Mailing List Archive

Ubuntu with Rancid 3.7 - Comware (CMW)
Hi All,

Seeking some assistance as I'm a RANCID noob. Have had no issues getting Cisco devices to work, however no luck with HPE switches.

I have a large environment of HPE switches which run COMEWARE v7. I found the following device scripts by JRBINKS at the following link: https://sites.google.com/site/jrbinks/code/rancid/cmwrancid

When I attempt to run a test against my device, I get the following error:

rancid@testrancidserver:~/bin$ ./rancid -d -t cmw aubneleaf3a0508
loadtype: device type cmw
loadtype: found device type cmw in /etc/rancid/rancid.types.conf
loadtype: loading cmw failed: Can't locate cmw.pm in @INC (you may need to install the cmw module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.26.1 /usr/local/share/perl/5.26.1 /usr/lib/x86_64-linux-gnu/perl5/5.26 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.26 /usr/share/perl/5.26 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base /usr/share/perl5/rancid) at /usr/share/perl5/rancid/rancid.pm line 257.
Couldn't load device type spec for cmw

Server: Ubuntu x64 18.04
Rancid version 3.7

From /etc/rancid/rancid.conf
BASEDIR=/var/lib/rancid; export BASEDIR
PATH=/usr/lib/rancid/bin:/usr/bin:/usr/sbin:/bin:/usr/local/bin; export PATH

I've copied cmwlogin to /var/lib/rancid/bin
I've copied cmw.pm to /var/lib

rancid@aubnesrv7rancid1:~/bin$ pwd
/var/lib/rancid/bin
rancid@aubnesrv7rancid1:~/bin$ ls cmwlogin -l
-rwxr-xr-x 1 root root 30304 Dec 19 15:18 cmwlogin

rancid@aubnesrv7rancid1:~$ pwd
/var/lib/rancid
rancid@aubnesrv7rancid1:~$ ls cmw.pm -l
-rwxr-xr-x 1 rancid rancid 16533 Dec 19 15:21 cmw.pm

rancid@testrancidserver:~/bin$ export
declare -x HOME="/var/lib/rancid"
declare -x LANG="en_US.UTF-8"
declare -x LOGNAME="rancid"
declare -x MAIL="/var/mail/rancid"
declare -x OLDPWD="/var/lib/rancid"
declare -x PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/snap/bin"
declare -x PWD="/var/lib/rancid/bin"
declare -x SHELL="/bin/bash"
declare -x SHLVL="1"
declare -x TERM="xterm"
declare -x USER="rancid"
declare -x XDG_DATA_DIRS="/usr/local/share:/usr/share:/var/lib/snapd/desktop"

Anyone able to assist?

Kind Regards
Aaron


*********************************************************************************

LEGAL DISCLAIMER. The contents of this electronic communication and any attached documents are strictly confidential and they may not be used or disclosed by someone who is not a named recipient.

If you have received this electronic communication in error please notify the sender by replying to this electronic communication inserting the word "misdirected" as the subject and delete this communication from your system.

*********************************************************************************
Re: Ubuntu with Rancid 3.7 - Comware (CMW) [ In reply to ]
Wed, Dec 19, 2018 at 06:12:56AM +0000, aaron.sutton@glencore.com.au:
> Hi All,
>
> Seeking some assistance as I'm a RANCID noob. Have had no issues getting Cisco devices to work, however no luck with HPE switches.
>
> I have a large environment of HPE switches which run COMEWARE v7. I found the following device scripts by JRBINKS at the following link: https://sites.google.com/site/jrbinks/code/rancid/cmwrancid
>
> When I attempt to run a test against my device, I get the following error:
>
> rancid@testrancidserver:~/bin$ ./rancid -d -t cmw aubneleaf3a0508
> loadtype: device type cmw
> loadtype: found device type cmw in /etc/rancid/rancid.types.conf
> loadtype: loading cmw failed: Can't locate cmw.pm in @INC (you may need to install the cmw module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.26.1 /usr/local/share/perl/5.26.1 /usr/lib/x86_64-linux-gnu/perl5/5.26 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.26 /usr/share/perl/5.26 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base /usr/share/perl5/rancid) at /usr/share/perl5/rancid/rancid.pm line 257.

cmw.pm must be found in the path of rancid.conf:PERL5LIB

> Couldn't load device type spec for cmw
>
> Server: Ubuntu x64 18.04
> Rancid version 3.7
>
> >From /etc/rancid/rancid.conf
> BASEDIR=/var/lib/rancid; export BASEDIR
> PATH=/usr/lib/rancid/bin:/usr/bin:/usr/sbin:/bin:/usr/local/bin; export PATH
>
> I've copied cmwlogin to /var/lib/rancid/bin
> I've copied cmw.pm to /var/lib
>
> rancid@aubnesrv7rancid1:~/bin$ pwd
> /var/lib/rancid/bin
> rancid@aubnesrv7rancid1:~/bin$ ls cmwlogin -l
> -rwxr-xr-x 1 root root 30304 Dec 19 15:18 cmwlogin
>
> rancid@aubnesrv7rancid1:~$ pwd
> /var/lib/rancid
> rancid@aubnesrv7rancid1:~$ ls cmw.pm -l
> -rwxr-xr-x 1 rancid rancid 16533 Dec 19 15:21 cmw.pm
>
> rancid@testrancidserver:~/bin$ export
> declare -x HOME="/var/lib/rancid"
> declare -x LANG="en_US.UTF-8"
> declare -x LOGNAME="rancid"
> declare -x MAIL="/var/mail/rancid"
> declare -x OLDPWD="/var/lib/rancid"
> declare -x PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/snap/bin"
> declare -x PWD="/var/lib/rancid/bin"
> declare -x SHELL="/bin/bash"
> declare -x SHLVL="1"
> declare -x TERM="xterm"
> declare -x USER="rancid"
> declare -x XDG_DATA_DIRS="/usr/local/share:/usr/share:/var/lib/snapd/desktop"
>
> Anyone able to assist?
>
> Kind Regards
> Aaron
>
>
> *********************************************************************************
>
> LEGAL DISCLAIMER. The contents of this electronic communication and any attached documents are strictly confidential and they may not be used or disclosed by someone who is not a named recipient.
>
> If you have received this electronic communication in error please notify the sender by replying to this electronic communication inserting the word "misdirected" as the subject and delete this communication from your system.
>
> *********************************************************************************

> _______________________________________________
> Rancid-discuss mailing list
> Rancid-discuss@shrubbery.net
> http://www.shrubbery.net/mailman/listinfo/rancid-discuss

_______________________________________________
Rancid-discuss mailing list
Rancid-discuss@shrubbery.net
http://www.shrubbery.net/mailman/listinfo/rancid-discuss
Re: Ubuntu with Rancid 3.7 - Comware (CMW) [ In reply to ]
Hi,

Thank you Haes, I found the path for PERL5LIB and copied cmw.pm into this folder.

I also had to modify cmwlogin SHEBANG line from
'#! /usr/local/bin/expect --' to '#! /usr/bin/expect --'

I can now successfully run ./cmwlogin -y aes128-cbc routername. This logs into the device

I can also successfuly run ./cmwlogin -y aes128-cbc -c 'display current-config' routername. This logs into the device, outputs running-config and then exits SSH session.

Hit my next problem now, i'm getting 'end of run not found' in my logs.

routername1: End of run not found
return
routername2: End of run not found
return
routername3: End of run not found
return

If i try the following command;

./rancid -d -t cmw routername1
loadtype: device type cmw
loadtype: found device type cmw in /etc/rancid/rancid.types.conf
executing cmwlogin -t 90 -c"display version;display boot-loader;display startup;dir /all;dir /all unit2>flash:/;dir /all slot2#flash:/;dir /all unit3>flash:/;dir /all slot3#flash:/;dir /all unit4>flash:/;dir /all slot4#flash:/;dir /all unit5>flash:/;dir /all slot5#flash:/;dir /all unit6>flash:/;dir /all slot6#flash:/;dir /all unit7>flash:/;dir /all slot7#flash:/;dir /all unit8>flash:/;dir /all slot8#flash:/;display device;display device manuinfo;display fan;display power;display poe powersupply;display poe temperature-protection;display transceiver interface;display cluster;display domain;display local-user;display password-control;display password-control super;display ssh server status;display irf;display xrn-fabric;display ftm topology-database;display fib;display ip routing-table;display ospf;display ospf brief;display vlan all;display lacp sys;display link-aggregation summary;display link-aggregation verbose;display loopback-detection;display mirror all;display ntp-service status;display stp root;display current-configuration" routername1
sh: 1: cmwlogin: not found
aubneleaf3a0511: missed cmd(s): all commands
aubneleaf3a0511: End of run not found
aubneleaf3a0511: clean_run is false
aubneleaf3a0511: found_end is false

Now, SH: 1: cmwlogin: not found error was why i updated the SHEBANG originally, but for some reason i'm not hitting this on ./rancid. If i run rancid-run however, this issue isn't present in the logs.

I feel very close to getting this working now...
Re: Ubuntu with Rancid 3.7 - Comware (CMW) [ In reply to ]
Hi,

More information,

I think the SH: 1: cmwlogin: not found error is due to not running this as the rancid user. I also get the same error with cisco devices which run completely run with rancid-run.

admin@rancidserver:/var/lib/rancid/bin$ sudo ./rancid -t cisco routername100
[sudo] password for admin:
sh: 1: clogin: not found
routername100: missed cmd(s): all commands
routername100: End of run not found

If i try and run under rancid account however, i'm getting permission errors.
rancid@rancidserver:~/bin$ ./rancid -t cisco routername100
Can't open rotuername100.new for writing: Permission denied

Kind Regards
Aaron
Re: Ubuntu with Rancid 3.7 - Comware (CMW) [ In reply to ]
Thu, Dec 20, 2018 at 12:25:31AM +0000, Aaron Sutton:
> Hi,
>
> More information,
>
> I think the SH: 1: cmwlogin: not found error is due to not running this as the rancid user. I also get the same error with cisco devices which run completely run with rancid-run.
>
> admin@rancidserver:/var/lib/rancid/bin$ sudo ./rancid -t cisco routername100
> [sudo] password for admin:
> sh: 1: clogin: not found

it does not assume a PATH, it inherits; so clogin must be in yours. the
rancid-run uses rancid.conf to adjust its PATH.

> routername100: missed cmd(s): all commands
> routername100: End of run not found
>
> If i try and run under rancid account however, i'm getting permission errors.
> rancid@rancidserver:~/bin$ ./rancid -t cisco routername100
> Can't open rotuername100.new for writing: Permission denied
>
> Kind Regards
> Aaron
>
>

> _______________________________________________
> Rancid-discuss mailing list
> Rancid-discuss@shrubbery.net
> http://www.shrubbery.net/mailman/listinfo/rancid-discuss

_______________________________________________
Rancid-discuss mailing list
Rancid-discuss@shrubbery.net
http://www.shrubbery.net/mailman/listinfo/rancid-discuss
Re: Ubuntu with Rancid 3.7 - Comware (CMW) [ In reply to ]
Thanks Heasley,

Appreciate your responses.

Makes sense regarding PATHS then when running as rancid user.

Any ideas about the 'end of run' issues?

Kind Regards
Aaron