Refactor Intent subsystem to eliminate using FlowRuleBatchOperation
Change-Id: Iee76dac5fa9935713ffc370b34ac47d9286ff351
diff --git a/core/api/src/main/java/org/onosproject/net/flow/FlowRuleOperations.java b/core/api/src/main/java/org/onosproject/net/flow/FlowRuleOperations.java
index 498cc05..84e0b8b 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/FlowRuleOperations.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/FlowRuleOperations.java
@@ -104,6 +104,17 @@
}
/**
+ * Appends an existing flow rule to the current stage.
+ *
+ * @param flowRuleOperation flow rule operation
+ * @return this
+ */
+ public Builder operation(FlowRuleOperation flowRuleOperation) {
+ currentStage.add(flowRuleOperation);
+ return this;
+ }
+
+ /**
* Appends a flow rule modify to the current stage.
*
* @param flowRule flow rule
diff --git a/core/api/src/main/java/org/onosproject/net/intent/IntentInstaller.java b/core/api/src/main/java/org/onosproject/net/intent/IntentInstaller.java
index 8a9577f..b0877a0 100644
--- a/core/api/src/main/java/org/onosproject/net/intent/IntentInstaller.java
+++ b/core/api/src/main/java/org/onosproject/net/intent/IntentInstaller.java
@@ -15,9 +15,10 @@
*/
package org.onosproject.net.intent;
-import org.onosproject.net.flow.FlowRuleBatchOperation;
-
import java.util.List;
+import java.util.Set;
+
+import org.onosproject.net.flow.FlowRuleOperation;
/**
* Abstraction of entity capable of installing intents to the environment.
@@ -31,7 +32,7 @@
* @return flow rule operations to complete install
* @throws IntentException if issues are encountered while installing the intent
*/
- List<FlowRuleBatchOperation> install(T intent);
+ List<Set<FlowRuleOperation>> install(T intent);
/**
* Uninstalls the specified intent from the environment.
@@ -40,7 +41,7 @@
* @return flow rule operations to complete uninstall
* @throws IntentException if issues are encountered while uninstalling the intent
*/
- List<FlowRuleBatchOperation> uninstall(T intent);
+ List<Set<FlowRuleOperation>> uninstall(T intent);
/**
* Replaces the specified intent with a new one in the environment.
@@ -50,6 +51,6 @@
* @return flow rule operations to complete the replace
* @throws IntentException if issues are encountered while uninstalling the intent
*/
- List<FlowRuleBatchOperation> replace(T oldIntent, T newIntent);
+ List<Set<FlowRuleOperation>> replace(T oldIntent, T newIntent);
}
diff --git a/core/api/src/test/java/org/onosproject/net/intent/IntentServiceTest.java b/core/api/src/test/java/org/onosproject/net/intent/IntentServiceTest.java
index 7ae00aa..e5a1509 100644
--- a/core/api/src/test/java/org/onosproject/net/intent/IntentServiceTest.java
+++ b/core/api/src/test/java/org/onosproject/net/intent/IntentServiceTest.java
@@ -35,7 +35,7 @@
import org.junit.Before;
import org.junit.Test;
import org.onosproject.core.IdGenerator;
-import org.onosproject.net.flow.FlowRuleBatchOperation;
+import org.onosproject.net.flow.FlowRuleOperation;
import org.onosproject.net.resource.LinkResourceAllocations;
/**
@@ -319,7 +319,7 @@
}
@Override
- public List<FlowRuleBatchOperation> install(TestInstallableIntent intent) {
+ public List<Set<FlowRuleOperation>> install(TestInstallableIntent intent) {
if (fail) {
throw new IntentException("install failed by design");
}
@@ -327,7 +327,7 @@
}
@Override
- public List<FlowRuleBatchOperation> uninstall(TestInstallableIntent intent) {
+ public List<Set<FlowRuleOperation>> uninstall(TestInstallableIntent intent) {
if (fail) {
throw new IntentException("remove failed by design");
}
@@ -335,7 +335,7 @@
}
@Override
- public List<FlowRuleBatchOperation> replace(TestInstallableIntent intent,
+ public List<Set<FlowRuleOperation>> replace(TestInstallableIntent intent,
TestInstallableIntent newIntent) {
return null;
}