ONOS-5268 Intents don't properly transition from WITHDRAWING to INSTALLED
If the same path is selected, the flows will not be reinstalled.
This patch fixes that.
Change-Id: I78da0015f7e3b39f3b7ff842f821053c2494b8e6
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/IntentInstaller.java b/core/net/src/main/java/org/onosproject/net/intent/impl/IntentInstaller.java
index 17b4653..332ca73 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/IntentInstaller.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/IntentInstaller.java
@@ -215,10 +215,8 @@
} else {
IntentData uninstall = uninstallData.get();
IntentData install = installData.get();
- List<Intent> uninstallIntents = new ArrayList<>();
- uninstallIntents.addAll(uninstall.installables());
- List<Intent> installIntents = new ArrayList<>();
- installIntents.addAll(install.installables());
+ List<Intent> uninstallIntents = Lists.newArrayList(uninstall.installables());
+ List<Intent> installIntents = Lists.newArrayList(install.installables());
checkState(uninstallIntents.stream().allMatch(this::isSupported),
"Unsupported installable intents detected");
@@ -234,6 +232,8 @@
if (uIntent.equals(installIntent)) {
return true;
} else if (uIntent instanceof FlowRuleIntent && installIntent instanceof FlowRuleIntent) {
+ //FIXME we can further optimize this by doing the filtering on a flow-by-flow basis
+ // (direction can be implied from intent state)
return ((FlowRuleIntent) uIntent).flowRules()
.containsAll(((FlowRuleIntent) installIntent).flowRules());
} else {
@@ -241,7 +241,12 @@
}
}).findFirst().ifPresent(common -> {
uninstallIntents.remove(common);
- iterator.remove();
+ if (INSTALLED.equals(uninstall.state())) {
+ // only remove the install intent if the existing
+ // intent (i.e. the uninstall one) is already
+ // installed or installing
+ iterator.remove();
+ }
});
}