Closed carsten-AEI closed 4 years ago
@carsten-AEI thank you for that fix. I'm gonna have a look how to implement that best and maybe make it more generic.
Would you be able to provide me with the full output of "show interfaces brief" and "show lldp info remote-device" please? That way I can build a test case for this. Thank you.
Oh gosh, I somehow missed your reply :frowning_face:
# show interfaces brief
Status and Counters - Port Status
| Intrusion MDI Flow Bcast
Port Type | Alert Enabled Status Mode Mode Ctrl Limit
------------ ---------- + --------- ------- ------ ---------- ---- ---- -----
1 100/1000T | No Yes Up 1000FDx MDI off 0
2 100/1000T | No Yes Up 1000FDx MDI off 0
3 100/1000T | No Yes Up 1000FDx MDIX off 0
4 100/1000T | No Yes Up 1000FDx MDI off 0
5 100/1000T | No Yes Up 1000FDx MDI off 0
6 100/1000T | No Yes Up 1000FDx MDI off 0
7 100/1000T | No Yes Up 1000FDx MDI off 0
8 100/1000T | No Yes Up 1000FDx MDI off 0
9 100/1000T | No Yes Up 1000FDx MDI off 0
10 100/1000T | No Yes Up 1000FDx MDIX off 0
11 100/1000T | No Yes Up 1000FDx MDI off 0
12 100/1000T | No Yes Up 1000FDx MDIX off 0
13 100/1000T | No Yes Up 1000FDx MDI off 0
14 100/1000T | No Yes Up 1000FDx MDI off 0
15 100/1000T | No Yes Up 1000FDx MDI off 0
16 100/1000T | No Yes Up 1000FDx MDI off 0
17 100/1000T | No Yes Up 1000FDx MDI off 0
18 100/1000T | No Yes Up 1000FDx MDI off 0
19 100/1000T | No Yes Up 1000FDx MDIX off 0
20 100/1000T | No Yes Up 1000FDx MDI off 0
21 100/1000T | No Yes Up 1000FDx MDI off 0
22 100/1000T | No Yes Up 1000FDx MDI off 0
23 100/1000T | No Yes Up 1000FDx MDIX off 0
24 100/1000T | No Yes Up 1000FDx MDI off 0
25 100/1000T | No Yes Up 1000FDx MDI off 0
26 100/1000T | No Yes Up 1000FDx MDIX off 0
27 100/1000T | No Yes Up 1000FDx MDI off 0
28 100/1000T | No Yes Up 1000FDx MDIX off 0
29 100/1000T | No Yes Up 1000FDx MDIX off 0
30 100/1000T | No Yes Up 1000FDx MDIX off 0
31 100/1000T | No Yes Up 1000FDx MDIX off 0
32 100/1000T | No Yes Up 1000FDx MDIX off 0
33 100/1000T | No Yes Up 1000FDx MDI off 0
34 100/1000T | No Yes Up 1000FDx MDI off 0
35 100/1000T | No Yes Up 1000FDx MDIX off 0
36 100/1000T | No Yes Up 1000FDx MDI off 0
37 100/1000T | No Yes Up 1000FDx MDI off 0
38 100/1000T | No Yes Up 1000FDx MDI off 0
39 100/1000T | No Yes Up 1000FDx MDI off 0
40 100/1000T | No Yes Up 1000FDx MDI off 0
41 100/1000T | No Yes Up 1000FDx MDIX off 0
42 100/1000T | No Yes Up 1000FDx MDI off 0
43 100/1000T | No Yes Down 1000FDx Auto off 0
44 100/1000T | No Yes Down 1000FDx Auto off 0
45 100/1000T | No Yes Down 1000FDx Auto off 0
46 100/1000T | No Yes Down 1000FDx Auto off 0
47 100/1000T | No Yes Down 1000FDx Auto off 0
48 100/1000T | No Yes Down 1000FDx Auto off 0
A1-Dyn1 10GbE-T | No Yes Up 10GigFD MDIX off 0
A2-Dyn1 10GbE-T | No Yes Up 10GigFD MDI off 0
B1-Dyn1 10GbE-T | No Yes Up 10GigFD MDIX off 0
B2-Dyn1 10GbE-T | No Yes Up 10GigFD MDIX off 0
# show lldp info remote-device
LLDP Remote Devices Information
LocalPort | ChassisId PortId PortDescr SysName
--------- + ------------------ ------------------ --------- ------------------
1 | 48 7b 6b 39 88 8b 48 7b 6b 39 88 8b eth0 a1001.atlas.local
2 | 48 7b 6b 39 8b 2f 48 7b 6b 39 8b 2f eth0 a1002.atlas.local
3 | 48 7b 6b 24 13 73 48 7b 6b 24 13 73 eth0 a1003.atlas.local
4 | 48 7b 6b 39 80 1f 48 7b 6b 39 80 1f eth0 a1004.atlas.local
5 | 48 7b 6b 39 7f d3 48 7b 6b 39 7f d3 eth0 a1005.atlas.local
6 | 48 7b 6b 39 82 37 48 7b 6b 39 82 37 eth0 a1006.atlas.local
7 | 48 7b 6b 39 87 3b 48 7b 6b 39 87 3b eth0 a1007.atlas.local
8 | 48 7b 6b 39 88 f3 48 7b 6b 39 88 f3 eth0 a1008.atlas.local
9 | 48 7b 6b 39 82 03 48 7b 6b 39 82 03 eth0 a1009.atlas.local
10 | 48 7b 6b 39 80 2f 48 7b 6b 39 80 2f eth0 a1010.atlas.local
11 | 48 7b 6b 39 87 47 48 7b 6b 39 87 47 eth0 a1011.atlas.local
12 | 48 7b 6b 39 85 fb 48 7b 6b 39 85 fb eth0 a1012.atlas.local
13 | 48 7b 6b 39 88 4e 48 7b 6b 39 88 4b eth0 a1013.atlas.local
14 | 48 7b 6b 39 82 33 48 7b 6b 39 82 33 eth0 a1014.atlas.local
15 | 48 7b 6b 39 7f 2b 48 7b 6b 39 7f 2b eth0 a1015.atlas.local
16 | 48 7b 6b 39 8b 7b 48 7b 6b 39 8b 7b eth0 a1016.atlas.local
17 | 48 7b 6b 39 86 07 48 7b 6b 39 86 07 eth0 a1017.atlas.local
18 | 48 7b 6b 39 8a fb 48 7b 6b 39 8a fb eth0 a1018.atlas.local
19 | 48 7b 6b 39 81 f7 48 7b 6b 39 81 f7 eth0 a1019.atlas.local
20 | 48 7b 6b 39 8a cf 48 7b 6b 39 8a cf eth0 a1020.atlas.local
21 | 48 7b 6b 24 1d 3f 48 7b 6b 24 1d 3f eth0 a1021.atlas.local
22 | 48 7b 6b 39 8a c7 48 7b 6b 39 8a c7 eth0 a1022.atlas.local
23 | 48 7b 6b 39 8a b7 48 7b 6b 39 8a b7 eth0 a1023.atlas.local
24 | 48 7b 6b 39 88 f7 48 7b 6b 39 88 f7 eth0 a1024.atlas.local
25 | 48 7b 6b 39 8b 4b 48 7b 6b 39 8b 4b eth0 a1025.atlas.local
26 | d8 50 e6 c3 a3 ea d8 50 e6 c3 a3 eb eth1 a1026.atlas.local
27 | d8 50 e6 c2 74 38 d8 50 e6 c2 74 39 eth1 a1027.atlas.local
28 | d8 50 e6 c2 6c ea d8 50 e6 c2 6c eb eth1 a1028.atlas.local
29 | d8 50 e6 c4 35 3a d8 50 e6 c4 35 3b eth1 a1029.atlas.local
30 | d8 50 e6 c3 a4 2e d8 50 e6 c3 a4 2f enp3s0 a1030.atlas.local
31 | d8 50 e6 c4 32 70 d8 50 e6 c4 32 71 eth1 a1031.atlas.local
32 | d8 50 e6 c3 96 66 d8 50 e6 c3 96 67 eth1 a1032.atlas.local
33 | d8 50 e6 c4 33 fc d8 50 e6 c4 33 fd eth1 a1033.atlas.local
34 | d8 50 e6 c3 a3 fa d8 50 e6 c3 a3 fb enp3s0 a1034.atlas.local
35 | d8 50 e6 c4 33 b0 d8 50 e6 c4 33 b1 eth1 a1035.atlas.local
36 | d8 50 e6 c2 70 50 d8 50 e6 c2 70 51 eth1 a1036.atlas.local
37 | d8 50 e6 c4 32 8a d8 50 e6 c4 32 8b eth1 a1037.atlas.local
38 | d8 50 e6 c3 96 72 d8 50 e6 c3 96 73 eth1 a1038.atlas.local
39 | d8 50 e6 c4 31 d6 d8 50 e6 c4 31 d7 eth1 a1039.atlas.local
40 | d8 50 e6 c3 a4 5e d8 50 e6 c3 a4 5f eth1 a1040.atlas.local
41 | d8 50 e6 c4 32 e0 d8 50 e6 c4 32 e1 eth1 a1041.atlas.local
42 | d8 50 e6 c2 70 f8 d8 50 e6 c2 70 f9 eth1 a1042.atlas.local
A1 | cc 3e 5f 2f c4 90 Ten-GigabitEthe... Ten-Gi... Coredata
A2 | cc 3e 5f 2f c4 90 Ten-GigabitEthe... Ten-Gi... Coredata
B1 | cc 3e 5f 2f c4 90 Ten-GigabitEthe... Ten-Gi... Coredata
B2 | cc 3e 5f 2f c4 90 Ten-GigabitEthe... Ten-Gi... Coredata
OOBM | cc 3e 5f cf 12 48 Ethernet1/0/30 Ethern... mgs010b
Perfect. Thank you for this, that helps me a lot...
@carsten-AEI Hmm. I realized something is missing. Can you get me the output of get_lldp_neighbors_detail() as well? The show lldp info remote-device output is truncated which means I'm missing a bit of info to build the right test case for this.
Unfortunately, when running
device.open()
vals = device.get_lldp_neighbors_detail()
device.close()
it fails similarly to #2 with
Traceback (most recent call last):
File "./test.py", line 17, in <module>
vals = device.get_lldp_neighbors_detail()
File "/home/carsten/.local/lib/python3.8/site-packages/napalm_procurve/procurve.py", line 340, in get_lldp_neighbors_detail
lldp_neighbors = self.get_lldp_neighbors()
File "/home/carsten/.local/lib/python3.8/site-packages/napalm_procurve/procurve.py", line 306, in get_lldp_neighbors
remote_port, device_id = self._get_lldp_neighbors_detail(local_port)
File "/home/carsten/.local/lib/python3.8/site-packages/napalm_procurve/procurve.py", line 376, in _get_lldp_neighbors_detail
return (tmp_lldp_details["PortId"], tmp_lldp_details["SysName"])
KeyError: 'PortId'
(also it takes about three minutes to arrive at this error but that may be caused by me running it via a VPN connection cobbled together and via telnet as the switch's ssh KEX methods are too ancient :wink: )
Any quick idea what to inject where to debug this? My Python foo is severely lacking...
(edit: This was tested against released version, i.e. pip3 install napalm napalm-procurve
. The latest version fails to setup/pip install with AttributeError: 'ParsedRequirement' object has no attribute 'req'
- shall I open another issue for that?)
@carsten-AEI are you getting this error with your patch applied or without? It'd need your patch to get any output I believe. But good to know that you're running into #2. That will serve as a good reproducer than. Thank you for that.
This makes life a bit more complex though as we're going to need to build a more complete test case to go into _napalm-procurve:/test/unit/mocked_data/test_get_lldpneighbors/2920-oobm.
I'd need the output of the following commands please:
And for good measure, what does autocomplete show you for the interface? e.g. when you type show lldp info remote device [tab][tab].
On my 2910al I'm getting the following:
[ethernet] PORT-LIST Show local or remote device information for the
specified ports.
<cr>
Would be interesting seeing what you're getting. I might also need the output of a few walkMIB commands, but we'll see about that.
Thanks for your help, this way I can mock your switch and make sure that the test-suite runs well on it.
Yeah, the patch was needed :blush:
Let's try to gather all the info:
This was great and super helpful. Thank you. Now for the MIB commands:
What do you get for walkMIB ifName?
Just verbatim?
walkMIB ifName
ifName.1 = 1
ifName.2 = 2
ifName.3 = 3
ifName.4 = 4
ifName.5 = 5
ifName.6 = 6
ifName.7 = 7
ifName.8 = 8
ifName.9 = 9
ifName.10 = 10
ifName.11 = 11
ifName.12 = 12
ifName.13 = 13
ifName.14 = 14
ifName.15 = 15
ifName.16 = 16
ifName.17 = 17
ifName.18 = 18
ifName.19 = 19
ifName.20 = 20
ifName.21 = 21
ifName.22 = 22
ifName.23 = 23
ifName.24 = 24
ifName.25 = 25
ifName.26 = 26
ifName.27 = 27
ifName.28 = 28
ifName.29 = 29
ifName.30 = 30
ifName.31 = 31
ifName.32 = 32
ifName.33 = 33
ifName.34 = 34
ifName.35 = 35
ifName.36 = 36
ifName.37 = 37
ifName.38 = 38
ifName.39 = 39
ifName.40 = 40
ifName.41 = 41
ifName.42 = 42
ifName.43 = 43
ifName.44 = 44
ifName.45 = 45
ifName.46 = 46
ifName.47 = 47
ifName.48 = 48
ifName.49 = A1
ifName.50 = A2
ifName.51 = B1
ifName.52 = B2
ifName.270 = Dyn1
ifName.330 = DEFAULT_VLAN
ifName.4425 = lo0
ifName.4426 = lo1
ifName.4427 = lo2
ifName.4428 = lo3
ifName.4429 = lo4
ifName.4430 = lo5
ifName.4431 = lo6
ifName.4432 = lo7
ifName.4433 = oobm0
ifName.4438 = lo0
@carsten-AEI thanks again for your help. Your code has been merged together with a testcase. Next release to pypi will handle oobm interfaces for your switch correctly.
On our "HP J9728A 2920-48G Switch" with OS version WB.16.03.0003
self._lldp_detail_parser(interface)
returned an empty dict for the OOBM interface as it needs to be queried differently.I hope this small patch helps fixing it for other switches as well without breaking it on others.