| 1 | # SNMP::Info::Layer2::Aironet | ||
| 2 | # | ||
| 3 | # Copyright (c) 2008-2009 Max Baker changes from version 0.8 and beyond. | ||
| 4 | # | ||
| 5 | # Copyright (c) 2003 Regents of the University of California | ||
| 6 | # All rights reserved. | ||
| 7 | # | ||
| 8 | # Redistribution and use in source and binary forms, with or without | ||
| 9 | # modification, are permitted provided that the following conditions are met: | ||
| 10 | # | ||
| 11 | # * Redistributions of source code must retain the above copyright notice, | ||
| 12 | # this list of conditions and the following disclaimer. | ||
| 13 | # * Redistributions in binary form must reproduce the above copyright | ||
| 14 | # notice, this list of conditions and the following disclaimer in the | ||
| 15 | # documentation and/or other materials provided with the distribution. | ||
| 16 | # * Neither the name of the University of California, Santa Cruz nor the | ||
| 17 | # names of its contributors may be used to endorse or promote products | ||
| 18 | # derived from this software without specific prior written permission. | ||
| 19 | # | ||
| 20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
| 21 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
| 22 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
| 23 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE | ||
| 24 | # LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
| 25 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
| 26 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
| 27 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
| 28 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
| 29 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
| 30 | # POSSIBILITY OF SUCH DAMAGE. | ||
| 31 | |||
| 32 | package SNMP::Info::Layer2::Aironet; | ||
| 33 | |||
| 34 | use strict; | ||
| 35 | use warnings; | ||
| 36 | use Exporter; | ||
| 37 | use SNMP::Info::Layer2; | ||
| 38 | use SNMP::Info::EtherLike; | ||
| 39 | use SNMP::Info::CiscoStats; | ||
| 40 | use SNMP::Info::CiscoConfig; | ||
| 41 | use SNMP::Info::CDP; | ||
| 42 | use SNMP::Info::IEEE802dot11; | ||
| 43 | |||
| 44 | @SNMP::Info::Layer2::Aironet::ISA | ||
| 45 | = qw/SNMP::Info::Layer2 SNMP::Info::EtherLike | ||
| 46 | SNMP::Info::CiscoStats SNMP::Info::CiscoConfig SNMP::Info::CDP Exporter/; | ||
| 47 | @SNMP::Info::Layer2::Aironet::EXPORT_OK = qw//; | ||
| 48 | |||
| 49 | our ($VERSION, %FUNCS, %GLOBALS, %MIBS, %MUNGE); | ||
| 50 | |||
| 51 | $VERSION = '3.985003'; | ||
| 52 | |||
| 53 | %GLOBALS = ( | ||
| 54 | %SNMP::Info::IEEE802dot11::GLOBALS, | ||
| 55 | %SNMP::Info::Layer2::GLOBALS, | ||
| 56 | %SNMP::Info::EtherLike::GLOBALS, | ||
| 57 | %SNMP::Info::CiscoStats::GLOBALS, | ||
| 58 | %SNMP::Info::CiscoConfig::GLOBALS, | ||
| 59 | %SNMP::Info::CDP::GLOBALS, | ||
| 60 | 'serial' => 'entPhysicalSerialNum.1', | ||
| 61 | 'ps1_type' => 'cpoePdCurrentPowerSource', | ||
| 62 | ); | ||
| 63 | |||
| 64 | %FUNCS = ( | ||
| 65 | %SNMP::Info::IEEE802dot11::FUNCS, | ||
| 66 | %SNMP::Info::Layer2::FUNCS, | ||
| 67 | %SNMP::Info::EtherLike::FUNCS, | ||
| 68 | %SNMP::Info::CiscoStats::FUNCS, | ||
| 69 | %SNMP::Info::CiscoConfig::FUNCS, | ||
| 70 | %SNMP::Info::CDP::FUNCS, | ||
| 71 | 'i_80211channel' => 'cd11IfPhyDsssCurrentChannel', | ||
| 72 | 'c_dot11subif' => 'cDot11ClientSubIfIndex', | ||
| 73 | 'cd11_rateset' => 'cDot11ClientDataRateSet', | ||
| 74 | 'cd11_txrate' => 'cDot11ClientCurrentTxRateSet', | ||
| 75 | 'cd11_uptime' => 'cDot11ClientUpTime', | ||
| 76 | 'cd11_sigstrength' => 'cDot11ClientSignalStrength', | ||
| 77 | 'cd11_sigqual' => 'cDot11ClientSigQuality', | ||
| 78 | 'cd11_rxpkt' => 'cDot11ClientPacketsReceived', | ||
| 79 | 'cd11_txpkt' => 'cDot11ClientPacketsSent', | ||
| 80 | 'cd11_rxbyte' => 'cDot11ClientBytesReceived', | ||
| 81 | 'cd11_txbyte' => 'cDot11ClientBytesSent', | ||
| 82 | 'mbss_mac_addr' => 'cdot11MbssidIfMacAddress', | ||
| 83 | ); | ||
| 84 | |||
| 85 | %MIBS = ( | ||
| 86 | %SNMP::Info::IEEE802dot11::MIBS, | ||
| 87 | %SNMP::Info::Layer2::MIBS, | ||
| 88 | %SNMP::Info::EtherLike::MIBS, | ||
| 89 | %SNMP::Info::CiscoStats::MIBS, | ||
| 90 | %SNMP::Info::CiscoConfig::MIBS, | ||
| 91 | %SNMP::Info::CDP::MIBS, | ||
| 92 | 'CISCO-DOT11-IF-MIB' => 'cd11IfAuxSsid', | ||
| 93 | 'CISCO-DOT11-ASSOCIATION-MIB' => 'cDot11ClientSubIfIndex', | ||
| 94 | 'CISCO-DOT11-SSID-SECURITY-MIB' => 'cdot11SecVlanNameId', | ||
| 95 | 'CISCO-VLAN-IFTABLE-RELATIONSHIP-MIB' => 'cviRoutedVlanIfIndex', | ||
| 96 | 'CISCO-POE-PD-MIB' => 'cpoePdCurrentPowerSource', | ||
| 97 | ); | ||
| 98 | |||
| 99 | %MUNGE = ( | ||
| 100 | %SNMP::Info::IEEE802dot11::MUNGE, | ||
| 101 | %SNMP::Info::Layer2::MUNGE, | ||
| 102 | %SNMP::Info::EtherLike::MUNGE, | ||
| 103 | %SNMP::Info::CiscoStats::MUNGE, | ||
| 104 | %SNMP::Info::CiscoConfig::MUNGE, | ||
| 105 | %SNMP::Info::CDP::MUNGE, | ||
| 106 | 'cd11_txrate' => \&munge_cd11_txrate, | ||
| 107 | 'cd11_rateset' => \&munge_cd11_txrate, | ||
| 108 | 'mbss_mac_addr' => \&SNMP::Info::munge_mac, | ||
| 109 | ); | ||
| 110 | |||
| 111 | # Use 802.11 power level without putting IEEE802dot11 in @ISA | ||
| 112 | *SNMP::Info::Layer2::Aironet::dot11_cur_tx_pwr_mw | ||
| 113 | = \&SNMP::Info::IEEE802dot11::dot11_cur_tx_pwr_mw; | ||
| 114 | |||
| 115 | sub vendor { | ||
| 116 | # Sorry, but it's true. | ||
| 117 | return 'cisco'; | ||
| 118 | } | ||
| 119 | |||
| 120 | sub interfaces { | ||
| 121 | my $aironet = shift; | ||
| 122 | my $partial = shift; | ||
| 123 | |||
| 124 | my $i_description = $aironet->i_description($partial); | ||
| 125 | |||
| 126 | return $i_description; | ||
| 127 | } | ||
| 128 | |||
| 129 | # Tag on e_descr.1 | ||
| 130 | sub description { | ||
| 131 | my $aironet = shift; | ||
| 132 | my $descr = $aironet->SUPER::description(); | ||
| 133 | my $e_descr = $aironet->e_descr(); | ||
| 134 | |||
| 135 | if (defined $e_descr->{1}) { | ||
| 136 | if (defined $descr) { | ||
| 137 | $descr = "$e_descr->{1} $descr" | ||
| 138 | } else { | ||
| 139 | $descr = "$e_descr->{1}" | ||
| 140 | } | ||
| 141 | } | ||
| 142 | return $descr; | ||
| 143 | } | ||
| 144 | |||
| 145 | # Fetch duplex from EtherLike | ||
| 146 | sub i_duplex { | ||
| 147 | my $aironet = shift; | ||
| 148 | my $partial = shift; | ||
| 149 | |||
| 150 | my $el_duplex = $aironet->el_duplex($partial); | ||
| 151 | |||
| 152 | my %i_duplex; | ||
| 153 | foreach my $d ( keys %$el_duplex ) { | ||
| 154 | my $val = $el_duplex->{$d}; | ||
| 155 | next unless defined $val; | ||
| 156 | $i_duplex{$d} = 'full' if $val =~ /full/i; | ||
| 157 | $i_duplex{$d} = 'half' if $val =~ /half/i; | ||
| 158 | } | ||
| 159 | |||
| 160 | return \%i_duplex; | ||
| 161 | } | ||
| 162 | |||
| 163 | # | ||
| 164 | # IOS 12.3 introduces the cDot11ClientSubIfIndex in the | ||
| 165 | # cDot11ClientConfigInfoTable, which supplies the ifIndex | ||
| 166 | # of the VLAN Subinterface if one exists, or of the primary | ||
| 167 | # interface if there are not subinterfaces. 12.2 used the | ||
| 168 | # Q-BRIDGE-MIB dot1qTpFdbTable but that was removed in 12.3. | ||
| 169 | sub _aironet_special { | ||
| 170 | my $aironet = shift; | ||
| 171 | my $os_ver = $aironet->os_ver(); | ||
| 172 | if ( defined($os_ver) | ||
| 173 | && $os_ver =~ /^(\d+)\.(\d+)(\D|$)/ | ||
| 174 | && ( ( $1 == 12 && $2 >= 3 ) || $1 > 12 ) ) | ||
| 175 | { | ||
| 176 | return 1; | ||
| 177 | } | ||
| 178 | } | ||
| 179 | |||
| 180 | # | ||
| 181 | # INDEX { ifIndex, cd11IfAuxSsid, cDot11ClientAddress } | ||
| 182 | sub _aironet_breakout_dot11idx { | ||
| 183 | my $oid = shift; | ||
| 184 | |||
| 185 | my @parts = split( /\./, $oid ); | ||
| 186 | my $ifindex = shift(@parts); | ||
| 187 | my $ssidlen = shift(@parts); | ||
| 188 | my $ssid = pack( "C*", splice( @parts, 0, $ssidlen ) ); | ||
| 189 | my $mac = join( ":", map { sprintf "%02x", $_ } @parts ); | ||
| 190 | return ( $ifindex, $ssid, $mac ); | ||
| 191 | } | ||
| 192 | |||
| 193 | sub fw_mac { | ||
| 194 | my $aironet = shift; | ||
| 195 | |||
| 196 | return $aironet->qb_fw_mac() unless _aironet_special($aironet); | ||
| 197 | my $c_dot11subif = $aironet->c_dot11subif(); | ||
| 198 | my $fw_mac = {}; | ||
| 199 | |||
| 200 | foreach my $i ( keys %$c_dot11subif ) { | ||
| 201 | my ( $ifindex, $ssid, $mac ) = _aironet_breakout_dot11idx($i); | ||
| 202 | $fw_mac->{$i} = $mac; | ||
| 203 | } | ||
| 204 | return $fw_mac; | ||
| 205 | } | ||
| 206 | |||
| 207 | sub fw_port { | ||
| 208 | my $aironet = shift; | ||
| 209 | |||
| 210 | return $aironet->qb_fw_port() unless _aironet_special($aironet); | ||
| 211 | my $c_dot11subif = $aironet->c_dot11subif(); | ||
| 212 | my $fw_port = {}; | ||
| 213 | |||
| 214 | foreach my $i ( keys %$c_dot11subif ) { | ||
| 215 | my ( $ifindex, $ssid, $mac ) = _aironet_breakout_dot11idx($i); | ||
| 216 | $fw_port->{$i} = $c_dot11subif->{$i} || $ifindex; | ||
| 217 | } | ||
| 218 | return $fw_port; | ||
| 219 | } | ||
| 220 | |||
| 221 | sub bp_index { | ||
| 222 | my $aironet = shift; | ||
| 223 | |||
| 224 | return $aironet->orig_bp_index() unless _aironet_special($aironet); | ||
| 225 | my $c_dot11subif = $aironet->c_dot11subif(); | ||
| 226 | my $bp_index = {}; | ||
| 227 | |||
| 228 | foreach my $i ( keys %$c_dot11subif ) { | ||
| 229 | my ( $ifindex, $ssid, $mac ) = _aironet_breakout_dot11idx($i); | ||
| 230 | my ($i) = $c_dot11subif->{$i} || $ifindex; | ||
| 231 | $bp_index->{$i} = $i; | ||
| 232 | } | ||
| 233 | return $bp_index; | ||
| 234 | } | ||
| 235 | |||
| 236 | ### | ||
| 237 | # | ||
| 238 | # VLAN support | ||
| 239 | # | ||
| 240 | sub v_name { | ||
| 241 | my $aironet = shift; | ||
| 242 | |||
| 243 | my $v_name = {}; | ||
| 244 | my $vlan_nameid = $aironet->cdot11SecVlanNameId(); | ||
| 245 | foreach my $i ( keys %$vlan_nameid ) { | ||
| 246 | my @parts = split( /\./, $i ); | ||
| 247 | my $namelen = shift(@parts); | ||
| 248 | |||
| 249 | my $name = pack( "C*", @parts ); | ||
| 250 | $v_name->{$i} = $name; | ||
| 251 | } | ||
| 252 | return $v_name; | ||
| 253 | } | ||
| 254 | |||
| 255 | sub v_index { | ||
| 256 | my $aironet = shift; | ||
| 257 | |||
| 258 | return $aironet->cdot11SecVlanNameId(); | ||
| 259 | } | ||
| 260 | |||
| 261 | sub i_vlan { | ||
| 262 | my $aironet = shift; | ||
| 263 | |||
| 264 | my $i_vlan = {}; | ||
| 265 | my $idxmap = $aironet->cviRoutedVlanIfIndex(); | ||
| 266 | foreach my $i ( keys %$idxmap ) { | ||
| 267 | my @parts = split( /\./, $i ); | ||
| 268 | $i_vlan->{ $idxmap->{$i} } = $parts[0]; | ||
| 269 | } | ||
| 270 | return $i_vlan; | ||
| 271 | } | ||
| 272 | |||
| 273 | # The MIB reports in units of half a megabit, e.g., | ||
| 274 | # 5.5Mbps is reported as 11. | ||
| 275 | sub munge_cd11_txrate { | ||
| 276 | my $txrates = shift; | ||
| 277 | my @units = unpack( "C*", $txrates ); | ||
| 278 | my @rates = map { | ||
| 279 | my $unit = $_; | ||
| 280 | $unit *= 0.5; | ||
| 281 | } @units; | ||
| 282 | |||
| 283 | return \@rates; | ||
| 284 | } | ||
| 285 | |||
| 286 | # cd11 INDEX | ||
| 287 | sub cd11_port { | ||
| 288 | my $aironet = shift; | ||
| 289 | my $cd11_sigstrength = $aironet->cd11_sigstrength(); | ||
| 290 | my $interfaces = $aironet->interfaces(); | ||
| 291 | my %ret; | ||
| 292 | foreach ( keys %$cd11_sigstrength ) { | ||
| 293 | my ( $ifindex, $ssid, $mac ) = _aironet_breakout_dot11idx($_); | ||
| 294 | $ret{$_} = $interfaces->{$ifindex}; | ||
| 295 | } | ||
| 296 | return \%ret; | ||
| 297 | } | ||
| 298 | |||
| 299 | sub cd11_ssid { | ||
| 300 | my $aironet = shift; | ||
| 301 | my $cd11_sigstrength = $aironet->cd11_sigstrength(); | ||
| 302 | my %ret; | ||
| 303 | foreach ( keys %$cd11_sigstrength ) { | ||
| 304 | my ( $ifindex, $ssid, $mac ) = _aironet_breakout_dot11idx($_); | ||
| 305 | $ret{$_} = $ssid; | ||
| 306 | } | ||
| 307 | return \%ret; | ||
| 308 | } | ||
| 309 | |||
| 310 | sub cd11_mac { | ||
| 311 | my $aironet = shift; | ||
| 312 | my $cd11_sigstrength = $aironet->cd11_sigstrength(); | ||
| 313 | my %ret; | ||
| 314 | foreach ( keys %$cd11_sigstrength ) { | ||
| 315 | my ( $ifindex, $ssid, $mac ) = _aironet_breakout_dot11idx($_); | ||
| 316 | $ret{$_} = $mac; | ||
| 317 | } | ||
| 318 | return \%ret; | ||
| 319 | } | ||
| 320 | |||
| 321 | # Map VLAN N on interface I to its actual ifIndex. | ||
| 322 | sub _vlan_map_n_stack { | ||
| 323 | my $aironet = shift; | ||
| 324 | my $vlan_idx = $aironet->cviRoutedVlanIfIndex(); | ||
| 325 | |||
| 326 | my $vlan_map = {}; | ||
| 327 | foreach my $idx ( keys %$vlan_idx ) { | ||
| 328 | my ( $vlan, $num ) = split( /\./, $idx ); | ||
| 329 | $vlan_map->{$vlan}->{$num} = $vlan_idx->{$idx}; | ||
| 330 | } | ||
| 331 | return $vlan_map; | ||
| 332 | } | ||
| 333 | |||
| 334 | # When using MBSS, the ifTable reports the | ||
| 335 | # base MAC address, but the actual association is | ||
| 336 | # with a different MAC address for MBSS. | ||
| 337 | # This convoluted path seems to be necessary | ||
| 338 | # to get the right overrides. | ||
| 339 | sub i_mac { | ||
| 340 | my $aironet = shift; | ||
| 341 | |||
| 342 | # no partial is possible due to the levels | ||
| 343 | # of indirection. | ||
| 344 | |||
| 345 | # Start with the ifPhysAddress, and override | ||
| 346 | my $mbss_mac = $aironet->orig_i_mac(); | ||
| 347 | |||
| 348 | my $mbss_mac_addr = $aironet->mbss_mac_addr(); | ||
| 349 | my $ssid_vlan = $aironet->cdot11SecAuxSsidVlan(); | ||
| 350 | my $vlan_map = $aironet->cviRoutedVlanIfIndex(); | ||
| 351 | my $ifstack = $aironet->ifStackStatus(); | ||
| 352 | |||
| 353 | my $vlan_list = {}; | ||
| 354 | foreach my $idx ( keys %$vlan_map ) { | ||
| 355 | my ( $vlan, $num ) = split( /\./, $idx ); | ||
| 356 | push( @{ $vlan_list->{$vlan} }, $vlan_map->{$idx} ); | ||
| 357 | } | ||
| 358 | |||
| 359 | my $stack = {}; | ||
| 360 | foreach my $idx ( keys %$ifstack ) { | ||
| 361 | my ( $upper, $lower ) = split( /\./, $idx ); | ||
| 362 | $stack->{$upper}->{$lower} = $ifstack->{$idx}; | ||
| 363 | } | ||
| 364 | |||
| 365 | # mbss_mac_addr index is (radio, ssid). | ||
| 366 | # ssid_vlan maps ssid->vlan. | ||
| 367 | # vlan_map maps vlan->[list of interfaces] | ||
| 368 | # ifstack allows us to pick the right interface | ||
| 369 | foreach my $idx ( keys %$mbss_mac_addr ) { | ||
| 370 | my ( $interface, @ssid ) = split( /\./, $idx ); | ||
| 371 | my $vlan = $ssid_vlan->{ join( ".", scalar(@ssid), @ssid ) }; | ||
| 372 | next unless defined($vlan); | ||
| 373 | foreach my $vlanif ( @{ $vlan_list->{$vlan} } ) { | ||
| 374 | if ( defined( $stack->{$vlanif}->{$interface} ) ) { | ||
| 375 | $mbss_mac->{$vlanif} = $mbss_mac_addr->{$idx}; | ||
| 376 | } | ||
| 377 | } | ||
| 378 | } | ||
| 379 | |||
| 380 | return $mbss_mac; | ||
| 381 | } | ||
| 382 | |||
| 383 | sub i_ssidlist { | ||
| 384 | my $aironet = shift; | ||
| 385 | |||
| 386 | # no partial is possible due to the levels | ||
| 387 | # of indirection. | ||
| 388 | my $ssid_row = $aironet->cdot11SecInterfSsidRowStatus(); | ||
| 389 | my $ssid_vlan = $aironet->cdot11SecAuxSsidVlan(); | ||
| 390 | if ( !defined($ssid_row) || !defined($ssid_vlan) ) { | ||
| 391 | return $aironet->cd11IfAuxSsid(); | ||
| 392 | } | ||
| 393 | my $ssidlist = {}; | ||
| 394 | my $if_ssidcount = {}; | ||
| 395 | my $vlan_map = $aironet->_vlan_map_n_stack(); | ||
| 396 | foreach my $idx ( keys %$ssid_row ) { | ||
| 397 | next unless $ssid_row->{$idx} eq 'active'; | ||
| 398 | |||
| 399 | # ssid_row index is radio.ssid | ||
| 400 | my ( $interface, $ssid ) = split( /\./, $idx, 2 ); | ||
| 401 | my ( $len, @ssidt ) = split( /\./, $ssid ); | ||
| 402 | my $mappedintf = $vlan_map->{ $ssid_vlan->{$ssid} }->{$interface}; | ||
| 403 | next unless $mappedintf; | ||
| 404 | if ( !$if_ssidcount->{$mappedintf} ) { | ||
| 405 | $if_ssidcount->{$mappedintf} = 1; | ||
| 406 | } | ||
| 407 | my $ssidlist_idx | ||
| 408 | = sprintf( "%s.%d", $mappedintf, $if_ssidcount->{$mappedintf} ); | ||
| 409 | $ssidlist->{$ssidlist_idx} = pack( "C*", @ssidt ); | ||
| 410 | $if_ssidcount->{$mappedintf}++; | ||
| 411 | } | ||
| 412 | return $ssidlist; | ||
| 413 | } | ||
| 414 | |||
| 415 | sub i_ssidbcast { | ||
| 416 | my $aironet = shift; | ||
| 417 | my $partial = shift; | ||
| 418 | my $mbss_bcast = $aironet->cdot11SecAuxSsidMbssidBroadcast(); | ||
| 419 | if ( !defined($mbss_bcast) ) { | ||
| 420 | return $aironet->cd11IfAuxSsidBroadcastSsid($partial); | ||
| 421 | } | ||
| 422 | my $map = {}; | ||
| 423 | foreach my $key ( keys %$mbss_bcast ) { | ||
| 424 | my (@idx) = split( /\./, $key ); | ||
| 425 | my $len = shift(@idx); | ||
| 426 | $map->{ pack( "C*", @idx ) } = $mbss_bcast->{$key}; | ||
| 427 | } | ||
| 428 | |||
| 429 | # This needs to return the same indexes as i_ssidlist. | ||
| 430 | # mbss_bcast maps ssid -> broadcasting | ||
| 431 | # so we just replace the i_ssidlist values with the mbss_bcast ones. | ||
| 432 | my $i_ssidlist = $aironet->i_ssidlist(); | ||
| 433 | my $i_ssidbcast = {}; | ||
| 434 | foreach my $key ( keys %$i_ssidlist ) { | ||
| 435 | $i_ssidbcast->{$key} = $map->{ $i_ssidlist->{$key} }; | ||
| 436 | } | ||
| 437 | return $i_ssidbcast; | ||
| 438 | } | ||
| 439 | |||
| 440 | sub i_ssidmac { | ||
| 441 | my $aironet = shift; | ||
| 442 | my $partial = shift; | ||
| 443 | my $mbss_mac_addr = $aironet->mbss_mac_addr(); | ||
| 444 | |||
| 445 | # Same logic as i_ssidbcast to return same indexes as i_ssidlist | ||
| 446 | my $map = {}; | ||
| 447 | foreach my $key ( keys %$mbss_mac_addr ) { | ||
| 448 | my ( $interface, @idx ) = split( /\./, $key ); | ||
| 449 | $map->{ pack( "C*", @idx ) } = $mbss_mac_addr->{$key}; | ||
| 450 | } | ||
| 451 | |||
| 452 | my $i_ssidlist = $aironet->i_ssidlist(); | ||
| 453 | my $i_ssidmac = {}; | ||
| 454 | foreach my $key ( keys %$i_ssidlist ) { | ||
| 455 | $i_ssidmac->{$key} = $map->{ $i_ssidlist->{$key} }; | ||
| 456 | } | ||
| 457 | return $i_ssidmac; | ||
| 458 | } | ||
| 459 | |||
| 460 | ### | ||
| 461 | # PoE status. The ps1_type is the PoE injector type, which is just | ||
| 462 | # a scalar; the status is a little more complex. | ||
| 463 | sub ps1_status { | ||
| 464 | my $aironet = shift; | ||
| 465 | my $idx = $aironet->cpoePdCurrentPowerLevel(); | ||
| 466 | my $mw = $aironet->cpoePdSupportedPower( $idx ); | ||
| 467 | my $descr = $aironet->cpoePdSupportedPowerMode( $idx ); | ||
| 468 | |||
| 469 | return sprintf( "%.2fW (%s)", $mw->{$idx} * 0.001, $descr->{$idx} ); | ||
| 470 | } | ||
| 471 | |||
| 472 | 1; | ||
| 473 | __END__ |