fix olt cookie issue
Change-Id: I25ce0b5fc9058195498aa407d01aef1fa78a95e4
diff --git a/apps/olt/app/src/main/java/org/onosproject/olt/impl/Olt.java b/apps/olt/app/src/main/java/org/onosproject/olt/impl/Olt.java
index ab03c0b..301039f 100644
--- a/apps/olt/app/src/main/java/org/onosproject/olt/impl/Olt.java
+++ b/apps/olt/app/src/main/java/org/onosproject/olt/impl/Olt.java
@@ -198,7 +198,7 @@
}
}
- @Override
+ @Override
public void provisionSubscriber(ConnectPoint port, VlanId vlan) {
AccessDeviceData olt = oltData.get(port.deviceId());
@@ -339,7 +339,6 @@
subscribers.put(cp, subscriberVlan);
objectives.put(cp, Sets.newHashSet(upFwd, downFwd));
-
flowObjectiveService.forward(deviceId, upFwd.add(new ObjectiveContext() {
@Override
public void onSuccess(Objective objective) {
@@ -352,7 +351,6 @@
}
}));
-
flowObjectiveService.forward(deviceId, downFwd.add(new ObjectiveContext() {
@Override
public void onSuccess(Objective objective) {
diff --git a/drivers/default/src/main/java/org/onosproject/driver/pipeline/OltPipeline.java b/drivers/default/src/main/java/org/onosproject/driver/pipeline/OltPipeline.java
index b781732..2dcdec7 100644
--- a/drivers/default/src/main/java/org/onosproject/driver/pipeline/OltPipeline.java
+++ b/drivers/default/src/main/java/org/onosproject/driver/pipeline/OltPipeline.java
@@ -80,6 +80,7 @@
import java.util.List;
import java.util.Optional;
import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicLong;
import java.util.stream.Collectors;
import static org.slf4j.LoggerFactory.getLogger;
@@ -102,6 +103,7 @@
private DeviceId deviceId;
private ApplicationId appId;
private IpPrefix mcastPrefix = IpPrefix.valueOf("224.0.0.0/4");
+ private AtomicLong counter = new AtomicLong(123);
protected FlowObjectiveStore flowObjectiveStore;
@@ -257,7 +259,6 @@
GroupKey key = new DefaultGroupKey(appKryo.serialize(nextObjective.id()));
-
pendingGroups.put(key, nextObjective);
switch (nextObjective.op()) {
@@ -281,8 +282,8 @@
break;
case REMOVE_FROM_EXISTING:
groupService.removeBucketsFromGroup(deviceId, key,
- new GroupBuckets(Collections.singletonList(bucket)),
- key, nextObjective.appId());
+ new GroupBuckets(Collections.singletonList(bucket)),
+ key, nextObjective.appId());
break;
default:
log.warn("Unknown next objective operation: {}", nextObjective.op());
@@ -309,9 +310,9 @@
buildTreatment(Instructions.createGroup(group.id()));
FlowRule rule = DefaultFlowRule.builder()
+ .withCookie(counter.getAndIncrement())
.forDevice(deviceId)
.forTable(0)
- .fromApp(fwd.appId())
.makePermanent()
.withPriority(fwd.priority())
.withSelector(fwd.selector())
@@ -341,7 +342,7 @@
private boolean checkForMulticast(ForwardingObjective fwd) {
IPCriterion ip = (IPCriterion) filterForCriterion(fwd.selector().criteria(),
- Criterion.Type.IPV4_DST);
+ Criterion.Type.IPV4_DST);
if (ip == null) {
return false;
@@ -389,8 +390,8 @@
Criterion innerVid = Criteria.matchVlanId(((VlanIdCriterion) innerVlan).vlanId());
FlowRule.Builder outer = DefaultFlowRule.builder()
+ .withCookie(counter.getAndIncrement())
.forDevice(deviceId)
- .fromApp(appId)
.makePermanent()
.withPriority(fwd.priority())
.withSelector(buildSelector(inport, outerVlan))
@@ -398,8 +399,8 @@
Instructions.transition(QQ_TABLE)));
FlowRule.Builder inner = DefaultFlowRule.builder()
+ .withCookie(counter.getAndIncrement())
.forDevice(deviceId)
- .fromApp(appId)
.forTable(QQ_TABLE)
.makePermanent()
.withPriority(fwd.priority())
@@ -431,8 +432,8 @@
Pair<Instruction, Instruction> outerPair = vlanOps.remove(0);
FlowRule.Builder inner = DefaultFlowRule.builder()
+ .withCookie(counter.getAndIncrement())
.forDevice(deviceId)
- .fromApp(appId)
.makePermanent()
.withPriority(fwd.priority())
.withSelector(fwd.selector())
@@ -446,8 +447,8 @@
innerPair.getRight()).vlanId();
FlowRule.Builder outer = DefaultFlowRule.builder()
+ .withCookie(counter.getAndIncrement())
.forDevice(deviceId)
- .fromApp(appId)
.forTable(QQ_TABLE)
.makePermanent()
.withPriority(fwd.priority())
@@ -542,9 +543,9 @@
private void buildAndApplyRule(FilteringObjective filter, TrafficSelector selector,
TrafficTreatment treatment) {
FlowRule rule = DefaultFlowRule.builder()
+ .withCookie(counter.getAndIncrement())
.forDevice(deviceId)
.forTable(0)
- .fromApp(filter.appId())
.makePermanent()
.withSelector(selector)
.withTreatment(treatment)