NAME
SNMP::Info::LLDP - SNMP Interface to the Link Layer Discovery Protocol (LLDP)
AUTHOR
Eric Miller
SYNOPSIS
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";
}
DESCRIPTION
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.
Inherited Classes
None.
Required MIBs
GLOBALS
These are methods that return scalar values from SNMP
- $lldp->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->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 ofsysName
object.Nulls are removed before the value is returned.
(
lldpLocSysName
) - $lldp->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 ofsysDesc
object.Nulls are removed before the value is returned.
(
lldpLocSysDesc
) - $lldp->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:
- Bit 'other(0)' indicates that the system has capabilities other than those listed below.
- Bit 'repeater(1)' indicates that the system has repeater capability.
- Bit 'bridge(2)' indicates that the system has bridge capability.
- Bit 'wlanAccessPoint(3)' indicates that the system has WLAN access point capability.
- Bit 'router(4)' indicates that the system has router capability.
- Bit 'telephone(5)' indicates that the system has telephone capability.
- Bit 'docsisCableDevice(6)' indicates that the system has DOCSIS Cable Device capability (IETF RFC 2669 & 2670).
- Bit 'stationOnly(7)' indicates that the system has only station capability and nothing else."
(
lldpLocSysCapEnabled
) - $lldp->lldp_loc_id()
-
The string value used to identify the chassis component associated with the local system.
(
lldpLocChassisId
) - $lldp->lldp_loc_id_type()
-
The type of encoding used to identify the chassis associated with the local system.
This is used by the above method to decode the octet string in
lldpLocChassisId
(
lldpLocChassisIdSubtype
)
TABLE METHODS
These are methods that return tables of information in the form of a reference to a hash.
- $lldp->lldp_id()
-
Returns the string value used to identify the chassis component associated with the remote system.
(
lldpRemChassisId
) - $lldp->lldp_if()
-
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
). - $lldp->lldp_ip()
-
Returns remote IPv4 address. Returns for all other address types, use lldp_addr if you want any return address type.
- $lldp->lldp_ipv6()
-
Returns remote IPv6 address, if known. Returns for all other address types, use lldp_addr if you don't care about return address type.
- $lldp->lldp_mac()
-
Returns remote (management) MAC address, if known. Returns for all other address types, use lldp_addr if you don't care about return address type.
- $lldp->lldp_addr()
-
Returns remote address. Type may be any IANA Address Family Number. Currently only returns IPv4, IPv6 or MAC addresses. If the remote device returns more than one address type, this method will give only one. Which one is returned is decided by chance, phase of the moon and Perl hash ordering.
Use lldp_mac, lldp_ip or lldp_ipv6 if you want a specific address type.
- $lldp->lldp_port()
-
Returns remote port ID
- $lldp->lldp_platform()
-
Tries to return something useful from
lldp_rem_sysdesc()
orlldp_rem_sysname()
. - $lldp->lldp_cap()
-
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
. - $lldp->lldp_media_cap()
-
Returns hash of arrays with each array containing the media capabilities supported by the remote system. Possible elements in the array are enumerated from
LldpXMedCapabilities
.
LLDP Remote Table (lldpRemTable
)
- $lldp->lldp_rem_id_type()
-
Returns the type of encoding used to identify the chassis associated with the remote system.
(
lldpRemChassisIdSubtype
) - $lldp->lldp_rem_id()
-
Returns the string value used to identify the chassis component associated with the remote system.
(
lldpRemChassisId
) - $lldp->lldp_rem_pid_type()
-
Returns the type of port identifier encoding used in the associated
lldpRemPortId
object.(
lldpRemPortIdSubtype
) - $lldp->lldp_rem_pid()
-
Returns the string value used to identify the port component associated with the remote system.
(
lldpRemPortId
) - $lldp->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->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->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->lldp_rem_hw_rev()
-
Returns the string value used to identify the hardware revision of the remote system. Nulls are removed before the value is returned.
(
lldpXMedRemHardwareRev
) - $lldp->lldp_rem_fw_rev()
-
Returns the string value used to identify the firmware revision of the remote system. Nulls are removed before the value is returned.
(
lldpXMedRemHardwareRev
) - $lldp->lldp_rem_sw_rev()
-
Returns the string value used to identify the software revision of the remote system. Nulls are removed before the value is returned.
(
lldpXMedRemSoftwareRev
) - $lldp->lldp_rem_serial()
-
Returns the string value used to identify the serial number of the remote system. Nulls are removed before the value is returned.
(
lldpXMedRemSerialNum
) - $lldp->lldp_rem_vendor()
-
Returns the string value used to identify the manufacturer of the remote system. Nulls are removed before the value is returned.
(
lldpXMedRemMfgName
) - $lldp->lldp_rem_asset()
-
Returns the string value used to identify the asset number of the remote system. Nulls are removed before the value is returned.
(
lldpXMedRemAssetID
) - $lldp->lldp_rem_model()
-
Returns the string value used to identify the model of the remote system. Nulls are removed before the value is returned.
(
lldpXMedRemModelName
) - $lldp->lldp_rem_media_cap_spt()
-
Returns which media capabilities are supported on the remote system. Results are munged into an ascii binary string, LSB.
- $lldp->lldp_rem_media_cap()
-
Returns which media capabilities are enabled on the remote system. Results are munged into an ascii binary string, LSB.
- $lldp->lldp_rem_sys_cap()
-
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:
- Bit 'other(0)' indicates that the system has capabilities other than those listed below.
- Bit 'repeater(1)' indicates that the system has repeater capability.
- Bit 'bridge(2)' indicates that the system has bridge capability.
- Bit 'wlanAccessPoint(3)' indicates that the system has WLAN access point capability.
- Bit 'router(4)' indicates that the system has router capability.
- Bit 'telephone(5)' indicates that the system has telephone capability.
- Bit 'docsisCableDevice(6)' indicates that the system has DOCSIS Cable Device capability (IETF RFC 2669 & 2670).
- Bit 'stationOnly(7)' indicates that the system has only station capability and nothing else."
(
lldpRemSysCapEnabled
)