Committed by
Brian O'Connor
Refactoring of IntentId based APIs
- getIntent - getIntentState - getInstallableIntents Change-Id: I6d2073dfa165e0e5adcef46fe5908b563b481a43
Showing
28 changed files
with
183 additions
and
199 deletions
... | @@ -23,7 +23,6 @@ import org.onosproject.net.ConnectPoint; | ... | @@ -23,7 +23,6 @@ import org.onosproject.net.ConnectPoint; |
23 | import org.onosproject.net.DeviceId; | 23 | import org.onosproject.net.DeviceId; |
24 | import org.onosproject.net.intent.Intent; | 24 | import org.onosproject.net.intent.Intent; |
25 | import org.onosproject.net.intent.IntentEvent; | 25 | import org.onosproject.net.intent.IntentEvent; |
26 | -import org.onosproject.net.intent.IntentId; | ||
27 | import org.onosproject.net.intent.IntentListener; | 26 | import org.onosproject.net.intent.IntentListener; |
28 | import org.onosproject.net.intent.IntentService; | 27 | import org.onosproject.net.intent.IntentService; |
29 | import org.onosproject.net.intent.IntentState; | 28 | import org.onosproject.net.intent.IntentState; |
... | @@ -108,12 +107,15 @@ public class BandwidthCalendarResource extends BaseResource { | ... | @@ -108,12 +107,15 @@ public class BandwidthCalendarResource extends BaseResource { |
108 | public Response withdrawIntent(@PathParam("intentId") String intentId) { | 107 | public Response withdrawIntent(@PathParam("intentId") String intentId) { |
109 | log.info("Receiving Teardown request for {}", intentId); | 108 | log.info("Receiving Teardown request for {}", intentId); |
110 | IntentService service = get(IntentService.class); | 109 | IntentService service = get(IntentService.class); |
110 | + // TODO: there needs to be an app id and key here | ||
111 | + /* | ||
111 | Intent intent = service.getIntent(IntentId.valueOf(Long.parseLong(intentId))); | 112 | Intent intent = service.getIntent(IntentId.valueOf(Long.parseLong(intentId))); |
112 | if (intent != null) { | 113 | if (intent != null) { |
113 | service.withdraw(intent); | 114 | service.withdraw(intent); |
114 | String reply = "ok\n"; | 115 | String reply = "ok\n"; |
115 | return Response.ok(reply).build(); | 116 | return Response.ok(reply).build(); |
116 | } | 117 | } |
118 | + */ | ||
117 | return Response.status(Response.Status.NOT_FOUND).build(); | 119 | return Response.status(Response.Status.NOT_FOUND).build(); |
118 | } | 120 | } |
119 | 121 | ||
... | @@ -163,7 +165,7 @@ public class BandwidthCalendarResource extends BaseResource { | ... | @@ -163,7 +165,7 @@ public class BandwidthCalendarResource extends BaseResource { |
163 | @Override | 165 | @Override |
164 | public void event(IntentEvent event) { | 166 | public void event(IntentEvent event) { |
165 | if (event.subject().equals(intent)) { | 167 | if (event.subject().equals(intent)) { |
166 | - state = service.getIntentState(intent.id()); | 168 | + state = service.getIntentState(intent.key()); |
167 | if (state == INSTALLED || state == FAILED || state == WITHDRAWN) { | 169 | if (state == INSTALLED || state == FAILED || state == WITHDRAWN) { |
168 | latch.countDown(); | 170 | latch.countDown(); |
169 | } | 171 | } | ... | ... |
... | @@ -100,7 +100,7 @@ public class OpticalPathProvisioner { | ... | @@ -100,7 +100,7 @@ public class OpticalPathProvisioner { |
100 | inStatusTportMap.clear(); | 100 | inStatusTportMap.clear(); |
101 | outStatusTportMap.clear(); | 101 | outStatusTportMap.clear(); |
102 | for (Intent intent : intentService.getIntents()) { | 102 | for (Intent intent : intentService.getIntents()) { |
103 | - if (intentService.getIntentState(intent.id()) == INSTALLED) { | 103 | + if (intentService.getIntentState(intent.key()) == INSTALLED) { |
104 | if (intent instanceof OpticalConnectivityIntent) { | 104 | if (intent instanceof OpticalConnectivityIntent) { |
105 | inStatusTportMap.put(((OpticalConnectivityIntent) intent).getSrc(), | 105 | inStatusTportMap.put(((OpticalConnectivityIntent) intent).getSrc(), |
106 | (OpticalConnectivityIntent) intent); | 106 | (OpticalConnectivityIntent) intent); |
... | @@ -177,7 +177,7 @@ public class OpticalPathProvisioner { | ... | @@ -177,7 +177,7 @@ public class OpticalPathProvisioner { |
177 | // TODO change the coordination approach between packet intents and optical intents | 177 | // TODO change the coordination approach between packet intents and optical intents |
178 | // Low speed LLDP may cause multiple calls which are not expected | 178 | // Low speed LLDP may cause multiple calls which are not expected |
179 | 179 | ||
180 | - if (!IntentState.FAILED.equals(intentService.getIntentState(intent.id()))) { | 180 | + if (!IntentState.FAILED.equals(intentService.getIntentState(intent.key()))) { |
181 | return; | 181 | return; |
182 | } | 182 | } |
183 | 183 | ... | ... |
... | @@ -579,7 +579,7 @@ public class IntentSynchronizer implements FibListener { | ... | @@ -579,7 +579,7 @@ public class IntentSynchronizer implements FibListener { |
579 | } | 579 | } |
580 | 580 | ||
581 | IntentState state = | 581 | IntentState state = |
582 | - intentService.getIntentState(fetchedIntent.id()); | 582 | + intentService.getIntentState(fetchedIntent.key()); |
583 | if (state == null || | 583 | if (state == null || |
584 | state == IntentState.WITHDRAWING || | 584 | state == IntentState.WITHDRAWING || |
585 | state == IntentState.WITHDRAWN) { | 585 | state == IntentState.WITHDRAWN) { |
... | @@ -601,7 +601,7 @@ public class IntentSynchronizer implements FibListener { | ... | @@ -601,7 +601,7 @@ public class IntentSynchronizer implements FibListener { |
601 | } | 601 | } |
602 | 602 | ||
603 | IntentState state = | 603 | IntentState state = |
604 | - intentService.getIntentState(fetchedIntent.id()); | 604 | + intentService.getIntentState(fetchedIntent.key()); |
605 | if (state == null || | 605 | if (state == null || |
606 | state == IntentState.WITHDRAWING || | 606 | state == IntentState.WITHDRAWING || |
607 | state == IntentState.WITHDRAWN) { | 607 | state == IntentState.WITHDRAWN) { | ... | ... |
... | @@ -535,19 +535,19 @@ public class IntentSyncTest extends AbstractIntentTest { | ... | @@ -535,19 +535,19 @@ public class IntentSyncTest extends AbstractIntentTest { |
535 | reset(intentService); | 535 | reset(intentService); |
536 | Set<Intent> intents = new HashSet<Intent>(); | 536 | Set<Intent> intents = new HashSet<Intent>(); |
537 | intents.add(intent1); | 537 | intents.add(intent1); |
538 | - expect(intentService.getIntentState(intent1.id())) | 538 | + expect(intentService.getIntentState(intent1.key())) |
539 | .andReturn(IntentState.INSTALLED).anyTimes(); | 539 | .andReturn(IntentState.INSTALLED).anyTimes(); |
540 | intents.add(intent2); | 540 | intents.add(intent2); |
541 | - expect(intentService.getIntentState(intent2.id())) | 541 | + expect(intentService.getIntentState(intent2.key())) |
542 | .andReturn(IntentState.INSTALLED).anyTimes(); | 542 | .andReturn(IntentState.INSTALLED).anyTimes(); |
543 | intents.add(intent4); | 543 | intents.add(intent4); |
544 | - expect(intentService.getIntentState(intent4.id())) | 544 | + expect(intentService.getIntentState(intent4.key())) |
545 | .andReturn(IntentState.INSTALLED).anyTimes(); | 545 | .andReturn(IntentState.INSTALLED).anyTimes(); |
546 | intents.add(intent5); | 546 | intents.add(intent5); |
547 | - expect(intentService.getIntentState(intent5.id())) | 547 | + expect(intentService.getIntentState(intent5.key())) |
548 | .andReturn(IntentState.INSTALLED).anyTimes(); | 548 | .andReturn(IntentState.INSTALLED).anyTimes(); |
549 | intents.add(intent7); | 549 | intents.add(intent7); |
550 | - expect(intentService.getIntentState(intent7.id())) | 550 | + expect(intentService.getIntentState(intent7.key())) |
551 | .andReturn(IntentState.WITHDRAWING).anyTimes(); | 551 | .andReturn(IntentState.WITHDRAWING).anyTimes(); |
552 | expect(intentService.getIntents()).andReturn(intents).anyTimes(); | 552 | expect(intentService.getIntents()).andReturn(intents).anyTimes(); |
553 | 553 | ... | ... |
... | @@ -39,7 +39,7 @@ public class IntentIdCompleter implements Completer { | ... | @@ -39,7 +39,7 @@ public class IntentIdCompleter implements Completer { |
39 | Iterator<Intent> it = service.getIntents().iterator(); | 39 | Iterator<Intent> it = service.getIntents().iterator(); |
40 | SortedSet<String> strings = delegate.getStrings(); | 40 | SortedSet<String> strings = delegate.getStrings(); |
41 | while (it.hasNext()) { | 41 | while (it.hasNext()) { |
42 | - strings.add(it.next().id().toString()); | 42 | + strings.add(it.next().key().toString()); |
43 | } | 43 | } |
44 | 44 | ||
45 | // Now let the completer do the work for figuring out what to offer. | 45 | // Now let the completer do the work for figuring out what to offer. | ... | ... |
... | @@ -19,8 +19,8 @@ import org.apache.karaf.shell.commands.Argument; | ... | @@ -19,8 +19,8 @@ import org.apache.karaf.shell.commands.Argument; |
19 | import org.apache.karaf.shell.commands.Command; | 19 | import org.apache.karaf.shell.commands.Command; |
20 | import org.onosproject.cli.AbstractShellCommand; | 20 | import org.onosproject.cli.AbstractShellCommand; |
21 | import org.onosproject.net.intent.Intent; | 21 | import org.onosproject.net.intent.Intent; |
22 | -import org.onosproject.net.intent.IntentId; | ||
23 | import org.onosproject.net.intent.IntentService; | 22 | import org.onosproject.net.intent.IntentService; |
23 | +import org.onosproject.net.intent.Key; | ||
24 | 24 | ||
25 | import java.math.BigInteger; | 25 | import java.math.BigInteger; |
26 | 26 | ||
... | @@ -43,8 +43,8 @@ public class IntentRemoveCommand extends AbstractShellCommand { | ... | @@ -43,8 +43,8 @@ public class IntentRemoveCommand extends AbstractShellCommand { |
43 | id = id.replaceFirst("0x", ""); | 43 | id = id.replaceFirst("0x", ""); |
44 | } | 44 | } |
45 | 45 | ||
46 | - IntentId intentId = IntentId.valueOf(new BigInteger(id, 16).longValue()); | 46 | + Key key = Key.of(new BigInteger(id, 16).longValue(), appId()); |
47 | - Intent intent = service.getIntent(intentId); | 47 | + Intent intent = service.getIntent(key); |
48 | if (intent != null) { | 48 | if (intent != null) { |
49 | service.withdraw(intent); | 49 | service.withdraw(intent); |
50 | } | 50 | } | ... | ... |
... | @@ -76,7 +76,7 @@ public class IntentsListCommand extends AbstractShellCommand { | ... | @@ -76,7 +76,7 @@ public class IntentsListCommand extends AbstractShellCommand { |
76 | print("%s", json(service, service.getIntents())); | 76 | print("%s", json(service, service.getIntents())); |
77 | } else { | 77 | } else { |
78 | for (Intent intent : service.getIntents()) { | 78 | for (Intent intent : service.getIntents()) { |
79 | - IntentState state = service.getIntentState(intent.id()); | 79 | + IntentState state = service.getIntentState(intent.key()); |
80 | if (state != null) { | 80 | if (state != null) { |
81 | print("id=%s, state=%s, type=%s, appId=%s", | 81 | print("id=%s, state=%s, type=%s, appId=%s", |
82 | intent.id(), state, intent.getClass().getSimpleName(), | 82 | intent.id(), state, intent.getClass().getSimpleName(), |
... | @@ -130,7 +130,7 @@ public class IntentsListCommand extends AbstractShellCommand { | ... | @@ -130,7 +130,7 @@ public class IntentsListCommand extends AbstractShellCommand { |
130 | 130 | ||
131 | // Collect the summary for each intent type intents | 131 | // Collect the summary for each intent type intents |
132 | for (Intent intent : intents) { | 132 | for (Intent intent : intents) { |
133 | - IntentState intentState = service.getIntentState(intent.id()); | 133 | + IntentState intentState = service.getIntentState(intent.key()); |
134 | if (intentState == null) { | 134 | if (intentState == null) { |
135 | continue; | 135 | continue; |
136 | } | 136 | } |
... | @@ -365,7 +365,7 @@ public class IntentsListCommand extends AbstractShellCommand { | ... | @@ -365,7 +365,7 @@ public class IntentsListCommand extends AbstractShellCommand { |
365 | print(" egress=%s", li.egressPoints()); | 365 | print(" egress=%s", li.egressPoints()); |
366 | } | 366 | } |
367 | 367 | ||
368 | - List<Intent> installable = service.getInstallableIntents(intent.id()); | 368 | + List<Intent> installable = service.getInstallableIntents(intent.key()); |
369 | if (showInstallable && installable != null && !installable.isEmpty()) { | 369 | if (showInstallable && installable != null && !installable.isEmpty()) { |
370 | print(" installable=%s", installable); | 370 | print(" installable=%s", installable); |
371 | } | 371 | } |
... | @@ -387,7 +387,7 @@ public class IntentsListCommand extends AbstractShellCommand { | ... | @@ -387,7 +387,7 @@ public class IntentsListCommand extends AbstractShellCommand { |
387 | .put("type", intent.getClass().getSimpleName()) | 387 | .put("type", intent.getClass().getSimpleName()) |
388 | .put("appId", intent.appId().name()); | 388 | .put("appId", intent.appId().name()); |
389 | 389 | ||
390 | - IntentState state = service.getIntentState(intent.id()); | 390 | + IntentState state = service.getIntentState(intent.key()); |
391 | if (state != null) { | 391 | if (state != null) { |
392 | result.put("state", state.toString()); | 392 | result.put("state", state.toString()); |
393 | } | 393 | } |
... | @@ -438,7 +438,7 @@ public class IntentsListCommand extends AbstractShellCommand { | ... | @@ -438,7 +438,7 @@ public class IntentsListCommand extends AbstractShellCommand { |
438 | result.set("links", LinksListCommand.json(li.links())); | 438 | result.set("links", LinksListCommand.json(li.links())); |
439 | } | 439 | } |
440 | 440 | ||
441 | - List<Intent> installable = service.getInstallableIntents(intent.id()); | 441 | + List<Intent> installable = service.getInstallableIntents(intent.key()); |
442 | if (installable != null && !installable.isEmpty()) { | 442 | if (installable != null && !installable.isEmpty()) { |
443 | result.set("installable", json(service, installable)); | 443 | result.set("installable", json(service, installable)); |
444 | } | 444 | } | ... | ... |
... | @@ -64,7 +64,7 @@ public class WipeOutCommand extends ClustersListCommand { | ... | @@ -64,7 +64,7 @@ public class WipeOutCommand extends ClustersListCommand { |
64 | print("Wiping intents"); | 64 | print("Wiping intents"); |
65 | IntentService intentService = get(IntentService.class); | 65 | IntentService intentService = get(IntentService.class); |
66 | for (Intent intent : intentService.getIntents()) { | 66 | for (Intent intent : intentService.getIntents()) { |
67 | - if (intentService.getIntentState(intent.id()) == IntentState.INSTALLED) { | 67 | + if (intentService.getIntentState(intent.key()) == IntentState.INSTALLED) { |
68 | intentService.withdraw(intent); | 68 | intentService.withdraw(intent); |
69 | } | 69 | } |
70 | } | 70 | } | ... | ... |
... | @@ -43,6 +43,14 @@ public interface IntentService { | ... | @@ -43,6 +43,14 @@ public interface IntentService { |
43 | void withdraw(Intent intent); | 43 | void withdraw(Intent intent); |
44 | 44 | ||
45 | /** | 45 | /** |
46 | + * Fetches an intent based on its key. | ||
47 | + * | ||
48 | + * @param key key of the intent | ||
49 | + * @return intent object if the key is found, null otherwise | ||
50 | + */ | ||
51 | + public Intent getIntent(Key key); | ||
52 | + | ||
53 | + /** | ||
46 | * Returns an iterable of intents currently in the system. | 54 | * Returns an iterable of intents currently in the system. |
47 | * | 55 | * |
48 | * @return set of intents | 56 | * @return set of intents |
... | @@ -57,30 +65,22 @@ public interface IntentService { | ... | @@ -57,30 +65,22 @@ public interface IntentService { |
57 | long getIntentCount(); | 65 | long getIntentCount(); |
58 | 66 | ||
59 | /** | 67 | /** |
60 | - * Retrieves the intent specified by its identifier. | ||
61 | - * | ||
62 | - * @param id intent identifier | ||
63 | - * @return the intent or null if one with the given identifier is not found | ||
64 | - */ | ||
65 | - Intent getIntent(IntentId id); | ||
66 | - | ||
67 | - /** | ||
68 | * Retrieves the state of an intent by its identifier. | 68 | * Retrieves the state of an intent by its identifier. |
69 | * | 69 | * |
70 | - * @param id intent identifier | 70 | + * @param intentKey intent identifier |
71 | * @return the intent state or null if one with the given identifier is not | 71 | * @return the intent state or null if one with the given identifier is not |
72 | * found | 72 | * found |
73 | */ | 73 | */ |
74 | - IntentState getIntentState(IntentId id); | 74 | + IntentState getIntentState(Key intentKey); |
75 | 75 | ||
76 | /** | 76 | /** |
77 | * Returns the list of the installable events associated with the specified | 77 | * Returns the list of the installable events associated with the specified |
78 | * top-level intent. | 78 | * top-level intent. |
79 | * | 79 | * |
80 | - * @param intentId top-level intent identifier | 80 | + * @param intentKey top-level intent identifier |
81 | * @return compiled installable intents | 81 | * @return compiled installable intents |
82 | */ | 82 | */ |
83 | - List<Intent> getInstallableIntents(IntentId intentId); | 83 | + List<Intent> getInstallableIntents(Key intentKey); |
84 | 84 | ||
85 | /** | 85 | /** |
86 | * Adds the specified listener for intent events. | 86 | * Adds the specified listener for intent events. | ... | ... |
... | @@ -40,37 +40,24 @@ public interface IntentStore extends Store<IntentEvent, IntentStoreDelegate> { | ... | @@ -40,37 +40,24 @@ public interface IntentStore extends Store<IntentEvent, IntentStoreDelegate> { |
40 | Iterable<Intent> getIntents(); | 40 | Iterable<Intent> getIntents(); |
41 | 41 | ||
42 | /** | 42 | /** |
43 | - * Returns the intent with the specified identifier. | ||
44 | - * | ||
45 | - * @param intentId intent identification | ||
46 | - * @return intent or null if not found | ||
47 | - */ | ||
48 | - @Deprecated | ||
49 | - default Intent getIntent(IntentId intentId) { | ||
50 | - throw new UnsupportedOperationException("deprecated"); | ||
51 | - } | ||
52 | - | ||
53 | - /** | ||
54 | * Returns the state of the specified intent. | 43 | * Returns the state of the specified intent. |
55 | * | 44 | * |
56 | - * @param intentId intent identification | 45 | + * @param intentKey intent identification |
57 | * @return current intent state | 46 | * @return current intent state |
58 | */ | 47 | */ |
59 | - @Deprecated | 48 | + default IntentState getIntentState(Key intentKey) { |
60 | - default IntentState getIntentState(IntentId intentId) { | 49 | + return null; |
61 | - throw new UnsupportedOperationException("deprecated"); | ||
62 | } | 50 | } |
63 | 51 | ||
64 | /** | 52 | /** |
65 | * Returns the list of the installable events associated with the specified | 53 | * Returns the list of the installable events associated with the specified |
66 | * original intent. | 54 | * original intent. |
67 | * | 55 | * |
68 | - * @param intentId original intent identifier | 56 | + * @param intentKey original intent identifier |
69 | * @return compiled installable intents | 57 | * @return compiled installable intents |
70 | */ | 58 | */ |
71 | - @Deprecated | 59 | + default List<Intent> getInstallableIntents(Key intentKey) { |
72 | - default List<Intent> getInstallableIntents(IntentId intentId) { | 60 | + throw new UnsupportedOperationException("getInstallableIntents()"); |
73 | - throw new UnsupportedOperationException("deprecated"); | ||
74 | } | 61 | } |
75 | 62 | ||
76 | /** | 63 | /** |
... | @@ -92,7 +79,8 @@ public interface IntentStore extends Store<IntentEvent, IntentStoreDelegate> { | ... | @@ -92,7 +79,8 @@ public interface IntentStore extends Store<IntentEvent, IntentStoreDelegate> { |
92 | * @param key key | 79 | * @param key key |
93 | * @return intent or null if not found | 80 | * @return intent or null if not found |
94 | */ | 81 | */ |
95 | - default Intent getIntent(Key key) { //FIXME remove when impl. | 82 | + default Intent getIntent(Key key) { |
83 | + // FIXME remove this default implementation when all stores have implemented it | ||
96 | return null; | 84 | return null; |
97 | } | 85 | } |
98 | 86 | ... | ... |
... | @@ -196,18 +196,18 @@ public class FakeIntentManager implements TestableIntentService { | ... | @@ -196,18 +196,18 @@ public class FakeIntentManager implements TestableIntentService { |
196 | } | 196 | } |
197 | 197 | ||
198 | @Override | 198 | @Override |
199 | - public Intent getIntent(IntentId id) { | 199 | + public Intent getIntent(Key intentKey) { |
200 | - return intents.get(id); | 200 | + return intents.get(intentKey); |
201 | } | 201 | } |
202 | 202 | ||
203 | @Override | 203 | @Override |
204 | - public IntentState getIntentState(IntentId id) { | 204 | + public IntentState getIntentState(Key intentKey) { |
205 | - return intentStates.get(id); | 205 | + return intentStates.get(intentKey); |
206 | } | 206 | } |
207 | 207 | ||
208 | @Override | 208 | @Override |
209 | - public List<Intent> getInstallableIntents(IntentId intentId) { | 209 | + public List<Intent> getInstallableIntents(Key intentKey) { |
210 | - return installables.get(intentId); | 210 | + return installables.get(intentKey); |
211 | } | 211 | } |
212 | 212 | ||
213 | @Override | 213 | @Override | ... | ... |
... | @@ -43,17 +43,17 @@ public class IntentServiceAdapter implements IntentService { | ... | @@ -43,17 +43,17 @@ public class IntentServiceAdapter implements IntentService { |
43 | } | 43 | } |
44 | 44 | ||
45 | @Override | 45 | @Override |
46 | - public Intent getIntent(IntentId id) { | 46 | + public Intent getIntent(Key intentKey) { |
47 | return null; | 47 | return null; |
48 | } | 48 | } |
49 | 49 | ||
50 | @Override | 50 | @Override |
51 | - public IntentState getIntentState(IntentId id) { | 51 | + public IntentState getIntentState(Key intentKey) { |
52 | return null; | 52 | return null; |
53 | } | 53 | } |
54 | 54 | ||
55 | @Override | 55 | @Override |
56 | - public List<Intent> getInstallableIntents(IntentId intentId) { | 56 | + public List<Intent> getInstallableIntents(Key intentKey) { |
57 | return null; | 57 | return null; |
58 | } | 58 | } |
59 | 59 | ... | ... |
... | @@ -91,7 +91,7 @@ public class IntentServiceTest { | ... | @@ -91,7 +91,7 @@ public class IntentServiceTest { |
91 | @Override | 91 | @Override |
92 | public void run() { | 92 | public void run() { |
93 | assertEquals("incorrect intent state", IntentState.INSTALLED, | 93 | assertEquals("incorrect intent state", IntentState.INSTALLED, |
94 | - service.getIntentState(intent.id())); | 94 | + service.getIntentState(intent.key())); |
95 | } | 95 | } |
96 | }); | 96 | }); |
97 | 97 | ||
... | @@ -112,7 +112,7 @@ public class IntentServiceTest { | ... | @@ -112,7 +112,7 @@ public class IntentServiceTest { |
112 | @Override | 112 | @Override |
113 | public void run() { | 113 | public void run() { |
114 | assertEquals("incorrect intent state", IntentState.WITHDRAWN, | 114 | assertEquals("incorrect intent state", IntentState.WITHDRAWN, |
115 | - service.getIntentState(intent.id())); | 115 | + service.getIntentState(intent.key())); |
116 | } | 116 | } |
117 | }); | 117 | }); |
118 | 118 | ||
... | @@ -140,7 +140,7 @@ public class IntentServiceTest { | ... | @@ -140,7 +140,7 @@ public class IntentServiceTest { |
140 | @Override | 140 | @Override |
141 | public void run() { | 141 | public void run() { |
142 | assertEquals("incorrect intent state", IntentState.FAILED, | 142 | assertEquals("incorrect intent state", IntentState.FAILED, |
143 | - service.getIntentState(intent.id())); | 143 | + service.getIntentState(intent.key())); |
144 | } | 144 | } |
145 | }); | 145 | }); |
146 | 146 | ||
... | @@ -163,7 +163,7 @@ public class IntentServiceTest { | ... | @@ -163,7 +163,7 @@ public class IntentServiceTest { |
163 | @Override | 163 | @Override |
164 | public void run() { | 164 | public void run() { |
165 | assertEquals("incorrect intent state", IntentState.FAILED, | 165 | assertEquals("incorrect intent state", IntentState.FAILED, |
166 | - service.getIntentState(intent.id())); | 166 | + service.getIntentState(intent.key())); |
167 | } | 167 | } |
168 | }); | 168 | }); |
169 | 169 | ||
... | @@ -255,7 +255,7 @@ public class IntentServiceTest { | ... | @@ -255,7 +255,7 @@ public class IntentServiceTest { |
255 | @Override | 255 | @Override |
256 | public void run() { | 256 | public void run() { |
257 | assertEquals("incorrect intent state", IntentState.INSTALLED, | 257 | assertEquals("incorrect intent state", IntentState.INSTALLED, |
258 | - service.getIntentState(intent.id())); | 258 | + service.getIntentState(intent.key())); |
259 | } | 259 | } |
260 | }); | 260 | }); |
261 | 261 | ... | ... |
... | @@ -40,13 +40,13 @@ import org.onosproject.net.intent.IntentData; | ... | @@ -40,13 +40,13 @@ import org.onosproject.net.intent.IntentData; |
40 | import org.onosproject.net.intent.IntentEvent; | 40 | import org.onosproject.net.intent.IntentEvent; |
41 | import org.onosproject.net.intent.IntentException; | 41 | import org.onosproject.net.intent.IntentException; |
42 | import org.onosproject.net.intent.IntentExtensionService; | 42 | import org.onosproject.net.intent.IntentExtensionService; |
43 | -import org.onosproject.net.intent.IntentId; | ||
44 | import org.onosproject.net.intent.IntentInstaller; | 43 | import org.onosproject.net.intent.IntentInstaller; |
45 | import org.onosproject.net.intent.IntentListener; | 44 | import org.onosproject.net.intent.IntentListener; |
46 | import org.onosproject.net.intent.IntentService; | 45 | import org.onosproject.net.intent.IntentService; |
47 | import org.onosproject.net.intent.IntentState; | 46 | import org.onosproject.net.intent.IntentState; |
48 | import org.onosproject.net.intent.IntentStore; | 47 | import org.onosproject.net.intent.IntentStore; |
49 | import org.onosproject.net.intent.IntentStoreDelegate; | 48 | import org.onosproject.net.intent.IntentStoreDelegate; |
49 | +import org.onosproject.net.intent.Key; | ||
50 | import org.slf4j.Logger; | 50 | import org.slf4j.Logger; |
51 | 51 | ||
52 | import java.util.ArrayList; | 52 | import java.util.ArrayList; |
... | @@ -81,7 +81,7 @@ public class IntentManager | ... | @@ -81,7 +81,7 @@ public class IntentManager |
81 | private static final Logger log = getLogger(IntentManager.class); | 81 | private static final Logger log = getLogger(IntentManager.class); |
82 | 82 | ||
83 | public static final String INTENT_NULL = "Intent cannot be null"; | 83 | public static final String INTENT_NULL = "Intent cannot be null"; |
84 | - public static final String INTENT_ID_NULL = "Intent ID cannot be null"; | 84 | + public static final String INTENT_ID_NULL = "Intent key cannot be null"; |
85 | 85 | ||
86 | private static final int NUM_THREADS = 12; | 86 | private static final int NUM_THREADS = 12; |
87 | 87 | ||
... | @@ -163,6 +163,11 @@ public class IntentManager | ... | @@ -163,6 +163,11 @@ public class IntentManager |
163 | } | 163 | } |
164 | 164 | ||
165 | @Override | 165 | @Override |
166 | + public Intent getIntent(Key key) { | ||
167 | + return store.getIntent(key); | ||
168 | + } | ||
169 | + | ||
170 | + @Override | ||
166 | public Iterable<Intent> getIntents() { | 171 | public Iterable<Intent> getIntents() { |
167 | return store.getIntents(); | 172 | return store.getIntents(); |
168 | } | 173 | } |
... | @@ -173,21 +178,15 @@ public class IntentManager | ... | @@ -173,21 +178,15 @@ public class IntentManager |
173 | } | 178 | } |
174 | 179 | ||
175 | @Override | 180 | @Override |
176 | - public Intent getIntent(IntentId id) { | 181 | + public IntentState getIntentState(Key intentKey) { |
177 | - checkNotNull(id, INTENT_ID_NULL); | 182 | + checkNotNull(intentKey, INTENT_ID_NULL); |
178 | - return store.getIntent(id); | 183 | + return store.getIntentState(intentKey); |
179 | - } | ||
180 | - | ||
181 | - @Override | ||
182 | - public IntentState getIntentState(IntentId id) { | ||
183 | - checkNotNull(id, INTENT_ID_NULL); | ||
184 | - return store.getIntentState(id); | ||
185 | } | 184 | } |
186 | 185 | ||
187 | @Override | 186 | @Override |
188 | - public List<Intent> getInstallableIntents(IntentId intentId) { | 187 | + public List<Intent> getInstallableIntents(Key intentKey) { |
189 | - checkNotNull(intentId, INTENT_ID_NULL); | 188 | + checkNotNull(intentKey, INTENT_ID_NULL); |
190 | - return store.getInstallableIntents(intentId); | 189 | + return store.getInstallableIntents(intentKey); |
191 | } | 190 | } |
192 | 191 | ||
193 | @Override | 192 | @Override |
... | @@ -446,11 +445,11 @@ public class IntentManager | ... | @@ -446,11 +445,11 @@ public class IntentManager |
446 | } | 445 | } |
447 | } | 446 | } |
448 | 447 | ||
449 | - private void buildAndSubmitBatches(Iterable<IntentId> intentIds, | 448 | + private void buildAndSubmitBatches(Iterable<Key> intentKeys, |
450 | boolean compileAllFailed) { | 449 | boolean compileAllFailed) { |
451 | // Attempt recompilation of the specified intents first. | 450 | // Attempt recompilation of the specified intents first. |
452 | - for (IntentId id : intentIds) { | 451 | + for (Key key : intentKeys) { |
453 | - Intent intent = store.getIntent(id); | 452 | + Intent intent = store.getIntent(key); |
454 | if (intent == null) { | 453 | if (intent == null) { |
455 | continue; | 454 | continue; |
456 | } | 455 | } |
... | @@ -460,7 +459,7 @@ public class IntentManager | ... | @@ -460,7 +459,7 @@ public class IntentManager |
460 | if (compileAllFailed) { | 459 | if (compileAllFailed) { |
461 | // If required, compile all currently failed intents. | 460 | // If required, compile all currently failed intents. |
462 | for (Intent intent : getIntents()) { | 461 | for (Intent intent : getIntents()) { |
463 | - IntentState state = getIntentState(intent.id()); | 462 | + IntentState state = getIntentState(intent.key()); |
464 | if (RECOMPILE.contains(state)) { | 463 | if (RECOMPILE.contains(state)) { |
465 | if (state == WITHDRAW_REQ) { | 464 | if (state == WITHDRAW_REQ) { |
466 | withdraw(intent); | 465 | withdraw(intent); |
... | @@ -482,9 +481,9 @@ public class IntentManager | ... | @@ -482,9 +481,9 @@ public class IntentManager |
482 | // Topology change delegate | 481 | // Topology change delegate |
483 | private class InternalTopoChangeDelegate implements TopologyChangeDelegate { | 482 | private class InternalTopoChangeDelegate implements TopologyChangeDelegate { |
484 | @Override | 483 | @Override |
485 | - public void triggerCompile(Iterable<IntentId> intentIds, | 484 | + public void triggerCompile(Iterable<Key> intentKeys, |
486 | boolean compileAllFailed) { | 485 | boolean compileAllFailed) { |
487 | - buildAndSubmitBatches(intentIds, compileAllFailed); | 486 | + buildAndSubmitBatches(intentKeys, compileAllFailed); |
488 | } | 487 | } |
489 | } | 488 | } |
490 | 489 | ... | ... |
... | @@ -29,8 +29,8 @@ import org.onosproject.event.Event; | ... | @@ -29,8 +29,8 @@ import org.onosproject.event.Event; |
29 | import org.onosproject.net.Link; | 29 | import org.onosproject.net.Link; |
30 | import org.onosproject.net.LinkKey; | 30 | import org.onosproject.net.LinkKey; |
31 | import org.onosproject.net.NetworkResource; | 31 | import org.onosproject.net.NetworkResource; |
32 | -import org.onosproject.net.intent.IntentId; | ||
33 | import org.onosproject.net.intent.IntentService; | 32 | import org.onosproject.net.intent.IntentService; |
33 | +import org.onosproject.net.intent.Key; | ||
34 | import org.onosproject.net.link.LinkEvent; | 34 | import org.onosproject.net.link.LinkEvent; |
35 | import org.onosproject.net.resource.LinkResourceEvent; | 35 | import org.onosproject.net.resource.LinkResourceEvent; |
36 | import org.onosproject.net.resource.LinkResourceListener; | 36 | import org.onosproject.net.resource.LinkResourceListener; |
... | @@ -65,8 +65,8 @@ public class ObjectiveTracker implements ObjectiveTrackerService { | ... | @@ -65,8 +65,8 @@ public class ObjectiveTracker implements ObjectiveTrackerService { |
65 | 65 | ||
66 | private final Logger log = getLogger(getClass()); | 66 | private final Logger log = getLogger(getClass()); |
67 | 67 | ||
68 | - private final SetMultimap<LinkKey, IntentId> intentsByLink = | 68 | + private final SetMultimap<LinkKey, Key> intentsByLink = |
69 | - synchronizedSetMultimap(HashMultimap.<LinkKey, IntentId>create()); | 69 | + synchronizedSetMultimap(HashMultimap.<LinkKey, Key>create()); |
70 | 70 | ||
71 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | 71 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
72 | protected TopologyService topologyService; | 72 | protected TopologyService topologyService; |
... | @@ -126,21 +126,21 @@ public class ObjectiveTracker implements ObjectiveTrackerService { | ... | @@ -126,21 +126,21 @@ public class ObjectiveTracker implements ObjectiveTrackerService { |
126 | } | 126 | } |
127 | 127 | ||
128 | @Override | 128 | @Override |
129 | - public void addTrackedResources(IntentId intentId, | 129 | + public void addTrackedResources(Key intentKey, |
130 | Collection<NetworkResource> resources) { | 130 | Collection<NetworkResource> resources) { |
131 | for (NetworkResource resource : resources) { | 131 | for (NetworkResource resource : resources) { |
132 | if (resource instanceof Link) { | 132 | if (resource instanceof Link) { |
133 | - intentsByLink.put(linkKey((Link) resource), intentId); | 133 | + intentsByLink.put(linkKey((Link) resource), intentKey); |
134 | } | 134 | } |
135 | } | 135 | } |
136 | } | 136 | } |
137 | 137 | ||
138 | @Override | 138 | @Override |
139 | - public void removeTrackedResources(IntentId intentId, | 139 | + public void removeTrackedResources(Key intentKey, |
140 | Collection<NetworkResource> resources) { | 140 | Collection<NetworkResource> resources) { |
141 | for (NetworkResource resource : resources) { | 141 | for (NetworkResource resource : resources) { |
142 | if (resource instanceof Link) { | 142 | if (resource instanceof Link) { |
143 | - intentsByLink.remove(linkKey((Link) resource), intentId); | 143 | + intentsByLink.remove(linkKey((Link) resource), intentKey); |
144 | } | 144 | } |
145 | } | 145 | } |
146 | } | 146 | } |
... | @@ -170,10 +170,10 @@ public class ObjectiveTracker implements ObjectiveTrackerService { | ... | @@ -170,10 +170,10 @@ public class ObjectiveTracker implements ObjectiveTrackerService { |
170 | } | 170 | } |
171 | 171 | ||
172 | if (event.reasons() == null || event.reasons().isEmpty()) { | 172 | if (event.reasons() == null || event.reasons().isEmpty()) { |
173 | - delegate.triggerCompile(new HashSet<IntentId>(), true); | 173 | + delegate.triggerCompile(new HashSet<Key>(), true); |
174 | 174 | ||
175 | } else { | 175 | } else { |
176 | - Set<IntentId> toBeRecompiled = new HashSet<>(); | 176 | + Set<Key> toBeRecompiled = new HashSet<>(); |
177 | boolean recompileOnly = true; | 177 | boolean recompileOnly = true; |
178 | 178 | ||
179 | // Scan through the list of reasons and keep accruing all | 179 | // Scan through the list of reasons and keep accruing all |
... | @@ -186,9 +186,9 @@ public class ObjectiveTracker implements ObjectiveTrackerService { | ... | @@ -186,9 +186,9 @@ public class ObjectiveTracker implements ObjectiveTrackerService { |
186 | linkEvent.subject().isDurable())) { | 186 | linkEvent.subject().isDurable())) { |
187 | final LinkKey linkKey = linkKey(linkEvent.subject()); | 187 | final LinkKey linkKey = linkKey(linkEvent.subject()); |
188 | synchronized (intentsByLink) { | 188 | synchronized (intentsByLink) { |
189 | - Set<IntentId> intentIds = intentsByLink.get(linkKey); | 189 | + Set<Key> intentKeys = intentsByLink.get(linkKey); |
190 | - log.debug("recompile triggered by LinkDown {} {}", linkKey, intentIds); | 190 | + log.debug("recompile triggered by LinkDown {} {}", linkKey, intentKeys); |
191 | - toBeRecompiled.addAll(intentIds); | 191 | + toBeRecompiled.addAll(intentKeys); |
192 | } | 192 | } |
193 | } | 193 | } |
194 | recompileOnly = recompileOnly && | 194 | recompileOnly = recompileOnly && |
... | @@ -243,15 +243,15 @@ public class ObjectiveTracker implements ObjectiveTrackerService { | ... | @@ -243,15 +243,15 @@ public class ObjectiveTracker implements ObjectiveTrackerService { |
243 | } | 243 | } |
244 | intentService.getIntents().forEach(intent -> { | 244 | intentService.getIntents().forEach(intent -> { |
245 | if (intent.appId().equals(appId)) { | 245 | if (intent.appId().equals(appId)) { |
246 | - IntentId id = intent.id(); | 246 | + Key key = intent.key(); |
247 | Collection<NetworkResource> resources = Lists.newArrayList(); | 247 | Collection<NetworkResource> resources = Lists.newArrayList(); |
248 | - intentService.getInstallableIntents(id).stream() | 248 | + intentService.getInstallableIntents(key).stream() |
249 | .map(installable -> installable.resources()) | 249 | .map(installable -> installable.resources()) |
250 | .forEach(resources::addAll); | 250 | .forEach(resources::addAll); |
251 | if (track) { | 251 | if (track) { |
252 | - addTrackedResources(id, resources); | 252 | + addTrackedResources(key, resources); |
253 | } else { | 253 | } else { |
254 | - removeTrackedResources(id, resources); | 254 | + removeTrackedResources(key, resources); |
255 | } | 255 | } |
256 | } | 256 | } |
257 | }); | 257 | }); | ... | ... |
... | @@ -15,11 +15,11 @@ | ... | @@ -15,11 +15,11 @@ |
15 | */ | 15 | */ |
16 | package org.onosproject.net.intent.impl; | 16 | package org.onosproject.net.intent.impl; |
17 | 17 | ||
18 | -import org.onosproject.net.NetworkResource; | ||
19 | -import org.onosproject.net.intent.IntentId; | ||
20 | - | ||
21 | import java.util.Collection; | 18 | import java.util.Collection; |
22 | 19 | ||
20 | +import org.onosproject.net.NetworkResource; | ||
21 | +import org.onosproject.net.intent.Key; | ||
22 | + | ||
23 | /** | 23 | /** |
24 | * Auxiliary service for tracking intent path flows and for notifying the | 24 | * Auxiliary service for tracking intent path flows and for notifying the |
25 | * intent service of environment changes via topology change delegate. | 25 | * intent service of environment changes via topology change delegate. |
... | @@ -43,19 +43,20 @@ public interface ObjectiveTrackerService { | ... | @@ -43,19 +43,20 @@ public interface ObjectiveTrackerService { |
43 | /** | 43 | /** |
44 | * Adds a path flow to be tracked. | 44 | * Adds a path flow to be tracked. |
45 | * | 45 | * |
46 | - * @param intentId intent identity on whose behalf the path is being tracked | 46 | + * @param intentKey intent identity on whose behalf the path is being tracked |
47 | * @param resources resources to track | 47 | * @param resources resources to track |
48 | */ | 48 | */ |
49 | - public void addTrackedResources(IntentId intentId, | 49 | + // TODO consider using the IntentData here rather than just the key |
50 | + public void addTrackedResources(Key intentKey, | ||
50 | Collection<NetworkResource> resources); | 51 | Collection<NetworkResource> resources); |
51 | 52 | ||
52 | /** | 53 | /** |
53 | * Removes a path flow to be tracked. | 54 | * Removes a path flow to be tracked. |
54 | * | 55 | * |
55 | - * @param intentId intent identity on whose behalf the path is being tracked | 56 | + * @param intentKey intent identity on whose behalf the path is being tracked |
56 | * @param resources resources to stop tracking | 57 | * @param resources resources to stop tracking |
57 | */ | 58 | */ |
58 | - public void removeTrackedResources(IntentId intentId, | 59 | + public void removeTrackedResources(Key intentKey, |
59 | Collection<NetworkResource> resources); | 60 | Collection<NetworkResource> resources); |
60 | 61 | ||
61 | } | 62 | } | ... | ... |
... | @@ -15,7 +15,7 @@ | ... | @@ -15,7 +15,7 @@ |
15 | */ | 15 | */ |
16 | package org.onosproject.net.intent.impl; | 16 | package org.onosproject.net.intent.impl; |
17 | 17 | ||
18 | -import org.onosproject.net.intent.IntentId; | 18 | +import org.onosproject.net.intent.Key; |
19 | 19 | ||
20 | /** | 20 | /** |
21 | * Auxiliary delegate for integration of intent manager and flow trackerService. | 21 | * Auxiliary delegate for integration of intent manager and flow trackerService. |
... | @@ -32,6 +32,6 @@ public interface TopologyChangeDelegate { | ... | @@ -32,6 +32,6 @@ public interface TopologyChangeDelegate { |
32 | * @param compileAllFailed true implies full compile of all failed intents | 32 | * @param compileAllFailed true implies full compile of all failed intents |
33 | * is required; false for selective recompile only | 33 | * is required; false for selective recompile only |
34 | */ | 34 | */ |
35 | - void triggerCompile(Iterable<IntentId> intentIds, boolean compileAllFailed); | 35 | + void triggerCompile(Iterable<Key> intentIds, boolean compileAllFailed); |
36 | 36 | ||
37 | } | 37 | } | ... | ... |
... | @@ -45,6 +45,7 @@ import org.onosproject.net.intent.IntentListener; | ... | @@ -45,6 +45,7 @@ import org.onosproject.net.intent.IntentListener; |
45 | import org.onosproject.net.intent.IntentService; | 45 | import org.onosproject.net.intent.IntentService; |
46 | import org.onosproject.net.intent.IntentState; | 46 | import org.onosproject.net.intent.IntentState; |
47 | import org.onosproject.net.intent.IntentTestsMocks; | 47 | import org.onosproject.net.intent.IntentTestsMocks; |
48 | +import org.onosproject.net.intent.Key; | ||
48 | import org.onosproject.net.resource.LinkResourceAllocations; | 49 | import org.onosproject.net.resource.LinkResourceAllocations; |
49 | import org.onosproject.store.trivial.impl.SimpleIntentStore; | 50 | import org.onosproject.store.trivial.impl.SimpleIntentStore; |
50 | 51 | ||
... | @@ -133,12 +134,12 @@ public class IntentManagerTest { | ... | @@ -133,12 +134,12 @@ public class IntentManagerTest { |
133 | } | 134 | } |
134 | 135 | ||
135 | @Override | 136 | @Override |
136 | - public void addTrackedResources(IntentId intentId, Collection<NetworkResource> resources) { | 137 | + public void addTrackedResources(Key key, Collection<NetworkResource> resources) { |
137 | //TODO | 138 | //TODO |
138 | } | 139 | } |
139 | 140 | ||
140 | @Override | 141 | @Override |
141 | - public void removeTrackedResources(IntentId intentId, Collection<NetworkResource> resources) { | 142 | + public void removeTrackedResources(Key key, Collection<NetworkResource> resources) { |
142 | //TODO | 143 | //TODO |
143 | } | 144 | } |
144 | } | 145 | } |
... | @@ -294,7 +295,7 @@ public class IntentManagerTest { | ... | @@ -294,7 +295,7 @@ public class IntentManagerTest { |
294 | // verify that all intents are parked and the batch operation is unblocked | 295 | // verify that all intents are parked and the batch operation is unblocked |
295 | Set<IntentState> parked = Sets.newHashSet(INSTALLED, WITHDRAWN, FAILED); | 296 | Set<IntentState> parked = Sets.newHashSet(INSTALLED, WITHDRAWN, FAILED); |
296 | for (Intent i : service.getIntents()) { | 297 | for (Intent i : service.getIntents()) { |
297 | - IntentState state = service.getIntentState(i.id()); | 298 | + IntentState state = service.getIntentState(i.key()); |
298 | assertTrue("Intent " + i.id() + " is in invalid state " + state, | 299 | assertTrue("Intent " + i.id() + " is in invalid state " + state, |
299 | parked.contains(state)); | 300 | parked.contains(state)); |
300 | } | 301 | } | ... | ... |
... | @@ -32,7 +32,7 @@ import org.onosproject.event.Event; | ... | @@ -32,7 +32,7 @@ import org.onosproject.event.Event; |
32 | import org.onosproject.net.Link; | 32 | import org.onosproject.net.Link; |
33 | import org.onosproject.net.NetworkResource; | 33 | import org.onosproject.net.NetworkResource; |
34 | import org.onosproject.net.intent.Intent; | 34 | import org.onosproject.net.intent.Intent; |
35 | -import org.onosproject.net.intent.IntentId; | 35 | +import org.onosproject.net.intent.Key; |
36 | import org.onosproject.net.intent.MockIdGenerator; | 36 | import org.onosproject.net.intent.MockIdGenerator; |
37 | import org.onosproject.net.link.LinkEvent; | 37 | import org.onosproject.net.link.LinkEvent; |
38 | import org.onosproject.net.resource.LinkResourceEvent; | 38 | import org.onosproject.net.resource.LinkResourceEvent; |
... | @@ -49,6 +49,7 @@ import static org.hamcrest.MatcherAssert.assertThat; | ... | @@ -49,6 +49,7 @@ import static org.hamcrest.MatcherAssert.assertThat; |
49 | import static org.hamcrest.Matchers.equalTo; | 49 | import static org.hamcrest.Matchers.equalTo; |
50 | import static org.hamcrest.Matchers.hasSize; | 50 | import static org.hamcrest.Matchers.hasSize; |
51 | import static org.hamcrest.Matchers.is; | 51 | import static org.hamcrest.Matchers.is; |
52 | +import static org.onosproject.net.NetTestTools.APP_ID; | ||
52 | import static org.onosproject.net.NetTestTools.link; | 53 | import static org.onosproject.net.NetTestTools.link; |
53 | 54 | ||
54 | /** | 55 | /** |
... | @@ -99,13 +100,13 @@ public class ObjectiveTrackerTest { | ... | @@ -99,13 +100,13 @@ public class ObjectiveTrackerTest { |
99 | static class TestTopologyChangeDelegate implements TopologyChangeDelegate { | 100 | static class TestTopologyChangeDelegate implements TopologyChangeDelegate { |
100 | 101 | ||
101 | CountDownLatch latch = new CountDownLatch(1); | 102 | CountDownLatch latch = new CountDownLatch(1); |
102 | - List<IntentId> intentIdsFromEvent; | 103 | + List<Key> intentIdsFromEvent; |
103 | boolean compileAllFailedFromEvent; | 104 | boolean compileAllFailedFromEvent; |
104 | 105 | ||
105 | @Override | 106 | @Override |
106 | - public void triggerCompile(Iterable<IntentId> intentIds, | 107 | + public void triggerCompile(Iterable<Key> intentKeys, |
107 | boolean compileAllFailed) { | 108 | boolean compileAllFailed) { |
108 | - intentIdsFromEvent = Lists.newArrayList(intentIds); | 109 | + intentIdsFromEvent = Lists.newArrayList(intentKeys); |
109 | compileAllFailedFromEvent = compileAllFailed; | 110 | compileAllFailedFromEvent = compileAllFailed; |
110 | latch.countDown(); | 111 | latch.countDown(); |
111 | } | 112 | } |
... | @@ -199,9 +200,9 @@ public class ObjectiveTrackerTest { | ... | @@ -199,9 +200,9 @@ public class ObjectiveTrackerTest { |
199 | topology, | 200 | topology, |
200 | reasons); | 201 | reasons); |
201 | 202 | ||
202 | - final IntentId intentId = IntentId.valueOf(0x333L); | 203 | + final Key key = Key.of(0x333L, APP_ID); |
203 | Collection<NetworkResource> resources = ImmutableSet.of(link); | 204 | Collection<NetworkResource> resources = ImmutableSet.of(link); |
204 | - tracker.addTrackedResources(intentId, resources); | 205 | + tracker.addTrackedResources(key, resources); |
205 | 206 | ||
206 | listener.event(event); | 207 | listener.event(event); |
207 | assertThat( | 208 | assertThat( | ... | ... |
... | @@ -40,6 +40,7 @@ import org.onosproject.net.intent.IntentId; | ... | @@ -40,6 +40,7 @@ import org.onosproject.net.intent.IntentId; |
40 | import org.onosproject.net.intent.IntentState; | 40 | import org.onosproject.net.intent.IntentState; |
41 | import org.onosproject.net.intent.IntentStore; | 41 | import org.onosproject.net.intent.IntentStore; |
42 | import org.onosproject.net.intent.IntentStoreDelegate; | 42 | import org.onosproject.net.intent.IntentStoreDelegate; |
43 | +import org.onosproject.net.intent.Key; | ||
43 | import org.onosproject.store.AbstractStore; | 44 | import org.onosproject.store.AbstractStore; |
44 | import org.onosproject.store.serializers.KryoNamespaces; | 45 | import org.onosproject.store.serializers.KryoNamespaces; |
45 | import org.onosproject.store.serializers.KryoSerializer; | 46 | import org.onosproject.store.serializers.KryoSerializer; |
... | @@ -202,6 +203,10 @@ public class DistributedIntentStore | ... | @@ -202,6 +203,10 @@ public class DistributedIntentStore |
202 | } | 203 | } |
203 | 204 | ||
204 | @Override | 205 | @Override |
206 | + public Intent getIntent(Key intentKey) { | ||
207 | + return null; | ||
208 | + } | ||
209 | + | ||
205 | public Intent getIntent(IntentId intentId) { | 210 | public Intent getIntent(IntentId intentId) { |
206 | Context timer = startTimer(getIntentTimer); | 211 | Context timer = startTimer(getIntentTimer); |
207 | try { | 212 | try { |
... | @@ -212,7 +217,10 @@ public class DistributedIntentStore | ... | @@ -212,7 +217,10 @@ public class DistributedIntentStore |
212 | } | 217 | } |
213 | 218 | ||
214 | @Override | 219 | @Override |
215 | - public IntentState getIntentState(IntentId id) { | 220 | + public IntentState getIntentState(Key key) { |
221 | + // TODO: either implement this or remove the class | ||
222 | + return IntentState.FAILED; | ||
223 | + /* | ||
216 | Context timer = startTimer(getIntentStateTimer); | 224 | Context timer = startTimer(getIntentStateTimer); |
217 | try { | 225 | try { |
218 | final IntentState localState = transientStates.get(id); | 226 | final IntentState localState = transientStates.get(id); |
... | @@ -223,6 +231,7 @@ public class DistributedIntentStore | ... | @@ -223,6 +231,7 @@ public class DistributedIntentStore |
223 | } finally { | 231 | } finally { |
224 | stopTimer(timer); | 232 | stopTimer(timer); |
225 | } | 233 | } |
234 | + */ | ||
226 | } | 235 | } |
227 | 236 | ||
228 | private void verify(boolean expression, String errorMessageTemplate, Object... errorMessageArgs) { | 237 | private void verify(boolean expression, String errorMessageTemplate, Object... errorMessageArgs) { |
... | @@ -236,13 +245,17 @@ public class DistributedIntentStore | ... | @@ -236,13 +245,17 @@ public class DistributedIntentStore |
236 | } | 245 | } |
237 | 246 | ||
238 | @Override | 247 | @Override |
239 | - public List<Intent> getInstallableIntents(IntentId intentId) { | 248 | + public List<Intent> getInstallableIntents(Key intentKey) { |
249 | + // TODO: implement this or delete class | ||
250 | + return null; | ||
251 | + /* | ||
240 | Context timer = startTimer(getInstallableIntentsTimer); | 252 | Context timer = startTimer(getInstallableIntentsTimer); |
241 | try { | 253 | try { |
242 | return installable.get(intentId); | 254 | return installable.get(intentId); |
243 | } finally { | 255 | } finally { |
244 | stopTimer(timer); | 256 | stopTimer(timer); |
245 | } | 257 | } |
258 | + */ | ||
246 | } | 259 | } |
247 | 260 | ||
248 | protected String strIntentId(IntentId key) { | 261 | protected String strIntentId(IntentId key) { | ... | ... |
... | @@ -137,18 +137,29 @@ public class GossipIntentStore | ... | @@ -137,18 +137,29 @@ public class GossipIntentStore |
137 | } | 137 | } |
138 | 138 | ||
139 | @Override | 139 | @Override |
140 | + public Intent getIntent(Key intentKey) { | ||
141 | + // TODO: Implement this | ||
142 | + return null; | ||
143 | + } | ||
144 | + | ||
145 | + | ||
140 | public Intent getIntent(IntentId intentId) { | 146 | public Intent getIntent(IntentId intentId) { |
141 | return intents.get(intentId); | 147 | return intents.get(intentId); |
142 | } | 148 | } |
143 | 149 | ||
144 | @Override | 150 | @Override |
145 | - public IntentState getIntentState(IntentId intentId) { | 151 | + public IntentState getIntentState(Key intentKey) { |
146 | - return intentStates.get(intentId); | 152 | + // TODO: implement this |
153 | + return IntentState.FAILED; | ||
147 | } | 154 | } |
148 | 155 | ||
149 | @Override | 156 | @Override |
150 | - public List<Intent> getInstallableIntents(IntentId intentId) { | 157 | + public List<Intent> getInstallableIntents(Key intentKey) { |
158 | + // TODO: implement this or delete class | ||
159 | + return null; | ||
160 | + /* | ||
151 | return installables.get(intentId); | 161 | return installables.get(intentId); |
162 | + */ | ||
152 | } | 163 | } |
153 | 164 | ||
154 | @Override | 165 | @Override |
... | @@ -225,11 +236,6 @@ public class GossipIntentStore | ... | @@ -225,11 +236,6 @@ public class GossipIntentStore |
225 | } | 236 | } |
226 | 237 | ||
227 | @Override | 238 | @Override |
228 | - public Intent getIntent(Key key) { | ||
229 | - return null; // TODO | ||
230 | - } | ||
231 | - | ||
232 | - @Override | ||
233 | public IntentData getIntentData(Key key) { | 239 | public IntentData getIntentData(Key key) { |
234 | return null; // TODO | 240 | return null; // TODO |
235 | } | 241 | } | ... | ... |
... | @@ -46,6 +46,7 @@ import org.onosproject.net.intent.IntentId; | ... | @@ -46,6 +46,7 @@ import org.onosproject.net.intent.IntentId; |
46 | import org.onosproject.net.intent.IntentState; | 46 | import org.onosproject.net.intent.IntentState; |
47 | import org.onosproject.net.intent.IntentStore; | 47 | import org.onosproject.net.intent.IntentStore; |
48 | import org.onosproject.net.intent.IntentStoreDelegate; | 48 | import org.onosproject.net.intent.IntentStoreDelegate; |
49 | +import org.onosproject.net.intent.Key; | ||
49 | import org.onosproject.store.hz.AbstractHazelcastStore; | 50 | import org.onosproject.store.hz.AbstractHazelcastStore; |
50 | import org.onosproject.store.hz.SMap; | 51 | import org.onosproject.store.hz.SMap; |
51 | import org.onosproject.store.serializers.KryoNamespaces; | 52 | import org.onosproject.store.serializers.KryoNamespaces; |
... | @@ -209,6 +210,11 @@ public class HazelcastIntentStore | ... | @@ -209,6 +210,11 @@ public class HazelcastIntentStore |
209 | } | 210 | } |
210 | 211 | ||
211 | @Override | 212 | @Override |
213 | + public Intent getIntent(Key intentKey) { | ||
214 | + return null; | ||
215 | + } | ||
216 | + | ||
217 | + | ||
212 | public Intent getIntent(IntentId intentId) { | 218 | public Intent getIntent(IntentId intentId) { |
213 | Context timer = startTimer(getIntentTimer); | 219 | Context timer = startTimer(getIntentTimer); |
214 | try { | 220 | try { |
... | @@ -227,7 +233,10 @@ public class HazelcastIntentStore | ... | @@ -227,7 +233,10 @@ public class HazelcastIntentStore |
227 | } | 233 | } |
228 | 234 | ||
229 | @Override | 235 | @Override |
230 | - public IntentState getIntentState(IntentId id) { | 236 | + public IntentState getIntentState(Key key) { |
237 | + // TODO: either implement this or remove this class | ||
238 | + return IntentState.FAILED; | ||
239 | + /* | ||
231 | Context timer = startTimer(getIntentStateTimer); | 240 | Context timer = startTimer(getIntentStateTimer); |
232 | try { | 241 | try { |
233 | final IntentState localState = transientStates.get(id); | 242 | final IntentState localState = transientStates.get(id); |
... | @@ -238,6 +247,7 @@ public class HazelcastIntentStore | ... | @@ -238,6 +247,7 @@ public class HazelcastIntentStore |
238 | } finally { | 247 | } finally { |
239 | stopTimer(timer); | 248 | stopTimer(timer); |
240 | } | 249 | } |
250 | + */ | ||
241 | } | 251 | } |
242 | 252 | ||
243 | private void verify(boolean expression, String errorMessageTemplate, Object... errorMessageArgs) { | 253 | private void verify(boolean expression, String errorMessageTemplate, Object... errorMessageArgs) { |
... | @@ -251,13 +261,18 @@ public class HazelcastIntentStore | ... | @@ -251,13 +261,18 @@ public class HazelcastIntentStore |
251 | } | 261 | } |
252 | 262 | ||
253 | @Override | 263 | @Override |
254 | - public List<Intent> getInstallableIntents(IntentId intentId) { | 264 | + public List<Intent> getInstallableIntents(Key intentKey) { |
265 | + // TODO: implement this or delete class | ||
266 | + return null; | ||
267 | + | ||
268 | + /* | ||
255 | Context timer = startTimer(getInstallableIntentsTimer); | 269 | Context timer = startTimer(getInstallableIntentsTimer); |
256 | try { | 270 | try { |
257 | return installable.get(intentId); | 271 | return installable.get(intentId); |
258 | } finally { | 272 | } finally { |
259 | stopTimer(timer); | 273 | stopTimer(timer); |
260 | } | 274 | } |
275 | + */ | ||
261 | } | 276 | } |
262 | 277 | ||
263 | @Override | 278 | @Override | ... | ... |
... | @@ -25,7 +25,6 @@ import org.onosproject.net.intent.BatchWrite.Operation; | ... | @@ -25,7 +25,6 @@ import org.onosproject.net.intent.BatchWrite.Operation; |
25 | import org.onosproject.net.intent.Intent; | 25 | import org.onosproject.net.intent.Intent; |
26 | import org.onosproject.net.intent.IntentData; | 26 | import org.onosproject.net.intent.IntentData; |
27 | import org.onosproject.net.intent.IntentEvent; | 27 | import org.onosproject.net.intent.IntentEvent; |
28 | -import org.onosproject.net.intent.IntentId; | ||
29 | import org.onosproject.net.intent.IntentState; | 28 | import org.onosproject.net.intent.IntentState; |
30 | import org.onosproject.net.intent.IntentStore; | 29 | import org.onosproject.net.intent.IntentStore; |
31 | import org.onosproject.net.intent.IntentStoreDelegate; | 30 | import org.onosproject.net.intent.IntentStoreDelegate; |
... | @@ -35,7 +34,6 @@ import org.slf4j.Logger; | ... | @@ -35,7 +34,6 @@ import org.slf4j.Logger; |
35 | 34 | ||
36 | import java.util.List; | 35 | import java.util.List; |
37 | import java.util.Map; | 36 | import java.util.Map; |
38 | -import java.util.Objects; | ||
39 | import java.util.stream.Collectors; | 37 | import java.util.stream.Collectors; |
40 | 38 | ||
41 | import static com.google.common.base.Preconditions.checkNotNull; | 39 | import static com.google.common.base.Preconditions.checkNotNull; |
... | @@ -77,38 +75,23 @@ public class SimpleIntentStore | ... | @@ -77,38 +75,23 @@ public class SimpleIntentStore |
77 | } | 75 | } |
78 | 76 | ||
79 | @Override | 77 | @Override |
80 | - public Intent getIntent(IntentId intentId) { | 78 | + public IntentState getIntentState(Key intentKey) { |
81 | - for (IntentData data : current.values()) { | 79 | + IntentData data = current.get(intentKey); |
82 | - if (Objects.equals(data.intent().id(), intentId)) { | 80 | + return (data != null) ? data.state() : null; |
83 | - return data.intent(); | ||
84 | - } | ||
85 | - } | ||
86 | - return null; | ||
87 | } | 81 | } |
88 | 82 | ||
89 | @Override | 83 | @Override |
90 | - public IntentState getIntentState(IntentId intentId) { | 84 | + public List<Intent> getInstallableIntents(Key intentKey) { |
91 | - for (IntentData data : current.values()) { | 85 | + // TODO: implement this or delete class |
92 | - if (Objects.equals(data.intent().id(), intentId)) { | ||
93 | - return data.state(); | ||
94 | - } | ||
95 | - } | ||
96 | return null; | 86 | return null; |
97 | - } | 87 | + /* |
98 | - | ||
99 | - @Override | ||
100 | - public List<Intent> getInstallableIntents(IntentId intentId) { | ||
101 | for (IntentData data : current.values()) { | 88 | for (IntentData data : current.values()) { |
102 | if (Objects.equals(data.intent().id(), intentId)) { | 89 | if (Objects.equals(data.intent().id(), intentId)) { |
103 | return data.installables(); | 90 | return data.installables(); |
104 | } | 91 | } |
105 | } | 92 | } |
106 | return null; | 93 | return null; |
107 | - } | 94 | + */ |
108 | - | ||
109 | - @Override | ||
110 | - public IntentData getIntentData(Key key) { | ||
111 | - return current.get(key); | ||
112 | } | 95 | } |
113 | 96 | ||
114 | /* | 97 | /* | ... | ... |
... | @@ -25,7 +25,6 @@ import org.onosproject.net.intent.BatchWrite.Operation; | ... | @@ -25,7 +25,6 @@ import org.onosproject.net.intent.BatchWrite.Operation; |
25 | import org.onosproject.net.intent.Intent; | 25 | import org.onosproject.net.intent.Intent; |
26 | import org.onosproject.net.intent.IntentData; | 26 | import org.onosproject.net.intent.IntentData; |
27 | import org.onosproject.net.intent.IntentEvent; | 27 | import org.onosproject.net.intent.IntentEvent; |
28 | -import org.onosproject.net.intent.IntentId; | ||
29 | import org.onosproject.net.intent.IntentState; | 28 | import org.onosproject.net.intent.IntentState; |
30 | import org.onosproject.net.intent.IntentStore; | 29 | import org.onosproject.net.intent.IntentStore; |
31 | import org.onosproject.net.intent.IntentStoreDelegate; | 30 | import org.onosproject.net.intent.IntentStoreDelegate; |
... | @@ -35,7 +34,6 @@ import org.slf4j.Logger; | ... | @@ -35,7 +34,6 @@ import org.slf4j.Logger; |
35 | 34 | ||
36 | import java.util.List; | 35 | import java.util.List; |
37 | import java.util.Map; | 36 | import java.util.Map; |
38 | -import java.util.Objects; | ||
39 | import java.util.stream.Collectors; | 37 | import java.util.stream.Collectors; |
40 | 38 | ||
41 | import static com.google.common.base.Preconditions.checkNotNull; | 39 | import static com.google.common.base.Preconditions.checkNotNull; |
... | @@ -76,38 +74,15 @@ public class SimpleIntentStore | ... | @@ -76,38 +74,15 @@ public class SimpleIntentStore |
76 | } | 74 | } |
77 | 75 | ||
78 | @Override | 76 | @Override |
79 | - public Intent getIntent(IntentId intentId) { | 77 | + public IntentState getIntentState(Key intentKey) { |
80 | - for (IntentData data : current.values()) { | 78 | + IntentData data = current.get(intentKey); |
81 | - if (Objects.equals(data.intent().id(), intentId)) { | 79 | + return (data != null) ? data.state() : null; |
82 | - return data.intent(); | ||
83 | - } | ||
84 | - } | ||
85 | - return null; | ||
86 | - } | ||
87 | - | ||
88 | - @Override | ||
89 | - public IntentState getIntentState(IntentId intentId) { | ||
90 | - for (IntentData data : current.values()) { | ||
91 | - if (Objects.equals(data.intent().id(), intentId)) { | ||
92 | - return data.state(); | ||
93 | - } | ||
94 | - } | ||
95 | - return null; | ||
96 | - } | ||
97 | - | ||
98 | - @Override | ||
99 | - public List<Intent> getInstallableIntents(IntentId intentId) { | ||
100 | - for (IntentData data : current.values()) { | ||
101 | - if (Objects.equals(data.intent().id(), intentId)) { | ||
102 | - return data.installables(); | ||
103 | - } | ||
104 | - } | ||
105 | - return null; | ||
106 | } | 80 | } |
107 | 81 | ||
108 | @Override | 82 | @Override |
109 | - public IntentData getIntentData(Key key) { | 83 | + public List<Intent> getInstallableIntents(Key intentKey) { |
110 | - return current.get(key); | 84 | + IntentData data = current.get(intentKey); |
85 | + return (data != null) ? data.installables() : null; | ||
111 | } | 86 | } |
112 | 87 | ||
113 | /* | 88 | /* | ... | ... |
... | @@ -24,8 +24,8 @@ import javax.ws.rs.core.Response; | ... | @@ -24,8 +24,8 @@ import javax.ws.rs.core.Response; |
24 | 24 | ||
25 | import org.onosproject.net.intent.HostToHostIntent; | 25 | import org.onosproject.net.intent.HostToHostIntent; |
26 | import org.onosproject.net.intent.Intent; | 26 | import org.onosproject.net.intent.Intent; |
27 | -import org.onosproject.net.intent.IntentId; | ||
28 | import org.onosproject.net.intent.IntentService; | 27 | import org.onosproject.net.intent.IntentService; |
28 | +import org.onosproject.net.intent.Key; | ||
29 | import org.onosproject.net.intent.PointToPointIntent; | 29 | import org.onosproject.net.intent.PointToPointIntent; |
30 | 30 | ||
31 | import com.fasterxml.jackson.databind.node.ObjectNode; | 31 | import com.fasterxml.jackson.databind.node.ObjectNode; |
... | @@ -54,15 +54,15 @@ public class IntentsWebResource extends AbstractWebResource { | ... | @@ -54,15 +54,15 @@ public class IntentsWebResource extends AbstractWebResource { |
54 | /** | 54 | /** |
55 | * Gets a single intent by Id. | 55 | * Gets a single intent by Id. |
56 | * | 56 | * |
57 | - * @param id Id to look up | 57 | + * @param key Id to look up |
58 | * @return intent data | 58 | * @return intent data |
59 | */ | 59 | */ |
60 | @GET | 60 | @GET |
61 | @Produces(MediaType.APPLICATION_JSON) | 61 | @Produces(MediaType.APPLICATION_JSON) |
62 | @Path("{id}") | 62 | @Path("{id}") |
63 | - public Response getIntentById(@PathParam("id") long id) { | 63 | + public Response getIntentById(@PathParam("id") String key) { |
64 | final Intent intent = nullIsNotFound(get(IntentService.class) | 64 | final Intent intent = nullIsNotFound(get(IntentService.class) |
65 | - .getIntent(IntentId.valueOf(id)), | 65 | + .getIntent(Key.of(key, null)), |
66 | INTENT_NOT_FOUND); | 66 | INTENT_NOT_FOUND); |
67 | final ObjectNode root; | 67 | final ObjectNode root; |
68 | if (intent instanceof HostToHostIntent) { | 68 | if (intent instanceof HostToHostIntent) { | ... | ... |
... | @@ -35,8 +35,8 @@ import org.onosproject.core.DefaultApplicationId; | ... | @@ -35,8 +35,8 @@ import org.onosproject.core.DefaultApplicationId; |
35 | import org.onosproject.core.IdGenerator; | 35 | import org.onosproject.core.IdGenerator; |
36 | import org.onosproject.net.NetworkResource; | 36 | import org.onosproject.net.NetworkResource; |
37 | import org.onosproject.net.intent.Intent; | 37 | import org.onosproject.net.intent.Intent; |
38 | -import org.onosproject.net.intent.IntentId; | ||
39 | import org.onosproject.net.intent.IntentService; | 38 | import org.onosproject.net.intent.IntentService; |
39 | +import org.onosproject.net.intent.Key; | ||
40 | 40 | ||
41 | import com.eclipsesource.json.JsonArray; | 41 | import com.eclipsesource.json.JsonArray; |
42 | import com.eclipsesource.json.JsonObject; | 42 | import com.eclipsesource.json.JsonObject; |
... | @@ -339,7 +339,7 @@ public class IntentsResourceTest extends ResourceTest { | ... | @@ -339,7 +339,7 @@ public class IntentsResourceTest extends ResourceTest { |
339 | 339 | ||
340 | intents.add(intent); | 340 | intents.add(intent); |
341 | 341 | ||
342 | - expect(mockIntentService.getIntent(IntentId.valueOf(0))) | 342 | + expect(mockIntentService.getIntent(Key.of(0, APP_ID))) |
343 | .andReturn(intent) | 343 | .andReturn(intent) |
344 | .anyTimes(); | 344 | .anyTimes(); |
345 | replay(mockIntentService); | 345 | replay(mockIntentService); |
... | @@ -356,7 +356,7 @@ public class IntentsResourceTest extends ResourceTest { | ... | @@ -356,7 +356,7 @@ public class IntentsResourceTest extends ResourceTest { |
356 | @Test | 356 | @Test |
357 | public void testBadGet() { | 357 | public void testBadGet() { |
358 | 358 | ||
359 | - expect(mockIntentService.getIntent(IntentId.valueOf(0))) | 359 | + expect(mockIntentService.getIntent(Key.of(0, APP_ID))) |
360 | .andReturn(null) | 360 | .andReturn(null) |
361 | .anyTimes(); | 361 | .anyTimes(); |
362 | replay(mockIntentService); | 362 | replay(mockIntentService); | ... | ... |
... | @@ -110,7 +110,7 @@ public class TopologyViewIntentFilter { | ... | @@ -110,7 +110,7 @@ public class TopologyViewIntentFilter { |
110 | 110 | ||
111 | // Search through all intents and see if they are relevant to our search. | 111 | // Search through all intents and see if they are relevant to our search. |
112 | for (Intent intent : sourceIntents) { | 112 | for (Intent intent : sourceIntents) { |
113 | - if (intentService.getIntentState(intent.id()) == INSTALLED) { | 113 | + if (intentService.getIntentState(intent.key()) == INSTALLED) { |
114 | boolean isRelevant = false; | 114 | boolean isRelevant = false; |
115 | if (intent instanceof HostToHostIntent) { | 115 | if (intent instanceof HostToHostIntent) { |
116 | isRelevant = isIntentRelevantToHosts((HostToHostIntent) intent, hosts) && | 116 | isRelevant = isIntentRelevantToHosts((HostToHostIntent) intent, hosts) && |
... | @@ -157,7 +157,7 @@ public class TopologyViewIntentFilter { | ... | @@ -157,7 +157,7 @@ public class TopologyViewIntentFilter { |
157 | 157 | ||
158 | // Indicates whether the specified intent involves all of the given devices. | 158 | // Indicates whether the specified intent involves all of the given devices. |
159 | private boolean isIntentRelevantToDevices(Intent intent, Iterable<Device> devices) { | 159 | private boolean isIntentRelevantToDevices(Intent intent, Iterable<Device> devices) { |
160 | - List<Intent> installables = intentService.getInstallableIntents(intent.id()); | 160 | + List<Intent> installables = intentService.getInstallableIntents(intent.key()); |
161 | for (Device device : devices) { | 161 | for (Device device : devices) { |
162 | if (!isIntentRelevantToDevice(installables, device)) { | 162 | if (!isIntentRelevantToDevice(installables, device)) { |
163 | return false; | 163 | return false; |
... | @@ -228,7 +228,7 @@ public class TopologyViewIntentFilter { | ... | @@ -228,7 +228,7 @@ public class TopologyViewIntentFilter { |
228 | Link ccDst = getFirstLink(opticalIntent.getDst(), true); | 228 | Link ccDst = getFirstLink(opticalIntent.getDst(), true); |
229 | 229 | ||
230 | for (Intent intent : intents) { | 230 | for (Intent intent : intents) { |
231 | - List<Intent> installables = intentService.getInstallableIntents(intent.id()); | 231 | + List<Intent> installables = intentService.getInstallableIntents(intent.key()); |
232 | for (Intent installable : installables) { | 232 | for (Intent installable : installables) { |
233 | if (installable instanceof PathIntent) { | 233 | if (installable instanceof PathIntent) { |
234 | List<Link> links = ((PathIntent) installable).path().links(); | 234 | List<Link> links = ((PathIntent) installable).path().links(); | ... | ... |
... | @@ -672,7 +672,7 @@ public abstract class TopologyViewMessages { | ... | @@ -672,7 +672,7 @@ public abstract class TopologyViewMessages { |
672 | for (TrafficClass trafficClass : trafficClasses) { | 672 | for (TrafficClass trafficClass : trafficClasses) { |
673 | for (Intent intent : trafficClass.intents) { | 673 | for (Intent intent : trafficClass.intents) { |
674 | boolean isOptical = intent instanceof OpticalConnectivityIntent; | 674 | boolean isOptical = intent instanceof OpticalConnectivityIntent; |
675 | - List<Intent> installables = intentService.getInstallableIntents(intent.id()); | 675 | + List<Intent> installables = intentService.getInstallableIntents(intent.key()); |
676 | if (installables != null) { | 676 | if (installables != null) { |
677 | for (Intent installable : installables) { | 677 | for (Intent installable : installables) { |
678 | String type = isOptical ? trafficClass.type + " optical" : trafficClass.type; | 678 | String type = isOptical ? trafficClass.type + " optical" : trafficClass.type; | ... | ... |
-
Please register or login to post a comment