Committed by
Gerrit Code Review
ONOS-1951: Segment Routing multi-instance instability: Plugging Objective contex…
…t to monitor any errors Change-Id: Ic710a756b7fec411a52a356409639c3f96c3129d
Showing
2 changed files
with
82 additions
and
11 deletions
| ... | @@ -35,7 +35,10 @@ import org.onosproject.net.flowobjective.DefaultFilteringObjective; | ... | @@ -35,7 +35,10 @@ import org.onosproject.net.flowobjective.DefaultFilteringObjective; |
| 35 | import org.onosproject.net.flowobjective.DefaultForwardingObjective; | 35 | import org.onosproject.net.flowobjective.DefaultForwardingObjective; |
| 36 | import org.onosproject.net.flowobjective.FilteringObjective; | 36 | import org.onosproject.net.flowobjective.FilteringObjective; |
| 37 | import org.onosproject.net.flowobjective.ForwardingObjective; | 37 | import org.onosproject.net.flowobjective.ForwardingObjective; |
| 38 | +import org.onosproject.net.flowobjective.Objective; | ||
| 39 | +import org.onosproject.net.flowobjective.ObjectiveError; | ||
| 38 | import org.onosproject.net.flowobjective.ForwardingObjective.Builder; | 40 | import org.onosproject.net.flowobjective.ForwardingObjective.Builder; |
| 41 | +import org.onosproject.net.flowobjective.ObjectiveContext; | ||
| 39 | import org.slf4j.Logger; | 42 | import org.slf4j.Logger; |
| 40 | import org.slf4j.LoggerFactory; | 43 | import org.slf4j.LoggerFactory; |
| 41 | 44 | ||
| ... | @@ -113,7 +116,11 @@ public class RoutingRulePopulator { | ... | @@ -113,7 +116,11 @@ public class RoutingRulePopulator { |
| 113 | 116 | ||
| 114 | log.debug("Installing IPv4 forwarding objective " | 117 | log.debug("Installing IPv4 forwarding objective " |
| 115 | + "for host {} in switch {}", hostIp, deviceId); | 118 | + "for host {} in switch {}", hostIp, deviceId); |
| 116 | - srManager.flowObjectiveService.forward(deviceId, fwdBuilder.add()); | 119 | + srManager.flowObjectiveService. |
| 120 | + forward(deviceId, | ||
| 121 | + fwdBuilder. | ||
| 122 | + add(new SRObjectiveContext(deviceId, | ||
| 123 | + SRObjectiveContext.ObjectiveType.FORWARDING))); | ||
| 117 | rulePopulationCounter.incrementAndGet(); | 124 | rulePopulationCounter.incrementAndGet(); |
| 118 | } | 125 | } |
| 119 | 126 | ||
| ... | @@ -192,7 +199,11 @@ public class RoutingRulePopulator { | ... | @@ -192,7 +199,11 @@ public class RoutingRulePopulator { |
| 192 | + "for router IP/subnet {} in switch {}", | 199 | + "for router IP/subnet {} in switch {}", |
| 193 | ipPrefix, | 200 | ipPrefix, |
| 194 | deviceId); | 201 | deviceId); |
| 195 | - srManager.flowObjectiveService.forward(deviceId, fwdBuilder.add()); | 202 | + srManager.flowObjectiveService. |
| 203 | + forward(deviceId, | ||
| 204 | + fwdBuilder. | ||
| 205 | + add(new SRObjectiveContext(deviceId, | ||
| 206 | + SRObjectiveContext.ObjectiveType.FORWARDING))); | ||
| 196 | rulePopulationCounter.incrementAndGet(); | 207 | rulePopulationCounter.incrementAndGet(); |
| 197 | 208 | ||
| 198 | return true; | 209 | return true; |
| ... | @@ -275,8 +286,11 @@ public class RoutingRulePopulator { | ... | @@ -275,8 +286,11 @@ public class RoutingRulePopulator { |
| 275 | .makePermanent()).withSelector(selector) | 286 | .makePermanent()).withSelector(selector) |
| 276 | .withPriority(100)) | 287 | .withPriority(100)) |
| 277 | .withFlag(ForwardingObjective.Flag.SPECIFIC); | 288 | .withFlag(ForwardingObjective.Flag.SPECIFIC); |
| 278 | - srManager.flowObjectiveService.forward(deviceId, | 289 | + srManager.flowObjectiveService. |
| 279 | - fwdObjBuilder.add()); | 290 | + forward(deviceId, |
| 291 | + fwdObjBuilder. | ||
| 292 | + add(new SRObjectiveContext(deviceId, | ||
| 293 | + SRObjectiveContext.ObjectiveType.FORWARDING))); | ||
| 280 | rulePopulationCounter.incrementAndGet(); | 294 | rulePopulationCounter.incrementAndGet(); |
| 281 | } | 295 | } |
| 282 | 296 | ||
| ... | @@ -346,7 +360,10 @@ public class RoutingRulePopulator { | ... | @@ -346,7 +360,10 @@ public class RoutingRulePopulator { |
| 346 | .addCondition(Criteria.matchVlanId(VlanId.NONE)); | 360 | .addCondition(Criteria.matchVlanId(VlanId.NONE)); |
| 347 | fob.permit().fromApp(srManager.appId); | 361 | fob.permit().fromApp(srManager.appId); |
| 348 | log.debug("populateTableVlan: Installing filtering objective for untagged packets"); | 362 | log.debug("populateTableVlan: Installing filtering objective for untagged packets"); |
| 349 | - srManager.flowObjectiveService.filter(deviceId, fob.add()); | 363 | + srManager.flowObjectiveService. |
| 364 | + filter(deviceId, | ||
| 365 | + fob.add(new SRObjectiveContext(deviceId, | ||
| 366 | + SRObjectiveContext.ObjectiveType.FILTER))); | ||
| 350 | } | 367 | } |
| 351 | 368 | ||
| 352 | /** | 369 | /** |
| ... | @@ -363,7 +380,10 @@ public class RoutingRulePopulator { | ... | @@ -363,7 +380,10 @@ public class RoutingRulePopulator { |
| 363 | .getDeviceMac(deviceId))); | 380 | .getDeviceMac(deviceId))); |
| 364 | fob.permit().fromApp(srManager.appId); | 381 | fob.permit().fromApp(srManager.appId); |
| 365 | log.debug("populateTableVlan: Installing filtering objective for router mac"); | 382 | log.debug("populateTableVlan: Installing filtering objective for router mac"); |
| 366 | - srManager.flowObjectiveService.filter(deviceId, fob.add()); | 383 | + srManager.flowObjectiveService. |
| 384 | + filter(deviceId, | ||
| 385 | + fob.add(new SRObjectiveContext(deviceId, | ||
| 386 | + SRObjectiveContext.ObjectiveType.FILTER))); | ||
| 367 | } | 387 | } |
| 368 | 388 | ||
| 369 | private PortNumber selectOnePort(DeviceId srcId, Set<DeviceId> destIds) { | 389 | private PortNumber selectOnePort(DeviceId srcId, Set<DeviceId> destIds) { |
| ... | @@ -382,4 +402,29 @@ public class RoutingRulePopulator { | ... | @@ -382,4 +402,29 @@ public class RoutingRulePopulator { |
| 382 | return null; | 402 | return null; |
| 383 | } | 403 | } |
| 384 | 404 | ||
| 405 | + private static class SRObjectiveContext implements ObjectiveContext { | ||
| 406 | + enum ObjectiveType { | ||
| 407 | + FILTER, | ||
| 408 | + FORWARDING | ||
| 409 | + } | ||
| 410 | + final DeviceId deviceId; | ||
| 411 | + final ObjectiveType type; | ||
| 412 | + | ||
| 413 | + SRObjectiveContext(DeviceId deviceId, ObjectiveType type) { | ||
| 414 | + this.deviceId = deviceId; | ||
| 415 | + this.type = type; | ||
| 416 | + } | ||
| 417 | + @Override | ||
| 418 | + public void onSuccess(Objective objective) { | ||
| 419 | + log.debug("{} objective operation successful in device {}", | ||
| 420 | + type.name(), deviceId); | ||
| 421 | + } | ||
| 422 | + | ||
| 423 | + @Override | ||
| 424 | + public void onError(Objective objective, ObjectiveError error) { | ||
| 425 | + log.warn("{} objective {} operation failed with error: {} in device {}", | ||
| 426 | + type.name(), objective, error, deviceId); | ||
| 427 | + } | ||
| 428 | + } | ||
| 429 | + | ||
| 385 | } | 430 | } | ... | ... |
| ... | @@ -41,6 +41,9 @@ import org.onosproject.net.flow.TrafficTreatment; | ... | @@ -41,6 +41,9 @@ import org.onosproject.net.flow.TrafficTreatment; |
| 41 | import org.onosproject.net.flowobjective.DefaultNextObjective; | 41 | import org.onosproject.net.flowobjective.DefaultNextObjective; |
| 42 | import org.onosproject.net.flowobjective.FlowObjectiveService; | 42 | import org.onosproject.net.flowobjective.FlowObjectiveService; |
| 43 | import org.onosproject.net.flowobjective.NextObjective; | 43 | import org.onosproject.net.flowobjective.NextObjective; |
| 44 | +import org.onosproject.net.flowobjective.Objective; | ||
| 45 | +import org.onosproject.net.flowobjective.ObjectiveContext; | ||
| 46 | +import org.onosproject.net.flowobjective.ObjectiveError; | ||
| 44 | import org.onosproject.net.group.DefaultGroupKey; | 47 | import org.onosproject.net.group.DefaultGroupKey; |
| 45 | import org.onosproject.net.group.GroupKey; | 48 | import org.onosproject.net.group.GroupKey; |
| 46 | import org.onosproject.net.link.LinkService; | 49 | import org.onosproject.net.link.LinkService; |
| ... | @@ -53,7 +56,7 @@ import org.slf4j.Logger; | ... | @@ -53,7 +56,7 @@ import org.slf4j.Logger; |
| 53 | * whether the current device is an edge device or a transit device. | 56 | * whether the current device is an edge device or a transit device. |
| 54 | */ | 57 | */ |
| 55 | public class DefaultGroupHandler { | 58 | public class DefaultGroupHandler { |
| 56 | - protected final Logger log = getLogger(getClass()); | 59 | + protected static final Logger log = getLogger(DefaultGroupHandler.class); |
| 57 | 60 | ||
| 58 | protected final DeviceId deviceId; | 61 | protected final DeviceId deviceId; |
| 59 | protected final ApplicationId appId; | 62 | protected final ApplicationId appId; |
| ... | @@ -211,7 +214,8 @@ public class DefaultGroupHandler { | ... | @@ -211,7 +214,8 @@ public class DefaultGroupHandler { |
| 211 | deviceId, | 214 | deviceId, |
| 212 | newLink.src().port(), | 215 | newLink.src().port(), |
| 213 | nextId); | 216 | nextId); |
| 214 | - NextObjective nextObjective = nextObjBuilder.add(); | 217 | + NextObjective nextObjective = nextObjBuilder. |
| 218 | + add(new SRNextObjectiveContext(deviceId)); | ||
| 215 | flowObjectiveService.next(deviceId, nextObjective); | 219 | flowObjectiveService.next(deviceId, nextObjective); |
| 216 | } | 220 | } |
| 217 | } | 221 | } |
| ... | @@ -268,7 +272,8 @@ public class DefaultGroupHandler { | ... | @@ -268,7 +272,8 @@ public class DefaultGroupHandler { |
| 268 | deviceId, | 272 | deviceId, |
| 269 | port, | 273 | port, |
| 270 | nextId); | 274 | nextId); |
| 271 | - NextObjective nextObjective = nextObjBuilder.remove(); | 275 | + NextObjective nextObjective = nextObjBuilder. |
| 276 | + remove(new SRNextObjectiveContext(deviceId)); | ||
| 272 | 277 | ||
| 273 | flowObjectiveService.next(deviceId, nextObjective); | 278 | flowObjectiveService.next(deviceId, nextObjective); |
| 274 | } | 279 | } |
| ... | @@ -470,7 +475,8 @@ public class DefaultGroupHandler { | ... | @@ -470,7 +475,8 @@ public class DefaultGroupHandler { |
| 470 | } | 475 | } |
| 471 | } | 476 | } |
| 472 | 477 | ||
| 473 | - NextObjective nextObj = nextObjBuilder.add(); | 478 | + NextObjective nextObj = nextObjBuilder. |
| 479 | + add(new SRNextObjectiveContext(deviceId)); | ||
| 474 | flowObjectiveService.next(deviceId, nextObj); | 480 | flowObjectiveService.next(deviceId, nextObj); |
| 475 | log.debug("createGroupsFromNeighborsets: Submited " | 481 | log.debug("createGroupsFromNeighborsets: Submited " |
| 476 | + "next objective {} in device {}", | 482 | + "next objective {} in device {}", |
| ... | @@ -496,7 +502,8 @@ public class DefaultGroupHandler { | ... | @@ -496,7 +502,8 @@ public class DefaultGroupHandler { |
| 496 | NextObjective.Builder nextObjBuilder = DefaultNextObjective | 502 | NextObjective.Builder nextObjBuilder = DefaultNextObjective |
| 497 | .builder().withId(objectiveId) | 503 | .builder().withId(objectiveId) |
| 498 | .withType(NextObjective.Type.HASHED).fromApp(appId); | 504 | .withType(NextObjective.Type.HASHED).fromApp(appId); |
| 499 | - NextObjective nextObjective = nextObjBuilder.remove(); | 505 | + NextObjective nextObjective = nextObjBuilder. |
| 506 | + remove(new SRNextObjectiveContext(deviceId)); | ||
| 500 | flowObjectiveService.next(deviceId, nextObjective); | 507 | flowObjectiveService.next(deviceId, nextObjective); |
| 501 | 508 | ||
| 502 | for (Map.Entry<NeighborSetNextObjectiveStoreKey, Integer> entry: nsNextObjStore.entrySet()) { | 509 | for (Map.Entry<NeighborSetNextObjectiveStoreKey, Integer> entry: nsNextObjStore.entrySet()) { |
| ... | @@ -510,4 +517,23 @@ public class DefaultGroupHandler { | ... | @@ -510,4 +517,23 @@ public class DefaultGroupHandler { |
| 510 | 517 | ||
| 511 | return false; | 518 | return false; |
| 512 | } | 519 | } |
| 520 | + | ||
| 521 | + protected static class SRNextObjectiveContext implements ObjectiveContext { | ||
| 522 | + final DeviceId deviceId; | ||
| 523 | + | ||
| 524 | + SRNextObjectiveContext(DeviceId deviceId) { | ||
| 525 | + this.deviceId = deviceId; | ||
| 526 | + } | ||
| 527 | + @Override | ||
| 528 | + public void onSuccess(Objective objective) { | ||
| 529 | + log.debug("Next objective operation successful in device {}", | ||
| 530 | + deviceId); | ||
| 531 | + } | ||
| 532 | + | ||
| 533 | + @Override | ||
| 534 | + public void onError(Objective objective, ObjectiveError error) { | ||
| 535 | + log.warn("Next objective {} operation failed with error: {} in device {}", | ||
| 536 | + objective, error, deviceId); | ||
| 537 | + } | ||
| 538 | + } | ||
| 513 | } | 539 | } | ... | ... |
-
Please register or login to post a comment