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

Missing Index in Table OID #274

Open
cyberchrime opened this issue Jun 7, 2019 · 0 comments
Open

Missing Index in Table OID #274

cyberchrime opened this issue Jun 7, 2019 · 0 comments

Comments

@cyberchrime
Copy link

Hey Guys,

I'm using pysnmp for requesting the neighbors of remote machines with LLDP-MIB::lldpRemTable. Additionally, I added several Organizationally Defined TLVs which can be requested with LLDP-MIB::lldpRemOrgDefInfoTable. Everything works fine for LLDP-MIB::lldpRemTable. However, I'm experiencing a weird behaviour when trying to query for LLDP-MIB::lldpRemOrgDefInfoTable. For some reasons, the index of a Organizationally Defined TLV with subtype 0 is omitted, though the index is very important in order to link it to the corresponding device. For all the other subtypes everything works fine.

This is the code I'm using to do a request:

    for (errorIndication,
         errorStatus,
         errorIndex,
         varBinds) in bulkCmd(SnmpEngine(),
                              CommunityData('public'),
                              UdpTransportTarget((127.0.0.1, 161)),
                              ContextData(),
                              0, 10,
                              ObjectType(ObjectIdentity(mib, oid)),
                              lexicographicMode=False):

        if errorIndication:
            print(errorIndication)
            break
        elif errorStatus:
            print('%s at %s' % (errorStatus.prettyPrint(),
                                errorIndex and varBinds[int(errorIndex) - 1][0] or '?'))
            break
        else:
            for varBind in varBinds:
		    print(varBind.prettyPrint())

, where mib results in LLDP-MIB and oid in lldpRemTable or lldpRemOrgDefInfoTable.

The code results in this output for LLDP-MIB::lldpRemTable:

LLDP-MIB::lldpRemChassisIdSubtype.2216900.2.7 = macAddress
LLDP-MIB::lldpRemChassisIdSubtype.2240800.2.4 = macAddress
LLDP-MIB::lldpRemChassisId.2203800.2.6 = 0x000000000000
LLDP-MIB::lldpRemChassisId.2216900.2.7 = 0x111111111111
LLDP-MIB::lldpRemChassisId.2240800.2.4 = 0x222222222222
LLDP-MIB::lldpRemPortIdSubtype.2203800.2.6 = macAddress
LLDP-MIB::lldpRemPortIdSubtype.2216900.2.7 = macAddress
LLDP-MIB::lldpRemPortIdSubtype.2240800.2.4 = macAddress
LLDP-MIB::lldpRemPortId.2203800.2.6 = 0x000000000000
LLDP-MIB::lldpRemPortId.2216900.2.7 = 0x111111111111
LLDP-MIB::lldpRemPortId.2240800.2.4 = 0x222222222222
LLDP-MIB::lldpRemPortDesc.2203800.2.6 = enp0s10
LLDP-MIB::lldpRemPortDesc.2216900.2.7 = eth0
LLDP-MIB::lldpRemPortDesc.2240800.2.4 = eth0
LLDP-MIB::lldpRemSysName.2203800.2.6 = machine6
LLDP-MIB::lldpRemSysName.2216900.2.7 = machine7
LLDP-MIB::lldpRemSysName.2240800.2.4 = machine4
LLDP-MIB::lldpRemSysDesc.2203800.2.6 = System Description 6
LLDP-MIB::lldpRemSysDesc.2216900.2.7 = System Description 7
LLDP-MIB::lldpRemSysDesc.2240800.2.4 = System Description 4
LLDP-MIB::lldpRemSysCapSupported.2203800.2.6 = bridge, wlanAccessPoint, router, stationOnly
LLDP-MIB::lldpRemSysCapSupported.2216900.2.7 = bridge, wlanAccessPoint, router, stationOnly
LLDP-MIB::lldpRemSysCapSupported.2240800.2.4 = bridge, wlanAccessPoint, router, stationOnly
LLDP-MIB::lldpRemSysCapEnabled.2203800.2.6 = wlanAccessPoint
LLDP-MIB::lldpRemSysCapEnabled.2216900.2.7 = stationOnly
LLDP-MIB::lldpRemSysCapEnabled.2240800.2.4 = bridge, wlanAccessPoint, router

For LLDP-MIB::lldpRemOrgDefInfoTable, I get the following:

LLDP-MIB::lldpRemOrgDefInfo.0.1 = RESERVED
LLDP-MIB::lldpRemOrgDefInfo.2203800.2.6."0x112233".1.2 = AAAAAAAAAA
LLDP-MIB::lldpRemOrgDefInfo.2203800.2.6."0x112233".2.3 = BBBBBB
LLDP-MIB::lldpRemOrgDefInfo.0.1 = RESERVED
LLDP-MIB::lldpRemOrgDefInfo.2216900.2.7."0x123456".1.2 = AAAAAAAAAA

Note the missing index in line 1 and 4. Observing the packet traffic in Wireshark I was able to see that the index is successfully transmitted. Using snmptable from the net-snmp tools also shows the index:

$ snmptable -c public -v2c -Oe 127.0.0.1 -Ci lldpRemOrgDefInfoTable
                index lldpRemOrgDefInfo
2203800.2.6.'."3'.0.1        "RESERVED"
2203800.2.6.'."3'.1.2      "AAAAAAAAAA"
2203800.2.6.'."3'.2.3          "BBBBBB"
2343600.2.7.'.4V'.0.2      "AAAAAAAAAA"
2343600.2.7.'.4V'.2.1        "RESERVED"

Do you have any idea how I can make the index visible again?

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

1 participant