[rancid] Rancid not collecting VLAN info on Cisco ME-3600

heasley heas at shrubbery.net
Thu Aug 15 22:18:29 UTC 2013


Thu, Aug 08, 2013 at 04:37:56PM +0000, Hagen, Skye:
> I agree, reversing the logic makes more sense. I knew there was a better answer than mine. For right now, I'll leave that to you for a future release. 

I think this works, but is based on rancid 3.0a2.

Index: lib/ios.pm.in
===================================================================
--- lib/ios.pm.in	(revision 2722)
+++ lib/ios.pm.in	(working copy)
@@ -1730,7 +1730,7 @@
 	    s/^$1\s{$len}//;
 	}
 
-	if (/^VTP Operating Mode\s+:\s+(Transparent|Server)/) {
+	if (/^VTP Operating Mode\s+:\s+(Client)/) {
 	    $DO_SHOW_VLAN = 1;
 	}
 	ProcessHistory("COMMENTS","keysort","I0","!VTP: $_");
@@ -1744,7 +1744,7 @@
     my($INPUT, $OUTPUT, $cmd) = @_;
     print STDERR "    In ShowVLAN: $_" if ($debug);
 
-    ($_ = <$INPUT>, return(1)) if (!$DO_SHOW_VLAN);
+    ($_ = <$INPUT>, return(1)) if ($DO_SHOW_VLAN);
 
     while (<$INPUT>) {
 	tr/\015//d;
@@ -1762,6 +1762,7 @@
 	    my($len) = length($1);
 	    s/^$1\s{$len}//;
 	}
+	return(0) if (/no virtual lans configured/i);
 
 	ProcessHistory("COMMENTS","keysort","IO","!VLAN: $_");
     }

> 
> Thanks, Skye.
> ________________________________________
> From: heasley <heas at shrubbery.net>
> Sent: Thursday, August 08, 2013 8:17 AM
> To: Hagen, Skye
> Cc: rancid-discuss at shrubbery.net
> Subject: Re: [rancid] Rancid not collecting VLAN info on Cisco ME-3600
> 
> Wed, Aug 07, 2013 at 06:49:27PM +0000, Hagen, Skye:
> > Rancid 2.3.6 does not collect VLAN information on a Cisco ME-3600 switch.
> > This is because the ME-3600 does not support VTP, and returns 'Invalid
> > command'. Rancid will only collect VLAN info on switches if the VTP mode
> > is transparent or server. The ShowVTP subroutine sets a flag
> > ($DO_SHOW_VLAN) if the VTP mode is server or transparent. The ShowVLAN
> > routine immediately returns if this flag is not set, bypassing the VLAN
> > info.
> >
> > My quick and dirty change was to set the flag in ShowVTP, if the type is
> > ME-3600. I do this before entering the while loop, so that the flag is set
> > before the subroutine exits because of the invalid command test. I'm not
> > sure that this is the best way to correct this, but it works in my
> > environment.
> 
> should the check really be the reversed?  if it _is_ a vtp client, skip
> show vlan.
> 
> > # This routine parses "show vtp status"
> > sub ShowVTP {
> >     print STDERR "    In ShowVTP: $_" if ($debug);
> >
> >     $DO_SHOW_VLAN = 1 if ($type =~ /^ME-3600X/); # ME-3600 doesn't support
> > VTP
> >     while (<INPUT>) {
> >         tr/\015//d;
> >         last if (/^$prompt/);
> >         next if (/^(\s*|\s*$cmd\s*)$/);
> >         return(1) if /^\s*\^\s*$/;
> >         return(1) if (/Line has invalid autocommand /);
> >         return(1) if (/(Invalid (input|command) detected|Type help or )/i);
> >         #return(1) if ($type !~ /^(2900XL|3500XL|6000)$/);
> >         return(-1) if (/command authorization failed/i);
> >         next if (/^Configuration last modified by/);
> >         # the pager can not be disabled per-session on the PIX
> >         if (/^(<-+ More -+>)/) {
> >             my($len) = length($1);
> >             s/^$1\s{$len}//;
> >         }
> >
> >         if (/^VTP Operating Mode\s+:\s+(Transparent|Server)/) {
> >             $DO_SHOW_VLAN = 1;
> >         }
> >         ProcessHistory("COMMENTS","keysort","I0","!VTP: $_");
> >     }
> >     ProcessHistory("COMMENTS","keysort","I0","!\n");
> >     return(0);
> > }
> >
> >
> >
> > _______________________________________________
> > Rancid-discuss mailing list
> > Rancid-discuss at shrubbery.net
> > http://www.shrubbery.net/mailman/listinfo.cgi/rancid-discuss


More information about the Rancid-discuss mailing list