Update the Intent Delete API and semantics:
* Added new Java API for adding/removing Application Intents:
IPathCalcRuntimeService.addApplicationIntents(...)
IPathCalcRuntimeService.removeApplicationIntents(...)
IPathCalcRuntimeService.removeAllApplicationIntents(...)
* Updated the corresponding REST API to use the new Java API, and
move all API implementation complexity within the Intent framework.
* Added a new REST API to support deleting multiple Intents together:
REST DELETE: /wm/onos/intent/high?intent_id=1,2,3
* Updated the semantics for deleting an Intent:
Using the new Intent API (REST or Java) to delete an intent will
prune the intent as well.
For now, the pruning is asynchronous.
* Implemented the corresponding backend support to automatically
prune intents that have been deleted.
See class DeleteIntentsTracker inside file PathCalcRuntimeModule.java
* Updated test PathCalcRuntimeModuleTest.testIntentReroute() to
reflect the old path deletion.
* Updated the EntryForIntentMatcher.matchesSafely() to remove
assertThat() statement.
With the new implementation, this matcher can be used with not()
Hamcrest wrapper.
Change-Id: I88e7de119bab9d955d71cede14eb7847c7b6afbf
diff --git a/src/test/java/net/onrc/onos/core/intent/runtime/PathCalcRuntimeModuleTest.java b/src/test/java/net/onrc/onos/core/intent/runtime/PathCalcRuntimeModuleTest.java
index c202910..e9286ad 100644
--- a/src/test/java/net/onrc/onos/core/intent/runtime/PathCalcRuntimeModuleTest.java
+++ b/src/test/java/net/onrc/onos/core/intent/runtime/PathCalcRuntimeModuleTest.java
@@ -4,6 +4,7 @@
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.hasItem;
import static org.hamcrest.Matchers.hasSize;
+import static org.hamcrest.Matchers.not;
import static org.hamcrest.Matchers.notNullValue;
import java.util.Collection;
@@ -78,9 +79,7 @@
@Override
public boolean matchesSafely(Collection<Intent> intents) {
- assertThat(intents,
- hasItem(Matchers.<Intent>hasProperty("id", equalTo(id))));
- return true;
+ return hasItem(Matchers.<Intent>hasProperty("id", equalTo(id))).matches(intents);
}
@Override
@@ -544,8 +543,8 @@
assertThat(processedPathIntents, notNullValue());
// Check that the low level intent 1 was correctly processed
- assertThat(reroutedPathIntents,
- hasIntentWithIdAndState("1___0", IntentState.DEL_ACK));
+ assertThat(reroutedPathIntents.getAllIntents(),
+ not(hasIntentWithId("1___0")));
assertThat(reroutedPathIntents,
hasIntentWithIdAndState("1___1", IntentState.INST_ACK));