Yi Tseng
Committed by Gerrit Code Review

Fix LinkCollectionCompiler duplicate flow rules problem

Use outputPorts.keys() might generate duplicate flow rules.
Use keySet() can fix this problem.

Change-Id: I8c1c47ccb8835c174b639cf4a5e94c1c1b36484d
(cherry picked from commit 155370e9)
......@@ -81,7 +81,7 @@ public class LinkCollectionIntentCompiler
computePorts(intent, inputPorts, outputPorts);
List<FlowRule> rules = new ArrayList<>();
for (DeviceId deviceId: outputPorts.keys()) {
for (DeviceId deviceId: outputPorts.keySet()) {
rules.addAll(createRules(intent, deviceId, inputPorts.get(deviceId), outputPorts.get(deviceId)));
}
return Collections.singletonList(new FlowRuleIntent(appId, rules, intent.resources()));
......
......@@ -358,7 +358,7 @@ private final VlanId ingressVlan = VlanId.vlanId("10");
assertThat(compiled, hasSize(1));
Collection<FlowRule> rules = ((FlowRuleIntent) compiled.get(0)).flowRules();
assertThat(rules, hasSize((linksMultiple.size() + intentMultipleTreatments.egressPoints().size())));
assertThat(rules, hasSize(2));
Set<FlowRule> d3Rules = rules
.parallelStream()
......@@ -424,7 +424,7 @@ private final VlanId ingressVlan = VlanId.vlanId("10");
Collection<FlowRule> rules = ((FlowRuleIntent) compiled.get(0)).flowRules();
assertThat(rules, hasSize((linksMultiple2.size() + intentMultipleTreatments2.egressPoints().size())));
assertThat(rules, hasSize(4));
Set<FlowRule> d2Rules = rules
......