diff options
Diffstat (limited to 'bin/rancid.in')
-rwxr-xr-x | bin/rancid.in | 50 |
1 files changed, 27 insertions, 23 deletions
diff --git a/bin/rancid.in b/bin/rancid.in index d8b3694..45a8563 100755 --- a/bin/rancid.in +++ b/bin/rancid.in @@ -1,7 +1,7 @@ #!@PERLV_PATH@ ## ## -## Copyright (C) 1997 by Henry Kilmer. +## Copyright (C) 1997-2001 by Henry Kilmer. ## All rights reserved. ## ## This software may be freely copied, modified and redistributed without @@ -304,7 +304,7 @@ sub ShowEnv { tr/\015//d; last if (/^$prompt/); next if (/^(\s*|\s*$cmd\s*)$/); - return(1) if ($type !~ /^7/); + #return(1) if ($type !~ /^7/); return(-1) if (/command authorization failed/i); if (!defined($E0)) { $E0=1; @@ -330,7 +330,7 @@ sub ShowEnv { } # This routine parses "show gsr chassis-info" for the gsr -# This will create arrarys for hw info. +# This will create arrays for hw info. sub ShowGSR { # Skip if this is not a 1200n. print STDERR " In ShowGSR: $_" if ($debug); @@ -340,7 +340,7 @@ sub ShowGSR { last if (/^$prompt/); next if (/^(\s*|\s*$cmd\s*)$/); return(-1) if (/command authorization failed/i); - return(1) if ($type !~ /^120/); + # return(1) if ($type !~ /^12[40]/); /^$/ && next; /^\s+Chassis: type (\S+) Fab Ver: (\S+)/ && ProcessHistory("COMMENTS","keysort","D0","!\n") && @@ -383,7 +383,7 @@ sub ShowBoot { if (!defined($H0)) { $H0=1; ProcessHistory("COMMENTS","keysort","H0","!\n"); } - if ($type !~ /^(120|7)/) { + if ($type !~ /^(12[04]|7)/) { if ($type !~ /^(29|35)00/) { ProcessHistory("COMMENTS","keysort","H2","!BootFlash: $_"); } else { @@ -399,14 +399,15 @@ sub ShowBoot { # This routine parses "show flash" sub ShowFlash { - # skip if this is 7000, 7200, 7500, or 12000. + # skip if this is 7000, 7200, 7500, or 12000; else we end up with + # redundant data from dir /all slot0: print STDERR " In ShowFlash: $_" if ($debug); while (<INPUT>) { tr/\015//d; last if (/^$prompt/); next if (/^(\s*|\s*$cmd\s*)$/); - return(1) if ($type =~ /^(120|7)/); + return(1) if ($type =~ /^(12[40]|7)/); return(-1) if (/command authorization failed/i); return(1) if /^\s*\^\s*$/; return(1) if /(Invalid input detected|Type help or )/; @@ -427,9 +428,10 @@ sub DirSlotN { tr/\015//d; last if (/^$prompt/); next if (/^(\s*|\s*$cmd\s*)$/); - return(1) if ($type !~ /^(120|7|36)/); + # return(1) if ($type !~ /^(12[40]|7|36)/); return(1) if /^\s*\^\s*$/; return(1) if /(Invalid input detected|Type help or )/; + return(1) if /No such device/i; return(1) if /\%Error: No such file or directory/; return(1) if /No space information available/; return(-1) if /\%Error calling/; @@ -451,7 +453,7 @@ sub ShowContAll { tr/\015//d; last if (/^$prompt/); next if (/^(\s*|\s*$cmd\s*)$/); - return(1) if ($type =~ /^(120|7[05])/); + # return(1) if ($type =~ /^(12[40]|7[05])/); return(-1) if (/command authorization failed/i); if (/^Interface ([^ \n(]*)/) { $INT = "$1, "; next; } /^(BRI unit \d)/ && @@ -462,7 +464,7 @@ sub ShowContAll { ProcessHistory("INT","","","!Interface: $1\n") && next; /(Media Type is \S+),/ && ProcessHistory("INT","","","!\t$1\n"); - if (/(M\dT:) show controller:$/) { + if (/(M\dT[^ :]*:) show controller:$/) { my($ctlr) = $1; $_ = <INPUT>; tr/\015//d; s/ subunit \d,//; ProcessHistory("INT","","","!Interface: $ctlr $_"); @@ -509,7 +511,7 @@ sub ShowContCbus { tr/\015//d; last if (/^$prompt/); next if (/^(\s*|\s*$cmd\s*)$/); - return(1) if ($type !~ /^7[05]0/); + #return(1) if ($type !~ /^7[05]0/); return(-1) if (/command authorization failed/i); if (/^\s*slot(\d+): ([^,]+), hw (\S+), sw (\S+), ccb/) { $slot = $1; @@ -554,7 +556,7 @@ sub ShowDiagbus { tr/\015//d; last if (/^$prompt/); next if (/^(\s*|\s*$cmd\s*)$/); - return(1) if ($type !~ /^7[05]/); + #return(1) if ($type !~ /^7[05]/); return(-1) if (/command authorization failed/i); if (/^\s*Slot (\d+):/i) { $slot = $1; @@ -615,11 +617,11 @@ sub ShowDiagbus { } next; } - /\s+(.*) PA, (\d) ports?, (\S+)/ && - ProcessHistory("SLOT","","","!Slot $slot/$board: type $3, $2 ports\n") && + /\s+(.*) (IP|PA), (\d) ports?, (\S+)/ && + ProcessHistory("SLOT","","","!Slot $slot/$board: type $4, $3 ports\n") && next; - /\s+(.*) PA( \(\S+\))?, (\d) ports?/ && - ProcessHistory("SLOT","","","!Slot $slot/$board: type $1$2, $3 ports\n") && + /\s+(.*) (IP|PA)( \(\S+\))?, (\d) ports?/ && + ProcessHistory("SLOT","","","!Slot $slot/$board: type $1$3, $4 ports\n") && next; /^\s*HW rev (\S+), Board revision (\S+)/ && ProcessHistory("SLOT","","","!Slot $slot/$board: hvers $1 rev $2\n") && @@ -640,7 +642,7 @@ sub ShowDiag { tr/\015//d; last if (/^$prompt/); next if (/^(\s*|\s*$cmd\s*)$/); - return(1) if ($type !~ /^(120|720|36|26)/); + # return(1) if ($type !~ /^(12[40]|720|36|26)/); return(-1) if (/command authorization failed/i); /^$/ && next; if (!defined($showdiags)) {$showdiags=1; ProcessHistory("SLOT","","","!\n");} @@ -744,12 +746,14 @@ sub ShowModule { next if (/^(\s*|\s*$cmd\s*)$/); return(-1) if (/command authorization failed/i); - # match slot info line, slot info then the rev info (the two are split) - if (/^ ?(\d+)\s+(\d+)\s+(.*)\s+(\S+)\s+(\S+)\s*$/) { + # match slot/card info line + if (/^ *(\d+)\s+(\d+)\s+(.*)\s+(\S+)\s+(\S+)\s*$/) { $lines[$1] .= "!Slot $1: type $3, $2 ports\n!Slot $1: part $4, serial $5\n"; $lines[$1] =~ s/\s+,/,/g; } - if (/^ ?(\d+)\s+\S+\s+to\s+\S+\s+(\S+)\s+(.*)\s+(\S+)\s*$/) { + # 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*$/) { $lines[$1] .= "!Slot $1: hvers $2, firmware $3, sw $4\n"; $lines[$1] =~ s/\s+,/,/g; } @@ -772,7 +776,7 @@ sub ShowC7200 { tr/\015//d; last if (/^$prompt/); next if (/^(\s*|\s*$cmd\s*)$/); - return(1) if ($type !~ /^72/); + #return(1) if ($type !~ /^72/); return(-1) if (/command authorization failed/i); /^$/ && next; if (/C7200 Midplane EEPROM:/) { @@ -807,7 +811,7 @@ sub ShowVTP { next if (/^(\s*|\s*$cmd\s*)$/); return(1) if /^\s*\^\s*$/; return(1) if /(Invalid input detected|Type help or )/; - return(1) if ($type !~ /^(2900XL|3500XL|6000)$/); + #return(1) if ($type !~ /^(2900XL|3500XL|6000)$/); return(-1) if (/command authorization failed/i); next if (/^Configuration last modified by/); if (/^VTP Operating Mode\s+:\s+(Transparent|Server)/) { @@ -830,7 +834,7 @@ sub ShowVLAN { last if (/^$prompt/); next if (/^(\s*|\s*$cmd\s*)$/); return(1) if /(Invalid input detected|Type help or )/; - return(1) if ($type !~ /^(2900XL|3500XL|6000)$/); + #return(1) if ($type !~ /^(2900XL|3500XL|6000)$/); return(-1) if (/command authorization failed/i); ProcessHistory("COMMENTS","keysort","IO","!VLAN: $_"); } |