[rancid] Question about custom command-file and expect
Hughes, Doug
Douglas.Hughes at DEShawResearch.com
Wed Feb 25 22:01:44 UTC 2015
This is definitely possible, though you need to dig out your Perl coding skills. It's not that hard with a little bit of perl, but you need to be prepared to edit the rancid file corresponding to your device (e.g. crancid or jrancid or whatever)
Then it's just adding the if condition (like the "next if" already there) and perhaps calling a new subroutine, or perhaps just handling it in a { } block if it's short enough.
It's not a standard feature, though.
-----Original Message-----
From: Rancid-discuss [mailto:rancid-discuss-bounces at shrubbery.net] On Behalf Of Simone Felici
Sent: Wednesday, February 25, 2015 5:41 AM
To: rancid-discuss at shrubbery.net
Subject: [rancid] Question about custom command-file and expect
Hello,
I would like to connect on a device using rancid and execute some commands *only* in some
circumstances. clogin works perfectly to login and using -x to specify a command-list file or -c to
execute commands works as well. But what I need is that, based on the response of a command I could
execute another command or not.
I.e., after login on a router, executing:
#show ip route <IP_ADDRESS>
IF I obtain:
% Subnet not in table
I need to execute some commands.
If I obtain:
Routing entry for <IP_ADDRESS>
(...)
THEN I need to do something different.
I've seen there is a [-s script-file] where I could add an expect script. Trying to use it, seems
the whole content of clogin is bypassed using the script file. Would be possible to use clogin for
login action and then, at the end, use only the script-file to add the rest of the commands with the
IF-THEN-ELSE logic?
Thanks for the help!
Simon
_______________________________________________
Rancid-discuss mailing list
Rancid-discuss at shrubbery.net
http://www.shrubbery.net/mailman/listinfo/rancid-discuss
More information about the Rancid-discuss
mailing list