Using replace instead install when there is already an intent
Fixes the problem of flows being left on the data plane
Change-Id: Iec3db8b460123f2744a57d8c08d14c8effe9ec34
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/LinkCollectionIntentInstaller.java b/core/net/src/main/java/org/onosproject/net/intent/impl/LinkCollectionIntentInstaller.java
index 816fc12..abc08d1 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/LinkCollectionIntentInstaller.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/LinkCollectionIntentInstaller.java
@@ -16,6 +16,7 @@
package org.onosproject.net.intent.impl;
import com.google.common.collect.HashMultimap;
+import com.google.common.collect.Lists;
import com.google.common.collect.SetMultimap;
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
@@ -112,10 +113,13 @@
}
@Override
- public List<FlowRuleBatchOperation> replace(LinkCollectionIntent intent,
+ public List<FlowRuleBatchOperation> replace(LinkCollectionIntent oldIntent,
LinkCollectionIntent newIntent) {
- // FIXME: implement
- return null;
+ // FIXME: implement this in a more intelligent/less brute force way
+ List<FlowRuleBatchOperation> batches = Lists.newArrayList();
+ batches.addAll(uninstall(oldIntent));
+ batches.addAll(install(newIntent));
+ return batches;
}
/**