From a83855157b5b40bd8b94d3e75ab7755fe484acfa Mon Sep 17 00:00:00 2001 From: "Eric A. Miller" Date: Sat, 10 Mar 2018 19:01:31 -0500 Subject: [PATCH] Fix SNMP::Info::IEEE802dot3ad when more than 1 LAG --- Changes | 6 ++++++ lib/SNMP/Info/CiscoAgg.pm | 14 +++++++++++--- lib/SNMP/Info/IEEE802dot3ad.pm | 31 ++++++++++++++++--------------- lib/SNMP/Info/Layer3/Cumulus.pm | 2 ++ lib/SNMP/Info/Layer3/H3C.pm | 8 +++++++- lib/SNMP/Info/Layer3/Huawei.pm | 8 +++++++- lib/SNMP/Info/Layer3/VMware.pm | 5 +++++ 7 files changed, 54 insertions(+), 20 deletions(-) diff --git a/Changes b/Changes index 08456d7e..49baa81e 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,9 @@ +version 3.50 + + [BUG FIXES] + + * Fix SNMP::Info::IEEE802dot3ad when more than 1 LAG + version 3.49 (2018-03-03) [ENHANCEMENTS] diff --git a/lib/SNMP/Info/CiscoAgg.pm b/lib/SNMP/Info/CiscoAgg.pm index 2580a669..a42596b2 100644 --- a/lib/SNMP/Info/CiscoAgg.pm +++ b/lib/SNMP/Info/CiscoAgg.pm @@ -1,6 +1,6 @@ # SNMP::Info::CiscoAgg # -# Copyright (c) 2014 SNMP::Info Developers +# Copyright (c) 2018 SNMP::Info Developers # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -52,9 +52,13 @@ $VERSION = '3.49'; %GLOBALS = (); -%FUNCS = (); +%FUNCS = ( + %SNMP::Info::IEEE802dot3ad::FUNCS, +); -%MUNGE = (); +%MUNGE = ( + %SNMP::Info::IEEE802dot3ad::MUNGE, +); sub agg_ports_pagp { my $dev = shift; @@ -147,4 +151,8 @@ automatically. =back +=head2 Table Methods imported from SNMP::Info::IEEE802dot3ad + +See documentation in L for details. + =cut diff --git a/lib/SNMP/Info/IEEE802dot3ad.pm b/lib/SNMP/Info/IEEE802dot3ad.pm index fad3da3e..21a5997b 100644 --- a/lib/SNMP/Info/IEEE802dot3ad.pm +++ b/lib/SNMP/Info/IEEE802dot3ad.pm @@ -1,6 +1,6 @@ # SNMP::Info::IEEE802dot3ad # -# Copyright (c) 2014 SNMP::Info Developers +# Copyright (c) 2018 SNMP::Info Developers # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -52,29 +52,30 @@ $VERSION = '3.49'; %GLOBALS = (); -%FUNCS = (); +%FUNCS = ( + 'ad_lag_ports' => 'dot3adAggPortListPorts', + ); -%MUNGE = (); +%MUNGE = ( + 'ad_lag_ports' => \&SNMP::Info::munge_port_list, + ); sub agg_ports_lag { my $dev = shift; # TODO: implement partial - my $masters = $dev->dot3adAggActorOperKey; - my $slaves = $dev->dot3adAggPortActorOperKey; + my $ports = $dev->ad_lag_ports; - return {} unless - ref {} eq ref $masters and scalar keys %$masters - and ref {} eq ref $slaves and scalar keys %$slaves; + return {} unless ref {} eq ref $ports and scalar keys %$ports; my $ret = {}; - foreach my $s (keys %$slaves) { - next if $slaves->{$s} == 0; - foreach my $m (keys %$masters) { - next unless $masters->{$m} == $slaves->{$s}; - $ret->{$s} = $m; - last; - } + foreach my $m ( keys %$ports ) { + my $idx = $m; + my $portlist = $ports->{$m}; + next unless $portlist; + for ( my $i = 0; $i <= scalar(@$portlist); $i++ ) { + $ret->{$i+1} = $idx if ( @$portlist[$i] ); + } } return $ret; diff --git a/lib/SNMP/Info/Layer3/Cumulus.pm b/lib/SNMP/Info/Layer3/Cumulus.pm index a32b6632..bb0972e5 100644 --- a/lib/SNMP/Info/Layer3/Cumulus.pm +++ b/lib/SNMP/Info/Layer3/Cumulus.pm @@ -68,11 +68,13 @@ $VERSION = '3.49'; %FUNCS = ( %SNMP::Info::Layer3::FUNCS, %SNMP::Info::LLDP::FUNCS, + %SNMP::Info::IEEE802dot3ad::FUNCS, ); %MUNGE = ( %SNMP::Info::Layer3::MUNGE, %SNMP::Info::LLDP::MUNGE, + %SNMP::Info::IEEE802dot3ad::MUNGE, ); sub vendor { return 'Cumulus Networks' } diff --git a/lib/SNMP/Info/Layer3/H3C.pm b/lib/SNMP/Info/Layer3/H3C.pm index 97da0795..e7230ea0 100644 --- a/lib/SNMP/Info/Layer3/H3C.pm +++ b/lib/SNMP/Info/Layer3/H3C.pm @@ -1,6 +1,6 @@ # SNMP::Info::Layer3::H3C # -# Copyright (c) 2012 Jeroen van Ingen +# Copyright (c) 2018 Jeroen van Ingen # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -71,12 +71,14 @@ $VERSION = '3.49'; %FUNCS = ( %SNMP::Info::Layer3::FUNCS, %SNMP::Info::LLDP::FUNCS, + %SNMP::Info::IEEE802dot3ad::FUNCS, i_duplex_admin => 'hh3cifEthernetDuplex', ); %MUNGE = ( %SNMP::Info::Layer3::MUNGE, %SNMP::Info::LLDP::MUNGE, + %SNMP::Info::IEEE802dot3ad::MUNGE, ); sub vendor { @@ -265,4 +267,8 @@ See documentation in L for details. See documentation in L for details. +=head2 Table Methods imported from SNMP::Info::IEEE802dot3ad + +See documentation in L for details. + =cut diff --git a/lib/SNMP/Info/Layer3/Huawei.pm b/lib/SNMP/Info/Layer3/Huawei.pm index 340c8d82..2765017d 100644 --- a/lib/SNMP/Info/Layer3/Huawei.pm +++ b/lib/SNMP/Info/Layer3/Huawei.pm @@ -1,6 +1,6 @@ # SNMP::Info::Layer3::Huawei # -# Copyright (c) 2015 Jeroen van Ingen +# Copyright (c) 2018 Jeroen van Ingen # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -64,11 +64,13 @@ $VERSION = '3.49'; %FUNCS = ( %SNMP::Info::Layer3::FUNCS, %SNMP::Info::LLDP::FUNCS, + %SNMP::Info::IEEE802dot3ad::FUNCS, ); %MUNGE = ( %SNMP::Info::Layer3::MUNGE, %SNMP::Info::LLDP::MUNGE, + %SNMP::Info::IEEE802dot3ad::MUNGE, ); sub vendor { @@ -229,4 +231,8 @@ See documentation in L for details. See documentation in L for details. +=head2 Table Methods imported from SNMP::Info::IEEE802dot3ad + +See documentation in L for details. + =cut diff --git a/lib/SNMP/Info/Layer3/VMware.pm b/lib/SNMP/Info/Layer3/VMware.pm index 933c1c10..4b3100b1 100644 --- a/lib/SNMP/Info/Layer3/VMware.pm +++ b/lib/SNMP/Info/Layer3/VMware.pm @@ -60,10 +60,12 @@ $VERSION = '3.49'; %FUNCS = ( %SNMP::Info::Layer3::FUNCS, + %SNMP::Info::IEEE802dot3ad::FUNCS, ); %MUNGE = ( %SNMP::Info::Layer3::MUNGE, + %SNMP::Info::IEEE802dot3ad::MUNGE, ); sub vendor { @@ -191,5 +193,8 @@ ifIndex of the corresponding master ports. See documentation in L for details. +=head2 Table Methods imported from SNMP::Info::IEEE802dot3ad + +See documentation in L for details. =cut