From a505626101e262be2cd5a8c74c44d3616c299519 Mon Sep 17 00:00:00 2001 From: Tar Committer Date: Wed, 23 Aug 2000 20:13:31 +0000 Subject: Imported from rancid-1.5.tar.gz. --- bin/rancid | 116 ++++++++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 92 insertions(+), 24 deletions(-) (limited to 'bin/rancid') diff --git a/bin/rancid b/bin/rancid index cd0cb8c..f283c7f 100755 --- a/bin/rancid +++ b/bin/rancid @@ -177,6 +177,10 @@ sub ShowVersion { $type = "AGS"; } elsif ( $1 eq "CSC4") { $type = "AGS+"; + } elsif ( $1 eq "2511" || $1 eq "2524" || $1 eq "AS2511-RJ") { + $type = "2500"; + } elsif ( $1 eq "3620" || $1 eq "3640") { + $type = "3600"; } elsif ( $1 eq "RSP7000") { $type = "7500"; } elsif ( $1 =~ /RSP\d/) { @@ -185,9 +189,9 @@ sub ShowVersion { $type = "7000"; } elsif ( $1 eq "RP") { $type = "7000"; - } elsif ( $1 eq "7202" || $1 eq "7204" || $1 eq "7206") { + } elsif ( $1 =~ /720[246]/) { $type = "7200"; - } elsif ($1 eq "12004/GRP" || $1 eq "12008/GRP" || $1 eq "12012/GRP") { + } elsif ($1 =~ /1200[48]\/GRP/ || $1 =~ /1201[26]\/GRP/) { $type = "12000"; } else { $type = $1; @@ -229,6 +233,16 @@ sub ShowVersion { "!Memory: pcmcia $2 slot$3 $1\n"); next; } + if(/^WARNING/) { + if (!defined($I0)) { + $I0=1; + ProcessHistory("COMMENTS","keysort","I0","!\n"); + } + ProcessHistory("COMMENTS","keysort","I1","! $_"); + # The line after the WARNING is what to do about it. + $_ = ; tr/\015//d; + ProcessHistory("COMMENTS","keysort","I1","! $_"); + } if (/^Configuration register is (.*)$/) { $config_register=$1; next; @@ -237,9 +251,24 @@ sub ShowVersion { return(0); } +# This routine parses "show install active" +sub ShowInstallActive { + print STDERR " In ShowInstallActive: $_" if ($debug); + + while () { + tr/\015//d; + last if (/^$prompt/); + next if (/^(\s*|\s*$cmd\s*)$/); + return(1) if /^\s*\^\s*$/; + return(1) if /Invalid input detected/; + ProcessHistory("COMMENTS","keysort","F5","!Image: $_") && next; + } + return(0); +} + # This routine parses "show env all" sub ShowEnv { - # Skip if this is not a 7500 or 7000. + # Skip if this is not a 7500, 7200, or 7000. print STDERR " In ShowEnv: $_" if ($debug); while () { @@ -306,7 +335,8 @@ sub ShowGSR { # This routine parses "show boot" sub ShowBoot { - # Pick up boot variables if 7000/7500/12000; otherwise pick up bootflash. + # Pick up boot variables if 7000/7200/7500/12000; + # otherwise pick up bootflash. print STDERR " In ShowBoot: $_" if ($debug); while () { @@ -321,7 +351,7 @@ sub ShowBoot { if (!defined($H0)) { $H0=1; ProcessHistory("COMMENTS","keysort","H0","!\n"); } - if ($type !~ /^(1200|7)/) { + if ($type !~ /^(120|7)/) { ProcessHistory("COMMENTS","keysort","H2","!BootFlash: $_"); } elsif (/variable/) { ProcessHistory("COMMENTS","keysort","H1","!Variable: $_"); @@ -340,7 +370,7 @@ sub ShowFlash { tr/\015//d; last if (/^$prompt/); next if (/^(\s*|\s*$cmd\s*)$/); - return(1) if ($type =~ /^(1200|7.0)/); + return(1) if ($type =~ /^(120|7)/); return(1) if /^\s*\^\s*$/; return(1) if /Invalid input detected/; ProcessHistory("FLASH","","","!Flash: $_"); @@ -360,9 +390,10 @@ sub DirSlotN { tr/\015//d; last if (/^$prompt/); next if (/^(\s*|\s*$cmd\s*)$/); - return(1) if ($type !~ /^(1200|7.0|36.0)/); + return(1) if ($type !~ /^(120|7|36)/); return(1) if /^\s*\^\s*$/; return(1) if /Invalid input detected/; + return(1) if /\%Error: No such file or directory/; return(1) if /No space information available/; return(-1) if /\%Error calling/; return(-1) if /: device being squeezed/; # Flash is busy @@ -382,7 +413,7 @@ sub ShowContAll { tr/\015//d; last if (/^$prompt/); next if (/^(\s*|\s*$cmd\s*)$/); - return(1) if ($type =~ /^(1200|7[05])/); + return(1) if ($type =~ /^(120|7[05])/); if (/^Interface ([^ \n(]*)/) { $INT = "$1, "; next; } /^(BRI unit \d)/ && ProcessHistory("INT","","","!Interface: $1\n") && next; @@ -393,10 +424,15 @@ sub ShowContAll { /(Media Type is \S+),/ && ProcessHistory("INT","","","!\t$1\n"); if (/(M\dT:) show controller:$/) { + my($ctlr) = $1; + $_ = ; tr/\015//d; s/ subunit \d,//; + ProcessHistory("INT","","","!Interface: $ctlr $_"); + } + if (/^(\S+) : show controller:$/) { my($ctlr) = $1; $_ = ; tr/\015//d; s/ subunit \d,//; - ProcessHistory("INT","","","!Interface: $ctlr $_"); - } + ProcessHistory("INT","","","!Interface: $ctlr: $_"); + } /^(HD unit \d), idb/ && ProcessHistory("INT","","","!Interface: $1\n") && next; /^HD unit \d, NIM/ && @@ -553,17 +589,17 @@ sub ShowDiagbus { return(0); } -# This routine parses "show diags" for the gsr, 7200, 3600 +# This routine parses "show diag" for the gsr, 7200, 3600, 2600. # This will create arrarys for hw info. -sub ShowDiags { +sub ShowDiag { # Skip if this is not a 12000. - print STDERR " In ShowDiags: $_" if ($debug); + print STDERR " In ShowDiag: $_" if ($debug); while () { tr/\015//d; last if (/^$prompt/); next if (/^(\s*|\s*$cmd\s*)$/); - return(1) if ($type !~ /^(1200|720|36.0)/); + return(1) if ($type !~ /^(120|720|36|26)/); /^$/ && next; if (!defined($showdiags)) {$showdiags=1; ProcessHistory("SLOT","","","!\n");} s/Port Packet Over SONET/POS/; @@ -606,9 +642,11 @@ sub ShowDiags { next; } # 7200 and 3600 stuff - if (/^(Slot) (\d+):/ || /^\s+(WIC) Slot (\d):/) { + if (/^(Slot)\s+(\d+):/ || /^\s+(WIC|VIC) Slot (\d):/) { if ($1 eq "WIC") { $WIC = "/$2"; + } elsif ($1 eq "VIC") { + $WIC = "/$2"; } else { $slot = $2; undef($WIC); @@ -620,8 +658,11 @@ sub ShowDiags { s/ with MII or RJ45/-TX/; s/Fast-ethernet /100Base/; s/[)(]//g; - /\s+(.*)\s+port adapter?,\s+(\d+)\s+/ && + /\s+(.*) port adapter,?\s+(\d+)\s+/i && ProcessHistory("SLOT","","","!Slot $slot: type $1, $2 ports\n"); + # I/O controller with no interfaces + /\s+(.*)\s+port adapter\s*$/i && + ProcessHistory("SLOT","","","!Slot $slot: type $1, 0 ports\n"); /\s+(.*)\s+daughter card(.*)$/ && ProcessHistory("SLOT","","","!Slot $slot$WIC: type $1$2\n"); /\s+(FT1)$/ && @@ -659,7 +700,7 @@ sub ShowC7200 { ProcessHistory("SLOT","","","!Slot Midplane: part $2, serial $1\n!\n"); next; } - if (/C7200 CPU EEPROM:/) { + if (/C720\d(VXR)? CPU EEPROM:/) { $_ = ; /revision\s+(\S+).*revision\s+(\S+)/ && ProcessHistory("SLOT","","","!Slot CPU: hvers $1 rev $2\n"); @@ -700,25 +741,50 @@ sub WriteTerm { /^ntp clock-period / && next; # kill ntp clock-period /^ length / && next; # kill length on serial lines /^ width / && next; # kill width on serial lines + /^ clockrate / && next; # kill clockrate on serial interfaces /^enable password / && ProcessHistory("ENABLE","","","!enable password \n") && next; - /^(username .*) password \d *(\S)\s*(.*)/ && + /^(username .*) password /&& ProcessHistory("USER","","","!$1 password \n") && next; /^\s*password / && ProcessHistory("LINE-PASS","","","! password \n") && next; /^\s*neighbor (\S*) password / && ProcessHistory("","","","! neighbor $1 password \n") && next; + /^(ip ftp password) / && + ProcessHistory("","","","!$1 \n") && next; + /^( ip ospf authentication-key) / && + ProcessHistory("","","","!$1 \n") && next; + /^( ip ospf message-digest-key \d+ md5) / && + ProcessHistory("","","","!$1 \n") && next; /fair-queue individual-limit/ && next; + # sort ip explicit-paths. + if (/^ip explicit-path name (\S+)/) { + my($key) = $1; + my($expath) = $_; + while () { + tr/\015//d; + last if (/^$prompt/); + last if (/^$prompt/ || ! /^(ip explicit-path name |[ !])/); + if (/^ip explicit-path name (\S+)/) { + ProcessHistory("EXPATH","keysort","$key","$expath"); + $key = $1; + $expath = $_; + } else { + $expath .= $_; + } + } + ProcessHistory("EXPATH","keysort","$key","$expath"); + } # sort route-maps - if (/^route-map ([^ ]+)/) { + if (/^route-map (\S+)/) { my($key) = $1; my($routemap) = $_; while () { tr/\015//d; last if (/^$prompt/ || ! /^(route-map |[ !])/); - if (/^route-map ([^ ]+)/) { + if (/^route-map (\S+)/) { ProcessHistory("ROUTEMAP","keysort","$key","$routemap"); $key = $1; $routemap = $_; @@ -804,6 +870,7 @@ sub DoNothing {print STDOUT;} # Main %commands=( 'show version' => "ShowVersion", + 'show install active' => "ShowInstallActive", 'show env all' => "ShowEnv", 'show gsr chassis' => "ShowGSR", 'show boot' => "ShowBoot", @@ -817,7 +884,7 @@ sub DoNothing {print STDOUT;} 'show controllers' => "ShowContAll", 'show controllers cbus' => "ShowContCbus", 'show diagbus' => "ShowDiagbus", - 'show diag' => "ShowDiags", + 'show diag' => "ShowDiag", 'show c7200' => "ShowC7200", 'write term' => "WriteTerm" ); @@ -825,6 +892,7 @@ sub DoNothing {print STDOUT;} # cmds is important (show version first and write term last). pita @commands=( "show version", + "show install active", "show env all", "show gsr chassis", "show boot", @@ -868,7 +936,7 @@ if ($file) { ProcessHistory("COMMENTS","keysort","B0","!\n"); ProcessHistory("COMMENTS","keysort","F0","!\n"); ProcessHistory("COMMENTS","keysort","G0","!\n"); -while() { +TOP: while() { tr/\015//d; if (/\#exit$/) { $clean_run=1; @@ -888,13 +956,13 @@ while() { if (! defined($commands{$cmd})) { print STDERR "found unexpected command - \"$cmd\"\n"; $clean_run = 0; - last; + last TOP; } $rval = &{$commands{$cmd}}; delete($commands{$cmd}); if ($rval == -1) { $clean_run = 0; - last; + last TOP; } } } -- cgit