Inherit from Layer2. Use orig_ syntax. Remove redundant items.
Support partial table fetches on overridden table methods. Pod updates.
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
# Eric Miller
|
# Eric Miller
|
||||||
# $Id$
|
# $Id$
|
||||||
#
|
#
|
||||||
# Copyright (c) 2004-6 Eric Miller, Max Baker
|
# Copyright (c) 2004 Eric Miller, Max Baker
|
||||||
#
|
#
|
||||||
# Redistribution and use in source and binary forms, with or without
|
# Redistribution and use in source and binary forms, with or without
|
||||||
# modification, are permitted provided that the following conditions are met:
|
# modification, are permitted provided that the following conditions are met:
|
||||||
@@ -28,23 +28,21 @@
|
|||||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
package SNMP::Info::Layer1::Bayhub;
|
package SNMP::Info::Layer1::Bayhub;
|
||||||
$VERSION = '1.04';
|
$VERSION = '1.05';
|
||||||
use strict;
|
use strict;
|
||||||
|
|
||||||
use Exporter;
|
use Exporter;
|
||||||
use SNMP::Info;
|
|
||||||
use SNMP::Info::Bridge;
|
|
||||||
use SNMP::Info::NortelStack;
|
|
||||||
use SNMP::Info::SONMP;
|
use SNMP::Info::SONMP;
|
||||||
|
use SNMP::Info::NortelStack;
|
||||||
|
use SNMP::Info::Layer2;
|
||||||
|
|
||||||
@SNMP::Info::Layer1::Bayhub::ISA = qw/SNMP::Info SNMP::Info::Bridge SNMP::Info::NortelStack SNMP::Info::SONMP Exporter/;
|
@SNMP::Info::Layer1::Bayhub::ISA = qw/SNMP::Info::SONMP SNMP::Info::NortelStack SNMP::Info::Layer2 Exporter/;
|
||||||
@SNMP::Info::Layer1::Bayhub::EXPORT_OK = qw//;
|
@SNMP::Info::Layer1::Bayhub::EXPORT_OK = qw//;
|
||||||
|
|
||||||
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
|
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
|
||||||
|
|
||||||
%MIBS = (
|
%MIBS = (
|
||||||
%SNMP::Info::MIBS,
|
%SNMP::Info::Layer2::MIBS,
|
||||||
%SNMP::Info::Bridge::MIBS,
|
|
||||||
%SNMP::Info::NortelStack::MIBS,
|
%SNMP::Info::NortelStack::MIBS,
|
||||||
%SNMP::Info::SONMP::MIBS,
|
%SNMP::Info::SONMP::MIBS,
|
||||||
'S5-ETHERNET-COMMON-MIB' => 's5EnPortTable',
|
'S5-ETHERNET-COMMON-MIB' => 's5EnPortTable',
|
||||||
@@ -52,15 +50,13 @@ use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
|
|||||||
);
|
);
|
||||||
|
|
||||||
%GLOBALS = (
|
%GLOBALS = (
|
||||||
%SNMP::Info::GLOBALS,
|
%SNMP::Info::Layer2::GLOBALS,
|
||||||
%SNMP::Info::Bridge::GLOBALS,
|
|
||||||
%SNMP::Info::NortelStack::GLOBALS,
|
%SNMP::Info::NortelStack::GLOBALS,
|
||||||
%SNMP::Info::SONMP::GLOBALS,
|
%SNMP::Info::SONMP::GLOBALS,
|
||||||
);
|
);
|
||||||
|
|
||||||
%FUNCS = (
|
%FUNCS = (
|
||||||
%SNMP::Info::FUNCS,
|
%SNMP::Info::Layer2::FUNCS,
|
||||||
%SNMP::Info::Bridge::FUNCS,
|
|
||||||
%SNMP::Info::NortelStack::FUNCS,
|
%SNMP::Info::NortelStack::FUNCS,
|
||||||
%SNMP::Info::SONMP::FUNCS,
|
%SNMP::Info::SONMP::FUNCS,
|
||||||
# S5-ETHERNET-COMMON-MIB::s5EnPortTable
|
# S5-ETHERNET-COMMON-MIB::s5EnPortTable
|
||||||
@@ -75,8 +71,7 @@ use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
|
|||||||
);
|
);
|
||||||
|
|
||||||
%MUNGE = (
|
%MUNGE = (
|
||||||
%SNMP::Info::MUNGE,
|
%SNMP::Info::Layer2::MUNGE,
|
||||||
%SNMP::Info::Bridge::MUNGE,
|
|
||||||
%SNMP::Info::NortelStack::MUNGE,
|
%SNMP::Info::NortelStack::MUNGE,
|
||||||
%SNMP::Info::SONMP::MUNGE,
|
%SNMP::Info::SONMP::MUNGE,
|
||||||
);
|
);
|
||||||
@@ -108,11 +103,14 @@ sub model {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Hubs do not support ifMIB requirements for get MAC
|
# Hubs do not support ifMIB requirements for get MAC
|
||||||
# and port status
|
# and port status
|
||||||
|
|
||||||
sub i_index {
|
sub i_index {
|
||||||
my $bayhub = shift;
|
my $bayhub = shift;
|
||||||
my $b_index = $bayhub->bayhub_pb_index();
|
my $partial = shift;
|
||||||
my $p_index = $bayhub->bayhub_pp_index();
|
|
||||||
|
my $b_index = $bayhub->bayhub_pb_index($partial) || {};
|
||||||
|
my $p_index = $bayhub->bayhub_pp_index($partial) || {};
|
||||||
my $model = $bayhub->model();
|
my $model = $bayhub->model();
|
||||||
|
|
||||||
my %i_index;
|
my %i_index;
|
||||||
@@ -141,14 +139,20 @@ sub i_index {
|
|||||||
return \%i_index;
|
return \%i_index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Partials don't really help in this class, but implemented
|
||||||
|
# for consistency
|
||||||
|
|
||||||
sub interfaces {
|
sub interfaces {
|
||||||
my $bayhub = shift;
|
my $bayhub = shift;
|
||||||
my $i_index = $bayhub->i_index();
|
my $partial = shift;
|
||||||
|
|
||||||
|
my $i_index = $bayhub->i_index() || {};
|
||||||
|
|
||||||
my %if;
|
my %if;
|
||||||
foreach my $iid (keys %$i_index){
|
foreach my $iid (keys %$i_index){
|
||||||
my $index = $i_index->{$iid};
|
my $index = $i_index->{$iid};
|
||||||
next unless defined $index;
|
next unless defined $index;
|
||||||
|
next if (defined $partial and $index !~ /^$partial$/);
|
||||||
|
|
||||||
# Index numbers are deterministic slot * 256 + port
|
# Index numbers are deterministic slot * 256 + port
|
||||||
my $port = $index % 256;
|
my $port = $index % 256;
|
||||||
@@ -164,12 +168,15 @@ sub interfaces {
|
|||||||
|
|
||||||
sub i_duplex {
|
sub i_duplex {
|
||||||
my $bayhub = shift;
|
my $bayhub = shift;
|
||||||
my $port_index = $bayhub->i_index();
|
my $partial = shift;
|
||||||
|
|
||||||
|
my $port_index = $bayhub->i_index() || {};
|
||||||
|
|
||||||
my %i_duplex;
|
my %i_duplex;
|
||||||
foreach my $iid (keys %$port_index){
|
foreach my $iid (keys %$port_index){
|
||||||
my $index = $port_index->{$iid};
|
my $index = $port_index->{$iid};
|
||||||
next unless defined $index;
|
next unless defined $index;
|
||||||
|
next if (defined $partial and $index !~ /^$partial$/);
|
||||||
|
|
||||||
my $duplex = 'half';
|
my $duplex = 'half';
|
||||||
$i_duplex{$index}=$duplex;
|
$i_duplex{$index}=$duplex;
|
||||||
@@ -179,12 +186,15 @@ sub i_duplex {
|
|||||||
|
|
||||||
sub i_duplex_admin {
|
sub i_duplex_admin {
|
||||||
my $bayhub = shift;
|
my $bayhub = shift;
|
||||||
my $port_index = $bayhub->i_index();
|
my $partial = shift;
|
||||||
|
|
||||||
|
my $port_index = $bayhub->i_index() || {};
|
||||||
|
|
||||||
my %i_duplex_admin;
|
my %i_duplex_admin;
|
||||||
foreach my $iid (keys %$port_index){
|
foreach my $iid (keys %$port_index){
|
||||||
my $index = $port_index->{$iid};
|
my $index = $port_index->{$iid};
|
||||||
next unless defined $index;
|
next unless defined $index;
|
||||||
|
next if (defined $partial and $index !~ /^$partial$/);
|
||||||
|
|
||||||
my $duplex = 'half';
|
my $duplex = 'half';
|
||||||
$i_duplex_admin{$index}=$duplex;
|
$i_duplex_admin{$index}=$duplex;
|
||||||
@@ -194,12 +204,15 @@ sub i_duplex_admin {
|
|||||||
|
|
||||||
sub i_speed {
|
sub i_speed {
|
||||||
my $bayhub = shift;
|
my $bayhub = shift;
|
||||||
my $port_index = $bayhub->i_index();
|
my $partial = shift;
|
||||||
|
|
||||||
|
my $port_index = $bayhub->i_index() || {};
|
||||||
|
|
||||||
my %i_speed;
|
my %i_speed;
|
||||||
foreach my $iid (keys %$port_index){
|
foreach my $iid (keys %$port_index){
|
||||||
my $index = $port_index->{$iid};
|
my $index = $port_index->{$iid};
|
||||||
next unless defined $index;
|
next unless defined $index;
|
||||||
|
next if (defined $partial and $index !~ /^$partial$/);
|
||||||
|
|
||||||
my $speed = '10 Mbps';
|
my $speed = '10 Mbps';
|
||||||
$i_speed{$index}=$speed;
|
$i_speed{$index}=$speed;
|
||||||
@@ -209,13 +222,16 @@ sub i_speed {
|
|||||||
|
|
||||||
sub i_up {
|
sub i_up {
|
||||||
my $bayhub = shift;
|
my $bayhub = shift;
|
||||||
my $port_index = $bayhub->i_index();
|
my $partial = shift;
|
||||||
my $link_stat = $bayhub->bayhub_up();
|
|
||||||
|
my $port_index = $bayhub->i_index() || {};
|
||||||
|
my $link_stat = $bayhub->bayhub_up() || {};
|
||||||
|
|
||||||
my %i_up;
|
my %i_up;
|
||||||
foreach my $iid (keys %$port_index){
|
foreach my $iid (keys %$port_index){
|
||||||
my $index = $port_index->{$iid};
|
my $index = $port_index->{$iid};
|
||||||
next unless defined $index;
|
next unless defined $index;
|
||||||
|
next if (defined $partial and $index !~ /^$partial$/);
|
||||||
my $link_stat = $link_stat->{$iid};
|
my $link_stat = $link_stat->{$iid};
|
||||||
next unless defined $link_stat;
|
next unless defined $link_stat;
|
||||||
|
|
||||||
@@ -229,13 +245,16 @@ sub i_up {
|
|||||||
|
|
||||||
sub i_up_admin {
|
sub i_up_admin {
|
||||||
my $bayhub = shift;
|
my $bayhub = shift;
|
||||||
my $i_index = $bayhub->i_index();
|
my $partial = shift;
|
||||||
my $link_stat = $bayhub->bayhub_up_admin();
|
|
||||||
|
my $i_index = $bayhub->i_index() || {};
|
||||||
|
my $link_stat = $bayhub->bayhub_up_admin() || {};
|
||||||
|
|
||||||
my %i_up_admin;
|
my %i_up_admin;
|
||||||
foreach my $iid (keys %$i_index){
|
foreach my $iid (keys %$i_index){
|
||||||
my $index = $i_index->{$iid};
|
my $index = $i_index->{$iid};
|
||||||
next unless defined $index;
|
next unless defined $index;
|
||||||
|
next if (defined $partial and $index !~ /^$partial$/);
|
||||||
my $link_stat = $link_stat->{$iid};
|
my $link_stat = $link_stat->{$iid};
|
||||||
next unless defined $link_stat;
|
next unless defined $link_stat;
|
||||||
|
|
||||||
@@ -265,9 +284,11 @@ sub set_i_up_admin {
|
|||||||
|
|
||||||
# Hubs do not support the standard Bridge MIB
|
# Hubs do not support the standard Bridge MIB
|
||||||
sub bp_index {
|
sub bp_index {
|
||||||
my $bayhub = shift;
|
my $bayhub = shift;
|
||||||
my $b_index = $bayhub->bayhub_nb_index();
|
my $partial = shift;
|
||||||
my $p_index = $bayhub->bayhub_np_index();
|
|
||||||
|
my $b_index = $bayhub->bayhub_nb_index() || {};
|
||||||
|
my $p_index = $bayhub->bayhub_np_index() || {};
|
||||||
my $model = $bayhub->model();
|
my $model = $bayhub->model();
|
||||||
|
|
||||||
my %bp_index;
|
my %bp_index;
|
||||||
@@ -290,6 +311,7 @@ sub bp_index {
|
|||||||
}
|
}
|
||||||
|
|
||||||
my $index = ($board*256)+$port;
|
my $index = ($board*256)+$port;
|
||||||
|
next if (defined $partial and $index !~ /^$partial$/);
|
||||||
|
|
||||||
$bp_index{$index} = $index;
|
$bp_index{$index} = $index;
|
||||||
}
|
}
|
||||||
@@ -298,8 +320,10 @@ sub bp_index {
|
|||||||
|
|
||||||
sub fw_port {
|
sub fw_port {
|
||||||
my $bayhub = shift;
|
my $bayhub = shift;
|
||||||
my $b_index = $bayhub->bayhub_nb_index();
|
my $partial = shift;
|
||||||
my $p_index = $bayhub->bayhub_np_index();
|
|
||||||
|
my $b_index = $bayhub->bayhub_nb_index($partial) || {};
|
||||||
|
my $p_index = $bayhub->bayhub_np_index($partial) || {};
|
||||||
my $model = $bayhub->model();
|
my $model = $bayhub->model();
|
||||||
|
|
||||||
my %fw_port;
|
my %fw_port;
|
||||||
@@ -368,7 +392,7 @@ Eric Miller
|
|||||||
=head1 DESCRIPTION
|
=head1 DESCRIPTION
|
||||||
|
|
||||||
Provides abstraction to the configuration information obtainable from a
|
Provides abstraction to the configuration information obtainable from a
|
||||||
Bayhub device through SNMP. Also provides device MAC to port mapping through the propietary MIB.
|
Bayhub device through SNMP. Also provides device MAC to port mapping through the proprietary MIB.
|
||||||
|
|
||||||
For speed or debugging purposes you can call the subclass directly, but not after determining
|
For speed or debugging purposes you can call the subclass directly, but not after determining
|
||||||
a more specific class using the method above.
|
a more specific class using the method above.
|
||||||
@@ -379,9 +403,7 @@ my $bayhub = new SNMP::Info::Layer1::Bayhub(...);
|
|||||||
|
|
||||||
=over
|
=over
|
||||||
|
|
||||||
=item SNMP::Info
|
=item SNMP::Info::Layer2
|
||||||
|
|
||||||
=item SNMP::Info::Bridge
|
|
||||||
|
|
||||||
=item SNMP::Info::NortelStack
|
=item SNMP::Info::NortelStack
|
||||||
|
|
||||||
@@ -397,15 +419,13 @@ my $bayhub = new SNMP::Info::Layer1::Bayhub(...);
|
|||||||
|
|
||||||
=item S5-COMMON-STATS-MIB
|
=item S5-COMMON-STATS-MIB
|
||||||
|
|
||||||
=item Inherited Classes' MIBs
|
=item Inherited Classes
|
||||||
|
|
||||||
See SNMP::Info for its own MIB requirements.
|
See L<SNMP::Info::Layer2/"Required MIBs"> and its inherited classes.
|
||||||
|
|
||||||
See SNMP::Info::Bridge for its own MIB requirements.
|
See L<SNMP::Info::NortelStack/"Required MIBs"> for its MIB requirements.
|
||||||
|
|
||||||
See SNMP::Info::NortelStack for its own MIB requirements.
|
See L<SNMP::Info::SONMP/"Required MIBs"> for its MIB requirements.
|
||||||
|
|
||||||
See SNMP::Info::SONMP for its own MIB requirements.
|
|
||||||
|
|
||||||
=back
|
=back
|
||||||
|
|
||||||
@@ -452,21 +472,17 @@ start at 0. Returns 0.
|
|||||||
|
|
||||||
=back
|
=back
|
||||||
|
|
||||||
=head2 Globals imported from SNMP::Info
|
=head2 Globals imported from SNMP::Info::Layer2
|
||||||
|
|
||||||
See documentation in SNMP::Info for details.
|
See L<SNMP::Info::Layer2/"GLOBALS"> for details.
|
||||||
|
|
||||||
=head2 Globals imported from SNMP::Info::Bridge
|
|
||||||
|
|
||||||
See documentation in SNMP::Info::Bridge for details.
|
|
||||||
|
|
||||||
=head2 Global Methods imported from SNMP::Info::NortelStack
|
=head2 Global Methods imported from SNMP::Info::NortelStack
|
||||||
|
|
||||||
See documentation in SNMP::Info::NortelStack for details.
|
See L<SNMP::Info::NortelStack/"GLOBALS"> for details.
|
||||||
|
|
||||||
=head2 Global Methods imported from SNMP::Info::SONMP
|
=head2 Global Methods imported from SNMP::Info::SONMP
|
||||||
|
|
||||||
See documentation in SNMP::Info::SONMP for details.
|
See L<SNMP::Info::SONMP/"GLOBALS"> for details.
|
||||||
|
|
||||||
=head1 TABLE ENTRIES
|
=head1 TABLE ENTRIES
|
||||||
|
|
||||||
@@ -535,20 +551,16 @@ to the Interface index.
|
|||||||
|
|
||||||
=back
|
=back
|
||||||
|
|
||||||
=head2 Table Methods imported from SNMP::Info
|
=head2 Table Methods imported from SNMP::Info::Layer2
|
||||||
|
|
||||||
See documentation in SNMP::Info for details.
|
See L<SNMP::Info::Layer2/"TABLE ENTRIES"> for details.
|
||||||
|
|
||||||
=head2 Table Methods imported from SNMP::Info::Bridge
|
|
||||||
|
|
||||||
See documentation in SNMP::Info::Bridge for details.
|
|
||||||
|
|
||||||
=head2 Table Methods imported from SNMP::Info::NortelStack
|
=head2 Table Methods imported from SNMP::Info::NortelStack
|
||||||
|
|
||||||
See documentation in SNMP::Info::NortelStack for details.
|
See L<SNMP::Info::NortelStack/"TABLE ENTRIES"> for details.
|
||||||
|
|
||||||
=head2 Table Methods imported from SNMP::Info::SONMP
|
=head2 Table Methods imported from SNMP::Info::SONMP
|
||||||
|
|
||||||
See documentation in SNMP::Info::SONMP for details.
|
See L<SNMP::Info::SONMP/"TABLE ENTRIES"> for details.
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|||||||
@@ -28,28 +28,25 @@
|
|||||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
package SNMP::Info::Layer1::S3000;
|
package SNMP::Info::Layer1::S3000;
|
||||||
$VERSION = '1.04';
|
$VERSION = '1.05';
|
||||||
use strict;
|
use strict;
|
||||||
|
|
||||||
use Exporter;
|
use Exporter;
|
||||||
use SNMP::Info::Layer1;
|
use SNMP::Info::Layer2;
|
||||||
use SNMP::Info::Bridge;
|
|
||||||
|
|
||||||
@SNMP::Info::Layer1::S3000::ISA = qw/SNMP::Info::Layer1 SNMP::Info::Bridge/;
|
@SNMP::Info::Layer1::S3000::ISA = qw/SNMP::Info::Layer2 Exporter/;
|
||||||
@SNMP::Info::Layer1::S3000::EXPORT_OK = qw//;
|
@SNMP::Info::Layer1::S3000::EXPORT_OK = qw//;
|
||||||
|
|
||||||
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
|
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
|
||||||
|
|
||||||
%MIBS = (
|
%MIBS = (
|
||||||
%SNMP::Info::Layer1::MIBS,
|
%SNMP::Info::Layer2::MIBS,
|
||||||
%SNMP::Info::Bridge::MIBS,
|
|
||||||
'SYNOPTICS-ETHERNET-MIB' => 's3EnetPortTable',
|
'SYNOPTICS-ETHERNET-MIB' => 's3EnetPortTable',
|
||||||
'SYNOPTICS-COMMON-MIB' => 's3AgentType',
|
'SYNOPTICS-COMMON-MIB' => 's3AgentType',
|
||||||
);
|
);
|
||||||
|
|
||||||
%GLOBALS = (
|
%GLOBALS = (
|
||||||
%SNMP::Info::Layer1::GLOBALS,
|
%SNMP::Info::Layer2::GLOBALS,
|
||||||
%SNMP::Info::Bridge::GLOBALS,
|
|
||||||
# From SYNOPTICS-COMMON-MIB
|
# From SYNOPTICS-COMMON-MIB
|
||||||
'os_bin' => 's3AgentFwVer',
|
'os_bin' => 's3AgentFwVer',
|
||||||
's3000_major_ver' => 's3AgentSwMajorVer',
|
's3000_major_ver' => 's3AgentSwMajorVer',
|
||||||
@@ -58,8 +55,7 @@ use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
|
|||||||
);
|
);
|
||||||
|
|
||||||
%FUNCS = (
|
%FUNCS = (
|
||||||
%SNMP::Info::Layer1::FUNCS,
|
%SNMP::Info::Layer2::FUNCS,
|
||||||
%SNMP::Info::Bridge::FUNCS,
|
|
||||||
# SYNOPTICS-ETHERNET-MIB::s3EnetPortTable
|
# SYNOPTICS-ETHERNET-MIB::s3EnetPortTable
|
||||||
's3000_pb_index' => 's3EnetPortBoardIndex',
|
's3000_pb_index' => 's3EnetPortBoardIndex',
|
||||||
's3000_pp_index' => 's3EnetPortIndex',
|
's3000_pp_index' => 's3EnetPortIndex',
|
||||||
@@ -75,8 +71,7 @@ use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
|
|||||||
);
|
);
|
||||||
|
|
||||||
%MUNGE = (
|
%MUNGE = (
|
||||||
%SNMP::Info::Layer1::MUNGE,
|
%SNMP::Info::Layer2::MUNGE,
|
||||||
%SNMP::Info::Bridge::MUNGE,
|
|
||||||
's3000_topo_mac' => \&SNMP::Info::munge_mac
|
's3000_topo_mac' => \&SNMP::Info::munge_mac
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -130,11 +125,14 @@ sub mac {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Hubs do not support ifMIB requirements for get MAC
|
# Hubs do not support ifMIB requirements for get MAC
|
||||||
# and port status
|
# and port status
|
||||||
|
|
||||||
sub i_index {
|
sub i_index {
|
||||||
my $s3000 = shift;
|
my $s3000 = shift;
|
||||||
my $b_index = $s3000->s3000_pb_index();
|
my $partial = shift;
|
||||||
my $p_index = $s3000->s3000_pp_index();
|
|
||||||
|
my $b_index = $s3000->s3000_pb_index($partial) || {};
|
||||||
|
my $p_index = $s3000->s3000_pp_index($partial) || {};
|
||||||
|
|
||||||
my %i_index;
|
my %i_index;
|
||||||
foreach my $iid (keys %$b_index){
|
foreach my $iid (keys %$b_index){
|
||||||
@@ -150,14 +148,20 @@ sub i_index {
|
|||||||
return \%i_index;
|
return \%i_index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Partials don't really help in this class, but implemented
|
||||||
|
# for consistency
|
||||||
|
|
||||||
sub interfaces {
|
sub interfaces {
|
||||||
my $s3000 = shift;
|
my $s3000 = shift;
|
||||||
my $i_index = $s3000->i_index();
|
my $partial = shift;
|
||||||
|
|
||||||
|
my $i_index = $s3000->i_index() || {};
|
||||||
|
|
||||||
my %if;
|
my %if;
|
||||||
foreach my $iid (keys %$i_index){
|
foreach my $iid (keys %$i_index){
|
||||||
my $index = $i_index->{$iid};
|
my $index = $i_index->{$iid};
|
||||||
next unless defined $index;
|
next unless defined $index;
|
||||||
|
next if (defined $partial and $index !~ /^$partial$/);
|
||||||
|
|
||||||
# Index numbers are deterministic slot * 256 + port - see i_index()
|
# Index numbers are deterministic slot * 256 + port - see i_index()
|
||||||
my $port = $index % 256;
|
my $port = $index % 256;
|
||||||
@@ -173,12 +177,15 @@ sub interfaces {
|
|||||||
|
|
||||||
sub i_duplex {
|
sub i_duplex {
|
||||||
my $s3000 = shift;
|
my $s3000 = shift;
|
||||||
my $port_index = $s3000->i_index();
|
my $partial = shift;
|
||||||
|
|
||||||
|
my $port_index = $s3000->i_index() || {};
|
||||||
|
|
||||||
my %i_duplex;
|
my %i_duplex;
|
||||||
foreach my $iid (keys %$port_index){
|
foreach my $iid (keys %$port_index){
|
||||||
my $index = $port_index->{$iid};
|
my $index = $port_index->{$iid};
|
||||||
next unless defined $index;
|
next unless defined $index;
|
||||||
|
next if (defined $partial and $index !~ /^$partial$/);
|
||||||
|
|
||||||
# Hubs only function half duplex
|
# Hubs only function half duplex
|
||||||
my $duplex = 'half';
|
my $duplex = 'half';
|
||||||
@@ -189,12 +196,15 @@ sub i_duplex {
|
|||||||
|
|
||||||
sub i_duplex_admin {
|
sub i_duplex_admin {
|
||||||
my $s3000 = shift;
|
my $s3000 = shift;
|
||||||
my $port_index = $s3000->i_index();
|
my $partial = shift;
|
||||||
|
|
||||||
|
my $port_index = $s3000->i_index() || {};
|
||||||
|
|
||||||
my %i_duplex_admin;
|
my %i_duplex_admin;
|
||||||
foreach my $iid (keys %$port_index){
|
foreach my $iid (keys %$port_index){
|
||||||
my $index = $port_index->{$iid};
|
my $index = $port_index->{$iid};
|
||||||
next unless defined $index;
|
next unless defined $index;
|
||||||
|
next if (defined $partial and $index !~ /^$partial$/);
|
||||||
|
|
||||||
# Hubs only function half duplex
|
# Hubs only function half duplex
|
||||||
my $duplex = 'half';
|
my $duplex = 'half';
|
||||||
@@ -205,12 +215,15 @@ sub i_duplex_admin {
|
|||||||
|
|
||||||
sub i_speed {
|
sub i_speed {
|
||||||
my $s3000 = shift;
|
my $s3000 = shift;
|
||||||
my $port_index = $s3000->i_index();
|
my $partial = shift;
|
||||||
|
|
||||||
|
my $port_index = $s3000->i_index() || {};
|
||||||
|
|
||||||
my %i_speed;
|
my %i_speed;
|
||||||
foreach my $iid (keys %$port_index){
|
foreach my $iid (keys %$port_index){
|
||||||
my $index = $port_index->{$iid};
|
my $index = $port_index->{$iid};
|
||||||
next unless defined $index;
|
next unless defined $index;
|
||||||
|
next if (defined $partial and $index !~ /^$partial$/);
|
||||||
|
|
||||||
# These hubs only support 10Mbs
|
# These hubs only support 10Mbs
|
||||||
my $speed = '10000000';
|
my $speed = '10000000';
|
||||||
@@ -221,13 +234,16 @@ sub i_speed {
|
|||||||
|
|
||||||
sub i_up {
|
sub i_up {
|
||||||
my $s3000 = shift;
|
my $s3000 = shift;
|
||||||
my $port_index = $s3000->i_index();
|
my $partial = shift;
|
||||||
my $link_stat = $s3000->s3000_up();
|
|
||||||
|
my $port_index = $s3000->i_index() || {};
|
||||||
|
my $link_stat = $s3000->s3000_up() || {};
|
||||||
|
|
||||||
my %i_up;
|
my %i_up;
|
||||||
foreach my $iid (keys %$port_index){
|
foreach my $iid (keys %$port_index){
|
||||||
my $index = $port_index->{$iid};
|
my $index = $port_index->{$iid};
|
||||||
next unless defined $index;
|
next unless defined $index;
|
||||||
|
next if (defined $partial and $index !~ /^$partial$/);
|
||||||
my $link_stat = $link_stat->{$iid};
|
my $link_stat = $link_stat->{$iid};
|
||||||
next unless defined $link_stat;
|
next unless defined $link_stat;
|
||||||
|
|
||||||
@@ -241,13 +257,16 @@ sub i_up {
|
|||||||
|
|
||||||
sub i_up_admin {
|
sub i_up_admin {
|
||||||
my $s3000 = shift;
|
my $s3000 = shift;
|
||||||
my $i_index = $s3000->i_index();
|
my $partial = shift;
|
||||||
my $link_stat = $s3000->s3000_up_admin();
|
|
||||||
|
my $i_index = $s3000->i_index() || {};
|
||||||
|
my $link_stat = $s3000->s3000_up_admin() || {};
|
||||||
|
|
||||||
my %i_up_admin;
|
my %i_up_admin;
|
||||||
foreach my $iid (keys %$i_index){
|
foreach my $iid (keys %$i_index){
|
||||||
my $index = $i_index->{$iid};
|
my $index = $i_index->{$iid};
|
||||||
next unless defined $index;
|
next unless defined $index;
|
||||||
|
next if (defined $partial and $index !~ /^$partial$/);
|
||||||
my $link_stat = $link_stat->{$iid};
|
my $link_stat = $link_stat->{$iid};
|
||||||
next unless defined $link_stat;
|
next unless defined $link_stat;
|
||||||
|
|
||||||
@@ -263,7 +282,7 @@ sub set_i_up_admin {
|
|||||||
my $s3000 = shift;
|
my $s3000 = shift;
|
||||||
my ($setting, $iid) = @_;
|
my ($setting, $iid) = @_;
|
||||||
|
|
||||||
my $i_index = $s3000->i_index();
|
my $i_index = $s3000->i_index() || {};
|
||||||
my %reverse_i_index = reverse %$i_index;
|
my %reverse_i_index = reverse %$i_index;
|
||||||
|
|
||||||
$setting = lc($setting);
|
$setting = lc($setting);
|
||||||
@@ -277,9 +296,11 @@ sub set_i_up_admin {
|
|||||||
|
|
||||||
# Hubs do not support the standard Bridge MIB
|
# Hubs do not support the standard Bridge MIB
|
||||||
sub bp_index {
|
sub bp_index {
|
||||||
my $s3000 = shift;
|
my $s3000 = shift;
|
||||||
my $b_index = $s3000->s3000_nb_index();
|
my $partial = shift;
|
||||||
my $p_index = $s3000->s3000_np_index();
|
|
||||||
|
my $b_index = $s3000->s3000_nb_index() || {};
|
||||||
|
my $p_index = $s3000->s3000_np_index() || {};
|
||||||
my $model = $s3000->model();
|
my $model = $s3000->model();
|
||||||
|
|
||||||
my %bp_index;
|
my %bp_index;
|
||||||
@@ -289,6 +310,7 @@ sub bp_index {
|
|||||||
my $port = $p_index->{$iid}||0;
|
my $port = $p_index->{$iid}||0;
|
||||||
|
|
||||||
my $index = ($board*256)+$port;
|
my $index = ($board*256)+$port;
|
||||||
|
next if (defined $partial and $index !~ /^$partial$/);
|
||||||
|
|
||||||
$bp_index{$index} = $index;
|
$bp_index{$index} = $index;
|
||||||
}
|
}
|
||||||
@@ -297,8 +319,10 @@ sub bp_index {
|
|||||||
|
|
||||||
sub fw_port {
|
sub fw_port {
|
||||||
my $s3000 = shift;
|
my $s3000 = shift;
|
||||||
my $b_index = $s3000->s3000_nb_index();
|
my $partial = shift;
|
||||||
my $p_index = $s3000->s3000_np_index();
|
|
||||||
|
my $b_index = $s3000->s3000_nb_index($partial) || {};
|
||||||
|
my $p_index = $s3000->s3000_np_index($partial) || {};
|
||||||
my $model = $s3000->model();
|
my $model = $s3000->model();
|
||||||
|
|
||||||
my %fw_port;
|
my %fw_port;
|
||||||
@@ -346,7 +370,7 @@ Eric Miller
|
|||||||
=head1 DESCRIPTION
|
=head1 DESCRIPTION
|
||||||
|
|
||||||
Provides abstraction to the configuration information obtainable from a
|
Provides abstraction to the configuration information obtainable from a
|
||||||
Bayhub device through SNMP. Also provides device MAC to port mapping through the propietary MIB.
|
Bayhub device through SNMP. Also provides device MAC to port mapping through the proprietary MIB.
|
||||||
|
|
||||||
For speed or debugging purposes you can call the subclass directly, but not after determining
|
For speed or debugging purposes you can call the subclass directly, but not after determining
|
||||||
a more specific class using the method above.
|
a more specific class using the method above.
|
||||||
@@ -357,9 +381,7 @@ my $s3000 = new SNMP::Info::Layer1::S3000(...);
|
|||||||
|
|
||||||
=over
|
=over
|
||||||
|
|
||||||
=item SNMP::Info::Layer1
|
=item SNMP::Info::Layer2
|
||||||
|
|
||||||
=item SNMP::Info::Bridge
|
|
||||||
|
|
||||||
=back
|
=back
|
||||||
|
|
||||||
@@ -373,9 +395,7 @@ my $s3000 = new SNMP::Info::Layer1::S3000(...);
|
|||||||
|
|
||||||
=item Inherited Classes' MIBs
|
=item Inherited Classes' MIBs
|
||||||
|
|
||||||
See SNMP::Info::Layer1 for its own MIB requirements.
|
See L<SNMP::Info::Layer2/"Required MIBs"> and its inherited classes.
|
||||||
|
|
||||||
See SNMP::Info::Bridge for its own MIB requirements.
|
|
||||||
|
|
||||||
=back
|
=back
|
||||||
|
|
||||||
@@ -426,13 +446,9 @@ Returns 00000011. Class emulates Layer 2 functionality through proprietary MIBs
|
|||||||
|
|
||||||
=back
|
=back
|
||||||
|
|
||||||
=head2 Globals imported from SNMP::Info::Layer1
|
=head2 Globals imported from SNMP::Info::Layer2
|
||||||
|
|
||||||
See documentation in SNMP::Info::Layer1 for details.
|
See L<SNMP::Info::Layer2/"GLOBALS"> for details.
|
||||||
|
|
||||||
=head2 Globals imported from SNMP::Info::Bridge
|
|
||||||
|
|
||||||
See documentation in SNMP::Info::Bridge for details.
|
|
||||||
|
|
||||||
=head1 TABLE ENTRIES
|
=head1 TABLE ENTRIES
|
||||||
|
|
||||||
@@ -513,12 +529,8 @@ Returns reference to hash. Key: Table entry, Value:Remote MAC address
|
|||||||
|
|
||||||
=back
|
=back
|
||||||
|
|
||||||
=head2 Table Methods imported from SNMP::Info::Layer1
|
=head2 Table Methods imported from SNMP::Info::Layer2
|
||||||
|
|
||||||
See documentation in SNMP::Info::Layer1 for details.
|
See L<SNMP::Info::Layer2/"TABLE ENTRIES"> for details.
|
||||||
|
|
||||||
=head2 Table Methods imported from SNMP::Info::Bridge
|
|
||||||
|
|
||||||
See documentation in SNMP::Info::Bridge for details.
|
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|||||||
Reference in New Issue
Block a user