IntentInstaller: changing from Set to Collection to improve perf
Change-Id: Ia7f0f7d893645c7528ac9f51acff133f6d82383d
diff --git a/core/api/src/main/java/org/onosproject/net/intent/IntentInstaller.java b/core/api/src/main/java/org/onosproject/net/intent/IntentInstaller.java
index b0877a0..fec85d5 100644
--- a/core/api/src/main/java/org/onosproject/net/intent/IntentInstaller.java
+++ b/core/api/src/main/java/org/onosproject/net/intent/IntentInstaller.java
@@ -15,11 +15,11 @@
*/
package org.onosproject.net.intent;
-import java.util.List;
-import java.util.Set;
-
import org.onosproject.net.flow.FlowRuleOperation;
+import java.util.Collection;
+import java.util.List;
+
/**
* Abstraction of entity capable of installing intents to the environment.
*/
@@ -32,7 +32,7 @@
* @return flow rule operations to complete install
* @throws IntentException if issues are encountered while installing the intent
*/
- List<Set<FlowRuleOperation>> install(T intent);
+ List<Collection<FlowRuleOperation>> install(T intent);
/**
* Uninstalls the specified intent from the environment.
@@ -41,7 +41,7 @@
* @return flow rule operations to complete uninstall
* @throws IntentException if issues are encountered while uninstalling the intent
*/
- List<Set<FlowRuleOperation>> uninstall(T intent);
+ List<Collection<FlowRuleOperation>> uninstall(T intent);
/**
* Replaces the specified intent with a new one in the environment.
@@ -51,6 +51,6 @@
* @return flow rule operations to complete the replace
* @throws IntentException if issues are encountered while uninstalling the intent
*/
- List<Set<FlowRuleOperation>> replace(T oldIntent, T newIntent);
+ List<Collection<FlowRuleOperation>> replace(T oldIntent, T newIntent);
}
diff --git a/core/api/src/test/java/org/onosproject/net/intent/IntentServiceTest.java b/core/api/src/test/java/org/onosproject/net/intent/IntentServiceTest.java
index e5a1509..c733933 100644
--- a/core/api/src/test/java/org/onosproject/net/intent/IntentServiceTest.java
+++ b/core/api/src/test/java/org/onosproject/net/intent/IntentServiceTest.java
@@ -15,22 +15,6 @@
*/
package org.onosproject.net.intent;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.fail;
-import static org.onosproject.net.intent.IntentEvent.Type.FAILED;
-import static org.onosproject.net.intent.IntentEvent.Type.INSTALLED;
-import static org.onosproject.net.intent.IntentEvent.Type.INSTALL_REQ;
-import static org.onosproject.net.intent.IntentEvent.Type.WITHDRAWN;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -38,6 +22,17 @@
import org.onosproject.net.flow.FlowRuleOperation;
import org.onosproject.net.resource.LinkResourceAllocations;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import static org.junit.Assert.*;
+import static org.onosproject.net.intent.IntentEvent.Type.*;
+
/**
* Suite of tests for the intent service contract.
*/
@@ -319,7 +314,7 @@
}
@Override
- public List<Set<FlowRuleOperation>> install(TestInstallableIntent intent) {
+ public List<Collection<FlowRuleOperation>> install(TestInstallableIntent intent) {
if (fail) {
throw new IntentException("install failed by design");
}
@@ -327,7 +322,7 @@
}
@Override
- public List<Set<FlowRuleOperation>> uninstall(TestInstallableIntent intent) {
+ public List<Collection<FlowRuleOperation>> uninstall(TestInstallableIntent intent) {
if (fail) {
throw new IntentException("remove failed by design");
}
@@ -335,7 +330,7 @@
}
@Override
- public List<Set<FlowRuleOperation>> replace(TestInstallableIntent intent,
+ public List<Collection<FlowRuleOperation>> replace(TestInstallableIntent intent,
TestInstallableIntent newIntent) {
return null;
}
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/IntentManager.java b/core/net/src/main/java/org/onosproject/net/intent/impl/IntentManager.java
index 945c6dc..8fa8b3f 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/IntentManager.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/IntentManager.java
@@ -15,23 +15,8 @@
*/
package org.onosproject.net.intent.impl;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.EnumSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-import java.util.Set;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Future;
-import java.util.stream.Collectors;
-
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Deactivate;
@@ -68,8 +53,21 @@
import org.onosproject.net.intent.impl.phase.Withdrawn;
import org.slf4j.Logger;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.EnumSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Future;
+import java.util.stream.Collectors;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Preconditions.checkState;
@@ -77,11 +75,7 @@
import static java.util.concurrent.Executors.newSingleThreadExecutor;
import static org.onlab.util.Tools.groupedThreads;
import static org.onlab.util.Tools.isNullOrEmpty;
-import static org.onosproject.net.intent.IntentState.FAILED;
-import static org.onosproject.net.intent.IntentState.INSTALLED;
-import static org.onosproject.net.intent.IntentState.INSTALL_REQ;
-import static org.onosproject.net.intent.IntentState.WITHDRAWN;
-import static org.onosproject.net.intent.IntentState.WITHDRAW_REQ;
+import static org.onosproject.net.intent.IntentState.*;
import static org.slf4j.LoggerFactory.getLogger;
/**
@@ -310,7 +304,7 @@
oldInstallables.size() == newInstallables.size(),
"Old and New Intent must have equivalent installable intents.");
- List<List<Set<FlowRuleOperation>>> plans = new ArrayList<>();
+ List<List<Collection<FlowRuleOperation>>> plans = new ArrayList<>();
for (int i = 0; i < newInstallables.size(); i++) {
Intent newInstallable = newInstallables.get(i);
registerSubclassInstallerIfNeeded(newInstallable);
@@ -369,7 +363,7 @@
// TODO: make this non-public due to short term hack for ONOS-1051
public FlowRuleOperations uninstallCoordinate(IntentData current, IntentData pending) {
List<Intent> installables = current.installables();
- List<List<Set<FlowRuleOperation>>> plans = new ArrayList<>();
+ List<List<Collection<FlowRuleOperation>>> plans = new ArrayList<>();
for (Intent installable : installables) {
plans.add(getInstaller(installable).uninstall(installable));
trackerService.removeTrackedResources(pending.key(), installable.resources());
@@ -395,20 +389,20 @@
// TODO needs tests... or maybe it's just perfect
- private FlowRuleOperations.Builder merge(List<List<Set<FlowRuleOperation>>> plans) {
+ private FlowRuleOperations.Builder merge(List<List<Collection<FlowRuleOperation>>> plans) {
FlowRuleOperations.Builder builder = FlowRuleOperations.builder();
// Build a batch one stage at a time
for (int stageNumber = 0;; stageNumber++) {
// Get the sub-stage from each plan (List<Set<FlowRuleOperation>)
- for (Iterator<List<Set<FlowRuleOperation>>> itr = plans.iterator(); itr.hasNext();) {
- List<Set<FlowRuleOperation>> plan = itr.next();
+ for (Iterator<List<Collection<FlowRuleOperation>>> itr = plans.iterator(); itr.hasNext();) {
+ List<Collection<FlowRuleOperation>> plan = itr.next();
if (plan.size() <= stageNumber) {
// we have consumed all stages from this plan, so remove it
itr.remove();
continue;
}
// write operations from this sub-stage into the builder
- Set<FlowRuleOperation> stage = plan.get(stageNumber);
+ Collection<FlowRuleOperation> stage = plan.get(stageNumber);
for (FlowRuleOperation entry : stage) {
builder.operation(entry);
}
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 ef6e8b5..260bd5b 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
@@ -15,10 +15,10 @@
*/
package org.onosproject.net.intent.impl;
-import java.util.List;
-import java.util.Set;
-import java.util.stream.Collectors;
-
+import com.google.common.collect.HashMultimap;
+import com.google.common.collect.ImmutableSet;
+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;
import org.apache.felix.scr.annotations.Deactivate;
@@ -42,10 +42,10 @@
import org.onosproject.net.intent.IntentInstaller;
import org.onosproject.net.intent.LinkCollectionIntent;
-import com.google.common.collect.HashMultimap;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Lists;
-import com.google.common.collect.SetMultimap;
+import java.util.Collection;
+import java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
/**
* Installer for {@link org.onosproject.net.intent.LinkCollectionIntent} path
@@ -75,18 +75,19 @@
}
@Override
- public List<Set<FlowRuleOperation>> install(LinkCollectionIntent intent) {
+ public List<Collection<FlowRuleOperation>> install(LinkCollectionIntent intent) {
return generateBatchOperations(intent, FlowRuleOperation.Type.ADD);
}
@Override
- public List<Set<FlowRuleOperation>> uninstall(LinkCollectionIntent intent) {
+ public List<Collection<FlowRuleOperation>> uninstall(LinkCollectionIntent intent) {
return generateBatchOperations(intent, FlowRuleOperation.Type.REMOVE);
}
- private List<Set<FlowRuleOperation>> generateBatchOperations(
+ private List<Collection<FlowRuleOperation>> generateBatchOperations(
LinkCollectionIntent intent, FlowRuleOperation.Type operation) {
+ //TODO do we need a set here?
SetMultimap<DeviceId, PortNumber> outputPorts = HashMultimap.create();
for (Link link : intent.links()) {
@@ -121,10 +122,10 @@
}
@Override
- public List<Set<FlowRuleOperation>> replace(LinkCollectionIntent oldIntent,
+ public List<Collection<FlowRuleOperation>> replace(LinkCollectionIntent oldIntent,
LinkCollectionIntent newIntent) {
// FIXME: implement this in a more intelligent/less brute force way
- List<Set<FlowRuleOperation>> batches = Lists.newArrayList();
+ List<Collection<FlowRuleOperation>> batches = Lists.newArrayList();
batches.addAll(uninstall(oldIntent));
batches.addAll(install(newIntent));
return batches;
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/MplsPathIntentInstaller.java b/core/net/src/main/java/org/onosproject/net/intent/impl/MplsPathIntentInstaller.java
index 9ad1fe5..5b7ef1a 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/MplsPathIntentInstaller.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/MplsPathIntentInstaller.java
@@ -1,9 +1,8 @@
package org.onosproject.net.intent.impl;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Deactivate;
@@ -40,9 +39,10 @@
import org.onosproject.net.resource.ResourceType;
import org.slf4j.Logger;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.slf4j.LoggerFactory.getLogger;
@@ -81,14 +81,14 @@
}
@Override
- public List<Set<FlowRuleOperation>> install(MplsPathIntent intent) {
+ public List<Collection<FlowRuleOperation>> install(MplsPathIntent intent) {
LinkResourceAllocations allocations = assignMplsLabel(intent);
return generateRules(intent, allocations, FlowRuleOperation.Type.ADD);
}
@Override
- public List<Set<FlowRuleOperation>> uninstall(MplsPathIntent intent) {
+ public List<Collection<FlowRuleOperation>> uninstall(MplsPathIntent intent) {
LinkResourceAllocations allocations = resourceService
.getAllocations(intent.id());
resourceService.releaseResources(allocations);
@@ -97,10 +97,10 @@
}
@Override
- public List<Set<FlowRuleOperation>> replace(MplsPathIntent oldIntent,
+ public List<Collection<FlowRuleOperation>> replace(MplsPathIntent oldIntent,
MplsPathIntent newIntent) {
-
- List<Set<FlowRuleOperation>> batches = Lists.newArrayList();
+ //FIXME this is brute force
+ List<Collection<FlowRuleOperation>> batches = Lists.newArrayList();
batches.addAll(uninstall(oldIntent));
batches.addAll(install(newIntent));
return batches;
@@ -140,7 +140,7 @@
return null;
}
- private List<Set<FlowRuleOperation>> generateRules(MplsPathIntent intent,
+ private List<Collection<FlowRuleOperation>> generateRules(MplsPathIntent intent,
LinkResourceAllocations allocations,
FlowRuleOperation.Type operation) {
@@ -150,7 +150,7 @@
Link link = links.next();
// List of flow rules to be installed
- Set<FlowRuleOperation> rules = Sets.newHashSet();
+ List<FlowRuleOperation> rules = Lists.newLinkedList();
// Ingress traffic
// Get the new MPLS label
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/ObjectiveTracker.java b/core/net/src/main/java/org/onosproject/net/intent/impl/ObjectiveTracker.java
index 3c7b733..b6edebf 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/ObjectiveTracker.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/ObjectiveTracker.java
@@ -49,10 +49,10 @@
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.collect.Multimaps.synchronizedSetMultimap;
import static java.util.concurrent.Executors.newSingleThreadExecutor;
+import static org.onlab.util.Tools.namedThreads;
import static org.onosproject.net.LinkKey.linkKey;
import static org.onosproject.net.link.LinkEvent.Type.LINK_REMOVED;
import static org.onosproject.net.link.LinkEvent.Type.LINK_UPDATED;
-import static org.onlab.util.Tools.namedThreads;
import static org.slf4j.LoggerFactory.getLogger;
/**
@@ -66,6 +66,7 @@
private final Logger log = getLogger(getClass());
private final SetMultimap<LinkKey, Key> intentsByLink =
+ //TODO this could be slow as a point of synchronization
synchronizedSetMultimap(HashMultimap.<LinkKey, Key>create());
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/OpticalPathIntentInstaller.java b/core/net/src/main/java/org/onosproject/net/intent/impl/OpticalPathIntentInstaller.java
index e2dc0d4..9dea575 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/OpticalPathIntentInstaller.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/OpticalPathIntentInstaller.java
@@ -15,9 +15,8 @@
*/
package org.onosproject.net.intent.impl;
-import java.util.List;
-import java.util.Set;
-
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Lists;
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Deactivate;
@@ -49,9 +48,8 @@
import org.onosproject.net.topology.TopologyService;
import org.slf4j.Logger;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
+import java.util.Collection;
+import java.util.List;
import static org.onosproject.net.flow.DefaultTrafficTreatment.builder;
import static org.slf4j.LoggerFactory.getLogger;
@@ -94,24 +92,24 @@
}
@Override
- public List<Set<FlowRuleOperation>> install(OpticalPathIntent intent) {
+ public List<Collection<FlowRuleOperation>> install(OpticalPathIntent intent) {
LinkResourceAllocations allocations = assignWavelength(intent);
return generateRules(intent, allocations, FlowRuleOperation.Type.ADD);
}
@Override
- public List<Set<FlowRuleOperation>> uninstall(OpticalPathIntent intent) {
+ public List<Collection<FlowRuleOperation>> uninstall(OpticalPathIntent intent) {
LinkResourceAllocations allocations = resourceService.getAllocations(intent.id());
- List<Set<FlowRuleOperation>> rules = generateRules(intent, allocations, FlowRuleOperation.Type.REMOVE);
+ List<Collection<FlowRuleOperation>> rules = generateRules(intent, allocations, FlowRuleOperation.Type.REMOVE);
log.info("uninstall rules: {}", rules);
return rules;
}
@Override
- public List<Set<FlowRuleOperation>> replace(OpticalPathIntent oldIntent,
+ public List<Collection<FlowRuleOperation>> replace(OpticalPathIntent oldIntent,
OpticalPathIntent newIntent) {
// FIXME: implement this
- List<Set<FlowRuleOperation>> batches = Lists.newArrayList();
+ List<Collection<FlowRuleOperation>> batches = Lists.newArrayList();
batches.addAll(uninstall(oldIntent));
batches.addAll(install(newIntent));
return batches;
@@ -125,13 +123,13 @@
return retLambda;
}
- private List<Set<FlowRuleOperation>> generateRules(OpticalPathIntent intent,
+ private List<Collection<FlowRuleOperation>> generateRules(OpticalPathIntent intent,
LinkResourceAllocations allocations,
FlowRuleOperation.Type operation) {
TrafficSelector.Builder selectorBuilder = DefaultTrafficSelector.builder();
selectorBuilder.matchInPort(intent.src().port());
- Set<FlowRuleOperation> rules = Sets.newHashSet();
+ List<FlowRuleOperation> rules = Lists.newLinkedList();
ConnectPoint prev = intent.src();
//FIXME check for null allocations
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/PathIntentInstaller.java b/core/net/src/main/java/org/onosproject/net/intent/impl/PathIntentInstaller.java
index 65b6314..47ffabe 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/PathIntentInstaller.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/PathIntentInstaller.java
@@ -15,10 +15,8 @@
*/
package org.onosproject.net.intent.impl;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Lists;
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Deactivate;
@@ -45,9 +43,9 @@
import org.onosproject.net.resource.LinkResourceService;
import org.slf4j.Logger;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
import static org.onosproject.net.flow.DefaultTrafficTreatment.builder;
import static org.slf4j.LoggerFactory.getLogger;
@@ -83,14 +81,14 @@
}
@Override
- public List<Set<FlowRuleOperation>> install(PathIntent intent) {
+ public List<Collection<FlowRuleOperation>> install(PathIntent intent) {
LinkResourceAllocations allocations = allocateResources(intent);
TrafficSelector.Builder builder =
DefaultTrafficSelector.builder(intent.selector());
Iterator<Link> links = intent.path().links().iterator();
ConnectPoint prev = links.next().dst();
- Set<FlowRuleOperation> rules = Sets.newHashSet();
+ List<FlowRuleOperation> rules = Lists.newLinkedList();
// TODO Generate multiple batches
while (links.hasNext()) {
builder.matchInPort(prev.port());
@@ -113,13 +111,13 @@
}
@Override
- public List<Set<FlowRuleOperation>> uninstall(PathIntent intent) {
+ public List<Collection<FlowRuleOperation>> uninstall(PathIntent intent) {
deallocateResources(intent);
TrafficSelector.Builder builder =
DefaultTrafficSelector.builder(intent.selector());
Iterator<Link> links = intent.path().links().iterator();
ConnectPoint prev = links.next().dst();
- Set<FlowRuleOperation> rules = Sets.newHashSet();
+ List<FlowRuleOperation> rules = Lists.newLinkedList();
// TODO Generate multiple batches
while (links.hasNext()) {
builder.matchInPort(prev.port());
@@ -140,9 +138,9 @@
}
@Override
- public List<Set<FlowRuleOperation>> replace(PathIntent oldIntent, PathIntent newIntent) {
+ public List<Collection<FlowRuleOperation>> replace(PathIntent oldIntent, PathIntent newIntent) {
// FIXME: implement this
- List<Set<FlowRuleOperation>> batches = Lists.newArrayList();
+ List<Collection<FlowRuleOperation>> batches = Lists.newArrayList();
batches.addAll(uninstall(oldIntent));
batches.addAll(install(newIntent));
return batches;
diff --git a/core/net/src/test/java/org/onosproject/net/intent/impl/IntentManagerTest.java b/core/net/src/test/java/org/onosproject/net/intent/impl/IntentManagerTest.java
index f55b575..642a66f 100644
--- a/core/net/src/test/java/org/onosproject/net/intent/impl/IntentManagerTest.java
+++ b/core/net/src/test/java/org/onosproject/net/intent/impl/IntentManagerTest.java
@@ -194,7 +194,7 @@
private static class TestIntentInstaller implements IntentInstaller<MockInstallableIntent> {
@Override
- public List<Set<org.onosproject.net.flow.FlowRuleOperation>> install(MockInstallableIntent intent) {
+ public List<Collection<org.onosproject.net.flow.FlowRuleOperation>> install(MockInstallableIntent intent) {
FlowRule fr = new IntentTestsMocks.MockFlowRule(intent.number().intValue());
Set<FlowRuleOperation> rules = ImmutableSet.of(
new FlowRuleOperation(fr, FlowRuleOperation.Type.ADD));
@@ -202,7 +202,7 @@
}
@Override
- public List<Set<FlowRuleOperation>> uninstall(MockInstallableIntent intent) {
+ public List<Collection<FlowRuleOperation>> uninstall(MockInstallableIntent intent) {
FlowRule fr = new IntentTestsMocks.MockFlowRule(intent.number().intValue());
Set<FlowRuleOperation> rules = ImmutableSet.of(
new FlowRuleOperation(fr, FlowRuleOperation.Type.REMOVE));
@@ -210,7 +210,8 @@
}
@Override
- public List<Set<FlowRuleOperation>> replace(MockInstallableIntent oldIntent, MockInstallableIntent newIntent) {
+ public List<Collection<FlowRuleOperation>> replace(MockInstallableIntent oldIntent,
+ MockInstallableIntent newIntent) {
FlowRule fr = new IntentTestsMocks.MockFlowRule(oldIntent.number().intValue());
FlowRule fr2 = new IntentTestsMocks.MockFlowRule(newIntent.number().intValue());
Set<FlowRuleOperation> rules = ImmutableSet.of(
@@ -222,17 +223,18 @@
private static class TestIntentErrorInstaller implements IntentInstaller<MockInstallableIntent> {
@Override
- public List<Set<FlowRuleOperation>> install(MockInstallableIntent intent) {
+ public List<Collection<FlowRuleOperation>> install(MockInstallableIntent intent) {
throw new IntentInstallationException("install() always fails");
}
@Override
- public List<Set<FlowRuleOperation>> uninstall(MockInstallableIntent intent) {
+ public List<Collection<FlowRuleOperation>> uninstall(MockInstallableIntent intent) {
throw new IntentRemovalException("uninstall() always fails");
}
@Override
- public List<Set<FlowRuleOperation>> replace(MockInstallableIntent oldIntent, MockInstallableIntent newIntent) {
+ public List<Collection<FlowRuleOperation>> replace(MockInstallableIntent oldIntent,
+ MockInstallableIntent newIntent) {
throw new IntentInstallationException("replace() always fails");
}
}
diff --git a/core/net/src/test/java/org/onosproject/net/intent/impl/PathConstraintCalculationTest.java b/core/net/src/test/java/org/onosproject/net/intent/impl/PathConstraintCalculationTest.java
index 5a5611b..8dd78c2 100644
--- a/core/net/src/test/java/org/onosproject/net/intent/impl/PathConstraintCalculationTest.java
+++ b/core/net/src/test/java/org/onosproject/net/intent/impl/PathConstraintCalculationTest.java
@@ -15,10 +15,6 @@
*/
package org.onosproject.net.intent.impl;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
-
import org.junit.Test;
import org.onosproject.net.flow.FlowRuleOperation;
import org.onosproject.net.flow.TrafficSelector;
@@ -35,11 +31,12 @@
import org.onosproject.net.resource.Lambda;
import org.onosproject.net.resource.LinkResourceService;
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.List;
+
import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.containsString;
-import static org.hamcrest.Matchers.hasSize;
-import static org.hamcrest.Matchers.instanceOf;
-import static org.hamcrest.Matchers.notNullValue;
+import static org.hamcrest.Matchers.*;
import static org.junit.Assert.fail;
import static org.onosproject.net.NetTestTools.APP_ID;
import static org.onosproject.net.NetTestTools.connectPoint;
@@ -99,7 +96,7 @@
* @param resourceService service to use for resource allocation requests
* @return fow rule entries
*/
- private List<Set<FlowRuleOperation>> installIntents(List<Intent> compiledIntents,
+ private List<Collection<FlowRuleOperation>> installIntents(List<Intent> compiledIntents,
LinkResourceService resourceService) {
final PathIntent path = (PathIntent) compiledIntents.get(0);
@@ -193,7 +190,7 @@
assertThat(compiledIntents, notNullValue());
assertThat(compiledIntents, hasSize(1));
- final List<Set<FlowRuleOperation>> flowOperations =
+ final List<Collection<FlowRuleOperation>> flowOperations =
installIntents(compiledIntents, resourceService);
assertThat(flowOperations, notNullValue());
@@ -242,7 +239,7 @@
assertThat(compiledIntents, notNullValue());
assertThat(compiledIntents, hasSize(1));
- final List<Set<FlowRuleOperation>> flowOperations =
+ final List<Collection<FlowRuleOperation>> flowOperations =
installIntents(compiledIntents, resourceService);
assertThat(flowOperations, notNullValue());