Squashed commit of the following:

commit 9be20cd3e24b401d5bfeb2bcb40d61a7b33ffe2c
Author: Eric A. Miller <emiller@cpan.org>
Date:   Sun Jan 19 10:13:41 2014 -0500

    Re-organize part 2

commit 058fc6e000a27b8ffadf5857078e0ab1569d3fa2
Author: Eric A. Miller <emiller@cpan.org>
Date:   Sun Jan 19 10:08:31 2014 -0500

    Re-organize

commit 04f4602d6cf06f917bd4f19db737f877a46fd28e
Author: Eric A. Miller <emiller@cpan.org>
Date:   Sun Jan 19 10:04:09 2014 -0500

    Add MLT agg_ports() support for Avaya

commit 2cdc3aed77f551e3c6d04f4cfe390a876010ebcb
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Sun Jan 12 14:24:38 2014 +0000

    implement LAG support for Foundry

commit 7465816b53981f3211bdeb5a7a414d5a4e65c79f
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Sun Jan 12 13:15:13 2014 +0000

    implement LAG support for Arista

commit 67e8f13f635f4fb450ab5df6e9145830ef72cf7b
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Sun Jan 12 12:59:09 2014 +0000

    update gitignore to ignore SNMP dir

commit df4ca0eb44a4f0e5aa114630f0d22b5c9d7861f3
Author: Oliver Gorwits <oliver@cpan.org>
Date:   Sun Jan 12 12:49:53 2014 +0000

    implement LAG support for Cisco
This commit is contained in:
Eric A. Miller
2014-01-19 10:25:41 -05:00
parent 6b49bfd4c4
commit 31a8abc3b8
9 changed files with 526 additions and 5 deletions

View File

@@ -148,6 +148,11 @@ $VERSION = '3.10';
'rc2k_mda_part' => 'rc2kMdaCardPartNumber',
'rc2k_mda_date' => 'rc2kMdaCardDateCode',
'rc2k_mda_dev' => 'rc2kMdaCardDeviations',
# From RAPID-CITY::rcMltTable
'rc_mlt_ports' => 'rcMltPortMembers',
'rc_mlt_index' => 'rcMltIfIndex',
'rc_mlt_dp' => 'rcMltDesignatedPort',
);
%MUNGE = (
@@ -156,6 +161,7 @@ $VERSION = '3.10';
'rc_cpu_mac' => \&SNMP::Info::munge_mac,
'rc_vlan_members' => \&SNMP::Info::munge_port_list,
'rc_vlan_no_join' => \&SNMP::Info::munge_port_list,
'rc_mlt_ports' => \&SNMP::Info::munge_port_list,
);
# Need to override here since overridden in Layer2 and Layer3 classes
@@ -566,6 +572,35 @@ sub _validate_vlan_param {
return 1;
}
sub agg_ports {
my $rapidcity = shift;
# TODO: implement partial
my $ports = $rapidcity->rc_mlt_ports;
my $trunks = $rapidcity->rc_mlt_index;
my $dps = $rapidcity->rc_mlt_dp || {};
return {}
unless ref {} eq ref $trunks
and scalar keys %$trunks
and ref {} eq ref $ports
and scalar keys %$ports;
my $ret = {};
foreach my $m ( keys %$trunks ) {
my $idx = $trunks->{$m};
next unless $idx;
$idx = $dps->{$m} ? $dps->{$m} : $idx;
my $portlist = $ports->{$m};
next unless $portlist;
for ( my $i = 0; $i <= scalar(@$portlist); $i++ ) {
$ret->{$i} = $idx if ( @$portlist[$i] );
}
}
return $ret;
}
1;
__END__
@@ -717,6 +752,12 @@ Returns VLAN IDs
(C<rcVlanId>)
=item $rapidcity->agg_ports()
Returns a HASH reference mapping from slave to master port for each member of
a port bundle (MLT) on the device. Keys are ifIndex of the slave ports,
Values are ifIndex of the corresponding master ports.
=back
=head2 RAPID-CITY Port Table (C<rcPortTable>)