[rancid] supermicro switch (again)

Marcin Dulak marcin.dulak at gmail.com
Thu Nov 17 13:12:31 UTC 2016


On Wed, Nov 16, 2016 at 9:14 PM, heasley <heas at shrubbery.net> wrote:

> Tue, Nov 15, 2016 at 06:09:20PM +0100, Marcin Dulak:
> > Hi,
> >
> > I read through this thread ending with no solution
> > http://www.shrubbery.net/pipermail/rancid-discuss/2013-
> November/007279.html
> >
> > Things I have tried:
> >
> > Version rancid-3.1-4.el6.x86_64
> >
> > 0.
> > add to ~rancid/.cloginrc the supermicro-switch settings
> >
> > add autoenable supermicro-switch 1
> > add user       supermicro-switch username
> > add password   supermicro-switch password password
> > add method     supermicro-switch ssh
> >
> >
> > 1.
> > clogin shows errors out-of-the-box, this is expected
> >
> > rancid $ clogin -c"show version" supermicro-switch
> > supermicro-switch
> > spawn ssh -c 3des -x -l username supermicro-switch
> > username at supermicro-switch's password:
> >
> >          Supermicro Switch
> >
> > supermicro-switch#
> > supermicro-switch# terminal length 0
> > % Invalid Command
> > supermicro-switch# terminal width 132
> > % Invalid Command
> > supermicro-switch#  show version
> > Switch ID  Hardware Version             Firmware Version  OS
> > Version
> > 0          XXX-XXXX Rev. X   (XX-XX)    X.X.X-X           X.X.X
> > supermicro-switch#exit
> >
> > 2.
> > copy clogin to smlogin
> >
> > root # cp /usr/libexec/rancid/clogin /usr/libexec/rancid/smlogin
> >
> > and replace the offending
> > send "terminal length 0\r" and send "terminal width 132\r" with with send
> > "\r"
>
> so, how do you turn of the pager?
>

https://www.supermicro.com/manuals/other/SM-CLI-Guide.pdf page 72: no cli
pagination


>
> does supermicro actually make the switch, or is it an OEM for which a
> script
> may already exist.
>
> > After that this returns without errors:
> >
> > rancid $ smlogin -c"show version" supermicro-switch
> >
> > 3.
> > rancid $ rancid -d supermicro-switch
> > loadtype(): device_type is empty
> > Couldn't load device type spec for
> >
> > So I add to /etc/rancid/rancid.types.base:
> >
> > supermicro;script;rancid -t supermicro
>
> This implies that there is a lib/supermicro.pm library.
>
> > supermicro;login;smlogin
> > supermicro;inloop;supermicro::inloop
> > supermicro;command;supermicro::ShowVersion;show version
> > supermicro;command;supermicro::WriteTerm;show running-config
> >
> > and then:
> >
> > rancid $ rancid -d -t supermicro supermicro-switch
> > loadtype: device type supermicro
> > loadtype: found device type supermicro in /etc/rancid/rancid.types.base
> > executing smlogin -t 90 -c"show version;show running-config"
> > supermicro-switch
> > supermicro-switch: missed cmd(s): all commands
> > supermicro-switch: End of run not found
> > supermicro-switch: End of run not found
> >
> > but as we know executing directly on the command line works: smlogin -t
> 90
> > -c"show version;show running-config" supermicro-switch
> >
> > To further debug I create `cp /usr/libexec/rancid/rancid
> > /usr/libexec/rancid/smrancid` and point to it with
> > supermicro;script;smrancid -t supermicro
> > but my guess is wrong: some other script than
> /usr/libexec/rancid/smrancid
> > is executed during `rancid -d -t supermicro supermicro-switch`
> >
> > How to debug this further?
>
> i'd start with rancid 3.5.1.
>

I'm at the latest version now.

$ rancid -V
rancid 3.5.1

$ cat ~/.cloginrc
add autoenable supermicro-switch 1
add user       supermicro-switch username
add password   supermicro-switch password password
add method     supermicro-switch ssh

Created smlogin based on blogin so `smlogin -c"show version"
supermicro-switch` runs fine:

$ diff usr/libexec/rancid/blogin usr/libexec/rancid/smlogin
501c501
<     send "more off\r"
---
>     send "no cli pagination\r"

Now, most of the posts suggest that the reason for getting "End of run not
found" is that rancid does not recognize
when the session to the switch is terminated. On Supermicro that seems to
be "supermicro-switch#exit".

I'm trying to find out the workflow of rancid in order to make the
adjustments:

$ grep '#exit\$' usr/share/perl5/vendor_perl/rancid/*
usr/share/perl5/vendor_perl/rancid/edgemax.pm:    if (/\#exit$/) {
usr/share/perl5/vendor_perl/rancid/foundry.pm:    if (/\#exit$/) {

$ grep '#exit\$' usr/libexec/rancid/*
usr/libexec/rancid/rrancid:    if (/\#exit$/) {

First question: what is the purpose of usr/libexec/rancid/rrancid compared
to the perl modules under usr/share/perl5/vendor_perl/rancid?

Second question - I'm doing:

$ cat etc/rancid/rancid.types.conf
supermicro;script;rrancid
supermicro;login;smlogin
supermicro;inloop;edgemax::inloop
supermicro;command;edgemax::ShowVersion;show version

but I can see that there seem to be no effect due to what I write for some
of these options, e.g. I can do without errors:
supermicro;script;dummy
supermicro;login;smlogin
supermicro;inloop;dummy::inloop

I would imagine something like that would be caught by rancid configuration
parser as incorrect and prevent the run?

Adding debug prints to the check for completness in
usr/libexec/rancid/rancid (also suggested in some posts) is not helpful:
printf(STDERR "$host: missed cmd(s): all commands\n");
printf(STDERR "$host: $clean_run\n");
printf(STDERR "$host: $found_end\n");

$ rancid -d -t supermicro supermicro-switch
loadtype: device type supermicro
loadtype: found device type supermicro in ./etc/rancid/rancid.types.conf
executing smlogin -t 90 -c"show version" supermicro-switch
supermicro-switch: missed cmd(s): all commands
supermicro-switch: 0
supermicro-switch: 0
supermicro-switch: End of run not found

Marcin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.shrubbery.net/pipermail/rancid-discuss/attachments/20161117/e408b643/attachment.html>


More information about the Rancid-discuss mailing list