Intents are now removed after being withdrawn.
Change-Id: I7574fe94add00abf58c71c6122bb3dc5aafa0f79
diff --git a/core/store/dist/src/main/java/org/onlab/onos/store/intent/impl/DistributedIntentStore.java b/core/store/dist/src/main/java/org/onlab/onos/store/intent/impl/DistributedIntentStore.java
index 5974b62..8da72cf 100644
--- a/core/store/dist/src/main/java/org/onlab/onos/store/intent/impl/DistributedIntentStore.java
+++ b/core/store/dist/src/main/java/org/onlab/onos/store/intent/impl/DistributedIntentStore.java
@@ -50,6 +50,7 @@
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
+import static com.google.common.base.Preconditions.checkState;
import static org.onlab.onos.net.intent.IntentState.*;
import static org.slf4j.LoggerFactory.getLogger;
import static org.onlab.metrics.MetricsUtil.*;
@@ -174,20 +175,15 @@
}
@Override
- public IntentEvent removeIntent(IntentId intentId) {
+ public void removeIntent(IntentId intentId) {
Context timer = startTimer(removeIntentTimer);
+ checkState(getIntentState(intentId) == WITHDRAWN,
+ "Intent state for {} is not WITHDRAWN.", intentId);
try {
- Intent intent = intents.remove(intentId);
- installable.remove(intentId);
- if (intent == null) {
- // was already removed
- return null;
- }
- IntentEvent event = this.setState(intent, WITHDRAWN);
+ intents.remove(intentId);
states.remove(intentId);
transientStates.remove(intentId);
- // TODO: Should we callremoveInstalledIntents if this Intent was
- return event;
+ installable.remove(intentId);
} finally {
stopTimer(timer);
}