#484 add Aggregate::agg_ports_ifstack to CiscoAgg::agg_ports

This commit is contained in:
Oliver Gorwits
2023-07-14 17:57:37 +01:00
parent ba721cf9fb
commit a71be6e4c2
3 changed files with 16 additions and 3 deletions

View File

@@ -63,7 +63,9 @@ sub agg_ports_ifstack {
foreach my $idx ( keys %$ifStack ) { foreach my $idx ( keys %$ifStack ) {
my ( $higher, $lower ) = split /\./, $idx; my ( $higher, $lower ) = split /\./, $idx;
next if ( $higher == 0 or $lower == 0 ); next if ( $higher == 0 or $lower == 0 );
if ( $ifType->{ $higher } eq 'ieee8023adLag' or $ifType->{ $higher } eq 'propMultiplexor') { if ( $ifType->{ $higher } eq 'ieee8023adLag'
or $ifType->{ $higher } eq 'propMultiplexor'
or $ifType->{ $higher } eq 'propVirtual' ) {
$ret->{ $lower } = $higher; $ret->{ $lower } = $higher;
} }
} }

View File

@@ -33,6 +33,7 @@ use strict;
use warnings; use warnings;
use Exporter; use Exporter;
use SNMP::Info::IEEE802dot3ad; use SNMP::Info::IEEE802dot3ad;
use SNMP::Info::Aggregate 'agg_ports_ifstack';
@SNMP::Info::CiscoAgg::ISA = qw/ @SNMP::Info::CiscoAgg::ISA = qw/
SNMP::Info::IEEE802dot3ad SNMP::Info::IEEE802dot3ad
@@ -137,7 +138,12 @@ sub agg_ports_lag {
# combine PAgP, LAG & Cisco proprietary data # combine PAgP, LAG & Cisco proprietary data
sub agg_ports { sub agg_ports {
my $ret = {%{agg_ports_pagp(@_)}, %{agg_ports_lag(@_)}, %{agg_ports_cisco(@_)}}; my $ret = {
%{agg_ports_ifstack(@_)},
%{agg_ports_pagp(@_)},
%{agg_ports_lag(@_)},
%{agg_ports_cisco(@_)},
};
return $ret; return $ret;
} }

View File

@@ -54,6 +54,8 @@ sub setup : Tests(setup) {
'163.10' => 'active', '163.10' => 'active',
'163.90' => 'active', '163.90' => 'active',
'0.8193' => 'active', '0.8193' => 'active',
'5010.10102' => 'active',
'5010.10103' => 'active',
'8193.20' => 'active', '8193.20' => 'active',
'8193.80' => 'active', '8193.80' => 'active',
}, },
@@ -63,7 +65,10 @@ sub setup : Tests(setup) {
'20' => 'ethernetCsmacd', '20' => 'ethernetCsmacd',
'80' => 'ethernetCsmacd', '80' => 'ethernetCsmacd',
'90' => 'ethernetCsmacd', '90' => 'ethernetCsmacd',
'10102' => 'ethernetCsmacd',
'10103' => 'ethernetCsmacd',
'163' => 'ieee8023adLag', '163' => 'ieee8023adLag',
'5010' => 'propVirtual',
'8193' => 'propMultiplexor', '8193' => 'propMultiplexor',
}, },
} }
@@ -77,7 +82,7 @@ sub agg_ports_ifstack : Tests(2) {
can_ok($test->{info}, 'agg_ports_ifstack'); can_ok($test->{info}, 'agg_ports_ifstack');
my $expected my $expected
= {'10' => '163', '90' => '163', '20' => '8193', '80' => '8193',}; = {'10' => '163', '90' => '163', '10102' => '5010', '10103' => '5010', '20' => '8193', '80' => '8193',};
cmp_deeply($test->{info}->agg_ports_ifstack(), cmp_deeply($test->{info}->agg_ports_ifstack(),
$expected, q(Aggregated links have expected values)); $expected, q(Aggregated links have expected values));