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