Open tonyfairbanks opened 3 years ago
In my experience, encoding for the chassis and port ID's isn't consistent. I'm guessing it depends on the remote system, but I've found that while the values are always base64 encoded they aren't always hex encoded.
Similar to #40 and #39 I have fixed this locally, but need to write tests to before submitting a PR.
The values of 'rem-lldp-chassis-id' and 'rem-lldp-port-id' from show lldp neighbors (and show lldp neighbors detail) are encoded when piped through display-xml. The current LLDP parsing code is not accounting for this and is returning the encoded strings and not the plaintext values.
'rem-lldp-chassis-id-subtype' and 'rem-lldp-port-subtype' indicate what type of value is encoded in their respective fields. So far I've encountered the following subtype values:
The types 'interface-name' and 'local' need to be base64 decoded. Base64 decoding 'mac-address' gives the numeric hex value of the MAC, which then needs to be converted to plaintext.
For the example below, in the XML output 'rem-lldp-chassis-id' needs to be base64 decoded, and 'rem-lldp-port-id''needs to be base64 decoded, and then converted from raw hex values.
'rem-lldp-chassis-id': base64decode('dm1uaWM1') -> vmnic5
'rem-lldp-port-id': hex2ascii(base64decode('oDaf36wm')) -> A0369FDFAC26
Switch information: