BUG 2661 - sonar issues in openflowplugin artifact2 53/15553/8
authorJozef Gloncak <jgloncak@cisco.com>
Fri, 20 Feb 2015 13:20:37 +0000 (14:20 +0100)
committerJozef Gloncak <jgloncak@cisco.com>
Thu, 5 Mar 2015 13:15:57 +0000 (13:15 +0000)
Some of sonar issues in openflowplugin artifact in package org.opendaylight.openflowplugin.openflow.md.core were solved.

Change-Id: Id2731f16cd5c026245cd6c3894dc1ca90b13c787
Signed-off-by: Jozef Gloncak <jgloncak@cisco.com>
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/AbstractModelDrivenSwitch.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/BuildSwitchCapabilitiesOF10.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/BuildSwitchCapabilitiesOF13.java
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/OpenflowPluginProvider.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/SalRegistrationManager.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/SwitchFeaturesUtil.java

index 1dbec72a52ac43315a16c8b2c235904f0b8c60e1..4cc5bc73c2523f701a8dae35906f6b05e11df77c 100644 (file)
@@ -37,32 +37,6 @@ public abstract class AbstractModelDrivenSwitch implements ModelDrivenSwitch {
 
     private final InstanceIdentifier<Node> identifier;
 
-    private RoutedRpcRegistration<SalFlowService> flowRegistration;
-
-    private RoutedRpcRegistration<SalGroupService> groupRegistration;
-    
-    private RoutedRpcRegistration<SalTableService> tableRegistration;
-
-    private RoutedRpcRegistration<SalMeterService> meterRegistration;
-    
-    private RoutedRpcRegistration<SalPortService> portRegistration;
-    
-    private RoutedRpcRegistration<NodeConfigService> nodeConfigRegistration;
-
-    private RoutedRpcRegistration<PacketProcessingService> packetRegistration;
-
-    private RoutedRpcRegistration<OpendaylightFlowStatisticsService> flowStatisticsRegistration;
-
-    private RoutedRpcRegistration<OpendaylightGroupStatisticsService> groupStatisticsRegistration;
-
-    private RoutedRpcRegistration<OpendaylightMeterStatisticsService> meterStatisticsRegistration;
-
-    private RoutedRpcRegistration<OpendaylightPortStatisticsService> portStatisticsRegistration;
-
-    private RoutedRpcRegistration<OpendaylightFlowTableStatisticsService> flowTableStatisticsRegistration;
-
-    private RoutedRpcRegistration<OpendaylightQueueStatisticsService> queueStatisticsRegistration;
-
     protected final SessionContext sessionContext;
 
     protected AbstractModelDrivenSwitch(InstanceIdentifier<Node> identifier,SessionContext conductor) {
@@ -80,55 +54,55 @@ public abstract class AbstractModelDrivenSwitch implements ModelDrivenSwitch {
         CompositeObjectRegistrationBuilder<ModelDrivenSwitch> builder = CompositeObjectRegistration
                 .<ModelDrivenSwitch> builderFor(this);
 
-        flowRegistration = ctx.addRoutedRpcImplementation(SalFlowService.class, this);
+        final RoutedRpcRegistration<SalFlowService> flowRegistration = ctx.addRoutedRpcImplementation(SalFlowService.class, this);
         flowRegistration.registerPath(NodeContext.class, getIdentifier());
         builder.add(flowRegistration);
-        
-        portRegistration = ctx.addRoutedRpcImplementation(SalPortService.class, this);
+
+        final RoutedRpcRegistration<SalPortService> portRegistration = ctx.addRoutedRpcImplementation(SalPortService.class, this);
         portRegistration.registerPath(NodeContext.class, getIdentifier());
         builder.add(portRegistration);
 
-        meterRegistration = ctx.addRoutedRpcImplementation(SalMeterService.class, this);
+        final RoutedRpcRegistration<SalMeterService> meterRegistration = ctx.addRoutedRpcImplementation(SalMeterService.class, this);
         meterRegistration.registerPath(NodeContext.class, getIdentifier());
         builder.add(meterRegistration);
 
-        groupRegistration = ctx.addRoutedRpcImplementation(SalGroupService.class, this);
+        final RoutedRpcRegistration<SalGroupService> groupRegistration = ctx.addRoutedRpcImplementation(SalGroupService.class, this);
         groupRegistration.registerPath(NodeContext.class, getIdentifier());
         builder.add(groupRegistration);
-        
-        tableRegistration = ctx.addRoutedRpcImplementation(SalTableService.class, this);
+
+        final RoutedRpcRegistration<SalTableService> tableRegistration = ctx.addRoutedRpcImplementation(SalTableService.class, this);
         tableRegistration.registerPath(NodeContext.class, getIdentifier());
         builder.add(tableRegistration);
 
-        packetRegistration = ctx.addRoutedRpcImplementation(PacketProcessingService.class, this);
+        final RoutedRpcRegistration<PacketProcessingService> packetRegistration = ctx.addRoutedRpcImplementation(PacketProcessingService.class, this);
         packetRegistration.registerPath(NodeContext.class, getIdentifier());
         builder.add(packetRegistration);
 
-        flowStatisticsRegistration = ctx.addRoutedRpcImplementation(OpendaylightFlowStatisticsService.class, this);
+        final RoutedRpcRegistration<OpendaylightFlowStatisticsService> flowStatisticsRegistration = ctx.addRoutedRpcImplementation(OpendaylightFlowStatisticsService.class, this);
         flowStatisticsRegistration.registerPath(NodeContext.class, getIdentifier());
         builder.add(flowStatisticsRegistration);
 
-        groupStatisticsRegistration = ctx.addRoutedRpcImplementation(OpendaylightGroupStatisticsService.class, this);
+        final RoutedRpcRegistration<OpendaylightGroupStatisticsService> groupStatisticsRegistration = ctx.addRoutedRpcImplementation(OpendaylightGroupStatisticsService.class, this);
         groupStatisticsRegistration.registerPath(NodeContext.class, getIdentifier());
         builder.add(groupStatisticsRegistration);
 
-        meterStatisticsRegistration = ctx.addRoutedRpcImplementation(OpendaylightMeterStatisticsService.class, this);
+        final RoutedRpcRegistration<OpendaylightMeterStatisticsService> meterStatisticsRegistration = ctx.addRoutedRpcImplementation(OpendaylightMeterStatisticsService.class, this);
         meterStatisticsRegistration.registerPath(NodeContext.class, getIdentifier());
         builder.add(meterStatisticsRegistration);
 
-        portStatisticsRegistration = ctx.addRoutedRpcImplementation(OpendaylightPortStatisticsService.class, this);
+        final RoutedRpcRegistration<OpendaylightPortStatisticsService> portStatisticsRegistration = ctx.addRoutedRpcImplementation(OpendaylightPortStatisticsService.class, this);
         portStatisticsRegistration.registerPath(NodeContext.class, getIdentifier());
         builder.add(portStatisticsRegistration);
 
-        nodeConfigRegistration = ctx.addRoutedRpcImplementation(NodeConfigService.class, this);
+        final RoutedRpcRegistration<NodeConfigService> nodeConfigRegistration = ctx.addRoutedRpcImplementation(NodeConfigService.class, this);
         nodeConfigRegistration.registerPath(NodeContext.class, getIdentifier());
         builder.add(nodeConfigRegistration);
-        
-        flowTableStatisticsRegistration = ctx.addRoutedRpcImplementation(OpendaylightFlowTableStatisticsService.class, this);
+
+        final RoutedRpcRegistration<OpendaylightFlowTableStatisticsService> flowTableStatisticsRegistration = ctx.addRoutedRpcImplementation(OpendaylightFlowTableStatisticsService.class, this);
         flowTableStatisticsRegistration.registerPath(NodeContext.class, getIdentifier());
         builder.add(flowTableStatisticsRegistration);
-        
-        queueStatisticsRegistration = ctx.addRoutedRpcImplementation(OpendaylightQueueStatisticsService.class, this);
+
+        final RoutedRpcRegistration<OpendaylightQueueStatisticsService> queueStatisticsRegistration = ctx.addRoutedRpcImplementation(OpendaylightQueueStatisticsService.class, this);
         queueStatisticsRegistration.registerPath(NodeContext.class, getIdentifier());
         builder.add(queueStatisticsRegistration);
 
index 4d605e4f0a168d9d37f21f1d2b8991e73d114f0e..0fbc1a1e7fc0617cb91d2cb4f80f700881c0f0c5 100644 (file)
@@ -31,7 +31,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731
  * @author jsebin
  *
  */
-public class BuildSwitchCapabilitiesOF10 implements BuildSwitchFeatures {
+public final class BuildSwitchCapabilitiesOF10 implements BuildSwitchFeatures {
 
     private static BuildSwitchCapabilitiesOF10 instance = new BuildSwitchCapabilitiesOF10();
     
index 17ea875aef51bc24b231a24f7fd8944e3edd10a7..f9d1f4370fe3d9b504b1c099e9a7fdf33e91819a 100644 (file)
@@ -29,7 +29,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731
  * @author jsebin
  *
  */
-public class BuildSwitchCapabilitiesOF13 implements BuildSwitchFeatures {
+public final class BuildSwitchCapabilitiesOF13 implements BuildSwitchFeatures {
 
 private static BuildSwitchCapabilitiesOF13 instance = new BuildSwitchCapabilitiesOF13();
     
index 110af9890bfb0ab423faac9ee1b37ee9085985f0..46eca4f7d94a9b062682108337afb114da9b3002 100644 (file)
@@ -98,7 +98,6 @@ public class ModelDrivenSwitchImpl extends AbstractModelDrivenSwitch {
     private final NodeId nodeId;
     private final IMessageDispatchService messageService;
     private short version = 0;
-    private NotificationProviderService rpcNotificationProviderService;
     private OFRpcTaskContext rpcTaskContext;
 
     // TODO:read timeout from configSubsystem
@@ -111,7 +110,7 @@ public class ModelDrivenSwitchImpl extends AbstractModelDrivenSwitch {
         this.nodeId = nodeId;
         messageService = sessionContext.getMessageDispatchService();
         version = sessionContext.getPrimaryConductor().getVersion();
-        rpcNotificationProviderService = OFSessionUtil.getSessionManager().getNotificationProviderService();
+        final NotificationProviderService rpcNotificationProviderService = OFSessionUtil.getSessionManager().getNotificationProviderService();
 
         rpcTaskContext = new OFRpcTaskContext();
         rpcTaskContext.setSession(sessionContext);
@@ -284,248 +283,201 @@ public class ModelDrivenSwitchImpl extends AbstractModelDrivenSwitch {
     @Override
     public Future<RpcResult<GetGroupDescriptionOutput>> getGroupDescription(final GetGroupDescriptionInput input) {
         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;
+                OFRpcTaskFactory.createGetGroupDescriptionTask(rpcTaskContext, input, null);
+        return task.submit();
     }
 
     @Override
     public Future<RpcResult<GetGroupFeaturesOutput>> getGroupFeatures(final GetGroupFeaturesInput input) {
         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;
+                OFRpcTaskFactory.createGetGroupFeaturesTask(rpcTaskContext, input, null);
+        return task.submit();
     }
 
     @Override
     public Future<RpcResult<GetGroupStatisticsOutput>> getGroupStatistics(final GetGroupStatisticsInput input) {
         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;
+                OFRpcTaskFactory.createGetGroupStatisticsTask(rpcTaskContext, input, null);
+        return task.submit();
     }
 
     @Override
     public Future<RpcResult<GetAllMeterConfigStatisticsOutput>> getAllMeterConfigStatistics(
             final GetAllMeterConfigStatisticsInput input) {
         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;
+                OFRpcTaskFactory.createGetAllMeterConfigStatisticsTask(rpcTaskContext, input, null);
+        return task.submit();
     }
 
     @Override
     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;
+                OFRpcTaskFactory.createGetAllMeterStatisticsTask(rpcTaskContext, input, null);
+        return task.submit();
     }
 
     @Override
     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;
+                OFRpcTaskFactory.createGetMeterFeaturesTask(rpcTaskContext, input, null);
+        return task.submit();
     }
 
     @Override
     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;
+                OFRpcTaskFactory.createGetMeterStatisticsTask(rpcTaskContext, input, null);
+        return task.submit();
     }
 
     @Override
     public Future<RpcResult<GetAllNodeConnectorsStatisticsOutput>> getAllNodeConnectorsStatistics(
             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;
+                OFRpcTaskFactory.createGetAllNodeConnectorsStatisticsTask(rpcTaskContext, input, null);
+        return task.submit();
     }
 
     @Override
     public Future<RpcResult<GetNodeConnectorStatisticsOutput>> getNodeConnectorStatistics(
             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;
+                OFRpcTaskFactory.createGetNodeConnectorStatisticsTask(rpcTaskContext, input, null);
+        return task.submit();
     }
 
     @Override
     public Future<RpcResult<UpdatePortOutput>> updatePort(final UpdatePortInput input) {
         LOG.debug("Calling the updatePort RPC method on MessageDispatchService");
 
-        // use primary connection
-        SwitchConnectionDistinguisher cookie = null;
-
         OFRpcTask<UpdatePortInput, RpcResult<UpdatePortOutput>> task =
-                OFRpcTaskFactory.createUpdatePortTask(rpcTaskContext, input, cookie);
-        ListenableFuture<RpcResult<UpdatePortOutput>> result = task.submit();
-
-        return result;
+                OFRpcTaskFactory.createUpdatePortTask(rpcTaskContext, input, null);
+        return task.submit();
     }
 
     @Override
     public Future<RpcResult<UpdateTableOutput>> updateTable(final UpdateTableInput input) {
         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;
+                OFRpcTaskFactory.createUpdateTableTask(rpcTaskContext, input, null);
+        return task.submit();
     }
 
     @Override
     public Future<RpcResult<GetAllFlowStatisticsFromFlowTableOutput>> getAllFlowStatisticsFromFlowTable(
             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;
+                OFRpcTaskFactory.createGetAllFlowStatisticsFromFlowTableTask(rpcTaskContext, input, null);
+        return task.submit();
     }
 
     @Override
     public Future<RpcResult<GetAllFlowsStatisticsFromAllFlowTablesOutput>> getAllFlowsStatisticsFromAllFlowTables(
             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;
+                OFRpcTaskFactory.createGetAllFlowsStatisticsFromAllFlowTablesTask(rpcTaskContext, input, null);
+        return task.submit();
     }
 
     @Override
     public Future<RpcResult<GetFlowStatisticsFromFlowTableOutput>> getFlowStatisticsFromFlowTable(
             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;
+                OFRpcTaskFactory.createGetFlowStatisticsFromFlowTableTask(rpcTaskContext, input, null);
+        return task.submit();
     }
 
     @Override
     public Future<RpcResult<GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput>> getAggregateFlowStatisticsFromFlowTableForAllFlows(
             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;
+                OFRpcTaskFactory.createGetAggregateFlowStatisticsFromFlowTableForAllFlowsTask(rpcTaskContext, input, null);
+        return task.submit();
     }
 
     @Override
     public Future<RpcResult<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput>> getAggregateFlowStatisticsFromFlowTableForGivenMatch(
             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;
+                OFRpcTaskFactory.createGetAggregateFlowStatisticsFromFlowTableForGivenMatchTask(rpcTaskContext, input, null);
+        return task.submit();
     }
 
     @Override
     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;
+                OFRpcTaskFactory.createGetFlowTablesStatisticsTask(rpcTaskContext, input, null);
+        return task.submit();
     }
 
     @Override
     public Future<RpcResult<GetAllQueuesStatisticsFromAllPortsOutput>> getAllQueuesStatisticsFromAllPorts(
             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;
+                OFRpcTaskFactory.createGetAllQueuesStatisticsFromAllPortsTask(rpcTaskContext, input, null);
+        return task.submit();
     }
 
     @Override
     public Future<RpcResult<GetAllQueuesStatisticsFromGivenPortOutput>> getAllQueuesStatisticsFromGivenPort(
             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;
+                OFRpcTaskFactory.createGetAllQueuesStatisticsFromGivenPortTask(rpcTaskContext, input, null);
+        return task.submit();
     }
 
     @Override
     public Future<RpcResult<GetQueueStatisticsFromGivenPortOutput>> getQueueStatisticsFromGivenPort(
             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;
+                OFRpcTaskFactory.createGetQueueStatisticsFromGivenPortTask(rpcTaskContext, input, null);
+        return task.submit();
     }
 
     @Override
     public Future<RpcResult<SetConfigOutput>> setConfig(SetConfigInput input) {
-        SwitchConnectionDistinguisher cookie = null;
-        OFRpcTask<SetConfigInput, RpcResult<SetConfigOutput>> task = OFRpcTaskFactory.createSetNodeConfigTask(rpcTaskContext, input, cookie);
-        ListenableFuture<RpcResult<SetConfigOutput>> result = task.submit();
-        return result;
+        OFRpcTask<SetConfigInput, RpcResult<SetConfigOutput>> task = OFRpcTaskFactory.createSetNodeConfigTask(rpcTaskContext, input, null);
+        return task.submit();
     }
 }
index aa8982043e7e8126d90fc402e31ff45177c8ee97..dff14ae0ff8ea72c8216e8169c7637ba6618fc8b 100644 (file)
@@ -1,6 +1,6 @@
 /**
  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
- * 
+ *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
@@ -8,7 +8,6 @@
 package org.opendaylight.openflowplugin.openflow.md.core.sal;
 
 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;
@@ -29,14 +28,14 @@ import org.opendaylight.yangtools.yang.common.RpcError;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-
 import com.google.common.base.Function;
 
 /**
- * collection of transformation functions dedicated to rpc future results  
+ * collection of transformation functions dedicated to rpc future results
  */
 public abstract class OFRpcFutureResultTransformFactory {
-    
+
+    private static final String MSG_ADD_FLOW_RPC = "Returning the Add Flow RPC result to MD-SAL";
     protected static Logger LOG = LoggerFactory
             .getLogger(OFRpcFutureResultTransformFactory.class);
 
@@ -47,8 +46,7 @@ public abstract class OFRpcFutureResultTransformFactory {
      */
     protected static <E> RpcResult<E> assembleRpcResult(RpcResult<?> input, E result) {
         Collection<RpcError> errors = input.getErrors();
-        RpcResult<E> rpcResult = Rpcs.getRpcResult(input.isSuccessful(), result, errors);
-        return rpcResult;
+        return Rpcs.getRpcResult(input.isSuccessful(), result, errors);
     }
 
     /**
@@ -67,13 +65,13 @@ public abstract class OFRpcFutureResultTransformFactory {
                 AddFlowOutput result = addFlowOutput.build();
 
                 RpcResult<AddFlowOutput> rpcResult = assembleRpcResult(input, result);
-                LOG.debug("Returning the Add Flow RPC result to MD-SAL");
+                LOG.debug(MSG_ADD_FLOW_RPC);
                 return rpcResult;
             }
 
         };
     }
-    
+
     /**
      * @return translator from {@link UpdateFlowOutput} to {@link RemoveFlowOutput}
      */
@@ -90,13 +88,13 @@ public abstract class OFRpcFutureResultTransformFactory {
                 RemoveFlowOutput result = removeFlowOutput.build();
 
                 RpcResult<RemoveFlowOutput> rpcResult = assembleRpcResult(input, result);
-                LOG.debug("Returning the Add Flow RPC result to MD-SAL");
+                LOG.debug(MSG_ADD_FLOW_RPC);
                 return rpcResult;
             }
 
         };
     }
-    
+
     /**
      * @return translator from {@link UpdateGroupOutput} to {@link AddGroupOutput}
      */
@@ -106,7 +104,7 @@ public abstract class OFRpcFutureResultTransformFactory {
             @Override
             public RpcResult<AddGroupOutput> apply(final RpcResult<UpdateGroupOutput> input) {
                 UpdateGroupOutput updateGroupOutput = input.getResult();
-                
+
                 AddGroupOutputBuilder addGroupOutput = new AddGroupOutputBuilder();
                 addGroupOutput.setTransactionId(updateGroupOutput.getTransactionId());
                 AddGroupOutput result = addGroupOutput.build();
@@ -117,7 +115,7 @@ public abstract class OFRpcFutureResultTransformFactory {
             }
         };
     }
-    
+
     /**
      * @return
      */
@@ -134,13 +132,13 @@ public abstract class OFRpcFutureResultTransformFactory {
                 RemoveGroupOutput result = removeGroupOutput.build();
 
                 RpcResult<RemoveGroupOutput> rpcResult = assembleRpcResult(input, result);
-                LOG.debug("Returning the Add Flow RPC result to MD-SAL");
+                LOG.debug(MSG_ADD_FLOW_RPC);
                 return rpcResult;
             }
 
         };
     }
-    
+
     /**
      * @return translator from {@link UpdateMeterOutput} to {@link AddMeterOutput}
      */
@@ -150,7 +148,7 @@ public abstract class OFRpcFutureResultTransformFactory {
             @Override
             public RpcResult<AddMeterOutput> apply(final RpcResult<UpdateMeterOutput> input) {
                 UpdateMeterOutput updateMeterOutput = input.getResult();
-                
+
                 AddMeterOutputBuilder addMeterOutput = new AddMeterOutputBuilder();
                 addMeterOutput.setTransactionId(updateMeterOutput.getTransactionId());
                 AddMeterOutput result = addMeterOutput.build();
@@ -161,8 +159,8 @@ public abstract class OFRpcFutureResultTransformFactory {
             }
         };
     }
-    
-    
+
+
     /**
      * @return
      */
@@ -172,7 +170,7 @@ public abstract class OFRpcFutureResultTransformFactory {
             @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();
@@ -183,8 +181,8 @@ public abstract class OFRpcFutureResultTransformFactory {
             }
         };
     }
-    
-    
-    
-    
+
+
+
+
 }
index 7cbbc262e16670dbca9b806ef5da244de3afd27f..3ca9a2676d0afa0ca0687797b64e40d4c1ebcef8 100644 (file)
@@ -8,9 +8,7 @@
 package org.opendaylight.openflowplugin.openflow.md.core.sal;
 
 import java.util.Collection;
-import java.util.Collections;
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ConsumerContext;
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
 import org.opendaylight.controller.sal.binding.api.BindingAwareProvider;
 import org.opendaylight.openflowjava.protocol.spi.connection.SwitchConnectionProvider;
@@ -22,7 +20,6 @@ import org.opendaylight.openflowplugin.api.statistics.MessageCountDumper;
 import org.opendaylight.openflowplugin.api.statistics.MessageObservatory;
 import org.opendaylight.openflowplugin.statistics.MessageSpyCounterImpl;
 import org.opendaylight.yangtools.yang.binding.DataContainer;
-import org.opendaylight.yangtools.yang.binding.RpcService;
 import org.osgi.framework.BundleContext;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -32,7 +29,7 @@ import org.slf4j.LoggerFactory;
  */
 public class OpenflowPluginProvider implements BindingAwareProvider, AutoCloseable {
 
-    private static Logger LOG = LoggerFactory.getLogger(OpenflowPluginProvider.class);
+    private static final Logger LOG = LoggerFactory.getLogger(OpenflowPluginProvider.class);
 
     private BindingAwareBroker broker;
 
index 7b48c623faf9e9ff6c4aa3885491268846c2397c..02d60ac1109a5def49f06e7510dfb185bb0e707f 100644 (file)
@@ -50,7 +50,7 @@ import org.slf4j.LoggerFactory;
  */
 public class SalRegistrationManager implements SessionListener, AutoCloseable {
 
-    private final static Logger LOG = LoggerFactory.getLogger(SalRegistrationManager.class);
+    private static final Logger LOG = LoggerFactory.getLogger(SalRegistrationManager.class);
 
     private ProviderContext providerContext;
 
@@ -138,7 +138,7 @@ public class SalRegistrationManager implements SessionListener, AutoCloseable {
         try {
             builder2.setIpAddress(getIpAddressOf(sw));
         } catch (Exception e) {
-            LOG.warn("IP address of the node {} cannot be obtained: {}", sw.getNodeId(), e.getMessage());
+            LOG.warn("IP address of the node {} cannot be obtained.", sw.getNodeId(), e);
         }
         builder2.setSwitchFeatures(swFeaturesUtil.buildSwitchFeatures(features));
         builder.addAugmentation(FlowCapableNodeUpdated.class, builder2.build());
@@ -148,10 +148,6 @@ public class SalRegistrationManager implements SessionListener, AutoCloseable {
 
     private static IpAddress getIpAddressOf(ModelDrivenSwitch sw) {
         SessionContext sessionContext = sw.getSessionContext();
-//        if (!sessionContext.isValid()) {
-//            LOG.warn("IP address of the node {} cannot be obtained. Session is not valid.", sw.getNodeId());
-//            return null;
-//        }
         Preconditions.checkNotNull(sessionContext.getPrimaryConductor(),
                 "primary conductor must not be NULL -> " + sw.getNodeId());
         Preconditions.checkNotNull(sessionContext.getPrimaryConductor().getConnectionAdapter(),
index cb9ff68901457d700c3116f6c51d338e78073d4a..f35f71c58d1742bc62a35d0e1fbe17ba096f11e1 100644 (file)
@@ -7,6 +7,9 @@
  */
 package org.opendaylight.openflowplugin.openflow.md.core.sal;
 
+import static org.opendaylight.openflowplugin.api.OFConstants.OFP_VERSION_1_0;
+import static org.opendaylight.openflowplugin.api.OFConstants.OFP_VERSION_1_3;
+
 import java.util.HashMap;
 import java.util.Map;
 
@@ -20,17 +23,17 @@ import org.slf4j.LoggerFactory;
  * @author jsebin
  *
  */
-public class SwitchFeaturesUtil {
+public final class SwitchFeaturesUtil {
 
-    protected static final Logger LOG = LoggerFactory.getLogger(SwitchFeaturesUtil.class);
+    private static final Logger LOG = LoggerFactory.getLogger(SwitchFeaturesUtil.class);
     
     private static SwitchFeaturesUtil instance = new SwitchFeaturesUtil();
     private Map<Short, BuildSwitchFeatures> swFeaturesBuilders;
     
     private SwitchFeaturesUtil() {
         swFeaturesBuilders = new HashMap<>();
-        swFeaturesBuilders.put((short) 1, BuildSwitchCapabilitiesOF10.getInstance());
-        swFeaturesBuilders.put((short) 4, BuildSwitchCapabilitiesOF13.getInstance());
+        swFeaturesBuilders.put(OFP_VERSION_1_0, BuildSwitchCapabilitiesOF10.getInstance());
+        swFeaturesBuilders.put(OFP_VERSION_1_3, BuildSwitchCapabilitiesOF13.getInstance());
     }
     
     /**
@@ -48,7 +51,7 @@ public class SwitchFeaturesUtil {
      */
     public SwitchFeatures buildSwitchFeatures(GetFeaturesOutput features) {
 
-        if(swFeaturesBuilders.containsKey(features.getVersion()) == true) {
+        if(swFeaturesBuilders.containsKey(features.getVersion())) {
             LOG.debug("map contains version {}", features.getVersion());
             try {
                 return swFeaturesBuilders.get(features.getVersion()).build(features);