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::DocsisHE
54 SNMP::Info::Entity
55 SNMP::Info::LLDP
56 SNMP::Info::PowerEthernet
57
58 Required MIBs
59 Inherited Classes
60 MIBs required by the inherited classes listed above.
61
62 MIBs can be found in netdisco-mibs package.
63
65 These are methods that return scalar value from SNMP
66
67 Overrides
68 $l2->model()
69 Cross references $l2->id() with product IDs in the Cisco MIBs.
70
71 For HP devices, removes 'hpswitch' from the name
72
73 For Cisco devices, removes c<'sysid'> from the name
74
75 $l2->vendor()
76 Tries to discover the vendor from $l2->model() and
77 $l2->description()
78
79 $l2->serial()
80 Returns a serial number if found from ENTITY-MIB and OLD-CISCO-...
81 MIB.
82
83 Globals imported from SNMP::Info
84 See documentation in "USAGE" in SNMP::Info for details.
85
86 Globals imported from SNMP::Info::Bridge
87 See documentation in "GLOBALS" in SNMP::Info::Bridge for details.
88
89 Globals imported from SNMP::Info::Entity
90 See documentation in "GLOBALS" in SNMP::Info::Entity for details.
91
92 Globals imported from SNMP::Info::LLDP
93 See documentation in "GLOBALS" in SNMP::Info::LLDP for details.
94
96 These are methods that return tables of information in the form of a
97 reference to a hash.
98
99 Overrides
100 $l2->interfaces()
101 Creates a map between the interface identifier (iid) and the
102 physical port name.
103
104 Defaults to "ifDescr" but checks and overrides with "ifName"
105
106 Table Methods imported from SNMP::Info
107 See documentation in "USAGE" in SNMP::Info for details.
108
109 Table Methods imported from SNMP::Info::Bridge
110 See documentation in "TABLE METHODS" in SNMP::Info::Bridge for details.
111
112 Table Methods imported from SNMP::Info::Entity
113 See documentation in "TABLE METHODS" in SNMP::Info::Entity for details.
114
115 Table Methods imported from SNMP::Info::LLDP
116 See documentation in "TABLE METHODS" in SNMP::Info::LLDP for details.
117
118
119
120perl v5.34.0 2021-09-13 SNMP::Info::Layer2(3)