Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some LLDP information needs to be base64/hex decoded #33

Open
tonyfairbanks opened this issue Feb 26, 2021 · 1 comment
Open

Some LLDP information needs to be base64/hex decoded #33

tonyfairbanks opened this issue Feb 26, 2021 · 1 comment

Comments

@tonyfairbanks
Copy link

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:

  • interface-name
  • mac-address
  • local

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.

# show lldp neighbors interface ethernet 1/1/7:1
Loc PortID          Rem Host Name        Rem Port Id                    Rem Chassis Id
--------------------------------------------------------------------------------------
ethernet1/1/7:1     ESX1                 a0:36:9f:df:ac:26             vmnic5


# show lldp neighbors interface ethernet 1/1/7:1 | display-xml
<?xml version="1.0" encoding="UTF-8"?>
<rpc-reply>
  <data>
    <global-params>
      <enable>true</enable>
      <tx-interval>30</tx-interval>
      <txhold-multiplier>4</txhold-multiplier>
...snip
      <virtual-ipv6>false</virtual-ipv6>
    </global-params>
    <interfaces-state>
      <interface>
        <name>ethernet1/1/7:1</name>
        <lldp-rem-neighbor-info>
          <info>
            <rem-lldp-time-mark>52797100</rem-lldp-time-mark>
            <rem-lldp-index>36</rem-lldp-index>
            <dest-mac-addr-index>1</dest-mac-addr-index>
            <rem-if-index>0</rem-if-index>
            <rem-local-port-num>1224</rem-local-port-num>
            <rem-lldp-chassis-id>dm1uaWM1</rem-lldp-chassis-id>
            <rem-lldp-port-id>oDaf36wm</rem-lldp-port-id>
            <rem-lldp-chassis-id-subtype>interface-name</rem-lldp-chassis-id-subtype>
            <rem-lldp-port-subtype>mac-address</rem-lldp-port-subtype>
            <rem-ttl>180</rem-ttl>
            <rem-last-update-time>332607</rem-last-update-time>
            <rem-info-valid-time>172</rem-info-valid-time>
            <rem-system-desc>VMware ESXi Releasebuild-17325551</rem-system-desc>
            <rem-port-desc>port 33 on dvSwitch DSwitch (cswitch)</rem-port-desc>
            <rem-system-name>ESX1</rem-system-name>
            <rem-max-frame-size>0</rem-max-frame-size>
            <rem-agg-link-status>false</rem-agg-link-status>
            <rem-sys-cap-supported>bridge</rem-sys-cap-supported>
            <rem-sys-cap-enabled>bridge</rem-sys-cap-enabled>
            <rem-remote-changes>false</rem-remote-changes>
            <rem-too-many-neighbors>false</rem-too-many-neighbors>
            <rem-dot3-auto-neg-supported>false</rem-dot3-auto-neg-supported>
            <rem-dot3-auto-neg-enabled>false</rem-dot3-auto-neg-enabled>
            <rem-dot3-auto-neg-adv-cap/>
          </info>
        </lldp-rem-neighbor-info>
 ...snip
        </lldp-med-remote-data>
      </interface>
    </interfaces-state>
  </data>
</rpc-reply>


'rem-lldp-chassis-id': base64decode('dm1uaWM1') -> vmnic5

'rem-lldp-port-id': hex2ascii(base64decode('oDaf36wm')) -> A0369FDFAC26

Switch information:

# show version
Dell EMC Networking OS10 Enterprise
Copyright (c) 1999-2020 by Dell Inc. All Rights Reserved.
OS Version: 10.5.2.2
Build Version: 10.5.2.2.258
Build Time: 2020-12-12T02:56:02+0000
System Type: S5224F-ON
Architecture: x86_64
Up Time: 1 week 2 days 23:15:43

@kace
Copy link
Contributor

kace commented Nov 10, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants