reverting to patch set 7 21/8321/9
authorPrasanna Huddar <prasanna.huddar@ericsson.com>
Wed, 30 Jul 2014 11:32:29 +0000 (17:02 +0530)
committerPrasanna Huddar <prasanna.huddar@ericsson.com>
Wed, 30 Jul 2014 11:32:29 +0000 (17:02 +0530)
Signed-off-by: Prasanna Huddar <prasanna.huddar@ericsson.com>
Change-Id: I7b4a14095545e21bf2f4de325962fcf693931939

openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/ModelDrivenSwitchImpl.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/OFRpcFutureResultTransformFactory.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/OFRpcTaskFactory.java
openflowplugin/src/test/java/org/opendaylight/openflowplugin/openflow/md/core/sal/ModelDrivenSwitchImplTest.java

index ddfbaaeceb5d96ea2bc74b852ebb821403be2893..3a8683c6342794f47696ba4b835304989b6aa399 100644 (file)
  */
 package org.opendaylight.openflowplugin.openflow.md.core.sal;
 
-import com.google.common.base.Objects;
-import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.JdkFutureAdapters;
-import com.google.common.util.concurrent.ListenableFuture;
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+
 import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
-import org.opendaylight.controller.sal.common.util.Rpcs;
-import org.opendaylight.openflowjava.protocol.api.util.BinContent;
-import org.opendaylight.openflowplugin.openflow.md.OFConstants;
 import org.opendaylight.openflowplugin.openflow.md.core.SwitchConnectionDistinguisher;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.FlowConvertor;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.GroupConvertor;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.MeterConvertor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.PacketOutConvertor;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.PortConvertor;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.TableFeaturesConvertor;
-import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.MatchReactor;
 import org.opendaylight.openflowplugin.openflow.md.core.session.IMessageDispatchService;
 import org.opendaylight.openflowplugin.openflow.md.core.session.OFSessionUtil;
 import org.opendaylight.openflowplugin.openflow.md.core.session.SessionContext;
 import org.opendaylight.openflowplugin.openflow.md.core.session.SwitchConnectionCookieOFImpl;
-import org.opendaylight.openflowplugin.openflow.md.util.FlowCreatorUtil;
-import org.opendaylight.openflowplugin.openflow.md.util.InventoryDataServiceUtil;
-import org.opendaylight.openflowplugin.openflow.md.util.OpenflowVersion;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowOutput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowRemovedBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.RemoveFlowInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.RemoveFlowOutput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.RemoveFlowOutputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.UpdateFlowInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.UpdateFlowOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForAllFlowsInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowStatisticsFromFlowTableInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowStatisticsFromFlowTableOutput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowStatisticsFromFlowTableOutputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowsStatisticsFromAllFlowTablesInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowsStatisticsFromAllFlowTablesOutput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowsStatisticsFromAllFlowTablesOutputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetFlowStatisticsFromFlowTableInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetFlowStatisticsFromFlowTableOutput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetFlowStatisticsFromFlowTableOutputBuilder;
 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.GetFlowTablesStatisticsOutputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev131103.TransactionId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.port.mod.port.Port;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.Flow;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.AddGroupInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.AddGroupOutput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.GroupRemovedBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.RemoveGroupInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.RemoveGroupOutput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.RemoveGroupOutputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.UpdateGroupInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.UpdateGroupOutput;
 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.GetAllGroupStatisticsOutputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupDescriptionInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupDescriptionOutput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupDescriptionOutputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupFeaturesInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupFeaturesOutput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupFeaturesOutputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupStatisticsInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupStatisticsOutput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupStatisticsOutputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.AddMeterInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.AddMeterOutput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.MeterRemovedBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.RemoveMeterInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.RemoveMeterOutput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.RemoveMeterOutputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.UpdateMeterInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.UpdateMeterOutput;
 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.GetAllMeterConfigStatisticsOutputBuilder;
 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.GetAllMeterStatisticsOutputBuilder;
 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.GetMeterFeaturesOutputBuilder;
 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.GetMeterStatisticsOutputBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.Group;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.GroupId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.Meter;
-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.MultipartRequestFlags;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.match.grouping.Match;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.match.grouping.MatchBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierInputBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowModInputBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GroupModInputBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MeterModInputBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PacketOutInput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortModInput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortModInputBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestAggregateCaseBuilder;
-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.MultipartRequestGroupCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestGroupDescCaseBuilder;
-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.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.MultipartRequestPortStatsCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestQueueCaseBuilder;
-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.MultipartRequestTableFeaturesCaseBuilder;
-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.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.group._case.MultipartRequestGroupBuilder;
-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.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.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.queue._case.MultipartRequestQueueBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.table._case.MultipartRequestTableBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.table.features._case.MultipartRequestTableFeaturesBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.table.features._case.multipart.request.table.features.TableFeatures;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.ConnectionCookie;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.TransmitPacketInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.service.rev131107.UpdatePortInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.service.rev131107.UpdatePortOutput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.port.service.rev131107.UpdatePortOutputBuilder;
 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.GetAllNodeConnectorsStatisticsOutputBuilder;
 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.GetNodeConnectorStatisticsOutputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.GetAllQueuesStatisticsFromAllPortsInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.GetAllQueuesStatisticsFromAllPortsOutput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.GetAllQueuesStatisticsFromAllPortsOutputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.GetAllQueuesStatisticsFromGivenPortInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.GetAllQueuesStatisticsFromGivenPortOutput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.GetAllQueuesStatisticsFromGivenPortOutputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.GetQueueStatisticsFromGivenPortInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.GetQueueStatisticsFromGivenPortOutput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.GetQueueStatisticsFromGivenPortOutputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.UpdateTableInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.UpdateTableOutput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.UpdateTableOutputBuilder;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.common.RpcError;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.slf4j.Logger;
 
-import java.math.BigInteger;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
+import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.JdkFutureAdapters;
+import com.google.common.util.concurrent.ListenableFuture;
 
 /**
  * RPC implementation of MD-switch
@@ -259,166 +181,41 @@ public class ModelDrivenSwitchImpl extends AbstractModelDrivenSwitch {
     @Override
     public Future<RpcResult<RemoveFlowOutput>> removeFlow(final RemoveFlowInput input) {
         LOG.debug("Calling the removeFlow RPC method on MessageDispatchService");
-        Long xId = null;
-        // For Flow provisioning, the SwitchConnectionDistinguisher is set to
-        // null so
-        // the request can be routed through any connection to the switch
-
+        
+        // use primary connection
         SwitchConnectionDistinguisher cookie = null;
-        if (Objects.firstNonNull(input.isBarrier(), Boolean.FALSE)) {
-            BarrierInputBuilder barrierInput = new BarrierInputBuilder();
-            xId = sessionContext.getNextXid();
-            barrierInput.setXid(xId);
-            barrierInput.setVersion(version);
-            @SuppressWarnings("unused")
-            Future<RpcResult<BarrierOutput>> barrierOFLib = messageService.barrier(barrierInput.build(), cookie);
-        }
-
-        // Convert the RemoveFlowInput to FlowModInput
-        FlowModInputBuilder ofFlowModInput = FlowConvertor.toFlowModInput(input, version, sessionContext
-                .getFeatures().getDatapathId());
-        xId = sessionContext.getNextXid();
-        ofFlowModInput.setXid(xId);
-
-        if (null != rpcNotificationProviderService) {
-            FlowRemovedBuilder removeFlow = new FlowRemovedBuilder(
-                    (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.Flow) input);
-            removeFlow.setTransactionId(new TransactionId(BigInteger.valueOf(xId.intValue())));
-            removeFlow.setFlowRef(input.getFlowRef());
-            rpcNotificationProviderService.publish(removeFlow.build());
-        }
-
-        Future<RpcResult<UpdateFlowOutput>> resultFromOFLib = messageService.flowMod(ofFlowModInput.build(), cookie);
-
-        RpcResult<UpdateFlowOutput> rpcResultFromOFLib = null;
-
-        try {
-            rpcResultFromOFLib = resultFromOFLib.get();
-        } catch (Exception ex) {
-            LOG.error(" Error while getting result for remove Flow RPC" + ex.getMessage());
-        }
-
-        UpdateFlowOutput updateFlowOutput = rpcResultFromOFLib.getResult();
-
-        RemoveFlowOutputBuilder removeFlowOutput = new RemoveFlowOutputBuilder();
-        removeFlowOutput.setTransactionId(updateFlowOutput.getTransactionId());
-        RemoveFlowOutput result = removeFlowOutput.build();
-
-        Collection<RpcError> errors = rpcResultFromOFLib.getErrors();
-        RpcResult<RemoveFlowOutput> rpcResult = Rpcs.getRpcResult(true, result, errors);
+        OFRpcTask<RemoveFlowInput, RpcResult<UpdateFlowOutput>> task = 
+                OFRpcTaskFactory.createRemoveFlowTask(rpcTaskContext, input, cookie);
+        ListenableFuture<RpcResult<UpdateFlowOutput>> result = task.submit();
 
-        LOG.debug("Returning the Remove Flow RPC result to MD-SAL");
-        return Futures.immediateFuture(rpcResult);
+        return Futures.transform(JdkFutureAdapters.listenInPoolThread(result), 
+                OFRpcFutureResultTransformFactory.createForRemoveFlowOutput());
     }
 
     @Override
     public Future<RpcResult<RemoveGroupOutput>> removeGroup(final RemoveGroupInput input) {
         LOG.debug("Calling the Remove Group RPC method on MessageDispatchService");
-        Long xId = null;
-
-        // For Flow provisioning, the SwitchConnectionDistinguisher is set to
-        // null so
-        // the request can be routed through any connection to the switch
 
         SwitchConnectionDistinguisher cookie = null;
-        if (Objects.firstNonNull(input.isBarrier(), Boolean.FALSE)) {
-            xId = sessionContext.getNextXid();
-            BarrierInputBuilder barrierInput = new BarrierInputBuilder();
-            barrierInput.setVersion(version);
-            barrierInput.setXid(xId);
-            @SuppressWarnings("unused")
-            Future<RpcResult<BarrierOutput>> barrierOFLib = messageService.barrier(barrierInput.build(), cookie);
-        }
-
-        // Convert the RemoveGroupInput to GroupModInput
-        GroupModInputBuilder ofGroupModInput = GroupConvertor.toGroupModInput(input, version, this.getSessionContext()
-                .getFeatures().getDatapathId());
-        xId = sessionContext.getNextXid();
-        ofGroupModInput.setXid(xId);
-
-        if (null != rpcNotificationProviderService) {
-            GroupRemovedBuilder groupMod = new GroupRemovedBuilder(
-                    (org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.Group) input);
-            groupMod.setTransactionId(new TransactionId(BigInteger.valueOf(xId.intValue())));
-            groupMod.setGroupRef(input.getGroupRef());
-            rpcNotificationProviderService.publish(groupMod.build());
-        }
-
-        Future<RpcResult<UpdateGroupOutput>> resultFromOFLib = messageService.groupMod(ofGroupModInput.build(), cookie);
-
-        RpcResult<UpdateGroupOutput> rpcResultFromOFLib = null;
-
-        try {
-            rpcResultFromOFLib = resultFromOFLib.get();
-        } catch (Exception ex) {
-            LOG.error(" Error while getting result for RemoveGroup RPC" + ex.getMessage());
-        }
-
-        UpdateGroupOutput updateGroupOutput = rpcResultFromOFLib.getResult();
-
-        RemoveGroupOutputBuilder removeGroupOutput = new RemoveGroupOutputBuilder();
-        removeGroupOutput.setTransactionId(updateGroupOutput.getTransactionId());
-        RemoveGroupOutput result = removeGroupOutput.build();
-
-        Collection<RpcError> errors = rpcResultFromOFLib.getErrors();
-        RpcResult<RemoveGroupOutput> rpcResult = Rpcs.getRpcResult(true, result, errors);
-
-        LOG.debug("Returning the Remove Group RPC result to MD-SAL");
-        return Futures.immediateFuture(rpcResult);
+        OFRpcTask<RemoveGroupInput, RpcResult<UpdateGroupOutput>> task = 
+                OFRpcTaskFactory.createRemoveGroupTask(rpcTaskContext, input, cookie);
+        ListenableFuture<RpcResult<UpdateGroupOutput>> result = task.submit();
+        
+        return Futures.transform(JdkFutureAdapters.listenInPoolThread(result), 
+                OFRpcFutureResultTransformFactory.createForRemoveGroupOutput());
     }
 
     @Override
     public Future<RpcResult<RemoveMeterOutput>> removeMeter(final RemoveMeterInput input) {
         LOG.debug("Calling the Remove MeterMod RPC method on MessageDispatchService");
-        Long xId = null;
 
-        // For Meter provisioning, the SwitchConnectionDistinguisher is set to
-        // null so
-        // the request can be routed through any connection to the switch
         SwitchConnectionDistinguisher cookie = null;
-        if (Objects.firstNonNull(input.isBarrier(), Boolean.FALSE)) {
-            xId = sessionContext.getNextXid();
-            BarrierInputBuilder barrierInput = new BarrierInputBuilder();
-            barrierInput.setVersion(version);
-            barrierInput.setXid(xId);
-            @SuppressWarnings("unused")
-            Future<RpcResult<BarrierOutput>> barrierOFLib = messageService.barrier(barrierInput.build(), cookie);
-        }
-
-        // Convert the RemoveMeterInput to MeterModInput
-        MeterModInputBuilder ofMeterModInput = MeterConvertor.toMeterModInput(input, version);
-        xId = sessionContext.getNextXid();
-        ofMeterModInput.setXid(xId);
-
-        if (null != rpcNotificationProviderService) {
-            MeterRemovedBuilder meterMod = new MeterRemovedBuilder(
-                    (org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.Meter) input);
-            meterMod.setTransactionId(new TransactionId(BigInteger.valueOf(xId.intValue())));
-            meterMod.setMeterRef(input.getMeterRef());
-            rpcNotificationProviderService.publish(meterMod.build());
-        }
-
-        Future<RpcResult<UpdateMeterOutput>> resultFromOFLib = messageService.meterMod(ofMeterModInput.build(), cookie);
-
-        RpcResult<UpdateMeterOutput> rpcResultFromOFLib = null;
-
-        try {
-            rpcResultFromOFLib = resultFromOFLib.get();
-        } catch (Exception ex) {
-            LOG.error(" Error while getting result for RemoveMeter RPC" + ex.getMessage());
-        }
-
-        UpdateMeterOutput updatemeterOutput = rpcResultFromOFLib.getResult();
-
-        RemoveMeterOutputBuilder removeMeterOutput = new RemoveMeterOutputBuilder();
-        removeMeterOutput.setTransactionId(updatemeterOutput.getTransactionId());
-        RemoveMeterOutput result = removeMeterOutput.build();
-
-        Collection<RpcError> errors = rpcResultFromOFLib.getErrors();
-        RpcResult<RemoveMeterOutput> rpcResult = Rpcs.getRpcResult(true, result, errors);
-
-        LOG.debug("Returning the Remove Meter RPC result to MD-SAL");
-        return Futures.immediateFuture(rpcResult);
+        OFRpcTask<RemoveMeterInput, RpcResult<UpdateMeterOutput>> task = 
+                OFRpcTaskFactory.createRemoveMeterTask(rpcTaskContext, input, cookie);
+        ListenableFuture<RpcResult<UpdateMeterOutput>> result = task.submit();
+        
+        return Futures.transform(JdkFutureAdapters.listenInPoolThread(result), 
+                OFRpcFutureResultTransformFactory.createForRemoveMeterOutput());
     }
 
     @Override
@@ -510,1006 +307,263 @@ public class ModelDrivenSwitchImpl extends AbstractModelDrivenSwitch {
         return nodeId;
     }
 
-    /*
-     * Methods for requesting statistics from switch
-     */
+    
     @Override
     public Future<RpcResult<GetAllGroupStatisticsOutput>> getAllGroupStatistics(final GetAllGroupStatisticsInput input) {
-
-        GetAllGroupStatisticsOutputBuilder output = new GetAllGroupStatisticsOutputBuilder();
-        Collection<RpcError> errors = Collections.emptyList();
-
-        if (version == OFConstants.OFP_VERSION_1_0) {
-            output.setTransactionId(null);
-            output.setGroupStats(null);
-
-            RpcResult<GetAllGroupStatisticsOutput> rpcResult = Rpcs.getRpcResult(true, output.build(), errors);
-            return Futures.immediateFuture(rpcResult);
-        }
-        // Generate xid to associate it with the request
-        Long xid = this.getSessionContext().getNextXid();
-
-        LOG.debug("Prepare statistics request for all the groups - Transaction id - {}", xid);
-
-        // Create multipart request header
-        MultipartRequestInputBuilder mprInput = new MultipartRequestInputBuilder();
-        mprInput.setType(MultipartType.OFPMPGROUP);
-        mprInput.setVersion(version);
-        mprInput.setXid(xid);
-        mprInput.setFlags(new MultipartRequestFlags(false));
-
-        // Create multipart request body for fetch all the group stats
-        MultipartRequestGroupCaseBuilder caseBuilder = new MultipartRequestGroupCaseBuilder();
-        MultipartRequestGroupBuilder mprGroupBuild = new MultipartRequestGroupBuilder();
-        mprGroupBuild.setGroupId(new GroupId(BinContent.intToUnsignedLong(Group.OFPGALL.getIntValue())));
-        caseBuilder.setMultipartRequestGroup(mprGroupBuild.build());
-
-        // Set request body to main multipart request
-        mprInput.setMultipartRequestBody(caseBuilder.build());
-
-        // Send the request, no cookies associated, use any connection
-        LOG.debug("Send group statistics request to the switch :{}", mprGroupBuild);
-        this.messageService.multipartRequest(mprInput.build(), null);
-
-        // Prepare rpc return output. Set xid and send it back.
-        LOG.debug("Return results and transaction id back to caller");
-        output.setTransactionId(generateTransactionId(xid));
-        output.setGroupStats(null);
-
-        RpcResult<GetAllGroupStatisticsOutput> rpcResult = Rpcs.getRpcResult(true, output.build(), errors);
-        return Futures.immediateFuture(rpcResult);
+     // use primary connection
+        LOG.debug("Calling the getAllGroupStatistics RPC method on MessageDispatchService");
+        SwitchConnectionDistinguisher cookie = null;
+        
+        OFRpcTask<GetAllGroupStatisticsInput, RpcResult<GetAllGroupStatisticsOutput>> task = 
+                OFRpcTaskFactory.createGetAllGroupStatisticsTask(rpcTaskContext, input, cookie);
+        ListenableFuture<RpcResult<GetAllGroupStatisticsOutput>> result = task.submit();
+        
+        return result;
 
     }
 
     @Override
     public Future<RpcResult<GetGroupDescriptionOutput>> getGroupDescription(final GetGroupDescriptionInput input) {
-
-        GetGroupDescriptionOutputBuilder output = new GetGroupDescriptionOutputBuilder();
-        Collection<RpcError> errors = Collections.emptyList();
-
-        if (version == OFConstants.OFP_VERSION_1_0) {
-            output.setTransactionId(null);
-            output.setGroupDescStats(null);
-
-            RpcResult<GetGroupDescriptionOutput> rpcResult = Rpcs.getRpcResult(true, output.build(), errors);
-            return Futures.immediateFuture(rpcResult);
-        }
-        // Generate xid to associate it with the request
-        Long xid = this.getSessionContext().getNextXid();
-
-        LOG.debug("Prepare group description statistics request - Transaction id - {}", xid);
-
-        // Create multipart request header
-        MultipartRequestInputBuilder mprInput = new MultipartRequestInputBuilder();
-        mprInput.setType(MultipartType.OFPMPGROUPDESC);
-        mprInput.setVersion(version);
-        mprInput.setXid(xid);
-        mprInput.setFlags(new MultipartRequestFlags(false));
-
-        // Create multipart request body for fetch all the group description
-        // stats
-        MultipartRequestGroupDescCaseBuilder mprGroupDescBuild = new MultipartRequestGroupDescCaseBuilder();
-
-        // Set request body to main multipart request
-        mprInput.setMultipartRequestBody(mprGroupDescBuild.build());
-
-        // Send the request, no cookies associated, use any connection
-        LOG.debug("Send group desciption statistics request to switch : {}", mprGroupDescBuild);
-        this.messageService.multipartRequest(mprInput.build(), null);
-
-        // Prepare rpc return output. Set xid and send it back.
-        LOG.debug("Return results and transaction id back to caller");
-        output.setTransactionId(generateTransactionId(xid));
-        output.setGroupDescStats(null);
-
-        RpcResult<GetGroupDescriptionOutput> rpcResult = Rpcs.getRpcResult(true, output.build(), errors);
-        return Futures.immediateFuture(rpcResult);
-
+        LOG.debug("Calling the getGroupDescription RPC method on MessageDispatchService");
+        SwitchConnectionDistinguisher cookie = null;
+        
+        OFRpcTask<GetGroupDescriptionInput, RpcResult<GetGroupDescriptionOutput>> task = 
+                OFRpcTaskFactory.createGetGroupDescriptionTask(rpcTaskContext, input, cookie);
+        ListenableFuture<RpcResult<GetGroupDescriptionOutput>> result = task.submit();
+        return result;
     }
-
+    
     @Override
     public Future<RpcResult<GetGroupFeaturesOutput>> getGroupFeatures(final GetGroupFeaturesInput input) {
-
-        GetGroupFeaturesOutputBuilder output = new GetGroupFeaturesOutputBuilder();
-        Collection<RpcError> errors = Collections.emptyList();
-
-        if (version == OFConstants.OFP_VERSION_1_0) {
-            output.setTransactionId(null);
-
-            RpcResult<GetGroupFeaturesOutput> rpcResult = Rpcs.getRpcResult(true, output.build(), errors);
-            return Futures.immediateFuture(rpcResult);
-        }
-        // Generate xid to associate it with the request
-        Long xid = this.getSessionContext().getNextXid();
-
-        LOG.debug("Prepare group features statistics request - Transaction id - {}", xid);
-
-        // Create multipart request header
-        MultipartRequestInputBuilder mprInput = new MultipartRequestInputBuilder();
-        mprInput.setType(MultipartType.OFPMPGROUPFEATURES);
-        mprInput.setVersion(version);
-        mprInput.setXid(xid);
-        mprInput.setFlags(new MultipartRequestFlags(false));
-
-        // Create multipart request body for fetch all the group description
-        // stats
-        MultipartRequestGroupFeaturesCaseBuilder mprGroupFeaturesBuild = new MultipartRequestGroupFeaturesCaseBuilder();
-
-        // Set request body to main multipart request
-        mprInput.setMultipartRequestBody(mprGroupFeaturesBuild.build());
-
-        // Send the request, no cookies associated, use any connection
-        LOG.debug("Send group features statistics request :{}", mprGroupFeaturesBuild);
-        this.messageService.multipartRequest(mprInput.build(), null);
-
-        // Prepare rpc return output. Set xid and send it back.
-        LOG.debug("Return results and transaction id back to caller");
-        output.setTransactionId(generateTransactionId(xid));
-
-        RpcResult<GetGroupFeaturesOutput> rpcResult = Rpcs.getRpcResult(true, output.build(), errors);
-        return Futures.immediateFuture(rpcResult);
+        LOG.debug("Calling the getGroupFeatures RPC method on MessageDispatchService");
+        SwitchConnectionDistinguisher cookie = null;
+        
+        OFRpcTask<GetGroupFeaturesInput, RpcResult<GetGroupFeaturesOutput>> task = 
+                OFRpcTaskFactory.createGetGroupFeaturesTask(rpcTaskContext, input, cookie);
+        ListenableFuture<RpcResult<GetGroupFeaturesOutput>> result = task.submit();
+        return result;
     }
-
+    
     @Override
     public Future<RpcResult<GetGroupStatisticsOutput>> getGroupStatistics(final GetGroupStatisticsInput input) {
-
-        GetGroupStatisticsOutputBuilder output = new GetGroupStatisticsOutputBuilder();
-        Collection<RpcError> errors = Collections.emptyList();
-
-        if (version == OFConstants.OFP_VERSION_1_0) {
-            output.setTransactionId(null);
-            output.setGroupStats(null);
-
-            RpcResult<GetGroupStatisticsOutput> rpcResult = Rpcs.getRpcResult(true, output.build(), errors);
-            return Futures.immediateFuture(rpcResult);
-        }
-        // Generate xid to associate it with the request
-        Long xid = this.getSessionContext().getNextXid();
-
-        LOG.debug("Prepare statistics request for node {} group ({}) - Transaction id - {}", input.getNode(),
-                input.getGroupId(), xid);
-
-        // Create multipart request header
-        MultipartRequestInputBuilder mprInput = new MultipartRequestInputBuilder();
-        mprInput.setType(MultipartType.OFPMPGROUP);
-        mprInput.setVersion(version);
-        mprInput.setXid(xid);
-        mprInput.setFlags(new MultipartRequestFlags(false));
-
-        // Create multipart request body for fetch all the group stats
-        MultipartRequestGroupCaseBuilder caseBuilder = new MultipartRequestGroupCaseBuilder();
-        MultipartRequestGroupBuilder mprGroupBuild = new MultipartRequestGroupBuilder();
-        mprGroupBuild.setGroupId(new GroupId(input.getGroupId().getValue()));
-        caseBuilder.setMultipartRequestGroup(mprGroupBuild.build());
-
-        // Set request body to main multipart request
-        mprInput.setMultipartRequestBody(caseBuilder.build());
-
-        // Send the request, no cookies associated, use any connection
-        LOG.debug("Send group statistics request :{}", mprGroupBuild);
-        this.messageService.multipartRequest(mprInput.build(), null);
-
-        // Prepare rpc return output. Set xid and send it back.
-        LOG.debug("Return results and transaction id back to caller");
-        output.setTransactionId(generateTransactionId(xid));
-        output.setGroupStats(null);
-
-        RpcResult<GetGroupStatisticsOutput> rpcResult = Rpcs.getRpcResult(true, output.build(), errors);
-        return Futures.immediateFuture(rpcResult);
+        LOG.debug("Calling the getGroupStatistics RPC method on MessageDispatchService");
+        SwitchConnectionDistinguisher cookie = null;
+        
+        OFRpcTask<GetGroupStatisticsInput, RpcResult<GetGroupStatisticsOutput>> task = 
+                OFRpcTaskFactory.createGetGroupStatisticsTask(rpcTaskContext, input, cookie);
+        ListenableFuture<RpcResult<GetGroupStatisticsOutput>> result = task.submit();
+        return result;
     }
 
     @Override
     public Future<RpcResult<GetAllMeterConfigStatisticsOutput>> getAllMeterConfigStatistics(
             final GetAllMeterConfigStatisticsInput input) {
-
-        GetAllMeterConfigStatisticsOutputBuilder output = new GetAllMeterConfigStatisticsOutputBuilder();
-        Collection<RpcError> errors = Collections.emptyList();
-
-        if (version == OFConstants.OFP_VERSION_1_0) {
-            output.setTransactionId(null);
-            output.setMeterConfigStats(null);
-
-            RpcResult<GetAllMeterConfigStatisticsOutput> rpcResult = Rpcs.getRpcResult(true, output.build(), errors);
-            return Futures.immediateFuture(rpcResult);
-
-        }
-        // Generate xid to associate it with the request
-        Long xid = this.getSessionContext().getNextXid();
-
-        LOG.debug("Prepare config request for all the meters - Transaction id - {}", xid);
-
-        // Create multipart request header
-        MultipartRequestInputBuilder mprInput = new MultipartRequestInputBuilder();
-        mprInput.setType(MultipartType.OFPMPMETERCONFIG);
-        mprInput.setVersion(version);
-        mprInput.setXid(xid);
-        mprInput.setFlags(new MultipartRequestFlags(false));
-
-        // Create multipart request body for fetch all the meter stats
-        MultipartRequestMeterConfigCaseBuilder caseBuilder = new MultipartRequestMeterConfigCaseBuilder();
-        MultipartRequestMeterConfigBuilder mprMeterConfigBuild = new MultipartRequestMeterConfigBuilder();
-        mprMeterConfigBuild.setMeterId(new MeterId(BinContent.intToUnsignedLong(Meter.OFPMALL.getIntValue())));
-        caseBuilder.setMultipartRequestMeterConfig(mprMeterConfigBuild.build());
-
-        // Set request body to main multipart request
-        mprInput.setMultipartRequestBody(caseBuilder.build());
-
-        // Send the request, no cookies associated, use any connection
-        LOG.debug("Send meter statistics request :{}", mprMeterConfigBuild);
-        this.messageService.multipartRequest(mprInput.build(), null);
-
-        // Prepare rpc return output. Set xid and send it back.
-        LOG.debug("Return results and transaction id back to caller");
-        output.setTransactionId(generateTransactionId(xid));
-        output.setMeterConfigStats(null);
-
-        RpcResult<GetAllMeterConfigStatisticsOutput> rpcResult = Rpcs.getRpcResult(true, output.build(), errors);
-        return Futures.immediateFuture(rpcResult);
+        LOG.debug("Calling the getAllMeterConfigStatistics RPC method on MessageDispatchService");
+        SwitchConnectionDistinguisher cookie = null;
+        
+        OFRpcTask<GetAllMeterConfigStatisticsInput, RpcResult<GetAllMeterConfigStatisticsOutput>> task = 
+                OFRpcTaskFactory.createGetAllMeterConfigStatisticsTask(rpcTaskContext, input, cookie);
+        ListenableFuture<RpcResult<GetAllMeterConfigStatisticsOutput>> result = task.submit();
+        return result;
     }
-
+    
     @Override
-    public Future<RpcResult<GetAllMeterStatisticsOutput>> getAllMeterStatistics(final GetAllMeterStatisticsInput input) {
-
-        GetAllMeterStatisticsOutputBuilder output = new GetAllMeterStatisticsOutputBuilder();
-        Collection<RpcError> errors = Collections.emptyList();
-
-        if (version == OFConstants.OFP_VERSION_1_0) {
-            output.setTransactionId(null);
-            output.setMeterStats(null);
-
-            RpcResult<GetAllMeterStatisticsOutput> rpcResult = Rpcs.getRpcResult(true, output.build(), errors);
-            return Futures.immediateFuture(rpcResult);
-        }
-        // Generate xid to associate it with the request
-        Long xid = this.getSessionContext().getNextXid();
-
-        LOG.debug("Prepare statistics request for all the meters - Transaction id - {}", xid);
-
-        // Create multipart request header
-        MultipartRequestInputBuilder mprInput = new MultipartRequestInputBuilder();
-        mprInput.setType(MultipartType.OFPMPMETER);
-        mprInput.setVersion(version);
-        mprInput.setXid(xid);
-        mprInput.setFlags(new MultipartRequestFlags(false));
-
-        // Create multipart request body for fetch all the meter stats
-        MultipartRequestMeterCaseBuilder caseBuilder = new MultipartRequestMeterCaseBuilder();
-        MultipartRequestMeterBuilder mprMeterBuild = new MultipartRequestMeterBuilder();
-        mprMeterBuild.setMeterId(new MeterId(BinContent.intToUnsignedLong(Meter.OFPMALL.getIntValue())));
-        caseBuilder.setMultipartRequestMeter(mprMeterBuild.build());
-
-        // Set request body to main multipart request
-        mprInput.setMultipartRequestBody(caseBuilder.build());
-
-        // Send the request, no cookies associated, use any connection
-        LOG.debug("Send meter statistics request :{}", mprMeterBuild);
-        this.messageService.multipartRequest(mprInput.build(), null);
-
-        // Prepare rpc return output. Set xid and send it back.
-        LOG.debug("Return results and transaction id back to caller");
-        output.setTransactionId(generateTransactionId(xid));
-        output.setMeterStats(null);
-
-        RpcResult<GetAllMeterStatisticsOutput> rpcResult = Rpcs.getRpcResult(true, output.build(), errors);
-        return Futures.immediateFuture(rpcResult);
+    public Future<RpcResult<GetAllMeterStatisticsOutput>> getAllMeterStatistics(
+            final GetAllMeterStatisticsInput input) {
+        LOG.debug("Calling the getAllMeterStatistics RPC method on MessageDispatchService");
+        SwitchConnectionDistinguisher cookie = null;
+        
+        OFRpcTask<GetAllMeterStatisticsInput, RpcResult<GetAllMeterStatisticsOutput>> task = 
+                OFRpcTaskFactory.createGetAllMeterStatisticsTask(rpcTaskContext, input, cookie);
+        ListenableFuture<RpcResult<GetAllMeterStatisticsOutput>> result = task.submit();
+        return result;
     }
-
+    
     @Override
-    public Future<RpcResult<GetMeterFeaturesOutput>> getMeterFeatures(final GetMeterFeaturesInput input) {
-
-        GetMeterFeaturesOutputBuilder output = new GetMeterFeaturesOutputBuilder();
-        Collection<RpcError> errors = Collections.emptyList();
-
-        if (version == OFConstants.OFP_VERSION_1_0) {
-            output.setTransactionId(null);
-
-            RpcResult<GetMeterFeaturesOutput> rpcResult = Rpcs.getRpcResult(true, output.build(), errors);
-            return Futures.immediateFuture(rpcResult);
-        }
-        // Generate xid to associate it with the request
-        Long xid = this.getSessionContext().getNextXid();
-
-        LOG.debug("Prepare features statistics request for all the meters - Transaction id - {}", xid);
-
-        // Create multipart request header
-        MultipartRequestInputBuilder mprInput = new MultipartRequestInputBuilder();
-        mprInput.setType(MultipartType.OFPMPMETERFEATURES);
-        mprInput.setVersion(version);
-        mprInput.setXid(xid);
-        mprInput.setFlags(new MultipartRequestFlags(false));
-
-        // Create multipart request body for fetch all the group description
-        // stats
-        MultipartRequestMeterFeaturesCaseBuilder mprMeterFeaturesBuild = new MultipartRequestMeterFeaturesCaseBuilder();
-
-        // Set request body to main multipart request
-        mprInput.setMultipartRequestBody(mprMeterFeaturesBuild.build());
-
-        // Send the request, no cookies associated, use any connection
-        LOG.debug("Send meter features statistics request :{}", mprMeterFeaturesBuild);
-        this.messageService.multipartRequest(mprInput.build(), null);
-
-        // Prepare rpc return output. Set xid and send it back.
-        LOG.debug("Return results and transaction id back to caller");
-        output.setTransactionId(generateTransactionId(xid));
-
-        RpcResult<GetMeterFeaturesOutput> rpcResult = Rpcs.getRpcResult(true, output.build(), errors);
-        return Futures.immediateFuture(rpcResult);
+    public Future<RpcResult<GetMeterFeaturesOutput>> getMeterFeatures(
+            final GetMeterFeaturesInput input) {
+        LOG.debug("Calling the getMeterFeatures RPC method on MessageDispatchService");
+        SwitchConnectionDistinguisher cookie = null;
+        
+        OFRpcTask<GetMeterFeaturesInput, RpcResult<GetMeterFeaturesOutput>> task = 
+                OFRpcTaskFactory.createGetMeterFeaturesTask(rpcTaskContext, input, cookie);
+        ListenableFuture<RpcResult<GetMeterFeaturesOutput>> result = task.submit();
+        return result;
     }
-
+    
     @Override
-    public Future<RpcResult<GetMeterStatisticsOutput>> getMeterStatistics(final GetMeterStatisticsInput input) {
-
-        GetMeterStatisticsOutputBuilder output = new GetMeterStatisticsOutputBuilder();
-        Collection<RpcError> errors = Collections.emptyList();
-
-        if (version == OFConstants.OFP_VERSION_1_0) {
-            output.setTransactionId(null);
-            output.setMeterStats(null);
-
-            RpcResult<GetMeterStatisticsOutput> rpcResult = Rpcs.getRpcResult(true, output.build(), errors);
-            return Futures.immediateFuture(rpcResult);
-
-        }
-        // Generate xid to associate it with the request
-        Long xid = this.getSessionContext().getNextXid();
-
-        LOG.debug("Preprae statistics request for Meter ({}) - Transaction id - {}", input.getMeterId().getValue(), xid);
-
-        // Create multipart request header
-        MultipartRequestInputBuilder mprInput = new MultipartRequestInputBuilder();
-        mprInput.setType(MultipartType.OFPMPMETER);
-        mprInput.setVersion(version);
-        mprInput.setXid(xid);
-        mprInput.setFlags(new MultipartRequestFlags(false));
-
-        // Create multipart request body for fetch all the meter stats
-        MultipartRequestMeterCaseBuilder caseBuilder = new MultipartRequestMeterCaseBuilder();
-        MultipartRequestMeterBuilder mprMeterBuild = new MultipartRequestMeterBuilder();
-        // Select specific meter
-        mprMeterBuild.setMeterId(new MeterId(input.getMeterId().getValue()));
-        caseBuilder.setMultipartRequestMeter(mprMeterBuild.build());
-
-        // Set request body to main multipart request
-        mprInput.setMultipartRequestBody(caseBuilder.build());
-
-        // Send the request, no cookies associated, use any connection
-        LOG.debug("Send meter statistics request :{}", mprMeterBuild);
-        this.messageService.multipartRequest(mprInput.build(), null);
-
-        // Prepare rpc return output. Set xid and send it back.
-        LOG.debug("Return results and transaction id back to caller");
-        output.setTransactionId(generateTransactionId(xid));
-        output.setMeterStats(null);
-
-        RpcResult<GetMeterStatisticsOutput> rpcResult = Rpcs.getRpcResult(true, output.build(), errors);
-        return Futures.immediateFuture(rpcResult);
+    public Future<RpcResult<GetMeterStatisticsOutput>> getMeterStatistics(
+            final GetMeterStatisticsInput input) {
+        LOG.debug("Calling the getMeterStatistics RPC method on MessageDispatchService");
+        SwitchConnectionDistinguisher cookie = null;
+        
+        OFRpcTask<GetMeterStatisticsInput, RpcResult<GetMeterStatisticsOutput>> task = 
+                OFRpcTaskFactory.createGetMeterStatisticsTask(rpcTaskContext, input, cookie);
+        ListenableFuture<RpcResult<GetMeterStatisticsOutput>> result = task.submit();
+        return result;
     }
-
+    
     @Override
     public Future<RpcResult<GetAllNodeConnectorsStatisticsOutput>> getAllNodeConnectorsStatistics(
-            final GetAllNodeConnectorsStatisticsInput arg0) {
-
-        // Generate xid to associate it with the request
-        Long xid = this.getSessionContext().getNextXid();
-
-        LOG.debug("Prepare port statistics request for all ports of node {} - TrasactionId - {}", arg0.getNode()
-                .getValue(), xid);
-
-        // Create multipart request header
-        MultipartRequestInputBuilder mprInput = new MultipartRequestInputBuilder();
-        mprInput.setType(MultipartType.OFPMPPORTSTATS);
-        mprInput.setVersion(version);
-        mprInput.setXid(xid);
-        mprInput.setFlags(new MultipartRequestFlags(false));
-
-        // Create multipart request body to fetch stats for all the port of the
-        // node
-        MultipartRequestPortStatsCaseBuilder caseBuilder = new MultipartRequestPortStatsCaseBuilder();
-        MultipartRequestPortStatsBuilder mprPortStatsBuilder = new MultipartRequestPortStatsBuilder();
-        // Select all ports
-        mprPortStatsBuilder.setPortNo(OFConstants.OFPP_ANY);
-        caseBuilder.setMultipartRequestPortStats(mprPortStatsBuilder.build());
-
-        // Set request body to main multipart request
-        mprInput.setMultipartRequestBody(caseBuilder.build());
-
-        // Send the request, no cookies associated, use any connection
-        LOG.debug("Send port statistics request :{}", mprPortStatsBuilder.build().toString());
-        this.messageService.multipartRequest(mprInput.build(), null);
-
-        // Prepare rpc return output. Set xid and send it back.
-        GetAllNodeConnectorsStatisticsOutputBuilder output = new GetAllNodeConnectorsStatisticsOutputBuilder();
-        output.setTransactionId(generateTransactionId(xid));
-
-        Collection<RpcError> errors = Collections.emptyList();
-        RpcResult<GetAllNodeConnectorsStatisticsOutput> rpcResult = Rpcs.getRpcResult(true, output.build(), errors);
-        return Futures.immediateFuture(rpcResult);
+            final GetAllNodeConnectorsStatisticsInput input) {
+        LOG.debug("Calling the getAllNodeConnectorsStatistics RPC method on MessageDispatchService");
+        SwitchConnectionDistinguisher cookie = null;
+        
+        OFRpcTask<GetAllNodeConnectorsStatisticsInput, RpcResult<GetAllNodeConnectorsStatisticsOutput>> task = 
+                OFRpcTaskFactory.createGetAllNodeConnectorsStatisticsTask(rpcTaskContext, input, cookie);
+        ListenableFuture<RpcResult<GetAllNodeConnectorsStatisticsOutput>> result = task.submit();
+        return result;
     }
-
+    
     @Override
     public Future<RpcResult<GetNodeConnectorStatisticsOutput>> getNodeConnectorStatistics(
-            final GetNodeConnectorStatisticsInput arg0) {
-        // Generate xid to associate it with the request
-        Long xid = this.getSessionContext().getNextXid();
-
-        LOG.debug("Prepare port statistics request for port {} of node {} - TrasactionId - {}",
-                arg0.getNodeConnectorId(), arg0.getNode().getValue(), xid);
-
-        // Create multipart request header
-        MultipartRequestInputBuilder mprInput = new MultipartRequestInputBuilder();
-        mprInput.setType(MultipartType.OFPMPPORTSTATS);
-        mprInput.setVersion(version);
-        mprInput.setXid(xid);
-        mprInput.setFlags(new MultipartRequestFlags(false));
-
-        // Create multipart request body to fetch stats for all the port of the
-        // node
-        MultipartRequestPortStatsCaseBuilder caseBuilder = new MultipartRequestPortStatsCaseBuilder();
-        MultipartRequestPortStatsBuilder mprPortStatsBuilder = new MultipartRequestPortStatsBuilder();
-
-        // Set specific port
-        mprPortStatsBuilder
-                .setPortNo(InventoryDataServiceUtil.portNumberfromNodeConnectorId(
-                        OpenflowVersion.get(version), arg0.getNodeConnectorId()));
-        caseBuilder.setMultipartRequestPortStats(mprPortStatsBuilder.build());
-
-        // Set request body to main multipart request
-        mprInput.setMultipartRequestBody(caseBuilder.build());
-
-        // Send the request, no cookies associated, use any connection
-        LOG.debug("Send port statistics request :{}", mprPortStatsBuilder.build().toString());
-        this.messageService.multipartRequest(mprInput.build(), null);
-
-        // Prepare rpc return output. Set xid and send it back.
-        GetNodeConnectorStatisticsOutputBuilder output = new GetNodeConnectorStatisticsOutputBuilder();
-        output.setTransactionId(generateTransactionId(xid));
-
-        Collection<RpcError> errors = Collections.emptyList();
-        RpcResult<GetNodeConnectorStatisticsOutput> rpcResult = Rpcs.getRpcResult(true, output.build(), errors);
-        return Futures.immediateFuture(rpcResult);
+            final GetNodeConnectorStatisticsInput input) {
+        LOG.debug("Calling the getNodeConnectorStatistics RPC method on MessageDispatchService");
+        SwitchConnectionDistinguisher cookie = null;
+        
+        OFRpcTask<GetNodeConnectorStatisticsInput, RpcResult<GetNodeConnectorStatisticsOutput>> task = 
+                OFRpcTaskFactory.createGetNodeConnectorStatisticsTask(rpcTaskContext, input, cookie);
+        ListenableFuture<RpcResult<GetNodeConnectorStatisticsOutput>> result = task.submit();
+        return result;
     }
 
     private static TransactionId generateTransactionId(final Long xid) {
         BigInteger bigIntXid = BigInteger.valueOf(xid);
         return new TransactionId(bigIntXid);
-
     }
-
+    
     @Override
     public Future<RpcResult<UpdatePortOutput>> updatePort(final UpdatePortInput input) {
-        PortModInput ofPortModInput = null;
-        RpcResult<UpdatePortOutput> rpcResultFromOFLib = null;
-
-        // For Flow provisioning, the SwitchConnectionDistinguisher is set to
-        // null so
-        // the request can be routed through any connection to the switch
-
+        LOG.debug("Calling the updatePort RPC method on MessageDispatchService");
+        
+        // use primary connection
         SwitchConnectionDistinguisher cookie = null;
-
-        // NSF sends a list of port and the ModelDrivenSwitch will
-        // send one port at a time towards the switch ( mutiple RPCs calls)
-        List<Port> inputPorts = input.getUpdatedPort().getPort().getPort();
-
-        // Get the Xid. The same Xid has to be sent in all the RPCs
-        Long Xid = sessionContext.getNextXid();
-
-        for (Port inputPort : inputPorts) {
-
-            // Convert the UpdateGroupInput to GroupModInput
-            ofPortModInput = PortConvertor.toPortModInput(inputPort, version);
-
-            // Insert the Xid ( transaction Id) before calling the RPC on the
-            // OFLibrary
-
-            PortModInputBuilder mdInput = new PortModInputBuilder(ofPortModInput);
-            mdInput.setXid(Xid);
-
-            LOG.debug("Calling the PortMod RPC method on MessageDispatchService");
-            Future<RpcResult<UpdatePortOutput>> resultFromOFLib = messageService.portMod(mdInput.build(), cookie);
-
-            try {
-                rpcResultFromOFLib = resultFromOFLib.get();
-            } catch (Exception ex) {
-                LOG.error(" Error while getting result for updatePort RPC" + ex.getMessage());
-            }
-
-            // The Future response value for all the RPCs except the last one is
-            // ignored
-
-        }
-        // Extract the Xid only from the Future for the last RPC and
-        // send it back to the NSF
-        UpdatePortOutput updatePortOutputOFLib = rpcResultFromOFLib.getResult();
-
-        UpdatePortOutputBuilder updatePortOutput = new UpdatePortOutputBuilder();
-        updatePortOutput.setTransactionId(updatePortOutputOFLib.getTransactionId());
-        UpdatePortOutput result = updatePortOutput.build();
-
-        Collection<RpcError> errors = rpcResultFromOFLib.getErrors();
-        RpcResult<UpdatePortOutput> rpcResult = Rpcs.getRpcResult(true, result, errors);
-
-        LOG.debug("Returning the Update Group RPC result to MD-SAL");
-        return Futures.immediateFuture(rpcResult);
-
+        
+        OFRpcTask<UpdatePortInput, RpcResult<UpdatePortOutput>> task = 
+                OFRpcTaskFactory.createUpdatePortTask(rpcTaskContext, input, cookie);
+        ListenableFuture<RpcResult<UpdatePortOutput>> result = task.submit();
+        
+        return result;
     }
 
     @Override
     public Future<RpcResult<UpdateTableOutput>> updateTable(final UpdateTableInput input) {
-
-        // Get the Xid. The same Xid has to be sent in all the Multipart
-        // requests
-        Long xid = this.getSessionContext().getNextXid();
-
-        LOG.debug("Prepare the Multipart Table Mod requests for Transaction Id {} ", xid);
-
-        // Create multipart request header
-        MultipartRequestInputBuilder mprInput = new MultipartRequestInputBuilder();
-        mprInput.setType(MultipartType.OFPMPTABLEFEATURES);
-        mprInput.setVersion((short) 0x04);
-        mprInput.setXid(xid);
-
-        // Convert the list of all MD-SAL table feature object into OF library
-        // object
-        List<TableFeatures> ofTableFeatureList = TableFeaturesConvertor.toTableFeaturesRequest(input.getUpdatedTable());
-
-        MultipartRequestTableFeaturesCaseBuilder caseRequest = new MultipartRequestTableFeaturesCaseBuilder();
-        MultipartRequestTableFeaturesBuilder tableFeaturesRequest = new MultipartRequestTableFeaturesBuilder();
-
-        mprInput.setFlags(new MultipartRequestFlags(false));
-
-        tableFeaturesRequest.setTableFeatures(ofTableFeatureList);
-
-        // Set request body to main multipart request
-        caseRequest.setMultipartRequestTableFeatures(tableFeaturesRequest.build());
-        mprInput.setMultipartRequestBody(caseRequest.build());
-
-        // Send the request, no cookies associated, use any connection
-        LOG.debug("Send Table Feature request :{}", ofTableFeatureList);
-        this.messageService.multipartRequest(mprInput.build(), null);
-
-        // Extract the Xid only from the Future for the last RPC and
-        // send it back to the NSF
-        LOG.debug("Returning the result and transaction id to NSF");
-        LOG.debug("Return results and transaction id back to caller");
-        UpdateTableOutputBuilder output = new UpdateTableOutputBuilder();
-        output.setTransactionId(generateTransactionId(xid));
-
-        Collection<RpcError> errors = Collections.emptyList();
-        RpcResult<UpdateTableOutput> rpcResult = Rpcs.getRpcResult(true, output.build(), errors);
-        return Futures.immediateFuture(rpcResult);
+        LOG.debug("Calling the updateTable RPC method on MessageDispatchService");
+        
+        SwitchConnectionDistinguisher cookie = null;
+        
+        OFRpcTask<UpdateTableInput, RpcResult<UpdateTableOutput>> task = 
+                OFRpcTaskFactory.createUpdateTableTask(rpcTaskContext, input, cookie);
+        ListenableFuture<RpcResult<UpdateTableOutput>> result = task.submit();
+        
+        return result;
     }
 
     @Override
     public Future<RpcResult<GetAllFlowStatisticsFromFlowTableOutput>> getAllFlowStatisticsFromFlowTable(
-            final GetAllFlowStatisticsFromFlowTableInput arg0) {
-
-        // Generate xid to associate it with the request
-        Long xid = this.getSessionContext().getNextXid();
-
-        LOG.debug("Prepare statistics request to get flow stats for switch tables {} - Transaction id - {}", arg0
-                .getTableId().getValue(), xid);
-
-        // Create multipart request header
-        MultipartRequestInputBuilder mprInput = new MultipartRequestInputBuilder();
-        mprInput.setType(MultipartType.OFPMPFLOW);
-        mprInput.setVersion(version);
-        mprInput.setXid(xid);
-        mprInput.setFlags(new MultipartRequestFlags(false));
-
-        // Create multipart request body for fetch all the group stats
-        MultipartRequestFlowCaseBuilder multipartRequestFlowCaseBuilder = new MultipartRequestFlowCaseBuilder();
-        MultipartRequestFlowBuilder mprFlowRequestBuilder = new MultipartRequestFlowBuilder();
-        mprFlowRequestBuilder.setTableId(arg0.getTableId().getValue());
-        mprFlowRequestBuilder.setOutPort(OFConstants.OFPP_ANY);
-        mprFlowRequestBuilder.setOutGroup(OFConstants.OFPG_ANY);
-        mprFlowRequestBuilder.setCookie(OFConstants.DEFAULT_COOKIE);
-        mprFlowRequestBuilder.setCookieMask(OFConstants.DEFAULT_COOKIE_MASK);
-        FlowCreatorUtil.setWildcardedFlowMatch(version, mprFlowRequestBuilder);
-
-        // Set request body to main multipart request
-        multipartRequestFlowCaseBuilder.setMultipartRequestFlow(mprFlowRequestBuilder.build());
-        mprInput.setMultipartRequestBody(multipartRequestFlowCaseBuilder.build());
-
-        // Send the request, no cookies associated, use any connection
-        LOG.debug("Send flow statistics request to the switch :{}", mprFlowRequestBuilder);
-        this.messageService.multipartRequest(mprInput.build(), null);
-
-        // Prepare rpc return output. Set xid and send it back.
-        LOG.debug("Return results and transaction id back to caller");
-        GetAllFlowStatisticsFromFlowTableOutputBuilder output = new GetAllFlowStatisticsFromFlowTableOutputBuilder();
-        output.setTransactionId(generateTransactionId(xid));
-        output.setFlowAndStatisticsMapList(null);
-
-        Collection<RpcError> errors = Collections.emptyList();
-        RpcResult<GetAllFlowStatisticsFromFlowTableOutput> rpcResult = Rpcs.getRpcResult(true, output.build(), errors);
-        return Futures.immediateFuture(rpcResult);
+            final GetAllFlowStatisticsFromFlowTableInput input) {
+        LOG.debug("Calling the getAllFlowStatisticsFromFlowTable RPC method on MessageDispatchService");
+        SwitchConnectionDistinguisher cookie = null;
+        
+        OFRpcTask<GetAllFlowStatisticsFromFlowTableInput, RpcResult<GetAllFlowStatisticsFromFlowTableOutput>> task = 
+                OFRpcTaskFactory.createGetAllFlowStatisticsFromFlowTableTask(rpcTaskContext, input, cookie);
+        ListenableFuture<RpcResult<GetAllFlowStatisticsFromFlowTableOutput>> result = task.submit();
+        return result;
     }
-
+    
     @Override
     public Future<RpcResult<GetAllFlowsStatisticsFromAllFlowTablesOutput>> getAllFlowsStatisticsFromAllFlowTables(
-            final GetAllFlowsStatisticsFromAllFlowTablesInput arg0) {
-
-        // Generate xid to associate it with the request
-        Long xid = this.getSessionContext().getNextXid();
-
-        LOG.debug("Prepare statistics request to get flow stats of all switch tables - Transaction id - {}", xid);
-
-        // Create multipart request header
-        MultipartRequestInputBuilder mprInput = new MultipartRequestInputBuilder();
-        mprInput.setType(MultipartType.OFPMPFLOW);
-        mprInput.setVersion(version);
-        mprInput.setXid(xid);
-        mprInput.setFlags(new MultipartRequestFlags(false));
-
-        // Create multipart request body for fetch all the group stats
-        MultipartRequestFlowCaseBuilder multipartRequestFlowCaseBuilder = new MultipartRequestFlowCaseBuilder();
-        MultipartRequestFlowBuilder mprFlowRequestBuilder = new MultipartRequestFlowBuilder();
-        mprFlowRequestBuilder.setTableId(OFConstants.OFPTT_ALL);
-        mprFlowRequestBuilder.setOutPort(OFConstants.OFPP_ANY);
-        mprFlowRequestBuilder.setOutGroup(OFConstants.OFPG_ANY);
-        mprFlowRequestBuilder.setCookie(OFConstants.DEFAULT_COOKIE);
-        mprFlowRequestBuilder.setCookieMask(OFConstants.DEFAULT_COOKIE_MASK);
-        mprFlowRequestBuilder.setCookieMask(OFConstants.DEFAULT_COOKIE_MASK);
-
-        FlowCreatorUtil.setWildcardedFlowMatch(version, mprFlowRequestBuilder);
-
-        // Set request body to main multipart request
-        multipartRequestFlowCaseBuilder.setMultipartRequestFlow(mprFlowRequestBuilder.build());
-        mprInput.setMultipartRequestBody(multipartRequestFlowCaseBuilder.build());
-
-        // Send the request, no cookies associated, use any connection
-        LOG.debug("Send flow statistics request to the switch :{}", mprFlowRequestBuilder);
-        this.messageService.multipartRequest(mprInput.build(), null);
-
-        // Prepare rpc return output. Set xid and send it back.
-        GetAllFlowsStatisticsFromAllFlowTablesOutputBuilder output = new GetAllFlowsStatisticsFromAllFlowTablesOutputBuilder();
-        output.setTransactionId(generateTransactionId(xid));
-        output.setFlowAndStatisticsMapList(null);
-
-        Collection<RpcError> errors = Collections.emptyList();
-        RpcResult<GetAllFlowsStatisticsFromAllFlowTablesOutput> rpcResult = Rpcs.getRpcResult(true, output.build(),
-                errors);
-        return Futures.immediateFuture(rpcResult);
-
+            final GetAllFlowsStatisticsFromAllFlowTablesInput input) {
+        LOG.debug("Calling the getAllFlowsStatisticsFromAllFlowTables RPC method on MessageDispatchService");
+        SwitchConnectionDistinguisher cookie = null;
+        
+        OFRpcTask<GetAllFlowsStatisticsFromAllFlowTablesInput, RpcResult<GetAllFlowsStatisticsFromAllFlowTablesOutput>> task = 
+                OFRpcTaskFactory.createGetAllFlowsStatisticsFromAllFlowTablesTask(rpcTaskContext, input, cookie);
+        ListenableFuture<RpcResult<GetAllFlowsStatisticsFromAllFlowTablesOutput>> result = task.submit();
+        return result;
     }
-
+    
     @Override
     public Future<RpcResult<GetFlowStatisticsFromFlowTableOutput>> getFlowStatisticsFromFlowTable(
-            final GetFlowStatisticsFromFlowTableInput arg0) {
-        // Generate xid to associate it with the request
-        Long xid = this.getSessionContext().getNextXid();
-
-        LOG.debug("Prepare statistics request to get stats for flow {} for switch tables {} - Transaction id - {}",
-                  arg0.getMatch() == null ? null : arg0.getMatch().toString(), arg0.getTableId(), xid);
-
-        // Create multipart request header
-        MultipartRequestInputBuilder mprInput = new MultipartRequestInputBuilder();
-        mprInput.setType(MultipartType.OFPMPFLOW);
-        mprInput.setVersion(version);
-        mprInput.setXid(xid);
-        mprInput.setFlags(new MultipartRequestFlags(false));
-
-        // Create multipart request body for fetch all the group stats
-        MultipartRequestFlowCaseBuilder multipartRequestFlowCaseBuilder = new MultipartRequestFlowCaseBuilder();
-        MultipartRequestFlowBuilder mprFlowRequestBuilder = new MultipartRequestFlowBuilder();
-        mprFlowRequestBuilder.setTableId(arg0.getTableId());
-
-        if (arg0.getOutPort() != null)
-            mprFlowRequestBuilder.setOutPort(arg0.getOutPort().longValue());
-        else
-            mprFlowRequestBuilder.setOutPort(OFConstants.OFPP_ANY);
-
-        if (arg0.getOutGroup() != null)
-            mprFlowRequestBuilder.setOutGroup(arg0.getOutGroup());
-        else
-            mprFlowRequestBuilder.setOutGroup(OFConstants.OFPG_ANY);
-
-        if (arg0.getCookie() != null)
-            mprFlowRequestBuilder.setCookie(arg0.getCookie().getValue());
-        else
-            mprFlowRequestBuilder.setCookie(OFConstants.DEFAULT_COOKIE);
-
-        if (arg0.getCookieMask() != null)
-            mprFlowRequestBuilder.setCookieMask(arg0.getCookieMask().getValue());
-        else
-            mprFlowRequestBuilder.setCookieMask(OFConstants.DEFAULT_COOKIE_MASK);
-
-        // convert and inject match
-        MatchReactor.getInstance().convert(arg0.getMatch(), version, mprFlowRequestBuilder,
-                this.getSessionContext().getFeatures().getDatapathId());
-
-        // Set request body to main multipart request
-        multipartRequestFlowCaseBuilder.setMultipartRequestFlow(mprFlowRequestBuilder.build());
-        mprInput.setMultipartRequestBody(multipartRequestFlowCaseBuilder.build());
-
-        // Send the request, no cookies associated, use any connection
-        LOG.debug("Send flow statistics request to the switch :{}", mprFlowRequestBuilder);
-        this.messageService.multipartRequest(mprInput.build(), null);
-
-        // Prepare rpc return output. Set xid and send it back.
-        GetFlowStatisticsFromFlowTableOutputBuilder output = new GetFlowStatisticsFromFlowTableOutputBuilder();
-        output.setTransactionId(generateTransactionId(xid));
-        output.setFlowAndStatisticsMapList(null);
-
-        Collection<RpcError> errors = Collections.emptyList();
-        RpcResult<GetFlowStatisticsFromFlowTableOutput> rpcResult = Rpcs.getRpcResult(true, output.build(), errors);
-        return Futures.immediateFuture(rpcResult);
+            final GetFlowStatisticsFromFlowTableInput input) {
+        LOG.debug("Calling the getFlowStatisticsFromFlowTable RPC method on MessageDispatchService");
+        SwitchConnectionDistinguisher cookie = null;
+        
+        OFRpcTask<GetFlowStatisticsFromFlowTableInput, RpcResult<GetFlowStatisticsFromFlowTableOutput>> task = 
+                OFRpcTaskFactory.createGetFlowStatisticsFromFlowTableTask(rpcTaskContext, input, cookie);
+        ListenableFuture<RpcResult<GetFlowStatisticsFromFlowTableOutput>> result = task.submit();
+        return result;
     }
-
+    
     @Override
     public Future<RpcResult<GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput>> getAggregateFlowStatisticsFromFlowTableForAllFlows(
-            final GetAggregateFlowStatisticsFromFlowTableForAllFlowsInput arg0) {
-        // Generate xid to associate it with the request
-        Long xid = this.getSessionContext().getNextXid();
-
-        LOG.debug(
-                "Prepare aggregate flow statistics request to get aggregate flow stats for all the flow installed on switch table {} - Transaction id - {}",
-                arg0.getTableId().getValue(), xid);
-
-        // Create multipart request header
-        MultipartRequestInputBuilder mprInput = new MultipartRequestInputBuilder();
-        mprInput.setType(MultipartType.OFPMPAGGREGATE);
-        mprInput.setVersion(version);
-        mprInput.setXid(xid);
-        mprInput.setFlags(new MultipartRequestFlags(false));
-
-        // Create multipart request body for fetch all the group stats
-        MultipartRequestAggregateCaseBuilder multipartRequestAggregateCaseBuilder = new MultipartRequestAggregateCaseBuilder();
-        MultipartRequestAggregateBuilder mprAggregateRequestBuilder = new MultipartRequestAggregateBuilder();
-        mprAggregateRequestBuilder.setTableId(arg0.getTableId().getValue());
-        mprAggregateRequestBuilder.setOutPort(OFConstants.OFPP_ANY);
-        mprAggregateRequestBuilder.setOutGroup(OFConstants.OFPG_ANY);
-        mprAggregateRequestBuilder.setCookie(OFConstants.DEFAULT_COOKIE);
-        mprAggregateRequestBuilder.setCookieMask(OFConstants.DEFAULT_COOKIE_MASK);
-
-        FlowCreatorUtil.setWildcardedFlowMatch(version, mprAggregateRequestBuilder);
-
-        // Set request body to main multipart request
-        multipartRequestAggregateCaseBuilder.setMultipartRequestAggregate(mprAggregateRequestBuilder.build());
-        mprInput.setMultipartRequestBody(multipartRequestAggregateCaseBuilder.build());
-
-        // Send the request, no cookies associated, use any connection
-        LOG.debug("Send request to the switch :{}", multipartRequestAggregateCaseBuilder.build().toString());
-        this.messageService.multipartRequest(mprInput.build(), null);
-
-        // Prepare rpc return output. Set xid and send it back.
-        GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutputBuilder output = new GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutputBuilder();
-        output.setTransactionId(generateTransactionId(xid));
-
-        Collection<RpcError> errors = Collections.emptyList();
-        RpcResult<GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput> rpcResult = Rpcs.getRpcResult(true,
-                output.build(), errors);
-        return Futures.immediateFuture(rpcResult);
+            final GetAggregateFlowStatisticsFromFlowTableForAllFlowsInput input) {
+        LOG.debug("Calling the getAggregateFlowStatisticsFromFlowTableForAllFlows RPC method on MessageDispatchService");
+        SwitchConnectionDistinguisher cookie = null;
+        
+        OFRpcTask<GetAggregateFlowStatisticsFromFlowTableForAllFlowsInput, RpcResult<GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput>> task = 
+                OFRpcTaskFactory.createGetAggregateFlowStatisticsFromFlowTableForAllFlowsTask(rpcTaskContext, input, cookie);
+        ListenableFuture<RpcResult<GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput>> result = task.submit();
+        return result;
     }
-
+    
     @Override
     public Future<RpcResult<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput>> getAggregateFlowStatisticsFromFlowTableForGivenMatch(
-            final GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput arg0) {
-
-        // Generate xid to associate it with the request
-        Long xid = this.getSessionContext().getNextXid();
-
-        LOG.debug(
-                "Prepare aggregate statistics request to get aggregate stats for flows matching {} and installed in flow tables {} - Transaction id - {}",
-                arg0.getMatch().toString(), arg0.getTableId(), xid);
-
-        // Create multipart request header
-        MultipartRequestInputBuilder mprInput = new MultipartRequestInputBuilder();
-        mprInput.setType(MultipartType.OFPMPAGGREGATE);
-        mprInput.setVersion(version);
-        mprInput.setXid(xid);
-        mprInput.setFlags(new MultipartRequestFlags(false));
-
-        // Create multipart request body for fetch all the group stats
-        MultipartRequestAggregateCaseBuilder multipartRequestAggregateCaseBuilder = new MultipartRequestAggregateCaseBuilder();
-        MultipartRequestAggregateBuilder mprAggregateRequestBuilder = new MultipartRequestAggregateBuilder();
-        mprAggregateRequestBuilder.setTableId(arg0.getTableId());
-        mprAggregateRequestBuilder.setOutPort(arg0.getOutPort().longValue());
-        mprAggregateRequestBuilder.setOutGroup(OFConstants.OFPG_ANY);
-        mprAggregateRequestBuilder.setCookie(OFConstants.DEFAULT_COOKIE);
-        mprAggregateRequestBuilder.setCookieMask(OFConstants.DEFAULT_COOKIE_MASK);
-
-        MatchReactor.getInstance().convert(arg0.getMatch(), version, mprAggregateRequestBuilder,
-                this.getSessionContext().getFeatures().getDatapathId());
-        // TODO: repeating code
-        if (version == OFConstants.OFP_VERSION_1_3) {
-            mprAggregateRequestBuilder.setCookie(arg0.getCookie().getValue());
-            mprAggregateRequestBuilder.setCookieMask(arg0.getCookieMask().getValue());
-            mprAggregateRequestBuilder.setOutGroup(arg0.getOutGroup());
-        }
-
-        // Set request body to main multipart request
-        multipartRequestAggregateCaseBuilder.setMultipartRequestAggregate(mprAggregateRequestBuilder.build());
-        mprInput.setMultipartRequestBody(multipartRequestAggregateCaseBuilder.build());
-
-        // Send the request, no cookies associated, use any connection
-        LOG.debug("Send request to the switch :{}", multipartRequestAggregateCaseBuilder.build().toString());
-        this.messageService.multipartRequest(mprInput.build(), null);
-
-        // Prepare rpc return output. Set xid and send it back.
-        GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutputBuilder output = new GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutputBuilder();
-        output.setTransactionId(generateTransactionId(xid));
-
-        Collection<RpcError> errors = Collections.emptyList();
-        RpcResult<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput> rpcResult = Rpcs.getRpcResult(true,
-                output.build(), errors);
-        return Futures.immediateFuture(rpcResult);
+            final GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput input) {
+        LOG.debug("Calling the getAggregateFlowStatisticsFromFlowTableForGivenMatch RPC method on MessageDispatchService");
+        SwitchConnectionDistinguisher cookie = null;
+        
+        OFRpcTask<GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput, RpcResult<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput>> task = 
+                OFRpcTaskFactory.createGetAggregateFlowStatisticsFromFlowTableForGivenMatchTask(rpcTaskContext, input, cookie);
+        ListenableFuture<RpcResult<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput>> result = task.submit();
+        return result;
     }
-
+    
     @Override
-    public Future<RpcResult<GetFlowTablesStatisticsOutput>> getFlowTablesStatistics(final GetFlowTablesStatisticsInput arg0) {
-        // Generate xid to associate it with the request
-        Long xid = this.getSessionContext().getNextXid();
-
-        LOG.debug("Prepare flow table statistics request to get flow table stats for all tables "
-                + "from node {}- Transaction id - {}", arg0.getNode(), xid);
-
-        // Create multipart request header
-        MultipartRequestInputBuilder mprInput = new MultipartRequestInputBuilder();
-        mprInput.setType(MultipartType.OFPMPTABLE);
-        mprInput.setVersion(version);
-        mprInput.setXid(xid);
-        mprInput.setFlags(new MultipartRequestFlags(false));
-
-        // Create multipart request body for fetch all the group stats
-        MultipartRequestTableCaseBuilder multipartRequestTableCaseBuilder = new MultipartRequestTableCaseBuilder();
-        MultipartRequestTableBuilder multipartRequestTableBuilder = new MultipartRequestTableBuilder();
-        multipartRequestTableBuilder.setEmpty(true);
-        multipartRequestTableCaseBuilder.setMultipartRequestTable(multipartRequestTableBuilder.build());
-
-        // Set request body to main multipart request
-        mprInput.setMultipartRequestBody(multipartRequestTableCaseBuilder.build());
-
-        // Send the request, no cookies associated, use any connection
-        LOG.debug("Send request to the switch :{}", multipartRequestTableCaseBuilder.build().toString());
-        this.messageService.multipartRequest(mprInput.build(), null);
-
-        // Prepare rpc return output. Set xid and send it back.
-        GetFlowTablesStatisticsOutputBuilder output = new GetFlowTablesStatisticsOutputBuilder();
-        output.setTransactionId(generateTransactionId(xid));
-
-        Collection<RpcError> errors = Collections.emptyList();
-        RpcResult<GetFlowTablesStatisticsOutput> rpcResult = Rpcs.getRpcResult(true, output.build(), errors);
-        return Futures.immediateFuture(rpcResult);
+    public Future<RpcResult<GetFlowTablesStatisticsOutput>> getFlowTablesStatistics(
+            final GetFlowTablesStatisticsInput input) {
+        LOG.debug("Calling the getFlowTablesStatistics RPC method on MessageDispatchService");
+        SwitchConnectionDistinguisher cookie = null;
+        
+        OFRpcTask<GetFlowTablesStatisticsInput, RpcResult<GetFlowTablesStatisticsOutput>> task = 
+                OFRpcTaskFactory.createGetFlowTablesStatisticsTask(rpcTaskContext, input, cookie);
+        ListenableFuture<RpcResult<GetFlowTablesStatisticsOutput>> result = task.submit();
+        return result;
     }
-
+    
     @Override
     public Future<RpcResult<GetAllQueuesStatisticsFromAllPortsOutput>> getAllQueuesStatisticsFromAllPorts(
-            final GetAllQueuesStatisticsFromAllPortsInput arg0) {
-        // Generate xid to associate it with the request
-        Long xid = this.getSessionContext().getNextXid();
-
-        LOG.debug(
-                "Prepare queue statistics request to collect stats for all queues attached to all the ports of node {} - TrasactionId - {}",
-                arg0.getNode().getValue(), xid);
-
-        // Create multipart request header
-        MultipartRequestInputBuilder mprInput = new MultipartRequestInputBuilder();
-        mprInput.setType(MultipartType.OFPMPQUEUE);
-        mprInput.setVersion(version);
-        mprInput.setXid(xid);
-        mprInput.setFlags(new MultipartRequestFlags(false));
-
-        // Create multipart request body to fetch stats for all the port of the
-        // node
-        MultipartRequestQueueCaseBuilder caseBuilder = new MultipartRequestQueueCaseBuilder();
-        MultipartRequestQueueBuilder mprQueueBuilder = new MultipartRequestQueueBuilder();
-        // Select all ports
-        mprQueueBuilder.setPortNo(OFConstants.OFPP_ANY);
-        // Select all the ports
-        mprQueueBuilder.setQueueId(OFConstants.OFPQ_ANY);
-
-        caseBuilder.setMultipartRequestQueue(mprQueueBuilder.build());
-
-        // Set request body to main multipart request
-        mprInput.setMultipartRequestBody(caseBuilder.build());
-
-        // Send the request, no cookies associated, use any connection
-        LOG.debug("Send queue statistics request :{}", mprQueueBuilder.build().toString());
-        this.messageService.multipartRequest(mprInput.build(), null);
-
-        // Prepare rpc return output. Set xid and send it back.
-        GetAllQueuesStatisticsFromAllPortsOutputBuilder output = new GetAllQueuesStatisticsFromAllPortsOutputBuilder();
-        output.setTransactionId(generateTransactionId(xid));
-        output.setQueueIdAndStatisticsMap(null);
-
-        Collection<RpcError> errors = Collections.emptyList();
-        RpcResult<GetAllQueuesStatisticsFromAllPortsOutput> rpcResult = Rpcs.getRpcResult(true, output.build(), errors);
-        return Futures.immediateFuture(rpcResult);
+            final GetAllQueuesStatisticsFromAllPortsInput input) {
+        LOG.debug("Calling the getAllQueuesStatisticsFromAllPorts RPC method on MessageDispatchService");
+        SwitchConnectionDistinguisher cookie = null;
+        
+        OFRpcTask<GetAllQueuesStatisticsFromAllPortsInput, RpcResult<GetAllQueuesStatisticsFromAllPortsOutput>> task = 
+                OFRpcTaskFactory.createGetAllQueuesStatisticsFromAllPortsTask(rpcTaskContext, input, cookie);
+        ListenableFuture<RpcResult<GetAllQueuesStatisticsFromAllPortsOutput>> result = task.submit();
+        return result;
     }
-
+    
     @Override
     public Future<RpcResult<GetAllQueuesStatisticsFromGivenPortOutput>> getAllQueuesStatisticsFromGivenPort(
-            final GetAllQueuesStatisticsFromGivenPortInput arg0) {
-        // Generate xid to associate it with the request
-        Long xid = this.getSessionContext().getNextXid();
-
-        LOG.debug("Prepare queue statistics request to collect stats for "
-                + "all queues attached to given port {} of node {} - TrasactionId - {}", arg0.getNodeConnectorId()
-                .toString(), arg0.getNode().getValue(), xid);
-
-        // Create multipart request header
-        MultipartRequestInputBuilder mprInput = new MultipartRequestInputBuilder();
-        mprInput.setType(MultipartType.OFPMPQUEUE);
-        mprInput.setVersion(version);
-        mprInput.setXid(xid);
-        mprInput.setFlags(new MultipartRequestFlags(false));
-
-        // Create multipart request body to fetch stats for all the port of the
-        // node
-        MultipartRequestQueueCaseBuilder caseBuilder = new MultipartRequestQueueCaseBuilder();
-        MultipartRequestQueueBuilder mprQueueBuilder = new MultipartRequestQueueBuilder();
-        // Select all queues
-        mprQueueBuilder.setQueueId(OFConstants.OFPQ_ANY);
-        // Select specific port
-        mprQueueBuilder.setPortNo(InventoryDataServiceUtil.portNumberfromNodeConnectorId(
-                OpenflowVersion.get(version),
-                arg0.getNodeConnectorId()));
-
-        caseBuilder.setMultipartRequestQueue(mprQueueBuilder.build());
-
-        // Set request body to main multipart request
-        mprInput.setMultipartRequestBody(caseBuilder.build());
-
-        // Send the request, no cookies associated, use any connection
-        LOG.debug("Send queue statistics request :{}", mprQueueBuilder.build().toString());
-        this.messageService.multipartRequest(mprInput.build(), null);
-
-        // Prepare rpc return output. Set xid and send it back.
-        GetAllQueuesStatisticsFromGivenPortOutputBuilder output = new GetAllQueuesStatisticsFromGivenPortOutputBuilder();
-        output.setTransactionId(generateTransactionId(xid));
-        output.setQueueIdAndStatisticsMap(null);
-
-        Collection<RpcError> errors = Collections.emptyList();
-        RpcResult<GetAllQueuesStatisticsFromGivenPortOutput> rpcResult = Rpcs
-                .getRpcResult(true, output.build(), errors);
-        return Futures.immediateFuture(rpcResult);
+            final GetAllQueuesStatisticsFromGivenPortInput input) {
+        LOG.debug("Calling the getAllQueuesStatisticsFromGivenPort RPC method on MessageDispatchService");
+        SwitchConnectionDistinguisher cookie = null;
+        
+        OFRpcTask<GetAllQueuesStatisticsFromGivenPortInput, RpcResult<GetAllQueuesStatisticsFromGivenPortOutput>> task = 
+                OFRpcTaskFactory.createGetAllQueuesStatisticsFromGivenPortTask(rpcTaskContext, input, cookie);
+        ListenableFuture<RpcResult<GetAllQueuesStatisticsFromGivenPortOutput>> result = task.submit();
+        return result;
     }
-
+    
     @Override
     public Future<RpcResult<GetQueueStatisticsFromGivenPortOutput>> getQueueStatisticsFromGivenPort(
-            final GetQueueStatisticsFromGivenPortInput arg0) {
-        // Generate xid to associate it with the request
-        Long xid = this.getSessionContext().getNextXid();
-
-        LOG.debug("Prepare queue statistics request to collect stats for "
-                + "given queue attached to given port {} of node {} - TrasactionId - {}", arg0.getQueueId().toString(),
-                arg0.getNodeConnectorId().toString(), arg0.getNode().getValue(), xid);
-
-        // Create multipart request header
-        MultipartRequestInputBuilder mprInput = new MultipartRequestInputBuilder();
-        mprInput.setType(MultipartType.OFPMPQUEUE);
-        mprInput.setVersion(version);
-        mprInput.setXid(xid);
-        mprInput.setFlags(new MultipartRequestFlags(false));
-
-        // Create multipart request body to fetch stats for all the port of the
-        // node
-        MultipartRequestQueueCaseBuilder caseBuilder = new MultipartRequestQueueCaseBuilder();
-        MultipartRequestQueueBuilder mprQueueBuilder = new MultipartRequestQueueBuilder();
-        // Select specific queue
-        mprQueueBuilder.setQueueId(arg0.getQueueId().getValue());
-        // Select specific port
-        mprQueueBuilder.setPortNo(InventoryDataServiceUtil.portNumberfromNodeConnectorId(OpenflowVersion.get(version),
-                arg0.getNodeConnectorId()));
-
-        caseBuilder.setMultipartRequestQueue(mprQueueBuilder.build());
-
-        // Set request body to main multipart request
-        mprInput.setMultipartRequestBody(caseBuilder.build());
-
-        // Send the request, no cookies associated, use any connection
-        LOG.debug("Send queue statistics request :{}", mprQueueBuilder.build().toString());
-        this.messageService.multipartRequest(mprInput.build(), null);
-
-        // Prepare rpc return output. Set xid and send it back.
-        GetQueueStatisticsFromGivenPortOutputBuilder output = new GetQueueStatisticsFromGivenPortOutputBuilder();
-        output.setTransactionId(generateTransactionId(xid));
-        output.setQueueIdAndStatisticsMap(null);
-
-        Collection<RpcError> errors = Collections.emptyList();
-        RpcResult<GetQueueStatisticsFromGivenPortOutput> rpcResult = Rpcs.getRpcResult(true, output.build(), errors);
-        return Futures.immediateFuture(rpcResult);
+            final GetQueueStatisticsFromGivenPortInput input) {
+        LOG.debug("Calling the getQueueStatisticsFromGivenPort RPC method on MessageDispatchService");
+        SwitchConnectionDistinguisher cookie = null;
+        
+        OFRpcTask<GetQueueStatisticsFromGivenPortInput, RpcResult<GetQueueStatisticsFromGivenPortOutput>> task = 
+                OFRpcTaskFactory.createGetQueueStatisticsFromGivenPortTask(rpcTaskContext, input, cookie);
+        ListenableFuture<RpcResult<GetQueueStatisticsFromGivenPortOutput>> result = task.submit();
+        return result;
     }
 }
index b2c1a42817d6e2befd8574019f7ad09deb6df90f..aa8982043e7e8126d90fc402e31ff45177c8ee97 100644 (file)
@@ -12,12 +12,18 @@ import java.util.Collection;
 import org.opendaylight.controller.sal.common.util.Rpcs;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.RemoveFlowOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.RemoveFlowOutputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.UpdateFlowOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.AddGroupOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.AddGroupOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.RemoveGroupOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.RemoveGroupOutputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.UpdateGroupOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.AddMeterOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.AddMeterOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.RemoveMeterOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.RemoveMeterOutputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.UpdateMeterOutput;
 import org.opendaylight.yangtools.yang.common.RpcError;
 import org.opendaylight.yangtools.yang.common.RpcResult;
@@ -68,6 +74,29 @@ public abstract class OFRpcFutureResultTransformFactory {
         };
     }
     
+    /**
+     * @return translator from {@link UpdateFlowOutput} to {@link RemoveFlowOutput}
+     */
+    public static Function<RpcResult<UpdateFlowOutput>,RpcResult<RemoveFlowOutput>> createForRemoveFlowOutput() {
+        return new Function<RpcResult<UpdateFlowOutput>,RpcResult<RemoveFlowOutput>>() {
+
+            @Override
+            public RpcResult<RemoveFlowOutput> apply(RpcResult<UpdateFlowOutput> input) {
+
+                UpdateFlowOutput updateFlowOutput = input.getResult();
+
+                RemoveFlowOutputBuilder removeFlowOutput = new RemoveFlowOutputBuilder();
+                removeFlowOutput.setTransactionId(updateFlowOutput.getTransactionId());
+                RemoveFlowOutput result = removeFlowOutput.build();
+
+                RpcResult<RemoveFlowOutput> rpcResult = assembleRpcResult(input, result);
+                LOG.debug("Returning the Add Flow RPC result to MD-SAL");
+                return rpcResult;
+            }
+
+        };
+    }
+    
     /**
      * @return translator from {@link UpdateGroupOutput} to {@link AddGroupOutput}
      */
@@ -75,7 +104,7 @@ public abstract class OFRpcFutureResultTransformFactory {
         return new Function<RpcResult<UpdateGroupOutput>,RpcResult<AddGroupOutput>>() {
 
             @Override
-            public RpcResult<AddGroupOutput> apply(RpcResult<UpdateGroupOutput> input) {
+            public RpcResult<AddGroupOutput> apply(final RpcResult<UpdateGroupOutput> input) {
                 UpdateGroupOutput updateGroupOutput = input.getResult();
                 
                 AddGroupOutputBuilder addGroupOutput = new AddGroupOutputBuilder();
@@ -90,7 +119,30 @@ public abstract class OFRpcFutureResultTransformFactory {
     }
     
     /**
-     * @return translator from {@link UpdateGroupOutput} to {@link AddGroupOutput}
+     * @return
+     */
+    public static Function<RpcResult<UpdateGroupOutput>,RpcResult<RemoveGroupOutput>> createForRemoveGroupOutput() {
+        return new Function<RpcResult<UpdateGroupOutput>,RpcResult<RemoveGroupOutput>>() {
+
+            @Override
+            public RpcResult<RemoveGroupOutput> apply(RpcResult<UpdateGroupOutput> input) {
+
+                UpdateGroupOutput updateGroupOutput = input.getResult();
+
+                RemoveGroupOutputBuilder removeGroupOutput = new RemoveGroupOutputBuilder();
+                removeGroupOutput.setTransactionId(updateGroupOutput.getTransactionId());
+                RemoveGroupOutput result = removeGroupOutput.build();
+
+                RpcResult<RemoveGroupOutput> rpcResult = assembleRpcResult(input, result);
+                LOG.debug("Returning the Add Flow RPC result to MD-SAL");
+                return rpcResult;
+            }
+
+        };
+    }
+    
+    /**
+     * @return translator from {@link UpdateMeterOutput} to {@link AddMeterOutput}
      */
     public static Function<RpcResult<UpdateMeterOutput>, RpcResult<AddMeterOutput>> createForAddMeterOutput() {
         return new Function<RpcResult<UpdateMeterOutput>,RpcResult<AddMeterOutput>>() {
@@ -111,6 +163,28 @@ public abstract class OFRpcFutureResultTransformFactory {
     }
     
     
+    /**
+     * @return
+     */
+    public static Function<RpcResult<UpdateMeterOutput>, RpcResult<RemoveMeterOutput>> createForRemoveMeterOutput() {
+        return new Function<RpcResult<UpdateMeterOutput>,RpcResult<RemoveMeterOutput>>() {
+
+            @Override
+            public RpcResult<RemoveMeterOutput> apply(final RpcResult<UpdateMeterOutput> input) {
+                UpdateMeterOutput updateMeterOutput = input.getResult();
+                
+                RemoveMeterOutputBuilder removeMeterOutput = new RemoveMeterOutputBuilder();
+                removeMeterOutput.setTransactionId(updateMeterOutput.getTransactionId());
+                RemoveMeterOutput result = removeMeterOutput.build();
+
+                RpcResult<RemoveMeterOutput> rpcResult = assembleRpcResult(input, result);
+                LOG.debug("Returning the Add Meter RPC result to MD-SAL");
+                return rpcResult;
+            }
+        };
+    }
+    
+    
     
     
 }
index 85169406cac456a2916f2c04ec1485731b51028d..a3f54f7e83fd6ff62cf01e350d94c84f2520b3cd 100644 (file)
  */
 package org.opendaylight.openflowplugin.openflow.md.core.sal;
 
-import com.google.common.util.concurrent.JdkFutureAdapters;
-import com.google.common.util.concurrent.ListenableFuture;
-import com.google.common.util.concurrent.SettableFuture;
+import java.math.BigInteger;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.concurrent.Future;
+
+import org.opendaylight.controller.sal.common.util.RpcErrors;
+import org.opendaylight.controller.sal.common.util.Rpcs;
+import org.opendaylight.openflowjava.protocol.api.util.BinContent;
+import org.opendaylight.openflowplugin.openflow.md.OFConstants;
 import org.opendaylight.openflowplugin.openflow.md.core.SwitchConnectionDistinguisher;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.FlowConvertor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.GroupConvertor;
 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.MeterConvertor;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.PortConvertor;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.TableFeaturesConvertor;
+import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.MatchReactor;
+import org.opendaylight.openflowplugin.openflow.md.util.FlowCreatorUtil;
+import org.opendaylight.openflowplugin.openflow.md.util.InventoryDataServiceUtil;
+import org.opendaylight.openflowplugin.openflow.md.util.OpenflowVersion;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowInputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowAdded;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowAddedBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowRemoved;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowRemovedBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowUpdated;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowUpdatedBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.RemoveFlowInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.RemoveFlowInputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.UpdateFlowInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.UpdateFlowOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForAllFlowsInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowStatisticsFromFlowTableInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowStatisticsFromFlowTableOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowStatisticsFromFlowTableOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowsStatisticsFromAllFlowTablesInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowsStatisticsFromAllFlowTablesOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowsStatisticsFromAllFlowTablesOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetFlowStatisticsFromFlowTableInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetFlowStatisticsFromFlowTableOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetFlowStatisticsFromFlowTableOutputBuilder;
+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.GetFlowTablesStatisticsOutputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev131103.TransactionId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.port.mod.port.Port;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.Flow;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.AddGroupInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.GroupAdded;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.GroupAddedBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.GroupRemoved;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.GroupRemovedBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.GroupUpdated;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.GroupUpdatedBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.RemoveGroupInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.UpdateGroupInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.UpdateGroupOutput;
+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.GetAllGroupStatisticsOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupDescriptionInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupDescriptionOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupDescriptionOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupFeaturesInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupFeaturesOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupFeaturesOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupStatisticsInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupStatisticsOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupStatisticsOutputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.Group;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.AddMeterInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.MeterAdded;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.MeterAddedBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.MeterRemoved;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.MeterRemovedBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.MeterUpdated;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.MeterUpdatedBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.RemoveMeterInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.UpdateMeterInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.UpdateMeterOutput;
+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.GetAllMeterConfigStatisticsOutputBuilder;
+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.GetAllMeterStatisticsOutputBuilder;
+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.GetMeterFeaturesOutputBuilder;
+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.GetMeterStatisticsOutputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.Meter;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.GroupId;
+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.MultipartRequestFlags;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowModInputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GroupModInputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MeterModInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortModInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortModInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestAggregateCaseBuilder;
+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.MultipartRequestGroupCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestGroupDescCaseBuilder;
+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.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.MultipartRequestPortStatsCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestQueueCaseBuilder;
+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.MultipartRequestTableFeaturesCaseBuilder;
+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.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.group._case.MultipartRequestGroupBuilder;
+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.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.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.queue._case.MultipartRequestQueueBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.table._case.MultipartRequestTableBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.table.features._case.MultipartRequestTableFeaturesBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.table.features._case.multipart.request.table.features.TableFeatures;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.port.service.rev131107.UpdatePortInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.port.service.rev131107.UpdatePortOutput;
+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.GetAllNodeConnectorsStatisticsOutputBuilder;
+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.GetNodeConnectorStatisticsOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.GetAllQueuesStatisticsFromAllPortsInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.GetAllQueuesStatisticsFromAllPortsOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.GetAllQueuesStatisticsFromAllPortsOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.GetAllQueuesStatisticsFromGivenPortInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.GetAllQueuesStatisticsFromGivenPortOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.GetAllQueuesStatisticsFromGivenPortOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.GetQueueStatisticsFromGivenPortInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.GetQueueStatisticsFromGivenPortOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.GetQueueStatisticsFromGivenPortOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.UpdateTableInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.UpdateTableOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.UpdateTableOutputBuilder;
 import org.opendaylight.yangtools.yang.common.RpcError;
+import org.opendaylight.yangtools.yang.common.RpcError.ErrorSeverity;
+import org.opendaylight.yangtools.yang.common.RpcError.ErrorType;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 
-import java.math.BigInteger;
-import java.util.Collection;
-import java.util.concurrent.Future;
+import com.google.common.util.concurrent.FutureCallback;
+import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.JdkFutureAdapters;
+import com.google.common.util.concurrent.ListenableFuture;
+import com.google.common.util.concurrent.SettableFuture;
 
 /**
  *
@@ -428,4 +546,1343 @@ public abstract class OFRpcTaskFactory {
             }
         };
     }
+    
+    
+    /**
+     * @param taskContext
+     * @param input
+     * @param cookie
+     * @return task
+     */
+    public static OFRpcTask<RemoveFlowInput, RpcResult<UpdateFlowOutput>> createRemoveFlowTask(
+            OFRpcTaskContext taskContext, RemoveFlowInput input,
+            SwitchConnectionDistinguisher cookie) {
+        OFRpcTask<RemoveFlowInput, RpcResult<UpdateFlowOutput>> task = 
+                new OFRpcTask<RemoveFlowInput, RpcResult<UpdateFlowOutput>>(taskContext, cookie, input) {
+            
+            @Override
+            public ListenableFuture<RpcResult<UpdateFlowOutput>> call() {
+                ListenableFuture<RpcResult<UpdateFlowOutput>> result = SettableFuture.create();
+                
+                Collection<RpcError> barrierErrors = OFRpcTaskUtil.manageBarrier(getTaskContext(), getInput().isBarrier(), getCookie());
+                if (!barrierErrors.isEmpty()) {
+                    OFRpcTaskUtil.wrapBarrierErrors(((SettableFuture<RpcResult<UpdateFlowOutput>>) result), barrierErrors);
+                } else {
+                    // Convert the AddFlowInput to FlowModInput
+                    FlowModInputBuilder ofFlowModInput = FlowConvertor.toFlowModInput(getInput(), 
+                            getVersion(), getSession().getFeatures().getDatapathId());
+                    final Long xId = getSession().getNextXid();
+                    ofFlowModInput.setXid(xId);
+                    
+                    Future<RpcResult<UpdateFlowOutput>> resultFromOFLib = 
+                            getMessageService().flowMod(ofFlowModInput.build(), getCookie());
+                    result = JdkFutureAdapters.listenInPoolThread(resultFromOFLib);
+                    
+                    OFRpcTaskUtil.hookFutureNotification(this, result, 
+                            getRpcNotificationProviderService(), createFlowRemovedNotification(xId, getInput()));
+                }
+
+                return result;
+            }
+        };
+        
+        return task;
+    }
+    
+    /**
+     * @param xId
+     * @return
+     */
+    protected static NotificationComposer<FlowRemoved> createFlowRemovedNotification(
+            final Long xId, final RemoveFlowInput input) {
+        return new NotificationComposer<FlowRemoved>() {
+            @Override
+            public FlowRemoved compose() {
+                FlowRemovedBuilder removedFlow = new FlowRemovedBuilder((Flow) input);
+                removedFlow.setTransactionId(new TransactionId(BigInteger.valueOf(xId.intValue())));
+                removedFlow.setFlowRef(input.getFlowRef());
+                return removedFlow.build();
+            }
+        };
+    }
+    
+    
+    /**
+     * @param taskContext
+     * @param input
+     * @param cookie
+     * @return task
+     */
+    public static OFRpcTask<RemoveGroupInput, RpcResult<UpdateGroupOutput>> createRemoveGroupTask(
+            final OFRpcTaskContext taskContext, RemoveGroupInput input, 
+            final SwitchConnectionDistinguisher cookie) {
+        OFRpcTask<RemoveGroupInput, RpcResult<UpdateGroupOutput>> task = 
+                new OFRpcTask<RemoveGroupInput, RpcResult<UpdateGroupOutput>>(taskContext, cookie, input) {
+            
+            @Override
+            public ListenableFuture<RpcResult<UpdateGroupOutput>> call() {
+                ListenableFuture<RpcResult<UpdateGroupOutput>> result = SettableFuture.create();
+                
+                Collection<RpcError> barrierErrors = OFRpcTaskUtil.manageBarrier(getTaskContext(), getInput().isBarrier(), getCookie());
+                if (!barrierErrors.isEmpty()) {
+                    OFRpcTaskUtil.wrapBarrierErrors(((SettableFuture<RpcResult<UpdateGroupOutput>>) result), barrierErrors);
+                } else {
+                    // Convert the AddGroupInput to GroupModInput
+                    GroupModInputBuilder ofGroupModInput = GroupConvertor.toGroupModInput(getInput(), 
+                            getVersion(), getSession().getFeatures().getDatapathId());
+                    final Long xId = getSession().getNextXid();
+                    ofGroupModInput.setXid(xId);
+                    
+                    Future<RpcResult<UpdateGroupOutput>> resultFromOFLib = getMessageService()
+                            .groupMod(ofGroupModInput.build(), getCookie());
+                    result = JdkFutureAdapters.listenInPoolThread(resultFromOFLib);
+                    
+                    OFRpcTaskUtil.hookFutureNotification(this, result, 
+                            getRpcNotificationProviderService(), createGroupRemovedNotification(xId, getInput()));
+                }
+
+                return result;
+            }
+        };
+        
+        return task;
+    }
+    
+    /**
+     * @param xId
+     * @param input
+     * @return 
+     */
+    protected static NotificationComposer<GroupRemoved> createGroupRemovedNotification(
+            final Long xId, final RemoveGroupInput input) {
+        return new NotificationComposer<GroupRemoved>() {
+            @Override
+            public GroupRemoved compose() {
+                GroupRemovedBuilder removedGroup = new GroupRemovedBuilder((Group) input);
+                removedGroup.setTransactionId(new TransactionId(BigInteger.valueOf(xId.intValue())));
+                removedGroup.setGroupRef(input.getGroupRef());
+                return removedGroup.build();
+            }
+        };
+    }
+    
+    /**
+     * @param taskContext
+     * @param input
+     * @param cookie
+     * @return task
+     */
+    public static OFRpcTask<RemoveMeterInput, RpcResult<UpdateMeterOutput>> createRemoveMeterTask(
+            OFRpcTaskContext taskContext, RemoveMeterInput input,
+            SwitchConnectionDistinguisher cookie) {
+        OFRpcTask<RemoveMeterInput, RpcResult<UpdateMeterOutput>> task = 
+                new OFRpcTask<RemoveMeterInput, RpcResult<UpdateMeterOutput>>(taskContext, cookie, input) {
+            
+            @Override
+            public ListenableFuture<RpcResult<UpdateMeterOutput>> call() {
+                ListenableFuture<RpcResult<UpdateMeterOutput>> result = SettableFuture.create();
+                
+                Collection<RpcError> barrierErrors = OFRpcTaskUtil.manageBarrier(getTaskContext(), getInput().isBarrier(), getCookie());
+                if (!barrierErrors.isEmpty()) {
+                    OFRpcTaskUtil.wrapBarrierErrors(((SettableFuture<RpcResult<UpdateMeterOutput>>) result), barrierErrors);
+                } else {
+                    // Convert the AddGroupInput to GroupModInput
+                    MeterModInputBuilder ofMeterModInput = MeterConvertor.toMeterModInput(getInput(), getVersion());
+                    final Long xId = getSession().getNextXid();
+                    ofMeterModInput.setXid(xId);
+                    
+                    Future<RpcResult<UpdateMeterOutput>> resultFromOFLib = getMessageService()
+                            .meterMod(ofMeterModInput.build(), getCookie());
+                    result = JdkFutureAdapters.listenInPoolThread(resultFromOFLib);
+                    
+                    OFRpcTaskUtil.hookFutureNotification(this, result, 
+                            getRpcNotificationProviderService(), createMeterRemovedNotification(xId, getInput()));
+                }
+
+                return result;
+            }
+        };
+        
+        return task;
+        
+    }
+    
+    /**
+     * @param xId
+     * @param input
+     * @return
+     */
+    protected static NotificationComposer<MeterRemoved> createMeterRemovedNotification(
+            final Long xId, final RemoveMeterInput input) {
+        return new NotificationComposer<MeterRemoved>() {
+            @Override
+            public MeterRemoved compose() {
+                MeterRemovedBuilder meterRemoved = new MeterRemovedBuilder((Meter) input);
+                meterRemoved.setTransactionId(new TransactionId(BigInteger.valueOf(xId.intValue())));
+                meterRemoved.setMeterRef(input.getMeterRef());
+                return meterRemoved.build();
+            }
+        };
+    }
+    
+    /**
+     * @param taskContext
+     * @param input
+     * @param cookie
+     * @return task
+     */
+    public static OFRpcTask<GetAllGroupStatisticsInput, RpcResult<GetAllGroupStatisticsOutput>> createGetAllGroupStatisticsTask(
+            final OFRpcTaskContext taskContext, GetAllGroupStatisticsInput input,
+            SwitchConnectionDistinguisher cookie) {
+        OFRpcTask<GetAllGroupStatisticsInput, RpcResult<GetAllGroupStatisticsOutput>> task = 
+                new OFRpcTask<GetAllGroupStatisticsInput, RpcResult<GetAllGroupStatisticsOutput>>(taskContext, cookie, input) {
+            
+            @Override
+            public ListenableFuture<RpcResult<GetAllGroupStatisticsOutput>> call() {
+                final SettableFuture<RpcResult<GetAllGroupStatisticsOutput>> result = SettableFuture.create();
+             
+                if (taskContext.getSession().getPrimaryConductor().getVersion() == OFConstants.OFP_VERSION_1_0) {
+                    Collection<RpcError> errors = Collections.emptyList();
+                    RpcResult<GetAllGroupStatisticsOutput> rpcResult = Rpcs.getRpcResult(true, 
+                            new GetAllGroupStatisticsOutputBuilder().build(), errors);
+                    
+                    return Futures.immediateFuture(rpcResult);
+                } else {   
+                
+                 // Generate xid to associate it with the request
+                    final Long xid = taskContext.getSession().getNextXid();
+    
+                 // Create multipart request body for fetch all the group stats
+                    MultipartRequestGroupCaseBuilder caseBuilder = new MultipartRequestGroupCaseBuilder();
+                    MultipartRequestGroupBuilder mprGroupBuild = new MultipartRequestGroupBuilder();
+                    mprGroupBuild.setGroupId(new GroupId(BinContent.intToUnsignedLong(
+                            org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731
+                            .Group.OFPGALL.getIntValue())));
+                    caseBuilder.setMultipartRequestGroup(mprGroupBuild.build());
+                    
+                    // Create multipart request header
+                    MultipartRequestInputBuilder mprInput = createMultipartHeader(MultipartType.OFPMPGROUP, 
+                            taskContext);
+                    
+                    // Set request body to main multipart request
+                    mprInput.setMultipartRequestBody(caseBuilder.build());
+    
+                    // Send the request, no cookies associated, use any connection
+                    
+                    Future<RpcResult<Void>> resultFromOFLib = getMessageService()
+                            .multipartRequest(mprInput.build(), getCookie());
+                    ListenableFuture<RpcResult<Void>> resultLib = JdkFutureAdapters.listenInPoolThread(resultFromOFLib);
+                    
+                    Futures.addCallback(resultLib, new ResultCallback<GetAllGroupStatisticsOutput>(result) {
+                        @Override
+                        public GetAllGroupStatisticsOutput createResult() {
+                            GetAllGroupStatisticsOutputBuilder groupStatBuilder = new GetAllGroupStatisticsOutputBuilder()
+                            .setTransactionId(new TransactionId(BigInteger.valueOf(xid)));
+                            return groupStatBuilder.build();
+                        }
+                    });
+                        
+                    return result;
+                }
+            }
+        };
+        return task;
+    }
+    
+    /**
+     * @param taskContext
+     * @param input
+     * @param cookie
+     * @return task
+     */
+    public static OFRpcTask<GetGroupDescriptionInput, RpcResult<GetGroupDescriptionOutput>> createGetGroupDescriptionTask(
+            final OFRpcTaskContext taskContext, GetGroupDescriptionInput input,
+            SwitchConnectionDistinguisher cookie) {
+        OFRpcTask<GetGroupDescriptionInput, RpcResult<GetGroupDescriptionOutput>> task = 
+                new OFRpcTask<GetGroupDescriptionInput, RpcResult<GetGroupDescriptionOutput>>(taskContext, cookie, input) {
+
+                    @Override
+                    public ListenableFuture<RpcResult<GetGroupDescriptionOutput>> call()
+                            throws Exception {
+                        final SettableFuture<RpcResult<GetGroupDescriptionOutput>> result = SettableFuture.create();
+                        
+                        if (taskContext.getSession().getPrimaryConductor().getVersion() == OFConstants.OFP_VERSION_1_0) {
+                            Collection<RpcError> errors = Collections.emptyList();
+                            RpcResult<GetGroupDescriptionOutput> rpcResult = Rpcs.getRpcResult(true, 
+                                    new GetGroupDescriptionOutputBuilder().build(), errors);
+                            return Futures.immediateFuture(rpcResult);
+                        } else {
+                            final Long xid = taskContext.getSession().getNextXid();
+                            
+                            MultipartRequestGroupDescCaseBuilder mprGroupDescCaseBuild = 
+                                                  new MultipartRequestGroupDescCaseBuilder();
+                            MultipartRequestInputBuilder mprInput = 
+                                    createMultipartHeader(MultipartType.OFPMPGROUPDESC, taskContext);
+                            mprInput.setMultipartRequestBody(mprGroupDescCaseBuild.build());
+                            Future<RpcResult<Void>> resultFromOFLib = getMessageService()
+                                    .multipartRequest(mprInput.build(), getCookie());
+                            ListenableFuture<RpcResult<Void>> resultLib = JdkFutureAdapters.listenInPoolThread(resultFromOFLib);
+                            
+                            Futures.addCallback(resultLib, new ResultCallback<GetGroupDescriptionOutput>(result) {
+                                @Override
+                                public GetGroupDescriptionOutput createResult() {
+                                    GetGroupDescriptionOutputBuilder groupStatBuilder = new GetGroupDescriptionOutputBuilder()
+                                    .setTransactionId(new TransactionId(BigInteger.valueOf(xid)));
+                                    return groupStatBuilder.build();
+                                }
+                            });
+                            return result;
+                        }
+                    }  
+        };
+        return task;
+    }
+    
+    /**
+     * @param taskContext
+     * @param input
+     * @param cookie
+     * @return task
+     */
+    public static OFRpcTask<GetGroupFeaturesInput, RpcResult<GetGroupFeaturesOutput>> createGetGroupFeaturesTask(
+            final OFRpcTaskContext taskContext, GetGroupFeaturesInput input,
+            SwitchConnectionDistinguisher cookie) {
+        OFRpcTask<GetGroupFeaturesInput, RpcResult<GetGroupFeaturesOutput>> task = 
+                new OFRpcTask<GetGroupFeaturesInput, RpcResult<GetGroupFeaturesOutput>>(taskContext, cookie, input) {
+
+                    @Override
+                    public ListenableFuture<RpcResult<GetGroupFeaturesOutput>> call()
+                            throws Exception {
+                        final SettableFuture<RpcResult<GetGroupFeaturesOutput>> result = SettableFuture.create();
+                        
+                        if (taskContext.getSession().getPrimaryConductor().getVersion() == OFConstants.OFP_VERSION_1_0) {
+                            Collection<RpcError> errors = Collections.emptyList();
+                            RpcResult<GetGroupFeaturesOutput> rpcResult = Rpcs.getRpcResult(true, 
+                                    new GetGroupFeaturesOutputBuilder().build(), errors);
+                            return Futures.immediateFuture(rpcResult);
+                        } else {
+                            final Long xid = taskContext.getSession().getNextXid();
+                            
+                            MultipartRequestGroupFeaturesCaseBuilder mprGroupFeaturesBuild = 
+                                                  new MultipartRequestGroupFeaturesCaseBuilder();
+                            MultipartRequestInputBuilder mprInput = 
+                                    createMultipartHeader(MultipartType.OFPMPGROUPFEATURES, taskContext);
+                            mprInput.setMultipartRequestBody(mprGroupFeaturesBuild.build());
+                            Future<RpcResult<Void>> resultFromOFLib = getMessageService()
+                                    .multipartRequest(mprInput.build(), getCookie());
+                            ListenableFuture<RpcResult<Void>> resultLib = JdkFutureAdapters.listenInPoolThread(resultFromOFLib);
+                            
+                            Futures.addCallback(resultLib, new ResultCallback<GetGroupFeaturesOutput>(result) {
+                                @Override
+                                public GetGroupFeaturesOutput createResult() {
+                                    GetGroupFeaturesOutputBuilder groupFeatureBuilder = new GetGroupFeaturesOutputBuilder()
+                                    .setTransactionId(new TransactionId(BigInteger.valueOf(xid)));
+                                    return groupFeatureBuilder.build();
+                                }
+                            });
+                            return result;
+                        }
+                    }  
+        };
+        return task;
+    }
+    
+    /**
+     * @param taskContext
+     * @param input
+     * @param cookie
+     * @return task
+     */
+    public static OFRpcTask<GetGroupStatisticsInput, RpcResult<GetGroupStatisticsOutput>> createGetGroupStatisticsTask(
+            final OFRpcTaskContext taskContext, final GetGroupStatisticsInput input,
+            SwitchConnectionDistinguisher cookie) {
+        OFRpcTask<GetGroupStatisticsInput, RpcResult<GetGroupStatisticsOutput>> task = 
+                new OFRpcTask<GetGroupStatisticsInput, RpcResult<GetGroupStatisticsOutput>>(taskContext, cookie, input) {
+
+                    @Override
+                    public ListenableFuture<RpcResult<GetGroupStatisticsOutput>> call()
+                            throws Exception {
+                        final SettableFuture<RpcResult<GetGroupStatisticsOutput>> result = SettableFuture.create();
+                        
+                        if (taskContext.getSession().getPrimaryConductor().getVersion() == OFConstants.OFP_VERSION_1_0) {
+                            Collection<RpcError> errors = Collections.emptyList();
+                            RpcResult<GetGroupStatisticsOutput> rpcResult = Rpcs.getRpcResult(true, 
+                                    new GetGroupStatisticsOutputBuilder().build(), errors);
+                            return Futures.immediateFuture(rpcResult);
+                        } else {
+                            final Long xid = taskContext.getSession().getNextXid();
+                            
+                            MultipartRequestGroupCaseBuilder caseBuilder = new MultipartRequestGroupCaseBuilder();
+                            MultipartRequestGroupBuilder mprGroupBuild = new MultipartRequestGroupBuilder();
+                            mprGroupBuild.setGroupId(new GroupId(input.getGroupId().getValue()));
+                            caseBuilder.setMultipartRequestGroup(mprGroupBuild.build());
+                            
+                            MultipartRequestInputBuilder mprInput = 
+                                    createMultipartHeader(MultipartType.OFPMPGROUP, taskContext);
+                            mprInput.setMultipartRequestBody(caseBuilder.build());
+                            Future<RpcResult<Void>> resultFromOFLib = getMessageService()
+                                    .multipartRequest(mprInput.build(), getCookie());
+                            ListenableFuture<RpcResult<Void>> resultLib = JdkFutureAdapters.listenInPoolThread(resultFromOFLib);
+                            
+                            Futures.addCallback(resultLib, new ResultCallback<GetGroupStatisticsOutput>(result) {
+                                @Override
+                                public GetGroupStatisticsOutput createResult() {
+                                    GetGroupStatisticsOutputBuilder groupStatisticsBuilder = 
+                                            new GetGroupStatisticsOutputBuilder()
+                                    .setTransactionId(new TransactionId(BigInteger.valueOf(xid)));
+                                    return groupStatisticsBuilder.build();
+                                }
+                            });
+                            return result;
+                        }
+                    }  
+        };
+        return task;
+    }
+    
+    /**
+     * @param taskContext
+     * @param input
+     * @param cookie
+     * @return task
+     */
+    public static OFRpcTask<GetAllMeterConfigStatisticsInput, RpcResult<GetAllMeterConfigStatisticsOutput>> createGetAllMeterConfigStatisticsTask(
+            final OFRpcTaskContext taskContext, final GetAllMeterConfigStatisticsInput input,
+            SwitchConnectionDistinguisher cookie) {
+        OFRpcTask<GetAllMeterConfigStatisticsInput, RpcResult<GetAllMeterConfigStatisticsOutput>> task = 
+                new OFRpcTask<GetAllMeterConfigStatisticsInput, RpcResult<GetAllMeterConfigStatisticsOutput>>(taskContext, cookie, input) {
+
+                    @Override
+                    public ListenableFuture<RpcResult<GetAllMeterConfigStatisticsOutput>> call()
+                            throws Exception {
+                        final SettableFuture<RpcResult<GetAllMeterConfigStatisticsOutput>> result = SettableFuture.create();
+                        
+                        if (taskContext.getSession().getPrimaryConductor().getVersion() == OFConstants.OFP_VERSION_1_0) {
+                            Collection<RpcError> errors = Collections.emptyList();
+                            RpcResult<GetAllMeterConfigStatisticsOutput> rpcResult = Rpcs.getRpcResult(true, 
+                                    new GetAllMeterConfigStatisticsOutputBuilder().build(), errors);
+                            return Futures.immediateFuture(rpcResult);
+                        } else {
+                            final Long xid = taskContext.getSession().getNextXid();
+                            
+                            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());
+                            
+                            MultipartRequestInputBuilder mprInput = 
+                                    createMultipartHeader(MultipartType.OFPMPMETERCONFIG, taskContext);
+                            mprInput.setMultipartRequestBody(caseBuilder.build());
+                            Future<RpcResult<Void>> resultFromOFLib = getMessageService()
+                                    .multipartRequest(mprInput.build(), getCookie());
+                            ListenableFuture<RpcResult<Void>> resultLib = JdkFutureAdapters.listenInPoolThread(resultFromOFLib);
+                            
+                            Futures.addCallback(resultLib, new ResultCallback<GetAllMeterConfigStatisticsOutput>(result) {
+                                @Override
+                                public GetAllMeterConfigStatisticsOutput createResult() {
+                                    GetAllMeterConfigStatisticsOutputBuilder allMeterConfStatBuilder = 
+                                            new GetAllMeterConfigStatisticsOutputBuilder()
+                                    .setTransactionId(new TransactionId(BigInteger.valueOf(xid)));
+                                    return allMeterConfStatBuilder.build();
+                                }
+                            });
+                            return result;
+                        }
+                    }  
+        };
+        return task;
+    }
+    
+    /**
+     * @param taskContext
+     * @param input
+     * @param cookie
+     * @return task
+     */
+    public static OFRpcTask<GetAllMeterStatisticsInput, RpcResult<GetAllMeterStatisticsOutput>> createGetAllMeterStatisticsTask(
+            final OFRpcTaskContext taskContext, final GetAllMeterStatisticsInput input,
+            SwitchConnectionDistinguisher cookie) {
+        OFRpcTask<GetAllMeterStatisticsInput, RpcResult<GetAllMeterStatisticsOutput>> task = 
+                new OFRpcTask<GetAllMeterStatisticsInput, RpcResult<GetAllMeterStatisticsOutput>>(taskContext, cookie, input) {
+
+                    @Override
+                    public ListenableFuture<RpcResult<GetAllMeterStatisticsOutput>> call()
+                            throws Exception {
+                        final SettableFuture<RpcResult<GetAllMeterStatisticsOutput>> result = SettableFuture.create();
+                        
+                        if (taskContext.getSession().getPrimaryConductor().getVersion() == OFConstants.OFP_VERSION_1_0) {
+                            Collection<RpcError> errors = Collections.emptyList();
+                            RpcResult<GetAllMeterStatisticsOutput> rpcResult = Rpcs.getRpcResult(true, 
+                                    new GetAllMeterStatisticsOutputBuilder().build(), errors);
+                            return Futures.immediateFuture(rpcResult);
+                        } else {
+                            final Long xid = taskContext.getSession().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 = 
+                                    createMultipartHeader(MultipartType.OFPMPMETER, taskContext);
+                            mprInput.setMultipartRequestBody(caseBuilder.build());
+                            Future<RpcResult<Void>> resultFromOFLib = getMessageService()
+                                    .multipartRequest(mprInput.build(), getCookie());
+                            ListenableFuture<RpcResult<Void>> resultLib = JdkFutureAdapters.listenInPoolThread(resultFromOFLib);
+                            
+                            Futures.addCallback(resultLib, new ResultCallback<GetAllMeterStatisticsOutput>(result) {
+                                @Override
+                                public GetAllMeterStatisticsOutput createResult() {
+                                    GetAllMeterStatisticsOutputBuilder allMeterStatBuilder = 
+                                            new GetAllMeterStatisticsOutputBuilder()
+                                    .setTransactionId(new TransactionId(BigInteger.valueOf(xid)));
+                                    return allMeterStatBuilder.build();
+                                }
+                            });
+                            return result;
+                        }
+                    }  
+        };
+        return task;
+    }
+    
+    /**
+     * @param taskContext
+     * @param input
+     * @param cookie
+     * @return task
+     */
+    public static OFRpcTask<GetMeterFeaturesInput, RpcResult<GetMeterFeaturesOutput>> createGetMeterFeaturesTask(
+            final OFRpcTaskContext taskContext, final GetMeterFeaturesInput input,
+            SwitchConnectionDistinguisher cookie) {
+        OFRpcTask<GetMeterFeaturesInput, RpcResult<GetMeterFeaturesOutput>> task = 
+                new OFRpcTask<GetMeterFeaturesInput, RpcResult<GetMeterFeaturesOutput>>(taskContext, cookie, input) {
+
+                    @Override
+                    public ListenableFuture<RpcResult<GetMeterFeaturesOutput>> call()
+                            throws Exception {
+                        final SettableFuture<RpcResult<GetMeterFeaturesOutput>> result = SettableFuture.create();
+                        
+                        if (taskContext.getSession().getPrimaryConductor().getVersion() == OFConstants.OFP_VERSION_1_0) {
+                            Collection<RpcError> errors = Collections.emptyList();
+                            RpcResult<GetMeterFeaturesOutput> rpcResult = Rpcs.getRpcResult(true, 
+                                    new GetMeterFeaturesOutputBuilder().build(), errors);
+                            return Futures.immediateFuture(rpcResult);
+                        } else {
+                            final Long xid = taskContext.getSession().getNextXid();
+                            
+                            MultipartRequestMeterFeaturesCaseBuilder mprMeterFeaturesBuild = 
+                                    new MultipartRequestMeterFeaturesCaseBuilder();
+                            
+                            MultipartRequestInputBuilder mprInput = 
+                                    createMultipartHeader(MultipartType.OFPMPMETERFEATURES, taskContext);
+                            mprInput.setMultipartRequestBody(mprMeterFeaturesBuild.build());
+                            Future<RpcResult<Void>> resultFromOFLib = getMessageService()
+                                    .multipartRequest(mprInput.build(), getCookie());
+                            ListenableFuture<RpcResult<Void>> resultLib = JdkFutureAdapters.listenInPoolThread(resultFromOFLib);
+                            
+                            Futures.addCallback(resultLib, new ResultCallback<GetMeterFeaturesOutput>(result) {
+                                @Override
+                                public GetMeterFeaturesOutput createResult() {
+                                    GetMeterFeaturesOutputBuilder meterFeaturesBuilder = 
+                                            new GetMeterFeaturesOutputBuilder()
+                                    .setTransactionId(new TransactionId(BigInteger.valueOf(xid)));
+                                    return meterFeaturesBuilder.build();
+                                }
+                            });
+                            return result;
+                        }
+                    }  
+        };
+        return task;
+    }
+    
+    /**
+     * @param taskContext
+     * @param input
+     * @param cookie
+     * @return task
+     */
+    public static OFRpcTask<GetMeterStatisticsInput, RpcResult<GetMeterStatisticsOutput>> createGetMeterStatisticsTask(
+            final OFRpcTaskContext taskContext, final GetMeterStatisticsInput input,
+            SwitchConnectionDistinguisher cookie) {
+        OFRpcTask<GetMeterStatisticsInput, RpcResult<GetMeterStatisticsOutput>> task = 
+                new OFRpcTask<GetMeterStatisticsInput, RpcResult<GetMeterStatisticsOutput>>(taskContext, cookie, input) {
+
+                    @Override
+                    public ListenableFuture<RpcResult<GetMeterStatisticsOutput>> call()
+                            throws Exception {
+                        final SettableFuture<RpcResult<GetMeterStatisticsOutput>> result = SettableFuture.create();
+                        
+                        if (taskContext.getSession().getPrimaryConductor().getVersion() == OFConstants.OFP_VERSION_1_0) {
+                            Collection<RpcError> errors = Collections.emptyList();
+                            RpcResult<GetMeterStatisticsOutput> rpcResult = Rpcs.getRpcResult(true, 
+                                    new GetMeterStatisticsOutputBuilder().build(), errors);
+                            return Futures.immediateFuture(rpcResult);
+                        } else {
+                            final Long xid = taskContext.getSession().getNextXid();
+                            
+                            MultipartRequestMeterCaseBuilder caseBuilder = 
+                                    new MultipartRequestMeterCaseBuilder();
+                            MultipartRequestMeterBuilder mprMeterBuild = 
+                                    new MultipartRequestMeterBuilder();
+                            mprMeterBuild.setMeterId(new MeterId(input.getMeterId().getValue()));
+                            caseBuilder.setMultipartRequestMeter(mprMeterBuild.build());
+                            
+                            MultipartRequestInputBuilder mprInput = 
+                                    createMultipartHeader(MultipartType.OFPMPMETER, taskContext);
+                            mprInput.setMultipartRequestBody(caseBuilder.build());
+                            Future<RpcResult<Void>> resultFromOFLib = getMessageService()
+                                    .multipartRequest(mprInput.build(), getCookie());
+                            ListenableFuture<RpcResult<Void>> resultLib = JdkFutureAdapters.listenInPoolThread(resultFromOFLib);
+                            
+                            Futures.addCallback(resultLib, new ResultCallback<GetMeterStatisticsOutput>(result) {
+                                @Override
+                                public GetMeterStatisticsOutput createResult() {
+                                    GetMeterStatisticsOutputBuilder meterStatBuilder = 
+                                            new GetMeterStatisticsOutputBuilder()
+                                    .setTransactionId(new TransactionId(BigInteger.valueOf(xid)));
+                                    return meterStatBuilder.build();
+                                }
+                            });
+                            return result;
+                        }
+                    }  
+        };
+        return task;
+    }
+    
+    /**
+     * @param taskContext
+     * @param input
+     * @param cookie
+     * @return task
+     */
+    public static OFRpcTask<GetAllNodeConnectorsStatisticsInput, RpcResult<GetAllNodeConnectorsStatisticsOutput>> 
+                                                    createGetAllNodeConnectorsStatisticsTask(
+            final OFRpcTaskContext taskContext, final GetAllNodeConnectorsStatisticsInput input,
+            SwitchConnectionDistinguisher cookie) {
+        OFRpcTask<GetAllNodeConnectorsStatisticsInput, RpcResult<GetAllNodeConnectorsStatisticsOutput>> task = 
+                new OFRpcTask<GetAllNodeConnectorsStatisticsInput, RpcResult<GetAllNodeConnectorsStatisticsOutput>>(taskContext, cookie, input) {
+
+                    @Override
+                    public ListenableFuture<RpcResult<GetAllNodeConnectorsStatisticsOutput>> call()
+                            throws Exception {
+                        final SettableFuture<RpcResult<GetAllNodeConnectorsStatisticsOutput>> result = SettableFuture.create();
+                        
+                            final Long xid = taskContext.getSession().getNextXid();
+                            
+                            MultipartRequestPortStatsCaseBuilder caseBuilder = 
+                                    new MultipartRequestPortStatsCaseBuilder();
+                            MultipartRequestPortStatsBuilder mprPortStatsBuilder = 
+                                    new MultipartRequestPortStatsBuilder();
+                            // Select all ports
+                            mprPortStatsBuilder.setPortNo(OFConstants.OFPP_ANY);
+                            caseBuilder.setMultipartRequestPortStats(mprPortStatsBuilder.build());
+                            
+                            MultipartRequestInputBuilder mprInput = 
+                                    createMultipartHeader(MultipartType.OFPMPPORTSTATS, taskContext);
+                            mprInput.setMultipartRequestBody(caseBuilder.build());
+                            Future<RpcResult<Void>> resultFromOFLib = getMessageService()
+                                    .multipartRequest(mprInput.build(), getCookie());
+                            ListenableFuture<RpcResult<Void>> resultLib = JdkFutureAdapters.listenInPoolThread(resultFromOFLib);
+                            
+                            Futures.addCallback(resultLib, new ResultCallback<GetAllNodeConnectorsStatisticsOutput>(result) {
+                                @Override
+                                public GetAllNodeConnectorsStatisticsOutput createResult() {
+                                    GetAllNodeConnectorsStatisticsOutputBuilder allNodeConnectorStatBuilder = 
+                                            new GetAllNodeConnectorsStatisticsOutputBuilder()
+                                    .setTransactionId(new TransactionId(BigInteger.valueOf(xid)));
+                                    return allNodeConnectorStatBuilder.build();
+                                }
+                            });
+                            return result;
+                        }
+        };
+        return task;
+    }
+    
+    /**
+     * @param taskContext
+     * @param input
+     * @param cookie
+     * @return task
+     */
+    public static OFRpcTask<GetNodeConnectorStatisticsInput, RpcResult<GetNodeConnectorStatisticsOutput>> 
+                                                    createGetNodeConnectorStatisticsTask(
+            final OFRpcTaskContext taskContext, final GetNodeConnectorStatisticsInput input,
+            SwitchConnectionDistinguisher cookie) {
+        OFRpcTask<GetNodeConnectorStatisticsInput, RpcResult<GetNodeConnectorStatisticsOutput>> task = 
+                new OFRpcTask<GetNodeConnectorStatisticsInput, RpcResult<GetNodeConnectorStatisticsOutput>>(taskContext, cookie, input) {
+
+                @Override
+                public ListenableFuture<RpcResult<GetNodeConnectorStatisticsOutput>> call()
+                        throws Exception {
+                    final SettableFuture<RpcResult<GetNodeConnectorStatisticsOutput>> result = SettableFuture.create();
+                    
+                        final Long xid = taskContext.getSession().getNextXid();
+                        
+                        MultipartRequestPortStatsCaseBuilder caseBuilder = 
+                                new MultipartRequestPortStatsCaseBuilder();
+                        MultipartRequestPortStatsBuilder mprPortStatsBuilder = 
+                                new MultipartRequestPortStatsBuilder();
+                        // Set specific port
+                        mprPortStatsBuilder
+                                .setPortNo(InventoryDataServiceUtil.portNumberfromNodeConnectorId(
+                                        OpenflowVersion.get(taskContext.getSession().getFeatures().getVersion()), 
+                                        input.getNodeConnectorId()));
+                        caseBuilder.setMultipartRequestPortStats(mprPortStatsBuilder.build());
+                        
+                        MultipartRequestInputBuilder mprInput = 
+                                createMultipartHeader(MultipartType.OFPMPPORTSTATS, taskContext);
+                        mprInput.setMultipartRequestBody(caseBuilder.build());
+                        Future<RpcResult<Void>> resultFromOFLib = getMessageService()
+                                .multipartRequest(mprInput.build(), getCookie());
+                        ListenableFuture<RpcResult<Void>> resultLib = JdkFutureAdapters.listenInPoolThread(resultFromOFLib);
+                        
+                        Futures.addCallback(resultLib, new ResultCallback<GetNodeConnectorStatisticsOutput>(result) {
+                            @Override
+                            public GetNodeConnectorStatisticsOutput createResult() {
+                                GetNodeConnectorStatisticsOutputBuilder allNodeConnectorStatBuilder = 
+                                        new GetNodeConnectorStatisticsOutputBuilder()
+                                .setTransactionId(new TransactionId(BigInteger.valueOf(xid)));
+                                return allNodeConnectorStatBuilder.build();
+                            }
+                        });
+                        return result;
+                    }
+        };
+        return task;
+    }
+    
+    /**
+     * @param taskContext
+     * @param input
+     * @param cookie
+     * @return task
+     */
+    public static OFRpcTask<GetAllFlowStatisticsFromFlowTableInput, RpcResult<GetAllFlowStatisticsFromFlowTableOutput>> 
+                                                    createGetAllFlowStatisticsFromFlowTableTask(
+            final OFRpcTaskContext taskContext, 
+            final GetAllFlowStatisticsFromFlowTableInput input,
+            SwitchConnectionDistinguisher cookie) {
+        OFRpcTask<GetAllFlowStatisticsFromFlowTableInput, RpcResult<GetAllFlowStatisticsFromFlowTableOutput>> task = 
+        new OFRpcTask<GetAllFlowStatisticsFromFlowTableInput, RpcResult<GetAllFlowStatisticsFromFlowTableOutput>>(taskContext, cookie, input) {
+
+                @Override
+                public ListenableFuture<RpcResult<GetAllFlowStatisticsFromFlowTableOutput>> call() throws Exception {
+                    final SettableFuture<RpcResult<GetAllFlowStatisticsFromFlowTableOutput>> result = SettableFuture.create();
+                    
+                        final Long xid = taskContext.getSession().getNextXid();
+                        
+                        MultipartRequestFlowCaseBuilder multipartRequestFlowCaseBuilder = new MultipartRequestFlowCaseBuilder();
+                        MultipartRequestFlowBuilder mprFlowRequestBuilder = new MultipartRequestFlowBuilder();
+                        mprFlowRequestBuilder.setTableId(input.getTableId().getValue());
+                        mprFlowRequestBuilder.setOutPort(OFConstants.OFPP_ANY);
+                        mprFlowRequestBuilder.setOutGroup(OFConstants.OFPG_ANY);
+                        mprFlowRequestBuilder.setCookie(OFConstants.DEFAULT_COOKIE);
+                        mprFlowRequestBuilder.setCookieMask(OFConstants.DEFAULT_COOKIE_MASK);
+                        FlowCreatorUtil.setWildcardedFlowMatch(taskContext.getSession()
+                                .getPrimaryConductor().getVersion(), mprFlowRequestBuilder);
+                        
+                        MultipartRequestInputBuilder mprInput = 
+                                createMultipartHeader(MultipartType.OFPMPFLOW, taskContext);
+                        mprInput.setMultipartRequestBody(multipartRequestFlowCaseBuilder.build());
+                        Future<RpcResult<Void>> resultFromOFLib = getMessageService()
+                                .multipartRequest(mprInput.build(), getCookie());
+                        ListenableFuture<RpcResult<Void>> resultLib = JdkFutureAdapters.listenInPoolThread(resultFromOFLib);
+                        
+                        Futures.addCallback(resultLib, new ResultCallback<GetAllFlowStatisticsFromFlowTableOutput>(result) {
+                            @Override
+                            public GetAllFlowStatisticsFromFlowTableOutput createResult() {
+                                GetAllFlowStatisticsFromFlowTableOutputBuilder allFlowStatsFromFlowTableBuilder = 
+                                        new GetAllFlowStatisticsFromFlowTableOutputBuilder()
+                                .setTransactionId(new TransactionId(BigInteger.valueOf(xid)));
+                                return allFlowStatsFromFlowTableBuilder.build();
+                            }
+                        });
+                        return result;
+                    }
+        };
+        return task;
+    }
+    
+    /**
+     * @param taskContext
+     * @param input
+     * @param cookie
+     * @return task
+     */
+    public static OFRpcTask<GetAllFlowsStatisticsFromAllFlowTablesInput, RpcResult<GetAllFlowsStatisticsFromAllFlowTablesOutput>> 
+                                                    createGetAllFlowsStatisticsFromAllFlowTablesTask(
+            final OFRpcTaskContext taskContext, 
+            final GetAllFlowsStatisticsFromAllFlowTablesInput input,
+            SwitchConnectionDistinguisher cookie) {
+        OFRpcTask<GetAllFlowsStatisticsFromAllFlowTablesInput, 
+        RpcResult<GetAllFlowsStatisticsFromAllFlowTablesOutput>> task = 
+        new OFRpcTask<GetAllFlowsStatisticsFromAllFlowTablesInput, 
+        RpcResult<GetAllFlowsStatisticsFromAllFlowTablesOutput>>(taskContext, cookie, input) {
+
+            @Override
+            public ListenableFuture<RpcResult<GetAllFlowsStatisticsFromAllFlowTablesOutput>> call() throws Exception {
+                final SettableFuture<RpcResult<GetAllFlowsStatisticsFromAllFlowTablesOutput>> result = SettableFuture.create();
+                
+                    final Long xid = taskContext.getSession().getNextXid();
+                    
+                 // Create multipart request body for fetch all the group stats
+                    MultipartRequestFlowCaseBuilder multipartRequestFlowCaseBuilder = 
+                            new MultipartRequestFlowCaseBuilder();
+                    MultipartRequestFlowBuilder mprFlowRequestBuilder = 
+                            new MultipartRequestFlowBuilder();
+                    mprFlowRequestBuilder.setTableId(OFConstants.OFPTT_ALL);
+                    mprFlowRequestBuilder.setOutPort(OFConstants.OFPP_ANY);
+                    mprFlowRequestBuilder.setOutGroup(OFConstants.OFPG_ANY);
+                    mprFlowRequestBuilder.setCookie(OFConstants.DEFAULT_COOKIE);
+                    mprFlowRequestBuilder.setCookieMask(OFConstants.DEFAULT_COOKIE_MASK);
+                    FlowCreatorUtil.setWildcardedFlowMatch(taskContext.getSession()
+                            .getPrimaryConductor().getVersion(), mprFlowRequestBuilder);
+                    
+                    MultipartRequestInputBuilder mprInput = 
+                            createMultipartHeader(MultipartType.OFPMPFLOW, taskContext);
+                    multipartRequestFlowCaseBuilder.setMultipartRequestFlow(mprFlowRequestBuilder.build());
+                    mprInput.setMultipartRequestBody(multipartRequestFlowCaseBuilder.build());
+                    Future<RpcResult<Void>> resultFromOFLib = getMessageService()
+                            .multipartRequest(mprInput.build(), getCookie());
+                    ListenableFuture<RpcResult<Void>> resultLib = JdkFutureAdapters.listenInPoolThread(resultFromOFLib);
+                    
+                    Futures.addCallback(resultLib, new ResultCallback<GetAllFlowsStatisticsFromAllFlowTablesOutput>(result) {
+                        @Override
+                        public GetAllFlowsStatisticsFromAllFlowTablesOutput createResult() {
+                            GetAllFlowsStatisticsFromAllFlowTablesOutputBuilder allFlowStatsFromAllFlowTableBuilder = 
+                                    new GetAllFlowsStatisticsFromAllFlowTablesOutputBuilder()
+                            .setTransactionId(new TransactionId(BigInteger.valueOf(xid)));
+                            return allFlowStatsFromAllFlowTableBuilder.build();
+                        }
+                    });
+                    return result;
+                }
+        };
+        return task;
+    }
+    
+    /**
+     * @param taskContext
+     * @param input
+     * @param cookie
+     * @return task
+     */
+    public static OFRpcTask<GetFlowStatisticsFromFlowTableInput, RpcResult<GetFlowStatisticsFromFlowTableOutput>> 
+                                                    createGetFlowStatisticsFromFlowTableTask(
+            final OFRpcTaskContext taskContext, 
+            final GetFlowStatisticsFromFlowTableInput input,SwitchConnectionDistinguisher cookie) {
+        OFRpcTask<GetFlowStatisticsFromFlowTableInput, RpcResult<GetFlowStatisticsFromFlowTableOutput>> task = 
+        new OFRpcTask<GetFlowStatisticsFromFlowTableInput, RpcResult<GetFlowStatisticsFromFlowTableOutput>>(taskContext, cookie, input) {
+
+            @Override
+            public ListenableFuture<RpcResult<GetFlowStatisticsFromFlowTableOutput>> call() throws Exception {
+                final SettableFuture<RpcResult<GetFlowStatisticsFromFlowTableOutput>> result = SettableFuture.create();
+                
+                    final Long xid = taskContext.getSession().getNextXid();
+                    
+                 // Create multipart request body for fetch all the group stats
+                    MultipartRequestFlowCaseBuilder multipartRequestFlowCaseBuilder = new MultipartRequestFlowCaseBuilder();
+                    MultipartRequestFlowBuilder mprFlowRequestBuilder = new MultipartRequestFlowBuilder();
+                    mprFlowRequestBuilder.setTableId(input.getTableId());
+
+                    if (input.getOutPort() != null)
+                        mprFlowRequestBuilder.setOutPort(input.getOutPort().longValue());
+                    else
+                        mprFlowRequestBuilder.setOutPort(OFConstants.OFPP_ANY);
+
+                    if (input.getOutGroup() != null)
+                        mprFlowRequestBuilder.setOutGroup(input.getOutGroup());
+                    else
+                        mprFlowRequestBuilder.setOutGroup(OFConstants.OFPG_ANY);
+
+                    if (input.getCookie() != null)
+                        mprFlowRequestBuilder.setCookie(input.getCookie().getValue());
+                    else
+                        mprFlowRequestBuilder.setCookie(OFConstants.DEFAULT_COOKIE);
+
+                    if (input.getCookieMask() != null)
+                        mprFlowRequestBuilder.setCookieMask(input.getCookieMask().getValue());
+                    else
+                        mprFlowRequestBuilder.setCookieMask(OFConstants.DEFAULT_COOKIE_MASK);
+
+                    // convert and inject match
+                    MatchReactor.getInstance().convert(input.getMatch(), taskContext.getSession()
+                            .getPrimaryConductor().getVersion(), mprFlowRequestBuilder,
+                            taskContext.getSession().getFeatures().getDatapathId());
+
+                    // Set request body to main multipart request
+                    multipartRequestFlowCaseBuilder.setMultipartRequestFlow(mprFlowRequestBuilder.build());
+                    MultipartRequestInputBuilder mprInput = 
+                            createMultipartHeader(MultipartType.OFPMPFLOW, taskContext);
+                    mprInput.setMultipartRequestBody(multipartRequestFlowCaseBuilder.build());
+                    Future<RpcResult<Void>> resultFromOFLib = getMessageService()
+                            .multipartRequest(mprInput.build(), getCookie());
+                    ListenableFuture<RpcResult<Void>> resultLib = JdkFutureAdapters.listenInPoolThread(resultFromOFLib);
+                    
+                    Futures.addCallback(resultLib, new ResultCallback<GetFlowStatisticsFromFlowTableOutput>(result) {
+                        @Override
+                        public GetFlowStatisticsFromFlowTableOutput createResult() {
+                            GetFlowStatisticsFromFlowTableOutputBuilder flowStatsFromFlowTableBuilder = 
+                                    new GetFlowStatisticsFromFlowTableOutputBuilder()
+                            .setTransactionId(new TransactionId(BigInteger.valueOf(xid)));
+                            return flowStatsFromFlowTableBuilder.build();
+                        }
+                    });
+                    return result;
+                }
+        };
+        return task;
+    }
+    
+    /**
+     * @param taskContext
+     * @param input
+     * @param cookie
+     * @return task
+     */
+    public static OFRpcTask<GetAggregateFlowStatisticsFromFlowTableForAllFlowsInput, RpcResult<GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput>> 
+                                                    createGetAggregateFlowStatisticsFromFlowTableForAllFlowsTask(
+            final OFRpcTaskContext taskContext, 
+            final GetAggregateFlowStatisticsFromFlowTableForAllFlowsInput input,SwitchConnectionDistinguisher cookie) {
+        OFRpcTask<GetAggregateFlowStatisticsFromFlowTableForAllFlowsInput, RpcResult<GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput>> task = 
+        new OFRpcTask<GetAggregateFlowStatisticsFromFlowTableForAllFlowsInput, RpcResult<GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput>>(taskContext, cookie, input) {
+
+        @Override
+        public ListenableFuture<RpcResult<GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput>> call() throws Exception {
+            final SettableFuture<RpcResult<GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput>> result = SettableFuture.create();
+            
+                final Long xid = taskContext.getSession().getNextXid();
+                
+             // Create multipart request body for fetch all the group stats
+                MultipartRequestAggregateCaseBuilder multipartRequestAggregateCaseBuilder = new MultipartRequestAggregateCaseBuilder();
+                MultipartRequestAggregateBuilder mprAggregateRequestBuilder = new MultipartRequestAggregateBuilder();
+                mprAggregateRequestBuilder.setTableId(input.getTableId().getValue());
+                mprAggregateRequestBuilder.setOutPort(OFConstants.OFPP_ANY);
+                mprAggregateRequestBuilder.setOutGroup(OFConstants.OFPG_ANY);
+                mprAggregateRequestBuilder.setCookie(OFConstants.DEFAULT_COOKIE);
+                mprAggregateRequestBuilder.setCookieMask(OFConstants.DEFAULT_COOKIE_MASK);
+
+                FlowCreatorUtil.setWildcardedFlowMatch(taskContext.getSession()
+                        .getPrimaryConductor().getVersion(), mprAggregateRequestBuilder);
+
+                // Set request body to main multipart request
+                multipartRequestAggregateCaseBuilder.setMultipartRequestAggregate(mprAggregateRequestBuilder.build());
+                MultipartRequestInputBuilder mprInput = 
+                        createMultipartHeader(MultipartType.OFPMPAGGREGATE, taskContext);
+                mprInput.setMultipartRequestBody(multipartRequestAggregateCaseBuilder.build());
+                Future<RpcResult<Void>> resultFromOFLib = getMessageService()
+                        .multipartRequest(mprInput.build(), getCookie());
+                ListenableFuture<RpcResult<Void>> resultLib = JdkFutureAdapters.listenInPoolThread(resultFromOFLib);
+                
+                Futures.addCallback(resultLib, new ResultCallback<GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput>(result) {
+                    @Override
+                    public GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput createResult() {
+                        GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutputBuilder flowStatsFromFlowTableBuilder = 
+                                new GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutputBuilder()
+                        .setTransactionId(new TransactionId(BigInteger.valueOf(xid)));
+                        return flowStatsFromFlowTableBuilder.build();
+                    }
+                });
+                return result;
+            }
+        };
+        return task;
+    }
+    
+    /**
+     * @param taskContext
+     * @param input
+     * @param cookie
+     * @return task
+     */
+    public static OFRpcTask<GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput, RpcResult<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput>> 
+                                                    createGetAggregateFlowStatisticsFromFlowTableForGivenMatchTask(
+            final OFRpcTaskContext taskContext, 
+            final GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput input,SwitchConnectionDistinguisher cookie) {
+        OFRpcTask<GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput, RpcResult<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput>> task = 
+        new OFRpcTask<GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput, RpcResult<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput>>(taskContext, cookie, input) {
+
+        @Override
+        public ListenableFuture<RpcResult<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput>> call() throws Exception {
+            final SettableFuture<RpcResult<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput>> result = SettableFuture.create();
+            
+                final Long xid = taskContext.getSession().getNextXid();
+                
+                MultipartRequestAggregateCaseBuilder multipartRequestAggregateCaseBuilder = new MultipartRequestAggregateCaseBuilder();
+                MultipartRequestAggregateBuilder mprAggregateRequestBuilder = new MultipartRequestAggregateBuilder();
+                mprAggregateRequestBuilder.setTableId(input.getTableId());
+                mprAggregateRequestBuilder.setOutPort(input.getOutPort().longValue());
+             // TODO: repeating code
+                if (taskContext.getSession().getPrimaryConductor().getVersion() == 
+                                                                OFConstants.OFP_VERSION_1_3) {
+                    mprAggregateRequestBuilder.setCookie(input.getCookie().getValue());
+                    mprAggregateRequestBuilder.setCookieMask(input.getCookieMask().getValue());
+                    mprAggregateRequestBuilder.setOutGroup(input.getOutGroup());
+                } else {
+                    mprAggregateRequestBuilder.setOutGroup(OFConstants.OFPG_ANY);
+                    mprAggregateRequestBuilder.setCookie(OFConstants.DEFAULT_COOKIE);
+                    mprAggregateRequestBuilder.setCookieMask(OFConstants.DEFAULT_COOKIE_MASK);
+                }
+                
+                MatchReactor.getInstance().convert(input.getMatch(), taskContext.getSession()
+                        .getPrimaryConductor().getVersion(), mprAggregateRequestBuilder,
+                        taskContext.getSession().getFeatures().getDatapathId());
+
+                FlowCreatorUtil.setWildcardedFlowMatch(taskContext.getSession()
+                        .getPrimaryConductor().getVersion(), mprAggregateRequestBuilder);
+
+                // Set request body to main multipart request
+                multipartRequestAggregateCaseBuilder.setMultipartRequestAggregate(mprAggregateRequestBuilder.build());
+                MultipartRequestInputBuilder mprInput = 
+                        createMultipartHeader(MultipartType.OFPMPAGGREGATE, taskContext);
+                mprInput.setMultipartRequestBody(multipartRequestAggregateCaseBuilder.build());
+                Future<RpcResult<Void>> resultFromOFLib = getMessageService()
+                        .multipartRequest(mprInput.build(), getCookie());
+                ListenableFuture<RpcResult<Void>> resultLib = JdkFutureAdapters.listenInPoolThread(resultFromOFLib);
+                
+                Futures.addCallback(resultLib, new ResultCallback<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput>(result) {
+                    @Override
+                    public GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput createResult() {
+                        GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutputBuilder aggregFlowStatsFromFlowTableBuilder = 
+                                new GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutputBuilder()
+                        .setTransactionId(new TransactionId(BigInteger.valueOf(xid)));
+                        return aggregFlowStatsFromFlowTableBuilder.build();
+                    }
+                });
+                return result;
+            }
+        };
+        return task;
+    }
+    
+    /**
+     * @param taskContext
+     * @param input
+     * @param cookie
+     * @return task
+     */
+    public static OFRpcTask<GetFlowTablesStatisticsInput, RpcResult<GetFlowTablesStatisticsOutput>> createGetFlowTablesStatisticsTask(
+            final OFRpcTaskContext taskContext, final GetFlowTablesStatisticsInput input,SwitchConnectionDistinguisher cookie) {
+        OFRpcTask<GetFlowTablesStatisticsInput, RpcResult<GetFlowTablesStatisticsOutput>> task = 
+        new OFRpcTask<GetFlowTablesStatisticsInput, RpcResult<GetFlowTablesStatisticsOutput>>(taskContext, cookie, input) {
+
+        @Override
+        public ListenableFuture<RpcResult<GetFlowTablesStatisticsOutput>> call() throws Exception {
+            final SettableFuture<RpcResult<GetFlowTablesStatisticsOutput>> result = SettableFuture.create();
+            
+                final Long xid = taskContext.getSession().getNextXid();
+                
+             // Create multipart request body for fetch all the group stats
+                MultipartRequestTableCaseBuilder multipartRequestTableCaseBuilder = new MultipartRequestTableCaseBuilder();
+                MultipartRequestTableBuilder multipartRequestTableBuilder = new MultipartRequestTableBuilder();
+                multipartRequestTableBuilder.setEmpty(true);
+                multipartRequestTableCaseBuilder.setMultipartRequestTable(multipartRequestTableBuilder.build());
+
+                // Set request body to main multipart request
+                MultipartRequestInputBuilder mprInput = 
+                        createMultipartHeader(MultipartType.OFPMPTABLE, taskContext);
+                mprInput.setMultipartRequestBody(multipartRequestTableCaseBuilder.build());
+                Future<RpcResult<Void>> resultFromOFLib = getMessageService()
+                        .multipartRequest(mprInput.build(), getCookie());
+                ListenableFuture<RpcResult<Void>> resultLib = JdkFutureAdapters.listenInPoolThread(resultFromOFLib);
+                
+                Futures.addCallback(resultLib, new ResultCallback<GetFlowTablesStatisticsOutput>(result) {
+                    @Override
+                    public GetFlowTablesStatisticsOutput createResult() {
+                        GetFlowTablesStatisticsOutputBuilder flowTableStatsBuilder = 
+                                new GetFlowTablesStatisticsOutputBuilder()
+                        .setTransactionId(new TransactionId(BigInteger.valueOf(xid)));
+                        return flowTableStatsBuilder.build();
+                    }
+                });
+                return result;
+            }
+        };
+        return task;
+    }
+    
+    /**
+     * @param taskContext
+     * @param input
+     * @param cookie
+     * @return task
+     */
+    public static OFRpcTask<GetAllQueuesStatisticsFromAllPortsInput, RpcResult<GetAllQueuesStatisticsFromAllPortsOutput>> createGetAllQueuesStatisticsFromAllPortsTask(
+            final OFRpcTaskContext taskContext, final GetAllQueuesStatisticsFromAllPortsInput input,SwitchConnectionDistinguisher cookie) {
+        OFRpcTask<GetAllQueuesStatisticsFromAllPortsInput, RpcResult<GetAllQueuesStatisticsFromAllPortsOutput>> task = 
+        new OFRpcTask<GetAllQueuesStatisticsFromAllPortsInput, RpcResult<GetAllQueuesStatisticsFromAllPortsOutput>>(taskContext, cookie, input) {
+
+        @Override
+        public ListenableFuture<RpcResult<GetAllQueuesStatisticsFromAllPortsOutput>> call() throws Exception {
+            final SettableFuture<RpcResult<GetAllQueuesStatisticsFromAllPortsOutput>> result = SettableFuture.create();
+            
+            final Long xid = taskContext.getSession().getNextXid();
+            
+            MultipartRequestQueueCaseBuilder caseBuilder = new MultipartRequestQueueCaseBuilder();
+            MultipartRequestQueueBuilder mprQueueBuilder = new MultipartRequestQueueBuilder();
+            // Select all ports
+            mprQueueBuilder.setPortNo(OFConstants.OFPP_ANY);
+            // Select all the ports
+            mprQueueBuilder.setQueueId(OFConstants.OFPQ_ANY);
+            caseBuilder.setMultipartRequestQueue(mprQueueBuilder.build());
+
+            // Set request body to main multipart request
+            MultipartRequestInputBuilder mprInput = 
+                    createMultipartHeader(MultipartType.OFPMPQUEUE, taskContext);
+            mprInput.setMultipartRequestBody(caseBuilder.build());
+            Future<RpcResult<Void>> resultFromOFLib = getMessageService()
+                    .multipartRequest(mprInput.build(), getCookie());
+            ListenableFuture<RpcResult<Void>> resultLib = JdkFutureAdapters.listenInPoolThread(resultFromOFLib);
+            
+            Futures.addCallback(resultLib, new ResultCallback<GetAllQueuesStatisticsFromAllPortsOutput>(result) {
+                @Override
+                public GetAllQueuesStatisticsFromAllPortsOutput createResult() {
+                    GetAllQueuesStatisticsFromAllPortsOutputBuilder allQueueStatsBuilder = 
+                            new GetAllQueuesStatisticsFromAllPortsOutputBuilder()
+                    .setTransactionId(new TransactionId(BigInteger.valueOf(xid)));
+                    return allQueueStatsBuilder.build();
+                }
+            });
+            return result;
+        }
+       };
+        return task;
+    }
+    
+    /**
+     * @param taskContext
+     * @param input
+     * @param cookie
+     * @return task
+     */
+    public static OFRpcTask<GetAllQueuesStatisticsFromGivenPortInput, RpcResult<GetAllQueuesStatisticsFromGivenPortOutput>> createGetAllQueuesStatisticsFromGivenPortTask(
+            final OFRpcTaskContext taskContext, final GetAllQueuesStatisticsFromGivenPortInput input,SwitchConnectionDistinguisher cookie) {
+        OFRpcTask<GetAllQueuesStatisticsFromGivenPortInput, RpcResult<GetAllQueuesStatisticsFromGivenPortOutput>> task = 
+        new OFRpcTask<GetAllQueuesStatisticsFromGivenPortInput, RpcResult<GetAllQueuesStatisticsFromGivenPortOutput>>(taskContext, cookie, input) {
+
+        @Override
+        public ListenableFuture<RpcResult<GetAllQueuesStatisticsFromGivenPortOutput>> call() throws Exception {
+            final SettableFuture<RpcResult<GetAllQueuesStatisticsFromGivenPortOutput>> result = SettableFuture.create();
+            
+            final Long xid = taskContext.getSession().getNextXid();
+            
+            MultipartRequestQueueCaseBuilder caseBuilder = new MultipartRequestQueueCaseBuilder();
+            MultipartRequestQueueBuilder mprQueueBuilder = new MultipartRequestQueueBuilder();
+            // Select all queues
+            mprQueueBuilder.setQueueId(OFConstants.OFPQ_ANY);
+            // Select specific port
+            mprQueueBuilder.setPortNo(InventoryDataServiceUtil.portNumberfromNodeConnectorId(
+                    OpenflowVersion.get(taskContext.getSession().getFeatures().getVersion()),
+                    input.getNodeConnectorId()));
+            caseBuilder.setMultipartRequestQueue(mprQueueBuilder.build());
+
+            // Set request body to main multipart request
+            MultipartRequestInputBuilder mprInput = 
+                    createMultipartHeader(MultipartType.OFPMPQUEUE, taskContext);
+            mprInput.setMultipartRequestBody(caseBuilder.build());
+            Future<RpcResult<Void>> resultFromOFLib = getMessageService()
+                    .multipartRequest(mprInput.build(), getCookie());
+            ListenableFuture<RpcResult<Void>> resultLib = JdkFutureAdapters.listenInPoolThread(resultFromOFLib);
+            
+            Futures.addCallback(resultLib, new ResultCallback<GetAllQueuesStatisticsFromGivenPortOutput>(result) {
+                @Override
+                public GetAllQueuesStatisticsFromGivenPortOutput createResult() {
+                    GetAllQueuesStatisticsFromGivenPortOutputBuilder allQueueStatsBuilder = 
+                            new GetAllQueuesStatisticsFromGivenPortOutputBuilder()
+                    .setTransactionId(new TransactionId(BigInteger.valueOf(xid)));
+                    return allQueueStatsBuilder.build();
+                }
+            });
+            return result;
+        }
+       };
+        return task;
+    }
+    
+    /**
+     * @param taskContext
+     * @param input
+     * @param cookie
+     * @return task
+     */
+    public static OFRpcTask<GetQueueStatisticsFromGivenPortInput, RpcResult<GetQueueStatisticsFromGivenPortOutput>> createGetQueueStatisticsFromGivenPortTask(
+            final OFRpcTaskContext taskContext, final GetQueueStatisticsFromGivenPortInput input,SwitchConnectionDistinguisher cookie) {
+        OFRpcTask<GetQueueStatisticsFromGivenPortInput, RpcResult<GetQueueStatisticsFromGivenPortOutput>> task = 
+        new OFRpcTask<GetQueueStatisticsFromGivenPortInput, RpcResult<GetQueueStatisticsFromGivenPortOutput>>(taskContext, cookie, input) {
+
+        @Override
+        public ListenableFuture<RpcResult<GetQueueStatisticsFromGivenPortOutput>> call() throws Exception {
+            final SettableFuture<RpcResult<GetQueueStatisticsFromGivenPortOutput>> result = SettableFuture.create();
+            
+            final Long xid = taskContext.getSession().getNextXid();
+            
+            MultipartRequestQueueCaseBuilder caseBuilder = new MultipartRequestQueueCaseBuilder();
+            MultipartRequestQueueBuilder mprQueueBuilder = new MultipartRequestQueueBuilder();
+            // Select specific queue
+            mprQueueBuilder.setQueueId(input.getQueueId().getValue());
+            // Select specific port
+            mprQueueBuilder.setPortNo(InventoryDataServiceUtil.portNumberfromNodeConnectorId(
+                    OpenflowVersion.get(taskContext.getSession().getFeatures().getVersion()),
+                    input.getNodeConnectorId()));
+            caseBuilder.setMultipartRequestQueue(mprQueueBuilder.build());
+
+            // Set request body to main multipart request
+            MultipartRequestInputBuilder mprInput = 
+                    createMultipartHeader(MultipartType.OFPMPQUEUE, taskContext);
+            mprInput.setMultipartRequestBody(caseBuilder.build());
+            Future<RpcResult<Void>> resultFromOFLib = getMessageService()
+                    .multipartRequest(mprInput.build(), getCookie());
+            ListenableFuture<RpcResult<Void>> resultLib = JdkFutureAdapters.listenInPoolThread(resultFromOFLib);
+            
+            Futures.addCallback(resultLib, new ResultCallback<GetQueueStatisticsFromGivenPortOutput>(result) {
+                @Override
+                public GetQueueStatisticsFromGivenPortOutput createResult() {
+                    GetQueueStatisticsFromGivenPortOutputBuilder queueStatsFromPortBuilder = 
+                            new GetQueueStatisticsFromGivenPortOutputBuilder()
+                    .setTransactionId(new TransactionId(BigInteger.valueOf(xid)));
+                    return queueStatsFromPortBuilder.build();
+                }
+            });
+            return result;
+        }
+       };
+        return task;
+    }
+    
+    static MultipartRequestInputBuilder createMultipartHeader(MultipartType multipart, 
+            OFRpcTaskContext taskContext) {
+        MultipartRequestInputBuilder mprInput = new MultipartRequestInputBuilder();
+        mprInput.setType(multipart);
+        mprInput.setVersion(taskContext.getSession().getPrimaryConductor().getVersion());
+        mprInput.setXid(taskContext.getSession().getNextXid());
+        mprInput.setFlags(new MultipartRequestFlags(false));
+        return mprInput;
+    }
+    
+    private static abstract class ResultCallback<T> implements FutureCallback<RpcResult<Void>> {
+        
+        private SettableFuture<RpcResult<T>> result;
+
+        /**
+         * @param result
+         */
+        public ResultCallback(SettableFuture<RpcResult<T>> result) {
+            this.result = result;
+        }
+
+        public abstract T createResult();
+
+        @Override
+        public void onSuccess(RpcResult<Void> resultArg) {
+            Collection<RpcError> errors = Collections.emptyList();
+            result.set(Rpcs.getRpcResult(true, createResult(), errors));
+        }
+
+        @Override
+        public void onFailure(Throwable t) {
+            result.set(Rpcs.<T>getRpcResult(false, 
+                    Collections.singletonList(RpcErrors.getRpcError(OFConstants.APPLICATION_TAG, 
+                            OFConstants.ERROR_TAG_TIMEOUT, 
+                            "something wrong happened", ErrorSeverity.WARNING, "", 
+                            ErrorType.RPC, t))));
+        }
+    }
+    
+    /**
+     * @param taskContext
+     * @param input
+     * @param cookie
+     * @return task
+     */
+    public static OFRpcTask<UpdatePortInput, RpcResult<UpdatePortOutput>> createUpdatePortTask(
+            final OFRpcTaskContext taskContext, final UpdatePortInput input,
+            final SwitchConnectionDistinguisher cookie) {
+        OFRpcTask<UpdatePortInput, RpcResult<UpdatePortOutput>> task = 
+                new OFRpcTask<UpdatePortInput, RpcResult<UpdatePortOutput>>(taskContext, cookie, input) {
+            
+            @Override
+            public ListenableFuture<RpcResult<UpdatePortOutput>> call() {
+                ListenableFuture<RpcResult<UpdatePortOutput>> result = SettableFuture.create();
+                final Long xid = taskContext.getSession().getNextXid();
+                Port inputPort = input.getUpdatedPort().getPort().getPort().get(0);
+                
+                    PortModInput ofPortModInput = PortConvertor.toPortModInput(inputPort, 
+                            taskContext.getSession().getPrimaryConductor().getVersion());
+
+                    PortModInputBuilder mdInput = new PortModInputBuilder(ofPortModInput);
+                    mdInput.setXid(xid);
+
+                    Future<RpcResult<UpdatePortOutput>> resultFromOFLib = getMessageService()
+                            .portMod(mdInput.build(), cookie);
+                    result = JdkFutureAdapters.listenInPoolThread(resultFromOFLib);
+
+                return result;
+            }
+        };
+        
+        return task;
+        
+    }
+    
+    /**
+     * @param taskContext
+     * @param input
+     * @param cookie
+     * @return task
+     */
+    public static OFRpcTask<UpdateTableInput, RpcResult<UpdateTableOutput>> createUpdateTableTask(
+            final OFRpcTaskContext taskContext, final UpdateTableInput input,
+            final SwitchConnectionDistinguisher cookie) {
+        OFRpcTask<UpdateTableInput, RpcResult<UpdateTableOutput>> task = 
+                new OFRpcTask<UpdateTableInput, RpcResult<UpdateTableOutput>>(taskContext, cookie, input) {
+            
+            @Override
+            public ListenableFuture<RpcResult<UpdateTableOutput>> call() {
+                final SettableFuture<RpcResult<UpdateTableOutput>> result = SettableFuture.create();
+                
+                final Long xid = taskContext.getSession().getNextXid();
+                
+                MultipartRequestTableFeaturesCaseBuilder caseBuilder = new MultipartRequestTableFeaturesCaseBuilder();
+                MultipartRequestTableFeaturesBuilder requestBuilder = new MultipartRequestTableFeaturesBuilder();
+                List<TableFeatures> ofTableFeatureList = TableFeaturesConvertor
+                        .toTableFeaturesRequest(input.getUpdatedTable());
+                requestBuilder.setTableFeatures(ofTableFeatureList);
+                caseBuilder.setMultipartRequestTableFeatures(requestBuilder.build());
+                
+                // Set request body to main multipart request
+                MultipartRequestInputBuilder mprInput = 
+                        createMultipartHeader(MultipartType.OFPMPTABLEFEATURES, taskContext);
+                mprInput.setMultipartRequestBody(caseBuilder.build());
+                
+                Future<RpcResult<Void>> resultFromOFLib = getMessageService()
+                        .multipartRequest(mprInput.build(), getCookie());
+                ListenableFuture<RpcResult<Void>> resultLib = JdkFutureAdapters.listenInPoolThread(resultFromOFLib);
+                
+                Futures.addCallback(resultLib, new ResultCallback<UpdateTableOutput>(result) {
+                    @Override
+                    public UpdateTableOutput createResult() {
+                        UpdateTableOutputBuilder queueStatsFromPortBuilder = 
+                                new UpdateTableOutputBuilder()
+                        .setTransactionId(new TransactionId(BigInteger.valueOf(xid)));
+                        return queueStatsFromPortBuilder.build();
+                    }
+                });
+                return result;
+            }
+        };
+        return task;
+    }
+    
 }
index f84f3fcf9882a1505a53ae13dec201ec381cff04..93ebb905b6c214a842e1771d4667451cf1d055d8 100644 (file)
@@ -9,8 +9,11 @@
 package org.opendaylight.openflowplugin.openflow.md.core.sal;
 
 import java.math.BigInteger;
+import java.util.ArrayList;
 import java.util.Collections;
+import java.util.List;
 import java.util.Set;
+import java.util.concurrent.ExecutionException;
 import java.util.concurrent.Executors;
 
 import org.junit.Before;
@@ -27,16 +30,111 @@ import org.opendaylight.openflowplugin.openflow.md.core.SwitchConnectionDistingu
 import org.opendaylight.openflowplugin.openflow.md.core.session.IMessageDispatchService;
 import org.opendaylight.openflowplugin.openflow.md.core.session.OFSessionUtil;
 import org.opendaylight.openflowplugin.openflow.md.core.session.SessionContext;
+import org.opendaylight.openflowplugin.openflow.md.util.OpenflowPortsUtil;
+import org.opendaylight.openflowplugin.statistics.MessageSpy;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowInputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.RemoveFlowInputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.UpdateFlowInputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.UpdateFlowOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.UpdateFlowOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.flow.update.OriginalFlowBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.flow.update.UpdatedFlowBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForAllFlowsInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForGivenMatchInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowStatisticsFromFlowTableInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowStatisticsFromFlowTableOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowsStatisticsFromAllFlowTablesInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowsStatisticsFromAllFlowTablesOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetFlowStatisticsFromFlowTableInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetFlowStatisticsFromFlowTableOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.GetFlowTablesStatisticsInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.GetFlowTablesStatisticsOutputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev131103.TransactionId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.CommonPort.PortNumber;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortConfig;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortFeatures;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.port.mod.PortBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.port.mod.port.Port;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.port.mod.port.PortKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.queue.rev130925.QueueId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowCookie;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowModFlags;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Match;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.AddGroupInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.RemoveGroupInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.UpdateGroupInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.UpdateGroupOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.UpdateGroupOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.group.update.UpdatedGroupBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetAllGroupStatisticsInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetAllGroupStatisticsOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupDescriptionInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupDescriptionOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupFeaturesInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupFeaturesOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupStatisticsInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupStatisticsOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.EtherType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.AddMeterInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.RemoveMeterInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.UpdateMeterInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.UpdateMeterOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.UpdateMeterOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.meter.update.UpdatedMeterBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetAllMeterConfigStatisticsInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetAllMeterConfigStatisticsOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetAllMeterStatisticsInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetAllMeterStatisticsOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetMeterFeaturesInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetMeterFeaturesOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetMeterStatisticsInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetMeterStatisticsOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetDestinationBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetSourceBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetTypeBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatchBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.GroupTypes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowModInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GroupModInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MeterModInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortModInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.port.service.rev131107.UpdatePortInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.port.service.rev131107.UpdatePortOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.port.service.rev131107.UpdatePortOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.port.service.rev131107.port.update.UpdatedPortBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.GetAllNodeConnectorsStatisticsInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.GetAllNodeConnectorsStatisticsOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.GetNodeConnectorStatisticsInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.GetNodeConnectorStatisticsOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.GetAllQueuesStatisticsFromAllPortsInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.GetAllQueuesStatisticsFromAllPortsOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.GetAllQueuesStatisticsFromGivenPortInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.GetAllQueuesStatisticsFromGivenPortOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.GetQueueStatisticsFromGivenPortInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.GetQueueStatisticsFromGivenPortOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.UpdateTableInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.UpdateTableOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.table.update.UpdatedTable;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.table.update.UpdatedTableBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TableConfig;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplySetfieldBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.TableFeatures;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.TableFeaturesBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.TableFeaturesKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.TablePropertiesBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.table.properties.TableFeatureProperties;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.table.properties.TableFeaturePropertiesBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.table.properties.TableFeaturePropertiesKey;
+import org.opendaylight.yangtools.yang.binding.DataContainer;
 import org.opendaylight.yangtools.yang.common.RpcError;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 
@@ -60,6 +158,8 @@ public class ModelDrivenSwitchImplTest {
     private IMessageDispatchService messageDispatchService;
     @Mock
     private GetFeaturesOutput features;
+    @Mock
+    private MessageSpy<DataContainer> messageSpy;
 
     /**
      * @throws java.lang.Exception
@@ -74,6 +174,8 @@ public class ModelDrivenSwitchImplTest {
         Mockito.when(features.getDatapathId()).thenReturn(BigInteger.valueOf(1));
         
         OFSessionUtil.getSessionManager().setRpcPool(MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(10)));
+        OFSessionUtil.getSessionManager().setMessageSpy(messageSpy);
+        OpenflowPortsUtil.init();
 
         mdSwitchOF10 = new ModelDrivenSwitchImpl(null, null, context);
         mdSwitchOF13 = new ModelDrivenSwitchImpl(null, null, context);
@@ -83,9 +185,11 @@ public class ModelDrivenSwitchImplTest {
      * Test method for
      * {@link org.opendaylight.openflowplugin.openflow.md.core.sal.ModelDrivenSwitchImpl#addFlow(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowInput)}
      * .
+     * @throws ExecutionException 
+     * @throws InterruptedException 
      */
     @Test
-    public void testAddFlow() {
+    public void testAddFlow() throws InterruptedException, ExecutionException {
         UpdateFlowOutputBuilder updateFlowOutput = new UpdateFlowOutputBuilder();
         updateFlowOutput.setTransactionId(new TransactionId(new BigInteger("42")));
         Set<RpcError> errorSet = Collections.emptySet();
@@ -95,19 +199,26 @@ public class ModelDrivenSwitchImplTest {
                         Matchers.any(SwitchConnectionDistinguisher.class))).thenReturn(Futures.immediateFuture(result));
 
         AddFlowInputBuilder input = new AddFlowInputBuilder();
-        input.setMatch(new MatchBuilder().build());
+        input.setMatch(createMatch());
 
-        mdSwitchOF10.addFlow(input.build());
-        mdSwitchOF13.addFlow(input.build());
+        Mockito.when(features.getVersion()).thenReturn((short)1);
+        mdSwitchOF10.addFlow(input.build()).get();
+        Mockito.when(features.getVersion()).thenReturn((short)4);
+        mdSwitchOF13.addFlow(input.build()).get();
+        Mockito.verify(messageDispatchService, Mockito.times(2)).flowMod(
+                Matchers.any(FlowModInput.class),
+                Matchers.any(SwitchConnectionDistinguisher.class));
     }
 
     /**
      * Test method for
      * {@link org.opendaylight.openflowplugin.openflow.md.core.sal.ModelDrivenSwitchImpl#removeFlow(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.RemoveFlowInput)}
      * .
+     * @throws ExecutionException 
+     * @throws InterruptedException 
      */
     @Test
-    public void testRemoveFlow() {
+    public void testRemoveFlow() throws InterruptedException, ExecutionException {
         UpdateFlowOutputBuilder updateFlowOutput = new UpdateFlowOutputBuilder();
         updateFlowOutput.setTransactionId(new TransactionId(new BigInteger("42")));
         Set<RpcError> errorSet = Collections.emptySet();
@@ -117,19 +228,27 @@ public class ModelDrivenSwitchImplTest {
                         Matchers.any(SwitchConnectionDistinguisher.class))).thenReturn(Futures.immediateFuture(result));
 
         RemoveFlowInputBuilder input = new RemoveFlowInputBuilder();
-        input.setMatch(new MatchBuilder().build());
+        input.setMatch(createMatch());
 
-        mdSwitchOF10.removeFlow(input.build());
-        mdSwitchOF13.removeFlow(input.build());
+        Mockito.when(features.getVersion()).thenReturn((short)1);
+        mdSwitchOF10.removeFlow(input.build()).get();
+        Mockito.when(features.getVersion()).thenReturn((short)4);
+        mdSwitchOF13.removeFlow(input.build()).get();
+        Mockito.verify(messageDispatchService, Mockito.times(2)).flowMod(
+                Matchers.any(FlowModInput.class),
+                Matchers.any(SwitchConnectionDistinguisher.class));
+        
     }
 
     /**
      * Test method for
      * {@link org.opendaylight.openflowplugin.openflow.md.core.sal.ModelDrivenSwitchImpl#updateFlow(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.UpdateFlowInput)}
      * .
+     * @throws ExecutionException 
+     * @throws InterruptedException 
      */
     @Test
-    public void testUpdateFlow() {
+    public void testUpdateFlow() throws InterruptedException, ExecutionException {
         UpdateFlowOutputBuilder updateFlowOutput = new UpdateFlowOutputBuilder();
         updateFlowOutput.setTransactionId(new TransactionId(new BigInteger("42")));
         Set<RpcError> errorSet = Collections.emptySet();
@@ -140,10 +259,909 @@ public class ModelDrivenSwitchImplTest {
 
         UpdateFlowInputBuilder input = new UpdateFlowInputBuilder();
         UpdatedFlowBuilder updatedFlow = new UpdatedFlowBuilder();
-        updatedFlow.setMatch(new MatchBuilder().build());
+        updatedFlow.setBarrier(false);
+        updatedFlow.setMatch(createMatch());
+        updatedFlow.setPriority(65);
+        updatedFlow.setFlags(new FlowModFlags(true, false, true, false, true));
         input.setUpdatedFlow(updatedFlow.build());
+        OriginalFlowBuilder originalFlowBuilder = new OriginalFlowBuilder();
+        originalFlowBuilder.setMatch(createMatch());
+        originalFlowBuilder.setPriority(65);
+        originalFlowBuilder.setFlags(new FlowModFlags(true, false, true, false, true));
+        input.setOriginalFlow(originalFlowBuilder.build());
+        
+        Mockito.when(features.getVersion()).thenReturn((short)1);
+        mdSwitchOF10.updateFlow(input.build()).get();
+        Mockito.when(features.getVersion()).thenReturn((short)4);
+        mdSwitchOF13.updateFlow(input.build()).get();
+        Mockito.verify(messageDispatchService, Mockito.times(2)).flowMod(
+                Matchers.any(FlowModInput.class),
+                Matchers.any(SwitchConnectionDistinguisher.class));
+    }
+    
+    /**
+     * Test method for
+     * {@link org.opendaylight.openflowplugin.openflow.md.core.sal.ModelDrivenSwitchImpl#
+     * addGroup(org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.
+     * AddGroupInput)}
+     * .
+     * @throws ExecutionException 
+     * @throws InterruptedException 
+     */
+    @Test
+    public void testAddGroup() throws InterruptedException, ExecutionException {
+        UpdateGroupOutputBuilder updateGroupOutput = new UpdateGroupOutputBuilder();
+        updateGroupOutput.setTransactionId(new TransactionId(new BigInteger("42")));
+        Set<RpcError> errorSet = Collections.emptySet();
+        RpcResult<UpdateGroupOutput> result = Rpcs.getRpcResult(true, updateGroupOutput.build(), errorSet);
+        Mockito.when(
+                messageDispatchService.groupMod(Matchers.any(GroupModInput.class),
+                        Matchers.any(SwitchConnectionDistinguisher.class))).thenReturn(Futures.immediateFuture(result));
+
+        AddGroupInputBuilder input = new AddGroupInputBuilder();
+        input.setGroupType(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupTypes.GroupFf);
+        input.setGroupId(new GroupId(789L));
+
+        mdSwitchOF10.addGroup(input.build()).get();
+        mdSwitchOF13.addGroup(input.build()).get();
+        Mockito.verify(messageDispatchService, Mockito.times(2)).groupMod(
+                Matchers.any(GroupModInput.class),
+                Matchers.any(SwitchConnectionDistinguisher.class));
+    }
+    
+    /**
+     * Test method for
+     * {@link org.opendaylight.openflowplugin.openflow.md.core.sal.ModelDrivenSwitchImpl#
+     * updateGroup(org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.
+     * UpdateGroupInput)}
+     * .
+     * @throws ExecutionException 
+     * @throws InterruptedException 
+     */
+    @Test
+    public void testUpdateGroup() throws InterruptedException, ExecutionException {
+        UpdateGroupOutputBuilder updateGroupOutput = new UpdateGroupOutputBuilder();
+        updateGroupOutput.setTransactionId(new TransactionId(new BigInteger("42")));
+        Set<RpcError> errorSet = Collections.emptySet();
+        RpcResult<UpdateGroupOutput> result = Rpcs.getRpcResult(true, updateGroupOutput.build(), errorSet);
+        Mockito.when(
+                messageDispatchService.groupMod(Matchers.any(GroupModInput.class),
+                        Matchers.any(SwitchConnectionDistinguisher.class))).thenReturn(Futures.immediateFuture(result));
+
+        UpdateGroupInputBuilder input = new UpdateGroupInputBuilder();
+        UpdatedGroupBuilder updatedGroupBuilder = new UpdatedGroupBuilder();
+        updatedGroupBuilder.setGroupId(new GroupId(789L));
+        updatedGroupBuilder.setGroupType(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupTypes.GroupFf);
+        input.setUpdatedGroup(updatedGroupBuilder.build());
+
+        mdSwitchOF10.updateGroup(input.build()).get();
+        mdSwitchOF13.updateGroup(input.build()).get();
+        Mockito.verify(messageDispatchService, Mockito.times(2)).groupMod(
+                Matchers.any(GroupModInput.class),
+                Matchers.any(SwitchConnectionDistinguisher.class));
+    }
+    
+    /**
+     * Test method for
+     * {@link org.opendaylight.openflowplugin.openflow.md.core.sal.ModelDrivenSwitchImpl#
+     * removeGroup(org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.
+     * RemoveGroupInput)}
+     * .
+     * @throws ExecutionException 
+     * @throws InterruptedException 
+     */
+    @Test
+    public void testRemoveGroup() throws InterruptedException, ExecutionException {
+        UpdateGroupOutputBuilder updateGroupOutput = new UpdateGroupOutputBuilder();
+        updateGroupOutput.setTransactionId(new TransactionId(new BigInteger("42")));
+        Set<RpcError> errorSet = Collections.emptySet();
+        RpcResult<UpdateGroupOutput> result = Rpcs.getRpcResult(true, updateGroupOutput.build(), errorSet);
+        Mockito.when(
+                messageDispatchService.groupMod(Matchers.any(GroupModInput.class),
+                        Matchers.any(SwitchConnectionDistinguisher.class))).thenReturn(Futures.immediateFuture(result));
+
+        RemoveGroupInputBuilder input = new RemoveGroupInputBuilder();
+        input.setGroupId(new GroupId(789L));
+        input.setGroupType(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupTypes.GroupFf);
+
+        mdSwitchOF10.removeGroup(input.build()).get();
+        mdSwitchOF13.removeGroup(input.build()).get();
+        Mockito.verify(messageDispatchService, Mockito.times(2)).groupMod(
+                Matchers.any(GroupModInput.class),
+                Matchers.any(SwitchConnectionDistinguisher.class));
+    }
+    
+    /**
+     * Test method for
+     * {@link org.opendaylight.openflowplugin.openflow.md.core.sal.ModelDrivenSwitchImpl#
+     * addMeter(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.
+     * AddMeterInput)}
+     * .
+     * @throws ExecutionException 
+     * @throws InterruptedException 
+     */
+    @Test
+    public void testAddMeter() throws InterruptedException, ExecutionException {
+        UpdateMeterOutputBuilder updateMeterOutput = new UpdateMeterOutputBuilder();
+        updateMeterOutput.setTransactionId(new TransactionId(new BigInteger("42")));
+        Set<RpcError> errorSet = Collections.emptySet();
+        RpcResult<UpdateMeterOutput> result = Rpcs.getRpcResult(true, updateMeterOutput.build(), errorSet);
+        Mockito.when(
+                messageDispatchService.meterMod(Matchers.any(MeterModInput.class),
+                        Matchers.any(SwitchConnectionDistinguisher.class))).thenReturn(Futures.immediateFuture(result));
+
+        AddMeterInputBuilder input = new AddMeterInputBuilder();
+        input.setMeterId(new MeterId(78L));
+
+        mdSwitchOF10.addMeter(input.build()).get();
+        mdSwitchOF13.addMeter(input.build()).get();
+        Mockito.verify(messageDispatchService, Mockito.times(2)).meterMod(
+                Matchers.any(MeterModInput.class),
+                Matchers.any(SwitchConnectionDistinguisher.class));
+    }
+    
+    /**
+     * Test method for
+     * {@link org.opendaylight.openflowplugin.openflow.md.core.sal.ModelDrivenSwitchImpl#
+     * updateMeter(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.
+     * UpdateMeterInput)}
+     * .
+     * @throws ExecutionException 
+     * @throws InterruptedException 
+     */
+    @Test
+    public void testUpdtateMeter() throws InterruptedException, ExecutionException {
+        UpdateMeterOutputBuilder updateMeterOutput = new UpdateMeterOutputBuilder();
+        updateMeterOutput.setTransactionId(new TransactionId(new BigInteger("42")));
+        Set<RpcError> errorSet = Collections.emptySet();
+        RpcResult<UpdateMeterOutput> result = Rpcs.getRpcResult(true, updateMeterOutput.build(), errorSet);
+        Mockito.when(
+                messageDispatchService.meterMod(Matchers.any(MeterModInput.class),
+                        Matchers.any(SwitchConnectionDistinguisher.class))).thenReturn(Futures.immediateFuture(result));
+
+        UpdateMeterInputBuilder input = new UpdateMeterInputBuilder();
+        UpdatedMeterBuilder updatedMeterBuilder = new UpdatedMeterBuilder();
+        updatedMeterBuilder.setMeterId(new MeterId(89L));
+        updatedMeterBuilder.setBarrier(false);
+        input.setUpdatedMeter(updatedMeterBuilder.build());
+
+        mdSwitchOF10.updateMeter(input.build()).get();
+        mdSwitchOF13.updateMeter(input.build()).get();
+        Mockito.verify(messageDispatchService, Mockito.times(2)).meterMod(
+                Matchers.any(MeterModInput.class),
+                Matchers.any(SwitchConnectionDistinguisher.class));
+    }
+    
+    /**
+     * Test method for
+     * {@link org.opendaylight.openflowplugin.openflow.md.core.sal.ModelDrivenSwitchImpl#
+     * removeMeter(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.
+     * RemoveMeterInput)}
+     * .
+     * @throws ExecutionException 
+     * @throws InterruptedException 
+     */
+    @Test
+    public void testRemoveMeter() throws InterruptedException, ExecutionException {
+        UpdateMeterOutputBuilder updateMeterOutput = new UpdateMeterOutputBuilder();
+        updateMeterOutput.setTransactionId(new TransactionId(new BigInteger("42")));
+        Set<RpcError> errorSet = Collections.emptySet();
+        RpcResult<UpdateMeterOutput> result = Rpcs.getRpcResult(true, updateMeterOutput.build(), errorSet);
+        Mockito.when(
+                messageDispatchService.meterMod(Matchers.any(MeterModInput.class),
+                        Matchers.any(SwitchConnectionDistinguisher.class))).thenReturn(Futures.immediateFuture(result));
+
+        RemoveMeterInputBuilder input = new RemoveMeterInputBuilder();
+        input.setMeterId(new MeterId(89L));
+        
+        mdSwitchOF10.removeMeter(input.build()).get();
+        mdSwitchOF13.removeMeter(input.build()).get();
+        Mockito.verify(messageDispatchService, Mockito.times(2)).meterMod(
+                Matchers.any(MeterModInput.class),
+                Matchers.any(SwitchConnectionDistinguisher.class));
+    }
+    
+    /**
+     * Test method for
+     * {@link org.opendaylight.openflowplugin.openflow.md.core.sal.ModelDrivenSwitchImpl#
+     * getAllGroupStatistics(org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.
+     * GetAllGroupStatisticsInput)}
+     * .
+     * @throws ExecutionException 
+     * @throws InterruptedException 
+     */
+    @Test
+    public void testGetAllGroupStatistics() throws InterruptedException, ExecutionException {
+        GetAllGroupStatisticsOutputBuilder getAllGroupStatistcsOutput = new GetAllGroupStatisticsOutputBuilder();
+        getAllGroupStatistcsOutput.setTransactionId(new TransactionId(new BigInteger("42")));
+        Set<RpcError> errorSet = Collections.emptySet();
+        RpcResult<Void> result = Rpcs.getRpcResult(true, null, errorSet);
+        Mockito.when(
+                messageDispatchService.multipartRequest(Matchers.any(MultipartRequestInput.class),
+                        Matchers.any(SwitchConnectionDistinguisher.class))).thenReturn(Futures.immediateFuture(result));
+
+        GetAllGroupStatisticsInputBuilder input = new GetAllGroupStatisticsInputBuilder();
+
+        mdSwitchOF10.getAllGroupStatistics(input.build()).get();
+        mdSwitchOF13.getAllGroupStatistics(input.build()).get();
+        Mockito.verify(messageDispatchService, Mockito.times(2)).multipartRequest(
+                Matchers.any(MultipartRequestInput.class),
+                Matchers.any(SwitchConnectionDistinguisher.class));
+    }
+    
+    /**
+     * Test method for
+     * {@link org.opendaylight.openflowplugin.openflow.md.core.sal.ModelDrivenSwitchImpl#
+     * getGroupDescription(org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.
+     * GetGroupDescriptionInput)}
+     * .
+     * @throws ExecutionException 
+     * @throws InterruptedException 
+     */
+    @Test
+    public void testGetGroupDescription() throws InterruptedException, ExecutionException {
+        GetGroupDescriptionOutputBuilder getGroupDescOutput = new GetGroupDescriptionOutputBuilder();
+        getGroupDescOutput.setTransactionId(new TransactionId(new BigInteger("42")));
+        Set<RpcError> errorSet = Collections.emptySet();
+        RpcResult<Void> result = Rpcs.getRpcResult(true, null, errorSet);
+        Mockito.when(
+                messageDispatchService.multipartRequest(Matchers.any(MultipartRequestInput.class),
+                        Matchers.any(SwitchConnectionDistinguisher.class))).thenReturn(Futures.immediateFuture(result));
+
+        GetGroupDescriptionInputBuilder input = new GetGroupDescriptionInputBuilder();
+
+        mdSwitchOF10.getGroupDescription(input.build()).get();
+        mdSwitchOF13.getGroupDescription(input.build()).get();
+        Mockito.verify(messageDispatchService, Mockito.times(2)).multipartRequest(
+                Matchers.any(MultipartRequestInput.class),
+                Matchers.any(SwitchConnectionDistinguisher.class));
+    }
+    
+    /**
+     * Test method for
+     * {@link org.opendaylight.openflowplugin.openflow.md.core.sal.ModelDrivenSwitchImpl#
+     * getGroupFeatures(org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.
+     * GetGroupFeaturesInput)}
+     * .
+     * @throws ExecutionException 
+     * @throws InterruptedException 
+     */
+    @Test
+    public void testGetGroupFeatures() throws InterruptedException, ExecutionException {
+        GetGroupFeaturesOutputBuilder getGroupFeaturesOutput = new GetGroupFeaturesOutputBuilder();
+        getGroupFeaturesOutput.setTransactionId(new TransactionId(new BigInteger("42")));
+        Set<RpcError> errorSet = Collections.emptySet();
+        RpcResult<Void> result = Rpcs.getRpcResult(true, null, errorSet);
+        Mockito.when(
+                messageDispatchService.multipartRequest(Matchers.any(MultipartRequestInput.class),
+                        Matchers.any(SwitchConnectionDistinguisher.class))).thenReturn(Futures.immediateFuture(result));
+
+        GetGroupFeaturesInputBuilder input = new GetGroupFeaturesInputBuilder();
+
+        mdSwitchOF10.getGroupFeatures(input.build()).get();
+        mdSwitchOF13.getGroupFeatures(input.build()).get();
+        Mockito.verify(messageDispatchService, Mockito.times(2)).multipartRequest(
+                Matchers.any(MultipartRequestInput.class),
+                Matchers.any(SwitchConnectionDistinguisher.class));
+    }
+    
+    /**
+     * Test method for
+     * {@link org.opendaylight.openflowplugin.openflow.md.core.sal.ModelDrivenSwitchImpl#
+     * getGroupStatistics(org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.
+     * GetGroupStatisticsInput)}
+     * .
+     * @throws ExecutionException 
+     * @throws InterruptedException 
+     */
+    //TODO GetGroupStatistics why NPE?
+    @Test
+    public void testGetGroupStatistics() throws InterruptedException, ExecutionException {
+        GetGroupStatisticsOutputBuilder getGroupStatsOutput = new GetGroupStatisticsOutputBuilder();
+        getGroupStatsOutput.setTransactionId(new TransactionId(new BigInteger("42")));
+        Set<RpcError> errorSet = Collections.emptySet();
+        RpcResult<Void> result = Rpcs.getRpcResult(true, null, errorSet);
+        Mockito.when(
+                messageDispatchService.multipartRequest(Matchers.any(MultipartRequestInput.class),
+                        Matchers.any(SwitchConnectionDistinguisher.class))).thenReturn(Futures.immediateFuture(result));
+
+        GetGroupStatisticsInputBuilder input = new GetGroupStatisticsInputBuilder();
+        input.setGroupId(new GroupId(42L));
+
+        mdSwitchOF10.getGroupStatistics(input.build()).get();
+        mdSwitchOF13.getGroupStatistics(input.build()).get();
+        Mockito.verify(messageDispatchService, Mockito.times(2)).multipartRequest(
+                Matchers.any(MultipartRequestInput.class),
+                Matchers.any(SwitchConnectionDistinguisher.class));
+    }
+    
+    /**
+     * Test method for
+     * {@link org.opendaylight.openflowplugin.openflow.md.core.sal.ModelDrivenSwitchImpl#
+     * getAllMeterConfigStatistics(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.
+     * GetAllMeterConfigStatisticsInput)}
+     * .
+     * @throws ExecutionException 
+     * @throws InterruptedException 
+     */
+    @Test
+    public void testGetAllMeterConfigStatistics() throws InterruptedException, ExecutionException {
+        GetAllMeterConfigStatisticsOutputBuilder getAllMeterConfigStatsOutput = 
+                new GetAllMeterConfigStatisticsOutputBuilder();
+        getAllMeterConfigStatsOutput.setTransactionId(new TransactionId(new BigInteger("42")));
+        Set<RpcError> errorSet = Collections.emptySet();
+        RpcResult<Void> result = Rpcs.getRpcResult(true, null, errorSet);
+        Mockito.when(
+                messageDispatchService.multipartRequest(Matchers.any(MultipartRequestInput.class),
+                        Matchers.any(SwitchConnectionDistinguisher.class))).thenReturn(Futures.immediateFuture(result));
+
+        GetAllMeterConfigStatisticsInputBuilder input = new GetAllMeterConfigStatisticsInputBuilder();
+
+        mdSwitchOF10.getAllMeterConfigStatistics(input.build()).get();
+        mdSwitchOF13.getAllMeterConfigStatistics(input.build()).get();
+        Mockito.verify(messageDispatchService, Mockito.times(2)).multipartRequest(
+                Matchers.any(MultipartRequestInput.class),
+                Matchers.any(SwitchConnectionDistinguisher.class));
+    }
+    
+    /**
+     * Test method for
+     * {@link org.opendaylight.openflowplugin.openflow.md.core.sal.ModelDrivenSwitchImpl#
+     * getAllMeterStatistics(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.
+     * GetAllMeterStatisticsInput)}
+     * .
+     * @throws ExecutionException 
+     * @throws InterruptedException 
+     */
+    @Test
+    public void testGetAllMeterStatistics() throws InterruptedException, ExecutionException {
+        GetAllMeterStatisticsOutputBuilder getAllMeterStatisticsOutput = 
+                new GetAllMeterStatisticsOutputBuilder();
+        getAllMeterStatisticsOutput.setTransactionId(new TransactionId(new BigInteger("42")));
+        Set<RpcError> errorSet = Collections.emptySet();
+        RpcResult<Void> result = Rpcs.getRpcResult(true, null, errorSet);
+        Mockito.when(
+                messageDispatchService.multipartRequest(Matchers.any(MultipartRequestInput.class),
+                        Matchers.any(SwitchConnectionDistinguisher.class))).thenReturn(Futures.immediateFuture(result));
+
+        GetAllMeterStatisticsInputBuilder input = new GetAllMeterStatisticsInputBuilder();
+
+        mdSwitchOF10.getAllMeterStatistics(input.build()).get();
+        mdSwitchOF13.getAllMeterStatistics(input.build()).get();
+        Mockito.verify(messageDispatchService, Mockito.times(2)).multipartRequest(
+                Matchers.any(MultipartRequestInput.class),
+                Matchers.any(SwitchConnectionDistinguisher.class));
+    }
+    
+    /**
+     * Test method for
+     * {@link org.opendaylight.openflowplugin.openflow.md.core.sal.ModelDrivenSwitchImpl#
+     * getMeterFeatures(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.
+     * GetMeterFeaturesInput)}
+     * .
+     * @throws ExecutionException 
+     * @throws InterruptedException 
+     */
+    @Test
+    public void testGetMeterFeatures() throws InterruptedException, ExecutionException {
+        GetMeterFeaturesOutputBuilder getMeterFeaturesOutput = 
+                new GetMeterFeaturesOutputBuilder();
+        getMeterFeaturesOutput.setTransactionId(new TransactionId(new BigInteger("42")));
+        Set<RpcError> errorSet = Collections.emptySet();
+        RpcResult<Void> result = Rpcs.getRpcResult(true, null, errorSet);
+        Mockito.when(
+                messageDispatchService.multipartRequest(Matchers.any(MultipartRequestInput.class),
+                        Matchers.any(SwitchConnectionDistinguisher.class))).thenReturn(Futures.immediateFuture(result));
+
+        GetMeterFeaturesInputBuilder input = new GetMeterFeaturesInputBuilder();
+
+        mdSwitchOF10.getMeterFeatures(input.build()).get();
+        mdSwitchOF13.getMeterFeatures(input.build()).get();
+        Mockito.verify(messageDispatchService, Mockito.times(2)).multipartRequest(
+                Matchers.any(MultipartRequestInput.class),
+                Matchers.any(SwitchConnectionDistinguisher.class));
+    }
+    
+    /**
+     * Test method for
+     * {@link org.opendaylight.openflowplugin.openflow.md.core.sal.ModelDrivenSwitchImpl#
+     * getMeterStatistics(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.
+     * GetMeterStatisticsInput)}
+     * .
+     * @throws ExecutionException 
+     * @throws InterruptedException 
+     */
+    @Test
+    public void testGetMeterStatistics() throws InterruptedException, ExecutionException {
+        GetMeterStatisticsOutputBuilder getMeterStatsOutput = new GetMeterStatisticsOutputBuilder();
+        getMeterStatsOutput.setTransactionId(new TransactionId(new BigInteger("42")));
+        Set<RpcError> errorSet = Collections.emptySet();
+        RpcResult<Void> result = Rpcs.getRpcResult(true, null, errorSet);
+        Mockito.when(
+                messageDispatchService.multipartRequest(Matchers.any(MultipartRequestInput.class),
+                        Matchers.any(SwitchConnectionDistinguisher.class))).thenReturn(Futures.immediateFuture(result));
+
+        GetMeterStatisticsInputBuilder input = new GetMeterStatisticsInputBuilder();
+        input.setMeterId(new MeterId(42L));
+
+        mdSwitchOF10.getMeterStatistics(input.build()).get();
+        mdSwitchOF13.getMeterStatistics(input.build()).get();
+        Mockito.verify(messageDispatchService, Mockito.times(2)).multipartRequest(
+                Matchers.any(MultipartRequestInput.class),
+                Matchers.any(SwitchConnectionDistinguisher.class));
+    }
+    
+    /**
+     * Test method for
+     * {@link org.opendaylight.openflowplugin.openflow.md.core.sal.ModelDrivenSwitchImpl#
+     * getAllNodeConnectorsStatistics(org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.
+     * GetAllNodeConnectorsStatisticsInput)}
+     * .
+     * @throws ExecutionException 
+     * @throws InterruptedException 
+     */
+    @Test
+    public void testGetAllNodeConnectorsStatistics() throws InterruptedException, ExecutionException {
+        GetAllNodeConnectorsStatisticsOutputBuilder getAllNodeConnectorsStatsOutput = 
+                new GetAllNodeConnectorsStatisticsOutputBuilder();
+        getAllNodeConnectorsStatsOutput.setTransactionId(new TransactionId(new BigInteger("42")));
+        Set<RpcError> errorSet = Collections.emptySet();
+        RpcResult<Void> result = Rpcs.getRpcResult(true, null, errorSet);
+        Mockito.when(
+                messageDispatchService.multipartRequest(Matchers.any(MultipartRequestInput.class),
+                        Matchers.any(SwitchConnectionDistinguisher.class))).thenReturn(Futures.immediateFuture(result));
 
-        mdSwitchOF10.updateFlow(input.build());
-        mdSwitchOF13.updateFlow(input.build());
+        GetAllNodeConnectorsStatisticsInputBuilder input = new GetAllNodeConnectorsStatisticsInputBuilder();
+
+        mdSwitchOF10.getAllNodeConnectorsStatistics(input.build()).get();
+        mdSwitchOF13.getAllNodeConnectorsStatistics(input.build()).get();
+        Mockito.verify(messageDispatchService, Mockito.times(2)).multipartRequest(
+                Matchers.any(MultipartRequestInput.class),
+                Matchers.any(SwitchConnectionDistinguisher.class));
+    }
+    
+    /**
+     * Test method for
+     * {@link org.opendaylight.openflowplugin.openflow.md.core.sal.ModelDrivenSwitchImpl#
+     * getNodeConnectorStatistics(org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.
+     * GetNodeConnectorStatisticsInput)}
+     * .
+     * @throws ExecutionException 
+     * @throws InterruptedException 
+     */
+    @Test
+    public void testGetNodeConnectorStatistics() throws InterruptedException, ExecutionException {
+        GetNodeConnectorStatisticsOutputBuilder getNodeConnectorStatsOutput = 
+                new GetNodeConnectorStatisticsOutputBuilder();
+        getNodeConnectorStatsOutput.setTransactionId(new TransactionId(new BigInteger("42")));
+        Set<RpcError> errorSet = Collections.emptySet();
+        RpcResult<Void> result = Rpcs.getRpcResult(true, null, errorSet);
+        Mockito.when(
+                messageDispatchService.multipartRequest(Matchers.any(MultipartRequestInput.class),
+                        Matchers.any(SwitchConnectionDistinguisher.class))).thenReturn(Futures.immediateFuture(result));
+
+        GetNodeConnectorStatisticsInputBuilder input = new GetNodeConnectorStatisticsInputBuilder();
+        input.setNodeConnectorId(new NodeConnectorId("openflow:12:8"));
+        
+        Mockito.when(features.getVersion()).thenReturn((short)1);
+        mdSwitchOF10.getNodeConnectorStatistics(input.build()).get();
+        Mockito.when(features.getVersion()).thenReturn((short)4);
+        mdSwitchOF13.getNodeConnectorStatistics(input.build()).get();
+        Mockito.verify(messageDispatchService, Mockito.times(2)).multipartRequest(
+                Matchers.any(MultipartRequestInput.class),
+                Matchers.any(SwitchConnectionDistinguisher.class));
+    }
+    
+    /**
+     * Test method for
+     * {@link org.opendaylight.openflowplugin.openflow.md.core.sal.ModelDrivenSwitchImpl#
+     * updatePort(org.opendaylight.yang.gen.v1.urn.opendaylight.port.service.rev131107.
+     * UpdatePortInput)}
+     * .
+     * @throws ExecutionException 
+     * @throws InterruptedException 
+     */
+    @Test
+    public void testUpdatePort() throws InterruptedException, ExecutionException {
+        UpdatePortOutputBuilder updatePortOutput = new UpdatePortOutputBuilder();
+        updatePortOutput.setTransactionId(new TransactionId(new BigInteger("42")));
+        Set<RpcError> errorSet = Collections.emptySet();
+        RpcResult<UpdatePortOutput> result = Rpcs.getRpcResult(true, updatePortOutput.build(), errorSet);
+        Mockito.when(
+                messageDispatchService.portMod(Matchers.any(PortModInput.class),
+                        Matchers.any(SwitchConnectionDistinguisher.class))).thenReturn(Futures.immediateFuture(result));
+
+        UpdatePortInputBuilder input = new UpdatePortInputBuilder();
+        
+        PortBuilder portBuilder = new PortBuilder();
+        List<Port> ports = new ArrayList<Port>();
+        ports.add(createPort()); 
+        portBuilder.setPort(ports);
+        UpdatedPortBuilder updatedPortBuilder = new UpdatedPortBuilder();
+        updatedPortBuilder.setPort(portBuilder.build());
+        input.setUpdatedPort(updatedPortBuilder.build());
+
+        mdSwitchOF10.updatePort(input.build()).get();
+        mdSwitchOF13.updatePort(input.build()).get();
+        Mockito.verify(messageDispatchService, Mockito.times(2)).portMod(
+                Matchers.any(PortModInput.class),
+                Matchers.any(SwitchConnectionDistinguisher.class));
+    }
+    
+    private static Port createPort() {
+        org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.port.mod.port.PortBuilder port = 
+                new org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.port.mod.port.PortBuilder();
+        
+        port.setPortName("TestingPort01");
+        port.setMask(new PortConfig(true, true, true, true));
+        port.setConfiguration(new PortConfig(true, true, true, true));
+        port.setAdvertisedFeatures(new PortFeatures(true, true, true, true, 
+                                                    false, false, false, false, 
+                                                    true, true, true, true,
+                                                    false, false, false, false));
+        port.setPortNumber(new PortNumber(42L));
+        port.setHardwareAddress(new MacAddress("01:23:45:67:89:ab"));
+        port.setBarrier(true);
+        port.setContainerName("TestContainer");
+        port.setPortModOrder(25L);
+        port.setKey(new PortKey(25L));
+        return port.build();
+    }
+    
+    /**
+     * Test method for
+     * {@link org.opendaylight.openflowplugin.openflow.md.core.sal.ModelDrivenSwitchImpl#
+     * updateTable(org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.
+     * UpdateTableInput)}
+     * .
+     * @throws ExecutionException 
+     * @throws InterruptedException 
+     */
+    @Test
+    public void testUpdateTable() throws InterruptedException, ExecutionException {
+        UpdateTableOutputBuilder updateTableOutput = new UpdateTableOutputBuilder();
+        updateTableOutput.setTransactionId(new TransactionId(new BigInteger("42")));
+        Set<RpcError> errorSet = Collections.emptySet();
+        RpcResult<Void> result = Rpcs.getRpcResult(true, null, errorSet);
+        Mockito.when(
+                messageDispatchService.multipartRequest(Matchers.any(MultipartRequestInput.class),
+                        Matchers.any(SwitchConnectionDistinguisher.class))).thenReturn(Futures.immediateFuture(result));
+
+        UpdateTableInputBuilder input = new UpdateTableInputBuilder();
+        input.setUpdatedTable(createUpdateTable());
+
+        mdSwitchOF10.updateTable(input.build()).get();
+        mdSwitchOF13.updateTable(input.build()).get();
+        Mockito.verify(messageDispatchService, Mockito.times(2)).multipartRequest(
+                Matchers.any(MultipartRequestInput.class),
+                Matchers.any(SwitchConnectionDistinguisher.class));
+    }
+    
+    private static UpdatedTable createUpdateTable() {
+        UpdatedTableBuilder updatedTableBuilder = new UpdatedTableBuilder();
+        TableFeaturesBuilder tableFeaturesBuilder = new TableFeaturesBuilder();
+        tableFeaturesBuilder.setConfig(new TableConfig(true));
+        tableFeaturesBuilder.setKey(new TableFeaturesKey((short) 42));
+        tableFeaturesBuilder.setMaxEntries(42L);
+        tableFeaturesBuilder.setMetadataMatch(new BigInteger("42424242"));
+        tableFeaturesBuilder.setMetadataWrite(new BigInteger("42424242"));
+        tableFeaturesBuilder.setName("testTableFeatures");
+        tableFeaturesBuilder.setTableId((short) 41);
+        
+        TablePropertiesBuilder tablePropertiesBuilder = new TablePropertiesBuilder();
+        TableFeaturePropertiesBuilder tableFeaturePropertiesBuilder = new TableFeaturePropertiesBuilder();
+        tableFeaturePropertiesBuilder.setKey(new TableFeaturePropertiesKey(45));
+        tableFeaturePropertiesBuilder.setOrder(44);
+        tableFeaturePropertiesBuilder.setTableFeaturePropType(new ApplySetfieldBuilder().build());
+        List<TableFeatureProperties> tableFeatureProperties = new ArrayList<TableFeatureProperties>();
+        tableFeatureProperties.add(tableFeaturePropertiesBuilder.build());
+        tablePropertiesBuilder.setTableFeatureProperties(tableFeatureProperties);
+        
+        tableFeaturesBuilder.setTableProperties(tablePropertiesBuilder.build());
+        List<TableFeatures> tableFeatures = new ArrayList<TableFeatures>();
+        tableFeatures.add(tableFeaturesBuilder.build());
+        updatedTableBuilder.setTableFeatures(tableFeatures);
+        return updatedTableBuilder.build();
+    }
+    
+    /**
+     * Test method for
+     * {@link org.opendaylight.openflowplugin.openflow.md.core.sal.ModelDrivenSwitchImpl#
+     * getAllFlowStatisticsFromFlowTable(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.
+     * GetAllFlowStatisticsFromFlowTableInput)}
+     * .
+     * @throws ExecutionException 
+     * @throws InterruptedException 
+     */
+    @Test
+    public void testGetAllFlowStatisticsFromFlowTable() throws InterruptedException, ExecutionException {
+        GetAllFlowStatisticsFromFlowTableOutputBuilder allFlowStatisticsFromFlowTableOutput = 
+                new GetAllFlowStatisticsFromFlowTableOutputBuilder();
+        allFlowStatisticsFromFlowTableOutput.setTransactionId(new TransactionId(new BigInteger("42")));
+        Set<RpcError> errorSet = Collections.emptySet();
+        RpcResult<Void> result = Rpcs.getRpcResult(true, null, errorSet);
+        Mockito.when(
+                messageDispatchService.multipartRequest(Matchers.any(MultipartRequestInput.class),
+                        Matchers.any(SwitchConnectionDistinguisher.class))).thenReturn(Futures.immediateFuture(result));
+
+        GetAllFlowStatisticsFromFlowTableInputBuilder input = new GetAllFlowStatisticsFromFlowTableInputBuilder();
+        input.setTableId(new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TableId((short) 42));
+
+        mdSwitchOF10.getAllFlowStatisticsFromFlowTable(input.build()).get();
+        mdSwitchOF13.getAllFlowStatisticsFromFlowTable(input.build()).get();
+        Mockito.verify(messageDispatchService, Mockito.times(2)).multipartRequest(
+                Matchers.any(MultipartRequestInput.class),
+                Matchers.any(SwitchConnectionDistinguisher.class));
+    }
+    
+    /**
+     * Test method for
+     * {@link org.opendaylight.openflowplugin.openflow.md.core.sal.ModelDrivenSwitchImpl#
+     * getAllFlowStatisticsFromFlowTable(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.
+     * GetAllFlowStatisticsFromFlowTableInput)}
+     * .
+     * @throws ExecutionException 
+     * @throws InterruptedException 
+     */
+    @Test
+    public void testGetAllFlowsStatisticsFromAllFlowTables() throws InterruptedException, ExecutionException {
+        GetAllFlowsStatisticsFromAllFlowTablesOutputBuilder allFlowStatisticsFromAllFlowTablesOutput = 
+                new GetAllFlowsStatisticsFromAllFlowTablesOutputBuilder();
+        allFlowStatisticsFromAllFlowTablesOutput.setTransactionId(new TransactionId(new BigInteger("42")));
+        Set<RpcError> errorSet = Collections.emptySet();
+        RpcResult<Void> result = Rpcs.getRpcResult(true, null, errorSet);
+        Mockito.when(
+                messageDispatchService.multipartRequest(Matchers.any(MultipartRequestInput.class),
+                        Matchers.any(SwitchConnectionDistinguisher.class))).thenReturn(Futures.immediateFuture(result));
+
+        GetAllFlowsStatisticsFromAllFlowTablesInputBuilder input = 
+                                    new GetAllFlowsStatisticsFromAllFlowTablesInputBuilder();
+
+        mdSwitchOF10.getAllFlowsStatisticsFromAllFlowTables(input.build()).get();
+        mdSwitchOF13.getAllFlowsStatisticsFromAllFlowTables(input.build()).get();
+        Mockito.verify(messageDispatchService, Mockito.times(2)).multipartRequest(
+                Matchers.any(MultipartRequestInput.class),
+                Matchers.any(SwitchConnectionDistinguisher.class));
+    }
+    
+    /**
+     * Test method for
+     * {@link org.opendaylight.openflowplugin.openflow.md.core.sal.ModelDrivenSwitchImpl#
+     * getAllFlowStatisticsFromFlowTable(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.
+     * GetAllFlowStatisticsFromFlowTableInput)}
+     * .
+     * @throws ExecutionException 
+     * @throws InterruptedException 
+     */
+    @Test
+    public void testGetFlowStatisticsFromFlowTables() throws InterruptedException, ExecutionException {
+        GetFlowStatisticsFromFlowTableOutputBuilder flowStatisticsFromFlowTablesOutput = 
+                new GetFlowStatisticsFromFlowTableOutputBuilder();
+        flowStatisticsFromFlowTablesOutput.setTransactionId(new TransactionId(new BigInteger("42")));
+        Set<RpcError> errorSet = Collections.emptySet();
+        RpcResult<Void> result = Rpcs.getRpcResult(true, null, errorSet);
+        Mockito.when(
+                messageDispatchService.multipartRequest(Matchers.any(MultipartRequestInput.class),
+                        Matchers.any(SwitchConnectionDistinguisher.class))).thenReturn(Futures.immediateFuture(result));
+
+        GetFlowStatisticsFromFlowTableInputBuilder input = 
+                                    new GetFlowStatisticsFromFlowTableInputBuilder();
+        input.setMatch(createMatch()); 
+
+        mdSwitchOF10.getFlowStatisticsFromFlowTable(input.build()).get();
+        mdSwitchOF13.getFlowStatisticsFromFlowTable(input.build()).get();
+        Mockito.verify(messageDispatchService, Mockito.times(2)).multipartRequest(
+                Matchers.any(MultipartRequestInput.class),
+                Matchers.any(SwitchConnectionDistinguisher.class));
+    }
+    
+    private static Match createMatch() {
+        MatchBuilder matchBuilder = new MatchBuilder(); 
+        EthernetMatchBuilder ethernetMatchBuilder = new EthernetMatchBuilder();
+        EthernetDestinationBuilder ethernetDestinationBuilder = new EthernetDestinationBuilder();
+        ethernetDestinationBuilder.setAddress(new MacAddress("01:23:45:67:89:ab"));
+        ethernetDestinationBuilder.setMask(new MacAddress("01:23:45:67:89:ab"));
+        ethernetMatchBuilder.setEthernetDestination(ethernetDestinationBuilder.build()); 
+        EthernetSourceBuilder ethernetSourceBuilder = new EthernetSourceBuilder();
+        ethernetSourceBuilder.setAddress(new MacAddress("01:23:45:67:89:ab"));
+        ethernetSourceBuilder.setMask(new MacAddress("01:23:45:67:89:ab"));
+        ethernetMatchBuilder.setEthernetSource(ethernetSourceBuilder.build()); 
+        ethernetMatchBuilder.setEthernetType(new EthernetTypeBuilder().setType(new EtherType(42L)).build()); 
+        matchBuilder.setEthernetMatch(ethernetMatchBuilder.build());
+        return matchBuilder.build();
+    }
+    
+    /**
+     * Test method for
+     * {@link org.opendaylight.openflowplugin.openflow.md.core.sal.ModelDrivenSwitchImpl#
+     * getAggregateFlowStatisticsFromFlowTableForAllFlows(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.
+     * GetAggregateFlowStatisticsFromFlowTableForAllFlowsInput)}
+     * .
+     * @throws ExecutionException 
+     * @throws InterruptedException 
+     */
+    @Test
+    public void testGetAggregateFlowStatisticsFromFlowTableForAllFlows() throws InterruptedException, 
+                                                                                ExecutionException {
+        GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutputBuilder aggregateFlowStatisticsOutput = 
+                new GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutputBuilder();
+        aggregateFlowStatisticsOutput.setTransactionId(new TransactionId(new BigInteger("42")));
+        Set<RpcError> errorSet = Collections.emptySet();
+        RpcResult<Void> result = Rpcs.getRpcResult(true, null, errorSet);
+        Mockito.when(
+                messageDispatchService.multipartRequest(Matchers.any(MultipartRequestInput.class),
+                        Matchers.any(SwitchConnectionDistinguisher.class))).thenReturn(Futures.immediateFuture(result));
+
+        GetAggregateFlowStatisticsFromFlowTableForAllFlowsInputBuilder input = 
+                           new GetAggregateFlowStatisticsFromFlowTableForAllFlowsInputBuilder();
+        input.setTableId(new org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TableId((short) 42));
+
+        mdSwitchOF10.getAggregateFlowStatisticsFromFlowTableForAllFlows(input.build()).get();
+        mdSwitchOF13.getAggregateFlowStatisticsFromFlowTableForAllFlows(input.build()).get();
+        Mockito.verify(messageDispatchService, Mockito.times(2)).multipartRequest(
+                Matchers.any(MultipartRequestInput.class),
+                Matchers.any(SwitchConnectionDistinguisher.class));
+    }
+    
+    /**
+     * Test method for
+     * {@link org.opendaylight.openflowplugin.openflow.md.core.sal.ModelDrivenSwitchImpl#
+     * getAggregateFlowStatisticsFromFlowTableForGivenMatch(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.
+     * GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput)}
+     * .
+     * @throws ExecutionException 
+     * @throws InterruptedException 
+     */
+    @Test
+    public void testGetAggregateFlowStatisticsFromFlowTableForGivenMatch() throws InterruptedException, 
+                                                                                ExecutionException {
+        GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutputBuilder aggregateFlowStatisticsForMatchOutput = 
+                new GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutputBuilder();
+        aggregateFlowStatisticsForMatchOutput.setTransactionId(new TransactionId(new BigInteger("42")));
+        Set<RpcError> errorSet = Collections.emptySet();
+        RpcResult<Void> result = Rpcs.getRpcResult(true, null, errorSet);
+        Mockito.when(
+                messageDispatchService.multipartRequest(Matchers.any(MultipartRequestInput.class),
+                        Matchers.any(SwitchConnectionDistinguisher.class))).thenReturn(Futures.immediateFuture(result));
+
+        GetAggregateFlowStatisticsFromFlowTableForGivenMatchInputBuilder input = 
+                           new GetAggregateFlowStatisticsFromFlowTableForGivenMatchInputBuilder();
+        input.setMatch(createMatch());
+        input.setCookie(new FlowCookie(new BigInteger("123456")));
+        input.setCookieMask(new FlowCookie(new BigInteger("123456")));
+        input.setOutGroup(44L);
+        input.setOutPort(new BigInteger("12563"));
+
+        mdSwitchOF10.getAggregateFlowStatisticsFromFlowTableForGivenMatch(input.build()).get();
+        mdSwitchOF13.getAggregateFlowStatisticsFromFlowTableForGivenMatch(input.build()).get();
+        Mockito.verify(messageDispatchService, Mockito.times(2)).multipartRequest(
+                Matchers.any(MultipartRequestInput.class),
+                Matchers.any(SwitchConnectionDistinguisher.class));
+    }
+    
+    /**
+     * Test method for
+     * {@link org.opendaylight.openflowplugin.openflow.md.core.sal.ModelDrivenSwitchImpl#
+     * getFlowTablesStatistics(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.
+     * GetFlowTablesStatisticsInput)}
+     * .
+     * @throws ExecutionException 
+     * @throws InterruptedException 
+     */
+    @Test
+    public void testGetFlowTablesStatistics() throws InterruptedException, ExecutionException {
+        GetFlowTablesStatisticsOutputBuilder flowTableStatisticsOutput = 
+                new GetFlowTablesStatisticsOutputBuilder();
+        flowTableStatisticsOutput.setTransactionId(new TransactionId(new BigInteger("42")));
+        Set<RpcError> errorSet = Collections.emptySet();
+        RpcResult<Void> result = Rpcs.getRpcResult(true, null, errorSet);
+        Mockito.when(
+                messageDispatchService.multipartRequest(Matchers.any(MultipartRequestInput.class),
+                        Matchers.any(SwitchConnectionDistinguisher.class))).thenReturn(Futures.immediateFuture(result));
+
+        GetFlowTablesStatisticsInputBuilder input = new GetFlowTablesStatisticsInputBuilder();
+
+        mdSwitchOF10.getFlowTablesStatistics(input.build()).get();
+        mdSwitchOF13.getFlowTablesStatistics(input.build()).get();
+        Mockito.verify(messageDispatchService, Mockito.times(2)).multipartRequest(
+                Matchers.any(MultipartRequestInput.class),
+                Matchers.any(SwitchConnectionDistinguisher.class));
+    }
+    
+    /**
+     * Test method for
+     * {@link org.opendaylight.openflowplugin.openflow.md.core.sal.ModelDrivenSwitchImpl#
+     * getAllQueuesStatisticsFromAllPorts(org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.
+     * GetAllQueuesStatisticsFromAllPortsInput)}
+     * .
+     * @throws ExecutionException 
+     * @throws InterruptedException 
+     */
+    @Test
+    public void testGetAllQueuesStatisticsFromAllPorts() throws InterruptedException, ExecutionException {
+        GetAllQueuesStatisticsFromAllPortsOutputBuilder allQueuesStatisticsAllPortsOutput = 
+                new GetAllQueuesStatisticsFromAllPortsOutputBuilder();
+        allQueuesStatisticsAllPortsOutput.setTransactionId(new TransactionId(new BigInteger("42")));
+        Set<RpcError> errorSet = Collections.emptySet();
+        RpcResult<Void> result = Rpcs.getRpcResult(true, null, errorSet);
+        Mockito.when(
+                messageDispatchService.multipartRequest(Matchers.any(MultipartRequestInput.class),
+                        Matchers.any(SwitchConnectionDistinguisher.class))).thenReturn(Futures.immediateFuture(result));
+
+        GetAllQueuesStatisticsFromAllPortsInputBuilder input = 
+                new GetAllQueuesStatisticsFromAllPortsInputBuilder();
+
+        mdSwitchOF10.getAllQueuesStatisticsFromAllPorts(input.build()).get();
+        mdSwitchOF13.getAllQueuesStatisticsFromAllPorts(input.build()).get();
+        Mockito.verify(messageDispatchService, Mockito.times(2)).multipartRequest(
+                Matchers.any(MultipartRequestInput.class),
+                Matchers.any(SwitchConnectionDistinguisher.class));
+    }
+    
+    /**
+     * Test method for
+     * {@link org.opendaylight.openflowplugin.openflow.md.core.sal.ModelDrivenSwitchImpl#
+     * getAllQueuesStatisticsFromGivenPort(org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.
+     * GetAllQueuesStatisticsFromGivenPortInput)}
+     * .
+     * @throws ExecutionException 
+     * @throws InterruptedException 
+     */
+    @Test
+    public void testGetAllQueuesStatisticsFromGivenPort() throws InterruptedException, ExecutionException {
+        GetAllQueuesStatisticsFromGivenPortOutputBuilder allQueuesStatisticsGivenPortsOutput = 
+                new GetAllQueuesStatisticsFromGivenPortOutputBuilder();
+        allQueuesStatisticsGivenPortsOutput.setTransactionId(new TransactionId(new BigInteger("42")));
+        Set<RpcError> errorSet = Collections.emptySet();
+        RpcResult<Void> result = Rpcs.getRpcResult(true, null, errorSet);
+        Mockito.when(
+                messageDispatchService.multipartRequest(Matchers.any(MultipartRequestInput.class),
+                        Matchers.any(SwitchConnectionDistinguisher.class))).thenReturn(Futures.immediateFuture(result));
+
+        GetAllQueuesStatisticsFromGivenPortInputBuilder input = 
+                new GetAllQueuesStatisticsFromGivenPortInputBuilder();
+        input.setNodeConnectorId(new NodeConnectorId("openflow:12:8"));
+        
+        Mockito.when(features.getVersion()).thenReturn((short)1);
+        mdSwitchOF10.getAllQueuesStatisticsFromGivenPort(input.build()).get();
+        Mockito.when(features.getVersion()).thenReturn((short)4);
+        mdSwitchOF13.getAllQueuesStatisticsFromGivenPort(input.build()).get();
+        Mockito.verify(messageDispatchService, Mockito.times(2)).multipartRequest(
+                Matchers.any(MultipartRequestInput.class),
+                Matchers.any(SwitchConnectionDistinguisher.class));
+    }
+    
+    /**
+     * Test method for
+     * {@link org.opendaylight.openflowplugin.openflow.md.core.sal.ModelDrivenSwitchImpl#
+     * getQueueStatisticsFromGivenPort(org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.
+     * GetQueueStatisticsFromGivenPortInput)}
+     * .
+     * @throws ExecutionException 
+     * @throws InterruptedException 
+     */
+    @Test
+    public void testGetQueueStatisticsFromGivenPort() throws InterruptedException, ExecutionException {
+        GetQueueStatisticsFromGivenPortOutputBuilder queuesStatisticsGivenPortOutput = 
+                new GetQueueStatisticsFromGivenPortOutputBuilder();
+        queuesStatisticsGivenPortOutput.setTransactionId(new TransactionId(new BigInteger("42")));
+        Set<RpcError> errorSet = Collections.emptySet();
+        RpcResult<Void> result = Rpcs.getRpcResult(true, null, errorSet);
+        Mockito.when(
+                messageDispatchService.multipartRequest(Matchers.any(MultipartRequestInput.class),
+                        Matchers.any(SwitchConnectionDistinguisher.class))).thenReturn(Futures.immediateFuture(result));
+
+        GetQueueStatisticsFromGivenPortInputBuilder input = 
+                new GetQueueStatisticsFromGivenPortInputBuilder();
+        input.setNodeConnectorId(new NodeConnectorId("openflow:12:8"));
+        input.setQueueId(new QueueId(55L));
+        
+        Mockito.when(features.getVersion()).thenReturn((short)1);
+        mdSwitchOF10.getQueueStatisticsFromGivenPort(input.build()).get();
+        Mockito.when(features.getVersion()).thenReturn((short)4);
+        mdSwitchOF13.getQueueStatisticsFromGivenPort(input.build()).get();
+        Mockito.verify(messageDispatchService, Mockito.times(2)).multipartRequest(
+                Matchers.any(MultipartRequestInput.class),
+                Matchers.any(SwitchConnectionDistinguisher.class));
     }
 }