Fix for openflow devices not connecting to controller
[openflowplugin.git] / openflowplugin-impl / src / main / java / org / opendaylight / openflowplugin / impl / services / sal / SalFlowsBatchServiceImpl.java
index 5c8e61848df24b5958119a2f8fc5c6b01300b99b..40245358f9c699cbab511fa87b06edc919d549ce 100644 (file)
@@ -9,7 +9,6 @@ package org.opendaylight.openflowplugin.impl.services.sal;
 
 import com.google.common.base.Preconditions;
 import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.JdkFutureAdapters;
 import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.MoreExecutors;
 import java.util.ArrayList;
@@ -71,17 +70,17 @@ public class SalFlowsBatchServiceImpl implements SalFlowsBatchService {
                   PathUtil.extractNodeId(input.getNode()),
                   input.getBatchRemoveFlows().size());
         final ArrayList<ListenableFuture<RpcResult<RemoveFlowOutput>>> resultsLot = new ArrayList<>();
-        for (BatchFlowInputGrouping batchFlow : input.getBatchRemoveFlows()) {
+        for (BatchFlowInputGrouping batchFlow : input.nonnullBatchRemoveFlows().values()) {
             final RemoveFlowInput removeFlowInput = new RemoveFlowInputBuilder(batchFlow)
                     .setFlowRef(createFlowRef(input.getNode(), batchFlow))
                     .setNode(input.getNode())
                     .build();
-            resultsLot.add(JdkFutureAdapters.listenInPoolThread(salFlowService.removeFlow(removeFlowInput)));
+            resultsLot.add(salFlowService.removeFlow(removeFlowInput));
         }
 
         final ListenableFuture<RpcResult<List<BatchFailedFlowsOutput>>> commonResult =
                 Futures.transform(Futures.successfulAsList(resultsLot),
-                        FlowUtil.createCumulatingFunction(input.getBatchRemoveFlows()),
+                        FlowUtil.createCumulatingFunction(input.nonnullBatchRemoveFlows().values()),
                         MoreExecutors.directExecutor());
 
         ListenableFuture<RpcResult<RemoveFlowsBatchOutput>> removeFlowsBulkFuture =
@@ -99,17 +98,17 @@ public class SalFlowsBatchServiceImpl implements SalFlowsBatchService {
     public ListenableFuture<RpcResult<AddFlowsBatchOutput>> addFlowsBatch(final AddFlowsBatchInput input) {
         LOG.trace("Adding flows @ {} : {}", PathUtil.extractNodeId(input.getNode()), input.getBatchAddFlows().size());
         final ArrayList<ListenableFuture<RpcResult<AddFlowOutput>>> resultsLot = new ArrayList<>();
-        for (BatchFlowInputGrouping batchFlow : input.getBatchAddFlows()) {
+        for (BatchFlowInputGrouping batchFlow : input.nonnullBatchAddFlows().values()) {
             final AddFlowInput addFlowInput = new AddFlowInputBuilder(batchFlow)
                     .setFlowRef(createFlowRef(input.getNode(), batchFlow))
                     .setNode(input.getNode())
                     .build();
-            resultsLot.add(JdkFutureAdapters.listenInPoolThread(salFlowService.addFlow(addFlowInput)));
+            resultsLot.add(salFlowService.addFlow(addFlowInput));
         }
 
         final ListenableFuture<RpcResult<List<BatchFailedFlowsOutput>>> commonResult =
                 Futures.transform(Futures.successfulAsList(resultsLot),
-                        FlowUtil.createCumulatingFunction(input.getBatchAddFlows()),
+                        FlowUtil.createCumulatingFunction(input.nonnullBatchAddFlows().values()),
                         MoreExecutors.directExecutor());
 
         ListenableFuture<RpcResult<AddFlowsBatchOutput>> addFlowsBulkFuture =
@@ -139,19 +138,19 @@ public class SalFlowsBatchServiceImpl implements SalFlowsBatchService {
                   PathUtil.extractNodeId(input.getNode()),
                   input.getBatchUpdateFlows().size());
         final ArrayList<ListenableFuture<RpcResult<UpdateFlowOutput>>> resultsLot = new ArrayList<>();
-        for (BatchUpdateFlows batchFlow : input.getBatchUpdateFlows()) {
+        for (BatchUpdateFlows batchFlow : input.nonnullBatchUpdateFlows().values()) {
             final UpdateFlowInput updateFlowInput = new UpdateFlowInputBuilder(input)
                     .setOriginalFlow(new OriginalFlowBuilder(batchFlow.getOriginalBatchedFlow()).build())
                     .setUpdatedFlow(new UpdatedFlowBuilder(batchFlow.getUpdatedBatchedFlow()).build())
                     .setFlowRef(createFlowRef(input.getNode(), batchFlow))
                     .setNode(input.getNode())
                     .build();
-            resultsLot.add(JdkFutureAdapters.listenInPoolThread(salFlowService.updateFlow(updateFlowInput)));
+            resultsLot.add(salFlowService.updateFlow(updateFlowInput));
         }
 
         final ListenableFuture<RpcResult<List<BatchFailedFlowsOutput>>> commonResult =
                 Futures.transform(Futures.successfulAsList(resultsLot),
-                                  FlowUtil.createCumulatingFunction(input.getBatchUpdateFlows()),
+                                  FlowUtil.createCumulatingFunction(input.nonnullBatchUpdateFlows().values()),
                         MoreExecutors.directExecutor());
 
         ListenableFuture<RpcResult<UpdateFlowsBatchOutput>> updateFlowsBulkFuture =