Attempt to fill in missing bp_index mappings on wired Aruba switches.

This commit is contained in:
Eric A. Miller
2013-11-18 21:33:17 -05:00
parent 7bf950026b
commit 9e332095a2

View File

@@ -625,35 +625,49 @@ sub i_ssidmac {
# Wired switches currently (AOS 7.2.0.0) do, but it seems only for # Wired switches currently (AOS 7.2.0.0) do, but it seems only for
# dot1q ports or access ports that are 'untrusted' ? # dot1q ports or access ports that are 'untrusted' ?
sub bp_index { sub bp_index {
my $aruba = shift; my $aruba = shift;
my $partial = shift; my $partial = shift;
my $i_index = $aruba->orig_i_index($partial) || {}; my $i_index = $aruba->ifExtPortIfIndex($partial) || {};
my $essid_ssid = $aruba->aruba_ap_bssid_ssid($partial) || {}; my $essid_ssid = $aruba->aruba_ap_bssid_ssid($partial) || {};
# Collect standard bp_index first # Collect standard bp_index first
my $wired_bp_index = $aruba->SUPER::bp_index($partial) || {}; my $wired_bp_index = $aruba->SUPER::bp_index($partial) || {};
my %bp_index = %$wired_bp_index; my %bp_index;
my %offset;
foreach my $iid ( keys %$i_index ) { foreach my $iid ( keys %$wired_bp_index ) {
my $index = $i_index->{$iid}; my $index = $wired_bp_index->{$iid};
next unless defined $index; my $delta = $iid - $index;
# Only augment bp_index, don't overwrite any existing mappings $offset{$delta}++;
next if exists $bp_index{$iid}; $bp_index{$iid} = $index;
}
$bp_index{$iid} = $index; # If the offset between dot1dBasePortIfIndex and ifIndex is consistent
} # add potentially missing mappings
if ( keys %offset == 1 ) {
foreach my $iid ( keys %$i_index ) {
my $index = $i_index->{$iid};
next unless defined $index;
# Get Attached APs as Interfaces # Only augment bp_index, don't overwrite any existing mappings
foreach my $oid ( keys %$essid_ssid ) { my $iid = (keys %offset)[0] + $index;
my @parts = split( /\./, $oid ); next if exists $bp_index{$iid};
my $iid = join( ".", splice( @parts, 0, 7 ) );
my $bssid = join( '.', @parts );
$bp_index{$bssid} = $iid; $bp_index{$iid} = $index;
} }
return \%bp_index; }
# Get Attached APs as Interfaces
foreach my $oid ( keys %$essid_ssid ) {
my @parts = split( /\./, $oid );
my $iid = join( ".", splice( @parts, 0, 7 ) );
my $bssid = join( '.', @parts );
$bp_index{$bssid} = $iid;
}
return \%bp_index;
} }
sub fw_port { sub fw_port {