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
hasLLDP()
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.
lldp_sysname()
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.
Nulls are removed before the value is returned.
(lldpLocSysName
)
lldp_sysdesc()
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.
Nulls are removed before the value is returned.
(lldpLocSysDesc
)
lldp_sys_cap()
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
)
These are methods that return tables of information in the form of a reference to a hash.
lldp_id()
Returns the string value used to identify the chassis component | associated |
with the remote system. |
(lldpRemChassisId
)
lldp_if()
Returns the mapping to the SNMP Interface Table.
lldp_ip()
Returns remote IPv4 address. Returns for all other address types, use lldp_addr if you want any return address type.
lldp_addr()
Returns remote address. Type may be any IANA Address Family Number. Currently only returns IPv4 or MAC addresses.
lldp_port()
Returns remote port ID
lldpRemTable
)lldp_rem_id_type()
Returns the type of encoding used to identify the chassis associated with the remote system.
(lldpRemChassisIdSubtype
)
lldp_rem_id()
Returns the string value used to identify the chassis component | associated |
with the remote system. |
(lldpRemChassisId
)
lldp_rem_pid_type()
Returns the type of port identifier encoding used in the associated
lldpRemPortId
object.
(lldpRemPortIdSubtype
)
lldp_rem_pid()
Returns the string value used to identify the port component associated with the remote system.
(lldpRemPortId
)
lldp_rem_desc()
Returns the string value used to identify the description of the given port associated with the remote system.
Nulls are removed before the value is returned.
(lldpRemPortDesc
)
lldp_rem_sysname()
Returns the string value used to identify the system name of the remote system.
Nulls are removed before the value is returned.
(lldpRemSysName
)
lldp_rem_sysdesc()
Returns the string value used to identify the system description of the remote system.
Nulls are removed before the value is returned.
(lldpRemSysDesc
)
lldp_rem_sys_cap()
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:
(lldpRemSysCapEnabled
)