ONOS-1057 - Remove references to deprecated applyBatch() method
Change-Id: I9215fde6be2acaa2becea58d8b6e5b171ff16817
diff --git a/core/api/src/main/java/org/onosproject/net/flow/FlowRuleService.java b/core/api/src/main/java/org/onosproject/net/flow/FlowRuleService.java
index 957ecf2..8dc9dc1 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/FlowRuleService.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/FlowRuleService.java
@@ -18,8 +18,6 @@
import org.onosproject.core.ApplicationId;
import org.onosproject.net.DeviceId;
-import java.util.concurrent.Future;
-
/**
* Service for injecting flow rules into the environment and for obtaining
* information about flow rules already in the environment. This implements
@@ -100,16 +98,6 @@
/**
* Applies a batch operation of FlowRules.
*
- * @param batch batch operation to apply
- * @return future indicating the state of the batch operation, due to the
- * deprecation of this api the future will immediately return
- */
- @Deprecated
- Future<CompletedBatchOperation> applyBatch(FlowRuleBatchOperation batch);
-
- /**
- * Applies a batch operation of FlowRules.
- *
* @param ops batch operation to apply
*/
void apply(FlowRuleOperations ops);
diff --git a/core/api/src/test/java/org/onosproject/net/flow/FlowRuleServiceAdapter.java b/core/api/src/test/java/org/onosproject/net/flow/FlowRuleServiceAdapter.java
index 393f3cf..c7b7879 100644
--- a/core/api/src/test/java/org/onosproject/net/flow/FlowRuleServiceAdapter.java
+++ b/core/api/src/test/java/org/onosproject/net/flow/FlowRuleServiceAdapter.java
@@ -19,8 +19,6 @@
import org.onosproject.core.ApplicationId;
import org.onosproject.net.DeviceId;
-import java.util.concurrent.Future;
-
/**
* Test adapter for flow rule service.
*/
@@ -61,11 +59,6 @@
}
@Override
- public Future<CompletedBatchOperation> applyBatch(FlowRuleBatchOperation batch) {
- return null;
- }
-
- @Override
public void apply(FlowRuleOperations ops) {
}
diff --git a/core/net/src/main/java/org/onosproject/net/flow/impl/FlowRuleManager.java b/core/net/src/main/java/org/onosproject/net/flow/impl/FlowRuleManager.java
index 97a2b68..9cbe923 100644
--- a/core/net/src/main/java/org/onosproject/net/flow/impl/FlowRuleManager.java
+++ b/core/net/src/main/java/org/onosproject/net/flow/impl/FlowRuleManager.java
@@ -15,13 +15,15 @@
*/
package org.onosproject.net.flow.impl;
-import com.google.common.collect.ArrayListMultimap;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-import com.google.common.collect.Multimap;
-import com.google.common.collect.Sets;
-import com.google.common.util.concurrent.Futures;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.atomic.AtomicBoolean;
+
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Deactivate;
@@ -58,15 +60,12 @@
import org.onosproject.net.provider.AbstractProviderService;
import org.slf4j.Logger;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
-import java.util.concurrent.atomic.AtomicBoolean;
+import com.google.common.collect.ArrayListMultimap;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import com.google.common.collect.Multimap;
+import com.google.common.collect.Sets;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.onlab.util.Tools.namedThreads;
@@ -195,36 +194,6 @@
}
@Override
- public Future<CompletedBatchOperation> applyBatch(FlowRuleBatchOperation batch) {
-
-
- FlowRuleOperations.Builder fopsBuilder = FlowRuleOperations.builder();
- batch.getOperations().stream().forEach(op -> {
- switch (op.operator()) {
- case ADD:
- fopsBuilder.add(op.target());
- break;
- case REMOVE:
- fopsBuilder.remove(op.target());
- break;
- case MODIFY:
- fopsBuilder.modify(op.target());
- break;
- default:
- log.warn("Unknown flow operation operator: {}", op.operator());
-
- }
- }
- );
-
- apply(fopsBuilder.build());
- return Futures.immediateFuture(
- new CompletedBatchOperation(true,
- Collections.emptySet(), null));
-
- }
-
- @Override
public void apply(FlowRuleOperations ops) {
operationsService.submit(new FlowOperationsProcessor(ops));
}
diff --git a/core/net/src/test/java/org/onosproject/net/flow/impl/FlowRuleManagerTest.java b/core/net/src/test/java/org/onosproject/net/flow/impl/FlowRuleManagerTest.java
index 3fd8b5a..fbda6cd 100644
--- a/core/net/src/test/java/org/onosproject/net/flow/impl/FlowRuleManagerTest.java
+++ b/core/net/src/test/java/org/onosproject/net/flow/impl/FlowRuleManagerTest.java
@@ -15,12 +15,19 @@
*/
package org.onosproject.net.flow.impl;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
-import com.google.common.util.concurrent.ListenableFuture;
-import com.google.common.util.concurrent.MoreExecutors;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Executor;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+import java.util.concurrent.atomic.AtomicLong;
+
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -45,7 +52,6 @@
import org.onosproject.net.flow.FlowEntry;
import org.onosproject.net.flow.FlowEntry.FlowEntryState;
import org.onosproject.net.flow.FlowRule;
-import org.onosproject.net.flow.FlowRuleBatchEntry;
import org.onosproject.net.flow.FlowRuleBatchOperation;
import org.onosproject.net.flow.FlowRuleEvent;
import org.onosproject.net.flow.FlowRuleListener;
@@ -62,22 +68,22 @@
import org.onosproject.net.provider.ProviderId;
import org.onosproject.store.trivial.impl.SimpleFlowRuleStore;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Executor;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-import java.util.concurrent.atomic.AtomicLong;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
+import com.google.common.util.concurrent.ListenableFuture;
+import com.google.common.util.concurrent.MoreExecutors;
-import static org.junit.Assert.*;
-import static org.onosproject.net.flow.FlowRuleEvent.Type.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.onosproject.net.flow.FlowRuleEvent.Type.RULE_ADDED;
+import static org.onosproject.net.flow.FlowRuleEvent.Type.RULE_ADD_REQUESTED;
+import static org.onosproject.net.flow.FlowRuleEvent.Type.RULE_REMOVED;
+import static org.onosproject.net.flow.FlowRuleEvent.Type.RULE_REMOVE_REQUESTED;
+import static org.onosproject.net.flow.FlowRuleEvent.Type.RULE_UPDATED;
/**
* Test codifying the flow rule service & flow rule provider service contracts.
@@ -387,42 +393,6 @@
f2, FlowEntryState.PENDING_REMOVE));
}
- @Test
- public void applyBatch() {
- FlowRule f1 = flowRule(1, 1);
- FlowRule f2 = flowRule(2, 2);
-
-
- mgr.applyFlowRules(f1);
-
- FlowEntry fe1 = new DefaultFlowEntry(f1);
- providerService.pushFlowMetrics(DID, Collections.<FlowEntry>singletonList(fe1));
-
- FlowRuleBatchEntry fbe1 = new FlowRuleBatchEntry(
- FlowRuleBatchEntry.FlowRuleOperation.REMOVE, f1);
-
- FlowRuleBatchEntry fbe2 = new FlowRuleBatchEntry(
- FlowRuleBatchEntry.FlowRuleOperation.ADD, f2);
-
- FlowRuleBatchOperation fbo = new FlowRuleBatchOperation(
- Lists.newArrayList(fbe1, fbe2), null, 0);
- Future<CompletedBatchOperation> future = mgr.applyBatch(fbo);
- assertTrue("Entries in wrong state",
- validateState(ImmutableMap.of(
- f1, FlowEntryState.PENDING_REMOVE,
- f2, FlowEntryState.PENDING_ADD)));
- CompletedBatchOperation completed = null;
- try {
- completed = future.get();
- } catch (InterruptedException | ExecutionException e) {
- fail("Unexpected exception: " + e);
- }
- if (!completed.isSuccess()) {
- fail("Installation should be a success");
- }
-
- }
-
private static class TestListener implements FlowRuleListener {
final List<FlowRuleEvent> events = new ArrayList<>();
diff --git a/core/net/src/test/java/org/onosproject/net/intent/impl/MockFlowRuleService.java b/core/net/src/test/java/org/onosproject/net/intent/impl/MockFlowRuleService.java
index f2f4edb..66ea27e 100644
--- a/core/net/src/test/java/org/onosproject/net/intent/impl/MockFlowRuleService.java
+++ b/core/net/src/test/java/org/onosproject/net/intent/impl/MockFlowRuleService.java
@@ -15,21 +15,19 @@
*/
package org.onosproject.net.intent.impl;
-import com.google.common.collect.Sets;
+import java.util.Set;
+import java.util.stream.Collectors;
+
import org.onosproject.core.ApplicationId;
import org.onosproject.net.DeviceId;
-import org.onosproject.net.flow.CompletedBatchOperation;
import org.onosproject.net.flow.DefaultFlowEntry;
import org.onosproject.net.flow.FlowEntry;
import org.onosproject.net.flow.FlowRule;
-import org.onosproject.net.flow.FlowRuleBatchOperation;
import org.onosproject.net.flow.FlowRuleListener;
import org.onosproject.net.flow.FlowRuleOperations;
import org.onosproject.net.flow.FlowRuleService;
-import java.util.Set;
-import java.util.concurrent.Future;
-import java.util.stream.Collectors;
+import com.google.common.collect.Sets;
public class MockFlowRuleService implements FlowRuleService {
@@ -42,11 +40,6 @@
}
@Override
- public Future<CompletedBatchOperation> applyBatch(FlowRuleBatchOperation batch) {
- throw new UnsupportedOperationException("deprecated");
- }
-
- @Override
public void apply(FlowRuleOperations ops) {
ops.stages().forEach(stage -> stage.forEach(flow -> {
switch (flow.type()) {