Fix the logic of deleting FIB entries in CorsaPipeline
Change-Id: I9fe3545fe29225d82a5c3e6b5ffc295565218ecb
diff --git a/drivers/src/main/java/org/onosproject/driver/pipeline/OVSCorsaPipeline.java b/drivers/src/main/java/org/onosproject/driver/pipeline/OVSCorsaPipeline.java
index a92dbe1..1620c33 100644
--- a/drivers/src/main/java/org/onosproject/driver/pipeline/OVSCorsaPipeline.java
+++ b/drivers/src/main/java/org/onosproject/driver/pipeline/OVSCorsaPipeline.java
@@ -317,28 +317,26 @@
selector.getCriterion(Criterion.Type.IPV4_DST)).ip())
.build();
- NextGroup next = flowObjectiveStore.getNextGroup(fwd.nextId());
+ TrafficTreatment.Builder tb = DefaultTrafficTreatment.builder();
- GroupKey key = appKryo.deserialize(next.data());
-
- Group group = groupService.getGroup(deviceId, key);
-
- if (group == null) {
- log.warn("The group left!");
- fail(fwd, ObjectiveError.GROUPMISSING);
- return Collections.emptySet();
+ if (fwd.nextId() != null) {
+ NextGroup next = flowObjectiveStore.getNextGroup(fwd.nextId());
+ GroupKey key = appKryo.deserialize(next.data());
+ Group group = groupService.getGroup(deviceId, key);
+ if (group == null) {
+ log.warn("The group left!");
+ fail(fwd, ObjectiveError.GROUPMISSING);
+ return Collections.emptySet();
+ }
+ tb.group(group.id());
}
- TrafficTreatment treatment = DefaultTrafficTreatment.builder()
- .group(group.id())
- .build();
-
FlowRule.Builder ruleBuilder = DefaultFlowRule.builder()
.fromApp(fwd.appId())
.withPriority(fwd.priority())
.forDevice(deviceId)
.withSelector(filteredSelector)
- .withTreatment(treatment);
+ .withTreatment(tb.build());
if (fwd.permanent()) {
ruleBuilder.makePermanent();