From 948921930b23b4f96e46f202977222256b1ceb66 Mon Sep 17 00:00:00 2001 From: Bill Fenner <> Date: Fri, 17 Nov 2006 00:25:14 +0000 Subject: [PATCH] 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 --- Info/Layer3/AlteonAD.pm | 40 ++++++------------------------- Info/Layer3/BayRS.pm | 41 ++++++++------------------------ Info/Layer3/Contivity.pm | 51 +++++++++++++++------------------------- Info/Layer3/Foundry.pm | 27 +-------------------- 4 files changed, 37 insertions(+), 122 deletions(-) diff --git a/Info/Layer3/AlteonAD.pm b/Info/Layer3/AlteonAD.pm index a813f730..46f62524 100644 --- a/Info/Layer3/AlteonAD.pm +++ b/Info/Layer3/AlteonAD.pm @@ -35,15 +35,17 @@ use strict; use Exporter; use SNMP::Info; +use SNMP::Info::Layer3; use SNMP::Info::Bridge; 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//; %MIBS = ( %SNMP::Info::MIBS, + %SNMP::Info::Layer3::MIBS, %SNMP::Info::Bridge::MIBS, 'ALTEON-TIGON-SWITCH-MIB' => 'agSoftwareVersion', 'ALTEON-TS-PHYSICAL-MIB' => 'agPortTableMaxEnt', @@ -52,6 +54,7 @@ use vars qw/$VERSION $DEBUG %GLOBALS %FUNCS $INIT %MIBS %MUNGE /; %GLOBALS = ( %SNMP::Info::GLOBALS, + %SNMP::Info::Layer3::GLOBALS, %SNMP::Info::Bridge::GLOBALS, 'sw_ver' => 'agSoftwareVersion', 'tftp_action' => 'agTftpAction', @@ -62,13 +65,8 @@ use vars qw/$VERSION $DEBUG %GLOBALS %FUNCS $INIT %MIBS %MUNGE /; %FUNCS = ( %SNMP::Info::FUNCS, + %SNMP::Info::Layer3::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 'ag_p_cfg_idx' => 'agPortCurCfgIndx', 'ag_p_cfg_pref' => 'agPortCurCfgPrefLink', @@ -86,8 +84,8 @@ use vars qw/$VERSION $DEBUG %GLOBALS %FUNCS $INIT %MIBS %MUNGE /; %MUNGE = ( %SNMP::Info::MUNGE, + %SNMP::Info::Layer3::MUNGE, %SNMP::Info::Bridge::MUNGE, - 'at_paddr' => \&SNMP::Info::munge_mac, ); sub model { @@ -236,7 +234,7 @@ sub i_name { # Bridge MIB does not map Bridge Port to ifIndex correctly sub bp_index { my $alteon = shift; - my $b_index = $alteon->bp_index_2(); + my $b_index = $alteon->orig_bp_index(); my %bp_index; foreach my $iid (keys %$b_index){ @@ -409,30 +407,6 @@ Returns a mapping between ifIndex and the Bridge Table. =back -=head2 RFC1213 Arp Cache Table (B) - -=over - -=item $alteon->at_index() - -Returns reference to hash. Maps ARP table entries to Interface IIDs - -(B) - -=item $alteon->at_paddr() - -Returns reference to hash. Maps ARP table entries to MAC addresses. - -(B) - -=item $alteon->at_netaddr() - -Returns reference to hash. Maps ARP table entries to IPs - -(B) - -=back - =head2 Table Methods imported from SNMP::Info See documentation in SNMP::Info for details. diff --git a/Info/Layer3/BayRS.pm b/Info/Layer3/BayRS.pm index ec270bf7..9540ece0 100644 --- a/Info/Layer3/BayRS.pm +++ b/Info/Layer3/BayRS.pm @@ -35,15 +35,17 @@ use strict; use Exporter; use SNMP::Info; +use SNMP::Info::Layer3; use SNMP::Info::Bridge; 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//; %MIBS = ( %SNMP::Info::MIBS, + %SNMP::Info::Layer3::MIBS, %SNMP::Info::Bridge::MIBS, 'Wellfleet-HARDWARE-MIB' => 'wfHwBpIdOpt', 'Wellfleet-OSPF-MIB' => 'wfOspfRouterId', @@ -53,6 +55,7 @@ use vars qw/$VERSION $DEBUG %GLOBALS %FUNCS $INIT %MIBS %MUNGE %MODEL_MAP/; %GLOBALS = ( %SNMP::Info::GLOBALS, + %SNMP::Info::Layer3::GLOBALS, %SNMP::Info::Bridge::GLOBALS, 'bp_id' => 'wfHwBpIdOpt', 'bp_serial' => 'wfHwBpSerialNumber', @@ -61,12 +64,8 @@ use vars qw/$VERSION $DEBUG %GLOBALS %FUNCS $INIT %MIBS %MUNGE %MODEL_MAP/; %FUNCS = ( %SNMP::Info::FUNCS, + %SNMP::Info::Layer3::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 'wf_csmacd_cct' => 'wfCSMACDCct', 'wf_csmacd_slot' => 'wfCSMACDSlot', @@ -97,8 +96,8 @@ use vars qw/$VERSION $DEBUG %GLOBALS %FUNCS $INIT %MIBS %MUNGE %MODEL_MAP/; %MUNGE = ( %SNMP::Info::MUNGE, + %SNMP::Info::Layer3::MUNGE, %SNMP::Info::Bridge::MUNGE, - 'at_paddr' => \&SNMP::Info::munge_mac, ); %MODEL_MAP = ( @@ -494,34 +493,14 @@ Returns reference to hash. Maps port VLAN ID to IIDs. =back -=head2 RFC1213 Arp Cache Table (B) - -=over - -=item $bayrs->at_index() - -Returns reference to hash. Maps ARP table entries to Interface IIDs - -(B) - -=item $bayrs->at_paddr() - -Returns reference to hash. Maps ARP table entries to MAC addresses. - -(B) - -=item $bayrs->at_netaddr() - -Returns reference to hash. Maps ARP table entries to IPs - -(B) - -=back - =head2 Table Methods imported from SNMP::Info 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 See documentation in SNMP::Info::Bridge for details. diff --git a/Info/Layer3/Contivity.pm b/Info/Layer3/Contivity.pm index b3b75e65..3aad84f3 100644 --- a/Info/Layer3/Contivity.pm +++ b/Info/Layer3/Contivity.pm @@ -35,37 +35,36 @@ use strict; use Exporter; use SNMP::Info; +use SNMP::Info::Layer3; use SNMP::Info::Entity; 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//; %MIBS = ( %SNMP::Info::MIBS, + %SNMP::Info::Layer3::MIBS, %SNMP::Info::Entity::MIBS, ); %GLOBALS = ( %SNMP::Info::GLOBALS, + %SNMP::Info::Layer3::GLOBALS, %SNMP::Info::Entity::GLOBALS, ); %FUNCS = ( %SNMP::Info::FUNCS, + %SNMP::Info::Layer3::FUNCS, %SNMP::Info::Entity::FUNCS, - 'i_name2' => 'ifName', - # From RFC1213-MIB - 'at_index' => 'ipNetToMediaIfIndex', - 'at_paddr' => 'ipNetToMediaPhysAddress', - 'at_netaddr' => 'ipNetToMediaNetAddress', ); %MUNGE = ( %SNMP::Info::MUNGE, + %SNMP::Info::Layer3::MUNGE, %SNMP::Info::Entity::MUNGE, - 'at_paddr' => \&SNMP::Info::munge_mac, ); sub layers { @@ -142,7 +141,7 @@ sub interfaces { sub i_name { my $contivity = shift; - my $i_name2 = $contivity->i_name2(); + my $i_name2 = $contivity->orig_i_name(); my %i_name; foreach my $iid (keys %$i_name2){ @@ -200,6 +199,8 @@ a more specific class using the method above. =item SNMP::Info +=item SNMP::Info::Layer3 + =item SNMP::Info::Entity =back @@ -212,6 +213,8 @@ a more specific class using the method above. 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. =back @@ -267,6 +270,10 @@ layers. 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 See documentation in SNMP::Info::Entity for details. @@ -287,34 +294,14 @@ tunnel interfaces. =back -=head2 RFC1213 Arp Cache Table (B) - -=over - -=item $contivity->at_index() - -Returns reference to hash. Maps ARP table entries to Interface IIDs - -(B) - -=item $contivity->at_paddr() - -Returns reference to hash. Maps ARP table entries to MAC addresses. - -(B) - -=item $contivity->at_netaddr() - -Returns reference to hash. Maps ARP table entries to IPs - -(B) - -=back - =head2 Table Methods imported from SNMP::Info 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 See documentation in SNMP::Info::Entity for details. diff --git a/Info/Layer3/Foundry.pm b/Info/Layer3/Foundry.pm index 0e822b63..527d532e 100644 --- a/Info/Layer3/Foundry.pm +++ b/Info/Layer3/Foundry.pm @@ -61,7 +61,7 @@ $VERSION = '1.04'; %SNMP::Info::FDP::GLOBALS, 'mac' => 'ifPhysAddress.1', 'chassis' => 'entPhysicalDescr.1', - 'serial' => 'snChasSerNum', + 'serial1' => 'snChasSerNum', 'temp' => 'snChasActualTemperature', 'ps1_type' => 'snChasPwrSupplyDescription.1', 'ps1_status' => 'snChasPwrSupplyOperStatus.1', @@ -89,7 +89,6 @@ $VERSION = '1.04'; # Inherit all the built in munging %SNMP::Info::Layer3::MUNGE, %SNMP::Info::FDP::MUNGE, - 'at_paddr' => \&SNMP::Info::munge_mac, ); @@ -422,30 +421,6 @@ does a little munging. =back -=head2 RFC1213 Arp Cache Table (B) - -=over - -=item $foundry->at_index() - -Returns reference to hash. Maps ARP table entries to Interface IIDs - -(B) - -=item $foundry->at_paddr() - -Returns reference to hash. Maps ARP table entries to MAC addresses. - -(B) - -=item $foundry->at_netaddr() - -Returns reference to hash. Maps ARP table entries to IPs - -(B) - -=back - =head2 Foundry Switch Port Information Table (B) =over