1Info::Bridge(3) User Contributed Perl Documentation Info::Bridge(3)
2
3
4
6 SNMP::Info::Bridge - SNMP Interface to SNMP data available through the
7 BRIDGE-MIB (RFC1493)
8
10 Max Baker
11
13 my $bridge = new SNMP::Info (
14 AutoSpecify => 1,
15 Debug => 1,
16 DestHost => 'switch',
17 Community => 'public',
18 Version => 2
19 );
20
21 my $class = $bridge->class();
22 print " Using device sub class : $class\n";
23
24 # Grab Forwarding Tables
25 my $interfaces = $bridge->interfaces();
26 my $fw_mac = $bridge->fw_mac();
27 my $fw_port = $bridge->fw_port();
28 my $bp_index = $bridge->bp_index();
29
30 foreach my $fw_index (keys %$fw_mac){
31 my $mac = $fw_mac->{$fw_index};
32 my $bp_id = $fw_port->{$fw_index};
33 my $iid = $bp_index->{$bp_id};
34 my $port = $interfaces->{$iid};
35
36 print "Port:$port forwarding to $mac\n";
37 }
38
40 BRIDGE-MIB is used by most Layer 2 devices, and holds information like
41 the MAC Forwarding Table and Spanning Tree Protocol info.
42
43 Q-BRIDGE-MIB holds 802.1q information -- VLANs and Trunking. Cisco
44 tends not to use this MIB, but some proprietary ones. HP and some
45 nicer vendors use this. This is from "RFC2674_q".
46
47 Create or use a subclass of SNMP::Info that inherits this class. Do
48 not use directly.
49
50 For debugging you can call new() directly as you would in SNMP::Info
51
52 my $bridge = new SNMP::Info::Bridge(...);
53
54 Inherited Classes
55 None.
56
57 Required MIBs
58 BRIDGE-MIB
59 Q-BRIDGE-MIB
60
61 BRIDGE-MIB needs to be extracted from
62 ftp://ftp.cisco.com/pub/mibs/v1/v1.tar.gz
63
65 These are methods that return scalar values from SNMP
66
67 $bridge->b_mac()
68 Returns the MAC Address of the root bridge port
69
70 ("dot1dBaseBridgeAddress")
71
72 $bridge->b_ports()
73 Returns the number of ports in device
74
75 ("dot1dBaseNumPorts")
76
77 $bridge->b_type()
78 Returns the type of bridging this bridge can perform, transparent
79 and/or source route.
80
81 ("dot1dBaseType")
82
83 $bridge->stp_ver()
84 Returns what version of STP the device is running.
85
86 ("dot1dStpProtocolSpecification")
87
88 $bridge->stp_time()
89 Returns time since last topology change detected. (100ths/second)
90
91 ("dot1dStpTimeSinceTopologyChange")
92
93 $bridge->stp_root()
94 Returns root of STP.
95
96 ("dot1dStpDesignatedRoot")
97
98 $bridge->qb_vlans_max()
99 Maximum number of VLANS supported on this device.
100
101 ("dot1qMaxSupportedVlans")
102
103 $bridge->qb_vlans()
104 Current number of VLANs that are configured in this device.
105
106 ("dot1qNumVlans")
107
108 $bridge->qb_next_vlan_index()
109 The next available value for "dot1qVlanIndex" of a local VLAN entry
110 in "dot1qVlanStaticTable"
111
112 ("dot1qNextFreeLocalVlanIndex")
113
115 These are methods that return tables of information in the form of a
116 reference to a hash.
117
118 $bridge->i_vlan()
119 Returns a mapping between "ifIndex" and the PVID or default VLAN.
120
121 $bridge->i_vlan_membership()
122 Returns reference to hash of arrays: key = "ifIndex", value = array
123 of VLAN IDs. These are the VLANs which are members of the egress
124 list for the port.
125
126 Example:
127 my $interfaces = $bridge->interfaces();
128 my $vlans = $bridge->i_vlan_membership();
129
130 foreach my $iid (sort keys %$interfaces) {
131 my $port = $interfaces->{$iid};
132 my $vlan = join(',', sort(@{$vlans->{$iid}}));
133 print "Port: $port VLAN: $vlan\n";
134 }
135
136 $bridge->qb_i_vlan_t()
137 Returns reference to hash: key = "dot1dBasePort", value = either
138 'trunk' for tagged ports or the VLAN ID.
139
140 $bridge->v_index()
141 Returns VLAN IDs
142
143 Forwarding Table ("dot1dTpFdbEntry")
144 $bridge->fw_mac()
145 Returns reference to hash of forwarding table MAC Addresses
146
147 ("dot1dTpFdbAddress")
148
149 $bridge->fw_port()
150 Returns reference to hash of forwarding table entries port
151 interface identifier (iid)
152
153 ("dot1dTpFdbPort")
154
155 $bridge->fw_status()
156 Returns reference to hash of forwarding table entries status
157
158 ("dot2dTpFdbStatus")
159
160 Bridge Port Table ("dot1dBasePortEntry")
161 $bridge->bp_index()
162 Returns reference to hash of bridge port table entries map back to
163 interface identifier (iid)
164
165 ("dot1dBasePortIfIndex")
166
167 $bridge->bp_port()
168 Returns reference to hash of bridge port table entries for a port
169 which (potentially) has the same value of "dot1dBasePortIfIndex" as
170 another port on the same bridge, this object contains the name of
171 an object instance unique to this port.
172
173 ("dot1dBasePortCircuit")
174
175 Spanning Tree Protocol Table ("dot1dStpPortTable")
176 Descriptions are straight from BRIDGE-MIB.my
177
178 $bridge->stp_p_id()
179 "The port number of the port for which this entry contains Spanning
180 Tree Protocol management information."
181
182 ("dot1dStpPort")
183
184 $bridge->stp_p_priority()
185 "The value of the priority field which is contained in the first
186 (in network byte order) octet of the (2 octet long) Port ID. The
187 other octet of the Port ID is given by the value of
188 "dot1dStpPort"."
189
190 ("dot1dStpPortPriority")
191
192 $bridge->stp_p_state()
193 "The port's current state as defined by application of the Spanning
194 Tree Protocol. This state controls what action a port takes on
195 reception of a frame. If the bridge has detected a port that is
196 malfunctioning it will place that port into the broken(6) state.
197 For ports which are disabled (see "dot1dStpPortEnable"), this
198 object will have a value of disabled(1)."
199
200 disabled(1)
201 blocking(2)
202 listening(3)
203 learning(4)
204 forwarding(5)
205 broken(6)
206
207 ("dot1dStpPortState")
208
209 $bridge->stp_p_cost()
210 "The contribution of this port to the path cost of paths towards
211 the spanning tree root which include this port. 802.1D-1990
212 recommends that the default value of this parameter be in inverse
213 proportion to the speed of the attached LAN."
214
215 ("dot1dStpPortPathCost")
216
217 $bridge->stp_p_root()
218 "The unique Bridge Identifier of the Bridge recorded as the Root in
219 the Configuration BPDUs transmitted by the Designated Bridge for
220 the segment to which the port is attached."
221
222 ("dot1dStpPortDesignatedRoot")
223
224 $bridge->stp_p_bridge()
225 "The Bridge Identifier of the bridge which this port considers to
226 be the Designated Bridge for this port's segment."
227
228 ("dot1dStpPortDesignatedBridge")
229
230 $bridge->stp_p_port()
231 ("dot1dStpPortDesignatedPort")
232
233 "The Port Identifier of the port on the Designated Bridge for this
234 port's segment."
235
236 $bridge->i_stp_port()
237 Returns the mapping of ("dot1dStpPortDesignatedPort") to the
238 interface index (iid).
239
240 $bridge->i_stp_state()
241 Returns the mapping of ("dot1dStpPortState") to the interface index
242 (iid).
243
244 $bridge->i_stp_id()
245 Returns the mapping of ("dot1dStpPort") to the interface index
246 (iid).
247
248 $bridge->i_stp_bridge()
249 Returns the mapping of ("dot1dStpPortDesignatedBridge") to the
250 interface index (iid).
251
252 Q-BRIDGE Port VLAN Table ("dot1qPortVlanTable")
253 $bridge->qb_i_vlan()
254 The PVID, the VLAN ID assigned to untagged frames or Priority-
255 Tagged frames received on this port.
256
257 ("dot1qPvid")
258
259 $bridge->qb_i_vlan_type()
260 Either "admitAll" or "admitOnlyVlanTagged". This is a good spot to
261 find trunk ports.
262
263 ("dot1qPortAcceptableFrameTypes")
264
265 $bridge->qb_i_vlan_in_flt()
266 When this is "true" the device will discard incoming frames for
267 VLANs which do not include this Port in its Member set. When
268 "false", the port will accept all incoming frames.
269
270 ("dot1qPortIngressFiltering")
271
272 Q-BRIDGE VLAN Current Table ("dot1qVlanCurrentTable")
273 $bridge->qb_cv_egress()
274 The set of ports which are assigned to the egress list for this
275 VLAN.
276
277 ("dot1qVlanCurrentEgressPorts")
278
279 $bridge->qb_cv_untagged()
280 The set of ports which should transmit egress packets for this VLAN
281 as untagged.
282
283 ("dot1qVlanCurrentUntaggedPorts")
284
285 $bridge->qb_cv_stat()
286 Status of the VLAN, other, permanent, or dynamicGvrp.
287
288 ("dot1qVlanStatus")
289
290 Q-BRIDGE VLAN Static Table ("dot1qVlanStaticTable")
291 $bridge->qb_v_name()
292 Human-entered name for vlans.
293
294 ("dot1qVlanStaticName")
295
296 $bridge->qb_v_egress()
297 The set of ports which are assigned to the egress list for this
298 VLAN.
299
300 ("dot1qVlanStaticEgressPorts")
301
302 $bridge->qb_v_fbdn_egress()
303 The set of ports which are prohibited from being included in the
304 egress list for this VLAN.
305
306 ("dot1qVlanForbiddenEgressPorts")
307
308 $bridge->qb_v_untagged()
309 The set of ports which should transmit egress packets for this VLAN
310 as untagged.
311
312 ("dot1qVlanStaticUntaggedPorts")
313
314 $bridge->qb_v_stat()
315 "active" !
316
317 ("dot1qVlanStaticRowStatus")
318
319 Q-BRIDGE Filtering Database Table ("dot1qFdbTable")
320 $bridge->qb_fw_mac()
321 Returns reference to hash of forwarding table MAC Addresses
322
323 ("dot1qTpFdbAddress")
324
325 $bridge->qb_fw_port()
326 Returns reference to hash of forwarding table entries port
327 interface identifier (iid)
328
329 ("dot1qTpFdbPort")
330
331 $bridge->qb_fw_status()
332 Returns reference to hash of forwarding table entries status
333
334 ("dot1qTpFdbStatus")
335
337 These are methods that provide SNMP set functionality for overridden
338 methods or provide a simpler interface to complex set operations. See
339 "SETTING DATA VIA SNMP" in SNMP::Info for general information on set
340 operations.
341
342 $bridge->set_i_vlan(vlan, ifIndex)
343 Currently unsupported. Throws an error and returns.
344
345 $bridge->set_i_pvid(pvid, ifIndex)
346 Currently unsupported. Throws an error and returns.
347
348 $bridge->set_add_i_vlan_tagged(vlan, ifIndex)
349 Currently unsupported. Throws an error and returns.
350
351 $bridge->set_remove_i_vlan_tagged(vlan, ifIndex)
352 Currently unsupported. Throws an error and returns.
353
354
355
356perl v5.12.0 2009-06-12 Info::Bridge(3)