1SNMP::Info::LLDP(3pm) User Contributed Perl DocumentationSNMP::Info::LLDP(3pm)
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
112 $lldp->lldp_loc_id()
113 The string value used to identify the chassis component associated
114 with the local system.
115
116 ("lldpLocChassisId")
117
118 $lldp->lldp_loc_id_type()
119 The type of encoding used to identify the chassis associated with
120 the local system.
121
122 This is used by the above method to decode the octet string in
123 "lldpLocChassisId"
124
125 ("lldpLocChassisIdSubtype")
126
128 These are methods that return tables of information in the form of a
129 reference to a hash.
130
131 $lldp->lldp_id()
132 Returns the string value used to identify the chassis component
133 associated with the remote system.
134
135 ("lldpRemChassisId")
136
137 $lldp->lldp_if()
138 Returns the mapping to the SNMP Interface Table. Tries to cross
139 reference ("lldpLocPortDesc") with ("ifDescr") and ("ifAlias") to
140 get ("ifIndex"), if unable defaults to ("lldpRemLocalPortNum").
141
142 $lldp->lldp_ip()
143 Returns remote IPv4 address. Returns for all other address types,
144 use lldp_addr if you want any return address type.
145
146 $lldp->lldp_ipv6()
147 Returns remote IPv6 address, if known. Returns for all other
148 address types, use lldp_addr if you don't care about return address
149 type.
150
151 $lldp->lldp_mac()
152 Returns remote (management) MAC address, if known. Returns for all
153 other address types, use lldp_addr if you don't care about return
154 address type.
155
156 $lldp->lldp_addr()
157 Returns remote address. Type may be any IANA Address Family
158 Number. Currently only returns IPv4, IPv6 or MAC addresses. If the
159 remote device returns more than one address type, this method will
160 give only one. Which one is returned is decided by chance, phase of
161 the moon and Perl hash ordering.
162
163 Use lldp_mac, lldp_ip or lldp_ipv6 if you want a specific address
164 type.
165
166 $lldp->lldp_port()
167 Returns remote port ID
168
169 $lldp->lldp_platform()
170 Tries to return something useful from lldp_rem_sysdesc() or
171 lldp_rem_sysname().
172
173 $lldp->lldp_cap()
174 Returns hash of arrays with each array containing the system
175 capabilities supported by the remote system. Possible elements in
176 the array are enumerated from "LldpSystemCapabilitiesMap".
177
178 $lldp->lldp_media_cap()
179 Returns hash of arrays with each array containing the media
180 capabilities supported by the remote system. Possible elements in
181 the array are enumerated from "LldpXMedCapabilities".
182
183 LLDP Remote Table ("lldpRemTable")
184 $lldp->lldp_rem_id_type()
185 Returns the type of encoding used to identify the chassis
186 associated with the remote system.
187
188 ("lldpRemChassisIdSubtype")
189
190 $lldp->lldp_rem_id()
191 Returns the string value used to identify the chassis component
192 associated with the remote system.
193
194 ("lldpRemChassisId")
195
196 $lldp->lldp_rem_pid_type()
197 Returns the type of port identifier encoding used in the associated
198 "lldpRemPortId" object.
199
200 ("lldpRemPortIdSubtype")
201
202 $lldp->lldp_rem_pid()
203 Returns the string value used to identify the port component
204 associated with the remote system.
205
206 ("lldpRemPortId")
207
208 $lldp->lldp_rem_desc()
209 Returns the string value used to identify the description of the
210 given port associated with the remote system.
211
212 Nulls are removed before the value is returned.
213
214 ("lldpRemPortDesc")
215
216 $lldp->lldp_rem_sysname()
217 Returns the string value used to identify the system name of the
218 remote system.
219
220 Nulls are removed before the value is returned.
221
222 ("lldpRemSysName")
223
224 $lldp->lldp_rem_sysdesc()
225 Returns the string value used to identify the system description of
226 the remote system.
227
228 Nulls are removed before the value is returned.
229
230 ("lldpRemSysDesc")
231
232 $lldp->lldp_rem_hw_rev()
233 Returns the string value used to identify the hardware revision of
234 the remote system. Nulls are removed before the value is returned.
235
236 ("lldpXMedRemHardwareRev")
237
238 $lldp->lldp_rem_fw_rev()
239 Returns the string value used to identify the firmware revision of
240 the remote system. Nulls are removed before the value is returned.
241
242 ("lldpXMedRemHardwareRev")
243
244 $lldp->lldp_rem_sw_rev()
245 Returns the string value used to identify the software revision of
246 the remote system. Nulls are removed before the value is returned.
247
248 ("lldpXMedRemSoftwareRev")
249
250 $lldp->lldp_rem_serial()
251 Returns the string value used to identify the serial number of the
252 remote system. Nulls are removed before the value is returned.
253
254 ("lldpXMedRemSerialNum")
255
256 $lldp->lldp_rem_vendor()
257 Returns the string value used to identify the manufacturer of the
258 remote system. Nulls are removed before the value is returned.
259
260 ("lldpXMedRemMfgName")
261
262 $lldp->lldp_rem_asset()
263 Returns the string value used to identify the asset number of the
264 remote system. Nulls are removed before the value is returned.
265
266 ("lldpXMedRemAssetID")
267
268 $lldp->lldp_rem_model()
269 Returns the string value used to identify the model of the remote
270 system. Nulls are removed before the value is returned.
271
272 ("lldpXMedRemModelName")
273
274 $lldp->lldp_rem_media_cap_spt()
275 Returns which media capabilities are supported on the remote
276 system. Results are munged into an ascii binary string, LSB.
277
278 $lldp->lldp_rem_media_cap()
279 Returns which media capabilities are enabled on the remote system.
280 Results are munged into an ascii binary string, LSB.
281
282 $lldp->lldp_rem_sys_cap()
283 Returns which system capabilities are enabled on the remote system.
284 Results are munged into an ascii binary string, LSB. Each digit
285 represents a bit from the table below:
286
287 Bit 'other(0)' indicates that the system has capabilities other
288 than those listed below.
289 Bit 'repeater(1)' indicates that the system has repeater
290 capability.
291 Bit 'bridge(2)' indicates that the system has bridge capability.
292 Bit 'wlanAccessPoint(3)' indicates that the system has WLAN access
293 point capability.
294 Bit 'router(4)' indicates that the system has router capability.
295 Bit 'telephone(5)' indicates that the system has telephone
296 capability.
297 Bit 'docsisCableDevice(6)' indicates that the system has DOCSIS
298 Cable Device capability (IETF RFC 2669 & 2670).
299 Bit 'stationOnly(7)' indicates that the system has only station
300 capability and nothing else."
301
302 ("lldpRemSysCapEnabled")
303
304
305
306perl v5.38.0 2023-09-04 SNMP::Info::LLDP(3pm)