mirror of
https://github.com/checktheroads/hyperglass
synced 2024-05-11 05:55:08 +00:00
add TSNR support, closes #87
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
"""Validate command configuration variables."""
|
||||
|
||||
# Local
|
||||
from .tnsr import TNSRCommands
|
||||
from .vyos import VyosCommands
|
||||
from ..main import HyperglassModelExtra
|
||||
from .arista import AristaCommands
|
||||
@@ -14,14 +15,15 @@ from .mikrotik_routeros import MikrotikRouterOS
|
||||
from .mikrotik_switchos import MikrotikSwitchOS
|
||||
|
||||
_NOS_MAP = {
|
||||
"juniper": JuniperCommands,
|
||||
"cisco_ios": CiscoIOSCommands,
|
||||
"cisco_xr": CiscoXRCommands,
|
||||
"cisco_nxos": CiscoNXOSCommands,
|
||||
"arista": AristaCommands,
|
||||
"cisco_ios": CiscoIOSCommands,
|
||||
"cisco_nxos": CiscoNXOSCommands,
|
||||
"cisco_xr": CiscoXRCommands,
|
||||
"huawei": HuaweiCommands,
|
||||
"juniper": JuniperCommands,
|
||||
"mikrotik_routeros": MikrotikRouterOS,
|
||||
"mikrotik_switchos": MikrotikSwitchOS,
|
||||
"tnsr": TNSRCommands,
|
||||
"vyos": VyosCommands,
|
||||
}
|
||||
|
||||
@@ -36,7 +38,8 @@ class Commands(HyperglassModelExtra):
|
||||
cisco_nxos: CommandGroup = CiscoNXOSCommands()
|
||||
huawei: CommandGroup = HuaweiCommands()
|
||||
mikrotik_routeros: CommandGroup = MikrotikRouterOS()
|
||||
mikortik_switchos: CommandGroup = MikrotikSwitchOS()
|
||||
mikrotik_switchos: CommandGroup = MikrotikSwitchOS()
|
||||
tnsr: CommandGroup = TNSRCommands()
|
||||
vyos: CommandGroup = VyosCommands()
|
||||
|
||||
@classmethod
|
||||
|
||||
56
hyperglass/models/commands/tnsr.py
Normal file
56
hyperglass/models/commands/tnsr.py
Normal file
@@ -0,0 +1,56 @@
|
||||
"""Netgate TNSR Command Model."""
|
||||
|
||||
# Third Party
|
||||
from pydantic import StrictStr
|
||||
|
||||
# Local
|
||||
from .common import CommandSet, CommandGroup
|
||||
|
||||
|
||||
class _IPv4(CommandSet):
|
||||
"""Validation model for default VRF IPv4 commands."""
|
||||
|
||||
bgp_community: StrictStr = 'dataplane shell sudo vtysh -c "show bgp ipv4 unicast community {target}"'
|
||||
bgp_aspath: StrictStr = 'dataplane shell sudo vtysh -c "show bgp ipv4 unicast regexp {target}"'
|
||||
bgp_route: StrictStr = 'dataplane shell sudo vtysh -c "show bgp ipv4 unicast {target}"'
|
||||
ping: StrictStr = "ping {target} ipv4 source {source} count 5 timeout 1"
|
||||
traceroute: StrictStr = "traceroute {target} ipv4 source {source} timeout 1 waittime 1"
|
||||
|
||||
|
||||
class _IPv6(CommandSet):
|
||||
"""Validation model for default VRF IPv6 commands."""
|
||||
|
||||
bgp_community: StrictStr = 'dataplane shell sudo vtysh -c "show bgp ipv6 unicast community {target}"'
|
||||
bgp_aspath: StrictStr = 'dataplane shell sudo vtysh -c "show bgp ipv6 unicast regexp {target}"'
|
||||
bgp_route: StrictStr = 'dataplane shell sudo vtysh -c "show bgp ipv6 unicast {target}"'
|
||||
ping: StrictStr = "ping {target} ipv6 source {source} count 5 timeout 1"
|
||||
traceroute: StrictStr = "traceroute {target} ipv6 source {source} timeout 1 waittime 1"
|
||||
|
||||
|
||||
class _VPNIPv4(CommandSet):
|
||||
"""Validation model for non-default ipv6 commands."""
|
||||
|
||||
bgp_community: StrictStr = 'dataplane shell sudo vtysh -c "show bgp vrf {vrf} ipv4 unicast community {target}"'
|
||||
bgp_aspath: StrictStr = 'dataplane shell sudo vtysh -c "show bgp vrf {vrf} ipv4 unicast regexp {target}"'
|
||||
bgp_route: StrictStr = 'dataplane shell sudo vtysh -c "show bgp vrf {vrf} ipv4 unicast {target}"'
|
||||
ping: StrictStr = "dataplane shell ping -4 -c 5 -W 1 -I {vrf} -S {source} {target}"
|
||||
traceroute: StrictStr = "dataplane shell traceroute -4 -w 1 -q 1 -i {vrf} -s {source} {target}"
|
||||
|
||||
|
||||
class _VPNIPv6(CommandSet):
|
||||
"""Validation model for non-default ipv6 commands."""
|
||||
|
||||
bgp_community: StrictStr = 'dataplane shell sudo vtysh -c "show bgp vrf {vrf} ipv6 unicast community {target}"'
|
||||
bgp_aspath: StrictStr = 'dataplane shell sudo vtysh -c "show bgp vrf {vrf} ipv6 unicast regexp {target}"'
|
||||
bgp_route: StrictStr = 'dataplane shell sudo vtysh -c "show bgp vrf {vrf} ipv6 unicast {target}"'
|
||||
ping: StrictStr = "dataplane shell ping -6 -c 5 -W 1 -I {vrf} -S {source} {target}"
|
||||
traceroute: StrictStr = "dataplane shell traceroute -6 -w 1 -q 1 -i {vrf} -s {source} {target}"
|
||||
|
||||
|
||||
class TNSRCommands(CommandGroup):
|
||||
"""Validation model for default tnsr commands."""
|
||||
|
||||
ipv4_default: _IPv4 = _IPv4()
|
||||
ipv6_default: _IPv6 = _IPv6()
|
||||
ipv4_vpn: _VPNIPv4 = _VPNIPv4()
|
||||
ipv6_vpn: _VPNIPv6 = _VPNIPv6()
|
||||
Reference in New Issue
Block a user