Mailing List Archive

automating non-config actions?
Has anyone thought about modifying rancid to make it a batch utility for executing arbitrary actions on lots of routers?

I'd like to be able to write simple expect scripts to accomplish a task, like "show route" or "clear route forwarding-table x/y x.x.x.x" and then roll it out to a whole list of routers.

The main difference I'm looking for is

- a switch to turn off all the diffing and cvs
- direct the logging to somewhere besides the config directory
- specify the action script on the command line.

This way, I could leverage all of rancid's router.db and vendor specific login knowledge, to get a more general utility.

In particular, what I really want to do is build a script to *install* a batch of configs from the archive on a series of routers. I would use this in a lab environment to quickly restore a bunch of routers to arbitrary past lab scenarios that people have built. I would also then use it to run tests & show commands against the scenario, and store them for later reference.

I'm getting ready to hack this up myself. But if anyone is has done something like this already, perhaps I can leverage your work. Either way, I'd like to know how many people are interested in this capability, so I can decide to what extent it's worth the effort of doing it professionally from the get-go, instead of quick-and-dirty.

-Avram
automating non-config actions? [ In reply to ]
On Sat, Jan 12, 2002 at 01:05:50PM -0800, Avram Dorfman wrote:
> Has anyone thought about modifying rancid to make it a batch
> utility for executing arbitrary actions on lots of routers?

Look at clogin - its already does a lot of what you want.
--asp
automating non-config actions? [ In reply to ]
Sat, Jan 12, 2002 at 05:06:33PM -0500, Andrew Partan:
> On Sat, Jan 12, 2002 at 01:05:50PM -0800, Avram Dorfman wrote:
> > Has anyone thought about modifying rancid to make it a batch
> > utility for executing arbitrary actions on lots of routers?
>
> Look at clogin - its already does a lot of what you want.
> --asp

btw, clogin is cisco (more or less) specific at this point. a simple
shell script would whack that for you. eg:

cd /usr/local/rancid
for router in `cat */router.db`
do
oldFS=$IFS
IFS=:
set $router
IFS=$oldFS

if [ "$3" == "up" ] ; then
if [ "$2" != "juniper"] ; then
jlogin -s jnx_script $1
else
clogin -s cisco_script $1
fi
fi
done
automating non-config actions? [ In reply to ]
I did see that. -s will cover the arbitrary script task I've suggested.

The grouping and parallel processing done by do-diffs, control_rancid,
and par, look like they would need to be hacked to support the -s option
of the *login scripts, with the more flexible batch functionality that
they provide, rather than manually listing every router using *login -r.

But a lot of the checking & emailing control_rancid does sort of doesn't
make sense to do for non-config collecting, or in an interactive
environment.

My apologies for not really specifying my intent clearly.

Thanks,
-Avram

> -----Original Message-----
> From: Andrew Partan [mailto:asp at partan.com]
> Sent: Saturday, January 12, 2002 5:07 PM
> To: Avram Dorfman
> Cc: rancid-discuss at shrubbery.net
> Subject: Re: automating non-config actions?
>
>
> On Sat, Jan 12, 2002 at 01:05:50PM -0800, Avram Dorfman wrote:
> > Has anyone thought about modifying rancid to make it a batch
> > utility for executing arbitrary actions on lots of routers?
>
> Look at clogin - its already does a lot of what you want.
> --asp
>
automating non-config actions? [ In reply to ]
Yup. I think I'll steal the group code, and work in par. I was thinking
about building this back into control_rancid & do_diffs, but it will
probably be quicker just to make a new script.

Thanks,
-Avram

> -----Original Message-----
> From: john heasley [mailto:heas at shrubbery.net]
> Sent: Saturday, January 12, 2002 5:34 PM
> To: Avram Dorfman
> Cc: rancid-discuss at shrubbery.net
> Subject: Re: automating non-config actions?
>
>
> Sat, Jan 12, 2002 at 05:06:33PM -0500, Andrew Partan:
> > On Sat, Jan 12, 2002 at 01:05:50PM -0800, Avram Dorfman wrote:
> > > Has anyone thought about modifying rancid to make it a batch
> > > utility for executing arbitrary actions on lots of routers?
> >
> > Look at clogin - its already does a lot of what you want.
> > --asp
>
> btw, clogin is cisco (more or less) specific at this point. a simple
> shell script would whack that for you. eg:
>
> cd /usr/local/rancid
> for router in `cat */router.db`
> do
> oldFS=$IFS
> IFS=:
> set $router
> IFS=$oldFS
>
> if [ "$3" == "up" ] ; then
> if [ "$2" != "juniper"] ; then
> jlogin -s jnx_script $1
> else
> clogin -s cisco_script $1
> fi
> fi
> done
>
automating non-config actions? [ In reply to ]
Have you looked at these?

MRAT - http://cisco.nothingnet.com/
Pancho - http://pancho.lunarmedia.net/

jas