From 06e0e3c17f3ca1c56ebcb819048dd1d379d269a3 Mon Sep 17 00:00:00 2001 From: Lachlan Miskin Date: Thu, 17 Feb 2022 22:54:55 +1000 Subject: [PATCH] Improve cisco_ios show_standby --- .../templates/cisco_ios_show_standby.textfsm | 25 ++++- .../show_standby/cisco_ios_show_standby.yml | 9 ++ .../show_standby/cisco_ios_show_standby1.raw | 18 +++ .../show_standby/cisco_ios_show_standby1.yml | 32 ++++++ .../show_standby/cisco_ios_show_standby2.raw | 28 +++++ .../show_standby/cisco_ios_show_standby2.yml | 54 +++++++++ .../show_standby/cisco_ios_show_standby3.raw | 57 ++++++++++ .../show_standby/cisco_ios_show_standby3.yml | 106 ++++++++++++++++++ 8 files changed, 325 insertions(+), 4 deletions(-) create mode 100644 tests/cisco_ios/show_standby/cisco_ios_show_standby1.raw create mode 100644 tests/cisco_ios/show_standby/cisco_ios_show_standby1.yml create mode 100644 tests/cisco_ios/show_standby/cisco_ios_show_standby2.raw create mode 100644 tests/cisco_ios/show_standby/cisco_ios_show_standby2.yml create mode 100644 tests/cisco_ios/show_standby/cisco_ios_show_standby3.raw create mode 100644 tests/cisco_ios/show_standby/cisco_ios_show_standby3.yml diff --git a/ntc_templates/templates/cisco_ios_show_standby.textfsm b/ntc_templates/templates/cisco_ios_show_standby.textfsm index cb6e45d3ce..08d0e4d4d1 100644 --- a/ntc_templates/templates/cisco_ios_show_standby.textfsm +++ b/ntc_templates/templates/cisco_ios_show_standby.textfsm @@ -1,35 +1,52 @@ +Value INTERFACE (\S+) Value GROUP (\d+) Value VERSION (\d+) Value STATE (\w+) +Value STATE_CHANGES (\d+) +Value STATE_LAST_CHANGE (\S+) Value VIRTUAL_IP (\S+) +Value List SECONDARY_IPS (\S+) Value ACTIVE_VIRTUAL_MAC (\S+) Value LOCAL_VIRTUAL_MAC (\S+) Value HELLO_TIME (\d+) Value HOLD_TIME (\d+) Value AUTHENTICATION (\w+) Value PREEMPTION (\w+) -Value ACTIVE_ROUTER (\d+\.\d+\.\d+\.\d+|local) +Value ACTIVE_ROUTER (\d+\.\d+\.\d+\.\d+|local|unknown) Value ACTIVE_ROUTER_PRIORITY (\d+) Value ACTIVE_ROUTER_MAC (\S+) -Value STANDBY_ROUTER (\d+\.\d+\.\d+\.\d+|local) +Value STANDBY_ROUTER (\d+\.\d+\.\d+\.\d+|local|unknown) Value STANDBY_ROUTER_PRIORITY (\d+) Value PRIORITY (\d+) Value GROUP_NAME (\S+) +Value FLAGS (\S+) +Value TRACK_ITEM (\S+) +Value TRACK_TYPE (object|interface) +Value TRACK_STATE (\S+) +Value TRACK_DECREMENT_TIME (\d+) Start - ^.*Group\s+${GROUP}\s+\(version\s+${VERSION}\) + ^\S+ -> Continue.Record + ^\s*${INTERFACE}\s+-\s+Group\s+${GROUP}\s*(\(version\s+${VERSION}\))?$$ ^.*State\s+is\s+${STATE} ^.*Virtual\s+IP\s+address\s+is\s+${VIRTUAL_IP} + ^.*Secondary\s+virtual\s+IP\s+address\s+${SECONDARY_IPS} ^.*Active\s+virtual\s+MAC\s+address\s+is\s+${ACTIVE_VIRTUAL_MAC} ^.*Local\s+virtual\s+MAC\s+address\s+is\s+${LOCAL_VIRTUAL_MAC} ^.*Hello\s+time\s+${HELLO_TIME}.*hold\s+time\s+${HOLD_TIME} + ^.*Next\s+hello\s+sent\s+in.*secs ^.*Authentication\s+${AUTHENTICATION} ^.*Preemption\s+${PREEMPTION} ^.*Active\s+router\s+is\s+${ACTIVE_ROUTER}(,\s+priority\s+${ACTIVE_ROUTER_PRIORITY})? ^\s+MAC\s+address\s+is\s+${ACTIVE_ROUTER_MAC} ^.*Standby\s+router\s+is\s+${STANDBY_ROUTER}(,\s+priority\s+${STANDBY_ROUTER_PRIORITY})? ^.*Priority\s+${PRIORITY} - ^.*Group\s+name\s+is\s+"${GROUP_NAME}" -> Record + ^\s*Track\s+${TRACK_TYPE}(\s+${TRACK_ITEM})?(\(unknown\))?(\s+state\s+${TRACK_STATE}(\s+decrement\s+${TRACK_DECREMENT_TIME})?)? + ^.*${STATE_CHANGES}\s+state\s+(change|changes),\s+last\s+state\s+change\s+${STATE_LAST_CHANGE} + ^.*Group\s+name\s+is\s+"${GROUP_NAME}" + ^.*FLAGS:\s+${FLAGS} + ^.*IP\s+redundancy\s+name\s+is\s+\"${GROUP_NAME}\"(\s+\(default\))? # Capture time-stamp if vty line has command time-stamping turned on ^Load\s+for\s+ ^Time\s+source\s+is + ^. -> Error diff --git a/tests/cisco_ios/show_standby/cisco_ios_show_standby.yml b/tests/cisco_ios/show_standby/cisco_ios_show_standby.yml index 23f2ea7d71..fea56ab65d 100644 --- a/tests/cisco_ios/show_standby/cisco_ios_show_standby.yml +++ b/tests/cisco_ios/show_standby/cisco_ios_show_standby.yml @@ -17,3 +17,12 @@ parsed_sample: standby_router_priority: "" priority: "90" group_name: "hsrp-Vl50-50" + secondary_ips: [] + interface: "Vlan50" + state_changes: "1" + state_last_change: "10w3d" + flags: "" + track_item: "" + track_type: "" + track_state: "" + track_decrement_time: "" diff --git a/tests/cisco_ios/show_standby/cisco_ios_show_standby1.raw b/tests/cisco_ios/show_standby/cisco_ios_show_standby1.raw new file mode 100644 index 0000000000..d376da00d1 --- /dev/null +++ b/tests/cisco_ios/show_standby/cisco_ios_show_standby1.raw @@ -0,0 +1,18 @@ +Vlan76 - Group 76 + State is Standby + 4 state changes, last state change 27w0d + Virtual IP address is 128.88.163.190 + Secondary virtual IP address 128.88.8.129 + Secondary virtual IP address 128.88.8.190 + Secondary virtual IP address 128.88.163.158 + Secondary virtual IP address 192.168.73.94 + Active virtual MAC address is 0000.0c07.ac4c + Local virtual MAC address is 0000.0c07.ac4c (v1 default) + Hello time 3 sec, hold time 10 sec + Next hello sent in 1.840 secs + Authentication text, string "fweq12as" + Preemption enabled, delay min 180 secs, reload 300 secs + Active router is 128.88.163.163, priority 255 (expires in 9.648 sec) + Standby router is local + Priority 250 (configured 250) + Group name is "hsrp-Vl76-76" (default) diff --git a/tests/cisco_ios/show_standby/cisco_ios_show_standby1.yml b/tests/cisco_ios/show_standby/cisco_ios_show_standby1.yml new file mode 100644 index 0000000000..3201caa99a --- /dev/null +++ b/tests/cisco_ios/show_standby/cisco_ios_show_standby1.yml @@ -0,0 +1,32 @@ +--- +parsed_sample: + - interface: "Vlan76" + group: "76" + version: "" + state: "Standby" + state_changes: "4" + state_last_change: "27w0d" + virtual_ip: "128.88.163.190" + secondary_ips: + - "128.88.8.129" + - "128.88.8.190" + - "128.88.163.158" + - "192.168.73.94" + active_virtual_mac: "0000.0c07.ac4c" + local_virtual_mac: "0000.0c07.ac4c" + hello_time: "3" + hold_time: "10" + authentication: "text" + preemption: "enabled" + active_router: "128.88.163.163" + active_router_priority: "255" + active_router_mac: "" + standby_router: "local" + standby_router_priority: "" + priority: "250" + group_name: "hsrp-Vl76-76" + flags: "" + track_item: "" + track_type: "" + track_state: "" + track_decrement_time: "" diff --git a/tests/cisco_ios/show_standby/cisco_ios_show_standby2.raw b/tests/cisco_ios/show_standby/cisco_ios_show_standby2.raw new file mode 100644 index 0000000000..624a48d58e --- /dev/null +++ b/tests/cisco_ios/show_standby/cisco_ios_show_standby2.raw @@ -0,0 +1,28 @@ +Vlan53 - Group 53 (version 2) + State is Active + 2 state changes, last state change 5d11h + Virtual IP address is 10.65.19.1 + Active virtual MAC address is 0000.0c9f.f035 (MAC In Use) + Local virtual MAC address is 0000.0c9f.f035 (v2 default) + Hello time 1 sec, hold time 3 sec + Next hello sent in 0.656 secs + Authentication MD5, key-chain "HSRP-KEYS" + Preemption enabled + Active router is local + Standby router is unknown + Priority 110 (configured 110) + Group name is "hsrp-Vl53-53" (default) + FLAGS: 0/1 +Vlan700 - Group 1 + State is Active + 11 state changes, last state change 5d14h + Virtual IP address is 192.168.46.145 + Active virtual MAC address is 0000.0c07.ac01 + Local virtual MAC address is 0000.0c07.ac01 (v1 default) + Hello time 3 sec, hold time 10 sec + Next hello sent in 0.344 secs + Preemption disabled + Active router is local + Standby router is unknown + Priority 175 (configured 175) + IP redundancy name is "hsrp-Vl700-1" (default) \ No newline at end of file diff --git a/tests/cisco_ios/show_standby/cisco_ios_show_standby2.yml b/tests/cisco_ios/show_standby/cisco_ios_show_standby2.yml new file mode 100644 index 0000000000..85c9644151 --- /dev/null +++ b/tests/cisco_ios/show_standby/cisco_ios_show_standby2.yml @@ -0,0 +1,54 @@ +--- +parsed_sample: + - interface: "Vlan53" + group: "53" + version: "2" + state: "Active" + state_changes: "2" + state_last_change: "5d11h" + virtual_ip: "10.65.19.1" + secondary_ips: [] + active_virtual_mac: "0000.0c9f.f035" + local_virtual_mac: "0000.0c9f.f035" + hello_time: "1" + hold_time: "3" + authentication: "MD5" + preemption: "enabled" + active_router: "local" + active_router_priority: "" + active_router_mac: "" + standby_router: "unknown" + standby_router_priority: "" + priority: "110" + group_name: "hsrp-Vl53-53" + flags: "0/1" + track_item: "" + track_type: "" + track_state: "" + track_decrement_time: "" + - interface: "Vlan700" + group: "1" + version: "" + state: "Active" + state_changes: "1" + state_last_change: "5d14h" + virtual_ip: "192.168.46.145" + secondary_ips: [] + active_virtual_mac: "0000.0c07.ac01" + local_virtual_mac: "0000.0c07.ac01" + hello_time: "3" + hold_time: "10" + authentication: "" + preemption: "disabled" + active_router: "local" + active_router_priority: "" + active_router_mac: "" + standby_router: "unknown" + standby_router_priority: "" + priority: "175" + group_name: "hsrp-Vl700-1" + flags: "" + track_item: "" + track_type: "" + track_state: "" + track_decrement_time: "" diff --git a/tests/cisco_ios/show_standby/cisco_ios_show_standby3.raw b/tests/cisco_ios/show_standby/cisco_ios_show_standby3.raw new file mode 100644 index 0000000000..d2d6b3d66e --- /dev/null +++ b/tests/cisco_ios/show_standby/cisco_ios_show_standby3.raw @@ -0,0 +1,57 @@ +Vlan111 - Group 1 + State is Standby + 1 state change, last state change 26w2d + Virtual IP address is 192.168.77.62 + Active virtual MAC address is 0000.0c07.ac01 + Local virtual MAC address is 0000.0c07.ac01 (v1 default) + Hello time 3 sec, hold time 10 sec + Next hello sent in 0.704 secs + Preemption enabled, delay min 180 secs + Active router is 192.168.77.60, priority 255 (expires in 10.416 sec) + Standby router is local + Priority 255 (configured 255) + Track object 1 state Up decrement 60 + Group name is "hsrp-Vl111-1" (default) +BDI10 - Group 1 + State is Active + 14 state changes, last state change 17w6d + Track object 1 state Up + Virtual IP address is 203.57.147.1 + Active virtual MAC address is 0000.0c07.ac01 (MAC In Use) + Local virtual MAC address is 0000.0c07.ac01 (v1 default) + Hello time 3 sec, hold time 10 sec + Next hello sent in 1.040 secs + Preemption enabled, delay min 180 secs + Active router is local + Standby router is 203.57.147.3, priority 230 (expires in 10.240 sec) + Priority 240 (configured 240) + Group name is "hsrp-BD10-1" (default) + FLAGS: 1/1 +Vlan703 - Group 4 + State is Active + 11 state changes, last state change 5d14h + Virtual IP address is 172.23.40.9 + Active virtual MAC address is 0000.0c07.ac04 + Local virtual MAC address is 0000.0c07.ac04 (v1 default) + Hello time 3 sec, hold time 10 sec + Next hello sent in 0.340 secs + Preemption enabled, delay min 180 secs + Active router is local + Standby router is unknown + Priority 200 (configured 200) + Track interface Dialer0 state Up decrement 10 + IP redundancy name is "hsrp-Vl703-4" (default) +GigabitEthernet0/1.2951 - Group 1 (version 2) + State is Active + 2 state changes, last state change 3y37w + Virtual IP address is 111.222.230.17 + Active virtual MAC address is 0000.0c9f.f001 + Local virtual MAC address is 0000.0c9f.f001 (v2 default) + Hello time 3 sec, hold time 10 sec + Next hello sent in 2.720 secs + Preemption enabled, delay min 180 secs, reload 300 secs + Active router is local + Standby router is unknown + Priority 255 (configured 255) + Track object 1 (unknown) + Group name is "hsrp-Gi0/1.2951-1" (default) \ No newline at end of file diff --git a/tests/cisco_ios/show_standby/cisco_ios_show_standby3.yml b/tests/cisco_ios/show_standby/cisco_ios_show_standby3.yml new file mode 100644 index 0000000000..93a0428302 --- /dev/null +++ b/tests/cisco_ios/show_standby/cisco_ios_show_standby3.yml @@ -0,0 +1,106 @@ +--- +parsed_sample: + - interface: "Vlan111" + group: "1" + version: "" + state: "Standby" + state_changes: "1" + state_last_change: "26w2d" + virtual_ip: "192.168.77.62" + secondary_ips: [] + active_virtual_mac: "0000.0c07.ac01" + local_virtual_mac: "0000.0c07.ac01" + hello_time: "3" + hold_time: "10" + authentication: "" + preemption: "enabled" + active_router: "192.168.77.60" + active_router_priority: "255" + active_router_mac: "" + standby_router: "local" + standby_router_priority: "" + priority: "255" + group_name: "hsrp-Vl111-1" + flags: "" + track_item: "1" + track_type: "object" + track_state: "Up" + track_decrement_time: "60" + - interface: "BDI10" + group: "1" + version: "" + state: "Active" + state_changes: "4" + state_last_change: "17w6d" + virtual_ip: "203.57.147.1" + secondary_ips: [] + active_virtual_mac: "0000.0c07.ac01" + local_virtual_mac: "0000.0c07.ac01" + hello_time: "3" + hold_time: "10" + authentication: "" + preemption: "enabled" + active_router: "local" + active_router_priority: "" + active_router_mac: "" + standby_router: "203.57.147.3" + standby_router_priority: "230" + priority: "240" + group_name: "hsrp-BD10-1" + flags: "1/1" + track_item: "1" + track_type: "object" + track_state: "Up" + track_decrement_time: "" + - interface: "Vlan703" + group: "4" + version: "" + state: "Active" + state_changes: "1" + state_last_change: "5d14h" + virtual_ip: "172.23.40.9" + secondary_ips: [] + active_virtual_mac: "0000.0c07.ac04" + local_virtual_mac: "0000.0c07.ac04" + hello_time: "3" + hold_time: "10" + authentication: "" + preemption: "enabled" + active_router: "local" + active_router_priority: "" + active_router_mac: "" + standby_router: "unknown" + standby_router_priority: "" + priority: "200" + group_name: "hsrp-Vl703-4" + flags: "" + track_item: "Dialer0" + track_type: "interface" + track_state: "Up" + track_decrement_time: "10" + - interface: "GigabitEthernet0/1.2951" + group: "1" + version: "2" + state: "Active" + state_changes: "2" + state_last_change: "3y37w" + virtual_ip: "111.222.230.17" + secondary_ips: [] + active_virtual_mac: "0000.0c9f.f001" + local_virtual_mac: "0000.0c9f.f001" + hello_time: "3" + hold_time: "10" + authentication: "" + preemption: "enabled" + active_router: "local" + active_router_priority: "" + active_router_mac: "" + standby_router: "unknown" + standby_router_priority: "" + priority: "255" + group_name: "hsrp-Gi0/1.2951-1" + flags: "" + track_item: "1" + track_type: "object" + track_state: "" + track_decrement_time: ""