From 88295e8c1e16a4a141f956ef90a12507c3e69437 Mon Sep 17 00:00:00 2001 From: Oliver Gorwits Date: Thu, 27 Mar 2014 23:08:53 +0000 Subject: [PATCH] Cisco PAgP support added to LAG method Squashed commit of the following: commit 5cb2d637c7e990bbb8f789b6878f4bcb99778157 Author: Brian De Wolf Date: Wed Feb 26 18:31:22 2014 -0800 Implement agg_ports_pagp This function was a stub that is now filled out. Also filled out the function that merges PAgP and LAG groups and did minimal testing of the PAgP side (no LAG in use in my env). --- ChangeLog | 6 ++++++ Info/CiscoAgg.pm | 26 +++++++++++++++++++++++--- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6c7adc2a..ca49a1a7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ SNMP::Info - Friendly OO-style interface to Network devices using SNMP. +version 3.13 (2014-03-27) + + [ENHANCEMENTS] + + * Cisco PAgP support added to LAG method + version 3.12 (2014-02-10) [ENHANCEMENTS] diff --git a/Info/CiscoAgg.pm b/Info/CiscoAgg.pm index e9950d30..7a6b7693 100644 --- a/Info/CiscoAgg.pm +++ b/Info/CiscoAgg.pm @@ -56,11 +56,31 @@ $VERSION = '3.12'; %MUNGE = (); -# until someone using PAgP sends us a patch -sub agg_ports_pagp { {} } +sub agg_ports_pagp { + my $dev = shift; + + # Note that this mapping will miss any interfaces that are down during + # polling. If one of the members is up, we could use + # pagpAdminGroupCapability to figure things out, but if they're all + # down, we're hosed. Since we could be hosed anyway, we skip the fancy + # stuff. + my $mapping = {}; + my $group = $dev->pagpGroupIfIndex; + for my $slave (keys %$group) { + my $master = $group->{$slave}; + next if($master == 0 || $slave == $master); + + $mapping->{$slave} = $master; + } + + return $mapping; +} # until we have PAgP data and need to combine with LAG data -sub agg_ports { return agg_ports_lag(@_) } +sub agg_ports { + my $ret = {%{agg_ports_pagp(@_)}, %{agg_ports_lag(@_)}}; + return $ret; +} 1;