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
Showing
1 changed file
with
10 additions
and
5 deletions
| ... | @@ -215,10 +215,8 @@ class IntentInstaller { | ... | @@ -215,10 +215,8 @@ class IntentInstaller { |
| 215 | } else { | 215 | } else { |
| 216 | IntentData uninstall = uninstallData.get(); | 216 | IntentData uninstall = uninstallData.get(); |
| 217 | IntentData install = installData.get(); | 217 | IntentData install = installData.get(); |
| 218 | - List<Intent> uninstallIntents = new ArrayList<>(); | 218 | + List<Intent> uninstallIntents = Lists.newArrayList(uninstall.installables()); |
| 219 | - uninstallIntents.addAll(uninstall.installables()); | 219 | + List<Intent> installIntents = Lists.newArrayList(install.installables()); |
| 220 | - List<Intent> installIntents = new ArrayList<>(); | ||
| 221 | - installIntents.addAll(install.installables()); | ||
| 222 | 220 | ||
| 223 | checkState(uninstallIntents.stream().allMatch(this::isSupported), | 221 | checkState(uninstallIntents.stream().allMatch(this::isSupported), |
| 224 | "Unsupported installable intents detected"); | 222 | "Unsupported installable intents detected"); |
| ... | @@ -234,6 +232,8 @@ class IntentInstaller { | ... | @@ -234,6 +232,8 @@ class IntentInstaller { |
| 234 | if (uIntent.equals(installIntent)) { | 232 | if (uIntent.equals(installIntent)) { |
| 235 | return true; | 233 | return true; |
| 236 | } else if (uIntent instanceof FlowRuleIntent && installIntent instanceof FlowRuleIntent) { | 234 | } else if (uIntent instanceof FlowRuleIntent && installIntent instanceof FlowRuleIntent) { |
| 235 | + //FIXME we can further optimize this by doing the filtering on a flow-by-flow basis | ||
| 236 | + // (direction can be implied from intent state) | ||
| 237 | return ((FlowRuleIntent) uIntent).flowRules() | 237 | return ((FlowRuleIntent) uIntent).flowRules() |
| 238 | .containsAll(((FlowRuleIntent) installIntent).flowRules()); | 238 | .containsAll(((FlowRuleIntent) installIntent).flowRules()); |
| 239 | } else { | 239 | } else { |
| ... | @@ -241,7 +241,12 @@ class IntentInstaller { | ... | @@ -241,7 +241,12 @@ class IntentInstaller { |
| 241 | } | 241 | } |
| 242 | }).findFirst().ifPresent(common -> { | 242 | }).findFirst().ifPresent(common -> { |
| 243 | uninstallIntents.remove(common); | 243 | uninstallIntents.remove(common); |
| 244 | - iterator.remove(); | 244 | + if (INSTALLED.equals(uninstall.state())) { |
| 245 | + // only remove the install intent if the existing | ||
| 246 | + // intent (i.e. the uninstall one) is already | ||
| 247 | + // installed or installing | ||
| 248 | + iterator.remove(); | ||
| 249 | + } | ||
| 245 | }); | 250 | }); |
| 246 | } | 251 | } |
| 247 | 252 | ... | ... |
-
Please register or login to post a comment