[rancid] Adding JunOS Commands in configure mode

Emille Blanc emille at abccommunications.com
Sun Jan 24 16:14:13 UTC 2021


Does it have to be done from configure mode?
Would
'show configuration  | compare rollback 0'
>From normal mode suffice?

Thinking for the sake of simplicity.  But looks like you are on the right track to me

Sent from my BlackBerry — the most secure mobile device — via the TELUS Network
From: peacefull64 at hotmail.fr
Sent: January 24, 2021 8:10 AM
To: rancid-discuss at www.shrubbery.net
Subject: [rancid] Adding JunOS Commands in configure mode


Hi,

I need to run "show | compare" in JunOS by entering in configure mode, so I would like to add this command to the list of commands that gets executed against Juniper devices.

At first I tried to edit directly the files "junos.pm", "jrancid" and "rancid.types.base" but without success.
After several searches on the internet and here I found some interesting information.

https://shrubbery.net/pipermail/rancid-discuss/2015-October/008716.html
https://shrubbery.net/pipermail/rancid-discuss/2016-September/009251.html
https://shrubbery.net/pipermail/rancid-discuss/2009-October/004326.html

So I don't override commands from the base types file and copy them from rancid.types.base to rancid.types.conf and rename them.
Of course without forgetting to update the "router.db" file with the value jlocal and copy /usr/local/libexec/rancid/jrancid to /usr/local/libexec/rancid/jlocal (I use FreeBSD OS).

Example conf:
jlocal;script;rancid -t jlocal
jlocal;login;jlogin
jlocal;module;junos
jlocal;inloop;junos::inloop
jlocal;command;junos::ShowChassisClocks;show chassis clocks
jlocal;command;junos::ShowChassisEnvironment;show chassis environment
jlocal;command;junos::ShowChassisFirmware;show chassis firmware
jlocal;command;junos::ShowChassisFpcDetail;show chassis fpc detail
jlocal;command;junos::ShowChassisHardware;show chassis hardware detail
jlocal;command;junos::ShowChassisHardware;show chassis hardware models
jlocal;command;junos::ShowChassisRoutingEngine;show chassis routing-engine
jlocal;command;junos::ShowChassisSCB;show chassis scb
jlocal;command;junos::ShowChassisSCB;show chassis sfm detail
jlocal;command;junos::ShowChassisSCB;show chassis ssb
jlocal;command;junos::ShowChassisSCB;show chassis feb detail
jlocal;command;junos::ShowChassisSCB;show chassis feb
jlocal;command;junos::ShowChassisSCB;show chassis cfeb
jlocal;command;junos::ShowChassisAlarms;show chassis alarms
jlocal;command;junos::ShowSystemLicense;show system license
jlocal;command;junos::ShowSystemBootMessages;show system boot-messages
jlocal;command;junos::ShowSystemCoreDumps;show system core-dumps
jlocal;command;junos::ShowVersion;show version detail
jlocal;command;junos::ShowConfiguration;show configuration

So far everything works fine, but if I add the additional lines for my commands in "rancid.types.conf" it doesn't work anymore.

jlocal;command;junos::RunConfigure;configure
jlocal;command;junos::ShowCompare;show | compare
jlocal;command;junos::RunExit;exit

I also tried to add the commands in the @commandtable array and also to modify the variable $prompt in order to take the '#' of the configure mode.

$prompt = ($_ =~ /^([^>]+>)/)[0]; ===> $prompt = ($_ =~ /^([^>|^#]+[>|#])/)[0];

Can someone please explain to me how I can set this up? Thank you.

Regards.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.shrubbery.net/pipermail/rancid-discuss/attachments/20210124/d6bed0e5/attachment.htm>


More information about the Rancid-discuss mailing list