1SNMP::Info::LLDP(3) User Contributed Perl Documentation SNMP::Info::LLDP(3)
2
3
4
6 SNMP::Info::LLDP - SNMP Interface to the Link Layer Discovery Protocol
7 (LLDP)
8
10 Eric Miller
11
13 my $lldp = new SNMP::Info (
14 AutoSpecify => 1,
15 Debug => 1,
16 DestHost => 'router',
17 Community => 'public',
18 Version => 2
19 );
20
21 my $class = $lldp->class();
22 print " Using device sub class : $class\n";
23
24 $haslldp = $lldp->hasLLDP() ? 'yes' : 'no';
25
26 # Print out a map of device ports with LLDP neighbors:
27 my $interfaces = $lldp->interfaces();
28 my $lldp_if = $lldp->lldp_if();
29 my $lldp_ip = $lldp->lldp_ip();
30 my $lldp_port = $lldp->lldp_port();
31
32 foreach my $lldp_key (keys %$lldp_ip){
33 my $iid = $lldp_if->{$lldp_key};
34 my $port = $interfaces->{$iid};
35 my $neighbor = $lldp_ip->{$lldp_key};
36 my $neighbor_port = $lldp_port->{$lldp_key};
37 print "Port : $port connected to $neighbor / $neighbor_port\n";
38 }
39
41 SNMP::Info::LLDP is a subclass of SNMP::Info that provides an object
42 oriented interface to LLDP information through SNMP.
43
44 LLDP is a Layer 2 protocol that allows a network device to advertise
45 its identity and capabilities on the local network providing topology
46 information. The protocol is defined in the IEEE standard 802.1AB.
47
48 Create or use a device subclass that inherits this class. Do not use
49 directly.
50
51 Inherited Classes
52 None.
53
54 Required MIBs
55 LLDP-MIB
56 LLDP-EXT-MED-MIB
57 LLDP-EXT-DOT1-MIB
58 LLDP-EXT-DOT3-MIB
59
61 These are methods that return scalar values from SNMP
62
63 $lldp->hasLLDP()
64 Is LLDP is active in this device?
65
66 Note: LLDP may be active, but nothing in "lldpRemoteSystemsData"
67 Tables so the device would not return any useful topology
68 information.
69
70 $lldp->lldp_sysname()
71 The string value used to identify the system name of the local
72 system. If the local agent supports IETF RFC 3418,
73 "lldpLocSysName" object should have the same value of "sysName"
74 object.
75
76 Nulls are removed before the value is returned.
77
78 ("lldpLocSysName")
79
80 $lldp->lldp_sysdesc()
81 The string value used to identify the system description of the
82 local system. If the local agent supports IETF RFC 3418,
83 "lldpLocSysDesc" object should have the same value of "sysDesc"
84 object.
85
86 Nulls are removed before the value is returned.
87
88 ("lldpLocSysDesc")
89
90 $lldp->lldp_sys_cap()
91 Returns which system capabilities are enabled on the local system.
92 Results are munged into an ascii binary string, LSB. Each digit
93 represents a bit from the table below:
94
95 Bit 'other(0)' indicates that the system has capabilities other
96 than those listed below.
97 Bit 'repeater(1)' indicates that the system has repeater
98 capability.
99 Bit 'bridge(2)' indicates that the system has bridge capability.
100 Bit 'wlanAccessPoint(3)' indicates that the system has WLAN access
101 point capability.
102 Bit 'router(4)' indicates that the system has router capability.
103 Bit 'telephone(5)' indicates that the system has telephone
104 capability.
105 Bit 'docsisCableDevice(6)' indicates that the system has DOCSIS
106 Cable Device capability (IETF RFC 2669 & 2670).
107 Bit 'stationOnly(7)' indicates that the system has only station
108 capability and nothing else."
109
110 ("lldpLocSysCapEnabled")
111
113 These are methods that return tables of information in the form of a
114 reference to a hash.
115
116 $lldp->lldp_id()
117 Returns the string value used to identify the chassis component
118 associated with the remote system.
119
120 ("lldpRemChassisId")
121
122 $lldp->lldp_if()
123 Returns the mapping to the SNMP Interface Table. Tries to cross
124 reference ("lldpLocPortDesc") with ("ifDescr") and ("ifAlias") to
125 get ("ifIndex"), if unable defaults to ("lldpRemLocalPortNum").
126
127 $lldp->lldp_ip()
128 Returns remote IPv4 address. Returns for all other address types,
129 use lldp_addr if you want any return address type.
130
131 $lldp->lldp_ipv6()
132 Returns remote IPv6 address, if known. Returns for all other
133 address types, use lldp_addr if you don't care about return address
134 type.
135
136 $lldp->lldp_mac()
137 Returns remote (management) MAC address, if known. Returns for all
138 other address types, use lldp_addr if you don't care about return
139 address type.
140
141 $lldp->lldp_addr()
142 Returns remote address. Type may be any IANA Address Family
143 Number. Currently only returns IPv4, IPv6 or MAC addresses. If the
144 remote device returns more than one address type, this method will
145 give only one. Which one is returned is decided by chance, phase of
146 the moon and Perl hash ordering.
147
148 Use lldp_mac, lldp_ip or lldp_ipv6 if you want a specific address
149 type.
150
151 $lldp->lldp_port()
152 Returns remote port ID
153
154 $lldp->lldp_platform()
155 Tries to return something useful from "lldp_rem_sysdesc()" or
156 "lldp_rem_sysname()".
157
158 $lldp->lldp_cap()
159 Returns hash of arrays with each array containing the system
160 capabilities supported by the remote system. Possible elements in
161 the array are enumerated from "LldpSystemCapabilitiesMap".
162
163 $lldp->lldp_media_cap()
164 Returns hash of arrays with each array containing the media
165 capabilities supported by the remote system. Possible elements in
166 the array are enumerated from "LldpXMedCapabilities".
167
168 LLDP Remote Table ("lldpRemTable")
169 $lldp->lldp_rem_id_type()
170 Returns the type of encoding used to identify the chassis
171 associated with the remote system.
172
173 ("lldpRemChassisIdSubtype")
174
175 $lldp->lldp_rem_id()
176 Returns the string value used to identify the chassis component
177 associated with the remote system.
178
179 ("lldpRemChassisId")
180
181 $lldp->lldp_rem_pid_type()
182 Returns the type of port identifier encoding used in the associated
183 "lldpRemPortId" object.
184
185 ("lldpRemPortIdSubtype")
186
187 $lldp->lldp_rem_pid()
188 Returns the string value used to identify the port component
189 associated with the remote system.
190
191 ("lldpRemPortId")
192
193 $lldp->lldp_rem_desc()
194 Returns the string value used to identify the description of the
195 given port associated with the remote system.
196
197 Nulls are removed before the value is returned.
198
199 ("lldpRemPortDesc")
200
201 $lldp->lldp_rem_sysname()
202 Returns the string value used to identify the system name of the
203 remote system.
204
205 Nulls are removed before the value is returned.
206
207 ("lldpRemSysName")
208
209 $lldp->lldp_rem_sysdesc()
210 Returns the string value used to identify the system description of
211 the remote system.
212
213 Nulls are removed before the value is returned.
214
215 ("lldpRemSysDesc")
216
217 $lldp->lldp_rem_hw_rev()
218 Returns the string value used to identify the hardware revision of
219 the remote system. Nulls are removed before the value is returned.
220
221 ("lldpXMedRemHardwareRev")
222
223 $lldp->lldp_rem_fw_rev()
224 Returns the string value used to identify the firmware revision of
225 the remote system. Nulls are removed before the value is returned.
226
227 ("lldpXMedRemHardwareRev")
228
229 $lldp->lldp_rem_sw_rev()
230 Returns the string value used to identify the software revision of
231 the remote system. Nulls are removed before the value is returned.
232
233 ("lldpXMedRemSoftwareRev")
234
235 $lldp->lldp_rem_serial()
236 Returns the string value used to identify the serial number of the
237 remote system. Nulls are removed before the value is returned.
238
239 ("lldpXMedRemSerialNum")
240
241 $lldp->lldp_rem_vendor()
242 Returns the string value used to identify the manufacturer of the
243 remote system. Nulls are removed before the value is returned.
244
245 ("lldpXMedRemMfgName")
246
247 $lldp->lldp_rem_asset()
248 Returns the string value used to identify the asset number of the
249 remote system. Nulls are removed before the value is returned.
250
251 ("lldpXMedRemAssetID")
252
253 $lldp->lldp_rem_model()
254 Returns the string value used to identify the model of the remote
255 system. Nulls are removed before the value is returned.
256
257 ("lldpXMedRemModelName")
258
259 $lldp->lldp_rem_media_cap_spt()
260 Returns which media capabilities are supported on the remote
261 system. Results are munged into an ascii binary string, LSB.
262
263 $lldp->lldp_rem_media_cap()
264 Returns which media capabilities are enabled on the remote system.
265 Results are munged into an ascii binary string, LSB.
266
267 $lldp->lldp_rem_sys_cap()
268 Returns which system capabilities are enabled on the remote system.
269 Results are munged into an ascii binary string, LSB. Each digit
270 represents a bit from the table below:
271
272 Bit 'other(0)' indicates that the system has capabilities other
273 than those listed below.
274 Bit 'repeater(1)' indicates that the system has repeater
275 capability.
276 Bit 'bridge(2)' indicates that the system has bridge capability.
277 Bit 'wlanAccessPoint(3)' indicates that the system has WLAN access
278 point capability.
279 Bit 'router(4)' indicates that the system has router capability.
280 Bit 'telephone(5)' indicates that the system has telephone
281 capability.
282 Bit 'docsisCableDevice(6)' indicates that the system has DOCSIS
283 Cable Device capability (IETF RFC 2669 & 2670).
284 Bit 'stationOnly(7)' indicates that the system has only station
285 capability and nothing else."
286
287 ("lldpRemSysCapEnabled")
288
289
290
291perl v5.34.0 2022-01-21 SNMP::Info::LLDP(3)