Fixup Augmentable and Identifiable methods changing
[openflowplugin.git] / openflowplugin-impl / src / main / java / org / opendaylight / openflowplugin / impl / statistics / services / direct / singlelayer / FlowDirectStatisticsService.java
index e2e47bed5bdcd13c537e00b5661f33ef64e40ad7..e761e829d4e32e04f118a8bec478cece569cdc74 100644 (file)
@@ -12,16 +12,22 @@ import java.util.List;
 import java.util.stream.Collectors;
 import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
 import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
+import org.opendaylight.openflowplugin.api.openflow.device.Xid;
 import org.opendaylight.openflowplugin.impl.datastore.MultipartWriterProvider;
+import org.opendaylight.openflowplugin.impl.services.util.ServiceException;
 import org.opendaylight.openflowplugin.impl.statistics.services.direct.AbstractFlowDirectStatisticsService;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.GetFlowStatisticsInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.GetFlowStatisticsOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.GetFlowStatisticsOutputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.FlowId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.flow.and.statistics.map.list.FlowAndStatisticsMapListBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.flow.and.statistics.map.list.FlowAndStatisticsMapListKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.multipart.reply.multipart.reply.body.MultipartReplyFlowStats;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.multipart.request.multipart.request.body.MultipartRequestFlowStatsBuilder;
 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;
 
 public class FlowDirectStatisticsService extends AbstractFlowDirectStatisticsService<MultipartReply> {
 
@@ -29,7 +35,8 @@ public class FlowDirectStatisticsService extends AbstractFlowDirectStatisticsSer
                                        final DeviceContext deviceContext,
                                        final ConvertorExecutor convertorExecutor,
                                        final MultipartWriterProvider statisticsWriterProvider) {
-        super(requestContextStack, deviceContext, convertorExecutor, statisticsWriterProvider);    }
+        super(requestContextStack, deviceContext, convertorExecutor, statisticsWriterProvider);
+    }
 
     @Override
     protected GetFlowStatisticsOutput buildReply(List<MultipartReply> input, boolean success) {
@@ -43,7 +50,7 @@ public class FlowDirectStatisticsService extends AbstractFlowDirectStatisticsSer
                 .map(flowAndStatisticsMapList -> {
                     final FlowId flowId = new FlowId(generateFlowId(flowAndStatisticsMapList));
                     return new FlowAndStatisticsMapListBuilder(flowAndStatisticsMapList)
-                        .setKey(new FlowAndStatisticsMapListKey(flowId))
+                        .withKey(new FlowAndStatisticsMapListKey(flowId))
                         .setFlowId(flowId)
                         .build();
                 })
@@ -51,4 +58,15 @@ public class FlowDirectStatisticsService extends AbstractFlowDirectStatisticsSer
             .build();
     }
 
+    @Override
+    protected OfHeader buildRequest(final Xid xid, final GetFlowStatisticsInput input) throws ServiceException {
+        return new MultipartRequestBuilder()
+            .setXid(xid.getValue())
+            .setVersion(getVersion())
+            .setRequestMore(false)
+            .setMultipartRequestBody(new MultipartRequestFlowStatsBuilder(input)
+                .build())
+            .build();
+    }
+
 }