From 0713a6457cbb397e4a7ceb5a1657eb6f5411da7d Mon Sep 17 00:00:00 2001 From: "Eric A. Miller" Date: Fri, 14 Dec 2012 23:28:04 -0500 Subject: [PATCH] L2::Airespace now reports AP Ethernet MAC as port MAC for radio ports --- ChangeLog | 3 ++- Info/Layer2/Airespace.pm | 40 +++++++++++++++++++++++++++++++++++++++- 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index ab3c0700..563c6bb4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -28,7 +28,8 @@ version 3.00 * UNIVERSAL::can() now works with dynamic methods * Dynamically generated methods are added to symbol table to avoid AUTOLOAD on subsequent calls - * L2::Airspace now supports 802.11n client tx rates + * L2::Airespace now supports 802.11n client tx rates + * L2::Airespace now reports AP Ethernet MAC as port MAC for radio ports * CiscoStats improvements to determine os versions, eg IOS XE ver on Sup7L-E * CiscoStats now reports 'ios-xe' if the device runs IOS XE (used to be 'ios') diff --git a/Info/Layer2/Airespace.pm b/Info/Layer2/Airespace.pm index 4f3a0368..bee6fcb1 100644 --- a/Info/Layer2/Airespace.pm +++ b/Info/Layer2/Airespace.pm @@ -47,6 +47,7 @@ $VERSION = '2.11'; %SNMP::Info::CDP::MIBS, %SNMP::Info::Airespace::MIBS, 'CISCO-LWAPP-DOT11-CLIENT-MIB' => 'cldcClientCurrentTxRateSet', 'CISCO-LWAPP-DOT11-MIB' => 'cldHtDot11nChannelBandwidth', + 'CISCO-LWAPP-AP-MIB' => 'cLApIfMacAddress', ); %GLOBALS = ( @@ -57,7 +58,8 @@ $VERSION = '2.11'; %FUNCS = ( %SNMP::Info::FUNCS, %SNMP::Info::Bridge::FUNCS, %SNMP::Info::CDP::FUNCS, %SNMP::Info::Airespace::FUNCS, - + # CISCO-LWAPP-AP-MIB::cLApTable + 'ap_if_mac' => 'cLApIfMacAddress', # This needs to be cleaned up, but for now we pretend to # have the CISCO-DOT11-MIB for signal strengths, etc. 'cd11_sigstrength' => 'bsnMobileStationRSSI', # kinda @@ -76,6 +78,7 @@ $VERSION = '2.11'; %MUNGE = ( %SNMP::Info::MUNGE, %SNMP::Info::Bridge::MUNGE, %SNMP::Info::CDP::MUNGE, %SNMP::Info::Airespace::MUNGE, + 'ap_if_mac' => \&SNMP::Info::munge_mac, 'cd11_rxpkt' => \&munge_64bits, 'cd11_txpkt' => \&munge_64bits, 'cd11n_ch_bw' => \&munge_cd11n_ch_bw, @@ -207,6 +210,31 @@ sub munge_64bits { return $value & 0xffffffff; } +# Cisco provides the AP's Ethernet MAC via +# CISCO-LWAPP-AP-MIB::cLApIfMacAddress this was not available pre-Cisco +sub i_mac { + my $airespace = shift; + my $partial = shift; + + my $i_index = $airespace->i_index($partial) || {}; + my $ap_mac = $airespace->ap_if_mac() || {}; + + my $i_mac = $airespace->SUPER::i_mac() || {}; + 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}/ ) { + $index =~ s/\.\d+$//; + next unless defined $index; + my $sys_mac = join( '.', map { hex($_) } split( ':', $index ) ); + my $mac = $ap_mac->{$sys_mac}; + $i_mac->{$iid} = $mac; + } + } + return $i_mac; +} + 1; __END__ @@ -266,6 +294,8 @@ my $airespace = new SNMP::Info::Layer2::Airespace(...); =item F +=item F + =item Inherited Classes' MIBs See L for its own MIB requirements. @@ -327,6 +357,14 @@ Returns client transmission speed in Mbs. =head2 Overrides +=over + +=item i_mac() + +Adds AP Ethernet MAC as port mac on radio ports from C. + +=back + =head2 Table Methods imported from SNMP::Info::Airespace See documentation in L for details.