Merge "Rework bit-copying functions and re-enable tests"
[openflowplugin.git] / openflowplugin-impl / src / main / java / org / opendaylight / openflowplugin / impl / services / singlelayer / SingleLayerAggregateFlowMultipartService.java
index aa36d96cb494c9e7f19ea3cf8944e4a82a5af589..cb24aa446b555999001d096a104bb614c6306fe4 100644 (file)
@@ -10,7 +10,8 @@ package org.opendaylight.openflowplugin.impl.services.singlelayer;
 
 import com.google.common.base.Preconditions;
 import com.google.common.util.concurrent.Futures;
-import java.util.concurrent.Future;
+import com.google.common.util.concurrent.ListenableFuture;
+import com.google.common.util.concurrent.MoreExecutors;
 import java.util.stream.Collectors;
 import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
 import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
@@ -23,6 +24,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.G
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.get.aggregate.flow.statistics.from.flow.table._for.given.match.output.AggregatedFlowStatisticsBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.multipart.reply.multipart.reply.body.MultipartReplyFlowAggregateStats;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.multipart.request.multipart.request.body.MultipartRequestFlowAggregateStatsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.multipart.request.multipart.request.body.multipart.request.flow.aggregate.stats.FlowAggregateStatsBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.MultipartReply;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.MultipartRequestBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;
@@ -45,13 +47,13 @@ public class SingleLayerAggregateFlowMultipartService
                 .setXid(xid.getValue())
                 .setVersion(getVersion())
                 .setRequestMore(false)
-                .setMultipartRequestBody(new MultipartRequestFlowAggregateStatsBuilder(input)
-                        .build())
+                .setMultipartRequestBody(new MultipartRequestFlowAggregateStatsBuilder()
+                    .setFlowAggregateStats(new FlowAggregateStatsBuilder(input).build()).build())
                 .build();
     }
 
     @Override
-    public Future<RpcResult<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput>> handleAndReply(
+    public ListenableFuture<RpcResult<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput>> handleAndReply(
             final GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput input) {
         return Futures.transform(handleServiceCall(input), result -> {
             if (Preconditions.checkNotNull(result).isSuccessful()) {
@@ -64,8 +66,7 @@ public class SingleLayerAggregateFlowMultipartService
                                         .filter(MultipartReplyFlowAggregateStats.class::isInstance)
                                         .map(multipartReplyBody ->
                                                 new AggregatedFlowStatisticsBuilder(
-                                                        MultipartReplyFlowAggregateStats.class
-                                                        .cast(multipartReplyBody))
+                                                    (MultipartReplyFlowAggregateStats) multipartReplyBody)
                                                         .build())
                                         .collect(Collectors.toList())))
                         .build();
@@ -75,6 +76,6 @@ public class SingleLayerAggregateFlowMultipartService
                     .<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput>failed()
                     .withRpcErrors(result.getErrors())
                     .build();
-        });
+        }, MoreExecutors.directExecutor());
     }
 }