Charles Chan
Committed by Charles Chan

Segment Routing refactoring

- Change name: McastEventHandler -> McastHandler
- Separate HostHandler from SRManager
- Move storekeys to a dedicated package
- Replace SRObjevtiveContext and BridgeTableObjectiveContext with DefaultObjectiveContext

Change-Id: Iab25529487004759105e5ba60c1d2a3852ac45e6
Showing 13 changed files with 84 additions and 105 deletions
...@@ -48,7 +48,7 @@ import org.onosproject.net.flowobjective.NextObjective; ...@@ -48,7 +48,7 @@ import org.onosproject.net.flowobjective.NextObjective;
48 import org.onosproject.net.mcast.McastEvent; 48 import org.onosproject.net.mcast.McastEvent;
49 import org.onosproject.net.mcast.McastRouteInfo; 49 import org.onosproject.net.mcast.McastRouteInfo;
50 import org.onosproject.net.topology.TopologyService; 50 import org.onosproject.net.topology.TopologyService;
51 -import org.onosproject.segmentrouting.grouphandler.McastNextObjectiveStoreKey; 51 +import org.onosproject.segmentrouting.storekey.McastNextObjectiveStoreKey;
52 import org.onosproject.store.serializers.KryoNamespaces; 52 import org.onosproject.store.serializers.KryoNamespaces;
53 import org.onosproject.store.service.ConsistentMap; 53 import org.onosproject.store.service.ConsistentMap;
54 import org.onosproject.store.service.Serializer; 54 import org.onosproject.store.service.Serializer;
...@@ -63,10 +63,10 @@ import java.util.Optional; ...@@ -63,10 +63,10 @@ import java.util.Optional;
63 import java.util.Set; 63 import java.util.Set;
64 64
65 /** 65 /**
66 - * Multicast event handler. 66 + * Handles multicast-related events.
67 */ 67 */
68 -public class McastEventHandler { 68 +public class McastHandler {
69 - private static final Logger log = LoggerFactory.getLogger(McastEventHandler.class); 69 + private static final Logger log = LoggerFactory.getLogger(McastHandler.class);
70 private final SegmentRoutingManager srManager; 70 private final SegmentRoutingManager srManager;
71 private final ApplicationId coreAppId; 71 private final ApplicationId coreAppId;
72 private StorageService storageService; 72 private StorageService storageService;
...@@ -79,7 +79,7 @@ public class McastEventHandler { ...@@ -79,7 +79,7 @@ public class McastEventHandler {
79 * 79 *
80 * @param srManager Segment Routing manager 80 * @param srManager Segment Routing manager
81 */ 81 */
82 - public McastEventHandler(SegmentRoutingManager srManager) { 82 + public McastHandler(SegmentRoutingManager srManager) {
83 coreAppId = srManager.coreService.getAppId(CoreService.CORE_APP_NAME); 83 coreAppId = srManager.coreService.getAppId(CoreService.CORE_APP_NAME);
84 84
85 this.srManager = srManager; 85 this.srManager = srManager;
......
...@@ -23,7 +23,9 @@ import org.onosproject.net.config.NetworkConfigEvent; ...@@ -23,7 +23,9 @@ import org.onosproject.net.config.NetworkConfigEvent;
23 import org.onosproject.net.device.DeviceService; 23 import org.onosproject.net.device.DeviceService;
24 import org.onosproject.net.flow.criteria.Criteria; 24 import org.onosproject.net.flow.criteria.Criteria;
25 import org.onosproject.net.flowobjective.DefaultFilteringObjective; 25 import org.onosproject.net.flowobjective.DefaultFilteringObjective;
26 +import org.onosproject.net.flowobjective.DefaultObjectiveContext;
26 import org.onosproject.net.flowobjective.FilteringObjective; 27 import org.onosproject.net.flowobjective.FilteringObjective;
28 +import org.onosproject.net.flowobjective.ObjectiveContext;
27 import org.onosproject.segmentrouting.config.DeviceConfigNotFoundException; 29 import org.onosproject.segmentrouting.config.DeviceConfigNotFoundException;
28 import org.onosproject.segmentrouting.config.SegmentRoutingAppConfig; 30 import org.onosproject.segmentrouting.config.SegmentRoutingAppConfig;
29 import org.slf4j.Logger; 31 import org.slf4j.Logger;
...@@ -117,9 +119,11 @@ public class NetworkConfigEventHandler { ...@@ -117,9 +119,11 @@ public class NetworkConfigEventHandler {
117 return; 119 return;
118 } 120 }
119 getVRouterFlowObjBuilders(pendingAdd).forEach(foBuilder -> { 121 getVRouterFlowObjBuilders(pendingAdd).forEach(foBuilder -> {
120 - srManager.flowObjectiveService. 122 + ObjectiveContext context = new DefaultObjectiveContext(
121 - filter(deviceId, foBuilder.add(new SRObjectiveContext(deviceId, 123 + (objective) -> log.debug("vRouterMac filter for {} populated", pendingAdd),
122 - SRObjectiveContext.ObjectiveType.FILTER))); 124 + (objective, error) ->
125 + log.warn("Failed to populate vRouterMac filter for {}: {}", pendingAdd, error));
126 + srManager.flowObjectiveService.filter(deviceId, foBuilder.add(context));
123 }); 127 });
124 } 128 }
125 129
...@@ -128,9 +132,11 @@ public class NetworkConfigEventHandler { ...@@ -128,9 +132,11 @@ public class NetworkConfigEventHandler {
128 return; 132 return;
129 } 133 }
130 getVRouterFlowObjBuilders(pendingRemove).forEach(foBuilder -> { 134 getVRouterFlowObjBuilders(pendingRemove).forEach(foBuilder -> {
131 - srManager.flowObjectiveService. 135 + ObjectiveContext context = new DefaultObjectiveContext(
132 - filter(deviceId, foBuilder.remove(new SRObjectiveContext(deviceId, 136 + (objective) -> log.debug("vRouterMac filter for {} revoked", pendingRemove),
133 - SRObjectiveContext.ObjectiveType.FILTER))); 137 + (objective, error) ->
138 + log.warn("Failed to revoke vRouterMac filter for {}: {}", pendingRemove, error));
139 + srManager.flowObjectiveService.filter(deviceId, foBuilder.remove(context));
134 }); 140 });
135 } 141 }
136 142
......
...@@ -24,6 +24,8 @@ import org.onlab.packet.MacAddress; ...@@ -24,6 +24,8 @@ import org.onlab.packet.MacAddress;
24 import org.onlab.packet.MplsLabel; 24 import org.onlab.packet.MplsLabel;
25 import org.onlab.packet.VlanId; 25 import org.onlab.packet.VlanId;
26 import org.onosproject.net.ConnectPoint; 26 import org.onosproject.net.ConnectPoint;
27 +import org.onosproject.net.flowobjective.DefaultObjectiveContext;
28 +import org.onosproject.net.flowobjective.ObjectiveContext;
27 import org.onosproject.segmentrouting.config.DeviceConfigNotFoundException; 29 import org.onosproject.segmentrouting.config.DeviceConfigNotFoundException;
28 import org.onosproject.segmentrouting.config.DeviceConfiguration; 30 import org.onosproject.segmentrouting.config.DeviceConfiguration;
29 import org.onosproject.segmentrouting.grouphandler.NeighborSet; 31 import org.onosproject.segmentrouting.grouphandler.NeighborSet;
...@@ -112,9 +114,11 @@ public class RoutingRulePopulator { ...@@ -112,9 +114,11 @@ public class RoutingRulePopulator {
112 log.warn(e.getMessage() + " Aborting populateIpRuleForHost."); 114 log.warn(e.getMessage() + " Aborting populateIpRuleForHost.");
113 return; 115 return;
114 } 116 }
115 - srManager.flowObjectiveService. 117 + ObjectiveContext context = new DefaultObjectiveContext(
116 - forward(deviceId, fwdBuilder.add(new SRObjectiveContext(deviceId, 118 + (objective) -> log.debug("IP rule for host {} populated", hostIp),
117 - SRObjectiveContext.ObjectiveType.FORWARDING))); 119 + (objective, error) ->
120 + log.warn("Failed to populate IP rule for host {}: {}", hostIp, error));
121 + srManager.flowObjectiveService.forward(deviceId, fwdBuilder.add(context));
118 rulePopulationCounter.incrementAndGet(); 122 rulePopulationCounter.incrementAndGet();
119 } 123 }
120 124
...@@ -138,9 +142,11 @@ public class RoutingRulePopulator { ...@@ -138,9 +142,11 @@ public class RoutingRulePopulator {
138 log.warn(e.getMessage() + " Aborting revokeIpRuleForHost."); 142 log.warn(e.getMessage() + " Aborting revokeIpRuleForHost.");
139 return; 143 return;
140 } 144 }
141 - srManager.flowObjectiveService. 145 + ObjectiveContext context = new DefaultObjectiveContext(
142 - forward(deviceId, fwdBuilder.remove(new SRObjectiveContext(deviceId, 146 + (objective) -> log.debug("IP rule for host {} revoked", hostIp),
143 - SRObjectiveContext.ObjectiveType.FORWARDING))); 147 + (objective, error) ->
148 + log.warn("Failed to revoke IP rule for host {}: {}", hostIp, error));
149 + srManager.flowObjectiveService.forward(deviceId, fwdBuilder.remove(context));
144 } 150 }
145 151
146 private ForwardingObjective.Builder getForwardingObjectiveBuilder( 152 private ForwardingObjective.Builder getForwardingObjectiveBuilder(
...@@ -285,11 +291,11 @@ public class RoutingRulePopulator { ...@@ -285,11 +291,11 @@ public class RoutingRulePopulator {
285 + "for router IP/subnet {} in switch {}", 291 + "for router IP/subnet {} in switch {}",
286 ipPrefix, 292 ipPrefix,
287 deviceId); 293 deviceId);
288 - srManager.flowObjectiveService. 294 + ObjectiveContext context = new DefaultObjectiveContext(
289 - forward(deviceId, 295 + (objective) -> log.debug("IP rule for router {} populated", ipPrefix),
290 - fwdBuilder. 296 + (objective, error) ->
291 - add(new SRObjectiveContext(deviceId, 297 + log.warn("Failed to populate IP rule for router {}: {}", ipPrefix, error));
292 - SRObjectiveContext.ObjectiveType.FORWARDING))); 298 + srManager.flowObjectiveService.forward(deviceId, fwdBuilder.add(context));
293 rulePopulationCounter.incrementAndGet(); 299 rulePopulationCounter.incrementAndGet();
294 300
295 return true; 301 return true;
...@@ -387,11 +393,11 @@ public class RoutingRulePopulator { ...@@ -387,11 +393,11 @@ public class RoutingRulePopulator {
387 .makePermanent()).withSelector(selector) 393 .makePermanent()).withSelector(selector)
388 .withPriority(SegmentRoutingService.DEFAULT_PRIORITY)) 394 .withPriority(SegmentRoutingService.DEFAULT_PRIORITY))
389 .withFlag(ForwardingObjective.Flag.SPECIFIC); 395 .withFlag(ForwardingObjective.Flag.SPECIFIC);
390 - srManager.flowObjectiveService. 396 + ObjectiveContext context = new DefaultObjectiveContext(
391 - forward(deviceId, 397 + (objective) -> log.debug("MPLS rule for SID {} populated", segmentId),
392 - fwdObjBuilder. 398 + (objective, error) ->
393 - add(new SRObjectiveContext(deviceId, 399 + log.warn("Failed to populate MPLS rule for SID {}: {}", segmentId, error));
394 - SRObjectiveContext.ObjectiveType.FORWARDING))); 400 + srManager.flowObjectiveService.forward(deviceId, fwdObjBuilder.add(context));
395 rulePopulationCounter.incrementAndGet(); 401 rulePopulationCounter.incrementAndGet();
396 } 402 }
397 403
...@@ -471,9 +477,9 @@ public class RoutingRulePopulator { ...@@ -471,9 +477,9 @@ public class RoutingRulePopulator {
471 } 477 }
472 478
473 for (Port port : srManager.deviceService.getPorts(deviceId)) { 479 for (Port port : srManager.deviceService.getPorts(deviceId)) {
474 - ConnectPoint cp = new ConnectPoint(deviceId, port.number()); 480 + ConnectPoint connectPoint = new ConnectPoint(deviceId, port.number());
475 // TODO: Handles dynamic port events when we are ready for dynamic config 481 // TODO: Handles dynamic port events when we are ready for dynamic config
476 - if (!srManager.deviceConfiguration.suppressSubnet().contains(cp) && 482 + if (!srManager.deviceConfiguration.suppressSubnet().contains(connectPoint) &&
477 port.isEnabled()) { 483 port.isEnabled()) {
478 Ip4Prefix portSubnet = config.getPortSubnet(deviceId, port.number()); 484 Ip4Prefix portSubnet = config.getPortSubnet(deviceId, port.number());
479 VlanId assignedVlan = (portSubnet == null) 485 VlanId assignedVlan = (portSubnet == null)
...@@ -492,9 +498,11 @@ public class RoutingRulePopulator { ...@@ -492,9 +498,11 @@ public class RoutingRulePopulator {
492 fob.withMeta(tt); 498 fob.withMeta(tt);
493 } 499 }
494 fob.permit().fromApp(srManager.appId); 500 fob.permit().fromApp(srManager.appId);
495 - srManager.flowObjectiveService. 501 + ObjectiveContext context = new DefaultObjectiveContext(
496 - filter(deviceId, fob.add(new SRObjectiveContext(deviceId, 502 + (objective) -> log.debug("Filter for {} populated", connectPoint),
497 - SRObjectiveContext.ObjectiveType.FILTER))); 503 + (objective, error) ->
504 + log.warn("Failed to populate filter for {}: {}", connectPoint, error));
505 + srManager.flowObjectiveService.filter(deviceId, fob.add(context));
498 } 506 }
499 } 507 }
500 } 508 }
...@@ -537,11 +545,11 @@ public class RoutingRulePopulator { ...@@ -537,11 +545,11 @@ public class RoutingRulePopulator {
537 .withPriority(SegmentRoutingService.HIGHEST_PRIORITY) 545 .withPriority(SegmentRoutingService.HIGHEST_PRIORITY)
538 .makePermanent() 546 .makePermanent()
539 .fromApp(srManager.appId); 547 .fromApp(srManager.appId);
540 - log.debug("Installing forwarding objective to punt port IP addresses"); 548 + ObjectiveContext context = new DefaultObjectiveContext(
541 - srManager.flowObjectiveService. 549 + (objective) -> log.debug("IP punt rule for {} populated", ipaddr),
542 - forward(deviceId, 550 + (objective, error) ->
543 - puntIp.add(new SRObjectiveContext(deviceId, 551 + log.warn("Failed to populate IP punt rule for {}: {}", ipaddr, error));
544 - SRObjectiveContext.ObjectiveType.FORWARDING))); 552 + srManager.flowObjectiveService.forward(deviceId, puntIp.add(context));
545 } 553 }
546 } 554 }
547 555
...@@ -585,14 +593,11 @@ public class RoutingRulePopulator { ...@@ -585,14 +593,11 @@ public class RoutingRulePopulator {
585 .withPriority(SegmentRoutingService.FLOOD_PRIORITY) 593 .withPriority(SegmentRoutingService.FLOOD_PRIORITY)
586 .fromApp(srManager.appId) 594 .fromApp(srManager.appId)
587 .makePermanent(); 595 .makePermanent();
588 - 596 + ObjectiveContext context = new DefaultObjectiveContext(
589 - srManager.flowObjectiveService.forward( 597 + (objective) -> log.debug("Subnet broadcast rule for {} populated", subnet),
590 - deviceId, 598 + (objective, error) ->
591 - fob.add(new SRObjectiveContext( 599 + log.warn("Failed to populate subnet broadcast rule for {}: {}", subnet, error));
592 - deviceId, 600 + srManager.flowObjectiveService.forward(deviceId, fob.add(context));
593 - SRObjectiveContext.ObjectiveType.FORWARDING)
594 - )
595 - );
596 }); 601 });
597 } 602 }
598 603
...@@ -618,11 +623,12 @@ public class RoutingRulePopulator { ...@@ -618,11 +623,12 @@ public class RoutingRulePopulator {
618 .addCondition(Criteria.matchVlanId(vlanId)) 623 .addCondition(Criteria.matchVlanId(vlanId))
619 .addCondition(Criteria.matchEthDst(MacAddress.NONE)) 624 .addCondition(Criteria.matchEthDst(MacAddress.NONE))
620 .withPriority(SegmentRoutingService.XCONNECT_PRIORITY); 625 .withPriority(SegmentRoutingService.XCONNECT_PRIORITY);
621 -
622 fob.permit().fromApp(srManager.appId); 626 fob.permit().fromApp(srManager.appId);
623 - srManager.flowObjectiveService 627 + ObjectiveContext context = new DefaultObjectiveContext(
624 - .filter(deviceId, fob.add(new SRObjectiveContext(deviceId, 628 + (objective) -> log.debug("XConnect filter for {} populated", connectPoint),
625 - SRObjectiveContext.ObjectiveType.FILTER))); 629 + (objective, error) ->
630 + log.warn("Failed to populate xconnect filter for {}: {}", connectPoint, error));
631 + srManager.flowObjectiveService.filter(deviceId, fob.add(context));
626 }); 632 });
627 }); 633 });
628 } 634 }
...@@ -666,14 +672,11 @@ public class RoutingRulePopulator { ...@@ -666,14 +672,11 @@ public class RoutingRulePopulator {
666 .withPriority(SegmentRoutingService.DEFAULT_PRIORITY) 672 .withPriority(SegmentRoutingService.DEFAULT_PRIORITY)
667 .fromApp(srManager.appId) 673 .fromApp(srManager.appId)
668 .makePermanent(); 674 .makePermanent();
669 - 675 + ObjectiveContext context = new DefaultObjectiveContext(
670 - srManager.flowObjectiveService.forward( 676 + (objective) -> log.debug("XConnect rule for {} populated", xConnects),
671 - deviceId, 677 + (objective, error) ->
672 - fob.add(new SRObjectiveContext( 678 + log.warn("Failed to populate xconnect rule for {}: {}", xConnects, error));
673 - deviceId, 679 + srManager.flowObjectiveService.forward(deviceId, fob.add(context));
674 - SRObjectiveContext.ObjectiveType.FORWARDING)
675 - )
676 - );
677 }); 680 });
678 } 681 }
679 682
......
...@@ -53,6 +53,10 @@ import org.onosproject.net.link.LinkService; ...@@ -53,6 +53,10 @@ import org.onosproject.net.link.LinkService;
53 import org.onosproject.segmentrouting.SegmentRoutingManager; 53 import org.onosproject.segmentrouting.SegmentRoutingManager;
54 import org.onosproject.segmentrouting.config.DeviceConfigNotFoundException; 54 import org.onosproject.segmentrouting.config.DeviceConfigNotFoundException;
55 import org.onosproject.segmentrouting.config.DeviceProperties; 55 import org.onosproject.segmentrouting.config.DeviceProperties;
56 +import org.onosproject.segmentrouting.storekey.NeighborSetNextObjectiveStoreKey;
57 +import org.onosproject.segmentrouting.storekey.PortNextObjectiveStoreKey;
58 +import org.onosproject.segmentrouting.storekey.SubnetNextObjectiveStoreKey;
59 +import org.onosproject.segmentrouting.storekey.XConnectNextObjectiveStoreKey;
56 import org.onosproject.store.service.EventuallyConsistentMap; 60 import org.onosproject.store.service.EventuallyConsistentMap;
57 import org.slf4j.Logger; 61 import org.slf4j.Logger;
58 62
......
1 /* 1 /*
2 - * Copyright 2015-present Open Networking Laboratory 2 + * Copyright 2016-present Open Networking Laboratory
3 * 3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License. 5 * you may not use this file except in compliance with the License.
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
14 * limitations under the License. 14 * limitations under the License.
15 */ 15 */
16 16
17 -package org.onosproject.segmentrouting.grouphandler; 17 +package org.onosproject.segmentrouting.storekey;
18 18
19 import org.onlab.packet.IpAddress; 19 import org.onlab.packet.IpAddress;
20 import org.onosproject.net.DeviceId; 20 import org.onosproject.net.DeviceId;
......
1 /* 1 /*
2 - * Copyright 2015-present Open Networking Laboratory 2 + * Copyright 2016-present Open Networking Laboratory
3 * 3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License. 5 * you may not use this file except in compliance with the License.
...@@ -14,11 +14,12 @@ ...@@ -14,11 +14,12 @@
14 * limitations under the License. 14 * limitations under the License.
15 */ 15 */
16 16
17 -package org.onosproject.segmentrouting.grouphandler; 17 +package org.onosproject.segmentrouting.storekey;
18 18
19 import java.util.Objects; 19 import java.util.Objects;
20 20
21 import org.onosproject.net.DeviceId; 21 import org.onosproject.net.DeviceId;
22 +import org.onosproject.segmentrouting.grouphandler.NeighborSet;
22 23
23 /** 24 /**
24 * Key of Neighborset next objective store. 25 * Key of Neighborset next objective store.
......
1 /* 1 /*
2 - * Copyright 2015-present Open Networking Laboratory 2 + * Copyright 2016-present Open Networking Laboratory
3 * 3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License. 5 * you may not use this file except in compliance with the License.
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
13 * See the License for the specific language governing permissions and 13 * See the License for the specific language governing permissions and
14 * limitations under the License. 14 * limitations under the License.
15 */ 15 */
16 -package org.onosproject.segmentrouting.grouphandler; 16 +package org.onosproject.segmentrouting.storekey;
17 17
18 import org.onosproject.net.DeviceId; 18 import org.onosproject.net.DeviceId;
19 import org.onosproject.net.PortNumber; 19 import org.onosproject.net.PortNumber;
......
1 /* 1 /*
2 - * Copyright 2015-present Open Networking Laboratory 2 + * Copyright 2016-present Open Networking Laboratory
3 * 3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License. 5 * you may not use this file except in compliance with the License.
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
13 * See the License for the specific language governing permissions and 13 * See the License for the specific language governing permissions and
14 * limitations under the License. 14 * limitations under the License.
15 */ 15 */
16 -package org.onosproject.segmentrouting; 16 +package org.onosproject.segmentrouting.storekey;
17 17
18 import java.util.Objects; 18 import java.util.Objects;
19 19
......
1 /* 1 /*
2 - * Copyright 2015-present Open Networking Laboratory 2 + * Copyright 2016-present Open Networking Laboratory
3 * 3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License. 5 * you may not use this file except in compliance with the License.
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
14 * limitations under the License. 14 * limitations under the License.
15 */ 15 */
16 16
17 -package org.onosproject.segmentrouting.grouphandler; 17 +package org.onosproject.segmentrouting.storekey;
18 18
19 import org.onlab.packet.IpPrefix; 19 import org.onlab.packet.IpPrefix;
20 import org.onosproject.net.DeviceId; 20 import org.onosproject.net.DeviceId;
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
14 * limitations under the License. 14 * limitations under the License.
15 */ 15 */
16 16
17 -package org.onosproject.segmentrouting.grouphandler; 17 +package org.onosproject.segmentrouting.storekey;
18 18
19 import org.onlab.packet.VlanId; 19 import org.onlab.packet.VlanId;
20 import org.onosproject.net.DeviceId; 20 import org.onosproject.net.DeviceId;
......
...@@ -13,43 +13,8 @@ ...@@ -13,43 +13,8 @@
13 * See the License for the specific language governing permissions and 13 * See the License for the specific language governing permissions and
14 * limitations under the License. 14 * limitations under the License.
15 */ 15 */
16 -package org.onosproject.segmentrouting;
17 -
18 -import org.onosproject.net.DeviceId;
19 -import org.onosproject.net.flowobjective.Objective;
20 -import org.onosproject.net.flowobjective.ObjectiveContext;
21 -import org.onosproject.net.flowobjective.ObjectiveError;
22 -import org.slf4j.Logger;
23 -import org.slf4j.LoggerFactory;
24 16
25 /** 17 /**
26 - * Segment Routing Flow Objective Context. 18 + * Key data structure of various stores used by Segment Routing.
27 */ 19 */
28 -public class SRObjectiveContext implements ObjectiveContext { 20 +package org.onosproject.segmentrouting.storekey;
29 - enum ObjectiveType {
30 - FILTER,
31 - FORWARDING
32 - }
33 - private final DeviceId deviceId;
34 - private final ObjectiveType type;
35 -
36 - private static final Logger log = LoggerFactory
37 - .getLogger(SegmentRoutingManager.class);
38 -
39 - SRObjectiveContext(DeviceId deviceId, ObjectiveType type) {
40 - this.deviceId = deviceId;
41 - this.type = type;
42 - }
43 - @Override
44 - public void onSuccess(Objective objective) {
45 - log.debug("{} objective operation successful in device {}",
46 - type.name(), deviceId);
47 - }
48 -
49 - @Override
50 - public void onError(Objective objective, ObjectiveError error) {
51 - log.warn("{} objective {} operation failed with error: {} in device {}",
52 - type.name(), objective, error, deviceId);
53 - }
54 -}
55 -
...\ No newline at end of file ...\ No newline at end of file
......