1SNMP::Info(3)         User Contributed Perl Documentation        SNMP::Info(3)
2
3
4

NAME

6       SNMP::Info - OO Interface to Network devices and MIBs through SNMP
7

VERSION

9       SNMP::Info - Version 3.66
10

AUTHOR

12       SNMP::Info is maintained by team of Open Source authors headed by Eric
13       Miller, Bill Fenner, Max Baker, Jeroen van Ingen and Oliver Gorwits.
14
15       Please visit <https://github.com/netdisco/snmp-info/> for the most up-
16       to-date list of developers.
17
18       SNMP::Info was originally created at UCSC for the Netdisco project
19       <http://netdisco.org> by Max Baker.
20

DEVICES SUPPORTED

22       There are now generic classes for most types of device and so the
23       authors recommend loading SNMP::Info with AutoSpecify, and then
24       reporting to the mail list any missing functionality (such as neighbor
25       discovery tables).
26

SYNOPSIS

28        use SNMP::Info;
29
30        my $info = new SNMP::Info(
31                                   # Auto Discover more specific Device Class
32                                   AutoSpecify => 1,
33                                   Debug       => 1,
34                                   # The rest is passed to SNMP::Session
35                                   DestHost    => 'router',
36                                   Community   => 'public',
37                                   Version     => 2
38                                 ) or die "Can't connect to device.\n";
39
40        my $err = $info->error();
41        die "SNMP Community or Version probably wrong connecting to device. $err\n" if defined $err;
42
43        my $name  = $info->name();
44        my $class = $info->class();
45        print "SNMP::Info is using this device class : $class\n";
46
47        # Find out the Duplex status for the ports
48        my $interfaces = $info->interfaces();
49        my $i_duplex   = $info->i_duplex();
50
51        # Get CDP Neighbor info
52        my $c_if       = $info->c_if();
53        my $c_ip       = $info->c_ip();
54        my $c_port     = $info->c_port();
55
56        # Print out data per port
57        foreach my $iid (keys %$interfaces){
58           my $duplex = $i_duplex->{$iid};
59           # Print out physical port name, not snmp iid
60           my $port  = $interfaces->{$iid};
61
62           print "$port: ";
63           print "$duplex duplex" if defined $duplex;
64
65           # The CDP Table has table entries different than the interface tables.
66           # So we use c_if to get the map from cdp table to interface table.
67
68           my %c_map = reverse %$c_if;
69           my $c_key = $c_map{$iid};
70           unless (defined $c_key) {
71                print "\n\n";
72                next;
73            }
74           my $neighbor_ip   = $c_ip->{$c_key};
75           my $neighbor_port = $c_port->{$c_key};
76
77           print " connected to $neighbor_ip / $neighbor_port\n" if defined $neighbor_ip;
78           print "\n";
79
80        }
81

SUPPORT

83       Please direct all support, help, and bug requests to the snmp-info-
84       users Mailing List at
85       <http://lists.sourceforge.net/lists/listinfo/snmp-info-users>.
86

DESCRIPTION

88       SNMP::Info gives an object oriented interface to information obtained
89       through SNMP.
90
91       This module is geared towards network devices.  Subclasses exist for a
92       number of network devices and common MIBs.
93
94       The idea behind this module is to give a common interface to data from
95       network devices, leaving the device-specific hacks behind the scenes in
96       subclasses.
97
98       In the SYNOPSIS example we fetch the name of all the ports on the
99       device and the duplex setting for that port with two methods --
100       interfaces() and i_duplex().
101
102       The information may be coming from any number of MIB files and is very
103       vendor specific.  SNMP::Info provides you a common method for all
104       supported devices.
105
106       Adding support for your own device is easy, and takes little SNMP
107       knowledge.
108
109       The module is not limited to network devices. Any MIB or device can be
110       given an objected oriented front-end by making a module that consists
111       of a couple hashes.  See EXTENDING SNMP::INFO.
112

REQUIREMENTS

114       1. Net-SNMP
115           To use this module, you must have Net-SNMP installed on your
116           system.  More specifically you need the Perl modules that come with
117           it.
118
119           DO NOT INSTALL SNMP:: or Net::SNMP from CPAN!
120
121           The SNMP module is matched to an install of net-snmp, and must be
122           installed from the net-snmp source tree.
123
124           The Perl module "SNMP" is found inside the net-snmp distribution.
125           Go to the perl/ directory of the distribution to install it, or run
126           "./configure --with-perl-modules" from the top directory of the
127           net-snmp distribution.
128
129           Net-SNMP can be found at http://net-snmp.sourceforge.net
130
131           Version 5.3.2 or greater is recommended.
132
133           Versions 5.0.1, 5.0301 and 5.0203 have issues with bulkwalk and are
134           not supported.
135
136           Redhat Users: Some versions that come with certain versions of
137           Redhat/Fedora don't have the Perl library installed.  Uninstall the
138           RPM and install by hand.
139
140       2. MIBS
141           SNMP::Info operates on textual descriptors found in MIBs.
142
143           If you are using SNMP::Info separate from Netdisco, download the
144           Netdisco MIB package at
145           <https://github.com/netdisco/netdisco-mibs/releases/latest/>
146
147           Make sure that your snmp.conf is updated to point to your MIB
148           directory and that the MIBs are world-readable.
149

DESIGN GOALS

151       1. Use of textual MIB leaf identifier and enumerated values
152           ·   All values are retrieved via MIB Leaf node names
153
154               For example SNMP::Info has an entry in its %GLOBALS hash for
155               ``sysName'' instead of 1.3.6.1.2.1.1.5.
156
157           ·   Data returned is in the enumerated value form.
158
159               For Example instead of looking up 1.3.6.1.2.1.2.2.1.3 and
160               getting back 23
161
162               SNMP::Info will ask for "RFC1213-MIB::ifType" and will get back
163               "ppp".
164
165       2. SNMP::Info is easily extended to new devices
166           You can create a new subclass for a device by providing four hashes
167           : %GLOBALS, %MIBS, %FUNCS, and %MUNGE.
168
169           Or you can override any existing methods from a parent class by
170           making a short subroutine.
171
172           See the section EXTENDING SNMP::INFO for more details.
173
174           When you make a new subclass for a device, please be sure to send
175           it back to the developers (via a github pull request or the mailing
176           list) for inclusion in the next version.
177

SUBCLASSES

179       These are the subclasses that implement MIBs and support devices:
180
181       Required MIBs not included in the install instructions above are noted
182       here.
183
184   MIB Subclasses
185       These subclasses implement method to access one or more MIBs.  These
186       are not used directly, but rather inherited from device subclasses.
187
188       For more info run "perldoc" on any of the following module names.
189
190       SNMP::Info::AdslLine
191           SNMP Interface to the ADSL-LINE-MIB for ADSL interfaces.
192
193           Requires the ADSL-LINE-MIB, down loadable from Cisco.
194
195           See documentation in SNMP::Info::AdslLine for details.
196
197       SNMP::Info::Aggregate
198           SNMP Interface to IF-MIB "ifStackTable" Aggregated Links
199
200           See documentation in SNMP::Info::Aggregate for details.
201
202       SNMP::Info::Airespace
203           AIRESPACE-WIRELESS-MIB and AIRESPACE-SWITCHING-MIB.  Inherited by
204           devices based on the Airespace wireless platform.
205
206           See documentation in SNMP::Info::Airespace for details.
207
208       SNMP::Info::AMAP
209           ALCATEL-IND1-INTERSWITCH-PROTOCOL-MIB.  Alcatel Mapping Adjacency
210           Protocol (AMAP) Support.
211
212           See documentation in SNMP::Info::AMAP for details.
213
214       SNMP::Info::Bridge
215           BRIDGE-MIB (RFC1286).  Q-BRIDGE-MIB. Inherited by devices with
216           Layer2 support.
217
218           See documentation in SNMP::Info::Bridge for details.
219
220       SNMP::Info::CiscoAgg
221           SNMP Interface to Cisco Aggregated Links
222
223           See documentation in SNMP::Info::CiscoAgg for details.
224
225       SNMP::Info::CDP
226           CISCO-CDP-MIB.  Cisco Discovery Protocol (CDP) Support.  Inherited
227           by Cisco, Enterasys, and HP devices.
228
229           See documentation in SNMP::Info::CDP for details.
230
231       SNMP::Info::CiscoConfig
232           CISCO-CONFIG-COPY-MIB, CISCO-FLASH-MIB, and OLD-CISCO-SYS-MIB.
233           These OIDs facilitate the writing of configuration files.
234
235           See documentation in SNMP::Info::CiscoConfig for details.
236
237       SNMP::Info::CiscoPortSecurity
238           CISCO-PORT-SECURITY-MIB and CISCO-PAE-MIB.
239
240           See documentation in SNMP::Info::CiscoPortSecurity for details.
241
242       SNMP::Info::CiscoPower
243           CISCO-POWER-ETHERNET-EXT-MIB.
244
245           See documentation in SNMP::Info::CiscoPower for details.
246
247       SNMP::Info::CiscoQOS
248           CISCO-CLASS-BASED-QOS-MIB. A collection of OIDs providing
249           information about a Cisco device's QOS config.
250
251           See documentation in SNMP::Info::CiscoQOS for details.
252
253       SNMP::Info::CiscoRTT
254           CISCO-RTTMON-MIB. A collection of OIDs providing information about
255           a Cisco device's RTT values.
256
257           See documentation in SNMP::Info::CiscoRTT for details.
258
259       SNMP::Info::CiscoStack
260           CISCO-STACK-MIB.
261
262           See documentation in SNMP::Info::CiscoStack for details.
263
264       SNMP::Info::CiscoStpExtensions
265           CISCO-STP-EXTENSIONS-MIB
266
267           See documentation in SNMP::Info::CiscoStpExtensions for details.
268
269       SNMP::Info::CiscoStats
270           OLD-CISCO-CPU-MIB, CISCO-PROCESS-MIB, and CISCO-MEMORY-POOL-MIB.
271           Provides common interfaces for memory, cpu, and os statistics for
272           Cisco devices.
273
274           See documentation in SNMP::Info::CiscoStats for details.
275
276       SNMP::Info::CiscoVTP
277           CISCO-VTP-MIB, CISCO-VLAN-MEMBERSHIP-MIB, CISCO-VLAN-IFTABLE-
278           RELATIONSHIP-MIB
279
280           See documentation in SNMP::Info::CiscoVTP for details.
281
282       SNMP::Info::EDP
283           Extreme Discovery Protocol.  EXTREME-EDP-MIB
284
285           See documentation in SNMP::Info::EDP for details.
286
287       SNMP::Info::Entity
288           ENTITY-MIB.  Used for device info in Cisco and other vendors.
289
290           See documentation in SNMP::Info::Entity for details.
291
292       SNMP::Info::EtherLike
293           EtherLike-MIB (RFC1398) - Some Layer3 devices implement this MIB,
294           as well as some Aironet Layer 2 devices (non Cisco).
295
296           See documentation in SNMP::Info::EtherLike for details.
297
298       SNMP::Info::FDP
299           Foundry (Brocade) Discovery Protocol.  FOUNDRY-SN-SWITCH-GROUP-MIB
300
301           See documentation in SNMP::Info::FDP for details.
302
303       SNMP::Info::IPv6
304           SNMP Interface for obtaining configured IPv6 addresses and mapping
305           IPv6 addresses to MAC addresses and interfaces, using information
306           from IP-MIB, IPV6-MIB and/or CISCO-IETF-IP-MIB.
307
308           See documentation in SNMP::Info::IPv6 for details.
309
310       SNMP::Info::IEEE802dot11
311           IEEE802dot11-MIB.  A collection of OIDs providing information about
312           standards based 802.11 wireless devices.
313
314           See documentation in SNMP::Info::IEEE802dot11 for details.
315
316       SNMP::Info::IEEE802dot3ad
317           SNMP Interface to IEEE Aggregated Links.  IEEE8023-LAG-MIB
318
319           See documentation in SNMP::Info::IEEE802dot3ad for details.
320
321       SNMP::Info::LLDP
322           LLDP-MIB, LLDP-EXT-DOT1-MIB, and LLDP-EXT-DOT3-MIB.  Link Layer
323           Discovery Protocol (LLDP) Support.
324
325           See documentation in SNMP::Info::LLDP for details.
326
327       SNMP::Info::MAU
328           MAU-MIB (RFC2668).  Some Layer2 devices use this for extended
329           Ethernet (Medium Attachment Unit) interface information.
330
331           See documentation in SNMP::Info::MAU for details.
332
333       SNMP::Info::MRO
334           Method resolution introspection for SNMP::Info
335
336           See documentation in SNMP::Info::MRO for details.
337
338       SNMP::Info::NortelStack
339           S5-AGENT-MIB, S5-CHASSIS-MIB.
340
341           See documentation in SNMP::Info::NortelStack for details.
342
343       SNMP::Info::PowerEthernet
344           POWER-ETHERNET-MIB
345
346           See documentation in SNMP::Info::PowerEthernet for details.
347
348       SNMP::Info::RapidCity
349           RAPID-CITY.  Inherited by Avaya switches for duplex and VLAN
350           information.
351
352           See documentation in SNMP::Info::RapidCity for details.
353
354       SNMP::Info::SONMP
355           SynOptics Network Management Protocol (SONMP) SYNOPTICS-ROOT-MIB,
356           S5-ETH-MULTISEG-TOPOLOGY-MIB.  Inherited by
357           Avaya/Nortel/Bay/Synoptics switches and hubs.
358
359           See documentation in SNMP::Info::SONMP for details.
360
361   Device Subclasses
362       These subclasses inherit from one or more classes to provide a common
363       interface to data obtainable from network devices.
364
365       All the required MIB files are included in the netdisco-mib package.
366       (See Above).
367
368       SNMP::Info::Layer1
369           Generic Layer1 Device subclass.
370
371           See documentation in SNMP::Info::Layer1 for details.
372
373           SNMP::Info::Layer1::Allied
374               Subclass for Allied Telesis Repeaters / Hubs.
375
376               Requires ATI-MIB
377
378               See documentation in SNMP::Info::Layer1::Allied for details.
379
380           SNMP::Info::Layer1::Asante
381               Subclass for Asante 1012 Hubs.
382
383               Requires ASANTE-HUB1012-MIB
384
385               See documentation in SNMP::Info::Layer1::Asante for details.
386
387           SNMP::Info::Layer1::Bayhub
388               Subclass for Nortel/Bay hubs.  This includes System 5000, 100
389               series, 200 series, and probably more.
390
391               See documentation in SNMP::Info::Layer1::Bayhub for details.
392
393           SNMP::Info::Layer1::Cyclades
394               Subclass for Cyclades/Avocent terminal servers.
395
396               See documentation in SNMP::Info::Layer1::Cyclades for details.
397
398           SNMP::Info::Layer1::S3000
399               Subclass for Bay/Synoptics hubs.  This includes System 3000,
400               281X, and probably more.
401
402               See documentation in SNMP::Info::Layer1::S3000 for details.
403
404       SNMP::Info::Layer2
405           Generic Layer2 Device subclass.
406
407           See documentation in SNMP::Info::Layer2 for details.
408
409           SNMP::Info::Layer2::3Com
410               Subclass for L2 3Com Switches.
411
412               See documentation in SNMP::Info::Layer2::3Com for details.
413
414           SNMP::Info::Layer2::Adtran
415               Subclass for Adtran devices.
416
417               See documentation in SNMP::Info::Layer2::Adtran for details.
418
419           SNMP::Info::Layer2::Aerohive
420               Subclass for Aerohive Access Points.
421
422               See documentation in SNMP::Info::Layer2::Aerohive for details.
423
424           SNMP::Info::Layer2::Airespace
425               Subclass for Cisco (Airespace) wireless controllers.
426
427               See documentation in SNMP::Info::Layer2::Airespace for details.
428
429           SNMP::Info::Layer2::Aironet
430               Class for Cisco Aironet wireless devices that run IOS.  See
431               also SNMP::Info::Layer3::Aironet for Aironet devices that don't
432               run IOS.
433
434               See documentation in SNMP::Info::Layer2::Aironet for details.
435
436           SNMP::Info::Layer2::Allied
437               Allied Telesis switches.
438
439               See documentation in SNMP::Info::Layer2::Allied for details.
440
441           SNMP::Info::Layer2::Atmedia
442               Subclass for atmedia encryptors.
443
444               See documentation in SNMP::Info::Layer2::Atmedia for details.
445
446           SNMP::Info::Layer2::Baystack
447               Subclass for Avaya/Nortel/Bay Ethernet Switch/Baystack
448               switches.  This includes 303, 304, 350, 380, 410, 420, 425,
449               450, 460, 470 series, 2500 series, 4000 series, 5000 series,
450               Business Ethernet Switch (BES), Business Policy Switch (BPS),
451               VSP 7000 series, and probably others.
452
453               See documentation in SNMP::Info::Layer2::Baystack for details.
454
455           SNMP::Info::Layer2::C1900
456               Subclass for Cisco Catalyst 1900 and 1900c Devices running
457               CatOS.
458
459               See documentation in SNMP::Info::Layer2::C1900 for details.
460
461           SNMP::Info::Layer2::C2900
462               Subclass for Cisco Catalyst 2900, 2950, 3500XL, and 3548
463               devices running IOS.
464
465               See documentation in SNMP::Info::Layer2::C2900 for details.
466
467           SNMP::Info::Layer2::Catalyst
468               Subclass for Cisco Catalyst switches running CatOS.  These
469               switches usually report a model number that starts with "wsc".
470               Note that this class does not support everything that has the
471               name Catalyst.
472
473               See documentation in SNMP::Info::Layer2::Catalyst for details.
474
475           SNMP::Info::Layer2::Centillion
476               Subclass for Nortel/Bay Centillion and 5000BH ATM switches.
477
478               See documentation in SNMP::Info::Layer2::Centillion for
479               details.
480
481           SNMP::Info::Layer2::Cisco
482               Generic Cisco subclass for layer 2 devices that are not yet
483               supported in more specific subclassesand the base layer 2 Cisco
484               class for other device specific layer 2 Cisco classes.
485
486               See documentation in SNMP::Info::Layer2::Cisco for details.
487
488           SNMP::Info::Layer2::CiscoSB
489               Subclass for Cisco's "Small Business" product line, acquired
490               from Linksys.  This currently comprises the Sx300/500 line of
491               switches.
492
493               See documentation in SNMP::Info::Layer2::CiscoSB for details.
494
495           SNMP::Info::Layer2::Exinda
496               Subclass for Exinda / GFI Network Orchestrator traffic shapers.
497
498               See documentation in SNMP::Info::Layer2::Exinda for details.
499
500           SNMP::Info::Layer2::HP
501               Subclass for more recent HP Procurve Switches.
502
503               Requires HP-ICF-OID and ENTITY-MIB downloaded from HP.
504
505               See documentation in SNMP::Info::Layer2::HP for details.
506
507           SNMP::Info::Layer2::HP4000
508               Subclass for older HP Procurve Switches
509
510               Requires HP-ICF-OID and ENTITY-MIB downloaded from HP.
511
512               See documentation in SNMP::Info::Layer2::HP4000 for details.
513
514           SNMP::Info::Layer2::HPVC
515               Subclass for HP Virtual Connect Switches
516
517               See documentation in SNMP::Info::Layer2::HPVC for details.
518
519           SNMP::Info::Layer2::Kentrox
520               Class for Kentrox DataSMART DSU/CSU.
521
522               See documentation in SNMP::Info::Layer2::Kentrox for details.
523
524           SNMP::Info::Layer2::N2270
525               Subclass for Nortel 2270 wireless switches.
526
527               See documentation in SNMP::Info::Layer2::N2270 for details.
528
529           SNMP::Info::Layer2::NAP222x
530               Subclass for Nortel 222x series wireless access points.
531
532               See documentation in SNMP::Info::Layer2::NAP222x for details.
533
534           SNMP::Info::Layer2::Netgear
535               Subclass for Netgear switches
536
537               See documentation in SNMP::Info::Layer2::Netgear for details.
538
539           SNMP::Info::Layer2::Nexans
540               Subclass for Nexans switches
541
542               See documetion in SNMP::Info::Layer2::Nexans for details.
543
544           SNMP::Info::Layer2::NWSS2300
545               SNMP Interface to Avaya (Trapeze) Wireless Controllers
546
547               See documentation in SNMP::Info::Layer2::NWSS2300 for details.
548
549           SNMP::Info::Layer2::Orinoco
550               Subclass for Orinoco/Proxim wireless access points.
551
552               See documentation in SNMP::Info::Layer2::Orinoco for details.
553
554           SNMP::Info::Layer2::Trapeze
555               SNMP Interface to Juniper (Trapeze) Wireless Controllers
556
557               See documentation in SNMP::Info::Layer2::Trapeze for details.
558
559           SNMP::Info::Layer2::Sixnet
560               SNMP Interface to Sixnet industrial switches
561
562               See documentation in SNMP::Info::Layer2::Sixnet for details.
563
564           SNMP::Info::Layer2::Ubiquiti
565               SNMP Interface to Ubiquiti Access Points and other devices
566
567               See documentation in SNMP::Info::Layer2::Ubiquiti for details.
568
569           SNMP::Info::Layer2::ZyXEL_DSLAM
570               Zyxel DSLAMs.  Need I say more?
571
572               See documentation in SNMP::Info::Layer2::ZyXEL_DSLAM for
573               details.
574
575       SNMP::Info::Layer3
576           Generic Layer3 and Layer2+3 Device subclass.
577
578           See documentation in SNMP::Info::Layer3 for details.
579
580           SNMP::Info::Layer3::Aironet
581               Subclass for Cisco Aironet wireless access points (AP) not
582               running IOS. These are usually older devices.
583
584               MIBs for these devices now included in v2.tar.gz available from
585               ftp.cisco.com.
586
587               Note SNMP::Info::Layer2::Aironet
588
589               See documentation in SNMP::Info::Layer3::Aironet for details.
590
591           SNMP::Info::Layer3::AlcatelLucent
592               Alcatel-Lucent OmniSwitch Class.
593
594               See documentation in SNMP::Info::Layer3::AlcatelLucent for
595               details.
596
597           SNMP::Info::Layer3::AlteonAD
598               Subclass for Radware Alteon Series ADC switches and Nortel
599               BladeCenter Layer2-3 GbE Switch Modules.
600
601               See documentation in SNMP::Info::Layer3::AlteonAD for details.
602
603           SNMP::Info::Layer3::Altiga
604               See documentation in SNMP::Info::Layer3::Altiga for details.
605
606           SNMP::Info::Layer3::Arista
607               See documentation in SNMP::Info::Layer3::Arista for details.
608
609           SNMP::Info::Layer3::Aruba
610               Subclass for Aruba wireless switches.
611
612               See documentation in SNMP::Info::Layer3::Aruba for details.
613
614           SNMP::Info::Layer3::BayRS
615               Subclass for Avaya/Nortel/Bay Multiprotocol/BayRS routers.
616               This includes BCN, BLN, ASN, ARN, AN, 2430, and 5430 routers.
617
618               See documentation in SNMP::Info::Layer3::BayRS for details.
619
620           SNMP::Info::Layer3::BlueCoatSG
621               Subclass for Blue Coat SG series proxy devices.
622
623               See documentation in SNMP::Info::Layer3::BlueCoatSG for
624               details.
625
626           SNMP::Info::Layer3::C3550
627               Subclass for Cisco Catalyst 3550,3540,3560 2/3 switches running
628               IOS.
629
630               See documentation in SNMP::Info::Layer3::C3550 for details.
631
632           SNMP::Info::Layer3::C4000
633               This class covers Catalyst 4000s and 4500s.
634
635               See documentation in SNMP::Info::Layer3::C4000 for details.
636
637           SNMP::Info::Layer3::C6500
638               This class covers Catalyst 6500s in native mode, hybrid mode.
639               Catalyst 3750's, 2970's and probably others.
640
641               See documentation in SNMP::Info::Layer3::C6500 for details.
642
643           SNMP::Info::Layer3::CheckPoint
644               Subclass for CheckPoint devices.
645
646               See documentation in SNMP::Info::Layer3::CheckPoint for
647               details.
648
649           SNMP::Info::Layer3::Cisco
650               This is a simple wrapper around layer 3 for IOS devices and the
651               base layer 3 Cisco class for other device specific layer 3
652               Cisco classes.
653
654               See documentation in SNMP::Info::Layer3::Cisco for details.
655
656           SNMP::Info::Layer3::CiscoASA
657               Subclass for Cisco Adaptive Security Appliances.
658
659               See documentation in SNMP::Info::Layer3::CiscoASA for details.
660
661           SNMP::Info::Layer3::CiscoFWSM
662               Subclass for Cisco Firewall Services Modules.
663
664               See documentation in SNMP::Info::Layer3::CiscoFWSM for details.
665
666           SNMP::Info::Layer3::CiscoSwitch
667               Base class for L3 Cisco switches.  See documentation in
668               SNMP::Info::Layer3::CiscoSwitch for details.
669
670           SNMP::Info::Layer3::Contivity
671               Subclass for Avaya/Nortel Contivity/VPN Routers.
672
673               See documentation in SNMP::Info::Layer3::Contivity for details.
674
675           SNMP::Info::Layer3::Cumulus
676               Subclass for Cumulus Networks Routers.
677
678               See documentation in SNMP::Info::Layer3::Cumulus for details.
679
680           SNMP::Info::Layer3::DLink
681               Subclass for DLink devices.
682
683               See documentation in SNMP::Info::Layer3::DLink for details.
684
685           SNMP::Info::Layer3::Dell
686               Subclass for Dell PowerConnect switches. The IBM BladeCenter
687               Gigabit Ethernet Switch Module and some Linksys switches also
688               use this module based upon MIB support.
689
690               See documentation in SNMP::Info::Layer3::Dell for details.
691
692           SNMP::Info::Layer3::Enterasys
693               Subclass for Enterasys devices.
694
695               See documentation in SNMP::Info::Layer3::Enterasys for details.
696
697           SNMP::Info::Layer3::ERX
698               Subclass for Juniper ERX switches.
699
700               See documentation in SNMP::Info::Layer3::ERX for details.
701
702           SNMP::Info::Layer3::Extreme
703               Subclass for Extreme Networks switches.
704
705               See documentation in SNMP::Info::Layer3::Extreme for details.
706
707           SNMP::Info::Layer3::F5
708               Subclass for F5 devices.
709
710               See documentation in SNMP::Info::Layer3::F5 for details.
711
712           SNMP::Info::Layer3::Force10
713               Subclass for Force10 devices.
714
715               See documentation in SNMP::Info::Layer3::Force10 for details.
716
717           SNMP::Info::Layer3::Fortinet
718               Subclass for Fortinet devices.
719
720               See documentation in SNMP::Info::Layer3::Fortinet for details.
721
722           SNMP::Info::Layer3::Foundry
723               Subclass for Brocade (Foundry) Network devices.
724
725               See documentation in SNMP::Info::Layer3::Foundry for details.
726
727           SNMP::Info::Layer3::Genua
728               Subclass for Genua security devices.
729
730               See documentation in SNMP::Info::Layer3::Genua for details.
731
732           SNMP::Info::Layer3::H3C
733               SNMP Interface to Layer 3 Devices, H3C & HP A-series.
734
735               See documentation in SNMP::Info::Layer3::H3C for details.
736
737           SNMP::Info::Layer3::HP9300
738               Subclass for HP network devices which Foundry Networks was the
739               Original Equipment Manufacturer (OEM) such as the HP ProCurve
740               9300 and 6300 series.
741
742               See documentation in SNMP::Info::Layer3::HP9300 for details.
743
744           SNMP::Info::Layer3::Huawei
745               SNMP Interface to Huawei Layer 3 switches and routers.
746
747               See documentation in SNMP::Info::Layer3::Huawei for details.
748
749           SNMP::Info::Layer3::IBMGbTor
750               SNMP Interface to IBM Rackswitch (formerly Blade Network
751               Technologies) network devices. Lenovo acquired these from IBM
752               and is now selling them under the Lenovo brand.
753
754               See documentation in SNMP::Info::Layer3::IBMGbTor for details.
755
756           SNMP::Info::Layer3::Juniper
757               Subclass for Juniper devices.
758
759               See documentation in SNMP::Info::Layer3::Juniper for details.
760
761           SNMP::Info::Layer3::Lantronix
762               Subclass for Lantronix devices.
763
764               See documentation in SNMP::Info::Layer3::Lantronix for details.
765
766           SNMP::Info::Layer3::Microsoft
767               Subclass for Generic Microsoft Routers running Microsoft
768               Windows OS.
769
770               See documentation in SNMP::Info::Layer3::Microsoft for details.
771
772           SNMP::Info::Layer3::Mikrotik
773               Subclass for Mikrotik devices running RouterOS.
774
775               See documentation in SNMP::Info::Layer3::Mikrotik for details.
776
777           SNMP::Info::Layer3::N1600
778               Subclass for Avaya/Nortel Ethernet Routing Switch 1600 series.
779
780               See documentation in SNMP::Info::Layer3::N1600 for details.
781
782           SNMP::Info::Layer3::NetSNMP
783               Subclass for host systems running Net-SNMP.
784
785               See documentation in SNMP::Info::Layer3::NetSNMP for details.
786
787           SNMP::Info::Layer3::Netscreen
788               Subclass for Juniper NetScreen.
789
790               See documentation in SNMP::Info::Layer3::Netscreen for details.
791
792           SNMP::Info::Layer3::Nexus
793               Subclass for Cisco Nexus devices running NX-OS.
794
795               See documentation in SNMP::Info::Layer3::Nexus for details.
796
797           SNMP::Info::Layer3::OneAccess
798               Subclass for OneAccess routers.
799
800               See documentation in SNMP::Info::Layer3::OneAccess for details.
801
802           SNMP::Info::Layer3::PacketFront
803               Subclass for PacketFront DRG series CPE.
804
805               See documentation in SNMP::Info::Layer3::PacketFront for
806               details.
807
808           SNMP::Info::Layer3::PaloAlto
809               Subclass for Palo Alto firewalls.
810
811               See documentation in SNMP::Info::Layer3::PaloAlto for details.
812
813           SNMP::Info::Layer3::Passport
814               Subclass for Avaya/Nortel Ethernet Routing Switch/Passport 8000
815               series, Accelar, and VSP 9000 series switches.
816
817               See documentation in SNMP::Info::Layer3::Passport for details.
818
819           SNMP::Info::Layer3::Pf
820               Subclass for FreeBSD-Based Firewalls using Pf /Pf Sense
821
822               See documentation in SNMP::Info::Layer3::Pf for details.
823
824           SNMP::Info::Layer3::Pica8
825               Subclass for Pica8 devices.
826
827               See documentation in SNMP::Info::Layer3::Pica8 for details.
828
829           SNMP::Info::Layer3::SonicWALL
830               Subclass for generic SonicWALL devices.
831
832               See documentation in SNMP::Info::Layer3::SonicWALL for details.
833
834           SNMP::Info::Layer3::Steelhead
835               Subclass for  Riverbed Steelhead WAN optimization appliances.
836
837               See documentation in SNMP::Info::Layer3::Steelhead for details.
838
839           SNMP::Info::Layer3::Sun
840               Subclass for Generic Sun Routers running SunOS.
841
842               See documentation in SNMP::Info::Layer3::Sun for details.
843
844           SNMP::Info::Layer3::Tasman
845               Subclass for Avaya Secure Routers.
846
847               See documentation in SNMP::Info::Layer3::Tasman for details.
848
849           SNMP::Info::Layer3::Timetra
850               Alcatel-Lucent SR Class.
851
852               See documentation in SNMP::Info::Layer3::Timetra for details.
853
854           SNMP::Info::Layer3::VyOS
855               Subclass for VyOS routers.
856
857               See documentation in SNMP::Info::Layer3::VyOS for details.
858
859           SNMP::Info::Layer3::VMware
860               Subclass for VMware ESXi hosts.
861
862               See documentation in SNMP::Info::Layer3::VMware for details.
863
864       SNMP::Info::Layer7
865           Generic Layer7 Devices.
866
867           See documentation in SNMP::Info::Layer7 for details.
868
869           SNMP::Info::Layer7::APC
870               Subclass for APC UPS devices.
871
872               See documentation in SNMP::Info::Layer7::APC for details.
873
874           SNMP::Info::Layer7::Arbor
875               Subclass for Arbor appliances.
876
877               See documentation in SNMP::Info::Layer7::Arbor for details.
878
879           SNMP::Info::Layer7::CiscoIPS
880               Subclass for Cisco IPS devices.
881
882               See documentation in SNMP::Info::Layer7::CiscoIPS for details.
883
884           SNMP::Info::Layer7::Gigamon
885               Subclass for Gigamon devices.
886
887               See documentation in SNMP::Info::Layer7::Gigamon for details.
888
889           SNMP::Info::Layer7::Liebert
890               Subclass for Liebert devices.
891
892               See documentation in SNMP::Info::Layer7::Liebert for details.
893
894           SNMP::Info::Layer7::Neoteris
895               Subclass for Juniper SSL VPN appliances.
896
897               See documentation in SNMP::Info::Layer7::Neoteris for details.
898
899           SNMP::Info::Layer7::Netscaler
900               Subclass for Citrix Netscaler appliances.
901
902               See documentation in SNMP::Info::Layer7::Netscaler for details.
903

Thanks

905       Thanks for testing and coding help (in no particular order) to :
906       Alexander Barthel, Andy Ford, Alexander Hartmaier, Andrew Herrick, Alex
907       Kramarov, Bernhard Augenstein, Bradley Baetz, Brian Chow, Brian Wilson,
908       Carlos Vicente, Dana Watanabe, David Pinkoski, David Sieborger, Douglas
909       McKeown, Greg King, Ivan Auger, Jean-Philippe Luiggi, Jeroen van Ingen,
910       Justin Hunter, Kent Hamilton, Matthew Tuttle, Michael Robbert, Mike
911       Hunter, Nicolai Petri, Ralf Gross, Robert Kerr, Nick Nauwelaerts and
912       people listed on the Netdisco README!
913

USAGE

915   Constructor
916       new()
917           Creates a new object and connects via SNMP::Session.
918
919            my $info = new SNMP::Info( 'Debug'             => 1,
920                                       'AutoSpecify'       => 1,
921                                       'BigInt'            => 1,
922                                       'BulkWalk'          => 1,
923                                       'BulkRepeaters'     => 20,
924                                       'IgnoreNetSNMPConf' => 1,
925                                       'LoopDetect'        => 1,
926                                       'DestHost'          => 'myrouter',
927                                       'Community'         => 'public',
928                                       'Version'           => 2,
929                                       'MibDirs'           => ['dir1','dir2','dir3'],
930                                     ) or die;
931
932           SNMP::Info Specific Arguments :
933
934           AutoSpecify
935               Returns an object of a more specific device class
936
937               (default 0, which means "off")
938
939           BigInt
940               Return Math::BigInt objects for 64 bit counters.  Sets on a
941               global scope, not object.
942
943               (default 0, which means "off")
944
945           BulkWalk
946               Set to 0 to turn off BULKWALK commands for SNMPv2 connections.
947
948               Note that BULKWALK is turned off for Net-SNMP versions 5.1.x
949               because of a bug.
950
951               (default 1, which means "on")
952
953           BulkRepeaters
954               Set number of MaxRepeaters for BULKWALK operation.  See
955               "perldoc SNMP" -> bulkwalk() for more info.
956
957               (default 20)
958
959           LoopDetect
960               Detects looping during getnext table column walks by comparing
961               IIDs for each instance.  A loop is detected if the same IID is
962               seen more than once and the walk is aborted.  Note:  This will
963               not detect loops during a bulkwalk operation, Net-SNMP's
964               internal bulkwalk function must detect the loop.
965
966               Set to 0 to turn off loop detection.
967
968               (default 1, which means "on")
969
970           IgnoreNetSNMPConf
971               Net-SNMP version 5.0 and higher read configuration files,
972               snmp.conf or snmp.local.conf, from /etc/snmp, /usr/share/snmp,
973               /usr/lib(64)/snmp, or $HOME/.snmp and uses those settings to
974               automatically parse MIB files, etc.
975
976               Set to 1 "on" to ignore Net-SNMP configuration files by
977               overriding the "SNMPCONFPATH" environmental variable during
978               object initialization. Note: MibDirs must be defined or Net-
979               SNMP will not be able to load MIBs and initialize the object.
980
981               (default 0, which means "off")
982
983           Debug
984               Prints Lots of debugging messages.  Pass 2 to print even more
985               debugging messages.
986
987               (default 0, which means "off")
988
989           DebugSNMP
990               Set $SNMP::debugging level for Net-SNMP.
991
992               See SNMP for more details.
993
994           MibDirs
995               Array ref to list of directories in which to look for MIBs.
996               Note this will be in addition to the ones setup in snmp.conf at
997               the system level.
998
999               (default use net-snmp settings only)
1000
1001           RetryNoSuch
1002               When using SNMP Version 1, try reading values even if they come
1003               back as "no such variable in this MIB".  Set to false if so
1004               desired.  This feature lets you read SNMPv2 data from an SNMP
1005               version 1 connection, and should probably be left on.
1006
1007               (default 1, which means "on")
1008
1009           Session
1010               SNMP::Session object to use instead of connecting on own.
1011
1012               (default creates session automatically)
1013
1014           Offline
1015               Causes SNMP::Info to avoid network activity and return data
1016               only from its cache. If you ask for something not in the cache,
1017               an error is thrown.  See also the "cache()" and "offline()"
1018               methods.
1019
1020               (default 0, which means "online")
1021
1022           Cache
1023               Pass in a HashRef to prime the cache of retrieved data. Useful
1024               for creating an instance in "Offline" mode from a previously
1025               dumped cache. See also the "cache()" method to retrieve a cache
1026               after running actial queries.
1027
1028           OTHER
1029               All other arguments are passed to SNMP::Session.
1030
1031               See SNMP::Session for a list of other possible arguments.
1032
1033           A Note about the wrong Community string or wrong SNMP Version:
1034
1035           If a connection is using the wrong community string or the wrong
1036           SNMP version, the creation of the object will not fail.  The device
1037           still answers the call on the SNMP port, but will not return
1038           information.  Check the error() method after you create the device
1039           object to see if there was a problem in connecting.
1040
1041           A note about SNMP Versions :
1042
1043           Some older devices don't support SNMP version 2, and will not
1044           return anything when a connection under Version 2 is attempted.
1045
1046           Some newer devices will support Version 1, but will not return all
1047           the data they might have if you had connected under Version 1
1048
1049           When trying to get info from a new device, you may have to try
1050           version 2 and then fallback to version 1.
1051
1052       update()
1053           Replace the existing session with a new one with updated values,
1054           without re-identifying the device.  The only supported changes are
1055           to Community or Context.
1056
1057           Clears the object cache.
1058
1059           This is useful, e.g., when a device supports multiple contexts (via
1060           changes to the Community string, or via the SNMPv3 Context
1061           parameter), but a context that you want to access does not support
1062           the objects (e.g., "sysObjectID", "sysDescr") that we use to
1063           identify the device.
1064
1065   Data is Cached
1066       Methods and subroutines requesting data from a device will only load
1067       the data once, and then return cached versions of that data.
1068
1069       Run $info->load_METHOD() where method is something like 'i_name' to
1070       reload data from a method.
1071
1072       Run $info->clear_cache() to clear the cache to allow reload of both
1073       globals and table methods.
1074
1075       The cache can be retrieved or set using the $info->cache() method. This
1076       works together with the "Offline" option.
1077
1078   Object Scalar Methods
1079       These are for package related data, not directly supplied from SNMP.
1080
1081       $info->clear_cache()
1082           Clears the cached data.  This includes GLOBALS data and TABLE
1083           METHOD data.
1084
1085       $info->debug(1)
1086           Returns current debug status, and optionally toggles debugging info
1087           for this object.
1088
1089       $info->offline([1|0])
1090           Returns if offline mode is currently turned on for this object.
1091
1092           Optionally sets the Offline parameter.
1093
1094       $info->cache([new_cache])
1095           Returns a HashRef of all cached data in this object. There will be
1096           a "store" key for table data and then one key for each leaf.
1097
1098           Optionally sets the cache parameters if passed a HashRef.
1099
1100       $info->bulkwalk([1|0])
1101           Returns if bulkwalk is currently turned on for this object.
1102
1103           Optionally sets the bulkwalk parameter.
1104
1105       $info->loopdetect([1|0])
1106           Returns if loopdetect is currently turned on for this object.
1107
1108           Optionally sets the loopdetect parameter.
1109
1110       $info->device_type()
1111           Returns the Subclass name for this device.  "SNMP::Info" is
1112           returned if no more specific class is available.
1113
1114           First the device is checked for Layer 3 support and a specific
1115           subclass, then Layer 2 support and subclasses are checked.
1116
1117           This means that Layer 2 / 3  switches and routers will fall under
1118           the SNMP::Info::Layer3 subclasses.
1119
1120           If the device still can be connected to via SNMP::Info, then
1121           SNMP::Info is returned.
1122
1123       $info->error(no_clear)
1124           Returns Error message if there is an error, or undef if there is
1125           not.
1126
1127           Reading the error will clear the error unless you set the no_clear
1128           flag.
1129
1130       $info->has_layer(3)
1131           Returns non-zero if the device has the supplied layer in the OSI
1132           Model
1133
1134           Returns if the device doesn't support the layers() call.
1135
1136       $info->snmp_comm()
1137           Returns SNMP Community string used in connection.
1138
1139       $info->snmp_ver()
1140           Returns SNMP Version used for this connection
1141
1142       $info->specify()
1143           Returns an object of a more-specific subclass.
1144
1145            my $info = new SNMP::Info(...);
1146            # Returns more specific object type
1147            $info = $info->specific();
1148
1149           Usually this method is called internally from new(AutoSpecify => 1)
1150
1151           See device_type() entry for how a subclass is chosen.
1152
1153       $info->cisco_comm_indexing()
1154           Returns 0.  Is an overridable method used for vlan indexing for
1155           snmp calls on certain Cisco devices.
1156
1157           See
1158           <ftp://ftp.cisco.com/pub/mibs/supportlists/wsc5000/wsc5000-communityIndexing.html>
1159
1160   Globals (Scalar Methods)
1161       These are methods to return scalar data from RFC1213.
1162
1163       Some subset of these is probably available for any network device that
1164       speaks SNMP.
1165
1166       $info->uptime()
1167           Uptime in hundredths of seconds since device became available.
1168
1169           ("sysUpTime")
1170
1171       $info->contact()
1172           ("sysContact")
1173
1174       $info->name()
1175           ("sysName")
1176
1177       $info->location()
1178           ("sysLocation")
1179
1180       $info->layers()
1181           This returns a binary encoded string where each digit represents a
1182           layer of the OSI model served by the device.
1183
1184               eg: 01000010  means layers 2 (physical) and 7 (Application)
1185                             are served.
1186
1187           Note:  This string is 8 digits long.
1188
1189           See $info->has_layer()
1190
1191           ("sysServices")
1192
1193       $info->ports()
1194           Number of interfaces available on this device.
1195
1196           Not too useful as the number of SNMP interfaces usually does not
1197           correspond with the number of physical ports
1198
1199           ("ifNumber")
1200
1201       $info->ipforwarding()
1202           The indication of whether the entity is acting as an IP gateway
1203
1204           Returns either forwarding or not-forwarding
1205
1206           ("ipForwarding")
1207
1208   Table Methods
1209       Each of these methods returns a hash_reference to a hash keyed on the
1210       interface index in SNMP.
1211
1212       Example : $info->interfaces() might return
1213
1214           { '1.12' => 'FastEthernet/0',
1215             '2.15' => 'FastEthernet/1',
1216             '9.99' => 'FastEthernet/2'
1217           }
1218
1219       The key is what you would see if you were to do an snmpwalk, and in
1220       some cases changes between reboots of the network device.
1221
1222   Partial Table Fetches
1223       If you want to get only a part of an SNMP table or a single instance
1224       from the table and you know the IID for the part of the table that you
1225       want, you can specify it in the call:
1226
1227           $local_routes = $info->ipr_route('192.168.0');
1228
1229       This will only fetch entries in the table that start with 192.168.0,
1230       which in this case are routes on the local network.
1231
1232       Remember that you must supply the partial IID (a numeric OID).
1233
1234       Partial table results are not cached.
1235
1236   Interface Information
1237       $info->interfaces()
1238           This methods is overridden in each subclass to provide a mapping
1239           between the Interface Table Index (iid) and the physical port name.
1240
1241       $info->if_ignore()
1242           Returns a reference to a hash where key values that exist are
1243           interfaces to ignore.
1244
1245           Ignored interfaces are ones that are usually not physical ports or
1246           Virtual Lans (VLANs) such as the Loopback interface, or the CPU
1247           interface.
1248
1249       $info->bulkwalk_no()
1250           Returns 0.  Is an overridable method used for turn off bulkwalk for
1251           the device class.
1252
1253       $info->i_index()
1254           Default SNMP IID to Interface index.
1255
1256           ("ifIndex")
1257
1258       $info->i_description()
1259           Description of the interface. Usually a little longer single word
1260           name that is both human and machine friendly.  Not always.
1261
1262           ("ifDescr")
1263
1264       $info->i_type()
1265           Interface type, such as Vlan, Ethernet, Serial
1266
1267           ("ifType")
1268
1269       $info->i_mtu()
1270           INTEGER. Interface MTU value.
1271
1272           ("ifMtu")
1273
1274       $info->i_speed()
1275           Speed of the link, human format.  See munge_speed() later in
1276           document for details.
1277
1278           ("ifSpeed", "ifHighSpeed" if necessary)
1279
1280       $info->i_speed_raw()
1281           Speed of the link in bits per second without munging.  If
1282           i_speed_high is available it will be used and multiplied by
1283           1_000_000.
1284
1285           ("ifSpeed", "ifHighSpeed" if necessary)
1286
1287       $info->i_speed_high()
1288           Speed of a high-speed link, human format.  See munge_highspeed()
1289           later in document for details.  You should not need to call this
1290           directly, as i_speed() will call it if it needs to.
1291
1292           ("ifHighSpeed")
1293
1294       $info->i_mac()
1295           MAC address of the interface.  Note this is just the MAC of the
1296           port, not anything connected to it.
1297
1298           ("ifPhysAddress")
1299
1300       $info->i_up()
1301           Link Status of the interface.  Typical values are 'up' and 'down'.
1302
1303           ("ifOperStatus")
1304
1305       $info->i_up_admin()
1306           Administrative status of the port.  Typical values are 'enabled'
1307           and 'disabled'.
1308
1309           ("ifAdminStatus")
1310
1311       $info->i_lastchange()
1312           The value of "sysUpTime" when this port last changed states
1313           (up,down).
1314
1315           ("ifLastChange")
1316
1317       $info->i_name()
1318           Interface Name field.  Supported by a smaller subset of devices,
1319           this fields is often human set.
1320
1321           ("ifName")
1322
1323       $info->i_alias()
1324           Interface Name field.  For certain devices this is a more human
1325           friendly form of i_description().  For others it is a human set
1326           field like i_name().
1327
1328           ("ifAlias")
1329
1330   Interface Statistics
1331       $info->i_octet_in(), $info->i_octets_out(), $info->i_octet_in64(),
1332       $info->i_octets_out64()
1333           Bandwidth.
1334
1335           Number of octets sent/received on the interface including framing
1336           characters.
1337
1338           64 bit version may not exist on all devices.
1339
1340           NOTE: To manipulate 64 bit counters you need to use Math::BigInt,
1341           since the values are too large for a normal Perl scalar.   Set the
1342           global $SNMP::Info::BIGINT to 1 , or pass the BigInt value to new()
1343           if you want SNMP::Info to do it for you.
1344
1345           ("ifInOctets") ("ifOutOctets") ("ifHCInOctets") ("ifHCOutOctets")
1346
1347       $info->i_errors_in(), $info->i_errors_out()
1348           Number of packets that contained an error preventing delivery.  See
1349           "IF-MIB" for more info.
1350
1351           ("ifInErrors") ("ifOutErrors")
1352
1353       $info->i_pkts_ucast_in(), $info->i_pkts_ucast_out(),
1354       $info->i_pkts_ucast_in64(), $info->i_pkts_ucast_out64()
1355           Number of packets not sent to a multicast or broadcast address.
1356
1357           64 bit version may not exist on all devices.
1358
1359           ("ifInUcastPkts") ("ifOutUcastPkts") ("ifHCInUcastPkts")
1360           ("ifHCOutUcastPkts")
1361
1362       $info->i_pkts_nucast_in(), $info->i_pkts_nucast_out(),
1363           Number of packets sent to a multicast or broadcast address.
1364
1365           These methods are deprecated by i_pkts_multi_in() and
1366           i_pkts_bcast_in() according to "IF-MIB".  Actual device usage may
1367           vary.
1368
1369           ("ifInNUcastPkts") ("ifOutNUcastPkts")
1370
1371       $info->i_pkts_multi_in() $info->i_pkts_multi_out(),
1372       $info->i_pkts_multi_in64(), $info->i_pkts_multi_out64()
1373           Number of packets sent to a multicast address.
1374
1375           64 bit version may not exist on all devices.
1376
1377           ("ifInMulticastPkts") ("ifOutMulticastPkts")
1378           ("ifHCInMulticastPkts") ("ifHCOutMulticastPkts")
1379
1380       $info->i_pkts_bcast_in() $info->i_pkts_bcast_out(),
1381       $info->i_pkts_bcast_in64() $info->i_pkts_bcast_out64()
1382           Number of packets sent to a broadcast address on an interface.
1383
1384           64 bit version may not exist on all devices.
1385
1386           ("ifInBroadcastPkts") ("ifOutBroadcastPkts")
1387           ("ifHCInBroadcastPkts") ("ifHCOutBroadcastPkts")
1388
1389       $info->i_discards_in() $info->i_discards_out()
1390           "The number of inbound packets which were chosen to be discarded
1391           even though no errors had been detected to prevent their being
1392           deliverable to a higher-layer protocol.  One possible reason for
1393           discarding such a packet could be to free up buffer space."
1394           ("IF-MIB")
1395
1396           ("ifInDiscards") ("ifOutDiscards")
1397
1398       $info->i_bad_proto_in()
1399           "For packet-oriented interfaces, the number of packets received via
1400           the interface which were discarded because of an unknown or
1401           unsupported protocol.  For character-oriented or fixed-length
1402           interfaces that support protocol multiplexing the number of
1403           transmission units received via the interface which were discarded
1404           because of an unknown or unsupported protocol.  For any interface
1405           that does not support protocol multiplexing, this counter will
1406           always be 0."
1407
1408           ("ifInUnknownProtos")
1409
1410       $info->i_qlen_out()
1411           "The length of the output packet queue (in packets)."
1412
1413           ("ifOutQLen")
1414
1415       $info->i_specific()
1416           See "IF-MIB" for full description
1417
1418           ("ifSpecific")
1419
1420   IPv4 Address Table
1421       Each entry in this table is an IPv4 address in use on this device.
1422       Usually this is implemented in Layer3 Devices. These methods try the
1423       deprecated IPv4 address table "IP-MIB::ipAddrTable" first due to its
1424       prevalence and will try the current "IP-MIB::ipAddressTable" if it
1425       doesn't return any results.  "IP-MIB::ipAddressTable" results are
1426       filtered to only return IPv4 unicast addresses and modified to match
1427       the return format of the older table for backwards compatibility.
1428
1429       See documentation in SNMP::Info::IPv6 for IPv6 Address Table.
1430
1431       $info->ip_index()
1432           Maps the IPv4 addresses to the interface index
1433
1434           ("ipAdEntIfIndex") or filtered and index modified
1435           ("ipAddressIfIndex")
1436
1437       $info->ip_table()
1438           Maps the Table to the IPv4 address
1439
1440           ("ipAdEntAddr") or address extracted from ("ipAddressIfIndex")
1441
1442       $info->ip_netmask()
1443           Gives netmask setting for IPv4 table entry.
1444
1445           ("ipAdEntNetMask") or netmask calculated from ("ipAddressPrefix")
1446
1447       $info->ip_broadcast()
1448           Gives the value of the least-significant bit in the IPv4 broadcast
1449           address either 1 or 0.
1450
1451           ("ipAdEntBcastAddr"), there is no equivalent from the
1452           "IP-MIB::ipAddressTable"
1453
1454   IP Routing Table
1455       $info->ipr_route()
1456           The route in question.  A value of 0.0.0.0 is the default gateway
1457           route.
1458
1459           ("ipRouteDest")
1460
1461       $info->ipr_if()
1462           The interface (IID) that the route is on.  Use interfaces() to map.
1463
1464           ("ipRouteIfIndex")
1465
1466       $info->ipr_1()
1467           Primary routing metric for this route.
1468
1469           ("ipRouteMetric1")
1470
1471       $info->ipr_2()
1472           If metrics are not used, they should be set to -1
1473
1474           ("ipRouteMetric2")
1475
1476       $info->ipr_3()
1477           ("ipRouteMetric3")
1478
1479       $info->ipr_4()
1480           ("ipRouteMetric4")
1481
1482       $info->ipr_5()
1483           ("ipRouteMetric5")
1484
1485       $info->ipr_dest()
1486           From RFC1213:
1487
1488             "The IP address of the next hop of this route.
1489             (In the case of a route bound to an interface
1490             which is realized via a broadcast media, the value
1491             of this field is the agent's IP address on that
1492             interface.)"
1493
1494           ("ipRouteNextHop")
1495
1496       $info->ipr_type()
1497           From RFC1213:
1498
1499               other(1),        -- none of the following
1500               invalid(2),      -- an invalidated route
1501                                -- route to directly
1502               direct(3),       -- connected (sub-)network
1503                                -- route to a non-local
1504               indirect(4)      -- host/network/sub-network
1505
1506
1507                 "The type of route.  Note that the values
1508                 direct(3) and indirect(4) refer to the notion of
1509                 direct and indirect routing in the IP
1510                 architecture.
1511
1512                 Setting this object to the value invalid(2) has
1513                 the effect of invalidating the corresponding entry
1514                 in the ipRouteTable object.  That is, it
1515                 effectively disassociates the destination
1516                 identified with said entry from the route
1517                 identified with said entry.  It is an
1518                 implementation-specific matter as to whether the
1519                 agent removes an invalidated entry from the table.
1520                 Accordingly, management stations must be prepared
1521                 to receive tabular information from agents that
1522                 corresponds to entries not currently in use.
1523                 Proper interpretation of such entries requires
1524                 examination of the relevant ipRouteType object."
1525
1526           ("ipRouteType")
1527
1528       $info->ipr_proto()
1529           From RFC1213:
1530
1531               other(1),       -- none of the following
1532                               -- non-protocol information,
1533                               -- e.g., manually configured
1534               local(2),       -- entries
1535                               -- set via a network
1536               netmgmt(3),     -- management protocol
1537                               -- obtained via ICMP,
1538               icmp(4),        -- e.g., Redirect
1539                               -- the remaining values are
1540                               -- all gateway routing
1541                               -- protocols
1542               egp(5),
1543               ggp(6),
1544               hello(7),
1545               rip(8),
1546               is-is(9),
1547               es-is(10),
1548               ciscoIgrp(11),
1549               bbnSpfIgp(12),
1550               ospf(13),
1551               bgp(14)
1552
1553           ("ipRouteProto")
1554
1555       $info->ipr_age()
1556           Seconds since route was last updated or validated.
1557
1558           ("ipRouteAge")
1559
1560       $info->ipr_mask()
1561           Subnet Mask of route. 0.0.0.0 for default gateway.
1562
1563           ("ipRouteMask")
1564
1565       $info->ipr_info()
1566           Reference to MIB definition specific to routing protocol.
1567
1568           ("ipRouteInfo")
1569
1570   Topology Information
1571       Based upon the manufacturer and software version devices may support
1572       some combination of Layer 2 topology protocol information.  SNMP::Info
1573       supports querying Link Layer Discovery Protocol (LLDP), Cisco Discovery
1574       Protocol (CDP), SynOptics/Bay/Nortel/Avaya Network Management Protocol
1575       (SONMP), Foundry/Brocade Discovery Protocol (FDP), Extreme Discovery
1576       Protocol (EDP), and Alcatel Mapping Adjacency Protocol (AMAP).
1577
1578       For protocol specific information and implementation:
1579
1580       LLDP: See SNMP::Info::LLDP for details.
1581       CDP: See SNMP::Info::CDP for details.
1582       SONMP: See SNMP::Info::SONMP for details.
1583       FDP: See SNMP::Info::FDP for details.
1584       EDP: See SNMP::Info::EDP for details.
1585       AMAP: See SNMP::Info::AMAP for details.
1586
1587       Topology Capabilities
1588
1589       $info->has_topo()
1590           Reports Layer 2 topology protocols which are supported and running
1591           on a device.
1592
1593           Returns either a reference to an array of protocols, possible
1594           values being: "lldp", "cdp", "sonmp", "fdp", "edp", "amap" or
1595           "undef" if no protocols are supported or running.
1596
1597       Common Topology Table Information
1598
1599       The common topology table methods below will query the device for
1600       information from the specified topology protocols and return a single
1601       hash combining all information. As a result, there may be identical
1602       topology information returned from the two protocols causing duplicate
1603       entries.  It is the calling program's responsibility to identify any
1604       duplicate entries and remove duplicates if necessary.  If it is
1605       necessary to understand which protocol provided the information,
1606       utilize the protocol specific methods directly rather than the generic
1607       methods.
1608
1609       The methods support partial table fetches by providing a partial as the
1610       first argument.
1611
1612       If a reference to an array is provided as the second argument, those
1613       protocols will be queried for information.  The supported array values
1614       are: "lldp", "cdp", "sonmp", "fdp", "edp", "amap".
1615
1616       If nothing is passed in as the second argument, the methods will call
1617       has_topo() to determine supported and running topology protocols on the
1618       device.
1619
1620       $info->c_ip(partial, topology_protocol_arrayref)
1621           Returns reference to hash.  Key: iid, Value: remote IPv4 address
1622
1623           If multiple entries exist with the same local port, c_if(), with
1624           the same IPv4 address, c_ip(), it may be a duplicate entry.
1625
1626           If multiple entries exist with the same local port, c_if(), with
1627           different IPv4 addresses, c_ip(), there is either a device in
1628           between two or more devices utilizing a different topology protocol
1629           or multiple devices which are not directly connected.
1630
1631           Use the protocol specific methods to dig deeper.
1632
1633       $info->c_if(partial, topology_protocol_arrayref)
1634           Returns reference to hash.  Key: iid, Value: local device port
1635           (interfaces)
1636
1637       $info->c_port(partial, topology_protocol_arrayref)
1638           Returns reference to hash. Key: iid, Value: remote port
1639           (interfaces)
1640
1641       $info->c_id(partial, topology_protocol_arrayref)
1642           Returns reference to hash. Key: iid, Value: string value used to
1643           identify the chassis component associated with the remote system.
1644
1645           Note: SONMP does not return this information.
1646
1647       $info->c_platform(partial, topology_protocol_arrayref)
1648           Returns reference to hash.  Key: iid, Value: Remote Device Type
1649
1650           Note:  EDP does not provide this information.  LLDP uses
1651           ("lldpRemSysDesc") or "lldp_rem_sysname" as the closest match.
1652
1653       $info->c_cap(partial, topology_protocol_arrayref)
1654           Returns reference to hash of arrays.  Key: iid, Value: Array of
1655           capabilities supported by the device.  See the specific protocol
1656           class for string values which could be elements within the array.
1657
1658           Note:  Only CDP and LLDP support this method.
1659

SETTING DATA VIA SNMP

1661       This section explains how to use SNMP::Info to do SNMP Set operations.
1662
1663       $info->set_METHOD($value)
1664           Sets the global METHOD to value.  Assumes that iid is .0
1665
1666           Returns if failed, or the return value from SNMP::Session::set()
1667           (snmp_errno)
1668
1669            $info->set_location("Here!");
1670
1671       $info->set_METHOD($value,$iid)
1672           Table Methods. Set iid of method to value.
1673
1674           Returns if failed, or the return value from SNMP::Session::set()
1675           (snmp_errno)
1676
1677            # Disable a port administratively
1678            my %if_map = reverse %{$info->interfaces()}
1679            $info->set_i_up_admin('down', $if_map{'FastEthernet0/0'})
1680               or die "Couldn't disable the port. ",$info->error(1);
1681
1682       NOTE: You must be connected to your device with a "ReadWrite" community
1683       string in order for set operations to work.
1684
1685       NOTE: This will only set data listed in %FUNCS and %GLOBALS.  For data
1686       acquired from overridden methods (subroutines) specific set_METHOD()
1687       subroutines will need to be added if they haven't been already.
1688

Quiet Mode

1690       SNMP::Info will not chirp anything to STDOUT unless there is a serious
1691       error (in which case it will probably die).
1692
1693       To get lots of debug info, set the Debug flag when calling new() or
1694       call $info->debug(1);
1695
1696       When calling a method check the return value.  If the return value is
1697       undef then check $info->error()
1698
1699       Beware, calling $info->error() clears the error.
1700
1701        my $name = $info->name() or die "Couldn't get sysName!" . $name->error();
1702

EXTENDING SNMP::INFO

1704       To support a new class (vendor or platform) of device, add a Perl
1705       package with the data structures and methods listed below.
1706
1707       If this seems a little scary, then the SNMP::Info developers are
1708       usually happy to accept the SNMP data from your device and make an
1709       attempt at the class themselves. Usually a "beta" release will go to
1710       CPAN for you to verify the implementation.
1711
1712   Gathering MIB data for SNMP::Info Developers
1713       The preference is to open a pull request in the github project. This
1714       allows all developers to have visibility into the request.  Please
1715       include pointers to the applicable platform MIBs.  For development we
1716       will need an "snmpwalk" of the device.  There is a tool now included in
1717       the SNMP::Info distribution to help with this task, although you'll
1718       most likely need to download the distribution from CPAN as it's
1719       included in the ""contrib/util"" directory.
1720
1721       The utility is named "make_snmpdata.pl". Run it with a command line
1722       like:
1723
1724        ./make_snmpdata.pl -c community -i -d device_ip \
1725         -m /home/netdisco-mibs/rfc:/home/netdisco-mibs/net-snmp:/home/netdisco-mibs/dir3 \
1726         SNMPv2-MIB IF-MIB EtherLike-MIB BRIDGE-MIB Q-BRIDGE-MIB ENTITY-MIB \
1727         POWER-ETHERNET-MIB IPV6-MIB LLDP-MIB DEVICE-SPECIFIC-MIB-NAME(s) > output.txt
1728
1729       This will print to the file every MIB entry with data in a format that
1730       the developers can use to emulate read operations without needing
1731       access to the device.  Preference would be to mask any sensitive data
1732       in the output, zip the file, and attach it to the github pull request.
1733       However, if you do not feel comfortable uploading the output to the
1734       tracker you could e-mail it to the developer that has claimed the
1735       ticket.
1736
1737   Data Structures required in new Subclass
1738       A class inheriting this class must implement these data structures :
1739
1740       $INIT
1741           Used to flag if the MIBs have been loaded yet.
1742
1743       %GLOBALS
1744           Contains a hash in the form ( method_name => SNMP MIB leaf name )
1745           These are scalar values such as name, uptime, etc.
1746
1747           To resolve MIB leaf name conflicts between private MIBs, you may
1748           prefix the leaf name with the MIB replacing each - (dash) and :
1749           (colon) with an _ (underscore).  For example,
1750           ALTEON_TIGON_SWITCH_MIB__agSoftwareVersion would be used as the
1751           hash value instead of the net-snmp notation
1752           ALTEON-TIGON-SWITCH-MIB::agSoftwareVersion.
1753
1754           When choosing the name for the methods, be aware that other new Sub
1755           Modules might inherit this one to get it's features.  Try to choose
1756           a prefix for methods that will give it's own name space inside the
1757           SNMP::Info methods.
1758
1759       %FUNCS
1760           Contains a hash in the form ( method_name => SNMP MIB leaf name)
1761           These are table entries, such as the "ifIndex"
1762
1763           To resolve MIB leaf name conflicts between private MIBs, you may
1764           prefix the leaf name with the MIB replacing each - (dash) and :
1765           (colon) with an _ (underscore).  For example,
1766           ALTEON_TS_PHYSICAL_MIB__agPortCurCfgPortName would be used as the
1767           hash value instead of the net-snmp notation
1768           ALTEON-TS-PHYSICAL-MIB::agPortCurCfgPortName.
1769
1770       %MIBS
1771           A list of each mib needed.
1772
1773               ('MIB-NAME' => 'itemToTestForPresence')
1774
1775           The value for each entry should be a MIB object to check for to
1776           make sure that the MIB is present and has loaded correctly.
1777
1778           $info->init() will throw an exception if a MIB does not load.
1779
1780       %MUNGE
1781           A map between method calls (from %FUNCS or %GLOBALS) and subroutine
1782           methods.  The subroutine called will be passed the data as it gets
1783           it from SNMP and it should return that same data in a more human
1784           friendly format.
1785
1786           Sample %MUNGE:
1787
1788            (my_ip     => \&munge_ip,
1789             my_mac    => \&munge_mac,
1790             my_layers => \&munge_dec2bin
1791            )
1792
1793   Sample Subclass
1794       Let's make a sample Layer 2 Device subclass.  This class will inherit
1795       the Cisco Vlan module as an example.
1796
1797       ----------------------- snip --------------------------------
1798
1799        # SNMP::Info::Layer2::Sample
1800
1801        package SNMP::Info::Layer2::Sample;
1802
1803        $VERSION = 0.1;
1804
1805        use strict;
1806
1807        use Exporter;
1808        use SNMP::Info::Layer2;
1809        use SNMP::Info::CiscoVTP;
1810
1811        @SNMP::Info::Layer2::Sample::ISA = qw/SNMP::Info::Layer2
1812                                              SNMP::Info::CiscoVTP Exporter/;
1813        @SNMP::Info::Layer2::Sample::EXPORT_OK = qw//;
1814
1815        use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
1816
1817        %MIBS    = (%SNMP::Info::Layer2::MIBS,
1818                    %SNMP::Info::CiscoVTP::MIBS,
1819                    'SUPER-DOOPER-MIB'  => 'supermibobject'
1820                   );
1821
1822        %GLOBALS = (%SNMP::Info::Layer2::GLOBALS,
1823                    %SNMP::Info::CiscoVTP::GLOBALS,
1824                    'name'              => 'supermib_supername',
1825                    'favorite_color'    => 'supermib_fav_color_object',
1826                    'favorite_movie'    => 'supermib_fav_movie_val'
1827                    );
1828
1829        %FUNCS   = (%SNMP::Info::Layer2::FUNCS,
1830                    %SNMP::Info::CiscoVTP::FUNCS,
1831                    # Super Dooper MIB - Super Hero Table
1832                    'super_hero_index'  => 'SuperHeroIfIndex',
1833                    'super_hero_name'   => 'SuperHeroIfName',
1834                    'super_hero_powers' => 'SuperHeroIfPowers'
1835                   );
1836
1837
1838        %MUNGE   = (%SNMP::Info::Layer2::MUNGE,
1839                    %SNMP::Info::CiscoVTP::MUNGE,
1840                    'super_hero_powers' => \&munge_powers
1841                   );
1842
1843        # OverRide uptime() method from %SNMP::Info::GLOBALS
1844        sub uptime {
1845            my $sample = shift;
1846
1847            my $name   = $sample->name();
1848
1849            # this is silly but you get the idea
1850            return '600' if defined $name ;
1851        }
1852
1853        # Create our own munge function
1854        sub munge_powers {
1855            my $power = shift;
1856
1857            # Take the returned obscure value and return something useful.
1858            return 'Fire' if $power =~ /reallyhot/i;
1859            return 'Ice'  if $power =~ /reallycold/i;
1860
1861            # Else
1862            return $power;
1863        }
1864
1865        # Copious Documentation here!!!
1866        =head1 NAME
1867        =head1 AUTHOR
1868        =head1 SYNOPSIS
1869        =head1 DESCRIPTION
1870        =head2 Inherited Classes
1871        =head2 Required MIBs
1872        =head1 GLOBALS
1873        =head2 Overrides
1874        =head1 TABLE METHODS
1875        =head2 Overrides
1876        =cut
1877
1878        1; # don't forget this line
1879       ----------------------- snip --------------------------------
1880

SNMP::INFO INTERNALS

1882   Object Namespace
1883       Internal data is stored with bareword keys. For example $info->{debug}
1884
1885       SNMP Data is stored or marked cached with keys starting with an
1886       underscore.  For example $info->{_name} is the cache for $info->name().
1887
1888       Cached Table data is stored in $info->store() and marked cached per
1889       above.
1890
1891   Package Globals
1892       These set the default value for an object upon creation.
1893
1894       $DEBUG
1895           Default 0.  Sends copious debug info to stdout.  This global sets
1896           the object's debug status in new() unless 'Debug' argument passed
1897           in new().  Change objects' debug status with $info->debug().
1898
1899       $BIGINT
1900           Default 0.   Set to true to have 64 bit counters return
1901           Math::BigInt objects instead of scalar string values.  See note
1902           under Interface Statistics about 64 bit values.
1903
1904       $NOSUCH
1905           Default 1.  Set to false to disable RetryNoSuch option for
1906           SNMP::Session.  Or see method in new() to do it on an object scope.
1907
1908       $REPEATERS
1909           Default 20.  MaxRepeaters for BULKWALK operations.  See "perldoc
1910           SNMP" for more info.  Can change by passing BulkRepeaters option in
1911           new()
1912
1913   Data Munging Callback Subroutines
1914       munge_speed()
1915           Makes human friendly speed ratings using %SPEED_MAP.
1916
1917            %SPEED_MAP = (
1918                           '56000'      => '56 kbps',
1919                           '64000'      => '64 kbps',
1920                           '115000'     => '115 kpbs',
1921                           '1500000'    => '1.5 Mbps',
1922                           '1536000'    => 'T1',
1923                           '1544000'    => 'T1',
1924                           '2000000'    => '2.0 Mbps',
1925                           '2048000'    => '2.048 Mbps',
1926                           '3072000'    => 'Dual T1',
1927                           '3088000'    => 'Dual T1',
1928                           '4000000'    => '4.0 Mbps',
1929                           '10000000'   => '10 Mbps',
1930                           '11000000'   => '11 Mbps',
1931                           '20000000'   => '20 Mbps',
1932                           '16000000'   => '16 Mbps',
1933                           '16777216'   => '16 Mbps',
1934                           '44210000'   => 'T3',
1935                           '44736000'   => 'T3',
1936                           '45000000'   => '45 Mbps',
1937                           '45045000'   => 'DS3',
1938                           '46359642'   => 'DS3',
1939                           '51850000'   => 'OC-1',
1940                           '54000000'   => '54 Mbps',
1941                           '64000000'   => '64 Mbps',
1942                           '100000000'  => '100 Mbps',
1943                           '200000000'  => '200 Mbps',
1944                           '149760000'  => 'ATM on OC-3',
1945                           '155000000'  => 'OC-3',
1946                           '155519000'  => 'OC-3',
1947                           '155520000'  => 'OC-3',
1948                           '400000000'  => '400 Mbps',
1949                           '599040000'  => 'ATM on OC-12',
1950                           '622000000'  => 'OC-12',
1951                           '622080000'  => 'OC-12',
1952                           '1000000000' => '1.0 Gbps',
1953                           '2000000000' => '2.0 Gbps',
1954                           '2488000000' => 'OC-48',
1955                        )
1956
1957           Note: high speed interfaces (usually 1 Gbps or faster) have their
1958           link speed in "ifHighSpeed". i_speed() automatically determines
1959           whether to use "ifSpeed" or "ifHighSpeed"; if the latter is used,
1960           the value is munged by munge_highspeed(). SNMP::Info can return
1961           speeds up to terabit levels this way.
1962
1963       munge_highspeed()
1964           Makes human friendly speed ratings for "ifHighSpeed".
1965
1966       munge_ip()
1967           Takes a binary IP and makes it dotted ASCII.
1968
1969       munge_mac()
1970           Takes an octet stream (HEX-STRING) and returns a colon separated
1971           ASCII hex string.
1972
1973       munge_prio_mac()
1974           Takes an 8-byte octet stream (HEX-STRING) and returns a colon
1975           separated ASCII hex string.
1976
1977       munge_prio_port()
1978           Takes an 2-byte octet stream (HEX-STRING) and returns a colon
1979           separated ASCII hex string.
1980
1981       munge_octet2hex()
1982           Takes a binary octet stream and returns an ASCII hex string.
1983
1984       munge_dec2bin()
1985           Takes a binary char and returns its ASCII binary representation.
1986
1987       munge_bits()
1988           Takes a SNMP2 'BITS' field and returns the ASCII bit string.
1989
1990       munge_counter64()
1991           If $BIGINT is set to true, then a Math::BigInt object is returned.
1992           See Math::BigInt for details.
1993
1994       munge_i_up()
1995           Net-SNMP tends to load "RFC1213-MIB" first, and so ignores the
1996           updated enumeration for "ifOperStatus" in "IF-MIB".  This munge
1997           handles the "newer" definitions for the enumeration in IF-MIB.
1998
1999           TODO: Get the precedence of MIBs and overriding of MIB data in Net-
2000           SNMP figured out.  Heirarchy/precendence of MIBS in SNMP::Info.
2001
2002       munge_port_list()
2003           Takes an octet string representing a set of ports and returns a
2004           reference to an array of binary values each array element
2005           representing a port.
2006
2007           If the element has a value of '1', then that port is included in
2008           the set of ports; the port is not included if it has a value of
2009           '0'.
2010
2011       munge_null()
2012           Removes control characters from a string.
2013
2014       munge_e_type()
2015           Takes an OID and return the object name if the right MIB is loaded.
2016
2017   Internally Used Functions
2018       resolve_desthost()
2019           Takes the SNMP::Session "DestHost" argument and determines if it is
2020           an 'IPv4' or 'IPv6' host. 'IPv6' hosts are prefixed with the
2021           "udp6:" "transport-specifier" as required by the undelying
2022           "Net-SNMP" library.  If unable to determine the type of address or
2023           resolve a DNS name, dies with "croak".
2024
2025       $info->init()
2026           Used internally.  Loads all entries in %MIBS.
2027
2028       $info->args()
2029           Returns a reference to the argument hash supplied to SNMP::Session
2030
2031       $info->class()
2032           Returns the class name of the object.
2033
2034       $info->error_throw(error message)
2035           Stores the error message for use by $info->error()
2036
2037           If $info->debug() is true, then the error message is carped too.
2038
2039       $info->funcs()
2040           Returns a reference to the %FUNCS hash.
2041
2042       $info->globals()
2043           Returns a reference to the %GLOBALS hash.
2044
2045       $info->mibs()
2046           Returns a reference to the %MIBS hash.
2047
2048       $info->munge()
2049           Returns a reference of the %MUNGE hash.
2050
2051       $info->nosuch()
2052           Returns NoSuch value set or not in new()
2053
2054       $info->session()
2055           Gets or Sets the SNMP::Session object.
2056
2057       $info->store(new_store)
2058           Returns or sets hash store for Table functions.
2059
2060           Store is a hash reference in this format :
2061
2062           $info->store = { attribute => { iid => value , iid2 => value2, ...
2063           } };
2064
2065       $info->_global()
2066           Used internally by AUTOLOAD to create dynamic methods from %GLOBALS
2067           or a single instance MIB Leaf node name from a loaded MIB.
2068
2069           Example: $info->name() on the first call dispatches to AUTOLOAD()
2070           which calls $info->_global('name') creating the method name().
2071
2072           These methods return data as a scalar.
2073
2074       $info->_set(attr,val,iid,type)
2075           Used internally by set_multi() to run an SNMP set command.  When
2076           run clears attr cache.
2077
2078           Attr can be passed as either a scalar or a reference to an array or
2079           array of arrays when used with set_multi().
2080
2081           Example:  $info->set_name('dog',3) uses autoload to resolve to
2082           $info->_set('name','dog',3);
2083
2084       $info->_make_setter(val,iid)
2085           Used internally by AUTOLOAD to create dynamic methods from either
2086           %GLOBALS, %FUNCS, or a valid mib leaf from a loaded MIB which runs
2087           an SNMP set command.  When run clears the attribute cache.
2088
2089           Example:  $info->set_name('dog',3) dispatches to autoload to
2090           resolve to $info->_set('name','dog',3) and _make_setter creates the
2091           set_name() method.
2092
2093       $info->set_multi(arrayref)
2094           Used to run an SNMP set command on several new values in the one
2095           request.  Returns the result of $info->_set(method).
2096
2097           Pass either a reference to a 4 element array [<obj>, <iid>, <val>,
2098           <type>] or a reference to an array of 4 element arrays to specify
2099           multiple values.
2100
2101               <obj> - One of the following forms:
2102                   1) leaf identifier (e.g., C<'sysContact'>)
2103                   2) An entry in either %FUNCS, %GLOBALS (e.g., 'contact')
2104               <iid> - The dotted-decimal, instance identifier. For scalar MIB objects
2105                        use '0'
2106               <val>  - The SNMP data value being set (e.g., 'netdisco')
2107               <type> - Optional as the MIB should be loaded.
2108
2109           If one of the set assignments is invalid, then the request will be
2110           rejected without applying any of the new values - regardless of the
2111           order they appear in the list.
2112
2113           Example:
2114               my $vlan_set = [
2115                   ['qb_v_untagged',"$old_vlan_id","$old_untagged_portlist"],
2116                   ['qb_v_egress',"$new_vlan_id","$new_egress_portlist"],
2117                   ['qb_v_egress',"$old_vlan_id","$old_egress_portlist"],
2118                   ['qb_v_untagged',"$new_vlan_id","$new_untagged_portlist"],
2119                   ['qb_i_vlan',"$port","$new_vlan_id"],
2120               ];
2121
2122               $info->set_multi($vlan_set);
2123
2124       $info->load_all()
2125           Debugging routine.  This does not include any overridden method or
2126           method implemented by subroutine.
2127
2128           Runs $info->load_METHOD() for each entry in $info->funcs();
2129
2130           Returns $info->store() -- See store() entry.
2131
2132           Note return value has changed since version 0.3
2133
2134       $info->all()
2135           Runs $info->load_all() once then returns $info->store();
2136
2137           Use $info->load_all() to reload the data.
2138
2139           Note return value has changed since version 0.3
2140
2141       $info->_load_attr()
2142           Used internally by AUTOLOAD to create dynamic methods from %FUNCS
2143           or a MIB Leaf node name contained within a table of a loaded MIB.
2144
2145           Supports partial table fetches and single instance table fetches.
2146           See "Partial Table Fetches" in SNMP::Info.
2147
2148           These methods return data as a reference to a hash.
2149
2150       $info->_show_attr()
2151           Used internally by AUTOLOAD to return data called by methods listed
2152           in %FUNCS.
2153
2154       $info->snmp_connect_ip(ip)
2155           Returns true or false based upon snmp connectivity to an IP.
2156
2157       modify_port_list(portlist,offset,replacement)
2158           Replaces the specified bit in a port_list array and returns the
2159           packed bitmask
2160
2161       $info->_cache(attr, data)
2162           Cache retrieved data so that if it's asked for again, we use the
2163           cache instead of going back to Net-SNMP. Data is cached inside the
2164           blessed hashref $self.
2165
2166           Accepts the leaf and value (scalar, or hashref for a table). Does
2167           not return anything useful.
2168
2169       $info->_munge(attr, data)
2170           Raw data returned from Net-SNMP might not be formatted correctly or
2171           might have platform-specific bugs or mistakes. The MUNGE feature of
2172           SNMP::Info allows for fixups to take place.
2173
2174           Accepts the leaf and value (scalar, or hashref for a table) and
2175           returns the raw or the munged data, as appropriate. That is, you do
2176           not need to know whether MUNGE is installed, and it's safe to call
2177           this method regardless.
2178
2179       _validate_autoload_method(method)
2180           Used internally by AUTOLOAD to validate that a dynamic method
2181           should be created.  Returns the OID of the MIB leaf node the method
2182           will get or set.
2183
2184           1. Returns unless method is listed in %FUNCS, %GLOBALS, or is MIB
2185           Leaf node name in a loaded MIB for given class.
2186           2. Translates the MIB Leaf node name to an OID.
2187           3. Checks to see if the method access type is allowed for the
2188           resolved OID.  Write access for set_ methods, read access for
2189           others.
2190       $info->can()
2191           Overrides UNIVERSAL::can() so that objects will correctly report
2192           their capabilities to include dynamic methods generated at run time
2193           via AUTOLOAD.
2194
2195           Calls parent can() first to see if method exists, if not validates
2196           that a method should be created then dispatches to the appropriate
2197           internal method for creation.  The newly created method is inserted
2198           into the symbol table returning to AUTOLOAD only for the initial
2199           method call.
2200
2201           Returns undef if the method does not exist and can not be created.
2202
2203   AUTOLOAD
2204       Each entry in either %FUNCS, %GLOBALS, or MIB Leaf node names present
2205       in loaded MIBs are used by AUTOLOAD() to create dynamic methods.
2206       Generated methods are inserted into the symbol table so that subsequent
2207       calls can avoid AUTOLOAD() and dispatch directly.
2208
2209       1. Returns unless method is listed in %FUNCS, %GLOBALS, or is a MIB
2210       Leaf node name in a loaded MIB for given class.
2211       2. If the method exists in %GLOBALS or is a single instance MIB Leaf
2212       node name from a loaded MIB, _global() generates the method.
2213       3. If a set_ prefix is present _make_setter() generates the method.
2214       4. If the method exists in %FUNCS or is a MIB Leaf node name contained
2215       within a table from a loaded MIB, _load_attr() generates the method.
2216       5. A load_ prefix forces reloading of data and does not use cached
2217       data.
2218       6. A _raw suffix returns data ignoring any munge routines.
2219
2220       Override any dynamic method listed in %GLOBALS, %FUNCS, or MIB Leaf
2221       node name a by creating a subroutine with the same name.
2222
2223       For example to override $info->name() create `` sub name {...}'' in
2224       your subclass.
2225
2227       Changes from SNMP::Info Version 0.7 and on are: Copyright (c) 2003-2010
2228       Max Baker and SNMP::Info Developers All rights reserved.
2229
2230       Original Code is: Copyright (c) 2002-2003, Regents of the University of
2231       California All rights reserved.
2232
2233       Redistribution and use in source and binary forms, with or without
2234       modification, are permitted provided that the following conditions are
2235       met:
2236
2237           * Redistributions of source code must retain the above copyright notice,
2238             this list of conditions and the following disclaimer.
2239           * Redistributions in binary form must reproduce the above copyright
2240             notice, this list of conditions and the following disclaimer in the
2241             documentation and/or other materials provided with the distribution.
2242           * Neither the name of the University of California, Santa Cruz nor the
2243             names of its contributors may be used to endorse or promote products
2244             derived from this software without specific prior written permission.
2245
2246       THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
2247       IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
2248       TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
2249       PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2250       OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2251       SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2252       LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2253       DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2254       THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2255       (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2256       OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2257
2258
2259
2260perl v5.28.1                      2019-04-04                     SNMP::Info(3)
Impressum