add VyOS support

This commit is contained in:
checktheroads 2020-07-04 19:30:46 -07:00
parent ef0bb6f33f
commit 013fdde8e7
5 changed files with 69 additions and 5 deletions

View file

@ -1,6 +1,6 @@
<div align="center">
<br/>
<img src="logo.png" width=300></img>
<img src="https://res.cloudinary.com/hyperglass/image/upload/v1593916013/logo.svg" width=300></img>
<br/>
<h3>The network looking glass that tries to make the internet better.</h3>
<br/>
@ -47,6 +47,7 @@ hyperglass is intended to make implementing a looking glass too easy not to do,
- Juniper JunOS
- Arista EOS
- Huawei
- VyOS
- FRRouting
- BIRD
- Configurable support for any other [supported platform](https://hyperglass.io/docs/platforms)

View file

@ -28,6 +28,11 @@ hyperglass comes with built in support for the following platforms:
- Juniper JunOS
- Arista EOS
- Huawei VRP
- VyOS
::: warning VyOS & VRFs
As of `vyos-1.3-rolling-202007050117` which is the latest release VyOS has been tested with hyperglass, VyOS does not support BGP or other dynamic routing protocols in a VRF. As such, the default BGP commands for VyOS **omit the VRF from the command**.
:::
Default commands for each of these network operating systems are built into hyperglass. However, you may override any of them or even add commands for another Network Operating System (NOS), as long as it's [supported](platforms). To define custom commands, add a `commands.yaml` file to your installation directory (`/etc/hyperglass`,
`~/hyperglass`). As an example, you could override the default Juniper `bgp_route` command for the default routing table like this:
@ -83,8 +88,7 @@ command_name:
You can also define your own arbitrary command groups, and reference them in your `devices.yaml` file. For example, if you wanted define a set of commands for a specific device to use, you could do it like this:
```yaml
# commands.yaml
```yaml title=commands.yaml
---
special_commands:
ipv4_default:
@ -101,8 +105,7 @@ You must define _all_ commands, even if they're disabled in your [configuration]
Then, in the device's definition in `devices.yaml`, reference the command set:
```yaml {5}
# devices.yaml
```yaml {5} title=devices.yaml
---
routers:
- name: specialrouter01

View file

@ -28,6 +28,7 @@ hyperglass was created with the lofty goal of benefiting the internet community
- Juniper JunOS
- Arista EOS
- Huawei
- VyOS
- FRRouting
- BIRD
- Configurable support for any other [supported platform](platforms.mdx)

View file

@ -2,6 +2,7 @@
# Project
from hyperglass.models import HyperglassModelExtra
from hyperglass.configuration.models.commands.vyos import VyosCommands
from hyperglass.configuration.models.commands.arista import AristaCommands
from hyperglass.configuration.models.commands.common import CommandGroup
from hyperglass.configuration.models.commands.huawei import HuaweiCommands
@ -17,6 +18,7 @@ _NOS_MAP = {
"cisco_nxos": CiscoNXOSCommands,
"arista": AristaCommands,
"huawei": HuaweiCommands,
"vyos": VyosCommands,
}
@ -29,6 +31,7 @@ class Commands(HyperglassModelExtra):
cisco_xr: CommandGroup = CiscoXRCommands()
cisco_nxos: CommandGroup = CiscoNXOSCommands()
huawei: CommandGroup = HuaweiCommands()
vyos: CommandGroup = VyosCommands()
@classmethod
def import_params(cls, input_params):

View file

@ -0,0 +1,56 @@
"""VyOS Command Model."""
# Third Party
from pydantic import StrictStr
# Project
from hyperglass.configuration.models.commands.common import CommandSet, CommandGroup
class _IPv4(CommandSet):
"""Validation model for non-default dual afi commands."""
bgp_route: StrictStr = "show ip bgp {target}"
bgp_aspath: StrictStr = 'show ip bgp regexp "{target}"'
bgp_community: StrictStr = "show ip bgp community {target}"
ping: StrictStr = "ping {target} count 5 interface {source}"
traceroute: StrictStr = "mtr -4 -G 1 -c 1 -w -o SAL -a {source} {target}"
class _IPv6(CommandSet):
"""Validation model for non-default ipv4 commands."""
bgp_route: StrictStr = "show ipv6 bgp {target}"
bgp_aspath: StrictStr = 'show ipv6 bgp regexp "{target}"'
bgp_community: StrictStr = "show ipv6 bgp community {target}"
ping: StrictStr = "ping {target} count 5 interface {source}"
traceroute: StrictStr = "mtr -6 -G 1 -c 1 -w -o SAL -a {source} {target}"
class _VPNIPv4(CommandSet):
"""Validation model for non-default ipv6 commands."""
bgp_route: StrictStr = "show ip bgp {target}"
bgp_aspath: StrictStr = 'show ip bgp regexp "{target}"'
bgp_community: StrictStr = "show ip bgp community {target}"
ping: StrictStr = "ping {target} count 5 vrf {vrf} interface {source}"
traceroute: StrictStr = "ip vrf exec {vrf} mtr -4 -G 1 -c 1 -w -o SAL -a {source} {target}"
class _VPNIPv6(CommandSet):
"""Validation model for non-default ipv6 commands."""
bgp_route: StrictStr = "show ipv6 bgp {target}"
bgp_aspath: StrictStr = 'show ipv6 bgp regexp "{target}"'
bgp_community: StrictStr = "show ipv6 bgp community {target}"
ping: StrictStr = "ping {target} count 5 interface {source}"
traceroute: StrictStr = "ip vrf exec {vrf} mtr -6 -G 1 -c 1 -w -o SAL -a {source} {target}"
class VyosCommands(CommandGroup):
"""Validation model for default juniper commands."""
ipv4_default: _IPv4 = _IPv4()
ipv6_default: _IPv6 = _IPv6()
ipv4_vpn: _VPNIPv4 = _VPNIPv4()
ipv6_vpn: _VPNIPv6 = _VPNIPv6()