- Removed ENTITY-MIB methods to SNMP::Info::Entity

- Removed %MY* crap
This commit is contained in:
Max Baker
2003-04-17 21:23:53 +00:00
parent 1f1ba32c1b
commit f2754b80bb

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::HP; package SNMP::Info::Layer2::HP;
$VERSION = 0.3; $VERSION = 0.4;
# $Id$ # $Id$
use strict; use strict;
@@ -36,68 +36,44 @@ use strict;
use Exporter; use Exporter;
use SNMP::Info::Layer2; use SNMP::Info::Layer2;
use SNMP::Info::MAU; use SNMP::Info::MAU;
use SNMP::Info::Entity;
use vars qw/$VERSION $DEBUG %GLOBALS %MIBS %FUNCS %PORTSTAT %MODEL_MAP use vars qw/$VERSION $DEBUG %GLOBALS %MIBS %FUNCS %PORTSTAT %MODEL_MAP %MUNGE $INIT/ ;
%MYGLOBALS %MYMIBS %MYFUNCS %MYMUNGE %MUNGE $INIT/ ;
@SNMP::Info::Layer2::HP::ISA = qw/SNMP::Info::Layer2 SNMP::Info::MAU Exporter/; @SNMP::Info::Layer2::HP::ISA = qw/SNMP::Info::Layer2 SNMP::Info::MAU SNMP::Info::Entity Exporter/;
@SNMP::Info::Layer2::HP::EXPORT_OK = qw//; @SNMP::Info::Layer2::HP::EXPORT_OK = qw//;
$DEBUG=0; # See SNMP::Info for the details of these data structures and interworkings.
$SNMP::debugging=$DEBUG;
# See SNMP::Info for the details of these data structures and
# the interworkings.
$INIT = 0; $INIT = 0;
%MYMIBS = ( 'ENTITY-MIB' => 'entPhysicalSerialNum', %MIBS = ( %SNMP::Info::Layer2::MIBS,
%SNMP::Info::MAU::MIBS,
%SNMP::Info::Entity::MIBS,
'RFC1271-MIB' => 'logDescription', 'RFC1271-MIB' => 'logDescription',
'HP-ICF-OID' => 'hpSwitch4000', 'HP-ICF-OID' => 'hpSwitch4000',
); );
%MIBS = ( %SNMP::Info::Layer2::MIBS,
%SNMP::Info::MAU::MIBS,
%MYMIBS );
%MYGLOBALS = ('serial1' => 'entPhysicalSerialNum.1',
# 'model' => 'entPhysicalModelName.1',
);
%GLOBALS = ( %GLOBALS = (
%SNMP::Info::Layer2::GLOBALS, %SNMP::Info::Layer2::GLOBALS,
%SNMP::Info::MAU::GLOBALS, %SNMP::Info::MAU::GLOBALS,
%MYGLOBALS %SNMP::Info::Entity::GLOBALS,
'serial1' => 'entPhysicalSerialNum.1',
); );
%MYFUNCS = (
'i_type2' => 'ifType',
'e_class' => 'entPhysicalClass',
'e_descr' => 'entPhysicalDescr',
'e_fwver' => 'entPhysicalFirmwareRev',
'e_hwver' => 'entPhysicalHardwareRev',
'e_map' => 'entAliasMappingIdentifier',
'e_model' => 'entPhysicalModelName',
'e_name' => 'entPhysicalName',
'e_parent' => 'entPhysicalContainedIn',
'e_serial' => 'entPhysicalSerialNum',
'e_swver' => 'entPhysicalSoftwareRev',
'e_type' => 'entPhysicalVendorType',
# RFC1271
'l_descr' => 'logDescription'
);
%FUNCS = ( %FUNCS = (
%SNMP::Info::Layer2::FUNCS, %SNMP::Info::Layer2::FUNCS,
%SNMP::Info::MAU::FUNCS, %SNMP::Info::MAU::FUNCS,
%MYFUNCS %SNMP::Info::Entity::FUNCS,
); 'i_type2' => 'ifType',
# RFC1271
%MYMUNGE = ( 'l_descr' => 'logDescription'
); );
%MUNGE = ( %MUNGE = (
# Inherit all the built in munging # Inherit all the built in munging
%SNMP::Info::Layer2::MUNGE, %SNMP::Info::Layer2::MUNGE,
%SNMP::Info::MAU::MUNGE, %SNMP::Info::MAU::MUNGE,
%MYMUNGE %SNMP::Info::Entity::MUNGE
); );
%MODEL_MAP = ( %MODEL_MAP = (
@@ -147,7 +123,6 @@ sub interfaces {
foreach my $iid (keys %$interfaces){ foreach my $iid (keys %$interfaces){
my $descr = $i_descr->{$iid}; my $descr = $i_descr->{$iid};
next unless defined $descr; next unless defined $descr;
#$if{$iid} = $iid;
$if{$iid} = $descr if (defined $descr and length $descr); $if{$iid} = $descr if (defined $descr and length $descr);
} }
@@ -155,26 +130,6 @@ sub interfaces {
} }
# e_port maps EntityTable entries to IfTable
sub e_port {
my $hp = shift;
my $e_map = $hp->e_map();
my %e_port;
foreach my $e_id (keys %$e_map) {
my $id = $e_id;
$id =~ s/\.0$//;
my $iid = $e_map->{$e_id};
$iid =~ s/.*\.//;
$e_port{$id} = $iid;
}
return \%e_port;
}
sub i_type { sub i_type {
my $hp = shift; my $hp = shift;
my $e_descr = $hp->e_descr(); my $e_descr = $hp->e_descr();
@@ -358,6 +313,8 @@ MIBs required:
=item HP-ICF-OID =item HP-ICF-OID
=item ENTITY-MIB
=back =back
HP MIBs can be found at http://www.hp.com/rnd/software HP MIBs can be found at http://www.hp.com/rnd/software
@@ -391,6 +348,11 @@ Arguments passed to new() are passed on to SNMP::Session::new()
=back =back
=head1 ChangeLog
Version 0.4 - Removed ENTITY-MIB e_*() methods to separate sub-class
=head1 HP Global Configuration Values =head1 HP Global Configuration Values
=over =over
@@ -429,64 +391,7 @@ hp
=back =back
=head1 HP Table Values =head1 Overriden Methods from SNMP::Info::Layer2
=head2 Entity Table
=over
=item $hp->e_class()
(C<entPhysicalClass>)
=item $hp->e_descr()
(C<entPhysicalClass>)
=item $hp->e_fwver()
(C<entPhysicalFirmwareRev>)
=item $hp->e_hwver()
(C<entPhysicalHardwareRev>)
=item $hp->e_map()
(C<entAliasMappingIdentifier>)
=item $hp->e_model()
(C<entPhysicalModelName>)
=item $hp->e_name()
(C<entPhysicalName>)
=item $hp->e_parent()
(C<entPhysicalContainedIn>)
=item $hp->e_port()
Maps EntityTable entries to the Interface Table (IfTable) using
$hp->e_map()
=item $hp->e_serial()
(C<entPhysicalSerialNum>)
=item $hp->e_swver()
(C<entPhysicalSoftwareRev>)
=item $hp->e_type()
(C<entPhysicalVendorType>)
=back
=head2 Overriden Methods from SNMP::Info::Layer2
=over =over