Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve cisco_ios show_standby #1091

Merged
merged 1 commit into from
Feb 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 21 additions & 4 deletions ntc_templates/templates/cisco_ios_show_standby.textfsm
Original file line number Diff line number Diff line change
@@ -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
9 changes: 9 additions & 0 deletions tests/cisco_ios/show_standby/cisco_ios_show_standby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: ""
18 changes: 18 additions & 0 deletions tests/cisco_ios/show_standby/cisco_ios_show_standby1.raw
Original file line number Diff line number Diff line change
@@ -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)
32 changes: 32 additions & 0 deletions tests/cisco_ios/show_standby/cisco_ios_show_standby1.yml
Original file line number Diff line number Diff line change
@@ -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: ""
28 changes: 28 additions & 0 deletions tests/cisco_ios/show_standby/cisco_ios_show_standby2.raw
Original file line number Diff line number Diff line change
@@ -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)
54 changes: 54 additions & 0 deletions tests/cisco_ios/show_standby/cisco_ios_show_standby2.yml
Original file line number Diff line number Diff line change
@@ -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: ""
57 changes: 57 additions & 0 deletions tests/cisco_ios/show_standby/cisco_ios_show_standby3.raw
Original file line number Diff line number Diff line change
@@ -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)
106 changes: 106 additions & 0 deletions tests/cisco_ios/show_standby/cisco_ios_show_standby3.yml
Original file line number Diff line number Diff line change
@@ -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: ""