ONOS-1057 - Remove references to deprecated applyBatch() method
Change-Id: I9215fde6be2acaa2becea58d8b6e5b171ff16817
Showing
5 changed files
with
47 additions
and
134 deletions
| ... | @@ -18,8 +18,6 @@ package org.onosproject.net.flow; | ... | @@ -18,8 +18,6 @@ package org.onosproject.net.flow; |
| 18 | import org.onosproject.core.ApplicationId; | 18 | import org.onosproject.core.ApplicationId; |
| 19 | import org.onosproject.net.DeviceId; | 19 | import org.onosproject.net.DeviceId; |
| 20 | 20 | ||
| 21 | -import java.util.concurrent.Future; | ||
| 22 | - | ||
| 23 | /** | 21 | /** |
| 24 | * Service for injecting flow rules into the environment and for obtaining | 22 | * Service for injecting flow rules into the environment and for obtaining |
| 25 | * information about flow rules already in the environment. This implements | 23 | * information about flow rules already in the environment. This implements |
| ... | @@ -100,16 +98,6 @@ public interface FlowRuleService { | ... | @@ -100,16 +98,6 @@ public interface FlowRuleService { |
| 100 | /** | 98 | /** |
| 101 | * Applies a batch operation of FlowRules. | 99 | * Applies a batch operation of FlowRules. |
| 102 | * | 100 | * |
| 103 | - * @param batch batch operation to apply | ||
| 104 | - * @return future indicating the state of the batch operation, due to the | ||
| 105 | - * deprecation of this api the future will immediately return | ||
| 106 | - */ | ||
| 107 | - @Deprecated | ||
| 108 | - Future<CompletedBatchOperation> applyBatch(FlowRuleBatchOperation batch); | ||
| 109 | - | ||
| 110 | - /** | ||
| 111 | - * Applies a batch operation of FlowRules. | ||
| 112 | - * | ||
| 113 | * @param ops batch operation to apply | 101 | * @param ops batch operation to apply |
| 114 | */ | 102 | */ |
| 115 | void apply(FlowRuleOperations ops); | 103 | void apply(FlowRuleOperations ops); | ... | ... |
| ... | @@ -19,8 +19,6 @@ package org.onosproject.net.flow; | ... | @@ -19,8 +19,6 @@ package org.onosproject.net.flow; |
| 19 | import org.onosproject.core.ApplicationId; | 19 | import org.onosproject.core.ApplicationId; |
| 20 | import org.onosproject.net.DeviceId; | 20 | import org.onosproject.net.DeviceId; |
| 21 | 21 | ||
| 22 | -import java.util.concurrent.Future; | ||
| 23 | - | ||
| 24 | /** | 22 | /** |
| 25 | * Test adapter for flow rule service. | 23 | * Test adapter for flow rule service. |
| 26 | */ | 24 | */ |
| ... | @@ -61,11 +59,6 @@ public class FlowRuleServiceAdapter implements FlowRuleService { | ... | @@ -61,11 +59,6 @@ public class FlowRuleServiceAdapter implements FlowRuleService { |
| 61 | } | 59 | } |
| 62 | 60 | ||
| 63 | @Override | 61 | @Override |
| 64 | - public Future<CompletedBatchOperation> applyBatch(FlowRuleBatchOperation batch) { | ||
| 65 | - return null; | ||
| 66 | - } | ||
| 67 | - | ||
| 68 | - @Override | ||
| 69 | public void apply(FlowRuleOperations ops) { | 62 | public void apply(FlowRuleOperations ops) { |
| 70 | 63 | ||
| 71 | } | 64 | } | ... | ... |
| ... | @@ -15,13 +15,15 @@ | ... | @@ -15,13 +15,15 @@ |
| 15 | */ | 15 | */ |
| 16 | package org.onosproject.net.flow.impl; | 16 | package org.onosproject.net.flow.impl; |
| 17 | 17 | ||
| 18 | -import com.google.common.collect.ArrayListMultimap; | 18 | +import java.util.Collections; |
| 19 | -import com.google.common.collect.Iterables; | 19 | +import java.util.List; |
| 20 | -import com.google.common.collect.Lists; | 20 | +import java.util.Map; |
| 21 | -import com.google.common.collect.Maps; | 21 | +import java.util.Set; |
| 22 | -import com.google.common.collect.Multimap; | 22 | +import java.util.concurrent.ConcurrentHashMap; |
| 23 | -import com.google.common.collect.Sets; | 23 | +import java.util.concurrent.ExecutorService; |
| 24 | -import com.google.common.util.concurrent.Futures; | 24 | +import java.util.concurrent.Executors; |
| 25 | +import java.util.concurrent.atomic.AtomicBoolean; | ||
| 26 | + | ||
| 25 | import org.apache.felix.scr.annotations.Activate; | 27 | import org.apache.felix.scr.annotations.Activate; |
| 26 | import org.apache.felix.scr.annotations.Component; | 28 | import org.apache.felix.scr.annotations.Component; |
| 27 | import org.apache.felix.scr.annotations.Deactivate; | 29 | import org.apache.felix.scr.annotations.Deactivate; |
| ... | @@ -58,15 +60,12 @@ import org.onosproject.net.provider.AbstractProviderRegistry; | ... | @@ -58,15 +60,12 @@ import org.onosproject.net.provider.AbstractProviderRegistry; |
| 58 | import org.onosproject.net.provider.AbstractProviderService; | 60 | import org.onosproject.net.provider.AbstractProviderService; |
| 59 | import org.slf4j.Logger; | 61 | import org.slf4j.Logger; |
| 60 | 62 | ||
| 61 | -import java.util.Collections; | 63 | +import com.google.common.collect.ArrayListMultimap; |
| 62 | -import java.util.List; | 64 | +import com.google.common.collect.Iterables; |
| 63 | -import java.util.Map; | 65 | +import com.google.common.collect.Lists; |
| 64 | -import java.util.Set; | 66 | +import com.google.common.collect.Maps; |
| 65 | -import java.util.concurrent.ConcurrentHashMap; | 67 | +import com.google.common.collect.Multimap; |
| 66 | -import java.util.concurrent.ExecutorService; | 68 | +import com.google.common.collect.Sets; |
| 67 | -import java.util.concurrent.Executors; | ||
| 68 | -import java.util.concurrent.Future; | ||
| 69 | -import java.util.concurrent.atomic.AtomicBoolean; | ||
| 70 | 69 | ||
| 71 | import static com.google.common.base.Preconditions.checkNotNull; | 70 | import static com.google.common.base.Preconditions.checkNotNull; |
| 72 | import static org.onlab.util.Tools.namedThreads; | 71 | import static org.onlab.util.Tools.namedThreads; |
| ... | @@ -195,36 +194,6 @@ public class FlowRuleManager | ... | @@ -195,36 +194,6 @@ public class FlowRuleManager |
| 195 | } | 194 | } |
| 196 | 195 | ||
| 197 | @Override | 196 | @Override |
| 198 | - public Future<CompletedBatchOperation> applyBatch(FlowRuleBatchOperation batch) { | ||
| 199 | - | ||
| 200 | - | ||
| 201 | - FlowRuleOperations.Builder fopsBuilder = FlowRuleOperations.builder(); | ||
| 202 | - batch.getOperations().stream().forEach(op -> { | ||
| 203 | - switch (op.operator()) { | ||
| 204 | - case ADD: | ||
| 205 | - fopsBuilder.add(op.target()); | ||
| 206 | - break; | ||
| 207 | - case REMOVE: | ||
| 208 | - fopsBuilder.remove(op.target()); | ||
| 209 | - break; | ||
| 210 | - case MODIFY: | ||
| 211 | - fopsBuilder.modify(op.target()); | ||
| 212 | - break; | ||
| 213 | - default: | ||
| 214 | - log.warn("Unknown flow operation operator: {}", op.operator()); | ||
| 215 | - | ||
| 216 | - } | ||
| 217 | - } | ||
| 218 | - ); | ||
| 219 | - | ||
| 220 | - apply(fopsBuilder.build()); | ||
| 221 | - return Futures.immediateFuture( | ||
| 222 | - new CompletedBatchOperation(true, | ||
| 223 | - Collections.emptySet(), null)); | ||
| 224 | - | ||
| 225 | - } | ||
| 226 | - | ||
| 227 | - @Override | ||
| 228 | public void apply(FlowRuleOperations ops) { | 197 | public void apply(FlowRuleOperations ops) { |
| 229 | operationsService.submit(new FlowOperationsProcessor(ops)); | 198 | operationsService.submit(new FlowOperationsProcessor(ops)); |
| 230 | } | 199 | } | ... | ... |
| ... | @@ -15,12 +15,19 @@ | ... | @@ -15,12 +15,19 @@ |
| 15 | */ | 15 | */ |
| 16 | package org.onosproject.net.flow.impl; | 16 | package org.onosproject.net.flow.impl; |
| 17 | 17 | ||
| 18 | -import com.google.common.collect.ImmutableList; | 18 | +import java.util.ArrayList; |
| 19 | -import com.google.common.collect.ImmutableMap; | 19 | +import java.util.Arrays; |
| 20 | -import com.google.common.collect.Lists; | 20 | +import java.util.Collections; |
| 21 | -import com.google.common.collect.Sets; | 21 | +import java.util.HashMap; |
| 22 | -import com.google.common.util.concurrent.ListenableFuture; | 22 | +import java.util.List; |
| 23 | -import com.google.common.util.concurrent.MoreExecutors; | 23 | +import java.util.Map; |
| 24 | +import java.util.Set; | ||
| 25 | +import java.util.concurrent.ExecutionException; | ||
| 26 | +import java.util.concurrent.Executor; | ||
| 27 | +import java.util.concurrent.TimeUnit; | ||
| 28 | +import java.util.concurrent.TimeoutException; | ||
| 29 | +import java.util.concurrent.atomic.AtomicLong; | ||
| 30 | + | ||
| 24 | import org.junit.After; | 31 | import org.junit.After; |
| 25 | import org.junit.Before; | 32 | import org.junit.Before; |
| 26 | import org.junit.Test; | 33 | import org.junit.Test; |
| ... | @@ -45,7 +52,6 @@ import org.onosproject.net.flow.DefaultFlowRule; | ... | @@ -45,7 +52,6 @@ import org.onosproject.net.flow.DefaultFlowRule; |
| 45 | import org.onosproject.net.flow.FlowEntry; | 52 | import org.onosproject.net.flow.FlowEntry; |
| 46 | import org.onosproject.net.flow.FlowEntry.FlowEntryState; | 53 | import org.onosproject.net.flow.FlowEntry.FlowEntryState; |
| 47 | import org.onosproject.net.flow.FlowRule; | 54 | import org.onosproject.net.flow.FlowRule; |
| 48 | -import org.onosproject.net.flow.FlowRuleBatchEntry; | ||
| 49 | import org.onosproject.net.flow.FlowRuleBatchOperation; | 55 | import org.onosproject.net.flow.FlowRuleBatchOperation; |
| 50 | import org.onosproject.net.flow.FlowRuleEvent; | 56 | import org.onosproject.net.flow.FlowRuleEvent; |
| 51 | import org.onosproject.net.flow.FlowRuleListener; | 57 | import org.onosproject.net.flow.FlowRuleListener; |
| ... | @@ -62,22 +68,22 @@ import org.onosproject.net.provider.AbstractProvider; | ... | @@ -62,22 +68,22 @@ import org.onosproject.net.provider.AbstractProvider; |
| 62 | import org.onosproject.net.provider.ProviderId; | 68 | import org.onosproject.net.provider.ProviderId; |
| 63 | import org.onosproject.store.trivial.impl.SimpleFlowRuleStore; | 69 | import org.onosproject.store.trivial.impl.SimpleFlowRuleStore; |
| 64 | 70 | ||
| 65 | -import java.util.ArrayList; | 71 | +import com.google.common.collect.ImmutableList; |
| 66 | -import java.util.Arrays; | 72 | +import com.google.common.collect.ImmutableMap; |
| 67 | -import java.util.Collections; | 73 | +import com.google.common.collect.Lists; |
| 68 | -import java.util.HashMap; | 74 | +import com.google.common.collect.Sets; |
| 69 | -import java.util.List; | 75 | +import com.google.common.util.concurrent.ListenableFuture; |
| 70 | -import java.util.Map; | 76 | +import com.google.common.util.concurrent.MoreExecutors; |
| 71 | -import java.util.Set; | ||
| 72 | -import java.util.concurrent.ExecutionException; | ||
| 73 | -import java.util.concurrent.Executor; | ||
| 74 | -import java.util.concurrent.Future; | ||
| 75 | -import java.util.concurrent.TimeUnit; | ||
| 76 | -import java.util.concurrent.TimeoutException; | ||
| 77 | -import java.util.concurrent.atomic.AtomicLong; | ||
| 78 | 77 | ||
| 79 | -import static org.junit.Assert.*; | 78 | +import static org.junit.Assert.assertEquals; |
| 80 | -import static org.onosproject.net.flow.FlowRuleEvent.Type.*; | 79 | +import static org.junit.Assert.assertFalse; |
| 80 | +import static org.junit.Assert.assertNotNull; | ||
| 81 | +import static org.junit.Assert.assertTrue; | ||
| 82 | +import static org.onosproject.net.flow.FlowRuleEvent.Type.RULE_ADDED; | ||
| 83 | +import static org.onosproject.net.flow.FlowRuleEvent.Type.RULE_ADD_REQUESTED; | ||
| 84 | +import static org.onosproject.net.flow.FlowRuleEvent.Type.RULE_REMOVED; | ||
| 85 | +import static org.onosproject.net.flow.FlowRuleEvent.Type.RULE_REMOVE_REQUESTED; | ||
| 86 | +import static org.onosproject.net.flow.FlowRuleEvent.Type.RULE_UPDATED; | ||
| 81 | 87 | ||
| 82 | /** | 88 | /** |
| 83 | * Test codifying the flow rule service & flow rule provider service contracts. | 89 | * Test codifying the flow rule service & flow rule provider service contracts. |
| ... | @@ -387,42 +393,6 @@ public class FlowRuleManagerTest { | ... | @@ -387,42 +393,6 @@ public class FlowRuleManagerTest { |
| 387 | f2, FlowEntryState.PENDING_REMOVE)); | 393 | f2, FlowEntryState.PENDING_REMOVE)); |
| 388 | } | 394 | } |
| 389 | 395 | ||
| 390 | - @Test | ||
| 391 | - public void applyBatch() { | ||
| 392 | - FlowRule f1 = flowRule(1, 1); | ||
| 393 | - FlowRule f2 = flowRule(2, 2); | ||
| 394 | - | ||
| 395 | - | ||
| 396 | - mgr.applyFlowRules(f1); | ||
| 397 | - | ||
| 398 | - FlowEntry fe1 = new DefaultFlowEntry(f1); | ||
| 399 | - providerService.pushFlowMetrics(DID, Collections.<FlowEntry>singletonList(fe1)); | ||
| 400 | - | ||
| 401 | - FlowRuleBatchEntry fbe1 = new FlowRuleBatchEntry( | ||
| 402 | - FlowRuleBatchEntry.FlowRuleOperation.REMOVE, f1); | ||
| 403 | - | ||
| 404 | - FlowRuleBatchEntry fbe2 = new FlowRuleBatchEntry( | ||
| 405 | - FlowRuleBatchEntry.FlowRuleOperation.ADD, f2); | ||
| 406 | - | ||
| 407 | - FlowRuleBatchOperation fbo = new FlowRuleBatchOperation( | ||
| 408 | - Lists.newArrayList(fbe1, fbe2), null, 0); | ||
| 409 | - Future<CompletedBatchOperation> future = mgr.applyBatch(fbo); | ||
| 410 | - assertTrue("Entries in wrong state", | ||
| 411 | - validateState(ImmutableMap.of( | ||
| 412 | - f1, FlowEntryState.PENDING_REMOVE, | ||
| 413 | - f2, FlowEntryState.PENDING_ADD))); | ||
| 414 | - CompletedBatchOperation completed = null; | ||
| 415 | - try { | ||
| 416 | - completed = future.get(); | ||
| 417 | - } catch (InterruptedException | ExecutionException e) { | ||
| 418 | - fail("Unexpected exception: " + e); | ||
| 419 | - } | ||
| 420 | - if (!completed.isSuccess()) { | ||
| 421 | - fail("Installation should be a success"); | ||
| 422 | - } | ||
| 423 | - | ||
| 424 | - } | ||
| 425 | - | ||
| 426 | private static class TestListener implements FlowRuleListener { | 396 | private static class TestListener implements FlowRuleListener { |
| 427 | final List<FlowRuleEvent> events = new ArrayList<>(); | 397 | final List<FlowRuleEvent> events = new ArrayList<>(); |
| 428 | 398 | ... | ... |
| ... | @@ -15,21 +15,19 @@ | ... | @@ -15,21 +15,19 @@ |
| 15 | */ | 15 | */ |
| 16 | package org.onosproject.net.intent.impl; | 16 | package org.onosproject.net.intent.impl; |
| 17 | 17 | ||
| 18 | -import com.google.common.collect.Sets; | 18 | +import java.util.Set; |
| 19 | +import java.util.stream.Collectors; | ||
| 20 | + | ||
| 19 | import org.onosproject.core.ApplicationId; | 21 | import org.onosproject.core.ApplicationId; |
| 20 | import org.onosproject.net.DeviceId; | 22 | import org.onosproject.net.DeviceId; |
| 21 | -import org.onosproject.net.flow.CompletedBatchOperation; | ||
| 22 | import org.onosproject.net.flow.DefaultFlowEntry; | 23 | import org.onosproject.net.flow.DefaultFlowEntry; |
| 23 | import org.onosproject.net.flow.FlowEntry; | 24 | import org.onosproject.net.flow.FlowEntry; |
| 24 | import org.onosproject.net.flow.FlowRule; | 25 | import org.onosproject.net.flow.FlowRule; |
| 25 | -import org.onosproject.net.flow.FlowRuleBatchOperation; | ||
| 26 | import org.onosproject.net.flow.FlowRuleListener; | 26 | import org.onosproject.net.flow.FlowRuleListener; |
| 27 | import org.onosproject.net.flow.FlowRuleOperations; | 27 | import org.onosproject.net.flow.FlowRuleOperations; |
| 28 | import org.onosproject.net.flow.FlowRuleService; | 28 | import org.onosproject.net.flow.FlowRuleService; |
| 29 | 29 | ||
| 30 | -import java.util.Set; | 30 | +import com.google.common.collect.Sets; |
| 31 | -import java.util.concurrent.Future; | ||
| 32 | -import java.util.stream.Collectors; | ||
| 33 | 31 | ||
| 34 | 32 | ||
| 35 | public class MockFlowRuleService implements FlowRuleService { | 33 | public class MockFlowRuleService implements FlowRuleService { |
| ... | @@ -42,11 +40,6 @@ public class MockFlowRuleService implements FlowRuleService { | ... | @@ -42,11 +40,6 @@ public class MockFlowRuleService implements FlowRuleService { |
| 42 | } | 40 | } |
| 43 | 41 | ||
| 44 | @Override | 42 | @Override |
| 45 | - public Future<CompletedBatchOperation> applyBatch(FlowRuleBatchOperation batch) { | ||
| 46 | - throw new UnsupportedOperationException("deprecated"); | ||
| 47 | - } | ||
| 48 | - | ||
| 49 | - @Override | ||
| 50 | public void apply(FlowRuleOperations ops) { | 43 | public void apply(FlowRuleOperations ops) { |
| 51 | ops.stages().forEach(stage -> stage.forEach(flow -> { | 44 | ops.stages().forEach(stage -> stage.forEach(flow -> { |
| 52 | switch (flow.type()) { | 45 | switch (flow.type()) { | ... | ... |
-
Please register or login to post a comment