You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using the LLDP handler and manger. I'm getting random/weird characters when I output the address in the lldp_management_address_t. Is there something im doing wrong? Or it is an actual issue? Everything else works fine
Depending on the address family (in your case "1" is IPv4), the management address could be binary data, in which case displaying it without precaution could look "funny" (for address family encodings, check http://www.iana.org/assignments/address-family-numbers/address-family-numbers.xhtml).
To get around that, and make the data more visible, just print the "repr" of the data (see example below).
~/t31/src @dhcp-2018-38.sjc+rtr1% /usr/lib/python2.7/site-packages/illdp.py
Welcome to 'interactive lldp'
Use h() for help, ex() for examples.
tab-completion is enabled; tab-tab (or ?) adds the doc string
...
... et1rs=m.lldp_remote_system_iter(eossdk.IntfId("Ethernet1")).next()
... et1nei=eossdk.LldpNeighbor(eossdk.IntfId("Ethernet1"),et1rs)
... mana=m.management_address(et1nei)[0]
...
... mana.to_string()
"lldp_management_address_t(address_family=6, **address='\x00\x00\x01\x02\x00\x00'**, snmp_ifindex=0, oid='')"
... print mana.to_string()
lldp_management_address_t(address_family=6, **address=''**, snmp_ifindex=0, oid='')
... print **repr**(mana.to_string())
"lldp_management_address_t(address_family=6, **address='\x00\x00\x01\x02\x00\x00'**, snmp_ifindex=0, oid='')"
... print repr(mana.address())
'\x00\x00\x01\x02\x00\x00'
...
Unfortunately, the management address type, unlike the other complex data types of lldp, do not have a pretty printer that prints the string representation of the most common encodings. We should definitely add that. Here is an example of such a pretty printer in action (using an lldp neighbor identified by mac address, in which case we print 11:22:33:44:55:66 instead of \x11\x22....) and also uses a more compact notation
I'm using the LLDP handler and manger. I'm getting random/weird characters when I output the address in the lldp_management_address_t. Is there something im doing wrong? Or it is an actual issue? Everything else works fine
def on_lldp_management_address(self, lldp_neighbor , list_mgmt):
print "mgmt address"
print list_mgmt[0].to_string()
print list_mgmt[0].oid()
print list_mgmt[0].address()
Output:
mgmt address
lldp_management_address_t(address_family=1, address='▒▒-', snmp_ifindex=2, oid='')
▒▒-
Show lldp neighbor output:
leaf-51(config-if-Et5,12)#show lldp neighbors ethernet 3 detail
Interface Ethernet3 detected 1 LLDP neighbors:
Neighbor 90e2.ba82.635c/90e2.ba82.635c, age 9 seconds
Discovered 0:13:39 ago; Last changed 0:13:39 ago
Chassis ID : 90e2.ba82.635c
Port ID : 90e2.ba82.635c
Enabled Capabilities: None
Management Address : 172.31.128.45
Interface Number Subtype : ifIndex (2)
Interface Number : 2
OID String :
Link Aggregation Status: Capable, Disabled (0x01)
Port ID : 0
Auto-negotiation : Supported, Enabled
Other
Operational MAU Type : 10GBASE-X
The text was updated successfully, but these errors were encountered: