Fix the logic of deleting FIB entries in CorsaPipeline
Change-Id: I9fe3545fe29225d82a5c3e6b5ffc295565218ecb
diff --git a/apps/bgprouter/src/main/java/org/onosproject/bgprouter/BgpRouter.java b/apps/bgprouter/src/main/java/org/onosproject/bgprouter/BgpRouter.java
index 1c02578..44d6640 100644
--- a/apps/bgprouter/src/main/java/org/onosproject/bgprouter/BgpRouter.java
+++ b/apps/bgprouter/src/main/java/org/onosproject/bgprouter/BgpRouter.java
@@ -27,11 +27,8 @@
import org.apache.felix.scr.annotations.Reference;
import org.apache.felix.scr.annotations.ReferenceCardinality;
import org.onlab.packet.Ethernet;
-import org.onlab.packet.Ip4Address;
-import org.onlab.packet.Ip4Prefix;
import org.onlab.packet.IpAddress;
import org.onlab.packet.IpPrefix;
-import org.onlab.packet.MacAddress;
import org.onosproject.config.NetworkConfigService;
import org.onosproject.core.ApplicationId;
import org.onosproject.core.CoreService;
@@ -66,13 +63,10 @@
import org.slf4j.LoggerFactory;
import java.util.Collection;
-import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
-import static org.onlab.util.Tools.delay;
-
/**
* BgpRouter component.
*/
@@ -226,7 +220,7 @@
for (FibUpdate update : withdraws) {
FibEntry entry = update.entry();
- Integer nextId = nextHops.get(entry.nextHopIp());
+ //Integer nextId = nextHops.get(entry.nextHopIp());
/* Group group = deleteNextHop(entry.prefix());
if (group == null) {
@@ -235,7 +229,7 @@
}*/
flowObjectiveService.forward(deviceId,
- generateRibForwardingObj(entry.prefix(), nextId).remove());
+ generateRibForwardingObj(entry.prefix(), null).remove());
}
@@ -253,11 +247,15 @@
ForwardingObjective.Builder fwdBuilder = DefaultForwardingObjective.builder()
.fromApp(appId)
.makePermanent()
- .nextStep(nextId)
.withSelector(selector)
.withPriority(priority)
.withFlag(ForwardingObjective.Flag.SPECIFIC);
+ if (nextId == null) {
+ fwdBuilder.withTreatment(DefaultTrafficTreatment.builder().build());
+ } else {
+ fwdBuilder.nextStep(nextId);
+ }
return fwdBuilder;
}
@@ -384,13 +382,14 @@
if (event.subject().id().equals(deviceId)) {
processIntfFilters(true, configService.getInterfaces());
- /* For test only - will be removed before Cardinal release */
+ /* For test only - will be removed before Cardinal release
delay(1000);
FibEntry fibEntry = new FibEntry(Ip4Prefix.valueOf("10.1.0.0/16"),
Ip4Address.valueOf("192.168.10.1"),
MacAddress.valueOf("DE:AD:BE:EF:FE:ED"));
FibUpdate fibUpdate = new FibUpdate(FibUpdate.Type.UPDATE, fibEntry);
updateFibEntry(Collections.singletonList(fibUpdate));
+ */
}
if (event.subject().id().equals(ctrlDeviceId)) {
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();