Committed by
Gerrit Code Review
fix olt cookie issue
Change-Id: I25ce0b5fc9058195498aa407d01aef1fa78a95e4
Showing
2 changed files
with
8 additions
and
9 deletions
| ... | @@ -339,7 +339,6 @@ public class Olt | ... | @@ -339,7 +339,6 @@ public class Olt |
| 339 | subscribers.put(cp, subscriberVlan); | 339 | subscribers.put(cp, subscriberVlan); |
| 340 | objectives.put(cp, Sets.newHashSet(upFwd, downFwd)); | 340 | objectives.put(cp, Sets.newHashSet(upFwd, downFwd)); |
| 341 | 341 | ||
| 342 | - | ||
| 343 | flowObjectiveService.forward(deviceId, upFwd.add(new ObjectiveContext() { | 342 | flowObjectiveService.forward(deviceId, upFwd.add(new ObjectiveContext() { |
| 344 | @Override | 343 | @Override |
| 345 | public void onSuccess(Objective objective) { | 344 | public void onSuccess(Objective objective) { |
| ... | @@ -352,7 +351,6 @@ public class Olt | ... | @@ -352,7 +351,6 @@ public class Olt |
| 352 | } | 351 | } |
| 353 | })); | 352 | })); |
| 354 | 353 | ||
| 355 | - | ||
| 356 | flowObjectiveService.forward(deviceId, downFwd.add(new ObjectiveContext() { | 354 | flowObjectiveService.forward(deviceId, downFwd.add(new ObjectiveContext() { |
| 357 | @Override | 355 | @Override |
| 358 | public void onSuccess(Objective objective) { | 356 | public void onSuccess(Objective objective) { | ... | ... |
| ... | @@ -80,6 +80,7 @@ import java.util.Collections; | ... | @@ -80,6 +80,7 @@ import java.util.Collections; |
| 80 | import java.util.List; | 80 | import java.util.List; |
| 81 | import java.util.Optional; | 81 | import java.util.Optional; |
| 82 | import java.util.concurrent.TimeUnit; | 82 | import java.util.concurrent.TimeUnit; |
| 83 | +import java.util.concurrent.atomic.AtomicLong; | ||
| 83 | import java.util.stream.Collectors; | 84 | import java.util.stream.Collectors; |
| 84 | 85 | ||
| 85 | import static org.slf4j.LoggerFactory.getLogger; | 86 | import static org.slf4j.LoggerFactory.getLogger; |
| ... | @@ -102,6 +103,7 @@ public class OltPipeline extends AbstractHandlerBehaviour implements Pipeliner { | ... | @@ -102,6 +103,7 @@ public class OltPipeline extends AbstractHandlerBehaviour implements Pipeliner { |
| 102 | private DeviceId deviceId; | 103 | private DeviceId deviceId; |
| 103 | private ApplicationId appId; | 104 | private ApplicationId appId; |
| 104 | private IpPrefix mcastPrefix = IpPrefix.valueOf("224.0.0.0/4"); | 105 | private IpPrefix mcastPrefix = IpPrefix.valueOf("224.0.0.0/4"); |
| 106 | + private AtomicLong counter = new AtomicLong(123); | ||
| 105 | 107 | ||
| 106 | protected FlowObjectiveStore flowObjectiveStore; | 108 | protected FlowObjectiveStore flowObjectiveStore; |
| 107 | 109 | ||
| ... | @@ -257,7 +259,6 @@ public class OltPipeline extends AbstractHandlerBehaviour implements Pipeliner { | ... | @@ -257,7 +259,6 @@ public class OltPipeline extends AbstractHandlerBehaviour implements Pipeliner { |
| 257 | GroupKey key = new DefaultGroupKey(appKryo.serialize(nextObjective.id())); | 259 | GroupKey key = new DefaultGroupKey(appKryo.serialize(nextObjective.id())); |
| 258 | 260 | ||
| 259 | 261 | ||
| 260 | - | ||
| 261 | pendingGroups.put(key, nextObjective); | 262 | pendingGroups.put(key, nextObjective); |
| 262 | 263 | ||
| 263 | switch (nextObjective.op()) { | 264 | switch (nextObjective.op()) { |
| ... | @@ -309,9 +310,9 @@ public class OltPipeline extends AbstractHandlerBehaviour implements Pipeliner { | ... | @@ -309,9 +310,9 @@ public class OltPipeline extends AbstractHandlerBehaviour implements Pipeliner { |
| 309 | buildTreatment(Instructions.createGroup(group.id())); | 310 | buildTreatment(Instructions.createGroup(group.id())); |
| 310 | 311 | ||
| 311 | FlowRule rule = DefaultFlowRule.builder() | 312 | FlowRule rule = DefaultFlowRule.builder() |
| 313 | + .withCookie(counter.getAndIncrement()) | ||
| 312 | .forDevice(deviceId) | 314 | .forDevice(deviceId) |
| 313 | .forTable(0) | 315 | .forTable(0) |
| 314 | - .fromApp(fwd.appId()) | ||
| 315 | .makePermanent() | 316 | .makePermanent() |
| 316 | .withPriority(fwd.priority()) | 317 | .withPriority(fwd.priority()) |
| 317 | .withSelector(fwd.selector()) | 318 | .withSelector(fwd.selector()) |
| ... | @@ -389,8 +390,8 @@ public class OltPipeline extends AbstractHandlerBehaviour implements Pipeliner { | ... | @@ -389,8 +390,8 @@ public class OltPipeline extends AbstractHandlerBehaviour implements Pipeliner { |
| 389 | Criterion innerVid = Criteria.matchVlanId(((VlanIdCriterion) innerVlan).vlanId()); | 390 | Criterion innerVid = Criteria.matchVlanId(((VlanIdCriterion) innerVlan).vlanId()); |
| 390 | 391 | ||
| 391 | FlowRule.Builder outer = DefaultFlowRule.builder() | 392 | FlowRule.Builder outer = DefaultFlowRule.builder() |
| 393 | + .withCookie(counter.getAndIncrement()) | ||
| 392 | .forDevice(deviceId) | 394 | .forDevice(deviceId) |
| 393 | - .fromApp(appId) | ||
| 394 | .makePermanent() | 395 | .makePermanent() |
| 395 | .withPriority(fwd.priority()) | 396 | .withPriority(fwd.priority()) |
| 396 | .withSelector(buildSelector(inport, outerVlan)) | 397 | .withSelector(buildSelector(inport, outerVlan)) |
| ... | @@ -398,8 +399,8 @@ public class OltPipeline extends AbstractHandlerBehaviour implements Pipeliner { | ... | @@ -398,8 +399,8 @@ public class OltPipeline extends AbstractHandlerBehaviour implements Pipeliner { |
| 398 | Instructions.transition(QQ_TABLE))); | 399 | Instructions.transition(QQ_TABLE))); |
| 399 | 400 | ||
| 400 | FlowRule.Builder inner = DefaultFlowRule.builder() | 401 | FlowRule.Builder inner = DefaultFlowRule.builder() |
| 402 | + .withCookie(counter.getAndIncrement()) | ||
| 401 | .forDevice(deviceId) | 403 | .forDevice(deviceId) |
| 402 | - .fromApp(appId) | ||
| 403 | .forTable(QQ_TABLE) | 404 | .forTable(QQ_TABLE) |
| 404 | .makePermanent() | 405 | .makePermanent() |
| 405 | .withPriority(fwd.priority()) | 406 | .withPriority(fwd.priority()) |
| ... | @@ -431,8 +432,8 @@ public class OltPipeline extends AbstractHandlerBehaviour implements Pipeliner { | ... | @@ -431,8 +432,8 @@ public class OltPipeline extends AbstractHandlerBehaviour implements Pipeliner { |
| 431 | Pair<Instruction, Instruction> outerPair = vlanOps.remove(0); | 432 | Pair<Instruction, Instruction> outerPair = vlanOps.remove(0); |
| 432 | 433 | ||
| 433 | FlowRule.Builder inner = DefaultFlowRule.builder() | 434 | FlowRule.Builder inner = DefaultFlowRule.builder() |
| 435 | + .withCookie(counter.getAndIncrement()) | ||
| 434 | .forDevice(deviceId) | 436 | .forDevice(deviceId) |
| 435 | - .fromApp(appId) | ||
| 436 | .makePermanent() | 437 | .makePermanent() |
| 437 | .withPriority(fwd.priority()) | 438 | .withPriority(fwd.priority()) |
| 438 | .withSelector(fwd.selector()) | 439 | .withSelector(fwd.selector()) |
| ... | @@ -446,8 +447,8 @@ public class OltPipeline extends AbstractHandlerBehaviour implements Pipeliner { | ... | @@ -446,8 +447,8 @@ public class OltPipeline extends AbstractHandlerBehaviour implements Pipeliner { |
| 446 | innerPair.getRight()).vlanId(); | 447 | innerPair.getRight()).vlanId(); |
| 447 | 448 | ||
| 448 | FlowRule.Builder outer = DefaultFlowRule.builder() | 449 | FlowRule.Builder outer = DefaultFlowRule.builder() |
| 450 | + .withCookie(counter.getAndIncrement()) | ||
| 449 | .forDevice(deviceId) | 451 | .forDevice(deviceId) |
| 450 | - .fromApp(appId) | ||
| 451 | .forTable(QQ_TABLE) | 452 | .forTable(QQ_TABLE) |
| 452 | .makePermanent() | 453 | .makePermanent() |
| 453 | .withPriority(fwd.priority()) | 454 | .withPriority(fwd.priority()) |
| ... | @@ -542,9 +543,9 @@ public class OltPipeline extends AbstractHandlerBehaviour implements Pipeliner { | ... | @@ -542,9 +543,9 @@ public class OltPipeline extends AbstractHandlerBehaviour implements Pipeliner { |
| 542 | private void buildAndApplyRule(FilteringObjective filter, TrafficSelector selector, | 543 | private void buildAndApplyRule(FilteringObjective filter, TrafficSelector selector, |
| 543 | TrafficTreatment treatment) { | 544 | TrafficTreatment treatment) { |
| 544 | FlowRule rule = DefaultFlowRule.builder() | 545 | FlowRule rule = DefaultFlowRule.builder() |
| 546 | + .withCookie(counter.getAndIncrement()) | ||
| 545 | .forDevice(deviceId) | 547 | .forDevice(deviceId) |
| 546 | .forTable(0) | 548 | .forTable(0) |
| 547 | - .fromApp(filter.appId()) | ||
| 548 | .makePermanent() | 549 | .makePermanent() |
| 549 | .withSelector(selector) | 550 | .withSelector(selector) |
| 550 | .withTreatment(treatment) | 551 | .withTreatment(treatment) | ... | ... |
-
Please register or login to post a comment