The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

SNMP::Info::Bridge - Perl5 Interface to SNMP data available through the BRIDGE-MIB (RFC1493)

AUTHOR

Max Baker (max@warped.org)

SYNOPSIS

 my $bridge = new SNMP::Info ( 
                             AutoSpecify => 1,
                             Debug       => 1,
                             DestHost    => 'switch', 
                             Community   => 'public',
                             Version     => 2
                             );

 my $class = $cdp->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_mac->{$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.

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

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 the device

(dot1dBaseType)

$bridge->stp_ver()

Returns what version of STP the device is running. Either decLb100 or ieee8021d.

(dot1dStpProtocolSpecification)

$bridge->stp_time()

Returns time since last topology change detected. (100ths/second)

(dot1dStpTimeSinceTopologyChange)

$bridge->stp_root()

Returns root of STP.

(dot1dStpDesignatedRoot)

TABLE METHODS

These are methods that return tables of information in the form of a reference to a hash.

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 forwading table entries status

(dot2dTpFdbStatus)

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 physical port name.

(dot1dBasePortCircuit)

Spanning Tree Protocol Table (dot1dStpPortTable)

Descriptions are lifted 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."