1Info::Layer2(3) User Contributed Perl Documentation 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
55 Required MIBs
56 Inherited Classes
57 MIBs required by the inherited classes listed above.
58
59 MIBs can be found in netdisco-mibs package.
60
62 These are methods that return scalar value from SNMP
63
64 Overrides
65 $l2->model()
66 Cross references $l2->id() with product IDs in the Cisco MIBs.
67
68 For HP devices, removes 'hpswitch' from the name
69
70 For Cisco devices, removes c<'sysid'> from the name
71
72 $l2->vendor()
73 Tries to discover the vendor from $l2->model() and
74 $l2->description()
75
76 $l2->serial()
77 Returns serial number if available through SNMP
78
79 Globals imported from SNMP::Info
80 See documentation in "GLOBALS" in SNMP::Info for details.
81
82 Globals imported from SNMP::Info::Bridge
83 See documentation in "GLOBALS" in SNMP::Info::Bridge for details.
84
85 Globals imported from SNMP::Info::Entity
86 See documentation in "GLOBALS" in SNMP::Info::Entity for details.
87
89 These are methods that return tables of information in the form of a
90 reference to a hash.
91
92 Overrides
93 $l2->interfaces()
94 Creates a map between the interface identifier (iid) and the
95 physical port name.
96
97 Defaults to "ifDescr" but checks and overrides with "ifName"
98
99 $l2->i_ignore()
100 Returns reference to hash. Increments value of IID if port is to
101 be ignored.
102
103 Ignores ports with "ifType" of loopback, propvirtual, other, and
104 cpu
105
106 Table Methods imported from SNMP::Info
107 See documentation in "TABLE METHODS" 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
116
117perl v5.12.0 2009-06-12 Info::Layer2(3)