Implement i_ssidlist(), i_ssidbcast(), and i_80211channel() methods.

Inherit from Layer2.  Use orig_ syntax. Remove redundant items.
Support partial table fetches on overridden table methods.
Pod updates.
This commit is contained in:
Eric Miller
2006-08-30 03:05:37 +00:00
parent 2ab9bb0053
commit eb8328c36d

View File

@@ -28,41 +28,39 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Layer2::Aruba; package SNMP::Info::Layer2::Aruba;
$VERSION = '1.04'; $VERSION = '1.05';
use strict; use strict;
use Exporter; use Exporter;
use SNMP::Info; use SNMP::Info::Layer2;
use SNMP::Info::Bridge;
@SNMP::Info::Layer2::Aruba::ISA = qw/SNMP::Info SNMP::Info::Bridge Exporter/; @SNMP::Info::Layer2::Aruba::ISA = qw/SNMP::Info::Layer2 Exporter/;
@SNMP::Info::Layer2::Aruba::EXPORT_OK = qw//; @SNMP::Info::Layer2::Aruba::EXPORT_OK = qw//;
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/; use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
%MIBS = ( %MIBS = (
%SNMP::Info::MIBS, %SNMP::Info::Layer2::MIBS,
%SNMP::Info::Bridge::MIBS,
'WLSX-SWITCH-MIB' => 'wlsxHostname', 'WLSX-SWITCH-MIB' => 'wlsxHostname',
'WLSR-AP-MIB' => 'wlsrHideSSID',
); );
%GLOBALS = ( %GLOBALS = (
%SNMP::Info::GLOBALS, %SNMP::Info::Layer2::GLOBALS,
%SNMP::Info::Bridge::GLOBALS,
); );
%FUNCS = ( %FUNCS = (
%SNMP::Info::FUNCS, %SNMP::Info::Layer2::FUNCS,
%SNMP::Info::Bridge::FUNCS,
'i_index2' => 'ifIndex',
'i_name2' => 'ifName',
# WLSX-SWITCH-MIB::wlsxSwitchAccessPointTable # WLSX-SWITCH-MIB::wlsxSwitchAccessPointTable
# Table index leafs do not return information # Table index leafs do not return information
# therefore unable to use apESSID. We extract # therefore unable to use apBSSID. We extract
# the information from the IID instead. # the information from the IID instead.
#'aruba_ap_essid' => 'apESSID', 'aruba_ap_name' => 'apLocation',
'aruba_ap_name' => 'apLocation', 'aruba_ap_ip' => 'apIpAddress',
'aruba_ap_ip' => 'apIpAddress', 'aruba_ap_essid' => 'apESSID',
'aruba_ap_ssidbcast' => 'wlsrHideSSID',
# WLSR-AP-MIB::wlsrConfigTable
'aruba_ap_channel' => 'apCurrentChannel',
# WLSX-SWITCH-MIB::wlsxSwitchStationMgmtTable # WLSX-SWITCH-MIB::wlsxSwitchStationMgmtTable
# Table index leafs do not return information # Table index leafs do not return information
# therefore unable to use staAccessPointBSSID # therefore unable to use staAccessPointBSSID
@@ -74,8 +72,7 @@ use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
); );
%MUNGE = ( %MUNGE = (
%SNMP::Info::MUNGE, %SNMP::Info::Layer2::MUNGE,
%SNMP::Info::Bridge::MUNGE,
); );
sub layers { sub layers {
@@ -116,8 +113,10 @@ sub model {
sub i_index { sub i_index {
my $aruba = shift; my $aruba = shift;
my $i_index = $aruba->i_index2(); my $partial = shift;
my $ap_index = $aruba->aruba_ap_name();
my $i_index = $aruba->orig_i_index($partial) || {};
my $ap_index = $aruba->aruba_ap_name($partial) || {};
my %if_index; my %if_index;
foreach my $iid (keys %$i_index){ foreach my $iid (keys %$i_index){
@@ -139,8 +138,10 @@ sub i_index {
sub interfaces { sub interfaces {
my $aruba = shift; my $aruba = shift;
my $i_index = $aruba->i_index(); my $partial = shift;
my $i_descr = $aruba->i_description();
my $i_index = $aruba->i_index($partial) || {};
my $i_descr = $aruba->i_description($partial) || {};
my %if; my %if;
foreach my $iid (keys %$i_index){ foreach my $iid (keys %$i_index){
@@ -167,9 +168,11 @@ sub interfaces {
sub i_name { sub i_name {
my $aruba = shift; my $aruba = shift;
my $i_index = $aruba->i_index(); my $partial = shift;
my $i_name2 = $aruba->i_name2();
my $ap_name = $aruba->aruba_ap_name(); my $i_index = $aruba->i_index($partial) || {};
my $i_name2 = $aruba->orig_i_name($partial) || {};
my $ap_name = $aruba->aruba_ap_name($partial) || {};
my %i_name; my %i_name;
foreach my $iid (keys %$i_index){ foreach my $iid (keys %$i_index){
@@ -193,12 +196,88 @@ sub i_name {
} }
return \%i_name; return \%i_name;
} }
sub i_ssidlist {
my $aruba = shift;
my $partial = shift;
my $i_index = $aruba->i_index($partial) || {};
my $ap_ssid = $aruba->aruba_ap_essid($partial) || {};
my %i_ssid;
foreach my $iid (keys %$i_index){
my $index = $i_index->{$iid};
next unless defined $index;
if ($index =~ /(?:[0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}/) {
my $ssid = $ap_ssid->{$iid};
next unless defined $ssid;
$i_ssid{$index} = $ssid;
}
else {
next;
}
}
return \%i_ssid;
}
sub i_80211channel {
my $aruba = shift;
my $partial = shift;
my $i_index = $aruba->i_index($partial) || {};
my $ap_ch = $aruba->aruba_ap_channel($partial) || {};
my %i_ch;
foreach my $iid (keys %$i_index){
my $index = $i_index->{$iid};
next unless defined $index;
if ($index =~ /(?:[0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}/) {
my $ch = $ap_ch->{$iid};
next unless defined $ch;
$i_ch{$index} = $ch;
}
else {
next;
}
}
return \%i_ch;
}
sub i_ssidbcast {
my $aruba = shift;
my $partial = shift;
my $i_index = $aruba->i_index($partial) || {};
my $ap_bc = $aruba->aruba_ap_ssidbcast($partial) || {};
my %i_bc;
foreach my $iid (keys %$i_index){
my $index = $i_index->{$iid};
next unless defined $index;
if ($index =~ /(?:[0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}/) {
my $bc = $ap_bc->{$iid};
next unless defined $bc;
$bc = ($bc ? 0 : 1);
$i_bc{$index} = $bc;
}
else {
next;
}
}
return \%i_bc;
}
# Wireless switches do not support the standard Bridge MIB # Wireless switches do not support the standard Bridge MIB
sub bp_index { sub bp_index {
my $aruba = shift; my $aruba = shift;
my $i_index = $aruba->i_index2(); my $partial = shift;
my $ap_index = $aruba->aruba_ap_name();
my $i_index = $aruba->orig_i_index($partial) || {};
my $ap_index = $aruba->aruba_ap_name($partial) || {};
my %bp_index; my %bp_index;
foreach my $iid (keys %$i_index){ foreach my $iid (keys %$i_index){
@@ -220,7 +299,9 @@ sub bp_index {
sub fw_port { sub fw_port {
my $aruba = shift; my $aruba = shift;
my $fw_idx = $aruba->fw_user(); my $partial = shift;
my $fw_idx = $aruba->fw_user($partial) || {};
my %fw_port; my %fw_port;
foreach my $iid (keys %$fw_idx){ foreach my $iid (keys %$fw_idx){
@@ -237,7 +318,9 @@ sub fw_port {
sub fw_mac { sub fw_mac {
my $aruba = shift; my $aruba = shift;
my $fw_idx = $aruba->fw_user(); my $partial = shift;
my $fw_idx = $aruba->fw_user($partial) || {};
my %fw_mac; my %fw_mac;
foreach my $iid (keys %$fw_idx){ foreach my $iid (keys %$fw_idx){
@@ -299,9 +382,7 @@ determining a more specific class using the method above.
=over =over
=item SNMP::Info =item SNMP::Info::Layer2
=item SNMP::Info::Bridge
=back =back
@@ -311,14 +392,14 @@ determining a more specific class using the method above.
=item WLSX-SWITCH-MIB =item WLSX-SWITCH-MIB
=item Inherited Classes' MIBs =item WLSR-AP-MIB
See SNMP::Info for its own MIB requirements.
See SNMP::Info::Bridge for its own MIB requirements.
=back =back
=head2 Inherited MIBs
See L<SNMP::Info::Layer2/"Required MIBs"> for its MIB requirements.
=head1 GLOBALS =head1 GLOBALS
These are methods that return scalar value from SNMP These are methods that return scalar value from SNMP
@@ -355,6 +436,10 @@ proprietary MIBs.
=back =back
=head2 Globals imported from SNMP::Info::Layer2
See L<SNMP::Info::Layer2/"GLOBALS"> for details.
=head1 TABLE ENTRIES =head1 TABLE ENTRIES
These are methods that return tables of information in the form of a reference These are methods that return tables of information in the form of a reference
@@ -393,6 +478,25 @@ both the keys and values.
(B<staPhyAddress>) as extracted from the IID. (B<staPhyAddress>) as extracted from the IID.
=item $aruba->i_ssidlist()
Returns reference to hash. SSID's recognized by the radio interface.
(B<apESSID>)
=item $aruba->i_ssidbcast()
Returns reference to hash. Indicates whether the SSID is broadcast, true or false.
(B<wlsrHideSSID>)
=item $aruba->i_80211channel()
Returns reference to hash. Current operating frequency channel of the radio
interface.
(B<apCurrentChannel>)
=back =back
=head2 Aruba Switch AP Table (B<wlsxSwitchAccessPointTable>) =head2 Aruba Switch AP Table (B<wlsxSwitchAccessPointTable>)
@@ -407,6 +511,14 @@ both the keys and values.
(B<apIpAddress>) (B<apIpAddress>)
=item $aruba->aruba_ap_essid()
(B<apESSID>)
=item $aruba->aruba_ap_ssidbcast()
(B<wlsrHideSSID>)
=back =back
=head2 Aruba Switch Station Management Table (B<wlsxSwitchStationMgmtTable>) =head2 Aruba Switch Station Management Table (B<wlsxSwitchStationMgmtTable>)
@@ -417,4 +529,20 @@ both the keys and values.
(B<staUserName>) (B<staUserName>)
=back
=head2 Aruba Wireless AP Configuration Table (B<wlsrConfigTable>)
=over
=item $aruba->aruba_ap_channel()
(B<apCurrentChannel>)
=back
=head2 Table Methods imported from SNMP::Info::Layer2
See L<SNMP::Info::Layer2/"TABLE ENTRIES"> for details.
=cut =cut