SNMP::Info::LLDP - SNMP Interface to the Link Layer Discovery Protocol (LLDP)
Eric Miller
my $lldp = new SNMP::Info ( AutoSpecify => 1, Debug => 1, DestHost => 'router', Community => 'public', Version => 2 ); my $class = $lldp->class(); print " Using device sub class : $class\n"; $haslldp = $lldp->hasLLDP() ? 'yes' : 'no'; # Print out a map of device ports with LLDP neighbors: my $interfaces = $lldp->interfaces(); my $lldp_if = $lldp->lldp_if(); my $lldp_ip = $lldp->lldp_ip(); my $lldp_port = $lldp->lldp_port(); foreach my $lldp_key (keys %$lldp_ip){ my $iid = $lldp_if->{$lldp_key}; my $port = $interfaces->{$iid}; my $neighbor = $lldp_ip->{$lldp_key}; my $neighbor_port = $lldp_port->{$lldp_key}; print "Port : $port connected to $neighbor / $neighbor_port\n"; }
SNMP::Info::LLDP is a subclass of SNMP::Info that provides an object oriented interface to LLDP information through SNMP.
LLDP is a Layer 2 protocol that allows a network device to advertise its identity and capabilities on the local network providing topology information. The protocol is defined in the IEEE standard 802.1AB.
Create or use a device subclass that inherits this class. Do not use directly.
None.
These are methods that return scalar values from SNMP
Is LLDP is active in this device?
Note: LLDP may be active, but nothing in lldpRemoteSystemsData Tables so the device would not return any useful topology information.
lldpRemoteSystemsData
The string value used to identify the system name of the local system. If the local agent supports IETF RFC 3418, lldpLocSysName object should have the same value of sysName object.
lldpLocSysName
sysName
Nulls are removed before the value is returned.
(lldpLocSysName)
The string value used to identify the system description of the local system. If the local agent supports IETF RFC 3418, lldpLocSysDesc object should have the same value of sysDesc object.
lldpLocSysDesc
sysDesc
(lldpLocSysDesc)
Returns which system capabilities are enabled on the local system. Results are munged into an ascii binary string, LSB. Each digit represents a bit from the table below:
(lldpLocSysCapEnabled)
lldpLocSysCapEnabled
These are methods that return tables of information in the form of a reference to a hash.
Returns the string value used to identify the chassis component associated with the remote system.
(lldpRemChassisId)
lldpRemChassisId
Returns the mapping to the SNMP Interface Table. Tries to cross reference (lldpLocPortDesc) with (ifDescr) and (ifAlias) to get (ifIndex), if unable defaults to (lldpRemLocalPortNum).
lldpLocPortDesc
ifDescr
ifAlias
ifIndex
lldpRemLocalPortNum
Returns remote IPv4 address. Returns for all other address types, use lldp_addr if you want any return address type.
Returns remote address. Type may be any IANA Address Family Number. Currently only returns IPv4 or MAC addresses.
Returns remote port ID
Tries to return something useful from lldp_rem_sysdesc() or lldp_rem_sysname().
lldp_rem_sysdesc()
lldp_rem_sysname()
Returns hash of arrays with each array containing the system capabilities supported by the remote system. Possible elements in the array are enumerated from LldpSystemCapabilitiesMap.
LldpSystemCapabilitiesMap
lldpRemTable
Returns the type of encoding used to identify the chassis associated with the remote system.
(lldpRemChassisIdSubtype)
lldpRemChassisIdSubtype
Returns the type of port identifier encoding used in the associated lldpRemPortId object.
lldpRemPortId
(lldpRemPortIdSubtype)
lldpRemPortIdSubtype
Returns the string value used to identify the port component associated with the remote system.
(lldpRemPortId)
Returns the string value used to identify the description of the given port associated with the remote system.
(lldpRemPortDesc)
lldpRemPortDesc
Returns the string value used to identify the system name of the remote system.
(lldpRemSysName)
lldpRemSysName
Returns the string value used to identify the system description of the remote system.
(lldpRemSysDesc)
lldpRemSysDesc
Returns which system capabilities are enabled on the remote system. Results are munged into an ascii binary string, LSB. Each digit represents a bit from the table below:
(lldpRemSysCapEnabled)
lldpRemSysCapEnabled
To install SNMP::Info, copy and paste the appropriate command in to your terminal.
cpanm
cpanm SNMP::Info
CPAN shell
perl -MCPAN -e shell install SNMP::Info
For more information on module installation, please visit the detailed CPAN module installation guide.