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
Showing
2 changed files
with
3 additions
and
3 deletions
... | @@ -81,7 +81,7 @@ public class LinkCollectionIntentCompiler | ... | @@ -81,7 +81,7 @@ public class LinkCollectionIntentCompiler |
81 | computePorts(intent, inputPorts, outputPorts); | 81 | computePorts(intent, inputPorts, outputPorts); |
82 | 82 | ||
83 | List<FlowRule> rules = new ArrayList<>(); | 83 | List<FlowRule> rules = new ArrayList<>(); |
84 | - for (DeviceId deviceId: outputPorts.keys()) { | 84 | + for (DeviceId deviceId: outputPorts.keySet()) { |
85 | rules.addAll(createRules(intent, deviceId, inputPorts.get(deviceId), outputPorts.get(deviceId))); | 85 | rules.addAll(createRules(intent, deviceId, inputPorts.get(deviceId), outputPorts.get(deviceId))); |
86 | } | 86 | } |
87 | return Collections.singletonList(new FlowRuleIntent(appId, rules, intent.resources())); | 87 | return Collections.singletonList(new FlowRuleIntent(appId, rules, intent.resources())); | ... | ... |
... | @@ -358,7 +358,7 @@ private final VlanId ingressVlan = VlanId.vlanId("10"); | ... | @@ -358,7 +358,7 @@ private final VlanId ingressVlan = VlanId.vlanId("10"); |
358 | assertThat(compiled, hasSize(1)); | 358 | assertThat(compiled, hasSize(1)); |
359 | 359 | ||
360 | Collection<FlowRule> rules = ((FlowRuleIntent) compiled.get(0)).flowRules(); | 360 | Collection<FlowRule> rules = ((FlowRuleIntent) compiled.get(0)).flowRules(); |
361 | - assertThat(rules, hasSize((linksMultiple.size() + intentMultipleTreatments.egressPoints().size()))); | 361 | + assertThat(rules, hasSize(2)); |
362 | 362 | ||
363 | Set<FlowRule> d3Rules = rules | 363 | Set<FlowRule> d3Rules = rules |
364 | .parallelStream() | 364 | .parallelStream() |
... | @@ -424,7 +424,7 @@ private final VlanId ingressVlan = VlanId.vlanId("10"); | ... | @@ -424,7 +424,7 @@ private final VlanId ingressVlan = VlanId.vlanId("10"); |
424 | 424 | ||
425 | 425 | ||
426 | Collection<FlowRule> rules = ((FlowRuleIntent) compiled.get(0)).flowRules(); | 426 | Collection<FlowRule> rules = ((FlowRuleIntent) compiled.get(0)).flowRules(); |
427 | - assertThat(rules, hasSize((linksMultiple2.size() + intentMultipleTreatments2.egressPoints().size()))); | 427 | + assertThat(rules, hasSize(4)); |
428 | 428 | ||
429 | 429 | ||
430 | Set<FlowRule> d2Rules = rules | 430 | Set<FlowRule> d2Rules = rules | ... | ... |
-
Please register or login to post a comment