Sonar issues 30/42330/4
authorIcaro Camelo <icamelo@inocybe.com>
Fri, 22 Jul 2016 18:00:22 +0000 (14:00 -0400)
committerIcaro Camelo <icamelo@inocybe.com>
Tue, 26 Jul 2016 18:01:20 +0000 (14:01 -0400)
Change-Id: Ide7595adaf29db0d7f09456a60d8b8277ef497be
Signed-off-by: Icaro Camelo <icamelo@inocybe.com>
26 files changed:
applications/bulk-o-matic/src/main/java/org/opendaylight/openflowplugin/applications/bulk/o/matic/BulkOMaticUtils.java
applications/bulk-o-matic/src/main/java/org/opendaylight/openflowplugin/applications/bulk/o/matic/FlowReader.java
applications/bulk-o-matic/src/main/java/org/opendaylight/openflowplugin/applications/bulk/o/matic/FlowWriterConcurrent.java
applications/bulk-o-matic/src/main/java/org/opendaylight/openflowplugin/applications/bulk/o/matic/FlowWriterSequential.java
applications/forwardingrules-manager/src/main/java/org/opendaylight/openflowplugin/applications/frm/impl/AbstractNodeConnectorCommitter.java
applications/forwardingrules-manager/src/main/java/org/opendaylight/openflowplugin/applications/frm/impl/FlowNodeConnectorInventoryTranslatorImpl.java
applications/forwardingrules-manager/src/main/java/org/opendaylight/openflowplugin/applications/frm/impl/FlowNodeReconciliationImpl.java
applications/forwardingrules-manager/src/main/java/org/opendaylight/openflowplugin/applications/frm/impl/TableForwarder.java
extension/openflowjava-extension-nicira-api/src/main/java/org/opendaylight/openflowjava/nx/api/NiciraActionDeserializerKey.java
extension/openflowjava-extension-nicira-api/src/main/java/org/opendaylight/openflowjava/nx/api/NiciraUtil.java
extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/NiciraMatchCodecs.java
extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/action/AbstractActionCodec.java
extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/action/ConntrackCodec.java
extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/action/MultipathCodec.java
extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/action/NiciraActionCodecs.java
extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/action/ResubmitCodec.java
extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/action/SetNshc1Codec.java
extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/action/SetNshc3Codec.java
extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/NxmHeader.java
openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/OFConstants.java
openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/md/core/session/SwitchSessionKeyOF.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/registry/flow/FlowRegistryKeyFactory.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/role/RoleContextImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/role/RoleManagerImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/rpc/listener/ItemLifecycleListenerImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/AbstractService.java

index 33e2f140bee52f554626d4948ef86df37ce717fc..37f9899546ca769683ab814a9c20a2b44fca7ef6 100644 (file)
@@ -30,11 +30,13 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 
 public class BulkOMaticUtils {
 
-    public final static int DEFUALT_STATUS = FlowCounter.OperationStatus.INIT.status();
-    public final static int DEFAULT_FLOW_COUNT = 0;
-    public final static long DEFAULT_COMPLETION_TIME = 0;
-    public final static String DEFAULT_UNITS = "ns";
-    public final static String DEVICE_TYPE_PREFIX = "openflow:";
+    private BulkOMaticUtils () { }
+
+    public static final int DEFUALT_STATUS = FlowCounter.OperationStatus.INIT.status();
+    public static final int DEFAULT_FLOW_COUNT = 0;
+    public static final long DEFAULT_COMPLETION_TIME = 0;
+    public static final String DEFAULT_UNITS = "ns";
+    public static final String DEVICE_TYPE_PREFIX = "openflow:";
 
     public static String ipIntToStr (int k) {
         return new StringBuilder().append(((k >> 24) & 0xFF)).append(".")
index bae183d53ec0b883920ed04f1ee30e8925ad125a..3796081892a79f570c5f702ca56a7aae85f29986 100644 (file)
@@ -40,7 +40,7 @@ public class FlowReader implements Runnable, FlowCounterMBean {
     private final boolean isConfigDs;
     private AtomicLong flowCount = new AtomicLong(0);
     private AtomicInteger readOpStatus = new AtomicInteger(FlowCounter.OperationStatus.INIT.status());
-    private final String UNITS = "ns";
+    private static final String UNITS = "ns";
 
     private FlowReader(final DataBroker dataBroker,
                       final Integer dpnCount,
index c26d1bcee46ec6daf6a3f1553af4d0b3d8b5c160..96904bd8d6a460d6dadaefa1d587b49407dd89f2 100644 (file)
@@ -24,23 +24,24 @@ import java.util.concurrent.atomic.AtomicLong;
 
 public class FlowWriterConcurrent implements FlowCounterMBean {
     private static final Logger LOG = LoggerFactory.getLogger(FlowWriterConcurrent.class);
+    public static final String USING_CONCURRENT_IMPLEMENTATION_OF_FLOW_WRITER = "Using Concurrent implementation of Flow Writer.";
     private final DataBroker dataBroker;
     private final ExecutorService flowPusher;
     private long startTime;
     private AtomicInteger writeOpStatus = new AtomicInteger(FlowCounter.OperationStatus.INIT.status());
     private AtomicInteger countDpnWriteCompletion = new AtomicInteger(0);
     private AtomicLong taskCompletionTime = new AtomicLong(0);
-    private final String UNITS = "ns";
+    private static final String UNITS = "ns";
 
     public FlowWriterConcurrent(final DataBroker dataBroker, ExecutorService flowPusher) {
         this.dataBroker = dataBroker;
         this.flowPusher = flowPusher;
-        LOG.info("Using Concurrent implementation of Flow Writer.");
+        LOG.info(USING_CONCURRENT_IMPLEMENTATION_OF_FLOW_WRITER);
     }
 
     public void addFlows(Integer dpnCount, Integer flowsPerDPN, int batchSize,
                          int sleepMillis, int sleepAfter, short startTableId, short endTableId) {
-        LOG.info("Using Concurrent implementation of Flow Writer.");
+        LOG.info(USING_CONCURRENT_IMPLEMENTATION_OF_FLOW_WRITER);
         countDpnWriteCompletion.set(dpnCount);
         startTime = System.nanoTime();
         for (int i = 1; i <= dpnCount; i++) {
@@ -52,7 +53,7 @@ public class FlowWriterConcurrent implements FlowCounterMBean {
 
     public void deleteFlows(Integer dpnCount, Integer flowsPerDPN, int batchSize,
                             short startTableId, short endTableId) {
-        LOG.info("Using Concurrent implementation of Flow Writer.");
+        LOG.info(USING_CONCURRENT_IMPLEMENTATION_OF_FLOW_WRITER);
         countDpnWriteCompletion.set(dpnCount);
         for (int i = 1; i <= dpnCount; i++) {
             FlowHandlerTask task = new FlowHandlerTask(Integer.toString(i), flowsPerDPN, false, batchSize,
index 943299abdfd2f604e567cf9f20b723358dabf372..99436bec24e60dc96f78717cd5df5af4bbe821fc 100644 (file)
@@ -31,7 +31,7 @@ public class FlowWriterSequential implements FlowCounterMBean {
     private AtomicInteger writeOpStatus = new AtomicInteger(FlowCounter.OperationStatus.INIT.status());
     private AtomicInteger countDpnWriteCompletion = new AtomicInteger(0);
     private AtomicLong taskCompletionTime = new AtomicLong(0);
-    private final String UNITS = "ns";
+    private static final String UNITS = "ns";
 
     public FlowWriterSequential(final DataBroker dataBroker, ExecutorService flowPusher) {
         this.dataBroker = dataBroker;
index 5e75b2d202d998a0f7151ddd9607c0a5034c3be4..546d121642202632bb78e76d37aadc4f9884ba3e 100644 (file)
@@ -69,6 +69,5 @@ public abstract class AbstractNodeConnectorCommitter <T extends DataObject> impl
     private boolean preConfigurationCheck(final InstanceIdentifier<FlowCapableNodeConnector> nodeConnIdent) {
         Preconditions.checkNotNull(nodeConnIdent, "FlowCapableNodeConnector ident can not be null!");
         return true;
-        //return provider.isNodeActive(nodeConnIdent);
     }
 }
index 8a34a7785e49b79345886089bd8799360431fb44..8b0df32c4bc2539658cb01dfb5feb4536ac26576 100644 (file)
@@ -97,7 +97,6 @@ public class FlowNodeConnectorInventoryTranslatorImpl extends AbstractNodeConnec
             String sNodeConnectorIdentifier = nodeConnIdent
                     .firstKeyOf(NodeConnector.class, NodeConnectorKey.class).getId().getValue();
             BigInteger nDpId = getDpIdFromPortName(sNodeConnectorIdentifier);
-            String portName = del.getName();
 
             dpnToPortMultiMap.remove(nDpId, sNodeConnectorIdentifier);
         }
@@ -107,7 +106,7 @@ public class FlowNodeConnectorInventoryTranslatorImpl extends AbstractNodeConnec
     public void update(InstanceIdentifier<FlowCapableNodeConnector> identifier, FlowCapableNodeConnector original, FlowCapableNodeConnector update, InstanceIdentifier<FlowCapableNodeConnector> nodeConnIdent) {
         if(compareInstanceIdentifierTail(identifier,II_TO_FLOW_CAPABLE_NODE_CONNECTOR)){
             LOG.debug("Node Connector updated");
-            //donot need to do anything as we are not considering updates here
+            //Don't need to do anything as we are not considering updates here
         }
     }
 
@@ -119,7 +118,6 @@ public class FlowNodeConnectorInventoryTranslatorImpl extends AbstractNodeConnec
                     .firstKeyOf(NodeConnector.class, NodeConnectorKey.class).getId().getValue();
             BigInteger nDpId = getDpIdFromPortName(sNodeConnectorIdentifier);
 
-            String portName = add.getName();
             if(!dpnToPortMultiMap.containsEntry(nDpId,sNodeConnectorIdentifier)) {
                 dpnToPortMultiMap.put(nDpId, sNodeConnectorIdentifier);
             }else{
index c3f13942cfab3b4899a384aa2bdcd1c24c351849..615fc89d2f40da683584b59c5ddd188c31d988d2 100644 (file)
@@ -119,7 +119,7 @@ public class FlowNodeReconciliationImpl implements FlowNodeReconciliation {
 
     private ListenerRegistration<FlowNodeReconciliationImpl> listenerRegistration;
 
-    private final int THREAD_POOL_SIZE = 4;
+    private static final int THREAD_POOL_SIZE = 4;
     ExecutorService executor = Executors.newFixedThreadPool(THREAD_POOL_SIZE);
 
     private static final InstanceIdentifier<FlowCapableNode> II_TO_FLOW_CAPABLE_NODE
@@ -604,7 +604,6 @@ public class FlowNodeReconciliationImpl implements FlowNodeReconciliation {
 
     private void deleteDSStaleFlows(List<InstanceIdentifier<StaleFlow>> flowsForBulkDelete){
         ImmutableList.Builder<InstanceIdentifier<StaleFlow>> builder = ImmutableList.builder();
-        ImmutableList<InstanceIdentifier<StaleFlow>> bulkDelFlows = builder.addAll(flowsForBulkDelete.iterator()).build();
 
         WriteTransaction writeTransaction = dataBroker.newWriteOnlyTransaction();
 
@@ -618,7 +617,6 @@ public class FlowNodeReconciliationImpl implements FlowNodeReconciliation {
 
     private void deleteDSStaleGroups(List<InstanceIdentifier<StaleGroup>> groupsForBulkDelete){
         ImmutableList.Builder<InstanceIdentifier<StaleGroup>> builder = ImmutableList.builder();
-        ImmutableList<InstanceIdentifier<StaleGroup>> bulkDelGroups = builder.addAll(groupsForBulkDelete.iterator()).build();
 
         WriteTransaction writeTransaction = dataBroker.newWriteOnlyTransaction();
 
@@ -633,7 +631,6 @@ public class FlowNodeReconciliationImpl implements FlowNodeReconciliation {
 
     private void deleteDSStaleMeters(List<InstanceIdentifier<StaleMeter>> metersForBulkDelete){
         ImmutableList.Builder<InstanceIdentifier<StaleMeter>> builder = ImmutableList.builder();
-        ImmutableList<InstanceIdentifier<StaleMeter>> bulkDelGroups = builder.addAll(metersForBulkDelete.iterator()).build();
 
         WriteTransaction writeTransaction = dataBroker.newWriteOnlyTransaction();
 
@@ -670,7 +667,8 @@ public class FlowNodeReconciliationImpl implements FlowNodeReconciliation {
     private void handleStaleEntityDeletionResultFuture(CheckedFuture<Void, TransactionCommitFailedException> submitFuture) {
         Futures.addCallback(submitFuture, new FutureCallback<Void>() {
             @Override
-            public void onSuccess(Void result) { LOG.debug("Stale entity removal success");
+            public void onSuccess(Void result) {
+                LOG.debug("Stale entity removal success");
             }
 
             @Override
index a579ee4d1f0621477aceaeb6d1020615b38027a8..8839cb6354efbc6b19e824fac17700b1e436d836 100644 (file)
@@ -48,12 +48,7 @@ public class TableForwarder extends AbstractListeningCommiter<TableFeatures> {
         try {
             SimpleTaskRetryLooper looper = new SimpleTaskRetryLooper(ForwardingRulesManagerImpl.STARTUP_LOOP_TICK,
                     ForwardingRulesManagerImpl.STARTUP_LOOP_MAX_RETRIES);
-            listenerRegistration = looper.loopUntilNoException(new Callable<ListenerRegistration<TableForwarder>>() {
-                @Override
-                public ListenerRegistration<TableForwarder> call() throws Exception {
-                    return db.registerDataTreeChangeListener(treeId, TableForwarder.this);
-                }
-            });
+            listenerRegistration = looper.loopUntilNoException(() -> db.registerDataTreeChangeListener(treeId, TableForwarder.this));
         } catch (final Exception e) {
             LOG.warn("FRM Table DataChange listener registration fail!");
             LOG.debug("FRM Table DataChange listener registration fail ..", e);
@@ -95,11 +90,12 @@ public class TableForwarder extends AbstractListeningCommiter<TableFeatures> {
 
         final TableFeatures originalTableFeatures = original;
         TableFeatures updatedTableFeatures;
-        if (null == update)
+        if (null == update) {
             updatedTableFeatures = original;
-        else
+        }
+        else {
             updatedTableFeatures = update;
-
+        }
         final UpdateTableInputBuilder builder = new UpdateTableInputBuilder();
 
         builder.setNode(new NodeRef(nodeIdent.firstIdentifierOf(Node.class)));
index 484d864c04d2a82b2a7ed3c71467a0c4e83ea89e..eb7146ad950a9539deeeab9c80e0d5cf76b87d86 100644 (file)
@@ -38,8 +38,9 @@ public final class NiciraActionDeserializerKey {
     }
 
     private static final boolean isValueUint16(int value) {
-        if (value >= 0 && value <= 65535L)
+        if (value >= 0 && value <= 65535L) {
             return true;
+        }
         return false;
     }
 
@@ -54,17 +55,22 @@ public final class NiciraActionDeserializerKey {
 
     @Override
     public boolean equals(Object obj) {
-        if (this == obj)
+        if (this == obj) {
             return true;
-        if (obj == null)
+        }
+        if (obj == null) {
             return false;
-        if (getClass() != obj.getClass())
+        }
+        if (getClass() != obj.getClass()) {
             return false;
+        }
         NiciraActionDeserializerKey other = (NiciraActionDeserializerKey) obj;
-        if (subtype != other.subtype)
+        if (subtype != other.subtype) {
             return false;
-        if (version != other.version)
+        }
+        if (version != other.version) {
             return false;
+        }
         return true;
     }
 
index 1f7797e4484ef87e2da6144039c17fd418f86ef1..48f54036eddbac85fccb997592dc6781ddb223e7 100644 (file)
@@ -13,7 +13,7 @@ import org.opendaylight.openflowjava.protocol.api.keys.ActionSerializerKey;
  * @author msunal
  */
 public final class NiciraUtil {
-
+    private NiciraUtil() { }
 
     public static final ActionSerializerKey<?> createOfJavaKeyFrom(NiciraActionSerializerKey key) {
         return new ActionSerializerKey<>(key.getVersion(), key.getSubtype(), NiciraConstants.NX_VENDOR_ID);
index d0c08b88d31fd8babdcf32ee3b5fdcaa873df994..6722a6b7eadc55652bf1a757d0caebe38baadb10 100644 (file)
@@ -47,6 +47,7 @@ import org.opendaylight.openflowjava.nx.codec.match.UdpSrcCodec;
  * @author Josh Hershberg (jhershbe@redhat.com)
  */
 public class NiciraMatchCodecs {
+    private NiciraMatchCodecs () { }
 
     public static final Reg0Codec REG0_CODEC = new Reg0Codec();
     public static final Reg1Codec REG1_CODEC = new Reg1Codec();
index 459377d69c5f5b64e3e9692c5746152c3f928659..01a9c1f2cbbfc421fb08eb4aacc560a39adbc4ab 100644 (file)
@@ -21,18 +21,18 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev13
  */
 public abstract class AbstractActionCodec implements OFSerializer<Action>, OFDeserializer<Action> {
 
-    protected final static void serializeHeader(final int msgLength, final int subtype, final ByteBuf outBuffer) {
+    protected static final void serializeHeader(final int msgLength, final int subtype, final ByteBuf outBuffer) {
         outBuffer.writeShort(EncodeConstants.EXPERIMENTER_VALUE);
         writeMsgLengthVendorIdSubtypeToBuffer(msgLength, subtype, outBuffer);
     }
 
-    private final static void writeMsgLengthVendorIdSubtypeToBuffer(final int msgLength, final int subtype, final ByteBuf outBuffer) {
+    private static final void writeMsgLengthVendorIdSubtypeToBuffer(final int msgLength, final int subtype, final ByteBuf outBuffer) {
         outBuffer.writeShort(msgLength);
         outBuffer.writeInt(NiciraConstants.NX_VENDOR_ID.intValue());
         outBuffer.writeShort(subtype);
     }
 
-    protected final static ActionBuilder deserializeHeader(final ByteBuf message) {
+    protected static final ActionBuilder deserializeHeader(final ByteBuf message) {
         // size of experimenter type
         message.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
         // size of length
@@ -46,7 +46,7 @@ public abstract class AbstractActionCodec implements OFSerializer<Action>, OFDes
         return actionBuilder;
     }
 
-    protected final static ExperimenterId getExperimenterId(){
+    protected static final ExperimenterId getExperimenterId(){
         return new ExperimenterId(NiciraConstants.NX_VENDOR_ID);
     }
 
index d44074d4756f6b7418f7530a725717eae7e049bf..ca615eff2a3c9c670bfa130442ed9d9decd589c5 100644 (file)
@@ -25,8 +25,6 @@ import org.slf4j.LoggerFactory;
  */
 
 public class ConntrackCodec extends AbstractActionCodec {
-    private static final Logger logger = LoggerFactory.getLogger(ConntrackCodec.class);
-
     public static final int LENGTH = 24;
     public static final byte NXAST_CONNTRACK_SUBTYPE = 35;
     public static final NiciraActionSerializerKey SERIALIZER_KEY =
@@ -36,7 +34,7 @@ public class ConntrackCodec extends AbstractActionCodec {
 
     @Override
     public void serialize(final Action input, final ByteBuf outBuffer) {
-        ActionConntrack action = ((ActionConntrack) input.getActionChoice()); //getAugmentation(OfjAugNxAction.class).getActionConntrack();
+        ActionConntrack action = ((ActionConntrack) input.getActionChoice());
         serializeHeader(LENGTH, NXAST_CONNTRACK_SUBTYPE, outBuffer);
 
         outBuffer.writeShort(action.getNxActionConntrack().getFlags().shortValue());
index e7ab43c1cadfca7eac5b8e398d636f65e4ce4ffe..adac519ed7851e125ea3e5c34f9eef8b40af0d7d 100644 (file)
@@ -26,8 +26,6 @@ import org.slf4j.LoggerFactory;
  * Codec for the NX_MULTIPATH
  */
 public class MultipathCodec extends AbstractActionCodec {
-    private static final Logger logger = LoggerFactory.getLogger(MultipathCodec.class);
-
     public static final int LENGTH = 32;
     public static final byte NXAST_MULTIPATH_SUBTYPE = 10;
     public static final NiciraActionSerializerKey SERIALIZER_KEY =
@@ -37,7 +35,7 @@ public class MultipathCodec extends AbstractActionCodec {
 
     @Override
     public void serialize(final Action input, final ByteBuf outBuffer) {
-        ActionMultipath action = ((ActionMultipath) input.getActionChoice()); //getAugmentation(OfjAugNxAction.class).getActionMultipath();
+        ActionMultipath action = ((ActionMultipath) input.getActionChoice());
         serializeHeader(LENGTH, NXAST_MULTIPATH_SUBTYPE, outBuffer);
 
         outBuffer.writeShort(action.getNxActionMultipath().getFields().getIntValue());
index 695de74b1ee44790cf28678324f490f6b0f979aa..2914e7ea87ee62af8c194b463aef5a82c5865919 100644 (file)
@@ -13,6 +13,8 @@ package org.opendaylight.openflowjava.nx.codec.action;
  */
 public class NiciraActionCodecs {
 
+    private NiciraActionCodecs() { }
+
     public static final RegMoveCodec REG_MOVE_CODEC = new RegMoveCodec();
     public static final RegLoadCodec REG_LOAD_CODEC = new RegLoadCodec();
     public static final OutputRegCodec OUTPUT_REG_CODEC = new OutputRegCodec();
index 38e8ecf851692c6c1c5db6902f8b39b7eeb82ade..f3ac951cc56086cf8a5f48f6031b0e225b739075 100644 (file)
@@ -22,6 +22,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev1
  * Codec for the NX_RESUBMIT and NX_RESUBMIT_TABLE
  */
 public class ResubmitCodec extends AbstractActionCodec {
+
     public static final int LENGTH = 16;
     public static final byte NXAST_RESUBMIT_SUBTYPE = 1;
     public static final byte NXAST_RESUBMIT_TABLE_SUBTYPE = 14;
index 82b3fcd88d77f6d56eb0c9d616d09d0f8d999749..e01d18a6efcfe279c54ced23e7b8eb310db98213 100644 (file)
@@ -26,8 +26,6 @@ import org.slf4j.LoggerFactory;
  */
 public class SetNshc1Codec extends AbstractActionCodec {
 
-    private static final Logger LOG = LoggerFactory.getLogger(SetNshc1Codec.class);
-
     public static final int LENGTH = 16;
     public static final byte NXAST_SET_NSC_SUBTYPE = 34;
     public static final NiciraActionSerializerKey SERIALIZER_KEY =
index 4e0858c7419bd5dc10a4c776669836536a41d8f8..e71857a17f57c225bebf1ffa226bb65db79e1faa 100644 (file)
@@ -23,6 +23,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev1
  * Codec for the NX_SetNsp and NX_SetNsp_TABLE
  */
 public class SetNshc3Codec extends AbstractActionCodec {
+
     public static final int LENGTH = 16;
     public static final byte NXAST_SET_NSC_SUBTYPE = 36;
     public static final NiciraActionSerializerKey SERIALIZER_KEY =
index ebcf669b9d8678d58b8f4ff620bf010c60b20f64..394ef58ff787a2d9b305f6786c56a44c91f792bb 100644 (file)
@@ -73,15 +73,19 @@ public class NxmHeader {
 
     @Override
     public boolean equals(Object obj) {
-        if (this == obj)
+        if (this == obj) {
             return true;
-        if (obj == null)
+        }
+        if (obj == null) {
             return false;
-        if (getClass() != obj.getClass())
+        }
+        if (getClass() != obj.getClass()) {
             return false;
+        }
         NxmHeader other = (NxmHeader) obj;
-        if (headerAsLong != other.headerAsLong)
+        if (headerAsLong != other.headerAsLong) {
             return false;
+        }
         return true;
     }
 
index fce41bd0c98011ed9f8ac7e43f14bbef3f929c03..e08903b339dcaf44e6903cd82f1f8fb0ab4675d7 100644 (file)
@@ -33,7 +33,7 @@ public final class OFConstants {
     /** openflow protocol 1.3 - version identifier */
     public static final short OFP_VERSION_1_3 = 0x04;
 
-    public final static String OF_URI_PREFIX = "openflow:";
+    public static final String OF_URI_PREFIX = "openflow:";
 
     /** enum ofp_table: Table numbering, wildcard table used for table config, flow stats and flow deletes. */
     public static final Short OFPTT_ALL = 0xff;
index 222dcd642dfe24e5d1d9acc8a5cb2213add4ff4f..dc50c0edb72e5f5f9e38050f9bab9e053b15d014 100644 (file)
@@ -49,18 +49,23 @@ public class SwitchSessionKeyOF {
 
     @Override
     public boolean equals(Object obj) {
-        if (this == obj)
+        if (this == obj) {
             return true;
-        if (obj == null)
+        }
+        if (obj == null) {
             return false;
-        if (getClass() != obj.getClass())
+        }
+        if (getClass() != obj.getClass()) {
             return false;
+        }
         SwitchSessionKeyOF other = (SwitchSessionKeyOF) obj;
         if (datapathId == null) {
-            if (other.datapathId != null)
+            if (other.datapathId != null) {
                 return false;
-        } else if (!datapathId.equals(other.datapathId))
+            }
+        } else if (!datapathId.equals(other.datapathId)) {
             return false;
+        }
         return true;
     }
 }
index d57c3c07bd026e1422dea8a1c3abc0ef333baad2..3919aa3c7553bc3d8cb1af2c7526ae92f029ac98 100644 (file)
@@ -21,6 +21,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.M
  * Created by Martin Bobak &lt;mbobak@cisco.com&gt; on 8.4.2015.
  */
 public class FlowRegistryKeyFactory {
+
     private FlowRegistryKeyFactory() {
         // Hide implicit constructor
     }
index 5ddf504fbb066de0a50927683df0f363e042e2c9..c5be1234d9196310c86389100ac0f3904d3fb16b 100644 (file)
@@ -16,7 +16,6 @@ import org.opendaylight.controller.md.sal.common.api.clustering.CandidateAlready
 import org.opendaylight.controller.md.sal.common.api.clustering.Entity;
 import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipCandidateRegistration;
 import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipService;
-import org.opendaylight.openflowplugin.api.openflow.OFPContext;
 import org.opendaylight.openflowplugin.api.openflow.device.DeviceInfo;
 import org.opendaylight.openflowplugin.api.openflow.device.RequestContext;
 import org.opendaylight.openflowplugin.api.openflow.lifecycle.LifecycleConductor;
index ae3f0d2ba1d2057947919305563bf5372465dfba..54d312e1e4426d3e816b93c45b1b90a0bb47294f 100644 (file)
@@ -247,7 +247,6 @@ public class RoleManagerImpl implements RoleManager, EntityOwnershipListener, Se
                         LOG.debug("Trying to remove from operational node: {}", roleContext.getDeviceInfo().getNodeId());
                         removeDeviceFromOperationalDS(roleContext.getDeviceInfo(), MAX_CLEAN_DS_RETRIES);
                     } else {
-                        final NodeId nodeId = roleContext.getDeviceInfo().getNodeId();
                         contexts.remove(roleContext.getDeviceInfo(), roleContext);
                         roleContext.close();
                         conductor.closeConnection(roleContext.getDeviceInfo());
index d13605c3f60eae68ed63da4718111847a66fefd9..c4ab0e3b2c967efe66fc20235146167798d10b53 100644 (file)
@@ -24,6 +24,7 @@ import org.slf4j.LoggerFactory;
 public class ItemLifecycleListenerImpl implements ItemLifecycleListener {
 
     private static final Logger LOG = LoggerFactory.getLogger(ItemLifecycleListenerImpl.class);
+    public static final String NOT_ABLE_TO_WRITE_TO_TRANSACTION = "Not able to write to transaction: {}";
 
     private final DeviceContext deviceContext;
 
@@ -37,7 +38,7 @@ public class ItemLifecycleListenerImpl implements ItemLifecycleListener {
             deviceContext.writeToTransaction(LogicalDatastoreType.OPERATIONAL, itemPath, itemBody);
             deviceContext.submitTransaction();
         } catch (Exception e) {
-            LOG.warn("Not able to write to transaction: {}", e);
+            LOG.warn(NOT_ABLE_TO_WRITE_TO_TRANSACTION, e);
         }
     }
 
@@ -47,7 +48,7 @@ public class ItemLifecycleListenerImpl implements ItemLifecycleListener {
             deviceContext.addDeleteToTxChain(LogicalDatastoreType.OPERATIONAL, itemPath);
             deviceContext.submitTransaction();
         } catch (Exception e) {
-            LOG.warn("Not able to write to transaction: {}", e);
+            LOG.warn(NOT_ABLE_TO_WRITE_TO_TRANSACTION, e);
         }
     }
 
@@ -58,7 +59,7 @@ public class ItemLifecycleListenerImpl implements ItemLifecycleListener {
             deviceContext.writeToTransaction(LogicalDatastoreType.OPERATIONAL, itemPath, itemBody);
             deviceContext.submitTransaction();
         } catch (Exception e) {
-            LOG.warn("Not able to write to transaction: {}", e);
+            LOG.warn(NOT_ABLE_TO_WRITE_TO_TRANSACTION, e);
         }
     }
 }
index 73f098da9eb4241931cae4fc64709f503a85e0cc..57e86731f8eb336ae6825fbb7c276a9811fad5ba 100644 (file)
@@ -34,8 +34,6 @@ import org.slf4j.LoggerFactory;
 
 abstract class AbstractService<I, O> {
     private static final Logger LOG = LoggerFactory.getLogger(AbstractService.class);
-    private static final long WAIT_TIME = 2000;
-    private static final BigInteger PRIMARY_CONNECTION = BigInteger.ZERO;
 
     private final short version;
     private final BigInteger datapathId;