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:
15
README.md
15
README.md
@@ -39,16 +39,17 @@ hyperglass is intended to make implementing a looking glass too easy not to do,
|
||||
- Full IPv6 support
|
||||
- Customizable everything: features, theme, UI/API text, error messages, commands
|
||||
- Built in support for:
|
||||
- Arista EOS
|
||||
- BIRD
|
||||
- Cisco IOS-XR
|
||||
- Cisco IOS/IOS-XE
|
||||
- Cisco NX-OS
|
||||
- Cisco IOS-XR
|
||||
- Juniper JunOS
|
||||
- Arista EOS
|
||||
- Huawei
|
||||
- Mikrotik
|
||||
- VyOS
|
||||
- FRRouting
|
||||
- BIRD
|
||||
- Huawei
|
||||
- Juniper JunOS
|
||||
- Mikrotik
|
||||
- TNSR
|
||||
- VyOS
|
||||
- Configurable support for any other [supported platform](https://hyperglass.io/docs/platforms)
|
||||
- Optionally access devices via an SSH proxy/jump server
|
||||
- VRF support
|
||||
|
@@ -22,16 +22,17 @@ hyperglass was created with the lofty goal of benefiting the internet community
|
||||
- Full IPv6 support
|
||||
- Customizable everything: features, theme, UI/API text, error messages, commands
|
||||
- Built in support for:
|
||||
- Arista EOS
|
||||
- BIRD
|
||||
- Cisco IOS-XR
|
||||
- Cisco IOS/IOS-XE
|
||||
- Cisco NX-OS
|
||||
- Cisco IOS-XR
|
||||
- Juniper JunOS
|
||||
- Arista EOS
|
||||
- Huawei
|
||||
- Mikrotik
|
||||
- VyOS
|
||||
- FRRouting
|
||||
- BIRD
|
||||
- Huawei
|
||||
- Juniper JunOS
|
||||
- Mikrotik
|
||||
- TNSR
|
||||
- VyOS
|
||||
- Configurable support for any other [supported platform](platforms.mdx)
|
||||
- Optionally access devices via an SSH proxy/jump server
|
||||
- VRF support
|
||||
|
@@ -18,7 +18,7 @@ The following platforms use [hyperglass-agent](agent/installation.mdx) for conne
|
||||
|
||||
## SSH
|
||||
|
||||
The following platforms use [Netmiko](https://github.com/ktbyers/netmiko) for connection handling. When configuring the `nos` property of a device, use the value in the **Key** column.
|
||||
The following platforms use [Netmiko](https://github.com/ktbyers/netmiko) or [Scrapli](https://github.com/carlmontanari/scrapli) for connection handling. When configuring the `nos` property of a device, use the value in the **Key** column.
|
||||
|
||||
| Name | Key |
|
||||
| ------------------------- | --------------------- |
|
||||
@@ -92,6 +92,7 @@ The following platforms use [Netmiko](https://github.com/ktbyers/netmiko) for co
|
||||
| RAD ETX | `rad_etx` |
|
||||
| Ruckus/Brocade FastIron | `ruckus_fastiron` |
|
||||
| Ruijie OS | `ruijie_os` |
|
||||
| TNSR | `tnsr` |
|
||||
| Ubuiquiti EdgeRouter | `ubiquiti_edge` |
|
||||
| Ubuiquiti EdgeSwitch | `ubiquiti_edgeswitch` |
|
||||
| Vyatta VyOS | `vyatta_vyos` |
|
||||
|
@@ -66,6 +66,7 @@ SCRAPE_HELPERS = {
|
||||
"junos": "juniper",
|
||||
"ios": "cisco_ios",
|
||||
"mikrotik": "mikrotik_routeros",
|
||||
"tsnr": "tnsr",
|
||||
}
|
||||
|
||||
DRIVER_MAP = {
|
||||
@@ -75,6 +76,7 @@ DRIVER_MAP = {
|
||||
"cisco_xr": "scrapli",
|
||||
"cisco_nxos": "scrapli",
|
||||
"juniper": "scrapli",
|
||||
"tnsr": "scrapli",
|
||||
"frr": "hyperglass_agent",
|
||||
"bird": "hyperglass_agent",
|
||||
}
|
||||
|
@@ -5,7 +5,7 @@ https://github.com/carlmontanari/scrapli
|
||||
|
||||
# Standard Library
|
||||
import math
|
||||
from typing import Iterable
|
||||
from typing import Sequence
|
||||
|
||||
# Third Party
|
||||
from scrapli.driver import AsyncGenericDriver
|
||||
@@ -37,11 +37,17 @@ from hyperglass.configuration import params
|
||||
from .ssh import SSHConnection
|
||||
|
||||
SCRAPLI_DRIVER_MAP = {
|
||||
"arista_eos": AsyncEOSDriver,
|
||||
"cisco_ios": AsyncIOSXEDriver,
|
||||
"cisco_nxos": AsyncNXOSDriver,
|
||||
"cisco_xr": AsyncIOSXRDriver,
|
||||
"juniper": AsyncJunosDriver,
|
||||
"arista_eos": AsyncEOSDriver,
|
||||
"tnsr": AsyncGenericDriver,
|
||||
}
|
||||
|
||||
driver_global_args = {
|
||||
# Per-NOS driver keyword arguments
|
||||
"tnsr": {"comms_prompt_pattern": r"\S+\s\S+[\#\>]"},
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +61,7 @@ def _map_driver(nos: str) -> AsyncGenericDriver:
|
||||
class ScrapliConnection(SSHConnection):
|
||||
"""Handle a device connection via Scrapli."""
|
||||
|
||||
async def collect(self, host: str = None, port: int = None) -> Iterable:
|
||||
async def collect(self, host: str = None, port: int = None) -> Sequence:
|
||||
"""Connect directly to a device.
|
||||
|
||||
Directly connects to the router via Netmiko library, returns the
|
||||
@@ -73,6 +79,8 @@ class ScrapliConnection(SSHConnection):
|
||||
else:
|
||||
log.debug("Connecting directly to {}", self.device.name)
|
||||
|
||||
global_args = driver_global_args.get(self.device.nos, {})
|
||||
|
||||
driver_kwargs = {
|
||||
"host": host or self.device._target,
|
||||
"port": port or self.device.port,
|
||||
@@ -82,6 +90,7 @@ class ScrapliConnection(SSHConnection):
|
||||
"auth_strict_key": False,
|
||||
"ssh_known_hosts_file": False,
|
||||
"ssh_config_file": False,
|
||||
**global_args,
|
||||
}
|
||||
|
||||
if self.device.credential._method == "password":
|
||||
|
@@ -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()
|
2
hyperglass/ui/package.json
vendored
2
hyperglass/ui/package.json
vendored
@@ -27,7 +27,7 @@
|
||||
"emotion-theming": "^10.0.27",
|
||||
"framer-motion": "^1.10.0",
|
||||
"lodash": "^4.17.15",
|
||||
"next": "^9.5",
|
||||
"next": "^9.5.4",
|
||||
"react": "^16.13.1",
|
||||
"react-countdown": "^2.2.1",
|
||||
"react-dom": "^16.13.1",
|
||||
|
1204
hyperglass/ui/yarn.lock
vendored
1204
hyperglass/ui/yarn.lock
vendored
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user