1SNMP::Info::Layer2(3) User Contributed Perl DocumentationSNMP::Info::Layer2(3)
2
3
4
6 SNMP::Info::Layer2 - SNMP Interface to network devices serving Layer2
7 only.
8
10 Max Baker
11
13 # Let SNMP::Info determine the correct subclass for you.
14 my $l2 = new SNMP::Info(
15 AutoSpecify => 1,
16 Debug => 1,
17 DestHost => 'myswitch',
18 Community => 'public',
19 Version => 2
20 )
21 or die "Can't connect to DestHost.\n";
22
23 my $class = $l2->class();
24 print "SNMP::Info determined this device to fall under subclass : $class\n";
25
26 # Let's get some basic Port information
27 my $interfaces = $l2->interfaces();
28 my $i_up = $l2->i_up();
29 my $i_speed = $l2->i_speed();
30 foreach my $iid (keys %$interfaces) {
31 my $port = $interfaces->{$iid};
32 my $up = $i_up->{$iid};
33 my $speed = $i_speed->{$iid}
34 print "Port $port is $up. Port runs at $speed.\n";
35 }
36
38 This class is usually used as a superclass for more specific device
39 classes listed under SNMP::Info::Layer2::* Please read all docs under
40 SNMP::Info first.
41
42 Provides abstraction to the configuration information obtainable from a
43 Layer2 device through SNMP. Information is stored in a number of MIBs.
44
45 For speed or debugging purposes you can call the subclass directly, but
46 not after determining a more specific class using the method above.
47
48 my $l2 = new SNMP::Info::Layer2(...);
49
50 Inherited Classes
51 SNMP::Info
52 SNMP::Info::Bridge
53 SNMP::Info::Entity
54 SNMP::Info::LLDP
55
56 Required MIBs
57 Inherited Classes
58 MIBs required by the inherited classes listed above.
59
60 MIBs can be found in netdisco-mibs package.
61
63 These are methods that return scalar value from SNMP
64
65 Overrides
66 $l2->model()
67 Cross references $l2->id() with product IDs in the Cisco MIBs.
68
69 For HP devices, removes 'hpswitch' from the name
70
71 For Cisco devices, removes c<'sysid'> from the name
72
73 $l2->vendor()
74 Tries to discover the vendor from $l2->model() and
75 $l2->description()
76
77 $l2->serial()
78 Returns a serial number if found from ENTITY-MIB and OLD-CISCO-...
79 MIB.
80
81 Globals imported from SNMP::Info
82 See documentation in "GLOBALS" in SNMP::Info for details.
83
84 Globals imported from SNMP::Info::Bridge
85 See documentation in "GLOBALS" in SNMP::Info::Bridge for details.
86
87 Globals imported from SNMP::Info::Entity
88 See documentation in "GLOBALS" in SNMP::Info::Entity for details.
89
90 Globals imported from SNMP::Info::LLDP
91 See documentation in "GLOBALS" in SNMP::Info::LLDP for details.
92
94 These are methods that return tables of information in the form of a
95 reference to a hash.
96
97 Overrides
98 $l2->interfaces()
99 Creates a map between the interface identifier (iid) and the
100 physical port name.
101
102 Defaults to "ifDescr" but checks and overrides with "ifName"
103
104 Table Methods imported from SNMP::Info
105 See documentation in "TABLE METHODS" in SNMP::Info for details.
106
107 Table Methods imported from SNMP::Info::Bridge
108 See documentation in "TABLE METHODS" in SNMP::Info::Bridge for details.
109
110 Table Methods imported from SNMP::Info::Entity
111 See documentation in "TABLE METHODS" in SNMP::Info::Entity for details.
112
113 Table Methods imported from SNMP::Info::LLDP
114 See documentation in "TABLE METHODS" in SNMP::Info::LLDP for details.
115
116
117
118perl v5.28.0 2018-11-29 SNMP::Info::Layer2(3)