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;
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;
.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()) {
.filter(MultipartReplyFlowAggregateStats.class::isInstance)
.map(multipartReplyBody ->
new AggregatedFlowStatisticsBuilder(
- MultipartReplyFlowAggregateStats.class
- .cast(multipartReplyBody))
+ (MultipartReplyFlowAggregateStats) multipartReplyBody)
.build())
.collect(Collectors.toList())))
.build();
.<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput>failed()
.withRpcErrors(result.getErrors())
.build();
- });
+ }, MoreExecutors.directExecutor());
}
}