Mailing List Archive

Rancid and the Cisco 5000 Nexus Platform
Hello,

I have some cisco Nexus 5k and I'm having some trouble grabbing the "show
run" through rancid. In my setup I commented out most commands in the
"rancid.types.base" file except for the "show run" section. The problem is
that with the file commented, rancid can't manage to grab the output
because, according to the logs, "End of run not found". Is this message
based on finding the word "end" in the configuration? Because if that's the
requirement, then even when manually doing "show run" it's not there.

The curious thing is that if I un-comment all the other show commands, then
rancid does manage to grab the router config, although of course that is
not ideal. Below [1] you can find the "rancid.types.base" config.

Connectivity to the device is NOT a problem. Version used is both 7.x and
5.x trains and both have problems.

Thank you!


[1]

cisco-nx;script;rancid -t cisco-nx
cisco-nx;login;clogin
cisco-nx;module;nxos
cisco-nx;inloop;nxos::inloop
#cisco-nx;command;rancid::RunCommand;term no monitor-force
#cisco-nx;command;nxos::ShowVersion;show version
#cisco-nx;command;nxos::ShowVersionBuild;show version build-info all
#cisco-nx;command;nxos::ShowLicense;show license
#cisco-nx;command;nxos::ShowLicense;show license usage
#cisco-nx;command;nxos::ShowLicense;show license host-id
#cisco-nx;command;nxos::ShowRedundancy;show system redundancy status
#cisco-nx;command;nxos::ShowEnv;show environment clock
#cisco-nx;command;nxos::ShowEnv;show environment fan
#cisco-nx;command;nxos::ShowEnv;show environment fex all fan
#cisco-nx;command;nxos::ShowEnvTemp;show environment temperature
#cisco-nx;command;nxos::ShowEnvPower;show environment power
#cisco-nx;command;nxos::ShowBoot;show boot
#cisco-nx;command;nxos::DirSlotN;dir bootflash:
#cisco-nx;command;nxos::DirSlotN;dir debug:
#cisco-nx;command;nxos::DirSlotN;dir logflash:
#cisco-nx;command;nxos::DirSlotN;dir slot0:
#cisco-nx;command;nxos::DirSlotN;dir usb1:
#cisco-nx;command;nxos::DirSlotN;dir usb2:
#cisco-nx;command;nxos::DirSlotN;dir volatile:
#cisco-nx;command;nxos::ShowModule;show module
#cisco-nx;command;nxos::ShowModule;show module xbar
##cisco-nx;command;nxos::ShowModule;show module X;add, but wait for show all
##cisco-nx;command;nxos::ShowModule;show module X epld;add, but wait for
show all
#cisco-nx;command;nxos::ShowInventory;show inventory
#cisco-nx;command;nxos::ShowIntTransceiver;show interface transceiver
#cisco-nx;command;nxos::ShowVTP;show vtp status;drop?
#cisco-nx;command;nxos::ShowVLAN;show vlan
#cisco-nx;command;nxos::ShowDebug;show debug
#cisco-nx;command;nxos::ShowCores;show cores vdc-all
#cisco-nx;command;nxos::ShowProcLog;show processes log vdc-all
#cisco-nx;command;nxos::ShowFex;show module fex
#cisco-nx;command;nxos::ShowFex;show fex
cisco-nx;command;nxos::WriteTerm;show running-config
Re: Rancid and the Cisco 5000 Nexus Platform [ In reply to ]
Mon, Jul 22, 2019 at 08:51:09AM -0700, Florin Vlad Olariu:
> Hello,
>
> I have some cisco Nexus 5k and I'm having some trouble grabbing the "show
> run" through rancid. In my setup I commented out most commands in the
> "rancid.types.base" file except for the "show run" section. The problem is
> that with the file commented, rancid can't manage to grab the output
> because, according to the logs, "End of run not found". Is this message
> based on finding the word "end" in the configuration? Because if that's the
> requirement, then even when manually doing "show run" it's not there.

please show us the error from the log file and tell us what version of
rancid. also, please follow the test in the FAQ S3 Q2.

Also, for some devices show version is required; as the device type can
affect other parsing. I doubt that is the problem for nxos, but you
also commented this:

> #cisco-nx;command;rancid::RunCommand;term no monitor-force

which i suspect is the problem, having now seen the errors.

> The curious thing is that if I un-comment all the other show commands, then
> rancid does manage to grab the router config, although of course that is
> not ideal. Below [1] you can find the "rancid.types.base" config.
>
> cisco-nx;script;rancid -t cisco-nx

please read the warning at the top of etc/rancid.types.base

_______________________________________________
Rancid-discuss mailing list
Rancid-discuss@shrubbery.net
http://www.shrubbery.net/mailman/listinfo/rancid-discuss
Re: Rancid and the Cisco 5000 Nexus Platform [ In reply to ]
Hi John, thanks for the reply.

I am running version 3.9 [2] and the logs looks like in [1]. I tried
un-commenting the line that states
"#cisco-nx;command;rancid::RunCommand;term no monitor-force" but it doesn't
work anyway.

Reading about your comment on "show version" made me try and un-comment
that line... (and only that line) and after that it worked!. But why do I
need to have show version in there at all for this to properly work?

An alternative solution I had was to put variables "$clean_run" and
"$found_end" to 1 in the /usr/local/rancid/bin/rancid file, but of course
this is not ideal as it applies to all types of routers.

Any idea how can I gather config _without_ needing "show version" also?




[1]

[rancid@tvvsmtarist001 logs]$ cat rancidconf.20190722.143428
starting: Mon Jul 22 14:34:28 UTC 2019



Trying to get all of the configs.
tlcxx-mgmt-001a.mlp.com: End of run not found

=====================================
Getting missed routers: round 1.
tlcxx-mgmt-001a.mlp.com: End of run not found

=====================================
Getting missed routers: round 2.
tlcxx-mgmt-001a.mlp.com: End of run not found

=====================================
Getting missed routers: round 3.
tlcxx-mgmt-001a.mlp.com: End of run not found

=====================================
Getting missed routers: round 4.
tlcxx-mgmt-001a.mlp.com: End of run not found


[2]

[rancid@tvvsmtarist001 logs]$ /usr/local/rancid/bin/rancid-run -V
rancid 3.9



On 22 July 2019 at 19:59:07, john heasley (heas@shrubbery.net) wrote:

Mon, Jul 22, 2019 at 08:51:09AM -0700, Florin Vlad Olariu:
> Hello,
>
> I have some cisco Nexus 5k and I'm having some trouble grabbing the "show
> run" through rancid. In my setup I commented out most commands in the
> "rancid.types.base" file except for the "show run" section. The problem
is
> that with the file commented, rancid can't manage to grab the output
> because, according to the logs, "End of run not found". Is this message
> based on finding the word "end" in the configuration? Because if that's
the
> requirement, then even when manually doing "show run" it's not there.

please show us the error from the log file and tell us what version of
rancid. also, please follow the test in the FAQ S3 Q2.

Also, for some devices show version is required; as the device type can
affect other parsing. I doubt that is the problem for nxos, but you
also commented this:

> #cisco-nx;command;rancid::RunCommand;term no monitor-force

which i suspect is the problem, having now seen the errors.

> The curious thing is that if I un-comment all the other show commands,
then
> rancid does manage to grab the router config, although of course that is
> not ideal. Below [1] you can find the "rancid.types.base" config.
>
> cisco-nx;script;rancid -t cisco-nx

please read the warning at the top of etc/rancid.types.base
Re: Rancid and the Cisco 5000 Nexus Platform [ In reply to ]
Tue, Jul 23, 2019 at 01:29:01AM -0700, Florin Vlad Olariu:
> I am running version 3.9 [2] and the logs looks like in [1]. I tried
> un-commenting the line that states
> "#cisco-nx;command;rancid::RunCommand;term no monitor-force" but it doesn't
> work anyway.

keep that; it prevents logs/etc from mangling prompts and commands that
rancid wants to match.

> Reading about your comment on "show version" made me try and un-comment
> that line... (and only that line) and after that it worked!. But why do I
> need to have show version in there at all for this to properly work?
>
> An alternative solution I had was to put variables "$clean_run" and
> "$found_end" to 1 in the /usr/local/rancid/bin/rancid file, but of course
> this is not ideal as it applies to all types of routers.
>
> Any idea how can I gather config _without_ needing "show version" also?

As I mentioned, the model sometimes affects the handling of the config.
I do not remember off the top why this is so in nxos. i'll try to look
later. its not that much extra data and it should all be commented.

_______________________________________________
Rancid-discuss mailing list
Rancid-discuss@shrubbery.net
http://www.shrubbery.net/mailman/listinfo/rancid-discuss
Re: Rancid and the Cisco 5000 Nexus Platform [ In reply to ]
Hey John,

So I poked around various rancid files. I discovered that the
"/usr/local/rancid/lib/rancid/nxos.pm" file/module sets a "type" variable
in the "ShowVersion" function which is then checked at the end (see [1]) to
test if we're on a NXOS platform. This module acknowledges the fact that
NXOS does not have an "end" marker, but I'm not sure why a "nxos.pm" module
would need to test if this is a nexus platform? Or at least, why bundle it
in the "ShowVersion" function without the option to include that output in
the config collected or not?

I'm sure there's some historical reason for it, just don't have the
context. For my particular case, I commented out line 1021 and left only
the $linecnt check in. This way I can get rid of "show version" output in
my config file and it affects only cisco-nx.

This is clearly a hack that will make upgrading more difficult, but my
knowledge of perl is basically 0 so can't really propose a more sane thing
here :(.

Thanks for your input. Hope somebody finds this hack useful.

[1]

1018 # The ContentEngine lacks a definitive "end of config" marker. If
we

1019 # know that it is NXOS and we have seen at least 5 lines

1020 # of write term output, we can be reasonably sure that we got the
config.

1021 # if (($type eq "NXOS") && $linecnt > 5) {

1022 if ($linecnt > 5) {


On 23 July 2019 at 18:42:21, john heasley (heas@shrubbery.net) wrote:

Tue, Jul 23, 2019 at 01:29:01AM -0700, Florin Vlad Olariu:
> I am running version 3.9 [2] and the logs looks like in [1]. I tried
> un-commenting the line that states
> "#cisco-nx;command;rancid::RunCommand;term no monitor-force" but it
doesn't
> work anyway.

keep that; it prevents logs/etc from mangling prompts and commands that
rancid wants to match.

> Reading about your comment on "show version" made me try and un-comment
> that line... (and only that line) and after that it worked!. But why do I
> need to have show version in there at all for this to properly work?
>
> An alternative solution I had was to put variables "$clean_run" and
> "$found_end" to 1 in the /usr/local/rancid/bin/rancid file, but of course
> this is not ideal as it applies to all types of routers.
>
> Any idea how can I gather config _without_ needing "show version" also?

As I mentioned, the model sometimes affects the handling of the config.
I do not remember off the top why this is so in nxos. i'll try to look
later. its not that much extra data and it should all be commented.