Provided by: libsnmp-info-perl_3.39-1_all
NAME
SNMP::Info::Bridge - SNMP Interface to SNMP data available through the BRIDGE-MIB (RFC1493)
AUTHOR
Max Baker
SYNOPSIS
my $bridge = new SNMP::Info ( AutoSpecify => 1, Debug => 1, DestHost => 'switch', Community => 'public', Version => 2 ); my $class = $bridge->class(); print " Using device sub class : $class\n"; # Grab Forwarding Tables my $interfaces = $bridge->interfaces(); my $fw_mac = $bridge->fw_mac(); my $fw_port = $bridge->fw_port(); my $bp_index = $bridge->bp_index(); foreach my $fw_index (keys %$fw_mac){ my $mac = $fw_mac->{$fw_index}; my $bp_id = $fw_port->{$fw_index}; my $iid = $bp_index->{$bp_id}; my $port = $interfaces->{$iid}; print "Port:$port forwarding to $mac\n"; }
DESCRIPTION
BRIDGE-MIB is used by most Layer 2 devices, and holds information like the MAC Forwarding Table and Spanning Tree Protocol info. Q-BRIDGE-MIB holds 802.1q information -- VLANs and Trunking. Cisco tends not to use this MIB, but some proprietary ones. HP and some nicer vendors use this. This is from "RFC2674_q". Create or use a subclass of SNMP::Info that inherits this class. Do not use directly. For debugging you can call new() directly as you would in SNMP::Info my $bridge = new SNMP::Info::Bridge(...); Inherited Classes None. Required MIBs BRIDGE-MIB Q-BRIDGE-MIB BRIDGE-MIB needs to be extracted from ftp://ftp.cisco.com/pub/mibs/v1/v1.tar.gz
GLOBAL METHODS
These are methods that return scalar values from SNMP $bridge->b_mac() Returns the MAC Address of the root bridge port ("dot1dBaseBridgeAddress") $bridge->b_ports() Returns the number of ports in device ("dot1dBaseNumPorts") $bridge->b_type() Returns the type of bridging this bridge can perform, transparent and/or source route. ("dot1dBaseType") $bridge->stp_ver() Returns what version of STP the device is running. ("dot1dStpProtocolSpecification") $bridge->stp_time() Returns time since last topology change detected. (100ths/second) ("dot1dStpTimeSinceTopologyChange") $bridge->stp_root() Returns root of STP. ("dot1dStpDesignatedRoot") $bridge->qb_vlans_max() Maximum number of VLANS supported on this device. ("dot1qMaxSupportedVlans") $bridge->qb_vlans() Current number of VLANs that are configured in this device. ("dot1qNumVlans") $bridge->qb_next_vlan_index() The next available value for "dot1qVlanIndex" of a local VLAN entry in "dot1qVlanStaticTable" ("dot1qNextFreeLocalVlanIndex")
TABLE METHODS
These are methods that return tables of information in the form of a reference to a hash. $bridge->i_vlan() Returns a mapping between "ifIndex" and the PVID or default VLAN. $vtp->i_untagged() An alias for "i_vlan". $bridge->i_vlan_membership() Returns reference to hash of arrays: key = "ifIndex", value = array of VLAN IDs. These are the VLANs which are members of the egress list for the port. Example: my $interfaces = $bridge->interfaces(); my $vlans = $bridge->i_vlan_membership(); foreach my $iid (sort keys %$interfaces) { my $port = $interfaces->{$iid}; my $vlan = join(',', sort(@{$vlans->{$iid}})); print "Port: $port VLAN: $vlan\n"; } $bridge->i_vlan_membership_untagged() Returns reference to hash of arrays: key = "ifIndex", value = array of VLAN IDs. These are the VLANs which are members of the untagged egress list for the port. $bridge->qb_i_vlan_t() Returns reference to hash: key = "dot1dBasePort", value = either 'trunk' for tagged ports or the VLAN ID. $bridge->qb_fdb_index() Returns reference to hash: key = VLAN ID, value = FDB ID. $bridge->v_index() Returns VLAN IDs Forwarding Table ("dot1dTpFdbEntry") $bridge->fw_mac() Returns reference to hash of forwarding table MAC Addresses ("dot1dTpFdbAddress") $bridge->fw_port() Returns reference to hash of forwarding table entries port interface identifier (iid) ("dot1dTpFdbPort") $bridge->fw_status() Returns reference to hash of forwarding table entries status ("dot1dTpFdbStatus") Bridge Port Table ("dot1dBasePortEntry") $bridge->bp_index() Returns reference to hash of bridge port table entries map back to interface identifier (iid) ("dot1dBasePortIfIndex") $bridge->bp_port() Returns reference to hash of bridge port table entries for a port which (potentially) has the same value of "dot1dBasePortIfIndex" as another port on the same bridge, this object contains the name of an object instance unique to this port. ("dot1dBasePortCircuit") Spanning Tree Instance Globals These are not part of a table, but return a hash reference to ease API compatibility with MST and PVST implementations indexed by a spanning tree instance id. $bridge->stp_i_time() Returns time since last topology change detected. (100ths/second) ("dot1dStpTimeSinceTopologyChange") $bridge->stp_i_time() Returns the total number of topology changes detected. ("dot1dStpTopChanges") $bridge->stp_i_root() Returns root of STP. ("dot1dStpDesignatedRoot") $bridge->stp_i_root_port() Returns the port number of the port that offers the lowest cost path to the root bridge. ("dot1dStpRootPort") $bridge->stp_i_priority() Returns the port number of the port that offers the lowest cost path to the root bridge. ("dot1dStpPriority") Spanning Tree Protocol Table ("dot1dStpPortTable") Descriptions are straight from BRIDGE-MIB.my $bridge->stp_p_id() "The port number of the port for which this entry contains Spanning Tree Protocol management information." ("dot1dStpPort") $bridge->stp_p_priority() "The value of the priority field which is contained in the first (in network byte order) octet of the (2 octet long) Port ID. The other octet of the Port ID is given by the value of "dot1dStpPort"." ("dot1dStpPortPriority") $bridge->stp_p_state() "The port's current state as defined by application of the Spanning Tree Protocol. This state controls what action a port takes on reception of a frame. If the bridge has detected a port that is malfunctioning it will place that port into the broken(6) state. For ports which are disabled (see "dot1dStpPortEnable"), this object will have a value of disabled(1)." disabled(1) blocking(2) listening(3) learning(4) forwarding(5) broken(6) ("dot1dStpPortState") $bridge->stp_p_cost() "The contribution of this port to the path cost of paths towards the spanning tree root which include this port. 802.1D-1990 recommends that the default value of this parameter be in inverse proportion to the speed of the attached LAN." ("dot1dStpPortPathCost") $bridge->stp_p_root() "The unique Bridge Identifier of the Bridge recorded as the Root in the Configuration BPDUs transmitted by the Designated Bridge for the segment to which the port is attached." ("dot1dStpPortDesignatedRoot") $bridge->stp_p_bridge() "The Bridge Identifier of the bridge which this port considers to be the Designated Bridge for this port's segment." ("dot1dStpPortDesignatedBridge") $bridge->stp_p_port() ("dot1dStpPortDesignatedPort") "The Port Identifier of the port on the Designated Bridge for this port's segment." $bridge->i_stp_port() Returns the mapping of ("dot1dStpPortDesignatedPort") to the interface index (iid). $bridge->i_stp_state() Returns the mapping of ("dot1dStpPortState") to the interface index (iid). $bridge->i_stp_id() Returns the mapping of ("dot1dStpPort") to the interface index (iid). $bridge->i_stp_bridge() Returns the mapping of ("dot1dStpPortDesignatedBridge") to the interface index (iid). Q-BRIDGE Port VLAN Table ("dot1qPortVlanTable") $bridge->qb_i_vlan() The PVID, the VLAN ID assigned to untagged frames or Priority-Tagged frames received on this port. ("dot1qPvid") $bridge->qb_i_vlan_type() Either "admitAll" or "admitOnlyVlanTagged". This is a good spot to find trunk ports. ("dot1qPortAcceptableFrameTypes") $bridge->qb_i_vlan_in_flt() When this is "true" the device will discard incoming frames for VLANs which do not include this Port in its Member set. When "false", the port will accept all incoming frames. ("dot1qPortIngressFiltering") Q-BRIDGE VLAN Current Table ("dot1qVlanCurrentTable") $bridge->qb_cv_egress() The set of ports which are assigned to the egress list for this VLAN. ("dot1qVlanCurrentEgressPorts") $bridge->qb_cv_untagged() The set of ports which should transmit egress packets for this VLAN as untagged. ("dot1qVlanCurrentUntaggedPorts") $bridge->qb_cv_stat() Status of the VLAN, other, permanent, or dynamicGvrp. ("dot1qVlanStatus") Q-BRIDGE VLAN Static Table ("dot1qVlanStaticTable") $bridge->qb_v_name() Human-entered name for vlans. ("dot1qVlanStaticName") $bridge->qb_v_egress() The set of ports which are assigned to the egress list for this VLAN. ("dot1qVlanStaticEgressPorts") $bridge->qb_v_fbdn_egress() The set of ports which are prohibited from being included in the egress list for this VLAN. ("dot1qVlanForbiddenEgressPorts") $bridge->qb_v_untagged() The set of ports which should transmit egress packets for this VLAN as untagged. ("dot1qVlanStaticUntaggedPorts") $bridge->qb_v_stat() "active" ! ("dot1qVlanStaticRowStatus") Q-BRIDGE Filtering Database Table ("dot1qFdbTable") $bridge->qb_fw_mac() Returns reference to hash of forwarding table MAC Addresses ("dot1qTpFdbAddress") $bridge->qb_fw_port() Returns reference to hash of forwarding table entries port interface identifier (iid) ("dot1qTpFdbPort") $bridge->qb_fw_vlan() Returns reference to hash of forwarding table entries VLAN ID $bridge->qb_fw_status() Returns reference to hash of forwarding table entries status ("dot1qTpFdbStatus")
SET METHODS
These are methods that provide SNMP set functionality for overridden methods or provide a simpler interface to complex set operations. See "SETTING DATA VIA SNMP" in SNMP::Info for general information on set operations. $bridge->set_i_vlan(vlan, ifIndex) Currently unsupported. Throws an error and returns. $bridge->set_i_untagged(vlan, ifIndex) An alias for "set_i_vlan". $bridge->set_i_pvid(pvid, ifIndex) Currently unsupported. Throws an error and returns. $bridge->set_add_i_vlan_tagged(vlan, ifIndex) Currently unsupported. Throws an error and returns. $bridge->set_remove_i_vlan_tagged(vlan, ifIndex) Currently unsupported. Throws an error and returns.