Commit 4b620589 authored by Weibin Sun's avatar Weibin Sun
Browse files

add uniq_ports to make ports unique

parent b422d288
......@@ -1197,7 +1197,7 @@ sub mapVlansToSwitches(@)
# This code is lifted from setPortVlan() in snmpit_stack.pm
#
foreach my $vlan_id (@vlan_ids) {
my @ports = uniq(getVlanPorts($vlan_id),
my @ports = uniq_ports(getVlanPorts($vlan_id),
getExperimentVlanPorts($vlan_id));
my @devices = mapPortsToSwitches(@ports);
......@@ -1739,6 +1739,22 @@ sub uniq(@) {
return keys %elts;
}
#
# uniq for ports
#
sub uniq_ports(@) {
my %elts;
my @pts;
foreach my $p (@_) {
if (!exists($elts{$p->toString()})) {
$elts{$p->toString()} = 1;
push @pts, $p;
}
}
return @pts;
}
# End with true
1;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment