Committed by
Gerrit Code Review
Adding support to remove a subscriber.
And fixing an issue where build on a flowrule could not be called repeatedly. Change-Id: I85773ac7a3fb4f2970b63599d1eafbfc8b3c5879
Showing
2 changed files
with
6 additions
and
9 deletions
... | @@ -364,6 +364,7 @@ public class DefaultFlowRule implements FlowRule { | ... | @@ -364,6 +364,7 @@ public class DefaultFlowRule implements FlowRule { |
364 | 364 | ||
365 | @Override | 365 | @Override |
366 | public FlowRule build() { | 366 | public FlowRule build() { |
367 | + FlowId localFlowId; | ||
367 | checkArgument((flowId != null) ^ (appId != null), "Either an application" + | 368 | checkArgument((flowId != null) ^ (appId != null), "Either an application" + |
368 | " id or a cookie must be supplied"); | 369 | " id or a cookie must be supplied"); |
369 | checkNotNull(selector, "Traffic selector cannot be null"); | 370 | checkNotNull(selector, "Traffic selector cannot be null"); |
... | @@ -377,11 +378,13 @@ public class DefaultFlowRule implements FlowRule { | ... | @@ -377,11 +378,13 @@ public class DefaultFlowRule implements FlowRule { |
377 | // Computing a flow ID based on appId takes precedence over setting | 378 | // Computing a flow ID based on appId takes precedence over setting |
378 | // the flow ID directly | 379 | // the flow ID directly |
379 | if (appId != null) { | 380 | if (appId != null) { |
380 | - flowId = computeFlowId(appId); | 381 | + localFlowId = computeFlowId(appId); |
382 | + } else { | ||
383 | + localFlowId = flowId; | ||
381 | } | 384 | } |
382 | 385 | ||
383 | return new DefaultFlowRule(deviceId, selector, treatment, priority, | 386 | return new DefaultFlowRule(deviceId, selector, treatment, priority, |
384 | - flowId, permanent, timeout, tableId); | 387 | + localFlowId, permanent, timeout, tableId); |
385 | } | 388 | } |
386 | 389 | ||
387 | private FlowId computeFlowId(ApplicationId appId) { | 390 | private FlowId computeFlowId(ApplicationId appId) { | ... | ... |
... | @@ -38,7 +38,6 @@ import org.onosproject.net.driver.AbstractHandlerBehaviour; | ... | @@ -38,7 +38,6 @@ import org.onosproject.net.driver.AbstractHandlerBehaviour; |
38 | import org.onosproject.net.flow.DefaultFlowRule; | 38 | import org.onosproject.net.flow.DefaultFlowRule; |
39 | import org.onosproject.net.flow.DefaultTrafficSelector; | 39 | import org.onosproject.net.flow.DefaultTrafficSelector; |
40 | import org.onosproject.net.flow.DefaultTrafficTreatment; | 40 | import org.onosproject.net.flow.DefaultTrafficTreatment; |
41 | -import org.onosproject.net.flow.FlowEntry; | ||
42 | import org.onosproject.net.flow.FlowRule; | 41 | import org.onosproject.net.flow.FlowRule; |
43 | import org.onosproject.net.flow.FlowRuleOperations; | 42 | import org.onosproject.net.flow.FlowRuleOperations; |
44 | import org.onosproject.net.flow.FlowRuleOperationsContext; | 43 | import org.onosproject.net.flow.FlowRuleOperationsContext; |
... | @@ -579,12 +578,7 @@ public class OltPipeline extends AbstractHandlerBehaviour implements Pipeliner { | ... | @@ -579,12 +578,7 @@ public class OltPipeline extends AbstractHandlerBehaviour implements Pipeliner { |
579 | builder.add(inner.build()).add(outer.build()); | 578 | builder.add(inner.build()).add(outer.build()); |
580 | break; | 579 | break; |
581 | case REMOVE: | 580 | case REMOVE: |
582 | - Iterable<FlowEntry> flows = flowRuleService.getFlowEntries(deviceId); | 581 | + builder.remove(inner.build()).remove(outer.build()); |
583 | - for (FlowEntry fe : flows) { | ||
584 | - if (fe.equals(inner.build()) || fe.equals(outer.build())) { | ||
585 | - builder.remove(fe); | ||
586 | - } | ||
587 | - } | ||
588 | break; | 582 | break; |
589 | case ADD_TO_EXISTING: | 583 | case ADD_TO_EXISTING: |
590 | break; | 584 | break; | ... | ... |
-
Please register or login to post a comment