added b_mac to MUNGE, 0.4 doc change

This commit is contained in:
Max Baker
2003-04-29 18:06:20 +00:00
parent cc13a0f850
commit 2674536a55

View File

@@ -28,7 +28,7 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Bridge; package SNMP::Info::Bridge;
$VERSION = 0.3; $VERSION = 0.4;
# $Id$ # $Id$
use strict; use strict;
@@ -44,7 +44,9 @@ $DEBUG=0;
$SNMP::debugging=$DEBUG; $SNMP::debugging=$DEBUG;
$INIT = 0; $INIT = 0;
%MIBS = ('BRIDGE-MIB' => 'dot1dBaseBridgeAddress');
%MIBS = ('BRIDGE-MIB' => 'dot1dBaseBridgeAddress');
%GLOBALS = ( %GLOBALS = (
'b_mac' => 'dot1dBaseBridgeAddress', 'b_mac' => 'dot1dBaseBridgeAddress',
'b_ports' => 'dot1dBaseNumPorts', 'b_ports' => 'dot1dBaseNumPorts',
@@ -82,6 +84,7 @@ $INIT = 0;
# Inherit all the built in munging # Inherit all the built in munging
%SNMP::Info::MUNGE, %SNMP::Info::MUNGE,
# Add ones for our class # Add ones for our class
'b_mac' => \&SNMP::Info::munge_mac,
'fw_mac' => \&SNMP::Info::munge_mac, 'fw_mac' => \&SNMP::Info::munge_mac,
'bs_mac' => \&SNMP::Info::munge_mac, 'bs_mac' => \&SNMP::Info::munge_mac,
'stp_root' => \&SNMP::Info::munge_mac, 'stp_root' => \&SNMP::Info::munge_mac,
@@ -115,13 +118,7 @@ __END__
=head1 NAME =head1 NAME
SNMP::Info::Bridge - Perl5 Interface to BRIDGE-MIB SNMP::Info::Bridge - Perl5 Interface to SNMP data available through the BRIDGE-MIB (RFC1493)
=head1 DESCRIPTION
BRIDGE-MIB is used by most Layer 2 devices like Switches
Inherits all methods from SNMP::Info
=head1 AUTHOR =head1 AUTHOR
@@ -129,40 +126,59 @@ Max Baker (C<max@warped.org>)
=head1 SYNOPSIS =head1 SYNOPSIS
my $bridge = new SNMP::Info::Bridge(DestHost => 'myswitch', my $bridge = new SNMP::Info (
Community => 'public'); AutoSpecify => 1,
my $mac = $bridge->mac(); Debug => 1,
DestHost => 'switch',
Community => 'public',
Version => 2
);
=head1 CREATING AN OBJECT 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";
}
=head1 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(...);
=head2 Inherited Classes
None.
=head2 Required MIBs
=over =over
=item new SNMP::Info::Bridge() =item BRIDGE-MIB
Arguments passed to new() are passed on to SNMP::Session::new()
my $bridge = new SNMP::Info::Bridge(
DestHost => $host,
Community => 'public',
Version => 3,...
)
die "Couldn't connect.\n" unless defined $bridge;
=item $bridge->session()
Sets or returns the SNMP::Session object
# Get
my $sess = $bridge->session();
# Set
my $newsession = new SNMP::Session(...);
$bridge->session($newsession);
=back =back
=head1 Bridge Global Configuration Values BRIDGE-MIB needs to be extracted from ftp://ftp.cisco.com/pub/mibs/v1/v1.tar.gz
=head1 GLOBAL METHODS
These are methods that return scalar values from SNMP
=over =over
@@ -204,7 +220,10 @@ Returns root of STP.
=back =back
=head1 TABLE ENTRIES =head1 TABLE METHODS
These are methods that return tables of information in the form of a reference
to a hash.
=head2 Forwarding Table (dot1dTpFdbEntry) =head2 Forwarding Table (dot1dTpFdbEntry)