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

bug fix for cisco_ios_show_redundancy #651

Closed
wants to merge 8 commits into from
Closed
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
173 changes: 91 additions & 82 deletions templates/cisco_ios_show_redundancy.textfsm
Original file line number Diff line number Diff line change
@@ -1,82 +1,91 @@
Value SYSTEM_UPTIME_DAYS (\d+)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mind fixing the files that remove & replace? This makes it hard to see what actually changed and bound to miss something when reviewing.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added Fields as optional - System uptime years, System uptime weeks, Active uptime years, Active uptime weeks, standby uptime years, Standby uptime weeks
Updated peer failed status on line 73. my first push let me know if you have questions

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is your OS you're editing in?

The line endings are what replacing all these files. If you're running linux, you can install dos2unix and run it against the files that are completely replaced rather than just showing your changes you made.

If you need help, I'm on our NTC public Slack as well.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

running on windows

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I think Windows is hijacking the line endings and causing this issue.

I will create a new PR that shows the actual changes and then tag you in it for these changes.

Value SYSTEM_UPTIME_HOURS (\d+)
Value SYSTEM_UPTIME_MINUTES (\d+)
Value SWITCHOVERS (\d+)
Value STANDBY_FAILURES (\d+)
Value LAST_SWITCHOVER_REASON (.+?)
Value HARDWARE_MODE (.+?)
Value CONFIGURED_REDUNDANCY_MODE (.+?)
Value OPERATING_REDUNDANCY_MODE (.+?)
Value MAINTENANCE_MODE (.+?)
Value COMMUNICATION_STATUS (.+?)
Value ACTIVE_SLOT (\d+)
Value ACTIVE_SOFTWARE_STATE (.+?)
Value ACTIVE_UPTIME_DAYS (\d+)
Value ACTIVE_UPTIME_HOURS (\d+)
Value ACTIVE_UPTIME_MINUTES (\d+)
Value ACTIVE_MAJOR_RELEASE (\d+)
Value ACTIVE_MINOR_RELEASE (\d+)
Value ACTIVE_MAINTENANCE_RELEASE (\S+)
Value ACTIVE_BOOT_DIRECTORY (\S+)
Value ACTIVE_BOOT_FILE (\S+)
Value ACTIVE_CONFIG_REGISTER (\S+)
Value STANDBY_SLOT (\d+)
Value STANDBY_SOFTWARE_STATE (.+?)
Value STANDBY_UPTIME_DAYS (\d+)
Value STANDBY_UPTIME_HOURS (\d+)
Value STANDBY_UPTIME_MINUTES (\d+)
Value STANDBY_MAJOR_RELEASE (\d+)
Value STANDBY_MINOR_RELEASE (\d+)
Value STANDBY_MAINTENANCE_RELEASE (\S+)
Value STANDBY_BOOT_DIRECTORY (\S+)
Value STANDBY_BOOT_FILE (\S+)
Value STANDBY_CONFIG_REGISTER (\S+)


Start
^Redundant\s+System\s+Information
^\s*-+\s*$$
^\s+Available\s+system\s+uptime\s*=\s*${SYSTEM_UPTIME_DAYS}\s+days,\s+${SYSTEM_UPTIME_HOURS}\s+hours,\s+${SYSTEM_UPTIME_MINUTES}\s+minutes\s*$$
^\s+Switchovers\s+system\s+experienced\s*=\s*${SWITCHOVERS}\s*$$
^\s+Standby\s+failures\s*=\s*${STANDBY_FAILURES}\s*$$
^\s+Last\s+switchover\s+reason\s*=\s*${LAST_SWITCHOVER_REASON}\s*$$
^\s+Hardware\s+Mode\s*=\s*${HARDWARE_MODE}\s*$$
^\s+Configured\s+Redundancy\s+Mode\s*=\s*${CONFIGURED_REDUNDANCY_MODE}\s*$$
^\s+Operating\s+Redundancy\s+Mode\s*=\s*${OPERATING_REDUNDANCY_MODE}\s*$$
^\s+Maintenance\s+Mode\s*=\s*${MAINTENANCE_MODE}\s*$$
^\s+Communications\s*=\s*${COMMUNICATION_STATUS}\s*$$
^\s+Current\s+Processor -> Current
# Capture time-stamp if vty line has command time-stamping turned on
^Load\s+for\s+
^Time\s+source\s+is
^\s*$$
^. -> Error

Current
^\s*-+\s*$$
^\s+Active\s+Location\s*=\s*slot\s+${ACTIVE_SLOT}\s*$$
^\s+Current\s+Software\s+state\s*=\s*${ACTIVE_SOFTWARE_STATE}\s*$$
^\s+Uptime\s+in\s+current\s+state\s*=\s*${ACTIVE_UPTIME_DAYS}\s+days,\s+${ACTIVE_UPTIME_HOURS}\s+hours,\s+${ACTIVE_UPTIME_MINUTES}\s+minutes\s*$$
^\s+Image\s+Version
^.+Version\s+${ACTIVE_MAJOR_RELEASE}\.${ACTIVE_MINOR_RELEASE}\(${ACTIVE_MAINTENANCE_RELEASE}\)
^.+[Cc][Ii][Ss][Cc][Oo]
^.+(?:Copyright|Compiled)
^\s+BOOT\s*=\s*${ACTIVE_BOOT_DIRECTORY}:${ACTIVE_BOOT_FILE}\s*$$
^\s+Configuration\s+register\s*=\s*${ACTIVE_CONFIG_REGISTER}\s*$$
^\s+Peer\s+Processor -> Peer
^\s*$$
^. -> Error

Peer
^\s*-+\s*$$
^\s+Standby\s+Location\s*=\s*slot\s+${STANDBY_SLOT}\s*$$
^\s+Current\s+Software\s+state\s*=\s*${STANDBY_SOFTWARE_STATE}\s*$$
^\s+Uptime\s+in\s+current\s+state\s*=\s*${STANDBY_UPTIME_DAYS}\s+days,\s+${STANDBY_UPTIME_HOURS}\s+hours,\s+${STANDBY_UPTIME_MINUTES}\s+minutes\s*$$
^\s+Image\s+Version
^.+Version\s+${STANDBY_MAJOR_RELEASE}\.${STANDBY_MINOR_RELEASE}\(${STANDBY_MAINTENANCE_RELEASE}\)
^.+[Cc][Ii][Ss][Cc][Oo]
^.+(?:Copyright|Compiled)
^\s+BOOT\s*=\s*${STANDBY_BOOT_DIRECTORY}:${STANDBY_BOOT_FILE}\s*$$
^\s+Configuration\s+register\s*=\s*${STANDBY_CONFIG_REGISTER}\s*$$
^\s*$$
^. -> Error
Value SYSTEM_UPTIME_YEARS (\d+)
Value SYSTEM_UPTIME_WEEKS (\d+)
Value SYSTEM_UPTIME_DAYS (\d+)
Value SYSTEM_UPTIME_HOURS (\d+)
Value SYSTEM_UPTIME_MINUTES (\d+)
Value SWITCHOVERS (\d+)
Value STANDBY_FAILURES (\d+)
Value LAST_SWITCHOVER_REASON (.+?)
Value HARDWARE_MODE (.+?)
Value CONFIGURED_REDUNDANCY_MODE (.+?)
Value OPERATING_REDUNDANCY_MODE (.+?)
Value MAINTENANCE_MODE (.+?)
Value COMMUNICATION_STATUS (.+?)
Value ACTIVE_SLOT (\S+)
Value ACTIVE_SOFTWARE_STATE (.+?)
Value ACTIVE_UPTIME_YEARS (\d+)
Value ACTIVE_UPTIME_WEEKS (\d+)
Value ACTIVE_UPTIME_DAYS (\d+)
Value ACTIVE_UPTIME_HOURS (\d+)
Value ACTIVE_UPTIME_MINUTES (\d+)
Value ACTIVE_MAJOR_RELEASE (\d+)
Value ACTIVE_MINOR_RELEASE (\d+)
Value ACTIVE_MAINTENANCE_RELEASE (\S+)
Value ACTIVE_BOOT_DIRECTORY (\S+)
Value ACTIVE_BOOT_FILE (\S+)
Value ACTIVE_CONFIG_REGISTER (\S+)
Value STANDBY_SLOT (\S+)
Value STANDBY_SOFTWARE_STATE (.+?)
Value STANDBY_UPTIME_YEARS (\d+)
Value STANDBY_UPTIME_WEEKS (\d+)
Value STANDBY_UPTIME_DAYS (\d+)
Value STANDBY_UPTIME_HOURS (\d+)
Value STANDBY_UPTIME_MINUTES (\d+)
Value STANDBY_MAJOR_RELEASE (\d+)
Value STANDBY_MINOR_RELEASE (\d+)
Value STANDBY_MAINTENANCE_RELEASE (\S+)
Value STANDBY_BOOT_DIRECTORY (\S+)
Value STANDBY_BOOT_FILE (\S+)
Value STANDBY_CONFIG_REGISTER (\S+)
Value STANDBY_STATUS (.+?)


Start
^Redundant\s+System\s+Information
^\s*-+\s*$$
^\s*Available\s+system\s+uptime\s*=\s*(${SYSTEM_UPTIME_YEARS}\s*year(s)?,)?\s*(${SYSTEM_UPTIME_WEEKS}\s*week(s)?,)?\s*(${SYSTEM_UPTIME_DAYS}\s*day(s)?,)?\s*(${SYSTEM_UPTIME_HOURS}\s*hour(s)?,)?\s*${SYSTEM_UPTIME_MINUTES}\s*minute(s)?\s*$$
^\s*Switchovers\s+system\s+experienced\s*=\s*${SWITCHOVERS}\s*$$
^\s*Standby\s+failures\s*=\s*${STANDBY_FAILURES}\s*$$
^\s*Last\s+switchover\s+reason\s*=\s*${LAST_SWITCHOVER_REASON}\s*$$
^\s*Hardware\s+Mode\s*=\s*${HARDWARE_MODE}\s*$$
^\s*Configured\s+Redundancy\s+Mode\s*=\s*${CONFIGURED_REDUNDANCY_MODE}\s*$$
^\s*Operating\s+Redundancy\s+Mode\s*=\s*${OPERATING_REDUNDANCY_MODE}\s*$$
^\s*Maintenance\s+Mode\s*=\s*${MAINTENANCE_MODE}\s*$$
^\s*Communications\s*=\s*${COMMUNICATION_STATUS}\s*$$
^\s*Current\s+Processor -> Current
# Capture time-stamp if vty line has command time-stamping turned on
^Load\s+for\s+
^Time\s+source\s+is
^\s*$$
^. -> Error

Current
^\s*-+\s*$$
^\s*Active\s+Location\s*=\s*slot\s+${ACTIVE_SLOT}\s*$$
^\s*Current\s+Software\s+state\s*=\s*${ACTIVE_SOFTWARE_STATE}\s*$$
^\s*Uptime\s+in\s+current\s+state\s*=\s*(${ACTIVE_UPTIME_YEARS}\s*year(s)?,)?\s*(${ACTIVE_UPTIME_WEEKS}\s*week(s)?,)?\s*(${ACTIVE_UPTIME_DAYS}\s*day(s)?,)?\s*(${ACTIVE_UPTIME_HOURS}\s*hour(s)?,)?\s*${ACTIVE_UPTIME_MINUTES}\s*minute(s)?\s*$$
^\s*Image\s+Version
^.+Version\s+${ACTIVE_MAJOR_RELEASE}\.${ACTIVE_MINOR_RELEASE}\(${ACTIVE_MAINTENANCE_RELEASE}\)
^.+[Cc][Ii][Ss][Cc][Oo]
^.*(?:Copyright|Compiled|CONFIG_FILE|BOOTLDR)
^\s*BOOT\s*=\s*${ACTIVE_BOOT_DIRECTORY}:${ACTIVE_BOOT_FILE}\s*$$
^\s*Configuration\s+register\s*=\s*${ACTIVE_CONFIG_REGISTER}\s*$$
^Peer\s*\(slot:\s*unavailable\)\s*\w*\s*\w*\s*\w*\s*\w*\s*\w\s*\w*\s*\w*\s*\w*\s*\w*\s*\'${STANDBY_STATUS}\'\s*state$$ -> EOF
^\s*Peer\s+Processor -> Peer
^\s*$$
^. -> Error

Peer
^\s*-+\s*$$
^\s*Standby\s+Location\s*=\s*slot\s+${STANDBY_SLOT}\s*$$
^\s*Current\s+Software\s+state\s*=\s*${STANDBY_SOFTWARE_STATE}\s*$$
^\s*Uptime\s+in\s+current\s+state\s*=\s*(${STANDBY_UPTIME_YEARS}\s*year(s)?,)?\s*(${STANDBY_UPTIME_WEEKS}\s*week(s)?,)?\s*(${STANDBY_UPTIME_DAYS}\s*day(s)?,)?\s*(${STANDBY_UPTIME_HOURS}\s*hour(s)?,)?\s*${STANDBY_UPTIME_MINUTES}\s*minute(s)?\s*$$
^\s*Image\s+Version
^.+Version\s+${STANDBY_MAJOR_RELEASE}\.${STANDBY_MINOR_RELEASE}\(${STANDBY_MAINTENANCE_RELEASE}\)
^.+[Cc][Ii][Ss][Cc][Oo]
^.*(?:Copyright|Compiled|CONFIG_FILE|BOOTLDR)
^\s*BOOT\s*=\s*${STANDBY_BOOT_DIRECTORY}:${STANDBY_BOOT_FILE}\s*$$
^\s*Configuration\s+register\s*=\s*${STANDBY_CONFIG_REGISTER}\s*$$
^\s*$$
^\s*Compiled\s*
^. -> Error
76 changes: 38 additions & 38 deletions tests/cisco_ios/show_redundancy/cisco_ios_show_redundancy.raw
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
Redundant System Information :
------------------------------
Available system uptime = 2 days, 2 hours, 39 minutes
Switchovers system experienced = 0
Standby failures = 0
Last switchover reason = none

Hardware Mode = Duplex
Configured Redundancy Mode = Stateful Switchover
Operating Redundancy Mode = Stateful Switchover
Maintenance Mode = Disabled
Communications = Up

Current Processor Information :
-------------------------------
Active Location = slot 1
Current Software state = ACTIVE
Uptime in current state = 2 days, 2 hours, 39 minutes
Image Version = Cisco Internetwork Operating System Software
IOS (tm) Catalyst 4000 L3 Switch Software (cat4000-I5S-M), Version 12.2(20)EWA(3
.92), CISCO INTERNAL USE ONLY ENHANCED PRODUCTION VERSION
Copyright (c) 1986-2004 by cisco Systems, Inc.
Compiled Wed 14-Jul-04 04:42 by esi
BOOT = bootflash:cat4000-i5s-mz.122_20_EWA_392,1
Configuration register = 0x2002

Peer Processor Information :
----------------------------
Standby Location = slot 2
Current Software state = STANDBY HOT
Uptime in current state = 2 days, 2 hours, 39 minutes
Image Version = Cisco Internetwork Operating System Software
IOS (tm) Catalyst 4000 L3 Switch Software (cat4000-I5S-M), Version 12.2(20)EWA(3
.92), CISCO INTERNAL USE ONLY ENHANCED PRODUCTION VERSION
Copyright (c) 1986-2004 by cisco Systems, Inc.
Compiled Wed 14-Jul-04 0
BOOT = bootflash:cat4000-i5s-mz.122_20_EWA_392,1
Configuration register = 0x2002
Comment on lines -1 to -38
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uploaded same data again

Redundant System Information :
------------------------------
Available system uptime = 2 days, 2 hours, 39 minutes
Switchovers system experienced = 0
Standby failures = 0
Last switchover reason = none
Hardware Mode = Duplex
Configured Redundancy Mode = Stateful Switchover
Operating Redundancy Mode = Stateful Switchover
Maintenance Mode = Disabled
Communications = Up
Current Processor Information :
-------------------------------
Active Location = slot 1
Current Software state = ACTIVE
Uptime in current state = 2 days, 2 hours, 39 minutes
Image Version = Cisco Internetwork Operating System Software
IOS (tm) Catalyst 4000 L3 Switch Software (cat4000-I5S-M), Version 12.2(20)EWA(3
.92), CISCO INTERNAL USE ONLY ENHANCED PRODUCTION VERSION
Copyright (c) 1986-2004 by cisco Systems, Inc.
Compiled Wed 14-Jul-04 04:42 by esi
BOOT = bootflash:cat4000-i5s-mz.122_20_EWA_392,1
Configuration register = 0x2002
Peer Processor Information :
----------------------------
Standby Location = slot 2
Current Software state = STANDBY HOT
Uptime in current state = 2 days, 2 hours, 39 minutes
Image Version = Cisco Internetwork Operating System Software
IOS (tm) Catalyst 4000 L3 Switch Software (cat4000-I5S-M), Version 12.2(20)EWA(3
.92), CISCO INTERNAL USE ONLY ENHANCED PRODUCTION VERSION
Copyright (c) 1986-2004 by cisco Systems, Inc.
Compiled Wed 14-Jul-04 0
BOOT = bootflash:cat4000-i5s-mz.122_20_EWA_392,1
Configuration register = 0x2002
77 changes: 42 additions & 35 deletions tests/cisco_ios/show_redundancy/cisco_ios_show_redundancy.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,42 @@
---
parsed_sample:
- system_uptime_days: "2"
system_uptime_hours: "2"
system_uptime_minutes: "39"
switchovers: "0"
standby_failures: "0"
last_switchover_reason: "none"
hardware_mode: "Duplex"
configured_redundancy_mode: "Stateful Switchover"
operating_redundancy_mode: "Stateful Switchover"
maintenance_mode: "Disabled"
communication_status: "Up"
active_slot: "1"
active_software_state: "ACTIVE"
active_uptime_days: "2"
active_uptime_hours: "2"
active_uptime_minutes: "39"
active_major_release: "12"
active_minor_release: "2"
active_maintenance_release: "20"
active_boot_directory: "bootflash"
active_boot_file: "cat4000-i5s-mz.122_20_EWA_392,1"
active_config_register: "0x2002"
standby_slot: "2"
standby_software_state: "STANDBY HOT"
standby_uptime_days: "2"
standby_uptime_hours: "2"
standby_uptime_minutes: "39"
standby_major_release: "12"
standby_minor_release: "2"
standby_maintenance_release: "20"
standby_boot_directory: "bootflash"
standby_boot_file: "cat4000-i5s-mz.122_20_EWA_392,1"
standby_config_register: "0x2002"
---
parsed_sample:
- system_uptime_years: ""
system_uptime_weeks: ""
system_uptime_days: "2"
system_uptime_hours: "2"
system_uptime_minutes: "39"
switchovers: "0"
standby_failures: "0"
last_switchover_reason: "none"
hardware_mode: "Duplex"
configured_redundancy_mode: "Stateful Switchover"
operating_redundancy_mode: "Stateful Switchover"
maintenance_mode: "Disabled"
communication_status: "Up"
active_slot: "1"
active_software_state: "ACTIVE"
active_uptime_years: ""
active_uptime_weeks: ""
active_uptime_days: "2"
active_uptime_hours: "2"
active_uptime_minutes: "39"
active_major_release: "12"
active_minor_release: "2"
active_maintenance_release: "20"
active_boot_directory: "bootflash"
active_boot_file: "cat4000-i5s-mz.122_20_EWA_392,1"
active_config_register: "0x2002"
standby_slot: "2"
standby_software_state: "STANDBY HOT"
standby_uptime_years: ""
standby_uptime_weeks: ""
standby_uptime_days: "2"
standby_uptime_hours: "2"
standby_uptime_minutes: "39"
standby_major_release: "12"
standby_minor_release: "2"
standby_maintenance_release: "20"
standby_boot_directory: "bootflash"
standby_boot_file: "cat4000-i5s-mz.122_20_EWA_392,1"
standby_config_register: "0x2002"
standby_status: ""
39 changes: 39 additions & 0 deletions tests/cisco_ios/show_redundancy/cisco_ios_show_redundancy2.raw
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
Redundant System Information :
------------------------------
Available system uptime = 1 hour, 22 minutes
Switchovers system experienced = 0
Standby failures = 0
Last switchover reason = none
Hardware Mode = Duplex
Configured Redundancy Mode = sso
Operating Redundancy Mode = sso
Maintenance Mode = Disabled
Communications = Up

Current Processor Information :
-------------------------------
Active Location = slot 1/5
Current Software state = ACTIVE
Uptime in current state = 1 hour, 22 minutes
Image Version = Cisco IOS Software, s2t54 Software (s2t54-ADVENTERPRISEK9-M), Version 15.5(1)SY4, RELEASE SOFTWARE (fc4)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2019 by Cisco Systems, Inc.
Compiled Mon 02-Sep-19 07:17 by prod_rel_team
BOOT = bootdisk:s2t54-adventerprisek9-mz.SPA.155-1.SY4.bin,1;
CONFIG_FILE =
BOOTLDR =
Configuration register = 0x2102

Peer Processor Information :
----------------------------
Standby Location = slot 2/5
Current Software state = STANDBY HOT
Uptime in current state = 19 minutes
Image Version = Cisco IOS Software, s2t54 Software (s2t54-ADVENTERPRISEK9-M), Version 15.5(1)SY4, RELEASE SOFTWARE (fc4)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2019 by Cisco Systems, Inc.
Compiled Mon 02-Sep-19 07:17 by prod_rel_team
BOOT = bootdisk:s2t54-adventerprisek9-mz.SPA.155-1.SY4.bin,1;
CONFIG_FILE =
BOOTLDR =
Configuration register = 0x2102
Loading