statistics related services moved to separate package 51/17551/1
authorMartin Bobak <mbobak@cisco.com>
Wed, 1 Apr 2015 14:26:57 +0000 (16:26 +0200)
committerMartin Bobak <mbobak@cisco.com>
Wed, 1 Apr 2015 14:28:41 +0000 (16:28 +0200)
- statistics related services are not exposed for MD-SAl

Change-Id: Id4c94fea6bad7d68ac095944f0d836e8fc2329b2
Signed-off-by: Martin Bobak <mbobak@cisco.com>
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/OpendaylightMeterStatisticsServiceImpl.java [deleted file]
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/OpendaylightPortStatisticsServiceImpl.java [deleted file]
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/RequestContextUtil.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/services/OpendaylightFlowStatisticsServiceImpl.java [moved from openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/OpendaylightFlowStatisticsServiceImpl.java with 92% similarity]
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/services/OpendaylightFlowTableStatisticsServiceImpl.java [moved from openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/OpendaylightFlowTableStatisticsServiceImpl.java with 82% similarity]
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/services/OpendaylightGroupStatisticsServiceImpl.java [moved from openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/OpendaylightGroupStatisticsServiceImpl.java with 90% similarity]
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/services/OpendaylightMeterStatisticsServiceImpl.java [new file with mode: 0644]
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/services/OpendaylightPortStatisticsServiceImpl.java [new file with mode: 0644]
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/services/OpendaylightQueueStatisticsServiceImpl.java [moved from openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/OpendaylightQueueStatisticsServiceImpl.java with 88% similarity]
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/util/MdSalRegistratorUtils.java

diff --git a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/OpendaylightMeterStatisticsServiceImpl.java b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/OpendaylightMeterStatisticsServiceImpl.java
deleted file mode 100644 (file)
index 9ef1a33..0000000
+++ /dev/null
@@ -1,166 +0,0 @@
-/**
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.openflowplugin.impl.services;
-
-import com.google.common.base.Function;
-import com.google.common.util.concurrent.JdkFutureAdapters;
-import com.google.common.util.concurrent.ListenableFuture;
-import com.google.common.util.concurrent.SettableFuture;
-import org.opendaylight.openflowjava.protocol.api.util.BinContent;
-import org.opendaylight.openflowplugin.api.openflow.device.RequestContext;
-import org.opendaylight.openflowplugin.api.openflow.device.Xid;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetAllMeterConfigStatisticsInput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetAllMeterConfigStatisticsOutput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetAllMeterStatisticsInput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetAllMeterStatisticsOutput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetMeterFeaturesInput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetMeterFeaturesOutput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetMeterStatisticsInput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetMeterStatisticsOutput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.OpendaylightMeterStatisticsService;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MeterId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestMeterCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestMeterConfigCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestMeterFeaturesCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.meter._case.MultipartRequestMeterBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.meter.config._case.MultipartRequestMeterConfigBuilder;
-import org.opendaylight.yangtools.yang.common.RpcResult;
-import java.util.concurrent.Future;
-
-/**
- * @author joe
- */
-public class OpendaylightMeterStatisticsServiceImpl extends CommonService implements OpendaylightMeterStatisticsService {
-
-
-    @Override
-    public Future<RpcResult<GetAllMeterConfigStatisticsOutput>> getAllMeterConfigStatistics(
-            final GetAllMeterConfigStatisticsInput input) {
-        return this
-                .<GetAllMeterConfigStatisticsOutput, Void> handleServiceCall(
-                        PRIMARY_CONNECTION,  new Function<DataCrate<GetAllMeterConfigStatisticsOutput>, Future<RpcResult<Void>>>() {
-
-                    @Override
-                    public Future<RpcResult<Void>> apply(final DataCrate<GetAllMeterConfigStatisticsOutput> data) {
-
-                        MultipartRequestMeterConfigCaseBuilder caseBuilder =
-                                new MultipartRequestMeterConfigCaseBuilder();
-                        MultipartRequestMeterConfigBuilder mprMeterConfigBuild =
-                                new MultipartRequestMeterConfigBuilder();
-                        mprMeterConfigBuild.setMeterId(new MeterId(BinContent.intToUnsignedLong(
-                                org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common
-                                .types.rev130731.Meter.OFPMALL.getIntValue())));
-                        caseBuilder.setMultipartRequestMeterConfig(mprMeterConfigBuild.build());
-
-                        final Xid xid = deviceContext.getNextXid();
-                        data.getRequestContext().setXid(xid);
-                        MultipartRequestInputBuilder mprInput = RequestInputUtils
-                                .createMultipartHeader(MultipartType.OFPMPMETERCONFIG, xid.getValue(), version);
-                        mprInput.setMultipartRequestBody(caseBuilder.build());
-                        Future<RpcResult<Void>> resultFromOFLib = deviceContext
-                                .getPrimaryConnectionContext().getConnectionAdapter().multipartRequest(mprInput.build());
-                        return JdkFutureAdapters
-                                .listenInPoolThread(resultFromOFLib);
-                    }});
-
-    }
-
-    @Override
-    public Future<RpcResult<GetAllMeterStatisticsOutput>> getAllMeterStatistics(final GetAllMeterStatisticsInput input) {
-        final RequestContext<GetAllMeterStatisticsOutput> requestContext = requestContextStack.createRequestContext();
-        final SettableFuture<RpcResult<GetAllMeterStatisticsOutput>> result = requestContextStack.storeOrFail(requestContext);
-
-        if (!result.isDone()) {
-
-            final Xid xid = deviceContext.getNextXid();
-
-            MultipartRequestMeterCaseBuilder caseBuilder =
-                    new MultipartRequestMeterCaseBuilder();
-            MultipartRequestMeterBuilder mprMeterBuild =
-                    new MultipartRequestMeterBuilder();
-            mprMeterBuild.setMeterId(new MeterId(BinContent.intToUnsignedLong(
-                    org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common
-                            .types.rev130731.Meter.OFPMALL.getIntValue())));
-            caseBuilder.setMultipartRequestMeter(mprMeterBuild.build());
-
-            MultipartRequestInputBuilder mprInput = RequestInputUtils
-                    .createMultipartHeader(MultipartType.OFPMPMETER, xid.getValue(), version);
-            mprInput.setMultipartRequestBody(caseBuilder.build());
-            Future<RpcResult<Void>> resultFromOFLib = deviceContext.getPrimaryConnectionContext()
-                    .getConnectionAdapter().multipartRequest(mprInput.build());
-
-            ListenableFuture<RpcResult<Void>> futureResultFromOfLib = JdkFutureAdapters.listenInPoolThread(resultFromOFLib);
-
-            final RpcResultConvertor<GetAllMeterStatisticsOutput> rpcResultConvertor = new RpcResultConvertor<>(requestContext, deviceContext);
-            rpcResultConvertor.processResultFromOfJava(futureResultFromOfLib);
-        } else {
-            RequestContextUtil.closeRequstContext(requestContext);
-        }
-        return result;
-    }
-
-    @Override
-    public Future<RpcResult<GetMeterFeaturesOutput>> getMeterFeatures(final GetMeterFeaturesInput input) {
-        final RequestContext requestContext = requestContextStack.createRequestContext();
-        final SettableFuture<RpcResult<GetMeterFeaturesOutput>> result = requestContextStack.storeOrFail(requestContext);
-
-        if (!result.isDone()) {
-
-            final Xid xid = deviceContext.getNextXid();
-
-            MultipartRequestMeterFeaturesCaseBuilder mprMeterFeaturesBuild =
-                    new MultipartRequestMeterFeaturesCaseBuilder();
-
-            MultipartRequestInputBuilder mprInput =
-                    RequestInputUtils.createMultipartHeader(MultipartType.OFPMPMETERFEATURES, xid.getValue(), version);
-            mprInput.setMultipartRequestBody(mprMeterFeaturesBuild.build());
-            Future<RpcResult<Void>> resultFromOFLib = deviceContext.getPrimaryConnectionContext().getConnectionAdapter().multipartRequest(mprInput.build());
-            ListenableFuture<RpcResult<Void>> futureResultFromOfLib = JdkFutureAdapters.listenInPoolThread(resultFromOFLib);
-
-            final RpcResultConvertor<GetMeterFeaturesOutput> rpcResultConvertor = new RpcResultConvertor<>(requestContext, deviceContext);
-            rpcResultConvertor.processResultFromOfJava(futureResultFromOfLib);
-        } else {
-            RequestContextUtil.closeRequstContext(requestContext);
-        }
-        return result;
-    }
-
-    @Override
-    public Future<RpcResult<GetMeterStatisticsOutput>> getMeterStatistics(final GetMeterStatisticsInput input) {
-        final RequestContext requestContext = requestContextStack.createRequestContext();
-        final SettableFuture<RpcResult<GetMeterStatisticsOutput>> result = requestContextStack.storeOrFail(requestContext);
-
-        if (!result.isDone()) {
-
-            final Xid xid = deviceContext.getNextXid();
-
-            MultipartRequestMeterCaseBuilder caseBuilder =
-                    new MultipartRequestMeterCaseBuilder();
-            MultipartRequestMeterBuilder mprMeterBuild =
-                    new MultipartRequestMeterBuilder();
-            mprMeterBuild.setMeterId(new MeterId(input.getMeterId().getValue()));
-            caseBuilder.setMultipartRequestMeter(mprMeterBuild.build());
-
-            MultipartRequestInputBuilder mprInput =
-                    RequestInputUtils.createMultipartHeader(MultipartType.OFPMPMETER, xid.getValue(), version);
-            mprInput.setMultipartRequestBody(caseBuilder.build());
-            Future<RpcResult<Void>> resultFromOFLib = deviceContext.getPrimaryConnectionContext().getConnectionAdapter().multipartRequest(mprInput.build());
-            ListenableFuture<RpcResult<Void>> futureResultFromOfLib = JdkFutureAdapters.listenInPoolThread(resultFromOFLib);
-
-            final RpcResultConvertor<GetMeterStatisticsOutput> rpcResultConvertor = new RpcResultConvertor<>(requestContext, deviceContext);
-            rpcResultConvertor.processResultFromOfJava(futureResultFromOfLib);
-
-        } else {
-            RequestContextUtil.closeRequstContext(requestContext);
-        }
-        return result;
-    }
-
-}
diff --git a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/OpendaylightPortStatisticsServiceImpl.java b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/OpendaylightPortStatisticsServiceImpl.java
deleted file mode 100644 (file)
index db51b9c..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-/**
- * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.openflowplugin.impl.services;
-
-import com.google.common.base.Function;
-import com.google.common.util.concurrent.JdkFutureAdapters;
-import org.opendaylight.openflowplugin.api.OFConstants;
-import org.opendaylight.openflowplugin.api.openflow.device.Xid;
-import org.opendaylight.openflowplugin.api.openflow.md.util.OpenflowVersion;
-import org.opendaylight.openflowplugin.openflow.md.util.InventoryDataServiceUtil;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestPortStatsCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.port.stats._case.MultipartRequestPortStatsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.GetAllNodeConnectorsStatisticsInput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.GetAllNodeConnectorsStatisticsOutput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.GetNodeConnectorStatisticsInput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.GetNodeConnectorStatisticsOutput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.OpendaylightPortStatisticsService;
-import org.opendaylight.yangtools.yang.common.RpcResult;
-import java.util.concurrent.Future;
-
-/**
- * @author joe
- */
-public class OpendaylightPortStatisticsServiceImpl extends CommonService implements OpendaylightPortStatisticsService {
-
-    @Override
-    public Future<RpcResult<GetAllNodeConnectorsStatisticsOutput>> getAllNodeConnectorsStatistics(
-            final GetAllNodeConnectorsStatisticsInput input) {
-        return this
-                .<GetAllNodeConnectorsStatisticsOutput, Void> handleServiceCall(
-                        PRIMARY_CONNECTION,  new Function<DataCrate<GetAllNodeConnectorsStatisticsOutput>, Future<RpcResult<Void>>>() {
-
-                    @Override
-                    public Future<RpcResult<Void>> apply(final DataCrate<GetAllNodeConnectorsStatisticsOutput> data) {
-
-                        MultipartRequestPortStatsCaseBuilder caseBuilder =
-                                new MultipartRequestPortStatsCaseBuilder();
-                        MultipartRequestPortStatsBuilder mprPortStatsBuilder =
-                                new MultipartRequestPortStatsBuilder();
-                        // Select all ports
-                        mprPortStatsBuilder.setPortNo(OFConstants.OFPP_ANY);
-                        caseBuilder.setMultipartRequestPortStats(mprPortStatsBuilder.build());
-
-                        final Xid xid = deviceContext.getNextXid();
-                        data.getRequestContext().setXid(xid);
-                        MultipartRequestInputBuilder mprInput = RequestInputUtils
-                                .createMultipartHeader(MultipartType.OFPMPPORTSTATS, xid.getValue(), version);
-                        mprInput.setMultipartRequestBody(caseBuilder.build());
-                        Future<RpcResult<Void>> resultFromOFLib = deviceContext
-                                .getPrimaryConnectionContext().getConnectionAdapter().multipartRequest(mprInput.build());
-                        return JdkFutureAdapters.listenInPoolThread(resultFromOFLib);
-                    }});
-    }
-
-    @Override
-    public Future<RpcResult<GetNodeConnectorStatisticsOutput>> getNodeConnectorStatistics(
-            final GetNodeConnectorStatisticsInput input) {
-        return this
-                .<GetNodeConnectorStatisticsOutput, Void> handleServiceCall(
-                        PRIMARY_CONNECTION,  new Function<DataCrate<GetNodeConnectorStatisticsOutput>, Future<RpcResult<Void>>>() {
-
-                    @Override
-                    public Future<RpcResult<Void>> apply(final DataCrate<GetNodeConnectorStatisticsOutput> data) {
-
-                        MultipartRequestPortStatsCaseBuilder caseBuilder =
-                                new MultipartRequestPortStatsCaseBuilder();
-                        MultipartRequestPortStatsBuilder mprPortStatsBuilder =
-                                new MultipartRequestPortStatsBuilder();
-                        // Set specific port
-                        mprPortStatsBuilder
-                        .setPortNo(InventoryDataServiceUtil.portNumberfromNodeConnectorId(
-                                OpenflowVersion.get(version),
-                                input.getNodeConnectorId()));
-                        caseBuilder.setMultipartRequestPortStats(mprPortStatsBuilder.build());
-
-                        final Xid xid = deviceContext.getNextXid();
-                        data.getRequestContext().setXid(xid);
-                        MultipartRequestInputBuilder mprInput = RequestInputUtils
-                                .createMultipartHeader(MultipartType.OFPMPPORTSTATS, xid.getValue(), version);
-                        mprInput.setMultipartRequestBody(caseBuilder.build());
-                        Future<RpcResult<Void>> resultFromOFLib = deviceContext.getPrimaryConnectionContext()
-                                .getConnectionAdapter().multipartRequest(mprInput.build());
-                        return JdkFutureAdapters.listenInPoolThread(resultFromOFLib);
-                    }});
-
-    }
-
-}
index ee752c9564bd6866b0e693ab40572dd9335259ec..9c54e4520f7ecb9858c991d27aed10d44d7d0532 100644 (file)
@@ -20,7 +20,7 @@ public final class RequestContextUtil {
     }
 
 
-    static void closeRequstContext(final RequestContext<?> requestContext) {
+    public static void closeRequstContext(final RequestContext<?> requestContext) {
         try {
             requestContext.close();
         } catch (Exception e) {
@@ -5,16 +5,20 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.openflowplugin.impl.services;
+package org.opendaylight.openflowplugin.impl.statistics.services;
 
 import com.google.common.base.Function;
-import org.opendaylight.yangtools.yang.binding.DataObject;
 import com.google.common.util.concurrent.JdkFutureAdapters;
 import com.google.common.util.concurrent.ListenableFuture;
-import java.util.concurrent.Future;
 import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
 import org.opendaylight.openflowplugin.api.openflow.device.RequestContext;
+import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
 import org.opendaylight.openflowplugin.api.openflow.device.Xid;
+import org.opendaylight.openflowplugin.impl.services.CommonService;
+import org.opendaylight.openflowplugin.impl.services.DataCrate;
+import org.opendaylight.openflowplugin.impl.services.RequestInputUtils;
+import org.opendaylight.openflowplugin.impl.services.RpcResultConvertor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.MatchReactor;
 import org.opendaylight.openflowplugin.openflow.md.util.FlowCreatorUtil;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForAllFlowsInput;
@@ -34,9 +38,11 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731
 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.aggregate._case.MultipartRequestAggregateBuilder;
 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.binding.DataObject;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import java.util.concurrent.Future;
 
 /**
  * @author joe
@@ -45,12 +51,18 @@ public class OpendaylightFlowStatisticsServiceImpl extends CommonService impleme
 
     private static final Logger LOG = LoggerFactory.getLogger(OpendaylightFlowStatisticsServiceImpl.class);
 
+    public OpendaylightFlowStatisticsServiceImpl(final RequestContextStack requestContextStack, DeviceContext deviceContext) {
+        super(requestContextStack, deviceContext);
+    }
+
     @Override
     public Future<RpcResult<GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput>> getAggregateFlowStatisticsFromFlowTableForAllFlows(
             final GetAggregateFlowStatisticsFromFlowTableForAllFlowsInput input) {
 
-        return this.<GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput, Void> handleServiceCall(
-                PRIMARY_CONNECTION, new Function<DataCrate<GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput>, Future<RpcResult<Void>>>() {
+
+        return this.<GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput, Void>handleServiceCall(
+                PRIMARY_CONNECTION,
+                new Function<DataCrate<GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput>, Future<RpcResult<Void>>>() {
 
                     @Override
                     public Future<RpcResult<Void>> apply(final DataCrate<GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput> data) {
@@ -88,8 +100,11 @@ public class OpendaylightFlowStatisticsServiceImpl extends CommonService impleme
     @Override
     public Future<RpcResult<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput>> getAggregateFlowStatisticsFromFlowTableForGivenMatch(
             final GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput input) {
-        return this.<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput, Void> handleServiceCall(
-                PRIMARY_CONNECTION, new Function<DataCrate<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput>, Future<RpcResult<Void>>>() {
+
+
+        return this.<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput, Void>handleServiceCall(
+                PRIMARY_CONNECTION,
+                new Function<DataCrate<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput>, Future<RpcResult<Void>>>() {
 
                     @Override
                     public Future<RpcResult<Void>> apply(final DataCrate<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput> data) {
@@ -134,7 +149,8 @@ public class OpendaylightFlowStatisticsServiceImpl extends CommonService impleme
     @Override
     public Future<RpcResult<GetAllFlowStatisticsFromFlowTableOutput>> getAllFlowStatisticsFromFlowTable(
             final GetAllFlowStatisticsFromFlowTableInput input) {
-        return this.<GetAllFlowStatisticsFromFlowTableOutput, Void> handleServiceCall(PRIMARY_CONNECTION,
+
+        return this.<GetAllFlowStatisticsFromFlowTableOutput, Void>handleServiceCall(PRIMARY_CONNECTION,
                 new Function<DataCrate<GetAllFlowStatisticsFromFlowTableOutput>, Future<RpcResult<Void>>>() {
 
                     @Override
@@ -167,7 +183,9 @@ public class OpendaylightFlowStatisticsServiceImpl extends CommonService impleme
     @Override
     public Future<RpcResult<GetAllFlowsStatisticsFromAllFlowTablesOutput>> getAllFlowsStatisticsFromAllFlowTables(
             final GetAllFlowsStatisticsFromAllFlowTablesInput input) {
-        return this.<GetAllFlowsStatisticsFromAllFlowTablesOutput, Void> handleServiceCall(PRIMARY_CONNECTION,
+
+
+        return this.<GetAllFlowsStatisticsFromAllFlowTablesOutput, Void>handleServiceCall(PRIMARY_CONNECTION,
                 new Function<DataCrate<GetAllFlowsStatisticsFromAllFlowTablesOutput>, Future<RpcResult<Void>>>() {
 
                     @Override
@@ -199,7 +217,9 @@ public class OpendaylightFlowStatisticsServiceImpl extends CommonService impleme
     @Override
     public Future<RpcResult<GetFlowStatisticsFromFlowTableOutput>> getFlowStatisticsFromFlowTable(
             final GetFlowStatisticsFromFlowTableInput input) {
-        return this.<GetFlowStatisticsFromFlowTableOutput, Void> handleServiceCall(PRIMARY_CONNECTION,
+
+
+        return this.<GetFlowStatisticsFromFlowTableOutput, Void>handleServiceCall(PRIMARY_CONNECTION,
                 new Function<DataCrate<GetFlowStatisticsFromFlowTableOutput>, Future<RpcResult<Void>>>() {
 
                     @Override
@@ -252,7 +272,7 @@ public class OpendaylightFlowStatisticsServiceImpl extends CommonService impleme
     }
 
     private <T extends DataObject> void convertRpcResultToRequestFuture(final RequestContext<T> requestContext,
-            final ListenableFuture<RpcResult<Void>> futureResultFromOfLib) {
+                                                                        final ListenableFuture<RpcResult<Void>> futureResultFromOfLib) {
         final RpcResultConvertor<T> rpcResultConvertor = new RpcResultConvertor<>(requestContext, deviceContext);
         rpcResultConvertor.processResultFromOfJava(futureResultFromOfLib);
     }
@@ -5,12 +5,16 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.openflowplugin.impl.services;
+package org.opendaylight.openflowplugin.impl.statistics.services;
 
 import com.google.common.base.Function;
 import com.google.common.util.concurrent.JdkFutureAdapters;
-import java.util.concurrent.Future;
+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.CommonService;
+import org.opendaylight.openflowplugin.impl.services.DataCrate;
+import org.opendaylight.openflowplugin.impl.services.RequestInputUtils;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.GetFlowTablesStatisticsInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.GetFlowTablesStatisticsOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.OpendaylightFlowTableStatisticsService;
@@ -19,6 +23,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestTableCaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.table._case.MultipartRequestTableBuilder;
 import org.opendaylight.yangtools.yang.common.RpcResult;
+import java.util.concurrent.Future;
 
 /**
  * @author joe
@@ -26,10 +31,16 @@ import org.opendaylight.yangtools.yang.common.RpcResult;
 public class OpendaylightFlowTableStatisticsServiceImpl extends CommonService implements
         OpendaylightFlowTableStatisticsService {
 
+    public OpendaylightFlowTableStatisticsServiceImpl(final RequestContextStack requestContextStack, DeviceContext deviceContext) {
+        super(requestContextStack, deviceContext);
+    }
+
     @Override
     public Future<RpcResult<GetFlowTablesStatisticsOutput>> getFlowTablesStatistics(
             final GetFlowTablesStatisticsInput input) {
-        return this.<GetFlowTablesStatisticsOutput, Void> handleServiceCall(PRIMARY_CONNECTION,
+
+
+        return this.<GetFlowTablesStatisticsOutput, Void>handleServiceCall(PRIMARY_CONNECTION,
                 new Function<DataCrate<GetFlowTablesStatisticsOutput>, Future<RpcResult<Void>>>() {
 
                     @Override
@@ -5,13 +5,17 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.openflowplugin.impl.services;
+package org.opendaylight.openflowplugin.impl.statistics.services;
 
 import com.google.common.base.Function;
 import com.google.common.util.concurrent.JdkFutureAdapters;
-import java.util.concurrent.Future;
 import org.opendaylight.openflowjava.protocol.api.util.BinContent;
+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.CommonService;
+import org.opendaylight.openflowplugin.impl.services.DataCrate;
+import org.opendaylight.openflowplugin.impl.services.RequestInputUtils;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetAllGroupStatisticsInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetAllGroupStatisticsOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupDescriptionInput;
@@ -29,15 +33,23 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestGroupFeaturesCaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.group._case.MultipartRequestGroupBuilder;
 import org.opendaylight.yangtools.yang.common.RpcResult;
+import java.util.concurrent.Future;
 
 /**
  * @author joe
  */
 public class OpendaylightGroupStatisticsServiceImpl extends CommonService implements OpendaylightGroupStatisticsService {
 
+
+    public OpendaylightGroupStatisticsServiceImpl(final RequestContextStack requestContextStack, DeviceContext deviceContext) {
+        super(requestContextStack, deviceContext);
+    }
+
     @Override
     public Future<RpcResult<GetAllGroupStatisticsOutput>> getAllGroupStatistics(final GetAllGroupStatisticsInput input) {
-        return this.<GetAllGroupStatisticsOutput, Void> handleServiceCall(PRIMARY_CONNECTION,
+
+
+        return this.<GetAllGroupStatisticsOutput, Void>handleServiceCall(PRIMARY_CONNECTION,
                 new Function<DataCrate<GetAllGroupStatisticsOutput>, Future<RpcResult<Void>>>() {
 
                     @Override
@@ -72,7 +84,7 @@ public class OpendaylightGroupStatisticsServiceImpl extends CommonService implem
 
     @Override
     public Future<RpcResult<GetGroupDescriptionOutput>> getGroupDescription(final GetGroupDescriptionInput input) {
-        return this.<GetGroupDescriptionOutput, Void> handleServiceCall(PRIMARY_CONNECTION,
+        return this.<GetGroupDescriptionOutput, Void>handleServiceCall(PRIMARY_CONNECTION,
                 new Function<DataCrate<GetGroupDescriptionOutput>, Future<RpcResult<Void>>>() {
 
                     @Override
@@ -94,7 +106,7 @@ public class OpendaylightGroupStatisticsServiceImpl extends CommonService implem
 
     @Override
     public Future<RpcResult<GetGroupFeaturesOutput>> getGroupFeatures(final GetGroupFeaturesInput input) {
-        return this.<GetGroupFeaturesOutput, Void> handleServiceCall(PRIMARY_CONNECTION,
+        return this.<GetGroupFeaturesOutput, Void>handleServiceCall(PRIMARY_CONNECTION,
                 new Function<DataCrate<GetGroupFeaturesOutput>, Future<RpcResult<Void>>>() {
 
                     @Override
@@ -116,7 +128,7 @@ public class OpendaylightGroupStatisticsServiceImpl extends CommonService implem
 
     @Override
     public Future<RpcResult<GetGroupStatisticsOutput>> getGroupStatistics(final GetGroupStatisticsInput input) {
-        return this.<GetGroupStatisticsOutput, Void> handleServiceCall(PRIMARY_CONNECTION,
+        return this.<GetGroupStatisticsOutput, Void>handleServiceCall(PRIMARY_CONNECTION,
                 new Function<DataCrate<GetGroupStatisticsOutput>, Future<RpcResult<Void>>>() {
 
                     @Override
diff --git a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/services/OpendaylightMeterStatisticsServiceImpl.java b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/services/OpendaylightMeterStatisticsServiceImpl.java
new file mode 100644 (file)
index 0000000..8085378
--- /dev/null
@@ -0,0 +1,160 @@
+/**
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowplugin.impl.statistics.services;
+
+import com.google.common.base.Function;
+import com.google.common.util.concurrent.JdkFutureAdapters;
+import org.opendaylight.openflowjava.protocol.api.util.BinContent;
+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.CommonService;
+import org.opendaylight.openflowplugin.impl.services.DataCrate;
+import org.opendaylight.openflowplugin.impl.services.RequestInputUtils;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetAllMeterConfigStatisticsInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetAllMeterConfigStatisticsOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetAllMeterStatisticsInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetAllMeterStatisticsOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetMeterFeaturesInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetMeterFeaturesOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetMeterStatisticsInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetMeterStatisticsOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.OpendaylightMeterStatisticsService;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MeterId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestMeterCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestMeterConfigCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestMeterFeaturesCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.meter._case.MultipartRequestMeterBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.meter.config._case.MultipartRequestMeterConfigBuilder;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+import java.util.concurrent.Future;
+
+/**
+ * @author joe
+ */
+public class OpendaylightMeterStatisticsServiceImpl extends CommonService implements OpendaylightMeterStatisticsService {
+
+
+    public OpendaylightMeterStatisticsServiceImpl(final RequestContextStack requestContextStack, DeviceContext deviceContext) {
+        super(requestContextStack, deviceContext);
+    }
+
+    @Override
+    public Future<RpcResult<GetAllMeterConfigStatisticsOutput>> getAllMeterConfigStatistics(
+            final GetAllMeterConfigStatisticsInput input) {
+        return this
+                .<GetAllMeterConfigStatisticsOutput, Void>handleServiceCall(
+                        PRIMARY_CONNECTION, new Function<DataCrate<GetAllMeterConfigStatisticsOutput>, Future<RpcResult<Void>>>() {
+
+                            @Override
+                            public Future<RpcResult<Void>> apply(final DataCrate<GetAllMeterConfigStatisticsOutput> data) {
+
+                                MultipartRequestMeterConfigCaseBuilder caseBuilder =
+                                        new MultipartRequestMeterConfigCaseBuilder();
+                                MultipartRequestMeterConfigBuilder mprMeterConfigBuild =
+                                        new MultipartRequestMeterConfigBuilder();
+                                mprMeterConfigBuild.setMeterId(new MeterId(BinContent.intToUnsignedLong(
+                                        org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common
+                                                .types.rev130731.Meter.OFPMALL.getIntValue())));
+                                caseBuilder.setMultipartRequestMeterConfig(mprMeterConfigBuild.build());
+
+                                final Xid xid = deviceContext.getNextXid();
+                                data.getRequestContext().setXid(xid);
+                                MultipartRequestInputBuilder mprInput = RequestInputUtils
+                                        .createMultipartHeader(MultipartType.OFPMPMETERCONFIG, xid.getValue(), version);
+                                mprInput.setMultipartRequestBody(caseBuilder.build());
+                                Future<RpcResult<Void>> resultFromOFLib = deviceContext
+                                        .getPrimaryConnectionContext().getConnectionAdapter().multipartRequest(mprInput.build());
+                                return JdkFutureAdapters
+                                        .listenInPoolThread(resultFromOFLib);
+                            }
+                        });
+
+    }
+
+    @Override
+    public Future<RpcResult<GetAllMeterStatisticsOutput>> getAllMeterStatistics(final GetAllMeterStatisticsInput input) {
+
+        final long xid = deviceContext.getNextXid().getValue();
+        return this.<GetAllMeterStatisticsOutput, Void>handleServiceCall(
+                PRIMARY_CONNECTION,
+                new Function<DataCrate<GetAllMeterStatisticsOutput>, Future<RpcResult<Void>>>() {
+                    @Override
+                    public Future<RpcResult<Void>> apply(final DataCrate<GetAllMeterStatisticsOutput> data) {
+
+                        MultipartRequestMeterCaseBuilder caseBuilder =
+                                new MultipartRequestMeterCaseBuilder();
+                        MultipartRequestMeterBuilder mprMeterBuild =
+                                new MultipartRequestMeterBuilder();
+                        mprMeterBuild.setMeterId(new MeterId(BinContent.intToUnsignedLong(
+                                org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common
+                                        .types.rev130731.Meter.OFPMALL.getIntValue())));
+                        caseBuilder.setMultipartRequestMeter(mprMeterBuild.build());
+
+                        MultipartRequestInputBuilder mprInput = RequestInputUtils
+                                .createMultipartHeader(MultipartType.OFPMPMETER, xid, version);
+                        mprInput.setMultipartRequestBody(caseBuilder.build());
+                        Future<RpcResult<Void>> resultFromOFLib = deviceContext.getPrimaryConnectionContext()
+                                .getConnectionAdapter().multipartRequest(mprInput.build());
+
+                        return JdkFutureAdapters.listenInPoolThread(resultFromOFLib);
+                    }
+                }
+        );
+
+    }
+
+    @Override
+    public Future<RpcResult<GetMeterFeaturesOutput>> getMeterFeatures(final GetMeterFeaturesInput input) {
+        final long xid = deviceContext.getNextXid().getValue();
+        return this.<GetMeterFeaturesOutput, Void>handleServiceCall(
+                PRIMARY_CONNECTION,
+                new Function<DataCrate<GetMeterFeaturesOutput>, Future<RpcResult<Void>>>() {
+                    @Override
+                    public Future<RpcResult<Void>> apply(final DataCrate<GetMeterFeaturesOutput> data) {
+
+                        MultipartRequestMeterFeaturesCaseBuilder mprMeterFeaturesBuild =
+                                new MultipartRequestMeterFeaturesCaseBuilder();
+
+                        MultipartRequestInputBuilder mprInput =
+                                RequestInputUtils.createMultipartHeader(MultipartType.OFPMPMETERFEATURES, xid, version);
+                        mprInput.setMultipartRequestBody(mprMeterFeaturesBuild.build());
+                        Future<RpcResult<Void>> resultFromOFLib = deviceContext.getPrimaryConnectionContext().getConnectionAdapter().multipartRequest(mprInput.build());
+                        return JdkFutureAdapters.listenInPoolThread(resultFromOFLib);
+                    }
+                });
+    }
+
+    @Override
+    public Future<RpcResult<GetMeterStatisticsOutput>> getMeterStatistics(final GetMeterStatisticsInput input) {
+        final long xid = deviceContext.getNextXid().getValue();
+        return this.<GetMeterStatisticsOutput, Void>handleServiceCall(
+                PRIMARY_CONNECTION,
+                new Function<DataCrate<GetMeterStatisticsOutput>, Future<RpcResult<Void>>>() {
+                    @Override
+                    public Future<RpcResult<Void>> apply(final DataCrate<GetMeterStatisticsOutput> data) {
+                        MultipartRequestMeterCaseBuilder caseBuilder =
+                                new MultipartRequestMeterCaseBuilder();
+                        MultipartRequestMeterBuilder mprMeterBuild =
+                                new MultipartRequestMeterBuilder();
+                        mprMeterBuild.setMeterId(new MeterId(input.getMeterId().getValue()));
+                        caseBuilder.setMultipartRequestMeter(mprMeterBuild.build());
+
+                        MultipartRequestInputBuilder mprInput =
+                                RequestInputUtils.createMultipartHeader(MultipartType.OFPMPMETER, xid, version);
+                        mprInput.setMultipartRequestBody(caseBuilder.build());
+                        Future<RpcResult<Void>> resultFromOFLib = deviceContext.getPrimaryConnectionContext().getConnectionAdapter().multipartRequest(mprInput.build());
+                        return JdkFutureAdapters.listenInPoolThread(resultFromOFLib);
+                    }
+                });
+
+    }
+
+}
diff --git a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/services/OpendaylightPortStatisticsServiceImpl.java b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/services/OpendaylightPortStatisticsServiceImpl.java
new file mode 100644 (file)
index 0000000..31490df
--- /dev/null
@@ -0,0 +1,106 @@
+/**
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowplugin.impl.statistics.services;
+
+import com.google.common.base.Function;
+import com.google.common.util.concurrent.JdkFutureAdapters;
+import org.opendaylight.openflowplugin.api.OFConstants;
+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.api.openflow.md.util.OpenflowVersion;
+import org.opendaylight.openflowplugin.impl.services.CommonService;
+import org.opendaylight.openflowplugin.impl.services.DataCrate;
+import org.opendaylight.openflowplugin.impl.services.RequestInputUtils;
+import org.opendaylight.openflowplugin.openflow.md.util.InventoryDataServiceUtil;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestPortStatsCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.port.stats._case.MultipartRequestPortStatsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.GetAllNodeConnectorsStatisticsInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.GetAllNodeConnectorsStatisticsOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.GetNodeConnectorStatisticsInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.GetNodeConnectorStatisticsOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.OpendaylightPortStatisticsService;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+import java.util.concurrent.Future;
+
+/**
+ * @author joe
+ */
+public class OpendaylightPortStatisticsServiceImpl extends CommonService implements OpendaylightPortStatisticsService {
+
+    public OpendaylightPortStatisticsServiceImpl(final RequestContextStack requestContextStack, DeviceContext deviceContext) {
+        super(requestContextStack, deviceContext);
+    }
+
+    @Override
+    public Future<RpcResult<GetAllNodeConnectorsStatisticsOutput>> getAllNodeConnectorsStatistics(
+            final GetAllNodeConnectorsStatisticsInput input) {
+        return this
+                .<GetAllNodeConnectorsStatisticsOutput, Void>handleServiceCall(
+                        PRIMARY_CONNECTION, new Function<DataCrate<GetAllNodeConnectorsStatisticsOutput>, Future<RpcResult<Void>>>() {
+
+                            @Override
+                            public Future<RpcResult<Void>> apply(final DataCrate<GetAllNodeConnectorsStatisticsOutput> data) {
+
+                                MultipartRequestPortStatsCaseBuilder caseBuilder =
+                                        new MultipartRequestPortStatsCaseBuilder();
+                                MultipartRequestPortStatsBuilder mprPortStatsBuilder =
+                                        new MultipartRequestPortStatsBuilder();
+                                // Select all ports
+                                mprPortStatsBuilder.setPortNo(OFConstants.OFPP_ANY);
+                                caseBuilder.setMultipartRequestPortStats(mprPortStatsBuilder.build());
+
+                                final Xid xid = deviceContext.getNextXid();
+                                data.getRequestContext().setXid(xid);
+                                MultipartRequestInputBuilder mprInput = RequestInputUtils
+                                        .createMultipartHeader(MultipartType.OFPMPPORTSTATS, xid.getValue(), version);
+                                mprInput.setMultipartRequestBody(caseBuilder.build());
+                                Future<RpcResult<Void>> resultFromOFLib = deviceContext
+                                        .getPrimaryConnectionContext().getConnectionAdapter().multipartRequest(mprInput.build());
+                                return JdkFutureAdapters.listenInPoolThread(resultFromOFLib);
+                            }
+                        });
+    }
+
+    @Override
+    public Future<RpcResult<GetNodeConnectorStatisticsOutput>> getNodeConnectorStatistics(
+            final GetNodeConnectorStatisticsInput input) {
+        return this
+                .<GetNodeConnectorStatisticsOutput, Void>handleServiceCall(
+                        PRIMARY_CONNECTION, new Function<DataCrate<GetNodeConnectorStatisticsOutput>, Future<RpcResult<Void>>>() {
+
+                            @Override
+                            public Future<RpcResult<Void>> apply(final DataCrate<GetNodeConnectorStatisticsOutput> data) {
+
+                                MultipartRequestPortStatsCaseBuilder caseBuilder =
+                                        new MultipartRequestPortStatsCaseBuilder();
+                                MultipartRequestPortStatsBuilder mprPortStatsBuilder =
+                                        new MultipartRequestPortStatsBuilder();
+                                // Set specific port
+                                mprPortStatsBuilder
+                                        .setPortNo(InventoryDataServiceUtil.portNumberfromNodeConnectorId(
+                                                OpenflowVersion.get(version),
+                                                input.getNodeConnectorId()));
+                                caseBuilder.setMultipartRequestPortStats(mprPortStatsBuilder.build());
+
+                                final Xid xid = deviceContext.getNextXid();
+                                data.getRequestContext().setXid(xid);
+                                MultipartRequestInputBuilder mprInput = RequestInputUtils
+                                        .createMultipartHeader(MultipartType.OFPMPPORTSTATS, xid.getValue(), version);
+                                mprInput.setMultipartRequestBody(caseBuilder.build());
+                                Future<RpcResult<Void>> resultFromOFLib = deviceContext.getPrimaryConnectionContext()
+                                        .getConnectionAdapter().multipartRequest(mprInput.build());
+                                return JdkFutureAdapters.listenInPoolThread(resultFromOFLib);
+                            }
+                        });
+
+    }
+
+}
@@ -5,13 +5,18 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.openflowplugin.impl.services;
+package org.opendaylight.openflowplugin.impl.statistics.services;
 
 import com.google.common.base.Function;
 import com.google.common.util.concurrent.JdkFutureAdapters;
 import org.opendaylight.openflowplugin.api.OFConstants;
+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.api.openflow.md.util.OpenflowVersion;
+import org.opendaylight.openflowplugin.impl.services.CommonService;
+import org.opendaylight.openflowplugin.impl.services.DataCrate;
+import org.opendaylight.openflowplugin.impl.services.RequestInputUtils;
 import org.opendaylight.openflowplugin.openflow.md.util.InventoryDataServiceUtil;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder;
@@ -32,11 +37,15 @@ import java.util.concurrent.Future;
  */
 public class OpendaylightQueueStatisticsServiceImpl extends CommonService implements OpendaylightQueueStatisticsService {
 
+    public OpendaylightQueueStatisticsServiceImpl(final RequestContextStack requestContextStack, DeviceContext deviceContext) {
+        super(requestContextStack, deviceContext);
+    }
+
     @Override
     public Future<RpcResult<GetAllQueuesStatisticsFromAllPortsOutput>> getAllQueuesStatisticsFromAllPorts(
             final GetAllQueuesStatisticsFromAllPortsInput input) {
-        return this.<GetAllQueuesStatisticsFromAllPortsOutput, Void> handleServiceCall(
-                PRIMARY_CONNECTION,  new Function<DataCrate<GetAllQueuesStatisticsFromAllPortsOutput>, Future<RpcResult<Void>>>() {
+        return this.<GetAllQueuesStatisticsFromAllPortsOutput, Void>handleServiceCall(
+                PRIMARY_CONNECTION, new Function<DataCrate<GetAllQueuesStatisticsFromAllPortsOutput>, Future<RpcResult<Void>>>() {
 
                     @Override
                     public Future<RpcResult<Void>> apply(final DataCrate<GetAllQueuesStatisticsFromAllPortsOutput> data) {
@@ -67,8 +76,8 @@ public class OpendaylightQueueStatisticsServiceImpl extends CommonService implem
     @Override
     public Future<RpcResult<GetAllQueuesStatisticsFromGivenPortOutput>> getAllQueuesStatisticsFromGivenPort(
             final GetAllQueuesStatisticsFromGivenPortInput input) {
-        return this.<GetAllQueuesStatisticsFromGivenPortOutput, Void> handleServiceCall(
-                 PRIMARY_CONNECTION,  new Function<DataCrate<GetAllQueuesStatisticsFromGivenPortOutput>, Future<RpcResult<Void>>>() {
+        return this.<GetAllQueuesStatisticsFromGivenPortOutput, Void>handleServiceCall(
+                PRIMARY_CONNECTION, new Function<DataCrate<GetAllQueuesStatisticsFromGivenPortOutput>, Future<RpcResult<Void>>>() {
 
                     @Override
                     public Future<RpcResult<Void>> apply(final DataCrate<GetAllQueuesStatisticsFromGivenPortOutput> data) {
@@ -99,8 +108,8 @@ public class OpendaylightQueueStatisticsServiceImpl extends CommonService implem
     @Override
     public Future<RpcResult<GetQueueStatisticsFromGivenPortOutput>> getQueueStatisticsFromGivenPort(
             final GetQueueStatisticsFromGivenPortInput input) {
-        return this.<GetQueueStatisticsFromGivenPortOutput, Void> handleServiceCall(
-                PRIMARY_CONNECTION,  new Function<DataCrate<GetQueueStatisticsFromGivenPortOutput>, Future<RpcResult<Void>>>() {
+        return this.<GetQueueStatisticsFromGivenPortOutput, Void>handleServiceCall(
+                PRIMARY_CONNECTION, new Function<DataCrate<GetQueueStatisticsFromGivenPortOutput>, Future<RpcResult<Void>>>() {
 
                     @Override
                     public Future<RpcResult<Void>> apply(final DataCrate<GetQueueStatisticsFromGivenPortOutput> data) {
index aade6cd78b3e2c15ee077026be27dfb85c50e27c..be5ebd442dfd6d3b70518415a709e5c590a84bdc 100644 (file)
@@ -10,28 +10,16 @@ package org.opendaylight.openflowplugin.impl.util;
 import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
 import org.opendaylight.openflowplugin.api.openflow.rpc.RpcContext;
 import org.opendaylight.openflowplugin.impl.services.NodeConfigServiceImpl;
-import org.opendaylight.openflowplugin.impl.services.OpendaylightFlowStatisticsServiceImpl;
-import org.opendaylight.openflowplugin.impl.services.OpendaylightFlowTableStatisticsServiceImpl;
-import org.opendaylight.openflowplugin.impl.services.OpendaylightGroupStatisticsServiceImpl;
-import org.opendaylight.openflowplugin.impl.services.OpendaylightMeterStatisticsServiceImpl;
-import org.opendaylight.openflowplugin.impl.services.OpendaylightPortStatisticsServiceImpl;
-import org.opendaylight.openflowplugin.impl.services.OpendaylightQueueStatisticsServiceImpl;
 import org.opendaylight.openflowplugin.impl.services.PacketProcessingServiceImpl;
 import org.opendaylight.openflowplugin.impl.services.SalFlowServiceImpl;
 import org.opendaylight.openflowplugin.impl.services.SalGroupServiceImpl;
 import org.opendaylight.openflowplugin.impl.services.SalMeterServiceImpl;
 import org.opendaylight.openflowplugin.impl.services.SalTableServiceImpl;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SalFlowService;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.OpendaylightFlowStatisticsService;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.OpendaylightFlowTableStatisticsService;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.SalGroupService;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.OpendaylightGroupStatisticsService;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.SalMeterService;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.OpendaylightMeterStatisticsService;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.module.config.rev141015.NodeConfigService;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.PacketProcessingService;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.OpendaylightPortStatisticsService;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.OpendaylightQueueStatisticsService;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.SalTableService;
 
 /**
@@ -49,18 +37,6 @@ public class MdSalRegistratorUtils {
         rpcContext.registerRpcServiceImplementation(SalGroupService.class, new SalGroupServiceImpl());
         rpcContext.registerRpcServiceImplementation(SalTableService.class, new SalTableServiceImpl());
         rpcContext.registerRpcServiceImplementation(PacketProcessingService.class, new PacketProcessingServiceImpl());
-        rpcContext.registerRpcServiceImplementation(OpendaylightFlowStatisticsService.class,
-                new OpendaylightFlowStatisticsServiceImpl());
-        rpcContext.registerRpcServiceImplementation(OpendaylightGroupStatisticsService.class,
-                new OpendaylightGroupStatisticsServiceImpl());
-        rpcContext.registerRpcServiceImplementation(OpendaylightMeterStatisticsService.class,
-                new OpendaylightMeterStatisticsServiceImpl());
-        rpcContext.registerRpcServiceImplementation(OpendaylightPortStatisticsService.class,
-                new OpendaylightPortStatisticsServiceImpl());
         rpcContext.registerRpcServiceImplementation(NodeConfigService.class, new NodeConfigServiceImpl());
-        rpcContext.registerRpcServiceImplementation(OpendaylightFlowTableStatisticsService.class,
-                new OpendaylightFlowTableStatisticsServiceImpl());
-        rpcContext.registerRpcServiceImplementation(OpendaylightQueueStatisticsService.class,
-                new OpendaylightQueueStatisticsServiceImpl());
     }
 }