Skip to content

Commit

Permalink
feat: Add DHCP relay support
Browse files Browse the repository at this point in the history
Fixes #251 and begins work on #259.
  • Loading branch information
shinmog committed Mar 26, 2021
1 parent 81f2dd4 commit f60fbae
Showing 1 changed file with 78 additions and 0 deletions.
78 changes: 78 additions & 0 deletions panos/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -4958,3 +4958,81 @@ def _setup(self):
params.append(VersionedParamPath("disabled", vartype="yesno", path="disabled"))

self._params = tuple(params)


class Dhcp(VersionedPanObject):
"""DHCP config.
Args:
name (str): Interface name.
"""

SUFFIX = ENTRY
ROOT = Root.DEVICE

CHILDTYPES = ("network.DhcpRelay",)

def _setup(self):
# xpaths
self._xpaths.add_profile(value="/network/dhcp/interface")

# params
self._params = ()


class DhcpRelay(VersionedPanObject):
"""DHCP relay config.
Args:
enabled (bool): Enabled.
servers (list): Relay server IP addresses.
ipv6_enabled (bool): Enable DHCPv6 relay.
"""

SUFFIX = None
CHILDTYPES = ("network.DhcpRelayIpv6Address",)

def _setup(self):
# xpaths
self._xpaths.add_profile(value="/relay")

# params
params = []

params.append(
VersionedParamPath("enabled", vartype="yesno", path="ip/enabled"),
)
params.append(
VersionedParamPath("servers", vartype="member", path="ip/server"),
)
params.append(
VersionedParamPath("ipv6_enabled", vartype="yesno", path="ipv6/enabled"),
)

self._params = tuple(params)


class DhcpRelayIpv6Address(VersionedPanObject):
"""DHCP relay IPv6 address.
Args:
name (str): DHCP server IPv6 address.
interface (str): Outgoing interface when using an IPv6 multicast address for
the DHCPv6 server.
"""

SUFFIX = ENTRY
ROOT = Root.DEVICE

def _setup(self):
# xpaths
self._xpaths.add_profile(value="/ipv6/server")

params = []

params.append(VersionedParamPath("interface", path="interface"),)

self._params = tuple(params)

0 comments on commit f60fbae

Please sign in to comment.