[rancid] brocade vdx backups

Doug Hughes doug.hughes at keystonenap.com
Wed Apr 26 13:44:54 UTC 2017


I wrote a vdx-working module that I contributed back in Oct 2016, but
not sure what the current state of it is.

It works with rancid 3.4.1

Below is my etc/rancid.types.conf excerpt

as you can see, brcdvcs uses the a10login module which works fine (I
didn't feel like reinventing the wheel here, and that worked)

and I created a new bcrdvcs and bcrdicx type. You'll want to change the
rbridge-id's to match your stack members. I stopped short of trying to
invent something generic to solve this particular puzzle.


attached is the modified brocade.pm which gets called for vcs.

icx uses the ios module.


brcdicx;script;rancid -t brcdicx
brcdicx;login;clogin
brcdicx;module;ios
brcdicx;inloop;ios::inloop
brcdicx:command;rancid::RunCommmand;skip-page-display
brcdicx;command;ios::ShowVersion;show version
brcdicx;command;ios::WriteTerm;show chassis
brcdicx;command;ios::WriteTerm;show running-config

# Brocade VCS 10g/40g
brcdvcs;script;rancid -t brcdvcs
brcdvcs;login;a10login
brcdvcs;module;brocade
brcdvcs;inloop;brocade::inloop
brcdvcs;command;brocade::ShowVersion;show version all-partitions
brcdvcs;command;brocade::ShowLicense;show license
brcdvcs;command;brocade::ShowRasLicense;show logging raslog rbridge-id 11
brcdvcs;command;brocade::ShowRasLicense;show logging raslog rbridge-id 12
brcdvcs;command;brocade::ShowVcs;show vcs detail
brcdvcs;command;brocade::ShowVlan;show vlan brief
brcdvcs;command;brocade::ShowSnapshots;show config snapshot rbridge-id 1
brcdvcs;command;brocade::ShowFabric;show virtual-fabric status
brcdvcs;command;brocade::ShowFabric;show fabric all
brcdvcs;command;brocade::ShowSupport;show support
brcdvcs;command;brocade::ShowMonitor;show system monitor
brcdvcs;command;brocade::ShowConfig;show running-config



On 4/26/2017 9:23 AM, Erik Muller wrote:
> VDXes are a very different codebase than a lot of the other foundry/brocade
> gear, and they have a whole new set of quirks as a result.  IIRC the
> biggest annoyance for rancid is that they don't have an end-of-config marker.
>
> I've gotten it working for VDXes before, my version is here:
> https://github.com/ermuller/rancid-stuff
> I haven't tested it widely enough to try to integrate it properly upstream,
> but if you wanted to give that a try, I'd appreciate any feedback.
> -e
>
> On 4/25/17 23:57 , Ross [Eve IT] wrote:
>> Hello,
>>
>> I've been scratching my head for the last few days trying to figure out how
>> to get these backups working.
>> We have a working installation of rancid on debian jessie with no issues.
>> jessie backports.  3.6.2-2
>>
>> A combination of cisco and brocade kit, brocade (ICX series) uses the
>> foundry module just fine.
>>
>> However the VDX switches are just not backing up.
>> I've tried both foundry and cisco.
>>
>>
>> However I can login, issue commands, etc..
>>
>>
>> :~$ bin/clogin  10.65.65.13
>> 10.65.65.13
>> spawn ssh -x -l admin 10.65.65.13
>> admin at 10.65.65.13 <mailto:admin at 10.65.65.13>'s password:
>>
>> Welcome to the Brocade Network Operating System Software
>> admin connected from 10.0.250.18 using ssh on vdx11-1
>> vdx11-1#
>>
>>
>>
>>
>> :~$bin/clogin -c "show vcs" 10.65.65.13
>> 10.65.65.13
>> spawn ssh -x -l admin 10.65.65.13
>> admin at 10.65.65.13 <mailto:admin at 10.65.65.13>'s password:
>>
>> Welcome to the Brocade Network Operating System Software
>> admin connected from 10.0.250.18 using ssh on vdx11-1
>> vdx11-1#
>> vdx11-1# terminal length 0
>> Successfully set This Session Terminal Length to  0.
>> vdx11-1# terminal width 132
>> -----------------------^
>> syntax error: unknown argument.
>> vdx11-1#  show vcs
>> Config Mode    : Distributed
>> VCS Mode       : Logical Chassis
>> VCS ID         : 1
>> VCS GUID       : 54f28a13-7c4b-4516-8198-cafaf637b393
>> Total Number of Nodes           : 4
>> Rbridge-Id       WWN                            Management IP   VCS Status
>>       Fabric Status        HostName
>> --------------------------------------------------------------------------------------------------------------
>> 1               >12:02:52:EC:1A:38:22:4C*       10.65.65.10      Online    
>>       Online               vdx11-1
>> 2                12:01:5C:EC:1V:3C:F2:AS        10.65.65.11      Online    
>>       Online               vdx11-2
>> 3                12:04:50:EB:1A:34:E4:90        10.65.65.12      Online    
>>       Online               vdx12-1
>> 4                12:03:C4:F5:7C:3S:BA:54        10.65.65.14      Online    
>>       Online               vdx12-2
>> vdx11-1#exit
>> Connection to 10.65.65.13 closed.
>>
>>
>>
>> Logs;
>>
>>
>> starting: Wednesday 26 April 13:45:12 AEST 2017
>>
>> cvs add: `10.65.65.13' already exists, with version number 1.1
>> Added 10.65.65.13
>>
>>
>>
>> Trying to get all of the configs.
>> 10.65.65.13 <http://10.65.65.13>: missed cmd(s): all commands
>> 10.65.65.13 <http://10.65.65.13>: End of run not found
>> 10.65.65.13 flogin error: Error: TIMEOUT reached
>> !
>> =====================================
>> Getting missed routers: round 1.
>> 10.65.65.13 <http://10.65.65.13>: missed cmd(s): all commands
>> 10.65.65.13 <http://10.65.65.13>: End of run not found
>> 10.65.65.13 flogin error: Error: TIMEOUT reached
>> !
>> =====================================
>> Getting missed routers: round 2.
>> 10.65.65.13 <http://10.65.65.13>: missed cmd(s): all commands
>> 10.65.65.13 <http://10.65.65.13>: End of run not found
>> 10.65.65.13 flogin error: Error: TIMEOUT reached
>> !
>> =====================================
>> Getting missed routers: round 3.
>> 10.65.65.13 <http://10.65.65.13>: missed cmd(s): all commands
>> 10.65.65.13 <http://10.65.65.13>: End of run not found
>> 10.65.65.13 flogin error: Error: TIMEOUT reached
>> !
>> =====================================
>> Getting missed routers: round 4.
>> 10.65.65.13 <http://10.65.65.13>: missed cmd(s): all commands
>> 10.65.65.13 <http://10.65.65.13>: End of run not found
>> 10.65.65.13 flogin error: Error: TIMEOUT reached
>> !
>>
>> cvs diff: Diffing .
>> cvs diff: Diffing configs
>> cvs commit: Examining .
>> cvs commit: Examining configs
>> /var/lib/rancid/CVS/mel/router.db,v  <--  router.db
>> new revision: 1.4; previous revision: 1.3
>>
>> ending: Wednesday 26 April 13:53:02 AEST 2017
>>
>>
>> Any help greatly appreciated.
>> Thanks in advance !
>>
>>
>>
>> _______________________________________________
>> Rancid-discuss mailing list
>> Rancid-discuss at shrubbery.net
>> http://www.shrubbery.net/mailman/listinfo/rancid-discuss
>>
> _______________________________________________
> Rancid-discuss mailing list
> Rancid-discuss at shrubbery.net
> http://www.shrubbery.net/mailman/listinfo/rancid-discuss

-- 
Doug Hughes
Keystone NAP
Fairless Hills, PA
1.844.KEYBLOCK (539.2562) 	

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.shrubbery.net/pipermail/rancid-discuss/attachments/20170426/40abde74/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: keystone-nap.png
Type: image/png
Size: 3476 bytes
Desc: not available
URL: <http://www.shrubbery.net/pipermail/rancid-discuss/attachments/20170426/40abde74/attachment.png>
-------------- next part --------------
package brocade;
##
## $Id$
##
## rancid 3.4.1
## Copyright (c) 1997-2016 by Terrapin Communications, Inc.
## All rights reserved.
##
## This code is derived from software contributed to and maintained by
## Terrapin Communications, Inc. by Henry Kilmer, John Heasley, Andrew Partan,
## Pete Whiting, Austin Schutz, and Andrew Fort.
##
## Redistribution and use in source and binary forms, with or without
## modification, are permitted provided that the following conditions
## are met:
## 1. Redistributions of source code must retain the above copyright
##    notice, this list of conditions and the following disclaimer.
## 2. Redistributions in binary form must reproduce the above copyright
##    notice, this list of conditions and the following disclaimer in the
##    documentation and/or other materials provided with the distribution.
## 3. All advertising materials mentioning features or use of this software
##    must display the following acknowledgement:
##        This product includes software developed by Terrapin Communications,
##        Inc. and its contributors for RANCID.
## 4. Neither the name of Terrapin Communications, Inc. nor the names of its
##    contributors may be used to endorse or promote products derived from
##    this software without specific prior written permission.
## 5. It is requested that non-binding fixes and modifications be contributed
##    back to Terrapin Communications, Inc.
##
## THIS SOFTWARE IS PROVIDED BY Terrapin Communications, INC. AND CONTRIBUTORS
## ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
## TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
## PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COMPANY OR CONTRIBUTORS
## BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
## CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
## SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
## INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
## CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
## ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
## POSSIBILITY OF SUCH DAMAGE.
##
## It is the request of the authors, but not a condition of license, that
## parties packaging or redistributing RANCID NOT distribute altered versions
## of the etc/rancid.types.base file nor alter how this file is processed nor
## when in relation to etc/rancid.types.conf.  The goal of this is to help
## suppress our support costs.  If it becomes a problem, this could become a
## condition of license.
# 
#  The expect login scripts were based on Erik Sherk's gwtn, by permission.
# 
#  The original looking glass software was written by Ed Kern, provided by
#  permission and modified beyond recognition.
#
#  RANCID - Really Awesome New Cisco confIg Differ
#
#  brocade.pm - for Brocade ECS switches - doug.hughes at keystonenap.com

use 5.010;
use strict 'vars';
use warnings;
no warnings 'uninitialized';
require(Exporter);
our @ISA = qw(Exporter);

use rancid 3.4.1;

our $proc;
our $ios;
our $found_version;
our $found_env;
our $found_diag;
our $config_register;			# configuration register value

@ISA = qw(Exporter rancid main);
#XXX @Exporter::EXPORT = qw($VERSION @commandtable %commands @commands);

# load-time initialization
sub import {
    0;
}

# post-open(collection file) initialization
sub init {
    # XXX is this the right place for this?
    # XXX can the content line move to the lib?
    ProcessHistory("","","","!RANCID-CONTENT-TYPE: brocade\n!\n");

    0;
}

# main loop of input of device output
sub inloop {
    my($INPUT, $OUTPUT) = @_;
    my($cmd, $rval);

TOP: while(<$INPUT>) {
	tr/\015//d;
	if ((/\>\s?logout$/) || $found_end) {
	    $clean_run=1;
	    last;
	}
	if (/^Error:/) {
	    print STDOUT ("$host complogin error: $_");
	    print STDERR ("$host complogin error: $_") if ($debug);
	    $clean_run=0;
	    last;
	}
	while (/[#>]\s*($cmds_regexp)\s*$/) {
	    $cmd = $1;
	    if (!defined($prompt)) {
		$prompt = ($_ =~ /^([^#>]+[#>])/)[0];
		$prompt =~ s/([][}{)(\\])/\\$1/g;
		print STDERR ("PROMPT MATCH: $prompt\n") if ($debug);
	    }
	    print STDERR ("HIT COMMAND:$_") if ($debug);
	    if (! defined($commands{$cmd})) {
		print STDERR "$host: found unexpected command - \"$cmd\"\n";
		$clean_run = 0;
		last TOP;
	    }
	    if (! defined(&{$commands{$cmd}})) {
		printf(STDERR "$host: undefined function - \"%s\"\n",  
		       $commands{$cmd});
		$clean_run = 0;
		last TOP;
	    }
	    $rval = &{$commands{$cmd}}($INPUT, $OUTPUT, $cmd);
	    delete($commands{$cmd});
	    if ($rval == -1) {
		$clean_run = 0;
		last TOP;
	    }
	}
    }
}

# This is for 10g switches with 40g license activations, for example
# parses output of show logging raslog rbridge-id <n>
# discard everything but the license info
sub ShowRasLicense {
    my($INPUT, $OUTPUT, $cmd) = @_;
    my(%licstr);
    my($linecnt) = 0;
 
    print STDERR "    In ShowRasLicense: $_" if ($debug);

    while (<$INPUT>) {
	tr/\015//d;
	last if (/^$prompt/);
	next if (!m/is Added\./);
	if (m/\s+(\S+\s+\S+ is Added)/) {
	    $licstr{$1}++;
	    $linecnt++;
	    next;
	}
		
    }
    if ($linecnt > 0) {
        ProcessHistory("License","","","!RASLICENSE: $cmd\n"); 
        foreach my $k (keys(%licstr)) {
            ProcessHistory("License","","","!RASLICENSE: $k\n"); 
        }
    }
    ProcessHistory("License","","","!\n"); 

    return(0);
}

# This routine parses "show configuration"
sub ShowConfig {
    my($INPUT, $OUTPUT, $cmd) = @_;
    my($linecnt) = 0;
    print STDERR "    In ShowConfig: $_" if ($debug);

    while (<$INPUT>) {
	tr/\015//d;
	last if (/^$prompt/);
	next if (/^(\s*|\s*$cmd\s*)$/);
	next if (/^Reading configuration information/);
	next if (/^Can\'t find object or class named \"\-all\"\s*$/);
	next if (/lock-address .*$/);
	next if (/^\# *uptime +\d+\s*$/);
	return(1) if (/invalid command name/);
	return(-1) if (/error: application error/i);

	if (/community label /) {
	    if ($filter_commstr) {
		$_ =~ s/community label .*$/community label <removed>/;
	    }
	}
	if (/^\s+(password) (\$1\$.*)?/ && $filter_pwds == 2) {
	    ProcessHistory("","","","!$1 <removed>$3\n"); next;
	}

	ProcessHistory("","","","$_");
	$linecnt++;
	if (/^!\s*end-of-config/) {
	    $found_end = 1;
	    return(0);
	}
    }

    # Prior to EOS 1.1, the Compass lacked a definitive "end of config" marker.
    if ($linecnt > 5) {
	$found_end = 1;
	return(1);
    }
    return(0);
}

# This routine parses "show fabric" commands
sub ShowFabric {
    my($INPUT, $OUTPUT, $cmd) = @_;
    print STDERR "    In ShowFabric: $_" if ($debug);

    while (<$INPUT>) {
	tr/\015//d;
	last if (/^$prompt/);
	return(1) if (/^-+\^/);			# missing command XXX
	next if (/^(\s*|\s*$cmd\s*)$/);
	next if (/^Can\'t find object or class named \"\-all\"\s*$/);
	next if (/lock-address .*$/);
	next if (/^\# *uptime +\d+\s*$/);
	return(1) if (/invalid command name/);

	return(-1) if /(error: |reading .* failed!)/i;

	# remove trailing whitespace
	s/\s+$/\n/;

	ProcessHistory("Fabric","","","! $_");
    }
    ProcessHistory("Fabric","","","!\n");
    return(0);
}

# This routine parses "show system monitor"
sub ShowMonitor {
    my($INPUT, $OUTPUT, $cmd) = @_;
    print STDERR "    In ShowMonitor: $_" if ($debug);

    while (<$INPUT>) {
	tr/\015//d;
	last if (/^$prompt/);
	return(1) if (/^-+\^/);			# missing command XXX
	next if (/Time of Report/);
	next if (/^(\s*|\s*$cmd\s*)$/);
	next if (/^Can\'t find object or class named \"\-all\"\s*$/);
	next if (/lock-address .*$/);
	next if (/^\# *uptime +\d+\s*$/);
	return(1) if (/invalid command name/);

	return(-1) if /(error: |reading .* failed!)/i;

	# remove trailing whitespace
	s/\s+$/\n/;

	ProcessHistory("Monitor","","","! $_");
    }
    ProcessHistory("Monitor","","","!\n");
    return(0);
}

# This routine parses "show support"
sub ShowSupport {
    my($INPUT, $OUTPUT, $cmd) = @_;
    print STDERR "    In ShowSupport: $_" if ($debug);

    while (<$INPUT>) {
	tr/\015//d;
	last if (/^$prompt/);
	return(1) if (/^-+\^/);			# missing command XXX
	return(1) if (/^syntax error: /);	# missing command XXX
	next if (/^(\s*|\s*$cmd\s*)$/);
	return(1) if (/invalid command name/);


	ProcessHistory("Support","","","!Support $_");
    }
    ProcessHistory("Support","","","!\n");
    return(0);
}


# This routine parses "show snapshots"
sub ShowSnapshots {
    my($INPUT, $OUTPUT, $cmd) = @_;
    print STDERR "    In ShowSnapshots: $_" if ($debug);

    while (<$INPUT>) {
	tr/\015//d;
	last if (/^$prompt/);
	next if (/^(\s*|\s*$cmd\s*)$/);
	# XXX why is show version missing?
	return(1) if (/invalid command name/);


	ProcessHistory("Snapshots","","","!Snapshots $_");
    }
    ProcessHistory("Snapshots","","","!\n");
    return(0);
}

# This routine parses "show vlan"
sub ShowVlan {
    my($INPUT, $OUTPUT, $cmd) = @_;
    print STDERR "    In ShowVlan: $_" if ($debug);

    while (<$INPUT>) {
	tr/\015//d;
	last if (/^$prompt/);
	next if (/^(\s*|\s*$cmd\s*)$/);
	# XXX why is show version missing?
	return(1) if (/invalid command name/);


	ProcessHistory("VLAN","","","!VLAN $_");
    }
    ProcessHistory("VLAN","","","!\n");
    return(0);
}

# This routine parses "show vcs"
sub ShowVcs {
    my($INPUT, $OUTPUT, $cmd) = @_;
    print STDERR "    In ShowVcs: $_" if ($debug);

    while (<$INPUT>) {
	tr/\015//d;
	last if (/^$prompt/);
	return(1) if (/^syntax error: /);	# missing command XXX
	next if (/^(\s*|\s*$cmd\s*)$/);
	# XXX why is show version missing?
	return(1) if (/invalid command name/);

	ProcessHistory("VCS","","","!VCS $_");
    }
    ProcessHistory("VCS","","","!\n");
    return(0);
}

# This routine parses "show licenses"
sub ShowLicense {
    my($INPUT, $OUTPUT, $cmd) = @_;
    print STDERR "    In ShowLicense: $_" if ($debug);

    while (<$INPUT>) {
	tr/\015//d;
	last if (/^$prompt/);
	next if (/^(\s*|\s*$cmd\s*)$/);
	return(1) if (/invalid command name/);

	ProcessHistory("License","","","!LICENSE $_");
    }
    ProcessHistory("License","","","!\n");
    return(0);
}

# This routine parses "show version"
sub ShowVersion {
    my($INPUT, $OUTPUT, $cmd) = @_;
    print STDERR "    In ShowVersion: $_" if ($debug);

    while (<$INPUT>) {
	tr/\015//d;
	last if (/^$prompt/);
	next if (/^(\s*|\s*$cmd\s*)$/);

	ProcessHistory("Version","","","! $_");
    }
    ProcessHistory("Version","","","!\n");
    return(0);
}

1;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0xA273BC92.asc
Type: application/pgp-keys
Size: 3116 bytes
Desc: not available
URL: <http://www.shrubbery.net/pipermail/rancid-discuss/attachments/20170426/40abde74/attachment.key>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://www.shrubbery.net/pipermail/rancid-discuss/attachments/20170426/40abde74/attachment.sig>


More information about the Rancid-discuss mailing list