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