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