Remove custom ipNetToMediaTable implementations, and inherit them

from Layer3.pm
Use orig_foo() instead of custom versions
Rename 'serial' to 'serial1' so Layer3.pm's serial() sub will use it
This commit is contained in:
Bill Fenner
2006-11-17 00:25:14 +00:00
parent dc494ff038
commit 948921930b
4 changed files with 37 additions and 122 deletions

View File

@@ -35,15 +35,17 @@ use strict;
use Exporter; use Exporter;
use SNMP::Info; use SNMP::Info;
use SNMP::Info::Layer3;
use SNMP::Info::Bridge; use SNMP::Info::Bridge;
use vars qw/$VERSION $DEBUG %GLOBALS %FUNCS $INIT %MIBS %MUNGE /; use vars qw/$VERSION $DEBUG %GLOBALS %FUNCS $INIT %MIBS %MUNGE /;
@SNMP::Info::Layer3::AlteonAD::ISA = qw/SNMP::Info SNMP::Info::Bridge Exporter/; @SNMP::Info::Layer3::AlteonAD::ISA = qw/SNMP::Info SNMP::Info::Layer3 SNMP::Info::Bridge Exporter/;
@SNMP::Info::Layer3::AlteonAD::EXPORT_OK = qw//; @SNMP::Info::Layer3::AlteonAD::EXPORT_OK = qw//;
%MIBS = ( %MIBS = (
%SNMP::Info::MIBS, %SNMP::Info::MIBS,
%SNMP::Info::Layer3::MIBS,
%SNMP::Info::Bridge::MIBS, %SNMP::Info::Bridge::MIBS,
'ALTEON-TIGON-SWITCH-MIB' => 'agSoftwareVersion', 'ALTEON-TIGON-SWITCH-MIB' => 'agSoftwareVersion',
'ALTEON-TS-PHYSICAL-MIB' => 'agPortTableMaxEnt', 'ALTEON-TS-PHYSICAL-MIB' => 'agPortTableMaxEnt',
@@ -52,6 +54,7 @@ use vars qw/$VERSION $DEBUG %GLOBALS %FUNCS $INIT %MIBS %MUNGE /;
%GLOBALS = ( %GLOBALS = (
%SNMP::Info::GLOBALS, %SNMP::Info::GLOBALS,
%SNMP::Info::Layer3::GLOBALS,
%SNMP::Info::Bridge::GLOBALS, %SNMP::Info::Bridge::GLOBALS,
'sw_ver' => 'agSoftwareVersion', 'sw_ver' => 'agSoftwareVersion',
'tftp_action' => 'agTftpAction', 'tftp_action' => 'agTftpAction',
@@ -62,13 +65,8 @@ use vars qw/$VERSION $DEBUG %GLOBALS %FUNCS $INIT %MIBS %MUNGE /;
%FUNCS = ( %FUNCS = (
%SNMP::Info::FUNCS, %SNMP::Info::FUNCS,
%SNMP::Info::Layer3::FUNCS,
%SNMP::Info::Bridge::FUNCS, %SNMP::Info::Bridge::FUNCS,
'bp_index_2' => 'dot1dBasePortIfIndex',
'i_name2' => 'ifName',
# From RFC1213-MIB
'at_index' => 'ipNetToMediaIfIndex',
'at_paddr' => 'ipNetToMediaPhysAddress',
'at_netaddr' => 'ipNetToMediaNetAddress',
# From agPortCurCfgTable # From agPortCurCfgTable
'ag_p_cfg_idx' => 'agPortCurCfgIndx', 'ag_p_cfg_idx' => 'agPortCurCfgIndx',
'ag_p_cfg_pref' => 'agPortCurCfgPrefLink', 'ag_p_cfg_pref' => 'agPortCurCfgPrefLink',
@@ -86,8 +84,8 @@ use vars qw/$VERSION $DEBUG %GLOBALS %FUNCS $INIT %MIBS %MUNGE /;
%MUNGE = ( %MUNGE = (
%SNMP::Info::MUNGE, %SNMP::Info::MUNGE,
%SNMP::Info::Layer3::MUNGE,
%SNMP::Info::Bridge::MUNGE, %SNMP::Info::Bridge::MUNGE,
'at_paddr' => \&SNMP::Info::munge_mac,
); );
sub model { sub model {
@@ -236,7 +234,7 @@ sub i_name {
# Bridge MIB does not map Bridge Port to ifIndex correctly # Bridge MIB does not map Bridge Port to ifIndex correctly
sub bp_index { sub bp_index {
my $alteon = shift; my $alteon = shift;
my $b_index = $alteon->bp_index_2(); my $b_index = $alteon->orig_bp_index();
my %bp_index; my %bp_index;
foreach my $iid (keys %$b_index){ foreach my $iid (keys %$b_index){
@@ -409,30 +407,6 @@ Returns a mapping between ifIndex and the Bridge Table.
=back =back
=head2 RFC1213 Arp Cache Table (B<ipNetToMediaTable>)
=over
=item $alteon->at_index()
Returns reference to hash. Maps ARP table entries to Interface IIDs
(B<ipNetToMediaIfIndex>)
=item $alteon->at_paddr()
Returns reference to hash. Maps ARP table entries to MAC addresses.
(B<ipNetToMediaPhysAddress>)
=item $alteon->at_netaddr()
Returns reference to hash. Maps ARP table entries to IPs
(B<ipNetToMediaNetAddress>)
=back
=head2 Table Methods imported from SNMP::Info =head2 Table Methods imported from SNMP::Info
See documentation in SNMP::Info for details. See documentation in SNMP::Info for details.

View File

@@ -35,15 +35,17 @@ use strict;
use Exporter; use Exporter;
use SNMP::Info; use SNMP::Info;
use SNMP::Info::Layer3;
use SNMP::Info::Bridge; use SNMP::Info::Bridge;
use vars qw/$VERSION $DEBUG %GLOBALS %FUNCS $INIT %MIBS %MUNGE %MODEL_MAP/; use vars qw/$VERSION $DEBUG %GLOBALS %FUNCS $INIT %MIBS %MUNGE %MODEL_MAP/;
@SNMP::Info::Layer3::BayRS::ISA = qw/SNMP::Info SNMP::Info::Bridge Exporter/; @SNMP::Info::Layer3::BayRS::ISA = qw/SNMP::Info SNMP::Info::Layer3 SNMP::Info::Bridge Exporter/;
@SNMP::Info::Layer3::BayRS::EXPORT_OK = qw//; @SNMP::Info::Layer3::BayRS::EXPORT_OK = qw//;
%MIBS = ( %MIBS = (
%SNMP::Info::MIBS, %SNMP::Info::MIBS,
%SNMP::Info::Layer3::MIBS,
%SNMP::Info::Bridge::MIBS, %SNMP::Info::Bridge::MIBS,
'Wellfleet-HARDWARE-MIB' => 'wfHwBpIdOpt', 'Wellfleet-HARDWARE-MIB' => 'wfHwBpIdOpt',
'Wellfleet-OSPF-MIB' => 'wfOspfRouterId', 'Wellfleet-OSPF-MIB' => 'wfOspfRouterId',
@@ -53,6 +55,7 @@ use vars qw/$VERSION $DEBUG %GLOBALS %FUNCS $INIT %MIBS %MUNGE %MODEL_MAP/;
%GLOBALS = ( %GLOBALS = (
%SNMP::Info::GLOBALS, %SNMP::Info::GLOBALS,
%SNMP::Info::Layer3::GLOBALS,
%SNMP::Info::Bridge::GLOBALS, %SNMP::Info::Bridge::GLOBALS,
'bp_id' => 'wfHwBpIdOpt', 'bp_id' => 'wfHwBpIdOpt',
'bp_serial' => 'wfHwBpSerialNumber', 'bp_serial' => 'wfHwBpSerialNumber',
@@ -61,12 +64,8 @@ use vars qw/$VERSION $DEBUG %GLOBALS %FUNCS $INIT %MIBS %MUNGE %MODEL_MAP/;
%FUNCS = ( %FUNCS = (
%SNMP::Info::FUNCS, %SNMP::Info::FUNCS,
%SNMP::Info::Layer3::FUNCS,
%SNMP::Info::Bridge::FUNCS, %SNMP::Info::Bridge::FUNCS,
'i_name2' => 'ifName',
# From RFC1213-MIB
'at_index' => 'ipNetToMediaIfIndex',
'at_paddr' => 'ipNetToMediaPhysAddress',
'at_netaddr' => 'ipNetToMediaNetAddress',
# From Wellfleet-CSMACD-MIB::wfCSMACDTable # From Wellfleet-CSMACD-MIB::wfCSMACDTable
'wf_csmacd_cct' => 'wfCSMACDCct', 'wf_csmacd_cct' => 'wfCSMACDCct',
'wf_csmacd_slot' => 'wfCSMACDSlot', 'wf_csmacd_slot' => 'wfCSMACDSlot',
@@ -97,8 +96,8 @@ use vars qw/$VERSION $DEBUG %GLOBALS %FUNCS $INIT %MIBS %MUNGE %MODEL_MAP/;
%MUNGE = ( %MUNGE = (
%SNMP::Info::MUNGE, %SNMP::Info::MUNGE,
%SNMP::Info::Layer3::MUNGE,
%SNMP::Info::Bridge::MUNGE, %SNMP::Info::Bridge::MUNGE,
'at_paddr' => \&SNMP::Info::munge_mac,
); );
%MODEL_MAP = ( %MODEL_MAP = (
@@ -494,34 +493,14 @@ Returns reference to hash. Maps port VLAN ID to IIDs.
=back =back
=head2 RFC1213 Arp Cache Table (B<ipNetToMediaTable>)
=over
=item $bayrs->at_index()
Returns reference to hash. Maps ARP table entries to Interface IIDs
(B<ipNetToMediaIfIndex>)
=item $bayrs->at_paddr()
Returns reference to hash. Maps ARP table entries to MAC addresses.
(B<ipNetToMediaPhysAddress>)
=item $bayrs->at_netaddr()
Returns reference to hash. Maps ARP table entries to IPs
(B<ipNetToMediaNetAddress>)
=back
=head2 Table Methods imported from SNMP::Info =head2 Table Methods imported from SNMP::Info
See documentation in SNMP::Info for details. See documentation in SNMP::Info for details.
=head2 Table Methods imported from SNMP::Info::Layer3
See documentation in SNMP::Info::Layer3 for details.
=head2 Table Methods imported from SNMP::Info::Bridge =head2 Table Methods imported from SNMP::Info::Bridge
See documentation in SNMP::Info::Bridge for details. See documentation in SNMP::Info::Bridge for details.

View File

@@ -35,37 +35,36 @@ use strict;
use Exporter; use Exporter;
use SNMP::Info; use SNMP::Info;
use SNMP::Info::Layer3;
use SNMP::Info::Entity; use SNMP::Info::Entity;
use vars qw/$VERSION $DEBUG %GLOBALS %FUNCS $INIT %MIBS %MUNGE/; use vars qw/$VERSION $DEBUG %GLOBALS %FUNCS $INIT %MIBS %MUNGE/;
@SNMP::Info::Layer3::Contivity::ISA = qw/SNMP::Info SNMP::Info::Entity Exporter/; @SNMP::Info::Layer3::Contivity::ISA = qw/SNMP::Info SNMP::Info::Layer3 SNMP::Info::Entity Exporter/;
@SNMP::Info::Layer3::Contivity::EXPORT_OK = qw//; @SNMP::Info::Layer3::Contivity::EXPORT_OK = qw//;
%MIBS = ( %MIBS = (
%SNMP::Info::MIBS, %SNMP::Info::MIBS,
%SNMP::Info::Layer3::MIBS,
%SNMP::Info::Entity::MIBS, %SNMP::Info::Entity::MIBS,
); );
%GLOBALS = ( %GLOBALS = (
%SNMP::Info::GLOBALS, %SNMP::Info::GLOBALS,
%SNMP::Info::Layer3::GLOBALS,
%SNMP::Info::Entity::GLOBALS, %SNMP::Info::Entity::GLOBALS,
); );
%FUNCS = ( %FUNCS = (
%SNMP::Info::FUNCS, %SNMP::Info::FUNCS,
%SNMP::Info::Layer3::FUNCS,
%SNMP::Info::Entity::FUNCS, %SNMP::Info::Entity::FUNCS,
'i_name2' => 'ifName',
# From RFC1213-MIB
'at_index' => 'ipNetToMediaIfIndex',
'at_paddr' => 'ipNetToMediaPhysAddress',
'at_netaddr' => 'ipNetToMediaNetAddress',
); );
%MUNGE = ( %MUNGE = (
%SNMP::Info::MUNGE, %SNMP::Info::MUNGE,
%SNMP::Info::Layer3::MUNGE,
%SNMP::Info::Entity::MUNGE, %SNMP::Info::Entity::MUNGE,
'at_paddr' => \&SNMP::Info::munge_mac,
); );
sub layers { sub layers {
@@ -142,7 +141,7 @@ sub interfaces {
sub i_name { sub i_name {
my $contivity = shift; my $contivity = shift;
my $i_name2 = $contivity->i_name2(); my $i_name2 = $contivity->orig_i_name();
my %i_name; my %i_name;
foreach my $iid (keys %$i_name2){ foreach my $iid (keys %$i_name2){
@@ -200,6 +199,8 @@ a more specific class using the method above.
=item SNMP::Info =item SNMP::Info
=item SNMP::Info::Layer3
=item SNMP::Info::Entity =item SNMP::Info::Entity
=back =back
@@ -212,6 +213,8 @@ a more specific class using the method above.
See SNMP::Info for its own MIB requirements. See SNMP::Info for its own MIB requirements.
See SNMP::Info::Layer3 for its own MIB requirements.
See SNMP::Info::Entity for its own MIB requirements. See SNMP::Info::Entity for its own MIB requirements.
=back =back
@@ -267,6 +270,10 @@ layers.
See documentation in SNMP::Info for details. See documentation in SNMP::Info for details.
=head2 Globals imported from SNMP::Info::Layer3
See documentation in SNMP::Info::Layer3 for details.
=head2 Globals imported from SNMP::Info::Entity =head2 Globals imported from SNMP::Info::Entity
See documentation in SNMP::Info::Entity for details. See documentation in SNMP::Info::Entity for details.
@@ -287,34 +294,14 @@ tunnel interfaces.
=back =back
=head2 RFC1213 Arp Cache Table (B<ipNetToMediaTable>)
=over
=item $contivity->at_index()
Returns reference to hash. Maps ARP table entries to Interface IIDs
(B<ipNetToMediaIfIndex>)
=item $contivity->at_paddr()
Returns reference to hash. Maps ARP table entries to MAC addresses.
(B<ipNetToMediaPhysAddress>)
=item $contivity->at_netaddr()
Returns reference to hash. Maps ARP table entries to IPs
(B<ipNetToMediaNetAddress>)
=back
=head2 Table Methods imported from SNMP::Info =head2 Table Methods imported from SNMP::Info
See documentation in SNMP::Info for details. See documentation in SNMP::Info for details.
=head2 Table Methods imported from SNMP::Info::Layer3
See documentation in SNMP::Info::Layer3 for details.
=head2 Table Methods imported from SNMP::Info::Entity =head2 Table Methods imported from SNMP::Info::Entity
See documentation in SNMP::Info::Entity for details. See documentation in SNMP::Info::Entity for details.

View File

@@ -61,7 +61,7 @@ $VERSION = '1.04';
%SNMP::Info::FDP::GLOBALS, %SNMP::Info::FDP::GLOBALS,
'mac' => 'ifPhysAddress.1', 'mac' => 'ifPhysAddress.1',
'chassis' => 'entPhysicalDescr.1', 'chassis' => 'entPhysicalDescr.1',
'serial' => 'snChasSerNum', 'serial1' => 'snChasSerNum',
'temp' => 'snChasActualTemperature', 'temp' => 'snChasActualTemperature',
'ps1_type' => 'snChasPwrSupplyDescription.1', 'ps1_type' => 'snChasPwrSupplyDescription.1',
'ps1_status' => 'snChasPwrSupplyOperStatus.1', 'ps1_status' => 'snChasPwrSupplyOperStatus.1',
@@ -89,7 +89,6 @@ $VERSION = '1.04';
# Inherit all the built in munging # Inherit all the built in munging
%SNMP::Info::Layer3::MUNGE, %SNMP::Info::Layer3::MUNGE,
%SNMP::Info::FDP::MUNGE, %SNMP::Info::FDP::MUNGE,
'at_paddr' => \&SNMP::Info::munge_mac,
); );
@@ -422,30 +421,6 @@ does a little munging.
=back =back
=head2 RFC1213 Arp Cache Table (B<ipNetToMediaTable>)
=over
=item $foundry->at_index()
Returns reference to hash. Maps ARP table entries to Interface IIDs
(B<ipNetToMediaIfIndex>)
=item $foundry->at_paddr()
Returns reference to hash. Maps ARP table entries to MAC addresses.
(B<ipNetToMediaPhysAddress>)
=item $foundry->at_netaddr()
Returns reference to hash. Maps ARP table entries to IPs
(B<ipNetToMediaNetAddress>)
=back
=head2 Foundry Switch Port Information Table (B<snSwPortIfTable>) =head2 Foundry Switch Port Information Table (B<snSwPortIfTable>)
=over =over