Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: path monitoring route #296

Merged
65 changes: 64 additions & 1 deletion panos/network.py
Original file line number Diff line number Diff line change
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: Path Monitor failure condition set 'any' or 'all'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just missing the (str) type in this docstring.

preemptive_holdtime (int): Path Monitor Preemptive Hold Time in minutes

"""

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

def _setup(self):
# xpaths
Expand All @@ -1772,6 +1776,26 @@ def _setup(self):
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_holdtime", vartype="int", path="/path-monitor/hold-time"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change preemptive_holdtime to preemptive_hold_time (and in the docstring as well).

)
)

self._params = tuple(params)


Expand Down Expand Up @@ -1821,6 +1845,45 @@ def _setup(self):
self._params = tuple(params)


class PathMonitorDestination(VersionedPanObject):
"""PathMonitorDestination Static Route

Args:
name (str): Name of Path Monitor Destination
enabled (bool): Enable Path Monitor Destination
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to be enable not enabled down below, just need to tweak this docstring.

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)


class VirtualRouter(VsysOperations):
"""Virtual router

Expand Down