Committed by
Gerrit Code Review
Fix the logic of deleting FIB entries in CorsaPipeline
Change-Id: I9fe3545fe29225d82a5c3e6b5ffc295565218ecb
Showing
2 changed files
with
22 additions
and
25 deletions
| ... | @@ -27,11 +27,8 @@ import org.apache.felix.scr.annotations.Deactivate; | ... | @@ -27,11 +27,8 @@ import org.apache.felix.scr.annotations.Deactivate; |
| 27 | import org.apache.felix.scr.annotations.Reference; | 27 | import org.apache.felix.scr.annotations.Reference; |
| 28 | import org.apache.felix.scr.annotations.ReferenceCardinality; | 28 | import org.apache.felix.scr.annotations.ReferenceCardinality; |
| 29 | import org.onlab.packet.Ethernet; | 29 | import org.onlab.packet.Ethernet; |
| 30 | -import org.onlab.packet.Ip4Address; | ||
| 31 | -import org.onlab.packet.Ip4Prefix; | ||
| 32 | import org.onlab.packet.IpAddress; | 30 | import org.onlab.packet.IpAddress; |
| 33 | import org.onlab.packet.IpPrefix; | 31 | import org.onlab.packet.IpPrefix; |
| 34 | -import org.onlab.packet.MacAddress; | ||
| 35 | import org.onosproject.config.NetworkConfigService; | 32 | import org.onosproject.config.NetworkConfigService; |
| 36 | import org.onosproject.core.ApplicationId; | 33 | import org.onosproject.core.ApplicationId; |
| 37 | import org.onosproject.core.CoreService; | 34 | import org.onosproject.core.CoreService; |
| ... | @@ -66,13 +63,10 @@ import org.slf4j.Logger; | ... | @@ -66,13 +63,10 @@ import org.slf4j.Logger; |
| 66 | import org.slf4j.LoggerFactory; | 63 | import org.slf4j.LoggerFactory; |
| 67 | 64 | ||
| 68 | import java.util.Collection; | 65 | import java.util.Collection; |
| 69 | -import java.util.Collections; | ||
| 70 | import java.util.HashMap; | 66 | import java.util.HashMap; |
| 71 | import java.util.Map; | 67 | import java.util.Map; |
| 72 | import java.util.Set; | 68 | import java.util.Set; |
| 73 | 69 | ||
| 74 | -import static org.onlab.util.Tools.delay; | ||
| 75 | - | ||
| 76 | /** | 70 | /** |
| 77 | * BgpRouter component. | 71 | * BgpRouter component. |
| 78 | */ | 72 | */ |
| ... | @@ -226,7 +220,7 @@ public class BgpRouter { | ... | @@ -226,7 +220,7 @@ public class BgpRouter { |
| 226 | 220 | ||
| 227 | for (FibUpdate update : withdraws) { | 221 | for (FibUpdate update : withdraws) { |
| 228 | FibEntry entry = update.entry(); | 222 | FibEntry entry = update.entry(); |
| 229 | - Integer nextId = nextHops.get(entry.nextHopIp()); | 223 | + //Integer nextId = nextHops.get(entry.nextHopIp()); |
| 230 | 224 | ||
| 231 | /* Group group = deleteNextHop(entry.prefix()); | 225 | /* Group group = deleteNextHop(entry.prefix()); |
| 232 | if (group == null) { | 226 | if (group == null) { |
| ... | @@ -235,7 +229,7 @@ public class BgpRouter { | ... | @@ -235,7 +229,7 @@ public class BgpRouter { |
| 235 | }*/ | 229 | }*/ |
| 236 | 230 | ||
| 237 | flowObjectiveService.forward(deviceId, | 231 | flowObjectiveService.forward(deviceId, |
| 238 | - generateRibForwardingObj(entry.prefix(), nextId).remove()); | 232 | + generateRibForwardingObj(entry.prefix(), null).remove()); |
| 239 | 233 | ||
| 240 | } | 234 | } |
| 241 | 235 | ||
| ... | @@ -253,11 +247,15 @@ public class BgpRouter { | ... | @@ -253,11 +247,15 @@ public class BgpRouter { |
| 253 | ForwardingObjective.Builder fwdBuilder = DefaultForwardingObjective.builder() | 247 | ForwardingObjective.Builder fwdBuilder = DefaultForwardingObjective.builder() |
| 254 | .fromApp(appId) | 248 | .fromApp(appId) |
| 255 | .makePermanent() | 249 | .makePermanent() |
| 256 | - .nextStep(nextId) | ||
| 257 | .withSelector(selector) | 250 | .withSelector(selector) |
| 258 | .withPriority(priority) | 251 | .withPriority(priority) |
| 259 | .withFlag(ForwardingObjective.Flag.SPECIFIC); | 252 | .withFlag(ForwardingObjective.Flag.SPECIFIC); |
| 260 | 253 | ||
| 254 | + if (nextId == null) { | ||
| 255 | + fwdBuilder.withTreatment(DefaultTrafficTreatment.builder().build()); | ||
| 256 | + } else { | ||
| 257 | + fwdBuilder.nextStep(nextId); | ||
| 258 | + } | ||
| 261 | return fwdBuilder; | 259 | return fwdBuilder; |
| 262 | } | 260 | } |
| 263 | 261 | ||
| ... | @@ -384,13 +382,14 @@ public class BgpRouter { | ... | @@ -384,13 +382,14 @@ public class BgpRouter { |
| 384 | if (event.subject().id().equals(deviceId)) { | 382 | if (event.subject().id().equals(deviceId)) { |
| 385 | processIntfFilters(true, configService.getInterfaces()); | 383 | processIntfFilters(true, configService.getInterfaces()); |
| 386 | 384 | ||
| 387 | - /* For test only - will be removed before Cardinal release */ | 385 | + /* For test only - will be removed before Cardinal release |
| 388 | delay(1000); | 386 | delay(1000); |
| 389 | FibEntry fibEntry = new FibEntry(Ip4Prefix.valueOf("10.1.0.0/16"), | 387 | FibEntry fibEntry = new FibEntry(Ip4Prefix.valueOf("10.1.0.0/16"), |
| 390 | Ip4Address.valueOf("192.168.10.1"), | 388 | Ip4Address.valueOf("192.168.10.1"), |
| 391 | MacAddress.valueOf("DE:AD:BE:EF:FE:ED")); | 389 | MacAddress.valueOf("DE:AD:BE:EF:FE:ED")); |
| 392 | FibUpdate fibUpdate = new FibUpdate(FibUpdate.Type.UPDATE, fibEntry); | 390 | FibUpdate fibUpdate = new FibUpdate(FibUpdate.Type.UPDATE, fibEntry); |
| 393 | updateFibEntry(Collections.singletonList(fibUpdate)); | 391 | updateFibEntry(Collections.singletonList(fibUpdate)); |
| 392 | + */ | ||
| 394 | } | 393 | } |
| 395 | 394 | ||
| 396 | if (event.subject().id().equals(ctrlDeviceId)) { | 395 | if (event.subject().id().equals(ctrlDeviceId)) { | ... | ... |
| ... | @@ -317,28 +317,26 @@ public class OVSCorsaPipeline extends AbstractHandlerBehaviour implements Pipeli | ... | @@ -317,28 +317,26 @@ public class OVSCorsaPipeline extends AbstractHandlerBehaviour implements Pipeli |
| 317 | selector.getCriterion(Criterion.Type.IPV4_DST)).ip()) | 317 | selector.getCriterion(Criterion.Type.IPV4_DST)).ip()) |
| 318 | .build(); | 318 | .build(); |
| 319 | 319 | ||
| 320 | - NextGroup next = flowObjectiveStore.getNextGroup(fwd.nextId()); | 320 | + TrafficTreatment.Builder tb = DefaultTrafficTreatment.builder(); |
| 321 | - | 321 | + |
| 322 | - GroupKey key = appKryo.deserialize(next.data()); | 322 | + if (fwd.nextId() != null) { |
| 323 | - | 323 | + NextGroup next = flowObjectiveStore.getNextGroup(fwd.nextId()); |
| 324 | - Group group = groupService.getGroup(deviceId, key); | 324 | + GroupKey key = appKryo.deserialize(next.data()); |
| 325 | - | 325 | + Group group = groupService.getGroup(deviceId, key); |
| 326 | - if (group == null) { | 326 | + if (group == null) { |
| 327 | - log.warn("The group left!"); | 327 | + log.warn("The group left!"); |
| 328 | - fail(fwd, ObjectiveError.GROUPMISSING); | 328 | + fail(fwd, ObjectiveError.GROUPMISSING); |
| 329 | - return Collections.emptySet(); | 329 | + return Collections.emptySet(); |
| 330 | + } | ||
| 331 | + tb.group(group.id()); | ||
| 330 | } | 332 | } |
| 331 | 333 | ||
| 332 | - TrafficTreatment treatment = DefaultTrafficTreatment.builder() | ||
| 333 | - .group(group.id()) | ||
| 334 | - .build(); | ||
| 335 | - | ||
| 336 | FlowRule.Builder ruleBuilder = DefaultFlowRule.builder() | 334 | FlowRule.Builder ruleBuilder = DefaultFlowRule.builder() |
| 337 | .fromApp(fwd.appId()) | 335 | .fromApp(fwd.appId()) |
| 338 | .withPriority(fwd.priority()) | 336 | .withPriority(fwd.priority()) |
| 339 | .forDevice(deviceId) | 337 | .forDevice(deviceId) |
| 340 | .withSelector(filteredSelector) | 338 | .withSelector(filteredSelector) |
| 341 | - .withTreatment(treatment); | 339 | + .withTreatment(tb.build()); |
| 342 | 340 | ||
| 343 | if (fwd.permanent()) { | 341 | if (fwd.permanent()) { |
| 344 | ruleBuilder.makePermanent(); | 342 | ruleBuilder.makePermanent(); | ... | ... |
-
Please register or login to post a comment