Bug fixes for Intent Manager
ONOS-343 Change-Id: I164c52b41080392c4b27a3969f270171558599a6
Showing
4 changed files
with
25 additions
and
6 deletions
... | @@ -294,7 +294,7 @@ public class IntentManager | ... | @@ -294,7 +294,7 @@ public class IntentManager |
294 | // intents with the top-level intent and proceed to install. | 294 | // intents with the top-level intent and proceed to install. |
295 | update.setInstallables(installables); | 295 | update.setInstallables(installables); |
296 | } catch (PathNotFoundException e) { | 296 | } catch (PathNotFoundException e) { |
297 | - log.debug("Path not found for intent {}", intent.id()); | 297 | + log.debug("Path not found for intent {}", intent); |
298 | } catch (IntentException e) { | 298 | } catch (IntentException e) { |
299 | log.warn("Unable to compile intent {} due to:", intent.id(), e); | 299 | log.warn("Unable to compile intent {} due to:", intent.id(), e); |
300 | 300 | ||
... | @@ -606,6 +606,9 @@ public class IntentManager | ... | @@ -606,6 +606,9 @@ public class IntentManager |
606 | oldInstallables = store.getInstallableIntents(oldIntent.id()); | 606 | oldInstallables = store.getInstallableIntents(oldIntent.id()); |
607 | } else { | 607 | } else { |
608 | oldInstallables = null; | 608 | oldInstallables = null; |
609 | + if (newIntent == null) { | ||
610 | + log.info("Ignoring {} for Intent {}", op.type(), op.intentId()); | ||
611 | + } | ||
609 | } | 612 | } |
610 | } | 613 | } |
611 | 614 | ||
... | @@ -853,8 +856,8 @@ public class IntentManager | ... | @@ -853,8 +856,8 @@ public class IntentManager |
853 | */ | 856 | */ |
854 | private void processFutures() { | 857 | private void processFutures() { |
855 | if (future == null) { | 858 | if (future == null) { |
856 | - log.warn("I have no Future."); | 859 | + // we are done if the future is null |
857 | - return; //FIXME look at this | 860 | + return; |
858 | } | 861 | } |
859 | try { | 862 | try { |
860 | CompletedBatchOperation completed = future.get(100, TimeUnit.NANOSECONDS); | 863 | CompletedBatchOperation completed = future.get(100, TimeUnit.NANOSECONDS); | ... | ... |
... | @@ -77,7 +77,7 @@ public class ObjectiveTracker implements ObjectiveTrackerService { | ... | @@ -77,7 +77,7 @@ public class ObjectiveTracker implements ObjectiveTrackerService { |
77 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | 77 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
78 | protected LinkResourceService resourceManager; | 78 | protected LinkResourceService resourceManager; |
79 | 79 | ||
80 | - @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | 80 | + @Reference(cardinality = ReferenceCardinality.OPTIONAL_UNARY) |
81 | protected IntentService intentService; | 81 | protected IntentService intentService; |
82 | 82 | ||
83 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | 83 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
... | @@ -108,6 +108,18 @@ public class ObjectiveTracker implements ObjectiveTrackerService { | ... | @@ -108,6 +108,18 @@ public class ObjectiveTracker implements ObjectiveTrackerService { |
108 | log.info("Stopped"); | 108 | log.info("Stopped"); |
109 | } | 109 | } |
110 | 110 | ||
111 | + protected void bindIntentService(IntentService service) { | ||
112 | + if (intentService == null) { | ||
113 | + intentService = service; | ||
114 | + } | ||
115 | + } | ||
116 | + | ||
117 | + protected void unbindIntentService(IntentService service) { | ||
118 | + if (intentService == service) { | ||
119 | + intentService = null; | ||
120 | + } | ||
121 | + } | ||
122 | + | ||
111 | @Override | 123 | @Override |
112 | public void setDelegate(TopologyChangeDelegate delegate) { | 124 | public void setDelegate(TopologyChangeDelegate delegate) { |
113 | checkNotNull(delegate, "Delegate cannot be null"); | 125 | checkNotNull(delegate, "Delegate cannot be null"); |
... | @@ -235,6 +247,10 @@ public class ObjectiveTracker implements ObjectiveTrackerService { | ... | @@ -235,6 +247,10 @@ public class ObjectiveTracker implements ObjectiveTrackerService { |
235 | //TODO consider adding flow rule event tracking | 247 | //TODO consider adding flow rule event tracking |
236 | 248 | ||
237 | private void updateTrackedResources(ApplicationId appId, boolean track) { | 249 | private void updateTrackedResources(ApplicationId appId, boolean track) { |
250 | + if (intentService == null) { | ||
251 | + log.debug("Intent service is not bound yet"); | ||
252 | + return; | ||
253 | + } | ||
238 | intentService.getIntents().forEach(intent -> { | 254 | intentService.getIntents().forEach(intent -> { |
239 | if (intent.appId().equals(appId)) { | 255 | if (intent.appId().equals(appId)) { |
240 | IntentId id = intent.id(); | 256 | IntentId id = intent.id(); | ... | ... |
... | @@ -63,7 +63,7 @@ import com.google.common.collect.ImmutableList; | ... | @@ -63,7 +63,7 @@ import com.google.common.collect.ImmutableList; |
63 | * Strongly consistent and durable state management service based on | 63 | * Strongly consistent and durable state management service based on |
64 | * Copycat implementation of Raft consensus protocol. | 64 | * Copycat implementation of Raft consensus protocol. |
65 | */ | 65 | */ |
66 | -@Component(immediate = true) | 66 | +@Component(immediate = false) |
67 | @Service | 67 | @Service |
68 | public class DatabaseManager implements DatabaseService, DatabaseAdminService { | 68 | public class DatabaseManager implements DatabaseService, DatabaseAdminService { |
69 | 69 | ... | ... |
... | @@ -33,7 +33,7 @@ import com.google.common.collect.LinkedListMultimap; | ... | @@ -33,7 +33,7 @@ import com.google.common.collect.LinkedListMultimap; |
33 | import com.google.common.collect.ListMultimap; | 33 | import com.google.common.collect.ListMultimap; |
34 | import com.google.common.collect.Multimaps; | 34 | import com.google.common.collect.Multimaps; |
35 | 35 | ||
36 | -@Component(immediate = true) | 36 | +@Component(immediate = false) |
37 | @Service | 37 | @Service |
38 | public class DistributedLockManager implements LockService { | 38 | public class DistributedLockManager implements LockService { |
39 | 39 | ... | ... |
-
Please register or login to post a comment