Use ByteBuf.readRetainedSlice()
[openflowplugin.git] / openflowplugin-impl / src / main / java / org / opendaylight / openflowplugin / impl / statistics / services / FlowsInTableService.java
index db676154cfd8cf846f7331f0537e6e377592ac49..9421879abb3fa43f8dca90c98bcbd4f1715100c1 100644 (file)
@@ -1,4 +1,4 @@
-/**
+/*
  * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
@@ -15,7 +15,6 @@ 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.services.util.RequestInputUtils;
-import org.opendaylight.openflowplugin.impl.services.util.ServiceException;
 import org.opendaylight.openflowplugin.impl.statistics.services.compatibility.AbstractCompatibleStatService;
 import org.opendaylight.openflowplugin.impl.statistics.services.compatibility.FlowStatisticsToNotificationTransformer;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
@@ -32,6 +31,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestFlowCaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.flow._case.MultipartRequestFlowBuilder;
+import org.opendaylight.yangtools.yang.common.Uint32;
 
 public final class FlowsInTableService extends AbstractCompatibleStatService<GetFlowStatisticsFromFlowTableInput,
         GetFlowStatisticsFromFlowTableOutput, FlowsStatisticsUpdate> {
@@ -41,8 +41,8 @@ public final class FlowsInTableService extends AbstractCompatibleStatService<Get
 
     public FlowsInTableService(final RequestContextStack requestContextStack,
                                final DeviceContext deviceContext,
-                               AtomicLong compatibilityXidSeed,
-                               ConvertorExecutor convertorExecutor) {
+                               final AtomicLong compatibilityXidSeed,
+                               final ConvertorExecutor convertorExecutor) {
         super(requestContextStack, deviceContext, compatibilityXidSeed);
         this.convertorExecutor = convertorExecutor;
         this.data = new VersionConvertorData(getVersion());
@@ -50,7 +50,7 @@ public final class FlowsInTableService extends AbstractCompatibleStatService<Get
 
     @Override
     protected OfHeader buildRequest(final Xid xid,
-                                    final GetFlowStatisticsFromFlowTableInput input) throws ServiceException {
+                                    final GetFlowStatisticsFromFlowTableInput input) {
         final MultipartRequestFlowCaseBuilder multipartRequestFlowCaseBuilder = new MultipartRequestFlowCaseBuilder();
         final MultipartRequestFlowBuilder mprFlowRequestBuilder = new MultipartRequestFlowBuilder();
 
@@ -61,7 +61,7 @@ public final class FlowsInTableService extends AbstractCompatibleStatService<Get
         }
 
         if (input.getOutPort() != null) {
-            mprFlowRequestBuilder.setOutPort(input.getOutPort().longValue());
+            mprFlowRequestBuilder.setOutPort(Uint32.valueOf(input.getOutPort().longValue()));
         } else {
             mprFlowRequestBuilder.setOutPort(OFConstants.OFPP_ANY);
         }
@@ -98,12 +98,13 @@ public final class FlowsInTableService extends AbstractCompatibleStatService<Get
     }
 
     @Override
-    public GetFlowStatisticsFromFlowTableOutput buildTxCapableResult(TransactionId emulatedTxId) {
+    public GetFlowStatisticsFromFlowTableOutput buildTxCapableResult(final TransactionId emulatedTxId) {
         return new GetFlowStatisticsFromFlowTableOutputBuilder().setTransactionId(emulatedTxId).build();
     }
 
     @Override
-    public FlowsStatisticsUpdate transformToNotification(List<MultipartReply> result, TransactionId emulatedTxId) {
+    public FlowsStatisticsUpdate transformToNotification(final List<MultipartReply> result,
+            final TransactionId emulatedTxId) {
         return FlowStatisticsToNotificationTransformer.transformToNotification(result,
                                                                                getDeviceInfo(),
                                                                                getOfVersion(),