perltidy
This commit is contained in:
@@ -5,21 +5,21 @@
|
||||
#
|
||||
# Copyright (c) 2003 Regents of the University of California
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# * 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
|
||||
# * 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
|
||||
#
|
||||
# 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 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
@@ -41,8 +41,9 @@ use SNMP::Info::CiscoStats;
|
||||
use SNMP::Info::CDP;
|
||||
use SNMP::Info::IEEE802dot11;
|
||||
|
||||
@SNMP::Info::Layer2::Aironet::ISA = qw/SNMP::Info::Layer2 SNMP::Info::Entity SNMP::Info::EtherLike
|
||||
SNMP::Info::CiscoStats SNMP::Info::CDP Exporter/;
|
||||
@SNMP::Info::Layer2::Aironet::ISA
|
||||
= qw/SNMP::Info::Layer2 SNMP::Info::Entity SNMP::Info::EtherLike
|
||||
SNMP::Info::CiscoStats SNMP::Info::CDP Exporter/;
|
||||
@SNMP::Info::Layer2::Aironet::EXPORT_OK = qw//;
|
||||
|
||||
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/;
|
||||
@@ -50,68 +51,69 @@ use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/;
|
||||
$VERSION = '1.09';
|
||||
|
||||
%GLOBALS = (
|
||||
%SNMP::Info::IEEE802dot11::GLOBALS,
|
||||
%SNMP::Info::Layer2::GLOBALS,
|
||||
%SNMP::Info::Entity::GLOBALS,
|
||||
%SNMP::Info::EtherLike::GLOBALS,
|
||||
%SNMP::Info::CiscoStats::GLOBALS,
|
||||
%SNMP::Info::CDP::GLOBALS,
|
||||
'serial' => 'entPhysicalSerialNum.1',
|
||||
'descr' => 'sysDescr'
|
||||
);
|
||||
%SNMP::Info::IEEE802dot11::GLOBALS,
|
||||
%SNMP::Info::Layer2::GLOBALS,
|
||||
%SNMP::Info::Entity::GLOBALS,
|
||||
%SNMP::Info::EtherLike::GLOBALS,
|
||||
%SNMP::Info::CiscoStats::GLOBALS,
|
||||
%SNMP::Info::CDP::GLOBALS,
|
||||
'serial' => 'entPhysicalSerialNum.1',
|
||||
'descr' => 'sysDescr'
|
||||
);
|
||||
|
||||
%FUNCS = (
|
||||
%SNMP::Info::IEEE802dot11::FUNCS,
|
||||
%SNMP::Info::Layer2::FUNCS,
|
||||
%SNMP::Info::Entity::FUNCS,
|
||||
%SNMP::Info::EtherLike::FUNCS,
|
||||
%SNMP::Info::CiscoStats::FUNCS,
|
||||
%SNMP::Info::CDP::FUNCS,
|
||||
'i_ssidlist' => 'cd11IfAuxSsid',
|
||||
'i_ssidbcast' => 'cd11IfAuxSsidBroadcastSsid',
|
||||
'i_80211channel' => 'cd11IfPhyDsssCurrentChannel',
|
||||
'c_dot11subif' => 'cDot11ClientSubIfIndex',
|
||||
'cd11_txrate' => 'cDot11ClientCurrentTxRateSet',
|
||||
'cd11_uptime' => 'cDot11ClientUpTime',
|
||||
'cd11_sigstrength' => 'cDot11ClientSignalStrength',
|
||||
'cd11_sigqual' => 'cDot11ClientSigQuality',
|
||||
'cd11_rxpkt' => 'cDot11ClientPacketsReceived',
|
||||
'cd11_txpkt' => 'cDot11ClientPacketsSent',
|
||||
'cd11_rxbyte' => 'cDot11ClientBytesReceived',
|
||||
'cd11_txbyte' => 'cDot11ClientBytesSent',
|
||||
'mbss_mac_addr' => 'cdot11MbssidIfMacAddress',
|
||||
);
|
||||
%FUNCS = (
|
||||
%SNMP::Info::IEEE802dot11::FUNCS,
|
||||
%SNMP::Info::Layer2::FUNCS,
|
||||
%SNMP::Info::Entity::FUNCS,
|
||||
%SNMP::Info::EtherLike::FUNCS,
|
||||
%SNMP::Info::CiscoStats::FUNCS,
|
||||
%SNMP::Info::CDP::FUNCS,
|
||||
'i_ssidlist' => 'cd11IfAuxSsid',
|
||||
'i_ssidbcast' => 'cd11IfAuxSsidBroadcastSsid',
|
||||
'i_80211channel' => 'cd11IfPhyDsssCurrentChannel',
|
||||
'c_dot11subif' => 'cDot11ClientSubIfIndex',
|
||||
'cd11_txrate' => 'cDot11ClientCurrentTxRateSet',
|
||||
'cd11_uptime' => 'cDot11ClientUpTime',
|
||||
'cd11_sigstrength' => 'cDot11ClientSignalStrength',
|
||||
'cd11_sigqual' => 'cDot11ClientSigQuality',
|
||||
'cd11_rxpkt' => 'cDot11ClientPacketsReceived',
|
||||
'cd11_txpkt' => 'cDot11ClientPacketsSent',
|
||||
'cd11_rxbyte' => 'cDot11ClientBytesReceived',
|
||||
'cd11_txbyte' => 'cDot11ClientBytesSent',
|
||||
'mbss_mac_addr' => 'cdot11MbssidIfMacAddress',
|
||||
);
|
||||
|
||||
%MIBS = (
|
||||
%SNMP::Info::IEEE802dot11::MIBS,
|
||||
%SNMP::Info::Layer2::MIBS,
|
||||
%SNMP::Info::Entity::MIBS,
|
||||
%SNMP::Info::EtherLike::MIBS,
|
||||
%SNMP::Info::CiscoStats::MIBS,
|
||||
%SNMP::Info::CiscoVTP::MIBS,
|
||||
%SNMP::Info::CDP::MIBS,
|
||||
'CISCO-DOT11-IF-MIB' => 'cd11IfAuxSsid',
|
||||
'CISCO-DOT11-ASSOCIATION-MIB' => 'cDot11ClientSubIfIndex',
|
||||
'CISCO-DOT11-SSID-SECURITY-MIB' => 'cdot11SecVlanNameId',
|
||||
'CISCO-VLAN-IFTABLE-RELATIONSHIP-MIB' => 'cviRoutedVlanIfIndex',
|
||||
);
|
||||
%MIBS = (
|
||||
%SNMP::Info::IEEE802dot11::MIBS,
|
||||
%SNMP::Info::Layer2::MIBS,
|
||||
%SNMP::Info::Entity::MIBS,
|
||||
%SNMP::Info::EtherLike::MIBS,
|
||||
%SNMP::Info::CiscoStats::MIBS,
|
||||
%SNMP::Info::CiscoVTP::MIBS,
|
||||
%SNMP::Info::CDP::MIBS,
|
||||
'CISCO-DOT11-IF-MIB' => 'cd11IfAuxSsid',
|
||||
'CISCO-DOT11-ASSOCIATION-MIB' => 'cDot11ClientSubIfIndex',
|
||||
'CISCO-DOT11-SSID-SECURITY-MIB' => 'cdot11SecVlanNameId',
|
||||
'CISCO-VLAN-IFTABLE-RELATIONSHIP-MIB' => 'cviRoutedVlanIfIndex',
|
||||
);
|
||||
|
||||
%MUNGE = (
|
||||
%SNMP::Info::IEEE802dot11::MUNGE,
|
||||
%SNMP::Info::Layer2::MUNGE,
|
||||
%SNMP::Info::Entity::MUNGE,
|
||||
%SNMP::Info::EtherLike::MUNGE,
|
||||
%SNMP::Info::CiscoStats::MUNGE,
|
||||
%SNMP::Info::CDP::MUNGE,
|
||||
'cd11_txrate' => \&munge_cd11_txrate,
|
||||
'mbss_mac_addr' => \&SNMP::Info::munge_mac,
|
||||
);
|
||||
%MUNGE = (
|
||||
%SNMP::Info::IEEE802dot11::MUNGE,
|
||||
%SNMP::Info::Layer2::MUNGE,
|
||||
%SNMP::Info::Entity::MUNGE,
|
||||
%SNMP::Info::EtherLike::MUNGE,
|
||||
%SNMP::Info::CiscoStats::MUNGE,
|
||||
%SNMP::Info::CDP::MUNGE,
|
||||
'cd11_txrate' => \&munge_cd11_txrate,
|
||||
'mbss_mac_addr' => \&SNMP::Info::munge_mac,
|
||||
);
|
||||
|
||||
# Use 802.11 power level without putting IEEE802dot11 in @ISA
|
||||
*SNMP::Info::Layer2::Aironet::dot11_cur_tx_pwr_mw =
|
||||
\&SNMP::Info::IEEE802dot11::dot11_cur_tx_pwr_mw;
|
||||
*SNMP::Info::Layer2::Aironet::dot11_cur_tx_pwr_mw
|
||||
= \&SNMP::Info::IEEE802dot11::dot11_cur_tx_pwr_mw;
|
||||
|
||||
sub vendor {
|
||||
|
||||
# Sorry, but it's true.
|
||||
return 'cisco';
|
||||
}
|
||||
@@ -128,7 +130,7 @@ sub interfaces {
|
||||
# Tag on e_descr.1
|
||||
sub description {
|
||||
my $aironet = shift;
|
||||
my $descr = $aironet->descr();
|
||||
my $descr = $aironet->descr();
|
||||
my $e_descr = $aironet->e_descr();
|
||||
|
||||
$descr = "$e_descr->{1} $descr" if defined $e_descr->{1};
|
||||
@@ -144,7 +146,7 @@ sub i_duplex {
|
||||
my $el_duplex = $aironet->el_duplex($partial);
|
||||
|
||||
my %i_duplex;
|
||||
foreach my $d (keys %$el_duplex){
|
||||
foreach my $d ( keys %$el_duplex ) {
|
||||
my $val = $el_duplex->{$d};
|
||||
next unless defined $val;
|
||||
$i_duplex{$d} = 'full' if $val =~ /full/i;
|
||||
@@ -162,9 +164,12 @@ sub i_duplex {
|
||||
# Q-BRIDGE-MIB dot1qTpFdbTable but that was removed in 12.3.
|
||||
sub _aironet_special {
|
||||
my $aironet = shift;
|
||||
my $os_ver = $aironet->os_ver();
|
||||
if (defined($os_ver) && $os_ver =~ /^(\d+)\.(\d+)(\D|$)/ && (($1 == 12 && $2 >= 3) || $1 > 12)) {
|
||||
return 1;
|
||||
my $os_ver = $aironet->os_ver();
|
||||
if ( defined($os_ver)
|
||||
&& $os_ver =~ /^(\d+)\.(\d+)(\D|$)/
|
||||
&& ( ( $1 == 12 && $2 >= 3 ) || $1 > 12 ) )
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -173,12 +178,12 @@ sub _aironet_special {
|
||||
sub _aironet_breakout_dot11idx {
|
||||
my $oid = shift;
|
||||
|
||||
my @parts = split(/\./, $oid);
|
||||
my @parts = split( /\./, $oid );
|
||||
my $ifindex = shift(@parts);
|
||||
my $ssidlen = shift(@parts);
|
||||
my $ssid = pack("C*", splice(@parts, 0, $ssidlen));
|
||||
my $mac = join(":", map {sprintf "%02x", $_} @parts);
|
||||
return ($ifindex, $ssid, $mac);
|
||||
my $ssid = pack( "C*", splice( @parts, 0, $ssidlen ) );
|
||||
my $mac = join( ":", map { sprintf "%02x", $_ } @parts );
|
||||
return ( $ifindex, $ssid, $mac );
|
||||
}
|
||||
|
||||
sub fw_mac {
|
||||
@@ -186,11 +191,11 @@ sub fw_mac {
|
||||
|
||||
return qb_fw_mac($aironet) unless _aironet_special($aironet);
|
||||
my $c_dot11subif = $aironet->c_dot11subif();
|
||||
my $fw_mac = {};
|
||||
my $fw_mac = {};
|
||||
|
||||
foreach my $i (keys %$c_dot11subif) {
|
||||
my ($ifindex, $ssid, $mac) = _aironet_breakout_dot11idx($i);
|
||||
$fw_mac->{$i} = $mac;
|
||||
foreach my $i ( keys %$c_dot11subif ) {
|
||||
my ( $ifindex, $ssid, $mac ) = _aironet_breakout_dot11idx($i);
|
||||
$fw_mac->{$i} = $mac;
|
||||
}
|
||||
return $fw_mac;
|
||||
}
|
||||
@@ -200,11 +205,11 @@ sub fw_port {
|
||||
|
||||
return $aironet->qb_fw_port() unless _aironet_special($aironet);
|
||||
my $c_dot11subif = $aironet->c_dot11subif();
|
||||
my $fw_port = {};
|
||||
my $fw_port = {};
|
||||
|
||||
foreach my $i (keys %$c_dot11subif) {
|
||||
my ($ifindex, $ssid, $mac) = _aironet_breakout_dot11idx($i);
|
||||
$fw_port->{$i} = $c_dot11subif->{$i} || $ifindex;
|
||||
foreach my $i ( keys %$c_dot11subif ) {
|
||||
my ( $ifindex, $ssid, $mac ) = _aironet_breakout_dot11idx($i);
|
||||
$fw_port->{$i} = $c_dot11subif->{$i} || $ifindex;
|
||||
}
|
||||
return $fw_port;
|
||||
}
|
||||
@@ -214,12 +219,12 @@ sub bp_index {
|
||||
|
||||
return $aironet->orig_bp_index() unless _aironet_special($aironet);
|
||||
my $c_dot11subif = $aironet->c_dot11subif();
|
||||
my $bp_index = {};
|
||||
my $bp_index = {};
|
||||
|
||||
foreach my $i (keys %$c_dot11subif) {
|
||||
my ($ifindex, $ssid, $mac) = _aironet_breakout_dot11idx($i);
|
||||
my ($i) = $c_dot11subif->{$i} || $ifindex;
|
||||
$bp_index->{$i} = $i;
|
||||
foreach my $i ( keys %$c_dot11subif ) {
|
||||
my ( $ifindex, $ssid, $mac ) = _aironet_breakout_dot11idx($i);
|
||||
my ($i) = $c_dot11subif->{$i} || $ifindex;
|
||||
$bp_index->{$i} = $i;
|
||||
}
|
||||
return $bp_index;
|
||||
}
|
||||
@@ -231,14 +236,14 @@ sub bp_index {
|
||||
sub v_name {
|
||||
my $aironet = shift;
|
||||
|
||||
my $v_name = {};
|
||||
my $v_name = {};
|
||||
my $vlan_nameid = $aironet->cdot11SecVlanNameId();
|
||||
foreach my $i (keys %$vlan_nameid) {
|
||||
my @parts = split(/\./, $i);
|
||||
my $namelen = shift(@parts);
|
||||
foreach my $i ( keys %$vlan_nameid ) {
|
||||
my @parts = split( /\./, $i );
|
||||
my $namelen = shift(@parts);
|
||||
|
||||
my $name = pack("C*", @parts);
|
||||
$v_name->{$i} = $name;
|
||||
my $name = pack( "C*", @parts );
|
||||
$v_name->{$i} = $name;
|
||||
}
|
||||
return $v_name;
|
||||
}
|
||||
@@ -254,9 +259,9 @@ sub i_vlan {
|
||||
|
||||
my $i_vlan = {};
|
||||
my $idxmap = $aironet->cviRoutedVlanIfIndex();
|
||||
foreach my $i (keys %$idxmap) {
|
||||
my @parts = split(/\./, $i);
|
||||
$i_vlan->{$idxmap->{$i}} = $parts[0];
|
||||
foreach my $i ( keys %$idxmap ) {
|
||||
my @parts = split( /\./, $i );
|
||||
$i_vlan->{ $idxmap->{$i} } = $parts[0];
|
||||
}
|
||||
return $i_vlan;
|
||||
}
|
||||
@@ -265,46 +270,46 @@ sub i_vlan {
|
||||
# 5.5Mbps is reported as 11.
|
||||
sub munge_cd11_txrate {
|
||||
my $txrates = shift;
|
||||
my @units = unpack("C*", $txrates);
|
||||
my @rates = map {
|
||||
my $unit = $_;
|
||||
$unit *= 0.5;
|
||||
} @units;
|
||||
my @units = unpack( "C*", $txrates );
|
||||
my @rates = map {
|
||||
my $unit = $_;
|
||||
$unit *= 0.5;
|
||||
} @units;
|
||||
|
||||
return \@rates;
|
||||
}
|
||||
|
||||
# cd11 INDEX
|
||||
sub cd11_port {
|
||||
my $aironet = shift;
|
||||
my $aironet = shift;
|
||||
my $cd11_sigstrength = $aironet->cd11_sigstrength();
|
||||
my $interfaces = $aironet->interfaces();
|
||||
my $interfaces = $aironet->interfaces();
|
||||
my %ret;
|
||||
foreach (keys %$cd11_sigstrength) {
|
||||
my ($ifindex, $ssid, $mac) = _aironet_breakout_dot11idx($_);
|
||||
$ret{$_} = $interfaces->{$ifindex};
|
||||
foreach ( keys %$cd11_sigstrength ) {
|
||||
my ( $ifindex, $ssid, $mac ) = _aironet_breakout_dot11idx($_);
|
||||
$ret{$_} = $interfaces->{$ifindex};
|
||||
}
|
||||
return \%ret;
|
||||
}
|
||||
|
||||
sub cd11_ssid {
|
||||
my $aironet = shift;
|
||||
my $aironet = shift;
|
||||
my $cd11_sigstrength = $aironet->cd11_sigstrength();
|
||||
my %ret;
|
||||
foreach (keys %$cd11_sigstrength) {
|
||||
my ($ifindex, $ssid, $mac) = _aironet_breakout_dot11idx($_);
|
||||
$ret{$_} = $ssid;
|
||||
foreach ( keys %$cd11_sigstrength ) {
|
||||
my ( $ifindex, $ssid, $mac ) = _aironet_breakout_dot11idx($_);
|
||||
$ret{$_} = $ssid;
|
||||
}
|
||||
return \%ret;
|
||||
}
|
||||
|
||||
sub cd11_mac {
|
||||
my $aironet = shift;
|
||||
my $aironet = shift;
|
||||
my $cd11_sigstrength = $aironet->cd11_sigstrength();
|
||||
my %ret;
|
||||
foreach (keys %$cd11_sigstrength) {
|
||||
my ($ifindex, $ssid, $mac) = _aironet_breakout_dot11idx($_);
|
||||
$ret{$_} = $mac;
|
||||
foreach ( keys %$cd11_sigstrength ) {
|
||||
my ( $ifindex, $ssid, $mac ) = _aironet_breakout_dot11idx($_);
|
||||
$ret{$_} = $mac;
|
||||
}
|
||||
return \%ret;
|
||||
}
|
||||
@@ -316,6 +321,7 @@ sub cd11_mac {
|
||||
# to get the right overrides.
|
||||
sub i_mac {
|
||||
my $aironet = shift;
|
||||
|
||||
# no partial is possible due to the levels
|
||||
# of indirection.
|
||||
|
||||
@@ -323,41 +329,40 @@ sub i_mac {
|
||||
my $mbss_mac = $aironet->orig_i_mac();
|
||||
|
||||
my $mbss_mac_addr = $aironet->mbss_mac_addr();
|
||||
my $ssid_vlan = $aironet->cdot11SecAuxSsidVlan();
|
||||
my $vlan_map = $aironet->cviRoutedVlanIfIndex();
|
||||
my $ifstack = $aironet->ifStackStatus();
|
||||
my $ssid_vlan = $aironet->cdot11SecAuxSsidVlan();
|
||||
my $vlan_map = $aironet->cviRoutedVlanIfIndex();
|
||||
my $ifstack = $aironet->ifStackStatus();
|
||||
|
||||
my $vlan_list = {};
|
||||
foreach my $idx (keys %$vlan_map) {
|
||||
my ($vlan, $num) = split(/\./, $idx);
|
||||
push(@{$vlan_list->{$vlan}}, $vlan_map->{$idx});
|
||||
foreach my $idx ( keys %$vlan_map ) {
|
||||
my ( $vlan, $num ) = split( /\./, $idx );
|
||||
push( @{ $vlan_list->{$vlan} }, $vlan_map->{$idx} );
|
||||
}
|
||||
|
||||
my $stack = {};
|
||||
foreach my $idx (keys %$ifstack) {
|
||||
my ($upper, $lower) = split(/\./, $idx);
|
||||
$stack->{$upper}->{$lower} = $ifstack->{$idx};
|
||||
foreach my $idx ( keys %$ifstack ) {
|
||||
my ( $upper, $lower ) = split( /\./, $idx );
|
||||
$stack->{$upper}->{$lower} = $ifstack->{$idx};
|
||||
}
|
||||
|
||||
# mbss_mac_addr index is (radio, ssid).
|
||||
# ssid_vlan maps ssid->vlan.
|
||||
# vlan_map maps vlan->[list of interfaces]
|
||||
# ifstack allows us to pick the right interface
|
||||
foreach my $idx (keys %$mbss_mac_addr) {
|
||||
my ($interface, @ssid) = split(/\./, $idx);
|
||||
my $vlan = $ssid_vlan->{join(".", scalar(@ssid), @ssid)};
|
||||
next unless defined($vlan);
|
||||
foreach my $vlanif (@{$vlan_list->{$vlan}}) {
|
||||
if (defined($stack->{$vlanif}->{$interface})) {
|
||||
$mbss_mac->{$vlanif} = $mbss_mac_addr->{$idx};
|
||||
}
|
||||
}
|
||||
foreach my $idx ( keys %$mbss_mac_addr ) {
|
||||
my ( $interface, @ssid ) = split( /\./, $idx );
|
||||
my $vlan = $ssid_vlan->{ join( ".", scalar(@ssid), @ssid ) };
|
||||
next unless defined($vlan);
|
||||
foreach my $vlanif ( @{ $vlan_list->{$vlan} } ) {
|
||||
if ( defined( $stack->{$vlanif}->{$interface} ) ) {
|
||||
$mbss_mac->{$vlanif} = $mbss_mac_addr->{$idx};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $mbss_mac;
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
__END__
|
||||
|
||||
|
||||
Reference in New Issue
Block a user