[rancid] PATCH: Cisco C3825,3845: Fix parsing of show version

Michael Stefaniuc mstefani at redhat.com
Tue May 23 11:18:23 UTC 2006


Hello,

the Cisco C3825 and C3845 do not include the processor information in
show version:
Cisco 3845 (revision 1.0) with 223232K/38912K bytes of memory.

Therefor the parsing of that string fails and rancid won't include the
"Chassis type", "Memory: main" and "Processor ID" lines into the saved
configs.

The attached patch fixes this. I tested it against all our devices with
rancid type "cisco" and the patch dosn't introduce any regression.
Though your milleage may vary.

The patch applies both to rancid-2.3.1 and rancid-2.3.2a4 (with an
offset here).

bye
	michael
-- 
Michael Stefaniuc               Tel.: +49-711-96437-199
Sr. Network Engineer            Fax.: +49-711-96437-111
Red Hat GmbH                    Email: mstefani at redhat.com
Hauptstaetterstr. 58            http://www.redhat.de/
D-70178 Stuttgart
-------------- next part --------------
--- rancid.orig	2006-05-23 03:58:36.000000000 -0400
+++ rancid	2006-05-23 05:03:02.000000000 -0400
@@ -211,7 +211,7 @@
 	    next;
 	/^System image file is "([^\"]*)"$/ &&
 	    ProcessHistory("COMMENTS","keysort","F5","!Image: $1\n") && next;
-	if (/(\S+)\s+\((\S+)\)\s+processor.*with (\S+[kK]) bytes/) {
+	if (/(\S+)\s+(?:\((\S+)\)\s+processor\s+)?\(revision[^)]+\).*with (\S+[kK]) bytes/) {
 	    my($proc) = $1;
 	    my($cpu) = $2;
 	    my($mem) = $3;
@@ -256,6 +256,8 @@
 		$type = "3600";
 	    } elsif ( $proc =~ /^37/) {
 		$type = "3700";
+	    } elsif ( $proc =~ /^38/) {
+		$type = "3800";
 	    } elsif ( $proc eq "RSP7000") {
 		$type = "7500";
 	    } elsif ( $proc =~ /RSP\d/) {
@@ -299,7 +301,9 @@
 		"!Chassis type:$slave $proc - a $type $device\n");
 	    ProcessHistory("COMMENTS","keysort","B1",
 		"!Memory:$slave main $mem\n");
-	    ProcessHistory("COMMENTS","keysort","A3","!CPU:$slave $cpu$_$slaveslot\n");
+	    if (defined($cpu)) {
+		ProcessHistory("COMMENTS","keysort","A3","!CPU:$slave $cpu$_$slaveslot\n");
+	    }
 	    next;
 	}
 	if (/(\S+) Silicon\s*Switch Processor/) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://www.shrubbery.net/pipermail/rancid-discuss/attachments/20060523/8f03c883/attachment.bin 


More information about the Rancid-discuss mailing list