[rancid] Cisco 6k vss switches don't list all modules
Per-Olof Olsson
peo at chalmers.se
Thu Jan 10 13:22:23 UTC 2019
Hello
Found that "show modules" don't list all modules on vss joined switches.
Just list modules from "active" switch.
This is how I make it to work on vss switches I have access to.
C6807-XL and C6832-X running 15.4(1)SY4.
Added
"cisco;command;ios::ShowModule;show module switch;c6500 ios vss"
before "show module" to rancid.types.base and change some lines in ios.pm
to extract correct info.
$diff -C3 ios.pm.org ios.pm
*** ios.pm.org 2019-01-10 13:24:32.314276935 +0100
--- ios.pm 2019-01-10 13:26:16.863676437 +0100
***************
*** 1,8 ****
package ios;
##
! ## $Id: ios.pm.in 3842 2018-07-19 01:05:03Z heas $
##
! ## rancid 3.99.99
## Copyright (c) 1997-2018 by Henry Kilmer and John Heasley
## All rights reserved.
##
--- 1,8 ----
package ios;
##
! ## $Id: ios.pm.in 3842 2018-07-19 01:05:03Z heas $+
##
! ## rancid 3.99.99+
## Copyright (c) 1997-2018 by Henry Kilmer and John Heasley
## All rights reserved.
##
***************
*** 85,90 ****
--- 85,92 ----
our $I0;
our $DO_SHOW_VLAN;
+ our $vss_show_module; # Use "show module switch" on 6k VSS systems
+
@ISA = qw(Exporter rancid main);
#XXX @Exporter::EXPORT = qw($VERSION @commandtable %commands @commands);
***************
*** 116,121 ****
--- 118,124 ----
$I0 = 0;
$DO_SHOW_VLAN = 0;
+ $vss_show_module = 0; # Use "show module switch" on 6k VSS systems
# add content lines and separators
ProcessHistory("","","","!RANCID-CONTENT-TYPE: $devtype\n!\n");
ProcessHistory("COMMENTS","keysort","B0","!\n");
***************
*** 1877,1887 ****
my(@lines);
my($slot, $pa);
while (<$INPUT>) {
tr/\015//d;
! return if (/^\s*\^$/);
! last if (/online diag status/i);
last if (/^$prompt/);
next if (/^(\s*|\s*$cmd\s*)$/);
return(-1) if (/command authorization failed/i);
--- 1880,1900 ----
my(@lines);
my($slot, $pa);
+ my($switch, $switch_n);
+ if ($vss_show_module == 1) {
+ while (<$INPUT>) {
+ last if (/^$prompt/);
+ }
+ return(0);
+ }
while (<$INPUT>) {
tr/\015//d;
! next if (/^\s*\^$/);
! if (/online diag status/i) {
! $vss_show_module = 1;
! next;
! }
last if (/^$prompt/);
next if (/^(\s*|\s*$cmd\s*)$/);
return(-1) if (/command authorization failed/i);
***************
*** 1891,1907 ****
s/^$1\s{$len}//;
}
# match slot/card info line
if (/^ *(\d+)\s+(\d+)\s+(.*)\s+(\S+)\s+(\S+)\s*$/) {
! $lines[$1 * 1000] .= "!Slot $1: type $3, $2 ports\n!Slot $1: part $4, serial $5\n";
! $lines[$1 * 1000] =~ s/\s+,/,/g;
next;
}
# now match the Revs in the second paragraph of o/p and stick it in
# the array with the previous bits...grumble.
if (/^ *(\d+)\s+\S+\s+to\s+\S+\s+(\S+)\s+(\S*)\s+(\S+)(\s+\S+)?\s*$/) {
! $lines[$1 * 1000] .= "!Slot $1: hvers $2, firmware $3, sw $4\n";
! $lines[$1 * 1000] =~ s/\s+,/,/g;
next;
}
# grab the sub-modules, if any
--- 1904,1928 ----
s/^$1\s{$len}//;
}
+ # match Switch Number: 1 Role: Virtual Switch Active/Standby
+ if (/^ *Switch Number: *(\d) .*Virtual Switch\s+(\S+)/) {
+ $switch_n = $1;
+ $switch = "Sw$1 ";
+ ProcessHistory("Module","","","!Virtual Switch $1 is $2\n");
+ next;
+ }
+
# match slot/card info line
if (/^ *(\d+)\s+(\d+)\s+(.*)\s+(\S+)\s+(\S+)\s*$/) {
! $lines[$switch_n * 10000 + $1 * 1000] .= "!Slot ${switch}$1: type $3, $2 ports\n!Slot ${switch}$1:
part $4, serial $5\n";
! $lines[$switch_n * 10000 + $1 * 1000] =~ s/\s+,/,/g;
next;
}
# now match the Revs in the second paragraph of o/p and stick it in
# the array with the previous bits...grumble.
if (/^ *(\d+)\s+\S+\s+to\s+\S+\s+(\S+)\s+(\S*)\s+(\S+)(\s+\S+)?\s*$/) {
! $lines[$switch_n * 10000 + $1 * 1000] .= "!Slot ${switch}$1: hvers $2, firmware $3, sw $4\n";
! $lines[$switch_n * 10000 + $1 * 1000] =~ s/\s+,/,/g;
next;
}
# grab the sub-modules, if any
***************
*** 1909,1921 ****
my($idx);
$pa = 0 if ($1 != $slot);
$slot = $1;
! $idx = $1 * 1000 + $1 * 10 + $pa;
! $lines[$idx] .= "!Slot $1/$pa: type $2\n";
! $lines[$idx] .= "!Slot $slot/$pa: part $3, serial $4\n";
! $lines[$idx] .= "!Slot $slot/$pa: hvers $5\n";
$pa++;
}
}
foreach $slot (@lines) {
next if ($slot =~ /^\s*$/);
ProcessHistory("Module","","","$slot!\n");
--- 1930,1945 ----
my($idx);
$pa = 0 if ($1 != $slot);
$slot = $1;
! $idx = $switch_n * 10000 + $1 * 1000 + $1 * 10 + $pa;
! $lines[$idx] .= "!Slot ${switch}$1/$pa: type $2\n";
! $lines[$idx] .= "!Slot ${switch}$slot/$pa: part $3, serial $4\n";
! $lines[$idx] .= "!Slot ${switch}$slot/$pa: hvers $5\n";
$pa++;
}
}
+ if ( $switch_n != 0 ) {
+ ProcessHistory("Module","","","!\n");
+ }
foreach $slot (@lines) {
next if ($slot =~ /^\s*$/);
ProcessHistory("Module","","","$slot!\n");
===================================================
Also tested on WS-C4500X-32 cat4500e-universalk9.SPA.03.08.06.E.152-4.E6 using
"show modules" command for vss cluster.
Result after fix to my 6832-X switch.
==================================
...
!
!Virtual Switch 1 is Standby
!Virtual Switch 2 is Active
!
!Slot Sw1 1: type 6832-X-LE 32P SFP+ Multi-Rate (Hot), 40 ports
!Slot Sw1 1: part C6832-X-LE, serial xxxxx
!Slot Sw1 1: hvers 2.0, firmware 15.2(02r)SYS, sw 15.4(1)SY4
!
!Slot Sw1 1/0: type Policy Feature Card 4
!Slot Sw1 1/0: part C6840-X-LE-PFC, serial xxxxx
!Slot Sw1 1/0: hvers 1.0
!
!Slot Sw1 1/1: type Policy Feature Card 4
!Slot Sw1 1/1: part C6840-X-LE-PFC, serial xxxxx
!Slot Sw1 1/1: hvers 1.0
!
!Slot Sw2 1: type 6832-X-LE 32P SFP+ Multi-Rate (Active), 40 ports
!Slot Sw2 1: part C6832-X-LE, serial xxxxx
!Slot Sw2 1: hvers 2.0, firmware 15.2(02r)SYS, sw 15.4(1)SY4
!
!Slot Sw2 1/2: type Policy Feature Card 4
!Slot Sw2 1/2: part C6840-X-LE-PFC, serial xxxxx
!Slot Sw2 1/2: hvers 1.0
!
!Slot Sw2 1/3: type Policy Feature Card 4
!Slot Sw2 1/3: part C6840-X-LE-PFC, serial xxxxx
!Slot Sw2 1/3: hvers 1.0
!
...
raw output from "show module switch" and "show module"
===========================
...
vss-gw#show module switch
Switch Number: 1 Role: Virtual Switch Standby
---------------------- -----------------------------
Mod Ports Card Type Model Serial No.
--- ----- -------------------------------------- ------------------ -----------
1 40 6832-X-LE 32P SFP+ Multi-Rate (Hot) C6832-X-LE xxxxx
Mod MAC addresses Hw Fw Sw Status
--- ---------------------------------- ------ ------------ ------------ -------
1 706b.aaaa.4039 to 706b.aaaa.40a9 2.0 15.2(02r)SYS 15.4(1)SY4 Ok
Mod Sub-Module Model Serial Hw Status
---- --------------------------- ------------------ ----------- ------- -------
1 Policy Feature Card 4 C6840-X-LE-PFC xxxxx 1.0 Ok
1 Policy Feature Card 4 C6840-X-LE-PFC xxxxx 1.0 Ok
Mod Online Diag Status
---- -------------------
1 Pass
Switch Number: 2 Role: Virtual Switch Active
---------------------- -----------------------------
Mod Ports Card Type Model Serial No.
--- ----- -------------------------------------- ------------------ -----------
1 40 6832-X-LE 32P SFP+ Multi-Rate (Active) C6832-X-LE xxxxx
Mod MAC addresses Hw Fw Sw Status
--- ---------------------------------- ------ ------------ ------------ -------
1 006c.aaaa.fe51 to 006c.aaaa.fec1 2.0 15.2(02r)SYS 15.4(1)SY4 Ok
Mod Sub-Module Model Serial Hw Status
---- --------------------------- ------------------ ----------- ------- -------
1 Policy Feature Card 4 C6840-X-LE-PFC xxxxx 1.0 Ok
1 Policy Feature Card 4 C6840-X-LE-PFC xxxxx 1.0 Ok
Mod Online Diag Status
---- -------------------
1 Pass
vss-gw#show module
Mod Ports Card Type Model Serial No.
--- ----- -------------------------------------- ------------------ -----------
1 40 6832-X-LE 32P SFP+ Multi-Rate (Active) C6832-X-LE xxxxx
Mod MAC addresses Hw Fw Sw Status
--- ---------------------------------- ------ ------------ ------------ -------
1 006c.aaaa.fe51 to 006c.aaaa.fec1 2.0 15.2(02r)SYS 15.4(1)SY4 Ok
Mod Sub-Module Model Serial Hw Status
---- --------------------------- ------------------ ----------- ------- -------
1 Policy Feature Card 4 C6840-X-LE-PFC xxxxx 1.0 Ok
1 Policy Feature Card 4 C6840-X-LE-PFC xxxxx 1.0 Ok
Mod Online Diag Status
---- -------------------
1 Pass
vss-gw#
...
================================
Is there any other switch platforms using "show modules" in ios.pm that will interfere with this fix?
/Peo
----------------------------------------------------------
Per-Olof Olsson Email: peo at chalmers.se
Chalmers tekniska högskola IT-avdelningen
Sven Hultins gata 8 412 96 Göteborg
Tel: 031/772 6738 Mob: 0707 88 3708
----------------------------------------------------------
More information about the Rancid-discuss
mailing list