Welcome, Guest. Please login or register.

Author Topic: lldp code not correct (not working)  (Read 5480 times)

shadowcaster

  • Guest
lldp code not correct (not working)
« on: March 10, 2010, 02:45:39 PM »
LLDP code got some incorrect assumptions, and not working for non-cisco devices.
please see http://cpansearch.perl.org/src/GAISSMAI/Net-SNMP-Mixin-Dot1abLldp-0.11/lib/Net/SNMP/Mixin/Dot1abLldp.pm for more info.


See sample output for switches (cisco and hp, hp - not working)
Code: [Select]
  #---------------------------------------------------------------
  # the tableIndex is a little bit tricky, please see the LLDP-MIB
  #---------------------------------------------------------------
  #
  # .1.0.8802.1.1.2.1.4.1.1.11[.0.20.1]
  #                             ^  ^ ^
  #                             |  | |
  #           lldpRemTimeMark---/  | |
  #                                | |
  #           lldpRemLocalPortNum--/ |
  #                                  |
  #           lldpRemIndex-----------/
  #
  #---------------------------------------------------------------

hp (ifindex lldp != ifindex iftable)! :
snmpwalk .1.3.6.1.2.1.2.2.1.1
RFC1213-MIB::ifIndex.1 = INTEGER: 1
RFC1213-MIB::ifIndex.101 = INTEGER: 101
RFC1213-MIB::ifIndex.102 = INTEGER: 102
RFC1213-MIB::ifIndex.103 = INTEGER: 103
RFC1213-MIB::ifIndex.104 = INTEGER: 104
RFC1213-MIB::ifIndex.105 = INTEGER: 105
RFC1213-MIB::ifIndex.106 = INTEGER: 106
RFC1213-MIB::ifIndex.107 = INTEGER: 107
RFC1213-MIB::ifIndex.108 = INTEGER: 108

snmpwalk .1.3.6.1.2.1.2.2.1.2
RFC1213-MIB::ifDescr.1 = STRING: "IP Interface"
RFC1213-MIB::ifDescr.101 = STRING: "Port #1"
RFC1213-MIB::ifDescr.102 = STRING: "Port #2"
RFC1213-MIB::ifDescr.103 = STRING: "Port #3"
RFC1213-MIB::ifDescr.104 = STRING: "Port #4"
RFC1213-MIB::ifDescr.105 = STRING: "Port #5"
RFC1213-MIB::ifDescr.106 = STRING: "Port #6"
RFC1213-MIB::ifDescr.107 = STRING: "Port #7"
RFC1213-MIB::ifDescr.108 = STRING: "Port #8"

snmpwalk .1.0.8802.1.1.2.1.3
LLDP-MIB::lldpLocChassisIdSubtype.0 = INTEGER: macAddress(4)
LLDP-MIB::lldpLocChassisId.0 = Hex-STRING: 00 1C 2E 0F CE E0
LLDP-MIB::lldpLocSysName.0 = STRING: procurve.local.domain
LLDP-MIB::lldpLocSysDesc.0 = STRING: PROCURVE J9029A - PA.03.04
LLDP-MIB::lldpLocSysCapSupported.0 = BITS: 20 00 00 00 bridge(2)
LLDP-MIB::lldpLocSysCapEnabled.0 = BITS: 20 00 00 00 bridge(2)
LLDP-MIB::lldpLocPortIdSubtype.1 = INTEGER: local(7)
LLDP-MIB::lldpLocPortIdSubtype.2 = INTEGER: local(7)
LLDP-MIB::lldpLocPortIdSubtype.3 = INTEGER: local(7)
LLDP-MIB::lldpLocPortIdSubtype.4 = INTEGER: local(7)
LLDP-MIB::lldpLocPortIdSubtype.5 = INTEGER: local(7)
LLDP-MIB::lldpLocPortIdSubtype.6 = INTEGER: local(7)
LLDP-MIB::lldpLocPortIdSubtype.7 = INTEGER: local(7)
LLDP-MIB::lldpLocPortIdSubtype.8 = INTEGER: local(7)
LLDP-MIB::lldpLocPortId.1 = STRING: "1"
LLDP-MIB::lldpLocPortId.2 = STRING: "2"
LLDP-MIB::lldpLocPortId.3 = STRING: "3"
LLDP-MIB::lldpLocPortId.4 = STRING: "4"
LLDP-MIB::lldpLocPortId.5 = STRING: "5"
LLDP-MIB::lldpLocPortId.6 = STRING: "6"
LLDP-MIB::lldpLocPortId.7 = STRING: "7"
LLDP-MIB::lldpLocPortId.8 = STRING: "8"
LLDP-MIB::lldpLocPortDesc.1 = STRING: Port #1
LLDP-MIB::lldpLocPortDesc.2 = STRING: Port #2
LLDP-MIB::lldpLocPortDesc.3 = STRING: Port #3
LLDP-MIB::lldpLocPortDesc.4 = STRING: Port #4
LLDP-MIB::lldpLocPortDesc.5 = STRING: Port #5
LLDP-MIB::lldpLocPortDesc.6 = STRING: Port #6
LLDP-MIB::lldpLocPortDesc.7 = STRING: Port #7
LLDP-MIB::lldpLocPortDesc.8 = STRING: Port #8
LLDP-MIB::lldpLocManAddrLen.ipV4."ю╗.Щ" = INTEGER: 5
LLDP-MIB::lldpLocManAddrIfSubtype.ipV4."ю╗.Щ" = INTEGER: ifIndex(2)
LLDP-MIB::lldpLocManAddrIfId.ipV4."ю╗.Щ" = INTEGER: 1
LLDP-MIB::lldpLocManAddrOID.ipV4."ю╗.Щ" = OID: SNMPv2-SMI::enterprises.11.2.3.7.11.66


snmpwalk .1.0.8802.1.1.2.1.4
LLDP-MIB::lldpRemChassisIdSubtype.42805700.1.4 = INTEGER: macAddress(4)
LLDP-MIB::lldpRemChassisId.42805700.1.4 = Hex-STRING: 00 22 6B 22 68 49
LLDP-MIB::lldpRemPortIdSubtype.42805700.1.4 = INTEGER: interfaceName(5)
LLDP-MIB::lldpRemPortId.42805700.1.4 = STRING: "g2"
LLDP-MIB::lldpRemPortDesc.42805700.1.4 = STRING: Ethernet Interface
LLDP-MIB::lldpRemSysName.42805700.1.4 = STRING: cisco
LLDP-MIB::lldpRemSysDesc.42805700.1.4 = STRING: 24-port 10/100 + 4-Port Gigabit Switch with CLI and WebView
LLDP-MIB::lldpRemSysCapSupported.42805700.1.4 = BITS: 20 00 00 00 bridge(2)
LLDP-MIB::lldpRemSysCapEnabled.42805700.1.4 = BITS: 20 00 00 00 bridge(2)






cisco:



snmpwalk .1.3.6.1.2.1.2.2.1.1
RFC1213-MIB::ifIndex.2 = INTEGER: 2
RFC1213-MIB::ifIndex.3 = INTEGER: 3
RFC1213-MIB::ifIndex.4 = INTEGER: 4
RFC1213-MIB::ifIndex.5 = INTEGER: 5
RFC1213-MIB::ifIndex.6 = INTEGER: 6
RFC1213-MIB::ifIndex.7 = INTEGER: 7
RFC1213-MIB::ifIndex.8 = INTEGER: 8
RFC1213-MIB::ifIndex.9 = INTEGER: 9
RFC1213-MIB::ifIndex.10 = INTEGER: 10
RFC1213-MIB::ifIndex.11 = INTEGER: 11
RFC1213-MIB::ifIndex.12 = INTEGER: 12
RFC1213-MIB::ifIndex.13 = INTEGER: 13
RFC1213-MIB::ifIndex.14 = INTEGER: 14
RFC1213-MIB::ifIndex.15 = INTEGER: 15
RFC1213-MIB::ifIndex.16 = INTEGER: 16
RFC1213-MIB::ifIndex.17 = INTEGER: 17
RFC1213-MIB::ifIndex.18 = INTEGER: 18
RFC1213-MIB::ifIndex.19 = INTEGER: 19
RFC1213-MIB::ifIndex.20 = INTEGER: 20
RFC1213-MIB::ifIndex.21 = INTEGER: 21
RFC1213-MIB::ifIndex.22 = INTEGER: 22
RFC1213-MIB::ifIndex.23 = INTEGER: 23
RFC1213-MIB::ifIndex.24 = INTEGER: 24
RFC1213-MIB::ifIndex.25 = INTEGER: 25
RFC1213-MIB::ifIndex.26 = INTEGER: 26
RFC1213-MIB::ifIndex.27 = INTEGER: 27
RFC1213-MIB::ifIndex.28 = INTEGER: 28
RFC1213-MIB::ifIndex.1000 = INTEGER: 1000
RFC1213-MIB::ifIndex.1001 = INTEGER: 1001
RFC1213-MIB::ifIndex.1002 = INTEGER: 1002
RFC1213-MIB::ifIndex.1003 = INTEGER: 1003
RFC1213-MIB::ifIndex.1004 = INTEGER: 1004
RFC1213-MIB::ifIndex.1005 = INTEGER: 1005
RFC1213-MIB::ifIndex.1006 = INTEGER: 1006
RFC1213-MIB::ifIndex.1007 = INTEGER: 1007
RFC1213-MIB::ifIndex.100000 = INTEGER: 100000

snmpwalk .1.3.6.1.2.1.2.2.1.2
RFC1213-MIB::ifDescr.1 = STRING: "Ethernet Interface"
RFC1213-MIB::ifDescr.2 = STRING: "Ethernet Interface"
RFC1213-MIB::ifDescr.3 = STRING: "Ethernet Interface"
RFC1213-MIB::ifDescr.4 = STRING: "Ethernet Interface"
RFC1213-MIB::ifDescr.5 = STRING: "Ethernet Interface"
RFC1213-MIB::ifDescr.6 = STRING: "Ethernet Interface"
RFC1213-MIB::ifDescr.7 = STRING: "Ethernet Interface"
RFC1213-MIB::ifDescr.8 = STRING: "Ethernet Interface"
RFC1213-MIB::ifDescr.9 = STRING: "Ethernet Interface"
RFC1213-MIB::ifDescr.10 = STRING: "Ethernet Interface"
RFC1213-MIB::ifDescr.11 = STRING: "Ethernet Interface"
RFC1213-MIB::ifDescr.12 = STRING: "Ethernet Interface"
RFC1213-MIB::ifDescr.13 = STRING: "Ethernet Interface"
RFC1213-MIB::ifDescr.14 = STRING: "Ethernet Interface"
RFC1213-MIB::ifDescr.15 = STRING: "Ethernet Interface"
RFC1213-MIB::ifDescr.16 = STRING: "Ethernet Interface"
RFC1213-MIB::ifDescr.17 = STRING: "Ethernet Interface"
RFC1213-MIB::ifDescr.18 = STRING: "Ethernet Interface"
RFC1213-MIB::ifDescr.19 = STRING: "Ethernet Interface"
RFC1213-MIB::ifDescr.20 = STRING: "Ethernet Interface"
RFC1213-MIB::ifDescr.21 = STRING: "Ethernet Interface"
RFC1213-MIB::ifDescr.22 = STRING: "Ethernet Interface"
RFC1213-MIB::ifDescr.23 = STRING: "Ethernet Interface"
RFC1213-MIB::ifDescr.24 = STRING: "Ethernet Interface"
RFC1213-MIB::ifDescr.25 = STRING: "Ethernet Interface"
RFC1213-MIB::ifDescr.26 = STRING: "Ethernet Interface"
RFC1213-MIB::ifDescr.27 = STRING: "Ethernet Interface"
RFC1213-MIB::ifDescr.28 = STRING: "Ethernet Interface"
RFC1213-MIB::ifDescr.1000 = STRING: "Ethernet Interface"
RFC1213-MIB::ifDescr.1001 = STRING: "Ethernet Interface"
RFC1213-MIB::ifDescr.1002 = STRING: "Ethernet Interface"
RFC1213-MIB::ifDescr.1003 = STRING: "Ethernet Interface"
RFC1213-MIB::ifDescr.1004 = STRING: "Ethernet Interface"
RFC1213-MIB::ifDescr.1005 = STRING: "Ethernet Interface"
RFC1213-MIB::ifDescr.1006 = STRING: "Ethernet Interface"
RFC1213-MIB::ifDescr.1007 = STRING: "Ethernet Interface"
RFC1213-MIB::ifDescr.100000 = STRING: "vlan"

snmpwalk .1.0.8802.1.1.2.1.3
LLDP-MIB::lldpLocChassisIdSubtype.0 = INTEGER: macAddress(4)
LLDP-MIB::lldpLocChassisId.0 = Hex-STRING: 00 22 6B 22 68 49
LLDP-MIB::lldpLocSysName.0 = STRING: cisco
LLDP-MIB::lldpLocSysDesc.0 = STRING: 24-port 10/100 + 4-Port Gigabit Switch with CLI and WebView
LLDP-MIB::lldpLocSysCapSupported.0 = BITS: 20 bridge(2)
LLDP-MIB::lldpLocSysCapEnabled.0 = BITS: 20 bridge(2)
LLDP-MIB::lldpLocPortIdSubtype.1 = INTEGER: interfaceName(5)
LLDP-MIB::lldpLocPortIdSubtype.2 = INTEGER: interfaceName(5)
LLDP-MIB::lldpLocPortIdSubtype.3 = INTEGER: interfaceName(5)
LLDP-MIB::lldpLocPortIdSubtype.4 = INTEGER: interfaceName(5)
LLDP-MIB::lldpLocPortIdSubtype.5 = INTEGER: interfaceName(5)
LLDP-MIB::lldpLocPortIdSubtype.6 = INTEGER: interfaceName(5)
LLDP-MIB::lldpLocPortIdSubtype.7 = INTEGER: interfaceName(5)
LLDP-MIB::lldpLocPortIdSubtype.8 = INTEGER: interfaceName(5)
LLDP-MIB::lldpLocPortIdSubtype.9 = INTEGER: interfaceName(5)
LLDP-MIB::lldpLocPortIdSubtype.10 = INTEGER: interfaceName(5)
LLDP-MIB::lldpLocPortIdSubtype.11 = INTEGER: interfaceName(5)
LLDP-MIB::lldpLocPortIdSubtype.12 = INTEGER: interfaceName(5)
LLDP-MIB::lldpLocPortIdSubtype.13 = INTEGER: interfaceName(5)
LLDP-MIB::lldpLocPortIdSubtype.14 = INTEGER: interfaceName(5)
LLDP-MIB::lldpLocPortIdSubtype.15 = INTEGER: interfaceName(5)
LLDP-MIB::lldpLocPortIdSubtype.16 = INTEGER: interfaceName(5)
LLDP-MIB::lldpLocPortIdSubtype.17 = INTEGER: interfaceName(5)
LLDP-MIB::lldpLocPortIdSubtype.18 = INTEGER: interfaceName(5)
LLDP-MIB::lldpLocPortIdSubtype.19 = INTEGER: interfaceName(5)
LLDP-MIB::lldpLocPortIdSubtype.20 = INTEGER: interfaceName(5)
LLDP-MIB::lldpLocPortIdSubtype.21 = INTEGER: interfaceName(5)
LLDP-MIB::lldpLocPortIdSubtype.22 = INTEGER: interfaceName(5)
LLDP-MIB::lldpLocPortIdSubtype.23 = INTEGER: interfaceName(5)
LLDP-MIB::lldpLocPortIdSubtype.24 = INTEGER: interfaceName(5)
LLDP-MIB::lldpLocPortIdSubtype.25 = INTEGER: interfaceName(5)
LLDP-MIB::lldpLocPortIdSubtype.26 = INTEGER: interfaceName(5)
LLDP-MIB::lldpLocPortIdSubtype.27 = INTEGER: interfaceName(5)
LLDP-MIB::lldpLocPortIdSubtype.28 = INTEGER: interfaceName(5)
LLDP-MIB::lldpLocPortId.1 = STRING: "e1"
LLDP-MIB::lldpLocPortId.2 = STRING: "e2"
LLDP-MIB::lldpLocPortId.3 = STRING: "e3"
LLDP-MIB::lldpLocPortId.4 = STRING: "e4"
LLDP-MIB::lldpLocPortId.5 = STRING: "e5"
LLDP-MIB::lldpLocPortId.6 = STRING: "e6"
LLDP-MIB::lldpLocPortId.7 = STRING: "e7"
LLDP-MIB::lldpLocPortId.8 = STRING: "e8"
LLDP-MIB::lldpLocPortId.9 = STRING: "e9"
LLDP-MIB::lldpLocPortId.10 = STRING: "e10"
LLDP-MIB::lldpLocPortId.11 = STRING: "e11"
LLDP-MIB::lldpLocPortId.12 = STRING: "e12"
LLDP-MIB::lldpLocPortId.13 = STRING: "e13"
LLDP-MIB::lldpLocPortId.14 = STRING: "e14"
LLDP-MIB::lldpLocPortId.15 = STRING: "e15"
LLDP-MIB::lldpLocPortId.16 = STRING: "e16"
LLDP-MIB::lldpLocPortId.17 = STRING: "e17"
LLDP-MIB::lldpLocPortId.18 = STRING: "e18"
LLDP-MIB::lldpLocPortId.19 = STRING: "e19"
LLDP-MIB::lldpLocPortId.20 = STRING: "e20"
LLDP-MIB::lldpLocPortId.21 = STRING: "e21"
LLDP-MIB::lldpLocPortId.22 = STRING: "e22"
LLDP-MIB::lldpLocPortId.23 = STRING: "e23"
LLDP-MIB::lldpLocPortId.24 = STRING: "e24"
LLDP-MIB::lldpLocPortId.25 = STRING: "g1"
LLDP-MIB::lldpLocPortId.26 = STRING: "g2"
LLDP-MIB::lldpLocPortId.27 = STRING: "g3"
LLDP-MIB::lldpLocPortId.28 = STRING: "g4"
LLDP-MIB::lldpLocPortDesc.1 = STRING: Ethernet Interface
LLDP-MIB::lldpLocPortDesc.2 = STRING: Ethernet Interface
LLDP-MIB::lldpLocPortDesc.3 = STRING: Ethernet Interface
LLDP-MIB::lldpLocPortDesc.4 = STRING: Ethernet Interface
LLDP-MIB::lldpLocPortDesc.5 = STRING: Ethernet Interface
LLDP-MIB::lldpLocPortDesc.6 = STRING: Ethernet Interface
LLDP-MIB::lldpLocPortDesc.7 = STRING: Ethernet Interface
LLDP-MIB::lldpLocPortDesc.8 = STRING: Ethernet Interface
LLDP-MIB::lldpLocPortDesc.9 = STRING: Ethernet Interface
LLDP-MIB::lldpLocPortDesc.10 = STRING: Ethernet Interface
LLDP-MIB::lldpLocPortDesc.11 = STRING: Ethernet Interface
LLDP-MIB::lldpLocPortDesc.12 = STRING: Ethernet Interface
LLDP-MIB::lldpLocPortDesc.13 = STRING: Ethernet Interface
LLDP-MIB::lldpLocPortDesc.14 = STRING: Ethernet Interface
LLDP-MIB::lldpLocPortDesc.15 = STRING: Ethernet Interface
LLDP-MIB::lldpLocPortDesc.16 = STRING: Ethernet Interface
LLDP-MIB::lldpLocPortDesc.17 = STRING: Ethernet Interface
LLDP-MIB::lldpLocPortDesc.18 = STRING: Ethernet Interface
LLDP-MIB::lldpLocPortDesc.19 = STRING: Ethernet Interface
LLDP-MIB::lldpLocPortDesc.20 = STRING: Ethernet Interface
LLDP-MIB::lldpLocPortDesc.21 = STRING: Ethernet Interface
LLDP-MIB::lldpLocPortDesc.22 = STRING: Ethernet Interface
LLDP-MIB::lldpLocPortDesc.23 = STRING: Ethernet Interface
LLDP-MIB::lldpLocPortDesc.24 = STRING: Ethernet Interface
LLDP-MIB::lldpLocPortDesc.25 = STRING: Ethernet Interface
LLDP-MIB::lldpLocPortDesc.26 = STRING: Ethernet Interface
LLDP-MIB::lldpLocPortDesc.27 = STRING: Ethernet Interface
LLDP-MIB::lldpLocPortDesc.28 = STRING: Ethernet Interface
LLDP-MIB::lldpLocManAddrLen.ipV4."ю╗.Ч" = INTEGER: 5
LLDP-MIB::lldpLocManAddrIfSubtype.ipV4."ю╗.Ч" = INTEGER: ifIndex(2)
LLDP-MIB::lldpLocManAddrIfId.ipV4."ю╗.Ч" = INTEGER: 100000
LLDP-MIB::lldpLocManAddrOID.ipV4."ю╗.Ч" = OID: SNMPv2-SMI::zeroDotZero

snmpwalk .1.0.8802.1.1.2.1.4
LLDP-MIB::lldpRemChassisIdSubtype.0.26.1 = INTEGER: macAddress(4)
LLDP-MIB::lldpRemChassisId.0.26.1 = Hex-STRING: 00 1C 2E 0F CE E0
LLDP-MIB::lldpRemPortIdSubtype.0.26.1 = INTEGER: local(7)
LLDP-MIB::lldpRemPortId.0.26.1 = STRING: "1"
LLDP-MIB::lldpRemPortDesc.0.26.1 = STRING: Port #1
LLDP-MIB::lldpRemSysName.0.26.1 = STRING: procurve.local.domain
LLDP-MIB::lldpRemSysDesc.0.26.1 = STRING: PROCURVE J9029A - PA.03.04
LLDP-MIB::lldpRemSysCapSupported.0.26.1 = BITS: 20 bridge(2)
LLDP-MIB::lldpRemSysCapEnabled.0.26.1 = BITS: 20 bridge(2)
LLDP-MIB::lldpRemManAddrIfSubtype.0.26.1.ipV4."ю╗.Щ" = INTEGER: ifIndex(2)
LLDP-MIB::lldpRemManAddrIfId.0.26.1.ipV4."ю╗.Щ" = INTEGER: 1
LLDP-MIB::lldpRemManAddrOID.0.26.1.ipV4."ю╗.Щ" = OID: SNMPv2-SMI::zeroDotZero



rickli

  • Administrator
  • Hero Member
  • *****
  • Posts: 2785
    • View Profile
    • NeDi
Re: lldp code not correct (not working)
« Reply #1 on: March 10, 2010, 09:54:56 PM »
I noticed that on an HP1800 too. What do you suggest to get the index mappings? Fortunately it works for other models...
Please consider Other-Invoices on your NeDi installation for an annual contribution, tx!
-Remo

shadowcaster

  • Guest
Re: lldp code not correct (not working)
« Reply #2 on: March 11, 2010, 01:42:35 PM »
currently, 2 things are blocking the process:
1) You assuming "lldpRemTimeMark" (see remark) = 0 in your code (hardcoded oids), which is not correct. Just skip this part of oid with regex, it should be ok.
2) We should match RFC1213-MIB::ifDescr string with LLDP-MIB::lldpLocPortDesc string to match lldp id with rfc1213 id. ifDesc are the only key that can be used to be 100% sure that we sending query to the same interface. This is per RFC.

Also, it would be great to have a look at code of snmp::info perl library from netdisco code. People over there seems to done hell of a job testing different devices and commenting code. At least have a look at snmp::info::lldp - it is well commented inside, including caveats for different vendors.

http://snmp-info.sourceforge.net/

rickli

  • Administrator
  • Hero Member
  • *****
  • Posts: 2785
    • View Profile
    • NeDi
Re: lldp code not correct (not working)
« Reply #3 on: March 13, 2010, 07:59:22 PM »
I assumed 0 as all devices I've tested went with that (except that 1800). For some reason reading IPs fails with perl on this particular devices as well, so I didn't bother spending more time (getting local IF description means another walk, so anyone pls let me know which devices require this!). I'll look at your suggestion now, tx Vasily.
« Last Edit: March 13, 2010, 09:00:33 PM by rickli »
Please consider Other-Invoices on your NeDi installation for an annual contribution, tx!
-Remo