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 @@
package org.onosproject.net.intent.impl;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import org.onosproject.net.DeviceId;
import org.onosproject.net.flow.FlowRule;
......@@ -299,15 +300,15 @@ class IntentInstaller {
// Context for applying and tracking operations related to flow objective intents.
private class FlowObjectiveOperationContext extends OperationContext {
List<FlowObjectiveInstallationContext> contexts;
List<FlowObjectiveInstallationContext> contexts = Lists.newLinkedList();
final Set<ObjectiveContext> pendingContexts = Sets.newHashSet();
final Set<ObjectiveContext> errorContexts = Sets.newConcurrentHashSet();
@Override
public void prepareIntents(List<Intent> intentsToApply, Direction direction) {
contexts = intentsToApply.stream()
intentsToApply.stream()
.flatMap(x -> buildObjectiveContexts((FlowObjectiveIntent) x, direction).stream())
.collect(Collectors.toList());
.forEach(contexts::add);
}
// Builds the specified objective in the appropriate direction
......