[rancid] Assistance creating a perl module to use with ZPE Systems NodegridOS Devices
Mick O'Donovan
mick.odonovan at heanet.ie
Fri Oct 15 14:59:01 UTC 2021
Hi Heas, all,
I'm struggling with an issue in trying to get some outputs from our ZPE estate of Out of Band devices using RANCID. What I have tried to do thus far is as follows:
1. Set credentials for my devices in .cloginrc
2. Cloned both clogin and rancid files in /var/lib/rancid/bin to zpelogin and zperancid respectively (just for separation)
- Here's the diff of the files:
rancid at rancid-staging:~/bin$ diff clogin zpelogin
1052,1072c1052,1072
< if { $do_command || $do_script } {
< if { [string compare "extreme" "$platform"] } {
< # If the prompt is (enable), then we are on a switch and the
< # command is "set length 0"; otherwise its "terminal length 0".
< if [regexp -- ".*> .*enable" "$prompt"] {
< send "set length 0\r"
< expect -re $prompt {}
< send "set width 132\r"
< expect -re $prompt {}
< send "set logging session disable\r"
< } else {
< send "terminal length 0\r"
< expect -re $prompt {}
< send "terminal width 132\r"
< }
< expect -re $prompt {}
< } else {
< send "disable clipaging\r"
< expect -re $prompt {}
< }
< }
---
> # if { $do_command || $do_script } {
> # if { [string compare "extreme" "$platform"] } {
> # # If the prompt is (enable), then we are on a switch and the
> # # command is "set length 0"; otherwise its "terminal length 0".
> # if [regexp -- ".*> .*enable" "$prompt"] {
> # send "set length 0\r"
> # expect -re $prompt {}
> # send "set width 132\r"
> # expect -re $prompt {}
> # send "set logging session disable\r"
> # } else {
> # send "terminal length 0\r"
> # expect -re $prompt {}
> # send "terminal width 132\r"
> # }
> # expect -re $prompt {}
> # } else {
> # send "disable clipaging\r"
> # expect -re $prompt {}
> # }
> # }
^^^ so essentially I've removed the cisco specific terminal length setting, etc
rancid at rancid-staging:~/bin$ diff rancid zperancid
140a141,143
> # I don't care if it sees "exit"
> $clean_run = 1;
>
^^^ It was recommended to me several weeks back to make this change but I can't for the life of me remember why.
3. edited /etc/rancid/rancid.types.[conf/base] to include the following lines
zpe;script;zperancid -t zpe
zpe;login;zpelogin
zpe;module;eos
zpe;inloop;eos::inloop
zpe;command;eos::ShowSoftware;show system/about
zpe;command;eos::ShowConfig;export_settings
^^^ the above trying the eos.pm module
When I run some debug against a host I receive the following:
rancid -d -t zpe <redacted>
loadtype: device type zpe
loadtype: found device type zpe in /etc/rancid/rancid.types.base
executing zpelogin -t 90 -c"show system/about;export_settings;show_settings" <redacted>
PROMPT MATCH: \[heanet@<redacted> /\]#
HIT COMMAND:[heanet@<redacted> /]# show system/about
In ShowSoftware: [heanet@<redacted> /]# show system/about
<redacted>: missed cmd(s): export_settings,show_settings
<redacted>: missed cmd(s): export_settings,show_settings
<redacted>: End of run not found
<redacted>: End of run not found
My reading of the above is that the module in question can properly understand the output received from the "show system/about" command and therefore stops and doesn't run the subsequent command. I would like to either get this sorted using pre-existing modules (probably not possible) or create a new perl module specific to zpe (happy to share with the community for others to use if needed).
For completeness, he's a snip of the outputs received in each of the commands I'm looking to run:
[heanet@<redacted> /]# show system/about/
system: Nodegrid Gate SR
licenses: 25
software: vX.X.X (Sep 9 2021 - 09:39:02)
cpu: Intel(R) Atom(TM) CPU C3538 @ 2.10GHz
cpu_cores: 4
bogomips_per_core: 4200.00
serial_number: XXX
uptime: 2 days, 23 hours, 49 minutes
model: GateSR
part_number: GSR-T8-BASE
bios_version: 90816T00
psu: 2
revision tag: Initial Config 2021-01-18 11:03:08.917159
bios sed compatible: no
ssd sed compatible: yes
[heanet@<redacted> /]# export_settings
<SNIP>
/settings/auditing/destinations/email email_port=25
/settings/auditing/destinations/email password=********
/settings/auditing/destinations/email confirm_password=********
/settings/auditing/destinations/email start_tls=yes
This is something that has been bugging me for a while so any help would be much appreciated!
Regards,
--
Mick O’Donovan
Senior Network Engineer
HEAnet CLG
Ireland's National Education and Research Network
1st Floor | 5 George's Dock | IFSC | Dublin D01 X8N7 | Ireland
+353 1 6609040 | mick.odonovan at heanet.ie | www.heanet.ie <http://www.heanet.ie>
Registered in Ireland, No. 275301 | CRA No. 20036270
More information about the Rancid-discuss
mailing list