Command Customization

hyperglass comes with built in support for the following platforms:

  • Cisco IOS & IOS-XE
  • Cisco IOS-XR
  • Juniper JunOS
  • Arista EOS
  • Huawei VRP
  • VyOS
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.

To define custom commands, add a commands.yaml file to your installation directory (/etc/hyperglass, ~/hyperglass).

Each command definition carries the following structure:

commands.yaml
command_name:
ipv4_default:
bgp_route: ...
bgp_aspath: ...
bgp_community: ...
ping: ...
traceroute: ...
ipv6_default:
bgp_route: ...
bgp_aspath: ...
bgp_community: ...
ping: ...
traceroute: ...
ipv4_vpn:
bgp_route: ...
bgp_aspath: ...
bgp_community: ...
ping: ...
traceroute: ...
ipv6_vpn:
bgp_route: ...
bgp_aspath: ...
bgp_community: ...
ping: ...
traceroute: ...

ipv4_default and ipv6_default reference the commands used in the default routing table/VRF, while ipv4_vpn and ipv6_vpn reference the commands used in any configured VRF. Every command will have the following keywords replaced:

KeywordDescription
{target}Query Target (IP address, community, AS Path).
{vrf}If it's a VRF query, the name of the VRF.

Overriding Built-In Commands

As an example, you could override the default Juniper bgp_route command for the default routing table like this:

commands.yaml
---
juniper:
ipv4_default:
bgp_route: "show route protocol bgp {target} terse"

If the NOS key (juniper, in this case) matches the supported platform key, only the command you specify will be overridden.

Adding a Custom Command Set

You can define any arbitrary set of commands to use for any supported device. When defining a custom command, you must define all commands, even if they're disabled in your configuration or otherwise unused.

commands.yaml
---
special_commands:
ipv4_default:
bgp_route: "show ip route {target}"
bgp_aspath: "show ip bgp as-path {target}"
bgp_community: "show ip bgp community {target}"
ping: "ping {target}"
traceroute: "traceroute {target}"
ipv6_default:
bgp_route: "show ipv6 route {target}"
bgp_aspath: "show ipv6 bgp as-path {target}"
bgp_community: "show ipv6 bgp community {target}"
ping: "ping6 {target}"
traceroute: "traceroute6 {target}"
ipv4_vpn:
bgp_route: "show ip route {target} vrf {vrf}"
bgp_aspath: "show ip bgp as-path {target} vrf {vrf}"
bgp_community: "show ip bgp community {target} vrf {vrf}"
ping: "ping {target} vrf {vrf}"
traceroute: "traceroute {target} vrf {vrf}"
ipv6_vpn:
bgp_route: "show ipv6 route {target} vrf {vrf}"
bgp_aspath: "show ipv6 bgp as-path {target} vrf {vrf}"
bgp_community: "show ipv6 bgp community {target} vrf {vrf}"
ping: "ping6 {target} vrf {vrf}"
traceroute: "traceroute6 {target} vrf {vrf}"

After adding the custom command to commands.yaml, reference its name under the device's commands: key in devices.yaml:

devices.yaml
---
routers:
- name: specialrouter01
commands: special_commands