Yes, it's must be done from configure mode because is not the same information.
For example, in operational mode, you can compare the active configuration to a previously committed configuration by using the following commands:
show configuration | compare revision revision-id
show configuration | compare rollback rollback-number
Similarly in configuration mode, you can compare the candidate configuration to a previously committed configuration by using the following commands:
show | compare revision revision-id
show | compare rollback rollback-number
https://www.juniper.net/documentation/en_US/junos/topics/task/operational/junos-xml-protocol-requesting-configuration-comparison.html
Regards.
-------- Message original --------
De : Emille Blanc <[email protected]>
Date : dim. 24 janv. 2021 à 17:14
À : "Dede ." <[email protected]>, [email protected]
Objet : Re: [rancid] Adding JunOS Commands in configure mode
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: [email protected]Sent: January 24, 2021 8:10 AMSubject: [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.
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 jlocaljlocal;login;jloginjlocal;module;junosjlocal;inloop;junos::inloopjlocal;command;junos::ShowChassisClocks;show chassis clocksjlocal;command;junos::ShowChassisEnvironment;show chassis environmentjlocal;command;junos::ShowChassisFirmware;show chassis firmwarejlocal;command;junos::ShowChassisFpcDetail;show chassis fpc detailjlocal;command;junos::ShowChassisHardware;show chassis hardware detailjlocal;command;junos::ShowChassisHardware;show chassis hardware modelsjlocal;command;junos::ShowChassisRoutingEngine;show chassis routing-enginejlocal;command;junos::ShowChassisSCB;show chassis scbjlocal;command;junos::ShowChassisSCB;show chassis sfm detailjlocal;command;junos::ShowChassisSCB;show chassis ssbjlocal;command;junos::ShowChassisSCB;show chassis feb detailjlocal;command;junos::ShowChassisSCB;show chassis febjlocal;command;junos::ShowChassisSCB;show chassis cfebjlocal;command;junos::ShowChassisAlarms;show chassis alarmsjlocal;command;junos::ShowSystemLicense;show system licensejlocal;command;junos::ShowSystemBootMessages;show system boot-messagesjlocal;command;junos::ShowSystemCoreDumps;show system core-dumpsjlocal;command;junos::ShowVersion;show version detailjlocal;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.
_______________________________________________ Rancid-discuss mailing list [email protected] https://www.shrubbery.net/mailman/listinfo/rancid-discuss
