some possible patches for rancid.in for consideration...
Roderick B. Greening
Roderick.Greening at gt.ca
Wed Jun 8 00:07:42 UTC 2005
Here are some patches I added to make things work a little better for my
equipment. Perhaps you may find some of them useful as well...
Especially interesting is the fix for the Cisco 1900 switches which
constantly have uninteresting diff lines show up due to the way the parser
deals with the "--More--" and blank lines to leaves behind. The fix was to
strip all blank lines from the 1900, except for legitimate ones used by the
motd banner.
Anyway, enjoy. If someone feels the fixes warrant inclusion in the next
release, please feel free to do so.
Thanks.
--- rancid-2.3.2a/bin/rancid.in 2005-03-29 20:08:41.000000000 -0330
+++ /usr/local/rancid/bin/rancid 2005-06-07 13:16:24.000000000 -0230
@@ -165,6 +165,11 @@
# PIX fail-over license
/^This PIX has an?\s+(.*)$/ &&
ProcessHistory("COMMENTS","keysort","C1", "!$_") && next;
+# BEGIN HACK - Add C1900 Version to COMMENTS
+ /^Version\s+(.*)/i &&
+ ProcessHistory("COMMENTS","keysort","F1", "!Image: Software:
$1\n") && next;
+# END HACK - Add C1900 Version to COMMENTS
+
/^(Cisco )?IOS .* Software,? \(([A-Za-z-0-9]*)\), .*Version\s+(.*)$/
&&
ProcessHistory("COMMENTS","keysort","F1",
"!Image:$slave Software: $2, $3\n") && next;
@@ -253,6 +258,10 @@
$type = "AGS";
} elsif ( $proc eq "CSC4") {
$type = "AGS+";
+# BEGIN HACK - Add a new Type - Cisco uBR Cable Modem
+ } elsif ( $proc eq "CM") {
+ $type = "uBR900";
+# END HACK - Add a new Type - Cisco uBR Cable Modem
} elsif ( $proc =~ /^(AS)?25[12][12]/) {
$type = "2500";
} elsif ( $proc =~ /261[01]/ || $proc =~ /262[01]/ ) {
@@ -597,6 +606,9 @@
last if (/^$prompt/);
next if (/^(\s*|\s*$cmd\s*)$/);
# return(1) if ($type !~ /^(12[40]|7|36)/);
+# BEGIN HACK - Remove uninteresting and always changing NVRAM junk on uBR
+ return(1) if ($type =~ /^(uBR)/) && ($dev =~ /^(nvram)/);
+# END HACK - Remove uninteresting and always changing NVRAM junk on uBR
return(1) if /^\s*\^\s*$/;
return(1) if /(Invalid input detected|Type help or )/;
return(1) if /(No such device|Error Sending Request)/i;
@@ -1187,6 +1199,9 @@
sub WriteTerm {
print STDERR " In WriteTerm: $_" if ($debug);
my($lineauto,$comment,$linecnt) = (0,0,0);
+# BEGIN HACK - C1900 Blank Line Fix - prevent constant diffs due to poor
cisco pager output
+ my($MYbanner) = (0);
+# END HACK - C1900 Blank Line Fix - prevent constant diffs due to poor
cisco pager output
while (<INPUT>) {
tr/\015//d;
@@ -1217,6 +1232,16 @@
# block above
/^! (Last configuration|NVRAM config last)/ && next;
+# BEGIN HACK - C1900 Blank Line Fix - prevent constant diffs due to poor
cisco pager output
+ if ($type == "1900") {
+ # Don't mess with the banner motd though...
+ $MYbanner = !$MYbanner if (//);
+ if (!$MYbanner) {
+ /^\n/ && next;
+ }
+ }
+# END HACK - C1900 Blank Line Fix - prevent constant diffs due to poor
cisco pager output
+
# skip consecutive comment lines to avoid oscillating extra comment
# line on some access servers. grrr.
if (/^!/) {
@@ -1232,6 +1257,9 @@
/^ntp clock-period / && next; # kill ntp clock-period
/^ length / && next; # kill length on serial lines
/^ width / && next; # kill width on serial lines
+# BEGIN HACK - Remove uninteresting and always changing "cable-modem
MAC-TIMER", etc
+ /^ cable-modem / && next; # band-aid for uBR 12.1.22c
+# END HACK - Remove uninteresting and always changing "cable-modem
MAC-TIMER", etc
$lineauto = 1 if /^ modem auto/;
/^ speed / && $lineauto && next; # kill speed on serial lines
/^ clockrate / && next; # kill clockrate on serial
interfaces
Roderick B. Greening, B.Sc.
Manager, Provisioning & Technical Support
Atlantic Region
group telecom, a Bell Canada Company
541 Kenmount Rd.
St. John's, NF
(709) 757-1328 (Office)
(709) 685-3681 (Mobile)
(709) 757-1201 (Fax)
rgreening at gt.ca
More information about the Rancid-discuss
mailing list