Ray Milkey
Committed by Gerrit Code Review

Fix for ONOS-4484 flows left behind after intent reroute

During the installation process, the list of flows to remove and
the list of flows to install were computed into the same variable,
so the list of adds overwrote the list of removes. The fix is to
put them all onto the same list.

Change-Id: I1f0c7f0a7b3c76f50afdb121dbba70010df79fab
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
16 16
17 package org.onosproject.net.intent.impl; 17 package org.onosproject.net.intent.impl;
18 18
19 +import com.google.common.collect.Lists;
19 import com.google.common.collect.Sets; 20 import com.google.common.collect.Sets;
20 import org.onosproject.net.DeviceId; 21 import org.onosproject.net.DeviceId;
21 import org.onosproject.net.flow.FlowRule; 22 import org.onosproject.net.flow.FlowRule;
...@@ -299,15 +300,15 @@ class IntentInstaller { ...@@ -299,15 +300,15 @@ class IntentInstaller {
299 300
300 // Context for applying and tracking operations related to flow objective intents. 301 // Context for applying and tracking operations related to flow objective intents.
301 private class FlowObjectiveOperationContext extends OperationContext { 302 private class FlowObjectiveOperationContext extends OperationContext {
302 - List<FlowObjectiveInstallationContext> contexts; 303 + List<FlowObjectiveInstallationContext> contexts = Lists.newLinkedList();
303 final Set<ObjectiveContext> pendingContexts = Sets.newHashSet(); 304 final Set<ObjectiveContext> pendingContexts = Sets.newHashSet();
304 final Set<ObjectiveContext> errorContexts = Sets.newConcurrentHashSet(); 305 final Set<ObjectiveContext> errorContexts = Sets.newConcurrentHashSet();
305 306
306 @Override 307 @Override
307 public void prepareIntents(List<Intent> intentsToApply, Direction direction) { 308 public void prepareIntents(List<Intent> intentsToApply, Direction direction) {
308 - contexts = intentsToApply.stream() 309 + intentsToApply.stream()
309 .flatMap(x -> buildObjectiveContexts((FlowObjectiveIntent) x, direction).stream()) 310 .flatMap(x -> buildObjectiveContexts((FlowObjectiveIntent) x, direction).stream())
310 - .collect(Collectors.toList()); 311 + .forEach(contexts::add);
311 } 312 }
312 313
313 // Builds the specified objective in the appropriate direction 314 // Builds the specified objective in the appropriate direction
......