- added os() , os_ver, and os_bin()

- doc change to 0.4 style
This commit is contained in:
Max Baker
2003-04-29 16:53:46 +00:00
parent 6da7d340a9
commit d7e524b4a3

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::Layer2::Bay; package SNMP::Info::Layer2::Bay;
$VERSION = 0.3; $VERSION = 0.4;
# $Id$ # $Id$
use strict; use strict;
@@ -73,6 +73,42 @@ $SNMP::Info::SPEED_MAP{200_000_000} = '100 Mbps';
'i_mac2' => \&SNMP::Info::munge_mac , 'i_mac2' => \&SNMP::Info::munge_mac ,
); );
sub os {
return 'bay';
}
sub os_ver {
my $bay = shift;
my $descr = $bay->description();
# 303 / 304
if ($descr =~ m/Rev: \d+\.\d+\.\d+\.\d+-(\d+\.\d+\.\d+\.\d+)/){
return $1;
}
# 450
if ($descr =~ m/SW:v(\d+\.\d+\.\d+\.\d+)/){
return $1;
}
return undef;
}
sub os_bin {
my $bay = shift;
my $descr = $bay->description();
# 303 / 304
if ($descr =~ m/Rev: \d+\.(\d+\.\d+\.\d+)-\d+\.\d+\.\d+\.\d+/){
return $1;
}
# 450
if ($descr =~ m/FW:v(\d+\.\d+\.\d+\.\d+)/){
return $1;
}
return undef;
}
sub vendor { sub vendor {
# or nortel, or synopsis? # or nortel, or synopsis?
return 'bay'; return 'bay';
@@ -136,6 +172,7 @@ sub c_if {
my %c_if; my %c_if;
foreach my $entry (keys %$bay_topo_port){ foreach my $entry (keys %$bay_topo_port){
my $port = $bay_topo_port->{$entry}; my $port = $bay_topo_port->{$entry};
next unless defined $port;
next if $port == 0; next if $port == 0;
$c_if{"$port.1"} = $port; $c_if{"$port.1"} = $port;
} }
@@ -181,6 +218,7 @@ sub c_port {
my %c_port; my %c_port;
foreach my $entry (keys %$bay_topo_seg){ foreach my $entry (keys %$bay_topo_seg){
my $port = $bay_topo_port->{$entry}; my $port = $bay_topo_port->{$entry};
next unless defined $port;
next if $port == 0; next if $port == 0;
# For fake remotes (multiple IPs for a c_ip), use first found # For fake remotes (multiple IPs for a c_ip), use first found
@@ -224,33 +262,7 @@ __END__
=head1 NAME =head1 NAME
SNMP::Info::Layer2::Bay - SNMP Interface to old Bay Network Switches SNMP::Info::Layer2::Bay - SNMP Interface to old Bay Network BayStack Switches
=head1 DESCRIPTION
Provides abstraction to the configuration information obtainable from a
Bay device through SNMP.
Inherits from
SNMP::Info::Layer2
Required MIBs:
SYNOPTICS-ROOT-MIB
S5-ETH-MULTISEG-TOPOLOGY-MIB
MIBS listed in SNMP::Info::Layer2
Bay MIBs can be found on the CD that came with your product.
Or, if you still have a service contract they can be downloaded at
www.nortelnetworks.com
They have also been seen at : http://www.inotech.com/mibs/vendor/baynetworks/synoptics/synoptics.asp
Or http://www.oidview.com/mibs/detail.html under Synoptics.
You will need at least the two listed above, and probably a few more.
=head1 AUTHOR =head1 AUTHOR
@@ -258,29 +270,65 @@ Max Baker (C<max@warped.org>)
=head1 SYNOPSIS =head1 SYNOPSIS
my $bay = new SNMP::Info::Layer2::Bay(DestHost => 'mybayswitch' , # Let SNMP::Info determine the correct subclass for you.
Community => 'public' ); my $bay = new SNMP::Info(
AutoSpecify => 1,
Debug => 1,
# These arguments are passed directly on to SNMP::Session
DestHost => 'myswitch',
Community => 'public',
Version => 2
)
or die "Can't connect to DestHost.\n";
=head1 CREATING AN OBJECT my $class = $bay->class();
print "SNMP::Info determined this device to fall under subclass : $class\n";
=head1 DESCRIPTION
Provides abstraction to the configuration information obtainable from a
Bay device through SNMP.
For speed or debugging purposes you can call the subclass directly, but not after determining
a more specific class using the method above.
my $bay = new SNMP::Info::Layer2::Bay(...);
=head2 Inherited Classes
=over =over
=item new SNMP::Info::Layer2::Bay() =item SNMP::Info::Layer2
Arguments passed to new() are passed on to SNMP::Session::new()
my $bay = new SNMP::Info::Layer2::Bay(
DestHost => $host,
Community => 'public',
Version => 3,...
)
die "Couldn't connect.\n" unless defined $bay;
=back =back
=head2 Required MIBs
=over
=item SYNOPTICS-ROOT-MIB
=item S5-ETH-MULTISEG-TOPOLOGY-MIB
=item Inherited classes
MIBs required by SNMP::Info::Layer2 and its superclasses.
=back
Bay MIBs can be found on the CD that came with your product.
Or, if you still have a service contract they can be downloaded at
www.nortelnetworks.com
They have also been seen at : http://www.inotech.com/mibs/vendor/baynetworks/synoptics/synoptics.asp
Or http://www.oidview.com/mibs/detail.html under Synoptics. Check also www.mibdepot.com
=head1 GLOBALS =head1 GLOBALS
These are methods that return scalar value from SNMP
=over =over
=item $bay->vendor() =item $bay->vendor()
@@ -309,8 +357,15 @@ Returns if the S5-ETH-MULTISEG-TOPOLOGY info is on for this device.
=back =back
=head2 Globals imported from SNMP::Info::Layer2
See documentation in SNMP::Info::Layer2 for details.
=head1 TABLE ENTRIES =head1 TABLE ENTRIES
These are methods that return tables of information in the form of a reference
to a hash.
=head2 Overrides =head2 Overrides
=over =over
@@ -417,4 +472,8 @@ Returns reference to hash. Key: Table entry, Value:Boolean, if bay_topo_seg() i
=back =back
=head2 Table Methods imported from SNMP::Info::Layer2
See documentation in SNMP::Info::Layer2 for details.
=cut =cut