Support partial table fetches on overridden table methods.

Prep 1.05
This commit is contained in:
Eric Miller
2007-06-13 02:48:44 +00:00
parent 069695f570
commit 2070f9b9e0
7 changed files with 77 additions and 65 deletions

View File

@@ -56,8 +56,6 @@ use vars qw/$VERSION %GLOBALS %MIBS %FUNCS %PORTSTAT %MUNGE/;
%FUNCS = (
%SNMP::Info::FUNCS,
'i_up2' => 'ifOperStatus',
'i_up_admin2' => 'ifAdminStatus',
'rptr_ports' => 'rptrGroupPortCapacity',
'rptr_port' => 'rptrPortIndex',
'rptr_slot' => 'rptrPortGroupIndex',
@@ -118,8 +116,10 @@ sub vendor {
# By Default we'll use the description field
sub interfaces {
my $l1 = shift;
my $interfaces = $l1->i_index();
my $rptr_port = $l1->rptr_port();
my $partial = shift;
my $interfaces = $l1->i_index($partial) || {};
my $rptr_port = $l1->rptr_port($partial) || {};
foreach my $port (keys %$rptr_port){
$interfaces->{$port} = $port;
@@ -129,9 +129,10 @@ sub interfaces {
sub i_up_admin {
my $l1 = shift;
my $partial = shift;
my $i_up_admin = $l1->i_up_admin2();
my $rptr_up_admin = $l1->rptr_up_admin();
my $i_up_admin = $l1->SUPER::i_up_admin($partial) || {};
my $rptr_up_admin = $l1->rptr_up_admin($partial) || {};
foreach my $key (keys %$rptr_up_admin){
my $up = $rptr_up_admin->{$key};
@@ -144,8 +145,10 @@ sub i_up_admin {
sub i_up {
my $l1 = shift;
my $i_up = $l1->i_up2();
my $rptr_up = $l1->rptr_up();
my $partial = shift;
my $i_up = $l1->SUPER::i_up($partial) || {};
my $rptr_up = $l1->rptr_up($partial) || {};
foreach my $key (keys %$rptr_up){
my $up = $rptr_up->{$key};
@@ -153,8 +156,8 @@ sub i_up {
}
return $i_up;
}
1;
__END__

View File

@@ -30,7 +30,7 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Layer2;
$VERSION = '1.04';
$VERSION = '1.05';
# $Id$
use strict;
@@ -126,8 +126,9 @@ sub serial {
sub i_ignore {
my $l2 = shift;
my $partial = shift;
my $i_type = $l2->i_type();
my $i_type = $l2->i_type($partial) || {};
my %i_ignore = ();
@@ -142,8 +143,10 @@ sub i_ignore {
sub interfaces {
my $l2 = shift;
my $interfaces = $l2->i_index();
my $i_descr = $l2->i_description();
my $partial = shift;
my $interfaces = $l2->i_index($partial) || {};
my $i_descr = $l2->i_description($partial) || {};
# Replace the Index with the ifDescr field.
foreach my $iid (keys %$i_descr){
@@ -159,7 +162,7 @@ __END__
=head1 NAME
SNMP::Info::Layer2 - Perl5 Interface to network devices serving Layer2 only.
SNMP::Info::Layer2 - SNMP Interface to network devices serving Layer2 only.
=head1 AUTHOR
@@ -194,14 +197,15 @@ Max Baker
=head1 DESCRIPTION
This class is usually used as a superclass for more specific device classes listed under
SNMP::Info::Layer2::* Please read all docs under SNMP::Info first.
This class is usually used as a superclass for more specific device classes
listed under SNMP::Info::Layer2::* Please read all docs under SNMP::Info
first.
Provides abstraction to the configuration information obtainable from a
Layer2 device through SNMP. Information is stored in a number of MIBs.
For speed or debugging purposes you can call the subclass directly, but not after determining
a more specific class using the method above.
For speed or debugging purposes you can call the subclass directly, but not
after determining a more specific class using the method above.
my $l2 = new SNMP::Info::Layer2(...);

View File

@@ -30,7 +30,7 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Layer2::Aironet;
$VERSION = '1.04';
$VERSION = '1.05';
# $Id$
use strict;
@@ -96,7 +96,9 @@ sub vendor {
sub interfaces {
my $aironet = shift;
my $i_description = $aironet->i_description();
my $partial = shift;
my $i_description = $aironet->i_description($partial);
return $i_description;
}
@@ -115,7 +117,9 @@ sub description {
# Fetch duplex from EtherLike
sub i_duplex {
my $aironet = shift;
my $el_duplex = $aironet->el_duplex();
my $partial = shift;
my $el_duplex = $aironet->el_duplex($partial);
my %i_duplex;
foreach my $d (keys %$el_duplex){

View File

@@ -29,7 +29,7 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Layer3::Contivity;
$VERSION = '1.04';
$VERSION = '1.05';
use strict;
@@ -126,7 +126,9 @@ sub serial {
sub interfaces {
my $contivity = shift;
my $description = $contivity->i_description();
my $partial = shift;
my $description = $contivity->i_description($partial) || {};
my %interfaces = ();
foreach my $iid (keys %$description){
@@ -141,7 +143,9 @@ sub interfaces {
sub i_name {
my $contivity = shift;
my $i_name2 = $contivity->orig_i_name();
my $partial = shift;
my $i_name2 = $contivity->orig_i_name($partial) || {};
my %i_name;
foreach my $iid (keys %$i_name2){
@@ -161,8 +165,8 @@ __END__
=head1 NAME
SNMP::Info::Layer3::Contivity - Perl5 Interface to Nortel Networks' Contivity
Extranet Switches (CES).
SNMP::Info::Layer3::Contivity - SNMP Interface to Nortel VPN Routers (Contivity
Extranet Switches).
=head1 AUTHOR
@@ -186,10 +190,10 @@ Eric Miller
=head1 DESCRIPTION
Abstraction subclass for Nortel Networks' Contivity Extranet Switch (CES).
Abstraction subclass for Nortel VPN Routers (Contivity Extranet Switch).
For speed or debugging purposes you can call the subclass directly, but not after determining
a more specific class using the method above.
For speed or debugging purposes you can call the subclass directly, but not
after determining a more specific class using the method above.
my $contivity = new SNMP::Info::Layer3::Contivity(...);

View File

@@ -146,9 +146,10 @@ sub serial {
# Descriptions are all the same, so use name instead
sub interfaces {
my $dell = shift;
my $partial = shift;
my $interfaces = $dell->i_index();
my $names = $dell->orig_i_name();
my $interfaces = $dell->i_index($partial) || {};
my $names = $dell->orig_i_name($partial) || {};
my %interfaces = ();
foreach my $iid (keys %$interfaces){
@@ -163,10 +164,11 @@ sub interfaces {
sub i_duplex_admin {
my $dell = shift;
my $partial = shift;
my $interfaces = $dell->interfaces();
my $dell_duplex = $dell->dell_duplex_admin();
my $dell_auto = $dell->dell_auto();
my $interfaces = $dell->interfaces($partial) || {};
my $dell_duplex = $dell->dell_duplex_admin($partial) || {};
my $dell_auto = $dell->dell_auto($partial) || {};
my %i_duplex_admin;
foreach my $if (keys %$interfaces){
@@ -182,15 +184,6 @@ sub i_duplex_admin {
return \%i_duplex_admin;
}
sub i_vlan {
my $dell = shift;
my $qb_i_vlan = $dell->qb_i_vlan_t();
if (defined $qb_i_vlan and scalar(keys %$qb_i_vlan)){
return $qb_i_vlan;
}
}
# dot1qTpFdbAddress doesn't return values but is used as the index for the table
# so extract mac from index of dot1qTpFdbPort
sub fw_mac {
@@ -217,7 +210,7 @@ __END__
=head1 NAME
SNMP::Info::Layer3::Dell - Perl5 Interface to Dell Power Connect Network Devices
SNMP::Info::Layer3::Dell - SNMP Interface to Dell Power Connect Network Devices
=head1 AUTHOR
@@ -245,8 +238,8 @@ Eric Miller
Provides abstraction to the configuration information obtainable from an
Dell Power Connect 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.
For speed or debugging purposes you can call the subclass directly, but not
after determining a more specific class using the method above.
my $dell = new SNMP::Info::Layer3::Dell(...);

View File

@@ -1,10 +1,7 @@
# SNMP::Info::Layer3::N1600 - SNMP Interface to Nortel N16XX devices
# Eric Miller
#
# Copyright (c) 2004,2005 Max Baker changes from version 0.8 and beyond.
#
# Copyright (c) 2002,2003 Regents of the University of California
# All rights reserved.
# Copyright (c) 2005 Eric Miller
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@@ -14,9 +11,6 @@
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# * Neither the name of the University of California, Santa Cruz nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
@@ -40,7 +34,7 @@ use SNMP::Info::SONMP;
use vars qw/$VERSION $DEBUG %GLOBALS %FUNCS $INIT %MIBS %MUNGE/;
$VERSION = '1.04';
$VERSION = '1.05';
@SNMP::Info::Layer3::N1600::ISA = qw/SNMP::Info::Layer3 SNMP::Info::SONMP Exporter/;
@SNMP::Info::Layer3::N1600::EXPORT_OK = qw//;
@@ -115,7 +109,9 @@ sub os_ver {
sub interfaces {
my $n1600 = shift;
my $i_index = $n1600->i_index();
my $partial = shift;
my $i_index = $n1600->i_index($partial) || {};
my %if;
foreach my $iid (keys %$i_index){
@@ -130,7 +126,9 @@ sub interfaces {
sub i_duplex {
my $n1600 = shift;
my $nway_status = $n1600->n1600_nway_status();
my $partial = shift;
my $nway_status = $n1600->n1600_nway_status($partial) || {};
my %i_duplex;
foreach my $iid (keys %$nway_status){
@@ -145,7 +143,9 @@ sub i_duplex {
sub i_duplex_admin {
my $n1600 = shift;
my $nway_state = $n1600->n1600_nway_state();
my $partial = shift;
my $nway_state = $n1600->n1600_nway_state($partial) || {};
my %i_duplex;
foreach my $iid (keys %$nway_state){
@@ -169,7 +169,7 @@ __END__
=head1 NAME
SNMP::Info::Layer3::N1600 - Perl5 Interface to Nortel 16XX Network Devices
SNMP::Info::Layer3::N1600 - SNMP Interface to Nortel 16XX Network Devices
=head1 AUTHOR
@@ -197,8 +197,8 @@ Eric Miller
Provides abstraction to the configuration information obtainable from a Nortel
N16XX 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.
For speed or debugging purposes you can call the subclass directly, but not
after determining a more specific class using the method above.
my $n1600 = new SNMP::Info::Layer3::N1600(...);

View File

@@ -24,12 +24,15 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Layer3::Sun;
$VERSION = '1.05';
# $Id$
use strict;
use Exporter;
use SNMP::Info::Layer3;
use vars qw/$VERSION $DEBUG %GLOBALS %MIBS %FUNCS %MUNGE $INIT/ ;
$VERSION = '1.05';
@SNMP::Info::Layer3::Sun::ISA = qw/SNMP::Info::Layer3 Exporter/;
@SNMP::Info::Layer3::Sun::EXPORT_OK = qw//;
@@ -81,8 +84,9 @@ sub serial {
sub i_ignore {
my $l3 = shift;
my $partial = shift;
my $interfaces = $l3->interfaces();
my $interfaces = $l3->interfaces($partial) || {};
my %i_ignore;
foreach my $if (keys %$interfaces) {
@@ -99,7 +103,7 @@ __END__
=head1 NAME
SNMP::Info::Layer3::Sun - Perl5 Interface to L3 Sun Solaris
SNMP::Info::Layer3::Sun - SNMP Interface to L3 Sun Solaris
=head1 AUTHOR