1SNMP::Info::Bridge(3) User Contributed Perl DocumentationSNMP::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 RSTP-MIB
61
63 These are methods that return scalar values from SNMP
64
65 $bridge->b_mac()
66 Returns the MAC Address of the root bridge port
67
68 ("dot1dBaseBridgeAddress")
69
70 $bridge->b_ports()
71 Returns the number of ports in device
72
73 ("dot1dBaseNumPorts")
74
75 $bridge->b_type()
76 Returns the type of bridging this bridge can perform, transparent
77 and/or source route.
78
79 ("dot1dBaseType")
80
81 $bridge->stp_ver()
82 Returns what version of STP the device is running.
83
84 ("dot1dStpProtocolSpecification")
85
86 $bridge->stp_time()
87 Returns time since last topology change detected. (100ths/second)
88
89 ("dot1dStpTimeSinceTopologyChange")
90
91 $bridge->stp_root()
92 Returns root of STP.
93
94 ("dot1dStpDesignatedRoot")
95
96 $bridge->qb_vlans_max()
97 Maximum number of VLANS supported on this device.
98
99 ("dot1qMaxSupportedVlans")
100
101 $bridge->qb_vlans()
102 Current number of VLANs that are configured in this device.
103
104 ("dot1qNumVlans")
105
106 $bridge->qb_next_vlan_index()
107 The next available value for "dot1qVlanIndex" of a local VLAN entry
108 in "dot1qVlanStaticTable"
109
110 ("dot1qNextFreeLocalVlanIndex")
111
113 These are methods that return tables of information in the form of a
114 reference to a hash.
115
116 $bridge->i_vlan()
117 Returns a mapping between "ifIndex" and the PVID or default VLAN.
118
119 $vtp->i_untagged()
120 An alias for "i_vlan".
121
122 $bridge->i_vlan_membership()
123 Returns reference to hash of arrays: key = "ifIndex", value = array
124 of VLAN IDs. These are the VLANs which are members of the egress
125 list for the port.
126
127 Example:
128 my $interfaces = $bridge->interfaces();
129 my $vlans = $bridge->i_vlan_membership();
130
131 foreach my $iid (sort keys %$interfaces) {
132 my $port = $interfaces->{$iid};
133 my $vlan = join(',', sort(@{$vlans->{$iid}}));
134 print "Port: $port VLAN: $vlan\n";
135 }
136
137 $bridge->i_vlan_membership_untagged()
138 Returns reference to hash of arrays: key = "ifIndex", value = array
139 of VLAN IDs. These are the VLANs which are members of the untagged
140 egress list for the port.
141
142 $bridge->qb_i_vlan_t()
143 Returns reference to hash: key = "dot1dBasePort", value = either
144 'trunk' for tagged ports or the VLAN ID.
145
146 $bridge->qb_fdb_index()
147 Returns reference to hash: key = FDB ID, value = VLAN ID.
148
149 $bridge->v_index()
150 Returns VLAN IDs
151
152 Forwarding Table ("dot1dTpFdbEntry")
153 $bridge->fw_mac()
154 Returns reference to hash of forwarding table MAC Addresses
155
156 ("dot1dTpFdbAddress")
157
158 $bridge->fw_port()
159 Returns reference to hash of forwarding table entries port
160 interface identifier (iid)
161
162 ("dot1dTpFdbPort")
163
164 $bridge->fw_status()
165 Returns reference to hash of forwarding table entries status
166
167 ("dot1dTpFdbStatus")
168
169 Bridge Port Table ("dot1dBasePortEntry")
170 $bridge->bp_index()
171 Returns reference to hash of bridge port table entries map back to
172 interface identifier (iid)
173
174 ("dot1dBasePortIfIndex")
175
176 $bridge->bp_port()
177 Returns reference to hash of bridge port table entries for a port
178 which (potentially) has the same value of "dot1dBasePortIfIndex" as
179 another port on the same bridge, this object contains the name of
180 an object instance unique to this port.
181
182 ("dot1dBasePortCircuit")
183
184 Spanning Tree Instance Globals
185 These are not part of a table, but return a hash reference to ease API
186 compatibility with MST and PVST implementations indexed by a spanning
187 tree instance id.
188
189 $bridge->stp_i_time()
190 Returns time since last topology change detected. (100ths/second)
191
192 ("dot1dStpTimeSinceTopologyChange")
193
194 $bridge->stp_i_time()
195 Returns the total number of topology changes detected.
196
197 ("dot1dStpTopChanges")
198
199 $bridge->stp_i_root()
200 Returns root of STP.
201
202 ("dot1dStpDesignatedRoot")
203
204 $bridge->stp_i_root_port()
205 Returns the port number of the port that offers the lowest cost
206 path to the root bridge.
207
208 ("dot1dStpRootPort")
209
210 $bridge->stp_i_priority()
211 Returns the port number of the port that offers the lowest cost
212 path to the root bridge.
213
214 ("dot1dStpPriority")
215
216 Spanning Tree Protocol Table ("dot1dStpPortTable")
217 Descriptions are straight from BRIDGE-MIB.my
218
219 $bridge->stp_p_id()
220 "The port number of the port for which this entry contains Spanning
221 Tree Protocol management information."
222
223 ("dot1dStpPort")
224
225 $bridge->stp_p_priority()
226 "The value of the priority field which is contained in the first
227 (in network byte order) octet of the (2 octet long) Port ID. The
228 other octet of the Port ID is given by the value of
229 "dot1dStpPort"."
230
231 ("dot1dStpPortPriority")
232
233 $bridge->stp_p_state()
234 "The port's current state as defined by application of the Spanning
235 Tree Protocol. This state controls what action a port takes on
236 reception of a frame. If the bridge has detected a port that is
237 malfunctioning it will place that port into the broken(6) state.
238 For ports which are disabled (see "dot1dStpPortEnable"), this
239 object will have a value of disabled(1)."
240
241 disabled(1)
242 blocking(2)
243 listening(3)
244 learning(4)
245 forwarding(5)
246 broken(6)
247
248 ("dot1dStpPortState")
249
250 $bridge->stp_p_cost()
251 "The contribution of this port to the path cost of paths towards
252 the spanning tree root which include this port. 802.1D-1990
253 recommends that the default value of this parameter be in inverse
254 proportion to the speed of the attached LAN."
255
256 ("dot1dStpPortPathCost")
257
258 $bridge->stp_p_root()
259 "The unique Bridge Identifier of the Bridge recorded as the Root in
260 the Configuration BPDUs transmitted by the Designated Bridge for
261 the segment to which the port is attached."
262
263 ("dot1dStpPortDesignatedRoot")
264
265 $bridge->stp_p_bridge()
266 "The Bridge Identifier of the bridge which this port considers to
267 be the Designated Bridge for this port's segment."
268
269 ("dot1dStpPortDesignatedBridge")
270
271 $bridge->stp_p_port()
272 ("dot1dStpPortDesignatedPort")
273
274 "The Port Identifier of the port on the Designated Bridge for this
275 port's segment."
276
277 $bridge->i_stp_port()
278 Returns the mapping of ("dot1dStpPortDesignatedPort") to the
279 interface index (iid).
280
281 $bridge->i_stp_state()
282 Returns the mapping of ("dot1dStpPortState") to the interface index
283 (iid).
284
285 $bridge->i_stp_id()
286 Returns the mapping of ("dot1dStpPort") to the interface index
287 (iid).
288
289 $bridge->i_stp_bridge()
290 Returns the mapping of ("dot1dStpPortDesignatedBridge") to the
291 interface index (iid).
292
293 Q-BRIDGE Port VLAN Table ("dot1qPortVlanTable")
294 $bridge->qb_i_vlan()
295 The PVID, the VLAN ID assigned to untagged frames or Priority-
296 Tagged frames received on this port.
297
298 ("dot1qPvid")
299
300 $bridge->qb_i_vlan_type()
301 Either "admitAll" or "admitOnlyVlanTagged". This is a good spot to
302 find trunk ports.
303
304 ("dot1qPortAcceptableFrameTypes")
305
306 $bridge->qb_i_vlan_in_flt()
307 When this is "true" the device will discard incoming frames for
308 VLANs which do not include this Port in its Member set. When
309 "false", the port will accept all incoming frames.
310
311 ("dot1qPortIngressFiltering")
312
313 Q-BRIDGE VLAN Current Table ("dot1qVlanCurrentTable")
314 $bridge->qb_cv_egress()
315 The set of ports which are assigned to the egress list for this
316 VLAN.
317
318 ("dot1qVlanCurrentEgressPorts")
319
320 $bridge->qb_cv_untagged()
321 The set of ports which should transmit egress packets for this VLAN
322 as untagged.
323
324 ("dot1qVlanCurrentUntaggedPorts")
325
326 $bridge->qb_cv_stat()
327 Status of the VLAN, other, permanent, or dynamicGvrp.
328
329 ("dot1qVlanStatus")
330
331 Q-BRIDGE VLAN Static Table ("dot1qVlanStaticTable")
332 $bridge->qb_v_name()
333 Human-entered name for vlans.
334
335 ("dot1qVlanStaticName")
336
337 $bridge->qb_v_egress()
338 The set of ports which are assigned to the egress list for this
339 VLAN.
340
341 ("dot1qVlanStaticEgressPorts")
342
343 $bridge->qb_v_fbdn_egress()
344 The set of ports which are prohibited from being included in the
345 egress list for this VLAN.
346
347 ("dot1qVlanForbiddenEgressPorts")
348
349 $bridge->qb_v_untagged()
350 The set of ports which should transmit egress packets for this VLAN
351 as untagged.
352
353 ("dot1qVlanStaticUntaggedPorts")
354
355 $bridge->qb_v_stat()
356 "active" !
357
358 ("dot1qVlanStaticRowStatus")
359
360 Q-BRIDGE Filtering Database Table ("dot1qFdbTable")
361 $bridge->qb_fw_mac()
362 Returns reference to hash of forwarding table MAC Addresses
363
364 ("dot1qTpFdbAddress")
365
366 $bridge->qb_fw_port()
367 Returns reference to hash of forwarding table entries port
368 interface identifier (iid)
369
370 ("dot1qTpFdbPort")
371
372 $bridge->qb_fw_vlan()
373 Returns reference to hash of forwarding table entries VLAN ID
374
375 $bridge->qb_fw_status()
376 Returns reference to hash of forwarding table entries status
377
378 ("dot1qTpFdbStatus")
379
381 These are methods that provide SNMP set functionality for overridden
382 methods or provide a simpler interface to complex set operations. See
383 "SETTING DATA VIA SNMP" in SNMP::Info for general information on set
384 operations.
385
386 $bridge->set_i_vlan(vlan, ifIndex)
387 Currently unsupported. Throws an error and returns.
388
389 $bridge->set_i_untagged(vlan, ifIndex)
390 An alias for "set_i_vlan".
391
392 $bridge->set_i_pvid(pvid, ifIndex)
393 Currently unsupported. Throws an error and returns.
394
395 $bridge->set_add_i_vlan_tagged(vlan, ifIndex)
396 Currently unsupported. Throws an error and returns.
397
398 $bridge->set_remove_i_vlan_tagged(vlan, ifIndex)
399 Currently unsupported. Throws an error and returns.
400
401
402
403perl v5.36.1 2023-07-17 SNMP::Info::Bridge(3)