Use orig_ attrib, remove redundant items.

Support partial table fetches on overridden table methods.
Pod updates.
This commit is contained in:
Eric Miller
2006-08-28 19:56:31 +00:00
parent 832679ac4f
commit ee829539c2
2 changed files with 34 additions and 31 deletions

View File

@@ -30,7 +30,7 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Layer1::Allied; package SNMP::Info::Layer1::Allied;
$VERSION = '1.04'; $VERSION = '1.05';
# $Id$ # $Id$
use strict; use strict;
@@ -49,7 +49,6 @@ use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
); );
%FUNCS = (%SNMP::Info::Layer1::FUNCS, %FUNCS = (%SNMP::Info::Layer1::FUNCS,
'i_name2' => 'ifName',
'ati_p_name' => 'portName', 'ati_p_name' => 'portName',
'ati_up' => 'linkTestLED', 'ati_up' => 'linkTestLED',
); );
@@ -92,10 +91,10 @@ sub model {
sub i_name{ sub i_name{
my $allied = shift; my $allied = shift;
my $partial = shift;
my $i_name = $allied->i_name2(); my $i_name = $allied->orig_i_name($partial) || {};
my $ati_p_name = $allied->ati_p_name($partial) || {};
my $ati_p_name = $allied->ati_p_name();
foreach my $port (keys %$ati_p_name){ foreach my $port (keys %$ati_p_name){
my $name = $ati_p_name->{$port}; my $name = $ati_p_name->{$port};
@@ -107,9 +106,10 @@ sub i_name{
sub i_up { sub i_up {
my $allied = shift; my $allied = shift;
my $partial = shift;
my $i_up = SNMP::Info::Layer1::i_up($allied); my $i_up = SNMP::Info::Layer1::i_up($allied, $partial);
my $ati_up = $allied->ati_up(); my $ati_up = $allied->ati_up($partial) || {};
foreach my $port (keys %$ati_up){ foreach my $port (keys %$ati_up){
my $up = $ati_up->{$port}; my $up = $ati_up->{$port};
@@ -143,7 +143,7 @@ Max Baker
) )
or die "Can't connect to DestHost.\n"; or die "Can't connect to DestHost.\n";
my $class = $l1->class(); my $class = $allied->class();
print "SNMP::Info determined this device to fall under subclass : $class\n"; print "SNMP::Info determined this device to fall under subclass : $class\n";
=head1 DESCRIPTION =head1 DESCRIPTION
@@ -170,7 +170,7 @@ Download for your device from http://www.allied-telesyn.com/allied/support/
=item Inherited Classes =item Inherited Classes
MIBs listed in SNMP::Info::Layer1 and its inherited classes. See L<SNMP::Info::Layer1/"Required MIBs"> and its inherited classes.
=back =back
@@ -208,7 +208,7 @@ Trys to cull out AT-nnnnX out of the description field.
=head2 Global Methods imported from SNMP::Info::Layer1 =head2 Global Methods imported from SNMP::Info::Layer1
See documentation in SNMP::Info::Layer1 for details. See L<SNMP::Info::Layer1/"GLOBALS"> for details.
=head1 TABLE ENTRIES =head1 TABLE ENTRIES
@@ -243,6 +243,6 @@ the values of ati_up() to 'up' and 'down'.
=head2 Table Methods imported from SNMP::Info::Layer1 =head2 Table Methods imported from SNMP::Info::Layer1
See documentation in SNMP::Info::Layer1 for details. See L<SNMP::Info::Layer1/"TABLE ENTRIES"> for details.
=cut =cut

View File

@@ -30,7 +30,7 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Layer1::Asante; package SNMP::Info::Layer1::Asante;
$VERSION = '1.04'; $VERSION = '1.05';
# $Id$ # $Id$
use strict; use strict;
@@ -48,10 +48,6 @@ use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
); );
%FUNCS = (%SNMP::Info::Layer1::FUNCS, %FUNCS = (%SNMP::Info::Layer1::FUNCS,
'i_speed2' => 'ifSpeed',
'i_mac2' => 'ifPhysAddress',
'i_descr2' => 'ifDescr',
'i_name2' => 'ifName',
'asante_port' => 'ePortIndex', 'asante_port' => 'ePortIndex',
'asante_group' => 'ePortGrpIndex', 'asante_group' => 'ePortGrpIndex',
'i_type' => 'ePortStateType', 'i_type' => 'ePortStateType',
@@ -63,15 +59,15 @@ use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
'ASANTE-HUB1012-MIB' => 'asante' 'ASANTE-HUB1012-MIB' => 'asante'
); );
%MUNGE = (%SNMP::Info::Layer1::MUNGE, %MUNGE = (
'i_mac2' => \&SNMP::Info::munge_mac, %SNMP::Info::Layer1::MUNGE,
'i_speed2' => \&SNMP::Info::munge_speed,
); );
sub interfaces { sub interfaces {
my $asante = shift; my $asante = shift;
my $partial = shift;
my $rptr_port = $asante->rptr_port(); my $rptr_port = $asante->rptr_port($partial) || {};
my %interfaces; my %interfaces;
@@ -110,8 +106,9 @@ sub model {
sub i_up { sub i_up {
my $asante = shift; my $asante = shift;
my $partial = shift;
my $asante_up = $asante->asante_up(); my $asante_up = $asante->asante_up($partial) || {};
my $i_up = {}; my $i_up = {};
foreach my $port (keys %$asante_up){ foreach my $port (keys %$asante_up){
@@ -125,8 +122,9 @@ sub i_up {
sub i_speed { sub i_speed {
my $asante = shift; my $asante = shift;
my $partial = shift;
my $i_speed = $asante->i_speed2(); my $i_speed = $asante->orig_i_speed($partial) || {};
my %i_speed; my %i_speed;
@@ -137,8 +135,9 @@ sub i_speed {
sub i_mac { sub i_mac {
my $asante = shift; my $asante = shift;
my $partial = shift;
my $i_mac = $asante->i_mac2(); my $i_mac = $asante->orig_i_mac($partial) || {};
my %i_mac; my %i_mac;
@@ -153,8 +152,9 @@ sub i_description {
sub i_name { sub i_name {
my $asante = shift; my $asante = shift;
my $partial = shift;
my $i_name = $asante->i_descr2(); my $i_name = $asante->orig_i_descr($partial) || {};
my %i_name; my %i_name;
@@ -186,7 +186,7 @@ Max Baker
) )
or die "Can't connect to DestHost.\n"; or die "Can't connect to DestHost.\n";
my $class = $asante->class(); my $class = $asante->class();
print "SNMP::Info determined this device to fall under subclass : $class\n"; print "SNMP::Info determined this device to fall under subclass : $class\n";
=head1 DESCRIPTION =head1 DESCRIPTION
@@ -210,7 +210,9 @@ Asante device through SNMP.
Download from http://www.mibdepot.com Download from http://www.mibdepot.com
=item MIBs listed in SNMP::Info::Layer1 =item Inherited Classes
See L<SNMP::Info::Layer1/"Required MIBs"> and its inherited classes.
=back =back
@@ -234,13 +236,14 @@ Returns 'asante' :)
=item $asante->model() =item $asante->model()
Trys to cull out AT-nnnnX out of the description field. Cross references $asante->id() to the ASANTE-HUB1012-MIB and returns
the results.
=back =back
=head2 Globals inherited from SNMP::Info::Layer1 =head2 Global Methods imported from SNMP::Info::Layer1
See documentation in SNMP::Info::Layer1 for details. See L<SNMP::Info::Layer1/"GLOBALS"> for details.
=head1 TABLE ENTRIES =head1 TABLE ENTRIES
@@ -255,7 +258,7 @@ Returns reference to map of IIDs to human-set port name.
=item $asante->i_up() =item $asante->i_up()
Returns reference to map of IIDs to link status. Changes Returns reference to map of IIDs to link status. Changes
the values of ati_up() to 'up' and 'down'. the values of asante_up() to 'up' and 'down'.
=back =back
@@ -275,6 +278,6 @@ the values of ati_up() to 'up' and 'down'.
=head2 Table Methods imported from SNMP::Info::Layer1 =head2 Table Methods imported from SNMP::Info::Layer1
See documentation in SNMP::Info::Layer1 for details. See L<SNMP::Info::Layer1/"TABLE ENTRIES"> for details.
=cut =cut