From a71be6e4c2a87118a6c7726ffec458d1ac8452e1 Mon Sep 17 00:00:00 2001 From: Oliver Gorwits Date: Fri, 14 Jul 2023 17:57:37 +0100 Subject: [PATCH] #484 add Aggregate::agg_ports_ifstack to CiscoAgg::agg_ports --- lib/SNMP/Info/Aggregate.pm | 4 +++- lib/SNMP/Info/CiscoAgg.pm | 8 +++++++- xt/lib/Test/SNMP/Info/Aggregate.pm | 7 ++++++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/lib/SNMP/Info/Aggregate.pm b/lib/SNMP/Info/Aggregate.pm index 44482371..07484e44 100644 --- a/lib/SNMP/Info/Aggregate.pm +++ b/lib/SNMP/Info/Aggregate.pm @@ -63,7 +63,9 @@ sub agg_ports_ifstack { foreach my $idx ( keys %$ifStack ) { my ( $higher, $lower ) = split /\./, $idx; 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; } } diff --git a/lib/SNMP/Info/CiscoAgg.pm b/lib/SNMP/Info/CiscoAgg.pm index 7e9a841a..2fbc0e10 100644 --- a/lib/SNMP/Info/CiscoAgg.pm +++ b/lib/SNMP/Info/CiscoAgg.pm @@ -33,6 +33,7 @@ use strict; use warnings; use Exporter; use SNMP::Info::IEEE802dot3ad; +use SNMP::Info::Aggregate 'agg_ports_ifstack'; @SNMP::Info::CiscoAgg::ISA = qw/ SNMP::Info::IEEE802dot3ad @@ -137,7 +138,12 @@ sub agg_ports_lag { # combine PAgP, LAG & Cisco proprietary data 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; } diff --git a/xt/lib/Test/SNMP/Info/Aggregate.pm b/xt/lib/Test/SNMP/Info/Aggregate.pm index 74928d7d..8c84007c 100644 --- a/xt/lib/Test/SNMP/Info/Aggregate.pm +++ b/xt/lib/Test/SNMP/Info/Aggregate.pm @@ -54,6 +54,8 @@ sub setup : Tests(setup) { '163.10' => 'active', '163.90' => 'active', '0.8193' => 'active', + '5010.10102' => 'active', + '5010.10103' => 'active', '8193.20' => 'active', '8193.80' => 'active', }, @@ -63,7 +65,10 @@ sub setup : Tests(setup) { '20' => 'ethernetCsmacd', '80' => 'ethernetCsmacd', '90' => 'ethernetCsmacd', + '10102' => 'ethernetCsmacd', + '10103' => 'ethernetCsmacd', '163' => 'ieee8023adLag', + '5010' => 'propVirtual', '8193' => 'propMultiplexor', }, } @@ -77,7 +82,7 @@ sub agg_ports_ifstack : Tests(2) { can_ok($test->{info}, 'agg_ports_ifstack'); 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(), $expected, q(Aggregated links have expected values));