alshabib
Committed by Gerrit Code Review

removing cookie generation from olt pipeline

Change-Id: Ib9bb69fcf5ac0dc603d033ba2cbb8c9127cc8b81
...@@ -73,7 +73,6 @@ import org.onosproject.net.group.GroupKey; ...@@ -73,7 +73,6 @@ import org.onosproject.net.group.GroupKey;
73 import org.onosproject.net.group.GroupListener; 73 import org.onosproject.net.group.GroupListener;
74 import org.onosproject.net.group.GroupService; 74 import org.onosproject.net.group.GroupService;
75 import org.onosproject.store.serializers.KryoNamespaces; 75 import org.onosproject.store.serializers.KryoNamespaces;
76 -import org.onosproject.store.service.AtomicCounter;
77 import org.onosproject.store.service.StorageService; 76 import org.onosproject.store.service.StorageService;
78 import org.slf4j.Logger; 77 import org.slf4j.Logger;
79 78
...@@ -105,9 +104,7 @@ public class OltPipeline extends AbstractHandlerBehaviour implements Pipeliner { ...@@ -105,9 +104,7 @@ public class OltPipeline extends AbstractHandlerBehaviour implements Pipeliner {
105 104
106 private DeviceId deviceId; 105 private DeviceId deviceId;
107 private ApplicationId appId; 106 private ApplicationId appId;
108 - // NOTE: OLT currently has some issue with cookie 0. Pick something larger 107 +
109 - // to avoid collision
110 - private AtomicCounter counter;
111 108
112 protected FlowObjectiveStore flowObjectiveStore; 109 protected FlowObjectiveStore flowObjectiveStore;
113 110
...@@ -133,18 +130,6 @@ public class OltPipeline extends AbstractHandlerBehaviour implements Pipeliner { ...@@ -133,18 +130,6 @@ public class OltPipeline extends AbstractHandlerBehaviour implements Pipeliner {
133 flowObjectiveStore = context.store(); 130 flowObjectiveStore = context.store();
134 storageService = serviceDirectory.get(StorageService.class); 131 storageService = serviceDirectory.get(StorageService.class);
135 132
136 - counter = storageService.atomicCounterBuilder()
137 - .withName(String.format(OLTCOOKIES, deviceId))
138 - .build()
139 - .asAtomicCounter();
140 -
141 - /*
142 - magic olt number to make sure we don't collide with it's internal
143 - processing
144 - */
145 - counter.set(123);
146 -
147 -
148 appId = coreService.registerApplication( 133 appId = coreService.registerApplication(
149 "org.onosproject.driver.OLTPipeline"); 134 "org.onosproject.driver.OLTPipeline");
150 135
...@@ -326,7 +311,7 @@ public class OltPipeline extends AbstractHandlerBehaviour implements Pipeliner { ...@@ -326,7 +311,7 @@ public class OltPipeline extends AbstractHandlerBehaviour implements Pipeliner {
326 buildTreatment(Instructions.createGroup(group.id())); 311 buildTreatment(Instructions.createGroup(group.id()));
327 312
328 FlowRule rule = DefaultFlowRule.builder() 313 FlowRule rule = DefaultFlowRule.builder()
329 - .withCookie(counter.getAndIncrement()) 314 + .fromApp(fwd.appId())
330 .forDevice(deviceId) 315 .forDevice(deviceId)
331 .forTable(0) 316 .forTable(0)
332 .makePermanent() 317 .makePermanent()
...@@ -407,7 +392,7 @@ public class OltPipeline extends AbstractHandlerBehaviour implements Pipeliner { ...@@ -407,7 +392,7 @@ public class OltPipeline extends AbstractHandlerBehaviour implements Pipeliner {
407 Criterion innerVid = Criteria.matchVlanId(((VlanIdCriterion) innerVlan).vlanId()); 392 Criterion innerVid = Criteria.matchVlanId(((VlanIdCriterion) innerVlan).vlanId());
408 393
409 FlowRule.Builder outer = DefaultFlowRule.builder() 394 FlowRule.Builder outer = DefaultFlowRule.builder()
410 - .withCookie(counter.getAndIncrement()) 395 + .fromApp(fwd.appId())
411 .forDevice(deviceId) 396 .forDevice(deviceId)
412 .makePermanent() 397 .makePermanent()
413 .withPriority(fwd.priority()) 398 .withPriority(fwd.priority())
...@@ -416,7 +401,7 @@ public class OltPipeline extends AbstractHandlerBehaviour implements Pipeliner { ...@@ -416,7 +401,7 @@ public class OltPipeline extends AbstractHandlerBehaviour implements Pipeliner {
416 Instructions.transition(QQ_TABLE))); 401 Instructions.transition(QQ_TABLE)));
417 402
418 FlowRule.Builder inner = DefaultFlowRule.builder() 403 FlowRule.Builder inner = DefaultFlowRule.builder()
419 - .withCookie(counter.getAndIncrement()) 404 + .fromApp(fwd.appId())
420 .forDevice(deviceId) 405 .forDevice(deviceId)
421 .forTable(QQ_TABLE) 406 .forTable(QQ_TABLE)
422 .makePermanent() 407 .makePermanent()
...@@ -449,7 +434,7 @@ public class OltPipeline extends AbstractHandlerBehaviour implements Pipeliner { ...@@ -449,7 +434,7 @@ public class OltPipeline extends AbstractHandlerBehaviour implements Pipeliner {
449 Pair<Instruction, Instruction> outerPair = vlanOps.remove(0); 434 Pair<Instruction, Instruction> outerPair = vlanOps.remove(0);
450 435
451 FlowRule.Builder inner = DefaultFlowRule.builder() 436 FlowRule.Builder inner = DefaultFlowRule.builder()
452 - .withCookie(counter.getAndIncrement()) 437 + .fromApp(fwd.appId())
453 .forDevice(deviceId) 438 .forDevice(deviceId)
454 .makePermanent() 439 .makePermanent()
455 .withPriority(fwd.priority()) 440 .withPriority(fwd.priority())
...@@ -464,7 +449,7 @@ public class OltPipeline extends AbstractHandlerBehaviour implements Pipeliner { ...@@ -464,7 +449,7 @@ public class OltPipeline extends AbstractHandlerBehaviour implements Pipeliner {
464 innerPair.getRight()).vlanId(); 449 innerPair.getRight()).vlanId();
465 450
466 FlowRule.Builder outer = DefaultFlowRule.builder() 451 FlowRule.Builder outer = DefaultFlowRule.builder()
467 - .withCookie(counter.getAndIncrement()) 452 + .fromApp(fwd.appId())
468 .forDevice(deviceId) 453 .forDevice(deviceId)
469 .forTable(QQ_TABLE) 454 .forTable(QQ_TABLE)
470 .makePermanent() 455 .makePermanent()
...@@ -560,7 +545,7 @@ public class OltPipeline extends AbstractHandlerBehaviour implements Pipeliner { ...@@ -560,7 +545,7 @@ public class OltPipeline extends AbstractHandlerBehaviour implements Pipeliner {
560 private void buildAndApplyRule(FilteringObjective filter, TrafficSelector selector, 545 private void buildAndApplyRule(FilteringObjective filter, TrafficSelector selector,
561 TrafficTreatment treatment) { 546 TrafficTreatment treatment) {
562 FlowRule rule = DefaultFlowRule.builder() 547 FlowRule rule = DefaultFlowRule.builder()
563 - .withCookie(counter.getAndIncrement()) 548 + .fromApp(filter.appId())
564 .forDevice(deviceId) 549 .forDevice(deviceId)
565 .forTable(0) 550 .forTable(0)
566 .makePermanent() 551 .makePermanent()
......