From fcfd5b572ad7394cdb4015a132de0ee86895fad4 Mon Sep 17 00:00:00 2001 From: Jozef Bacigal Date: Fri, 8 Sep 2017 10:35:39 +0200 Subject: [PATCH] Fix codestyle - Removed deprecated getLOGValue from deviceInfo See also:Bug-8607 Change-Id: Ic9c11ea6e2ace4e802ddc8dd3e2445655e2a57fd Signed-off-by: Jozef Bacigal --- .../impl/common/MultipartReplyTranslatorUtil.java | 2 +- .../impl/device/DeviceContextImpl.java | 10 +++++----- .../impl/device/TransactionChainManager.java | 2 +- .../initialization/AbstractDeviceInitializer.java | 2 +- .../device/initialization/OF13DeviceInitializer.java | 12 ++++++------ .../openflowplugin/impl/rpc/RpcManagerImpl.java | 2 +- .../AbstractMultipartRequestOnTheFlyCallback.java | 2 +- .../impl/statistics/StatisticsContextImpl.java | 2 +- .../impl/statistics/StatisticsGatheringUtils.java | 6 +++--- .../impl/util/DeviceInitializationUtil.java | 2 +- .../impl/device/DeviceManagerImplTest.java | 2 +- .../statistics/MultipartReplyTranslatorTest.java | 1 - 12 files changed, 22 insertions(+), 23 deletions(-) diff --git a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/common/MultipartReplyTranslatorUtil.java b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/common/MultipartReplyTranslatorUtil.java index d046883da9..67fa6fac24 100644 --- a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/common/MultipartReplyTranslatorUtil.java +++ b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/common/MultipartReplyTranslatorUtil.java @@ -181,7 +181,7 @@ public class MultipartReplyTranslatorUtil { .MultipartReply.class.cast(message).getMultipartReplyBody()); } - LOG.debug("Failed to translate {} for node {}.", message.getImplementedInterface(), deviceInfo.getLOGValue()); + LOG.debug("Failed to translate {} for node {}.", message.getImplementedInterface(), deviceInfo); return Optional.empty(); } diff --git a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/device/DeviceContextImpl.java b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/device/DeviceContextImpl.java index 0ba9468a74..0630f8bae4 100644 --- a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/device/DeviceContextImpl.java +++ b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/device/DeviceContextImpl.java @@ -349,7 +349,7 @@ public class DeviceContextImpl implements DeviceContext, ExtensionConverterProvi submitTransaction(); } catch (final Exception e) { LOG.warn("Error processing port status message for port {} on device {}", - portStatus.getPortNo(), getDeviceInfo().getLOGValue(), e); + portStatus.getPortNo(), getDeviceInfo(), e); } } else if (!hasState.get()) { primaryConnectionContext.handlePortStatusMessage(portStatus); @@ -680,7 +680,7 @@ public class DeviceContextImpl implements DeviceContext, ExtensionConverterProvi void lazyTransactionManagerInitialization() { if (!this.initialized.get()) { if (LOG.isDebugEnabled()) { - LOG.debug("Transaction chain manager for node {} created", deviceInfo.getLOGValue()); + LOG.debug("Transaction chain manager for node {} created", deviceInfo); } this.transactionChainManager = new TransactionChainManager(dataBroker, deviceInfo); this.deviceFlowRegistry = new DeviceFlowRegistryImpl(deviceInfo.getVersion(), dataBroker, deviceInfo @@ -749,7 +749,7 @@ public class DeviceContextImpl implements DeviceContext, ExtensionConverterProvi .count(); LOG.debug("Finished filling flow registry with {} flows for node: {}", flowCount, deviceInfo - .getLOGValue()); + ); } this.contextChainMastershipWatcher.onMasterRoleAcquired(deviceInfo, ContextChainMastershipState .INITIAL_FLOW_REGISTRY_FILL); @@ -759,11 +759,11 @@ public class DeviceContextImpl implements DeviceContext, ExtensionConverterProvi public void onFailure(Throwable throwable) { if (deviceFlowRegistryFill.isCancelled()) { if (LOG.isDebugEnabled()) { - LOG.debug("Cancelled filling flow registry with flows for node: {}", deviceInfo.getLOGValue()); + LOG.debug("Cancelled filling flow registry with flows for node: {}", deviceInfo); } } else { LOG.warn("Failed filling flow registry with flows for node: {} with exception: {}", deviceInfo - .getLOGValue(), throwable); + , throwable); } contextChainMastershipWatcher.onNotAbleToStartMastership( deviceInfo, diff --git a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/device/TransactionChainManager.java b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/device/TransactionChainManager.java index 38a9d7a8ea..e06fbd2f29 100644 --- a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/device/TransactionChainManager.java +++ b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/device/TransactionChainManager.java @@ -70,7 +70,7 @@ class TransactionChainManager implements TransactionChainListener, AutoCloseable TransactionChainManager(@Nonnull final DataBroker dataBroker, @Nonnull final DeviceInfo deviceInfo) { this.dataBroker = dataBroker; - this.nodeId = deviceInfo.getLOGValue(); + this.nodeId = deviceInfo.toString(); this.lastSubmittedFuture = Futures.immediateFuture(null); } diff --git a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/device/initialization/AbstractDeviceInitializer.java b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/device/initialization/AbstractDeviceInitializer.java index 7fad99e45e..f07ca2f0cf 100644 --- a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/device/initialization/AbstractDeviceInitializer.java +++ b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/device/initialization/AbstractDeviceInitializer.java @@ -45,7 +45,7 @@ public abstract class AbstractDeviceInitializer { Preconditions.checkNotNull(deviceContext); // Write node to datastore - LOG.debug("Initializing node information for node {}", deviceContext.getDeviceInfo().getLOGValue()); + LOG.debug("Initializing node information for node {}", deviceContext.getDeviceInfo()); try { deviceContext.writeToTransaction(LogicalDatastoreType.OPERATIONAL, deviceContext .getDeviceInfo() diff --git a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/device/initialization/OF13DeviceInitializer.java b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/device/initialization/OF13DeviceInitializer.java index 3d5b60b407..040baf299c 100644 --- a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/device/initialization/OF13DeviceInitializer.java +++ b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/device/initialization/OF13DeviceInitializer.java @@ -58,7 +58,7 @@ public class OF13DeviceInitializer extends AbstractDeviceInitializer { final DeviceState deviceState = Preconditions.checkNotNull(deviceContext.getDeviceState()); final DeviceInfo deviceInfo = Preconditions.checkNotNull(deviceContext.getDeviceInfo()); final Capabilities capabilities = connectionContext.getFeatures().getCapabilities(); - LOG.debug("Setting capabilities for device {}", deviceInfo.getLOGValue()); + LOG.debug("Setting capabilities for device {}", deviceInfo); DeviceStateUtil.setDeviceStateBasedOnV13Capabilities(deviceState, capabilities); // First process description reply, write data to DS and write consequent data if successful @@ -89,7 +89,7 @@ public class OF13DeviceInitializer extends AbstractDeviceInitializer { @Override public Void apply(@Nullable final List>> input) { LOG.info("Static node {} successfully finished collecting", - deviceContext.getDeviceInfo().getLOGValue()); + deviceContext.getDeviceInfo()); return null; } }); @@ -140,7 +140,7 @@ public class OF13DeviceInitializer extends AbstractDeviceInitializer { @Override public void onSuccess(final RpcResult> result) { if (Objects.nonNull(result.getResult())) { - LOG.info("Static node {} info: {} collected", deviceContext.getDeviceInfo().getLOGValue(), type); + LOG.info("Static node {} info: {} collected", deviceContext.getDeviceInfo(), type); translateAndWriteResult( type, result.getResult(), @@ -169,7 +169,7 @@ public class OF13DeviceInitializer extends AbstractDeviceInitializer { @Override public void onFailure(@Nonnull final Throwable throwable) { LOG.warn("Request of type {} for static info of node {} failed.", - type, deviceContext.getDeviceInfo().getLOGValue()); + type, deviceContext.getDeviceInfo()); } }); } @@ -218,11 +218,11 @@ public class OF13DeviceInitializer extends AbstractDeviceInitializer { }); }); } catch (final Exception e) { - LOG.warn("Failed to write node {} to DS ", deviceContext.getDeviceInfo().getLOGValue(), e); + LOG.warn("Failed to write node {} to DS ", deviceContext.getDeviceInfo(), e); } } else { LOG.warn("Failed to write node {} to DS because we failed to gather device info.", - deviceContext.getDeviceInfo().getLOGValue()); + deviceContext.getDeviceInfo()); } } diff --git a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/rpc/RpcManagerImpl.java b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/rpc/RpcManagerImpl.java index d8cc351b32..f5794de7a7 100644 --- a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/rpc/RpcManagerImpl.java +++ b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/rpc/RpcManagerImpl.java @@ -84,7 +84,7 @@ public class RpcManagerImpl implements RpcManager { public void onDeviceRemoved(final DeviceInfo deviceInfo) { contexts.remove(deviceInfo); if (LOG.isDebugEnabled()) { - LOG.debug("Rpc context removed for node {}", deviceInfo.getLOGValue()); + LOG.debug("Rpc context removed for node {}", deviceInfo); } } } diff --git a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/AbstractMultipartRequestOnTheFlyCallback.java b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/AbstractMultipartRequestOnTheFlyCallback.java index a1b5e19d7d..6da5d83fd1 100644 --- a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/AbstractMultipartRequestOnTheFlyCallback.java +++ b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/AbstractMultipartRequestOnTheFlyCallback.java @@ -96,7 +96,7 @@ public abstract class AbstractMultipartRequestOnTheFlyCallback writer.write(reply, false)); } catch (final Exception ex) { LOG.warn("Stats processing of type {} for node {} failed during write-to-tx step", - getMultipartType(), deviceInfo.getLOGValue(), ex); + getMultipartType(), deviceInfo, ex); } }); } catch (final Exception ex) { diff --git a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/StatisticsContextImpl.java b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/StatisticsContextImpl.java index 0d219eb42f..e7ebc7c1be 100644 --- a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/StatisticsContextImpl.java +++ b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/StatisticsContextImpl.java @@ -265,7 +265,7 @@ class StatisticsContextImpl implements StatisticsContext { } return Futures.transformAsync(prevFuture, result -> { - LOG.debug("Status of previous stat iteration for node {}: {}", deviceInfo.getLOGValue(), result); + LOG.debug("Status of previous stat iteration for node {}: {}", deviceInfo, result); LOG.debug("Stats iterating to next type for node {} of type {}", deviceInfo, multipartType); final boolean onTheFly = MultipartType.OFPMPFLOW.equals(multipartType); final boolean supported = collectingStatType.contains(multipartType); diff --git a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/StatisticsGatheringUtils.java b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/StatisticsGatheringUtils.java index 1183ff051a..2c13b485f1 100644 --- a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/StatisticsGatheringUtils.java +++ b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/StatisticsGatheringUtils.java @@ -112,7 +112,7 @@ public final class StatisticsGatheringUtils { } catch (final Exception e) { LOG.warn("Stats processing of type {} for node {} " + "failed during transformation step", - type, deviceInfo.getLOGValue(), e); + type, deviceInfo, e); return Futures.immediateFailedFuture(e); } @@ -189,7 +189,7 @@ public final class StatisticsGatheringUtils { } LOG.warn("Stats processing of type {} for node {} " - + "failed during write-to-tx step", type, deviceInfo.getLOGValue()); + + "failed during write-to-tx step", type, deviceInfo); return false; } @@ -210,7 +210,7 @@ public final class StatisticsGatheringUtils { })); } catch (final Exception ex) { LOG.warn("Stats processing of type {} for node {} " - + "failed during write-to-tx step", type, deviceInfo.getLOGValue(), ex); + + "failed during write-to-tx step", type, deviceInfo, ex); } return result.get(); diff --git a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/util/DeviceInitializationUtil.java b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/util/DeviceInitializationUtil.java index 80303a02d7..9c50540d5c 100644 --- a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/util/DeviceInitializationUtil.java +++ b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/util/DeviceInitializationUtil.java @@ -73,7 +73,7 @@ public class DeviceInitializationUtil { */ public static void makeEmptyTables(final TxFacade txFacade, final DeviceInfo deviceInfo, final short nrOfTables) { if (LOG.isDebugEnabled()) { - LOG.debug("About to create {} empty tables for node {}.", nrOfTables, deviceInfo.getLOGValue()); + LOG.debug("About to create {} empty tables for node {}.", nrOfTables, deviceInfo); } for (int i = 0; i < nrOfTables; i++) { diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/device/DeviceManagerImplTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/device/DeviceManagerImplTest.java index fbb1165834..dd106cbb33 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/device/DeviceManagerImplTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/device/DeviceManagerImplTest.java @@ -168,7 +168,7 @@ public class DeviceManagerImplTest { public void removeDeviceFromOperationalDSException() throws Exception { final CheckedFuture failedFuture = Futures.immediateFailedCheckedFuture( - new TransactionCommitFailedException("Test failed transaction", null, null)); + new TransactionCommitFailedException("Test failed transaction")); Mockito.when(writeTransaction.submit()).thenReturn(failedFuture); final ListenableFuture future = deviceManager .removeDeviceFromOperationalDS(DUMMY_IDENTIFIER); diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/MultipartReplyTranslatorTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/MultipartReplyTranslatorTest.java index a61a3068d2..f6089fcfef 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/MultipartReplyTranslatorTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/MultipartReplyTranslatorTest.java @@ -304,7 +304,6 @@ public class MultipartReplyTranslatorTest { DeviceInfo deviceInfo = mock(DeviceInfo.class); when(deviceInfo.getVersion()).thenReturn(OFConstants.OFP_VERSION_1_3); when(deviceInfo.getDatapathId()).thenReturn(DUMMY_DATAPATH_ID); - when(deviceInfo.getLOGValue()).thenReturn(DUMMY_DATAPATH_ID.toString()); when(mockedDeviceContext.getDeviceInfo()).thenReturn(deviceInfo); when(mockedConnectionContext.getFeatures()).thenReturn(mockedFeaturesReply); -- 2.36.6