napalm-procurve
napalm-procurve copied to clipboard
get_facts doesn't work on stacked switches
Parsing breaks when multiple results are returned from show commands due to the switches being stacked.
Error:
File "<PATH>/napalm_procurve/procurve.py", line 254, in get_facts
serial_number = line.split(" : ")[2].strip()
IndexError: list index out of range
Sample output:
SWITCH# show system
Status and Counters - General System Information
System Name : SWITCH
System Contact :
System Location :
MAC Age Time (sec) : 300
Time Zone : 60
Daylight Time Rule : Western-Europe
Software revision : WB.15.16.0005
Base MAC Addr : 1458d0-000000
Member :1
ROM Version : WB.15.05
Up Time : 152 days
CPU Util (%) : 0
MAC Addr : 1458d0-000000
Serial Number : SG40AAAAAA
Memory - Total : 165,446,144
Free : 80,752,020
Member :2
ROM Version : WB.15.05
Up Time : 117 days
CPU Util (%) : 17
MAC Addr : 1458d0-000000
Serial Number : SG49AAAAAA
Memory - Total : 165,446,144
Free : 92,550,468
Member :3
ROM Version : WB.15.05
Up Time : 152 days
CPU Util (%) : 0
MAC Addr : 3863bb-000000
Serial Number : SG4BAAAAAA
Memory - Total : 165,446,144
Free : 92,477,244
Cool. Thanks for the report. I've never used stacked ProCurve switches so far.
Is there a clear indicator that a switch is stacked? And how do other show xxx
commands behave? Do they also merge output from the stack members by prefixing it with "Member :x"?
SWITCH# show uptime
Stack
213d 16h 46m
Member 1
152d 22h 41m
Member 2
117d 5h 6m
Member 3
152d 22h 29m
Member 4
213d 16h 46m
show interfaces brief
seems to work the same, just different port names (1/1, 1/2, etc.)
if you have a quick way to test show_model
, let me know.
Edit:
no indicator that it's stacked, but an easy way to check is show stacking
. For non-stacked switches output is simple:
SWITCH-2# show stack
Stacking is disabled.
Thank you. What does show stack show on your device?
I still have some 2650s lying around somewhere in a datacenter, I gotta pick them up and test them out to see how the stacking behaves and use it as a test...
SWITCH# show stacking
Stack ID : 04001458-aaaaaa
MAC Address : 1458d0-aaaaaa
Stack Topology : Ring
Stack Status : Active
Split Policy : One-Fragment-Up
Uptime : 217d 11h 13m
Software Version : WB.15.16.0005
Mbr
ID Mac Address Model Pri Status
--- ------------- -------------------------------------- --- ---------------
1 1458d0-aaaaaa HP J9727A 2920-24G-PoE+ Switch 255 Standby
2 1458d0-baaaaa HP J9727A 2920-24G-PoE+ Switch 250 Member
3 3863bb-caaaaa HP J9727A 2920-24G-PoE+ Switch 245 Member
4 645106-daaaaa HP J9727A 2920-24G-PoE+ Switch 240 Commander
Thank you. That is helpful…