Skip to content

Commit

Permalink
New templates: yamaha_show_environment, yamaha_show_ip_route (#865)
Browse files Browse the repository at this point in the history
  • Loading branch information
akira6592 authored Feb 3, 2021
1 parent cd0130e commit 3241a99
Show file tree
Hide file tree
Showing 8 changed files with 163 additions and 0 deletions.
3 changes: 3 additions & 0 deletions templates/index
Original file line number Diff line number Diff line change
Expand Up @@ -458,3 +458,6 @@ vyatta_vyos_show_interfaces.textfsm, .*, .*vyos.*, sh[[ow]] int[[erfaces]]
vyatta_vyos_show_arp.textfsm, .*, .*vyos.*, sh[[ow]] a[[rp]]

watchguard_firebox_show_arp.textfsm, .*, watchguard_firebox, sh[[ow]] arp

yamaha_show_environment.textfsm, .*, yamaha, sh[[ow]] en[[vironment]]
yamaha_show_ip_route.textfsm, .*, yamaha, sh[[ow]] ip ro[[ute]]
36 changes: 36 additions & 0 deletions templates/yamaha_show_environment.textfsm
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# You need to set "console character ascci".
Value BOOTROM (\S+)
Value VERSION (\S+)
Value SERIAL (\w+)
Value CPU_5_SEC (\d+)
Value CPU_1_MIN (\d+)
Value CPU_5_MIN (\d+)
Value MEMORY_USED (\d+)
Value FIRMWARE (\S+)
Value CONFIG_FILE (\S+)
Value DEFAULT_FIRMWARE (\S+)
Value DEFAULT_CONFIG_FILE (\S+)
Value BOOT_TIME (.+)
Value CURRENT_TIME (.+)
Value ELASPED_TIME (.+)
Value SECURITY_CLASS ([1-3])
Value FORGET (ON|OFF)
Value TELNET (ON|OFF)
Value INSIDE_TEMPERATURE (\d+)

Start
^.+\sBootROM\sVer\.${BOOTROM}
^.+\s+Rev\.${VERSION}\s+\(.+\)
^\s+main:.+serial=${SERIAL}\s+MAC-Address.+
^.+=([a-f0-9:]{17})
^CPU:\s+${CPU_5_SEC}%\(5sec\)\s+${CPU_1_MIN}%\(1min\)\s+${CPU_5_MIN}%\(5min\)\s+Memory:\s+${MEMORY_USED}%\s+used
^Packet-buffer:.+
^Firmware:\s${FIRMWARE}\s+Config\.\sfile:\s+${CONFIG_FILE}
^Default\sfirmware:\s${DEFAULT_FIRMWARE}\s+Default\sconfig\.\sfile:\s${DEFAULT_CONFIG_FILE}
^Boot\stime:\s+${BOOT_TIME}
^Current\stime:\s+${CURRENT_TIME}
^Elapsed\stime\sfrom\sboot:\s+${ELASPED_TIME}
^Security\sClass:\s+${SECURITY_CLASS},\s+FORGET:\s+${FORGET},\s+TELNET:\s+${TELNET}
^Inside\sTemperature\(C\.\):\s+${INSIDE_TEMPERATURE}
^\s*$$
^. -> Error
17 changes: 17 additions & 0 deletions templates/yamaha_show_ip_route.textfsm
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# You need to set "console character ascci".
Value NETWORK (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|default)
Value MASK (\d{1,2})
Value NEXTHOP_IP (\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|-)
Value NEXTHOP_IF (\S+)
Value PROTOCOL (\S+)
Value ADDITIONAL_INFO (\S*)

Start
^Destination\s+Gateway\s+Interface\s+Kind\s+Additional\s+Info -> Routes

Routes
^${NETWORK}(/${MASK})?\s+${NEXTHOP_IP}\s+${NEXTHOP_IF}\s+${PROTOCOL}\s+${ADDITIONAL_INFO} -> Record
^\s*$$
^. -> Error

EOF
1 change: 1 addition & 0 deletions tests/test_index_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"vyatta_vyos",
"vyos",
"watchguard_firebox",
"yamaha",
]
RE_TEMPLATE_OS = re.compile("^(" + "|".join(OS_CHOICES) + ")")

Expand Down
13 changes: 13 additions & 0 deletions tests/yamaha/show_environment/yamaha_show_environment.raw
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
RTX1200 BootROM Ver.1.01
RTX1200 Rev.10.01.71 (Thu Sep 29 15:08:40 2016)
main: RTX1200 ver=c0 serial=D12345678 MAC-Address=00:a0:de:aa:bb:11 MAC-Addr
ess=00:a0:de:aa:bb:22 MAC-Address=00:a0:de:aa:bb:33
CPU: 1%(5sec) 2%(1min) 3%(5min) Memory: 24% used
Packet-buffer: 0%(small) 0%(middle) 5%(large) 0%(huge) used
Firmware: exec1 Config. file: config1
Default firmware: exec0 Default config. file: config0
Boot time: 2021/01/24 12:32:36 +09:00
Current time: 2021/01/30 09:44:53 +09:00
Elapsed time from boot: 5days 21:12:17
Security Class: 1, FORGET: ON, TELNET: OFF
Inside Temperature(C.): 36
20 changes: 20 additions & 0 deletions tests/yamaha/show_environment/yamaha_show_environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
parsed_sample:
- bootrom: "1.01"
version: "10.01.71"
serial: "D12345678"
cpu_5_sec: "1"
cpu_1_min: "2"
cpu_5_min: "3"
memory_used: "24"
firmware: "exec1"
config_file: "config1"
default_firmware: "exec0"
default_config_file: "config0"
boot_time: "2021/01/24 12:32:36 +09:00"
current_time: "2021/01/30 09:44:53 +09:00"
elasped_time: "5days 21:12:17"
security_class: "1"
forget: "ON"
telnet: "OFF"
inside_temperature: "36"
11 changes: 11 additions & 0 deletions tests/yamaha/show_ip_route/yamaha_show_ip_route.raw
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Destination Gateway Interface Kind Additional Info.
default - PP[01] static
10.0.0.0/8 192.168.1.254 LAN2 static k(1)
10.0.0.0/8 192.168.1.253 LAN2 static w(0)
10.1.0.0/24 192.168.1.253 LAN2 OSPF cost=2
10.2.0.0/24 192.168.1.252 LAN2 OSPF cost=2
203.0.113.2/32 - PP[01] implicit
169.254.1.1/30 - TUNNEL[1] implicit
192.168.1.0/24 192.168.1.8 LAN2 implicit
192.168.100.0/24 192.168.100.1 LAN1 implicit
203.0.113.1/32 - PP[01] temporary
62 changes: 62 additions & 0 deletions tests/yamaha/show_ip_route/yamaha_show_ip_route.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
parsed_sample:
- network: "default"
mask: ""
nexthop_ip: "-"
nexthop_if: "PP[01]"
protocol: "static"
additional_info: ""
- network: "10.0.0.0"
mask: "8"
nexthop_ip: "192.168.1.254"
nexthop_if: "LAN2"
protocol: "static"
additional_info: "k(1)"
- network: "10.0.0.0"
mask: "8"
nexthop_ip: "192.168.1.253"
nexthop_if: "LAN2"
protocol: "static"
additional_info: "w(0)"
- network: "10.1.0.0"
mask: "24"
nexthop_ip: "192.168.1.253"
nexthop_if: "LAN2"
protocol: "OSPF"
additional_info: "cost=2"
- network: "10.2.0.0"
mask: "24"
nexthop_ip: "192.168.1.252"
nexthop_if: "LAN2"
protocol: "OSPF"
additional_info: "cost=2"
- network: "203.0.113.2"
mask: "32"
nexthop_ip: "-"
nexthop_if: "PP[01]"
protocol: "implicit"
additional_info: ""
- network: "169.254.1.1"
mask: "30"
nexthop_ip: "-"
nexthop_if: "TUNNEL[1]"
protocol: "implicit"
additional_info: ""
- network: "192.168.1.0"
mask: "24"
nexthop_ip: "192.168.1.8"
nexthop_if: "LAN2"
protocol: "implicit"
additional_info: ""
- network: "192.168.100.0"
mask: "24"
nexthop_ip: "192.168.100.1"
nexthop_if: "LAN1"
protocol: "implicit"
additional_info: ""
- network: "203.0.113.1"
mask: "32"
nexthop_ip: "-"
nexthop_if: "PP[01]"
protocol: "temporary"
additional_info: ""

0 comments on commit 3241a99

Please sign in to comment.