patches and alternative enterasys/riverstone support
Andrew Fort
afort at choqolat.org
Tue Aug 12 06:48:42 UTC 2003
Hi folks,
I've recently found myself with some new devices to add to the
repository, which didn't have some things handled as originally expected
(thanks for the variance, cisco)..
The following patch for 'rancid' does the following:
- Identifies 4500s and 3550s as switches
- Gathers System, Motherboard and Power Supply serial numbers from
Cat3550 (and possibly others) (NOTE: on a 3550 the System S/N really is
usable with TAC, which is a real bonus ;).
- Gathers 3550 (and again, possibly other) redundant power supply status
info from the "show env all" output.
- Ignores "show vlan" output on 3550/4500 IOS switches(*).
(*) This really needs to be on a per-device configurable basis, which I
believe is coming to a future rancid release (i.e., different device
[groups] have different parser configuration and commands to run). The
reason is that this patch is suitable really only if you're using the
extended VLAN support (i.e., you have "vlan" configuration inside your
main running-configuration, rather than just stored in the
flash:vlan.dat file), whereas the "show vlan" output was included by
RANCID to allow for the 2900XL/3500XL switches where this info was not
available via the main configuration.
On the Enterasys/Riverstone front, I've had some luck patching "rscmd"
from the 'Quartz' package at http://www.nmops.org so that the -c option
allows multiple commands to be executed. Since it was originally
derived from clogin and is GPL, it should be suitable for inclusion
(except that it's been stripped back for a slightly different method of
usage and has less functionality than the current clogin derived
scripts). This works well, and appears to avoid the output buffering
issues seen with the other variants by doing 'expect "*"' to flush the
input before sending more back to the device. I still have some
features to add (last-resort password handling), but would appreciate if
I could get some folks to run my mods on their systems. It involves a
modded "rscmd" (from Quartz) and a modified rivrancid (i.e.,
:%s/rivlogin/rscmd/g).
--snip--
--- /home/afort/rancid-2.3.eft/bin/rancid.in Thu Jan 2 06:15:47 2003
+++ ./rancid Mon Aug 11 16:30:04 2003
@@ -1,4 +1,4 @@
-#!@PERLV_PATH@
+#!/usr/bin/perl
##
##
## Copyright (C) 1997-2001 by Henry Kilmer.
@@ -173,6 +173,8 @@
}
/^Serial Number:\s+(.*)$/ &&
ProcessHistory("COMMENTS","keysort","C1", "!$_") && next;
+ /^(System|Motherboard|Power supply) serial number:\s+(.*)$/ &&
+ ProcessHistory("COMMENTS","keysort","C1", "!$_") && next;
/^Activation Key:\s+(.*)$/ &&
ProcessHistory("COMMENTS","keysort","C2", "!$_") && next;
/^ROM: \d+ Bootstrap .*(Version.*)$/ &&
@@ -242,9 +244,15 @@
} elsif ( $proc =~ /WS-C29/) {
$type = "2900XL";
$device = "switch";
+ } elsif ( $proc =~ /WS-C3550/) {
+ $type = "3550";
+ $device = "switch";
} elsif ( $proc =~ /WS-C35/) {
$type = "3500XL";
$device = "switch";
+ } elsif ( $proc =~ /WS-C45/) {
+ $type = "4500";
+ $device = "switch";
} elsif ( $proc =~ /6000/) {
$type = "6000";
$device = "switch";
@@ -379,6 +387,8 @@
ProcessHistory("COMMENTS","keysort","E2","!Power: $1\n") &&
next;
/^\s*(redundant .*)/i &&
ProcessHistory("COMMENTS","keysort","E2","!Power: $1\n") &&
next;
+ /^\s*(RPS is .*)/i &&
+ ProcessHistory("COMMENTS","keysort","E2","!Power: $1\n") &&
next;
}
ProcessHistory("COMMENTS","","","!\n");
return(0);
@@ -928,6 +938,7 @@
last if (/^$prompt/);
next if (/^(\s*|\s*$cmd\s*)$/);
return(1) if /(Invalid input detected|Type help or )/;
+ return(1) if ($type =~ /^(3550|4500)$/);
#return(1) if ($type !~ /^(2900XL|3500XL|6000)$/);
return(-1) if (/command authorization failed/i);
# the pager can not be disabled per-session on the PIX
--snip--
-afort
More information about the Rancid-discuss
mailing list