Skip to content

Commit

Permalink
feat: Add static route path monitoring
Browse files Browse the repository at this point in the history
This adds static route path monitoring to both the static route class and the IPv6 static route class.  This
also adds a few new parameters to the static route classes themselves to control the path monitoring.

PR #296
  • Loading branch information
kevinhuy authored and shinmog committed May 6, 2021
1 parent 04e31df commit 7662496
Showing 1 changed file with 78 additions and 1 deletion.
79 changes: 78 additions & 1 deletion panos/network.py
Expand Up @@ -1742,10 +1742,14 @@ class StaticRoute(VersionedPanObject):
interface (str): Next hop interface
admin_dist (str): Administrative distance
metric (int): Metric (Default: 10)
enable_path_monitor (bool): Enable Path Monitor
failure_condition (str): Path Monitor failure condition set 'any' or 'all'
preemptive_hold_time (int): Path Monitor Preemptive Hold Time in minutes
"""

SUFFIX = ENTRY
CHILDTYPES = ("network.PathMonitorDestination",)

def _setup(self):
# xpaths
Expand All @@ -1771,6 +1775,23 @@ def _setup(self):
params.append(
VersionedParamPath("metric", default=10, vartype="int", path="metric")
)
params.append(
VersionedParamPath(
"enable_path_monitor", path="path-monitor/enable", vartype="yesno"
)
)
params.append(
VersionedParamPath(
"failure_condition",
values=("all", "any"),
path="path-monitor/failure-condition",
)
)
params.append(
VersionedParamPath(
"preemptive_hold_time", vartype="int", path="path-monitor/hold-time"
)
)

self._params = tuple(params)

Expand All @@ -1788,10 +1809,14 @@ class StaticRouteV6(VersionedPanObject):
interface (str): Next hop interface
admin_dist (str): Administrative distance
metric (int): Metric (Default: 10)
enable_path_monitor (bool): Enable Path Monitor
failure_condition (str): Path Monitor failure condition set 'any' or 'all'
preemptive_hold_time (int): Path Monitor Preemptive Hold Time in minutes
"""

SUFFIX = ENTRY
CHILDTYPES = ("network.PathMonitorDestination",)

def _setup(self):
# xpaths
Expand All @@ -1817,6 +1842,58 @@ def _setup(self):
params.append(
VersionedParamPath("metric", default=10, vartype="int", path="metric")
)
params.append(
VersionedParamPath(
"enable_path_monitor", path="path-monitor/enable", vartype="yesno"
)
)
params.append(
VersionedParamPath(
"failure_condition",
values=("all", "any"),
path="path-monitor/failure-condition",
)
)
params.append(
VersionedParamPath(
"preemptive_hold_time", vartype="int", path="path-monitor/hold-time"
)
)

self._params = tuple(params)


class PathMonitorDestination(VersionedPanObject):
"""PathMonitorDestination Static Route
Args:
name (str): Name of Path Monitor Destination
enable (bool): Enable Path Monitor Destination
source (str): Source ip of interface
destination (str): Destination ip
interval (int): Ping Interval (sec) (Default: 3)
count (int): Ping count (Default: 5)
"""

SUFFIX = ENTRY

def _setup(self):
# xpaths
self._xpaths.add_profile(value="/path-monitor/monitor-destinations")

# params
params = []

params.append(VersionedParamPath("enable", vartype="yesno", path="enable"))
params.append(VersionedParamPath("source", path="source"))
params.append(VersionedParamPath("destination", path="destination"))
params.append(
VersionedParamPath("interval", default=3, vartype="int", path="interval")
)
params.append(
VersionedParamPath("count", default=5, vartype="int", path="count")
)

self._params = tuple(params)

Expand Down

0 comments on commit 7662496

Please sign in to comment.