Discussion:
[rancid] Vyatta config processing.
Matthew MacAulay
2013-09-24 14:22:32 UTC
Permalink
Hello list,

I am new to Rancid and have found it to be excellent when working with
Cisco devices. I have also managed to get it looking after NXOS, Alteon,
Foundry and F5 without too many problems. Most answers I found here J

I have one device left on my mission list.

A vyatta router, there are a couple of scripts / modules out there and I
have tried to make them work but I am stuck and need some help.

This one seems most promising as it followed the normal rancid module
structure.

https://gist.github.com/Dunkirk/4032499

The default commandtable command did not work for me, the prompt logs in
fine and run’s the ‘show configuration’ commands, but it needs an “any key”
pressing to display all of the config.. I have tried and failed to make
this work, I think I need to change my prompt to be a large number or lines
or something?

Either way, it would seem that there is a better command that should be
used, so I changed my commandtable

@commandtable = (

{'cli-shell-api showConfig --show-active-only' => 'WriteTerm'},

);

All I get back checked into CVS are the interfaces (top bit of the config),
I am thinking that the sub WriteTerm is detecting the End of the config
early but spotting this beyond my perl skills.

If I run the command below I get the full config.

/usr/lib/rancid/bin/clogin -f /var/lib/rancid/.cloginrc -c "cli-shell-api
showConfig --show-active-only" vyattaR1

Below is the first bit of the config, it stops after the loopback
interface, can anyone tell me why and what I need to do to fix it?

Thanks inadvanced.

Mat.

SNIP.

}

ethernet eth1 {

address 1.1.1.2/24

duplex auto

hw-id 00:50:56:e0:00:18

smp_affinity auto

speed auto

vrrp {

vrrp-group 20 {

advertise-interval 1

preempt true

priority 101

sync-group ALPHA

virtual-address 1.1.1.1/24

}

}

}

loopback lo {

}

} <--------- Rancid stops processing the config here..

protocols {

bgp 12345 {

neighbor 1.1.1.11 {

allowas-in {

}

SNIP
Ed Ravin
2013-09-25 04:21:51 UTC
Permalink
I wrote a RANCID module for Vyattas running Mendocino a few years ago. It
used non-interaactive SSH (required public/private key pair) and ran each
command through this template:

"unset _OFR_CONFIGURE; exec vbash --noediting --noprofile -c 'source /etc/bash_completion; _vyatta_op_run <COMMAND>'"

That convinced the Vyatta to give me the Vyatta CLI without also thinking
that an interactive terminal existed. I have no idea whether this still
works in current versions, as I stopped working with Vyattas after that.

I also used a different command list:

commandtable=(
{'show version' => "ShowVersion"},
{'show hardware dmi' => "ShowHard"},
{'show hardware pci' => "ShowHard"},
{'show hardware cpu' => "ShowCPU"},
{'show system usb' => "ShowUSB"},
{'show system routing-daemons' => "ShowRoutingDaemons"},
{'show configuration commands' => "ShowConfig"},
);

Note the use of "show configuration commands" - this gives you the Vyatta
config in command-line rather than config-file form, so it's much easier
to make sense of the diffs.

I'll send you the tarball separately. I never published it on this list
because I don't know of anyone else who has it working in their environment.
It's possible that my code strayed too far from both RANCID's paradigm and
current Vyatta practice, but maybe you'll be able to use something from it.

-- Ed

On Tue, Sep 24, 2013 at 03:22:32PM +0100, Matthew MacAulay wrote:
...
Post by Matthew MacAulay
A vyatta router, there are a couple of scripts / modules out there and
I have tried to make them work but I am stuck and need some help.
This one seems most promising as it followed the normal rancid module
structure.
[1]https://gist.github.com/Dunkirk/4032499
The default commandtable command did not work for me, the prompt logs
in fine and runs the show configuration commands, but it needs an any
key pressing to display all of the config.. I have tried and failed to
make this work, I think I need to change my prompt to be a large number
or lines or something?
[...]

Loading...