Merge IntentInstaller's role into IntentCompiler
It resolves naming mismatch in naming of IntentProcessPhases and states
handled in the phases. It is described in ONOS-1064.
- Define FlowRuleIntent that enables flow rule level operation
as an intent.
- Remove IntentInstaller interface
- Existing installable intents such as PathIntent, LinkCollectionIntent,
OpticalPathIntent and MplsPathIntent now become non installable intents.
Only FlowRuleIntent is categorized as installable intent now.
- Implement intent compilers for PathIntent, LinkCollectionIntent,
OpticalPathIntent and MplsPathIntent. They generates FlowRuleIntents.
- Write unit tests for the newly created intent compilers according to
the intent installers' unit tests
- Remove all intent installers and their unit tests
Change-Id: I22d6c7acb65a4c066145de0018bd0727f44bd54a
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/phase/InstallRequest.java b/core/net/src/main/java/org/onosproject/net/intent/impl/phase/InstallRequest.java
index 1944aad..9e09788 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/phase/InstallRequest.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/phase/InstallRequest.java
@@ -27,18 +27,30 @@
*/
final class InstallRequest implements IntentProcessPhase {
- private final IntentProcessor intentManager;
- private final IntentData pending;
- private final Optional<IntentData> current;
+ private final IntentProcessor processor;
+ private final IntentData data;
+ private final Optional<IntentData> stored;
- InstallRequest(IntentProcessor processor, IntentData intentData, Optional<IntentData> current) {
- this.intentManager = checkNotNull(processor);
- this.pending = checkNotNull(intentData);
- this.current = checkNotNull(current);
+ /**
+ * Creates an install request phase.
+ *
+ * @param processor intent processor to be passed to intent process phases
+ * generated after this phase
+ * @param intentData intent data to be processed
+ * @param stored intent data stored in the store
+ */
+ InstallRequest(IntentProcessor processor, IntentData intentData, Optional<IntentData> stored) {
+ this.processor = checkNotNull(processor);
+ this.data = checkNotNull(intentData);
+ this.stored = checkNotNull(stored);
}
@Override
public Optional<IntentProcessPhase> execute() {
- return Optional.of(new Compiling(intentManager, pending, current.orElse(null)));
+ if (!stored.isPresent() || stored.get().installables() == null || stored.get().installables().isEmpty()) {
+ return Optional.of(new Compiling(processor, data));
+ } else {
+ return Optional.of(new Recompiling(processor, data, stored.get()));
+ }
}
}