1SNMP::Info::Layer3(3) User Contributed Perl DocumentationSNMP::Info::Layer3(3)
2
3
4
6 SNMP::Info::Layer3 - SNMP Interface to network devices serving Layer3
7 or Layers 2 & 3
8
10 Max Baker
11
13 # Let SNMP::Info determine the correct subclass for you.
14 my $l3 = new SNMP::Info(
15 AutoSpecify => 1,
16 Debug => 1,
17 DestHost => 'myswitch',
18 Community => 'public',
19 Version => 2
20 )
21 or die "Can't connect to DestHost.\n";
22
23 my $class = $l3->class();
24 print "SNMP::Info determined this device to fall under subclass : $class\n";
25
26 # Let's get some basic Port information
27 my $interfaces = $l3->interfaces();
28 my $i_up = $l3->i_up();
29 my $i_speed = $l3->i_speed();
30 foreach my $iid (keys %$interfaces) {
31 my $port = $interfaces->{$iid};
32 my $up = $i_up->{$iid};
33 my $speed = $i_speed->{$iid}
34 print "Port $port is $up. Port runs at $speed.\n";
35 }
36
38 This class is usually used as a superclass for more specific device
39 classes listed under SNMP::Info::Layer3::* Please read all docs under
40 SNMP::Info first.
41
42 Provides generic methods for accessing SNMP data for Layer 3 network
43 devices. Includes support for Layer2+3 devices.
44
45 For speed or debugging purposes you can call the subclass directly, but
46 not after determining a more specific class using the method above.
47
48 my $l3 = new SNMP::Info::Layer3(...);
49
50 Inherited Classes
51 SNMP::Info
52 SNMP::Info::Bridge (For L2/L3 devices)
53 SNMP::Info::EtherLike
54 SNMP::Info::Entity
55 SNMP::Info::PowerEthernet
56 SNMP::Info::IPv6
57 SNMP::Info::LLDP
58 SNMP::Info::DocsisHE
59 SNMP::Info::AdslLine
60
61 Required MIBs
62 IP-MIB
63 ISIS-MIB
64 OSPF-MIB
65 BGP4-MIB
66
67 Inherited MIBs
68 See "REQUIREMENTS" in SNMP::Info for its MIB requirements.
69
70 See "Required MIBs" in SNMP::Info::Bridge for its MIB requirements.
71
72 See "Required MIBs" in SNMP::Info::EtherLike for its MIB requirements.
73
74 See "Required MIBs" in SNMP::Info::Entity for its MIB requirements.
75
76 See "Required MIBs" in SNMP::Info::PowerEthernet for its MIB
77 requirements.
78
79 See "Required MIBs" in SNMP::Info::IPv6 for its MIB requirements.
80
81 See "Required MIBs" in SNMP::Info::LLDP for its MIB requirements.
82
83 See "Required MIBs" in SNMP::Info::DocsisHE for its MIB requirements.
84
85 See "Required MIBs" in SNMP::Info::AdslLine for its MIB requirements.
86
88 These are methods that return scalar value from SNMP
89
90 $l3->mac()
91 Returns root port mac address
92
93 ("ifPhysAddress.1")
94
95 $l3->router_ip()
96 ("ospfRouterId.0")
97
98 $l3->bgp_id()
99 ("bgpIdentifier.0")
100
101 Returns the BGP identifier of the local system
102
103 $l3->bgp_local_as()
104 Returns the local autonomous system number
105
106 ("bgpLocalAs.0")
107
108 Overrides
109 $l3->model()
110 Tries to reference $l3->id() to one of the product MIBs listed
111 above
112
113 Removes 'cisco' from cisco devices for readability.
114
115 $l3->serial()
116 Returns a serial number if found from ENTITY-MIB and OLD-CISCO-...
117 MIB.
118
119 $l3->vendor()
120 Tries to cull a Vendor name from "sysDescr"
121
122 $l3->root_ip()
123 Returns the primary IP used to communicate with the device.
124 Returns the first found: OSPF Router ID ("ospfRouterId") or any
125 OSPF Host IP Address ("ospfHostIpAddress").
126
127 Globals imported from SNMP::Info
128 See "USAGE" in SNMP::Info for details.
129
130 Global Methods imported from SNMP::Info::Bridge
131 See "GLOBALS" in SNMP::Info::Bridge for details.
132
133 Global Methods imported from SNMP::Info::EtherLike
134 See "GLOBALS" in SNMP::Info::EtherLike for details.
135
136 Global Methods imported from SNMP::Info::Entity
137 See "GLOBALS" in SNMP::Info::Entity for details.
138
139 Global Methods imported from SNMP::Info:PowerEthernet
140 See "GLOBALS" in SNMP::Info::PowerEthernet for details.
141
142 Global Methods imported from SNMP::Info::IPv6
143 See "GLOBALS" in SNMP::Info::IPv6 for details.
144
145 Global Methods imported from SNMP::Info::LLDP
146 See "GLOBALS" in SNMP::Info::LLDP for details.
147
148 Global Methods imported from SNMP::Info::DocsisHE
149 See "GLOBALS" in SNMP::Info::DocsisHE for details.
150
151 Global Methods imported from SNMP::Info::AdslLine
152 See "GLOBALS" in SNMP::Info::AdslLine for details.
153
155 These are methods that return tables of information in the form of a
156 reference to a hash.
157
158 Overrides
159 $l3->interfaces()
160 Returns the map between SNMP Interface Identifier (iid) and
161 physical port name.
162
163 Only returns those iids that have a description listed in
164 $l3->i_description()
165
166 $l3->i_subinterfaces()
167 Returns reference to hash of arrays: key = "ifIndex", value = array
168 of "ifIndex". These are the VLAN subinterfaces ("l2vlan" type) for
169 the parent ("ethernetCsmacd" type) interface.
170
171 Example:
172 my $interfaces = $l3->interfaces();
173 my $i_subs = $l3->i_subinterfaces();
174
175 foreach my $iid (sort keys %$interfaces) {
176 my $port = $interfaces->{$iid};
177 my $subs = join(',', sort(map {$interfaces->{$_}} @{$i_subs->{$iid}}));
178 print "Port: $port has subinterfaces: $subs\n";
179 }
180
181 $l3->i_name()
182 Returns reference to hash of iid to human set name.
183
184 Defaults to "ifName", but checks for an "ifAlias"
185
186 $l3->i_duplex()
187 Returns reference to hash of iid to current link duplex setting.
188
189 Maps $l3->el_index() to $l3->el_duplex, then culls out full,half,
190 or auto and sets the map to that value.
191
192 See SNMP::Info::EtherLike for the el_index() and el_duplex()
193 methods.
194
195 IP-MIB Arp Cache Table ("ipNetToMediaTable")
196 $l3->at_index()
197 Returns reference to hash. Maps ARP table entries to Interface
198 IIDs
199
200 ("ipNetToMediaIfIndex")
201
202 If the device doesn't support "ipNetToMediaIfIndex", this will try
203 the deprecated "atIfIndex".
204
205 $l3->at_paddr()
206 Returns reference to hash. Maps ARP table entries to MAC
207 addresses.
208
209 ("ipNetToMediaPhysAddress")
210
211 If the device doesn't support "ipNetToMediaPhysAddress", this will
212 try the deprecated "atPhysAddress".
213
214 $l3->at_netaddr()
215 Returns reference to hash. Maps ARP table entries to IP addresses.
216
217 ("ipNetToMediaNetAddress")
218
219 If the device doesn't support "ipNetToMediaNetAddress", this will
220 try the deprecated "atNetAddress".
221
222 ARP Cache Entries
223 The "atTable" has been deprecated since 1991. You should never need to
224 use these methods. See "ipNetToMediaTable" above.
225
226 $l3->old_at_index()
227 Returns reference to map of IID to Arp Cache Entry
228
229 ("atIfIndex")
230
231 $l3->old_at_paddr()
232 Returns reference to hash of Arp Cache Entries to MAC address
233
234 ("atPhysAddress")
235
236 $l3->old_at_netaddr()
237 Returns reference to hash of Arp Cache Entries to IP Address
238
239 ("atNetAddress")
240
241 BGP Peer Table ("bgpPeerTable")
242 $l3->bgp_peers()
243 Returns reference to hash of BGP peer to local IP address
244
245 ("bgpPeerLocalAddr")
246
247 $l3->bgp_peer_id()
248 Returns reference to hash of BGP peer to BGP peer identifier
249
250 ("bgpPeerIdentifier")
251
252 $l3->bgp_peer_state()
253 Returns reference to hash of BGP peer to BGP peer state
254
255 ("bgpPeerState")
256
257 $l3->bgp_peer_as()
258 Returns reference to hash of BGP peer to BGP peer autonomous system
259 number
260
261 ("bgpPeerRemoteAs")
262
263 $l3->bgp_peer_addr()
264 Returns reference to hash of BGP peer to BGP peer IP address
265
266 ("bgpPeerRemoteAddr")
267
268 $l3->bgp_peer_fsm_est_trans()
269 Returns reference to hash of BGP peer to the total number of times
270 the BGP FSM transitioned into the established state
271
272 ("bgpPeerFsmEstablishedTransitions")
273
274 $l3->bgp_peer_in_tot_msgs()
275 Returns reference to hash of BGP peer to the total number of
276 messages received from the remote peer on this connection
277
278 ("bgpPeerInTotalMessages")
279
280 $l3->bgp_peer_in_upd_el_time()
281 Returns reference to hash of BGP peer to the elapsed time in
282 seconds since the last BGP UPDATE message was received from the
283 peer.
284
285 ("bgpPeerInUpdateElapsedTime")
286
287 $l3->bgp_peer_in_upd()
288 Returns reference to hash of BGP peer to the number of BGP UPDATE
289 messages received on this connection
290
291 ("bgpPeerInUpdates")
292
293 $l3->bgp_peer_out_tot_msgs()
294 Returns reference to hash of BGP peer to the total number of
295 messages transmitted to the remote peer on this connection
296
297 ("bgpPeerOutTotalMessages")
298
299 $l3->bgp_peer_out_upd()
300 Returns reference to hash of BGP peer to the number of BGP UPDATE
301 messages transmitted on this connection
302
303 ("bgpPeerOutUpdates")
304
305 OSPF Interface Table ("ospfIfTable")
306 $l3->ospf_if_ip()
307 Returns reference to hash of OSPF interface IP addresses
308
309 ("ospfIfIpAddress")
310
311 $l3->ospf_if_area()
312 Returns reference to hash of the OSPF area to which the interfaces
313 connect
314
315 ("ospfIfAreaId")
316
317 $l3->ospf_if_type()
318 Returns reference to hash of the OSPF interfaces' type
319
320 ("ospfIfType")
321
322 $l3->ospf_if_hello()
323 Returns reference to hash of the OSPF interfaces' hello interval
324
325 ("ospfIfHelloInterval")
326
327 $l3->ospf_if_dead()
328 Returns reference to hash of the OSPF interfaces' dead interval
329
330 ("ospfIfRtrDeadInterval")
331
332 $l3->ospf_if_admin()
333 Returns reference to hash of the OSPF interfaces' administrative
334 status
335
336 ("ospfIfAdminStat")
337
338 $l3->ospf_if_state()
339 Returns reference to hash of the OSPF interfaces' state
340
341 ("ospfIfState")
342
343 OSPF Neighbor Table ("ospfNbrTable")
344 $l3->ospf_peers()
345 Returns reference to hash of IP addresses the neighbor is using in
346 its IP Source Addresses
347
348 ("ospfNbrIpAddr")
349
350 $l3->ospf_peer_id()
351 Returns reference to hash of neighbor Router IDs
352
353 ("ospfNbrRtrId")
354
355 $l3->ospf_peer_state()
356 Returns reference to hash of state of the relationship with the
357 neighbor routers
358
359 ("ospfNbrState")
360
361 IS-IS Circuit Table
362 $l3->isis_circ_if_idx()
363 Returns reference to hash of the interface index associated with
364 the IS-IS circuit ("isisCircIfIndex")
365
366 $l3->isis_circ_admin()
367 Returns reference to hash of the IS-IS circuit's admin status
368
369 ("isisCircAdminState")
370
371 $l3->isis_circ_type()
372 Returns reference to hash of the IS-IS circuit's type
373
374 ("isisCircType")
375
376 $l3->isis_circ_level_type()
377 Returns reference to hash of the IS-IS circuit's level
378
379 ("isisCircLevelType")
380
381 IS-IS Adjacency Table
382 $l3->isis_adj_id()
383 Returns reference to hash of the peer id of adjacencies.
384
385 ("isisISAdjNeighSysID")
386
387 $l3->isis_adj_type()
388 Returns reference to hash of the type of adjacencies (Level 1
389 Intermediate System, Level 2 Intermediate System, Level 1+2
390 Intermediate System, unknown)
391
392 ("isisISAdjNeighSysType")
393
394 $l3->isis_adj_usage()
395 Returns reference to hash of the type of adjacencies in use
396 (undefined, Level 1, Level 2, Level1+2)
397
398 ("isisISAdjNeighUsage")
399
400 $l3->isis_adj_ip_type()
401 Returns reference to hash of type of address (IPv4, IPv6, etc) on
402 adjacencies.
403
404 ("isisISAdjIPAddrType")
405
406 $l3->isis_adj()
407 Returns reference to hash of addresses (IPv4, IPv6, etc) on
408 adjacencies. Note this returns hash-strings, for IPs, use
409 $l3->isis_peers()
410
411 ("isisISAdjIPAddrAddress")
412
413 $l3->isis_peers()
414 Returns reference to hash of addresses (IPv4, IPv6) on adjacencies.
415 Convert hash strings from isis_adj to proper IP (v4 and v6)
416 formatting.
417
418 Table Methods imported from SNMP::Info
419 See "USAGE" in SNMP::Info for details.
420
421 Table Methods imported from SNMP::Info::Bridge
422 See "TABLE METHODS" in SNMP::Info::Bridge for details.
423
424 Table Methods imported from SNMP::Info::EtherLike
425 See "TABLE METHODS" in SNMP::Info::EtherLike for details.
426
427 Table Methods imported from SNMP::Info::Entity
428 See "TABLE METHODS" in SNMP::Info::Entity for details.
429
430 Table Methods imported from SNMP::Info::PowerEthernet
431 See "TABLE METHODS" in SNMP::Info::PowerEthernet for details.
432
433 Table Methods imported from SNMP::Info::IPv6
434 See "TABLE METHODS" in SNMP::Info::IPv6 for details.
435
436 Table Methods imported from SNMP::Info::LLDP
437 See "TABLE METHODS" in SNMP::Info::LLDP for details.
438
439 Table Methods imported from SNMP::Info::DocsisHE
440 See "TABLE METHODS" in SNMP::Info::DocsisHE for details.
441
442 Table Methods imported from SNMP::Info::AdslLine
443 See "TABLE METHODS" in SNMP::Info::AdslLine for details.
444
445
446
447perl v5.36.1 2023-07-17 SNMP::Info::Layer3(3)