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

Hagen, Skye skyeh at uidaho.edu
Wed Aug 7 18:49:27 UTC 2013


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.

# 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);
}





More information about the Rancid-discuss mailing list