From 0b153ce18153b71fc7e5bb6de5338d5dbaf9b1a1 Mon Sep 17 00:00:00 2001 From: Michal Polkorab Date: Thu, 9 Jun 2016 10:53:40 +0200 Subject: [PATCH] Fixed netty & checkstyle failures Change-Id: I5287bdcdcbc48513d45a9cd4593bf1df6c7be941 Signed-off-by: Michal Polkorab --- .../impl/core/ConnectionInitializer.java | 8 ++++++ .../impl/core/DelegatingInboundHandler.java | 8 +++--- .../protocol/impl/core/IdleHandler.java | 4 +-- .../impl/core/OFDatagramPacketDecoder.java | 12 ++++---- .../impl/core/OFDatagramPacketEncoder.java | 6 ++-- .../impl/core/OFDatagramPacketHandler.java | 28 +++++++++---------- .../protocol/impl/core/OFDecoder.java | 14 +++++----- .../protocol/impl/core/OFFrameDecoder.java | 26 ++++++++--------- .../protocol/impl/core/OFVersionDetector.java | 12 ++++---- .../protocol/impl/core/SslContextFactory.java | 10 +++---- .../protocol/impl/core/SslKeyStore.java | 4 +-- .../core/SwitchConnectionProviderImpl.java | 12 ++++---- .../impl/core/TcpChannelInitializer.java | 16 +++++------ .../impl/core/TcpConnectionInitializer.java | 12 ++++++-- .../protocol/impl/core/TcpHandler.java | 12 ++++---- .../protocol/impl/core/UdpHandler.java | 12 ++++---- .../AbstractOutboundQueueManager.java | 4 +-- .../DeserializerRegistryImpl.java | 4 +-- .../factories/EchoReplyMessageFactory.java | 4 ++- .../factories/EchoRequestMessageFactory.java | 4 ++- .../factories/ErrorMessageFactory.java | 7 +++-- .../OF10EchoReplyMessageFactory.java | 4 ++- .../OF10EchoRequestMessageFactory.java | 4 ++- .../factories/OF10ErrorMessageFactory.java | 7 +++-- .../OF10PacketOutInputMessageFactory.java | 3 +- .../factories/PacketInMessageFactory.java | 4 ++- .../PacketOutInputMessageFactory.java | 3 +- .../serialization/SerializerRegistryImpl.java | 4 +-- .../impl/util/OF13MatchSerializer.java | 6 ++-- .../statistics/StatisticsCounters.java | 16 +++++------ .../rev140328/StatisticsCollectionModule.java | 10 +++---- .../protocol/impl/core/DummyDecoder.java | 4 +-- .../MultipartReplyMessageFactoryTest.java | 4 +-- .../EchoOutputMessageFactoryTest.java | 5 ++-- .../EchoRequestMessageFactoryTest.java | 5 ++-- .../factories/ErrorMessageFactoryTest.java | 5 ++-- .../HelloInputMessageFactoryTest.java | 12 ++++---- .../OF10PacketInMessageFactoryTest.java | 5 ++-- .../OF10PacketOutInputMessageFactoryTest.java | 4 ++- .../factories/PacketInMessageFactoryTest.java | 5 ++-- .../PacketOutInputMessageFactoryTest.java | 4 ++- .../impl/util/ActionsDeserializerTest.java | 4 +-- .../impl/util/OF13MatchSerializerTest.java | 2 +- .../statistics/StatisticsCountersTest.java | 4 +-- .../impl/clients/ListeningSimpleClient.java | 14 +++++----- .../impl/clients/ScenarioHandler.java | 16 +++++------ .../protocol/impl/clients/SendEvent.java | 12 ++++---- .../protocol/impl/clients/SimpleClient.java | 18 ++++++------ .../impl/clients/SimpleClientFramer.java | 12 ++++---- .../impl/clients/SimpleClientHandler.java | 12 ++++---- .../protocol/impl/clients/SleepEvent.java | 6 ++-- .../impl/clients/UdpSimpleClient.java | 18 ++++++------ .../impl/clients/UdpSimpleClientFramer.java | 12 ++++---- .../impl/clients/WaitForMessageEvent.java | 10 +++---- 54 files changed, 258 insertions(+), 215 deletions(-) diff --git a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/ConnectionInitializer.java b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/ConnectionInitializer.java index 4959edaa..1e95c65c 100644 --- a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/ConnectionInitializer.java +++ b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/ConnectionInitializer.java @@ -1,3 +1,11 @@ +/* + * Copyright (c) 2015 Pantheon Technologies s.r.o. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ + package org.opendaylight.openflowjava.protocol.impl.core; /** diff --git a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/DelegatingInboundHandler.java b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/DelegatingInboundHandler.java index e0a013c1..a0efc900 100644 --- a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/DelegatingInboundHandler.java +++ b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/DelegatingInboundHandler.java @@ -27,7 +27,7 @@ import com.google.common.base.Preconditions; */ public class DelegatingInboundHandler extends ChannelInboundHandlerAdapter { - private static final Logger LOGGER = LoggerFactory.getLogger(DelegatingInboundHandler.class); + private static final Logger LOG = LoggerFactory.getLogger(DelegatingInboundHandler.class); private final MessageConsumer consumer; private boolean inactiveMessageSent = false; @@ -37,7 +37,7 @@ public class DelegatingInboundHandler extends ChannelInboundHandlerAdapter { * @param connectionAdapter reference for adapter communicating with upper layers outside library */ public DelegatingInboundHandler(final MessageConsumer connectionAdapter) { - LOGGER.trace("Creating DelegatingInboundHandler"); + LOG.trace("Creating DelegatingInboundHandler"); consumer = Preconditions.checkNotNull(connectionAdapter); } @@ -48,7 +48,7 @@ public class DelegatingInboundHandler extends ChannelInboundHandlerAdapter { @Override public void channelInactive(final ChannelHandlerContext ctx) { - LOGGER.debug("Channel inactive"); + LOG.debug("Channel inactive"); if (!inactiveMessageSent) { DisconnectEventBuilder builder = new DisconnectEventBuilder(); builder.setInfo("Channel inactive"); @@ -59,7 +59,7 @@ public class DelegatingInboundHandler extends ChannelInboundHandlerAdapter { @Override public void channelUnregistered(final ChannelHandlerContext ctx) { - LOGGER.debug("Channel unregistered"); + LOG.debug("Channel unregistered"); if (!inactiveMessageSent) { DisconnectEventBuilder builder = new DisconnectEventBuilder(); builder.setInfo("Channel unregistered"); diff --git a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/IdleHandler.java b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/IdleHandler.java index 9b6e863d..5f408e6c 100644 --- a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/IdleHandler.java +++ b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/IdleHandler.java @@ -23,7 +23,7 @@ import org.slf4j.LoggerFactory; */ public class IdleHandler extends ReadTimeoutHandler { - private static final Logger LOGGER = LoggerFactory.getLogger(IdleHandler.class); + private static final Logger LOG = LoggerFactory.getLogger(IdleHandler.class); private boolean first = true; /** @@ -43,7 +43,7 @@ public class IdleHandler extends ReadTimeoutHandler { @Override protected void readTimedOut(final ChannelHandlerContext ctx) throws Exception { if (first) { - LOGGER.debug("Switch idle"); + LOG.debug("Switch idle"); SwitchIdleEventBuilder builder = new SwitchIdleEventBuilder(); builder.setInfo("Switch idle"); ctx.fireChannelRead(builder.build()); diff --git a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/OFDatagramPacketDecoder.java b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/OFDatagramPacketDecoder.java index 3a083eea..261beb9c 100644 --- a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/OFDatagramPacketDecoder.java +++ b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/OFDatagramPacketDecoder.java @@ -23,27 +23,27 @@ import org.slf4j.LoggerFactory; */ public class OFDatagramPacketDecoder extends SimpleChannelInboundHandler{ - private static final Logger LOGGER = LoggerFactory.getLogger(OFDatagramPacketDecoder.class); + private static final Logger LOG = LoggerFactory.getLogger(OFDatagramPacketDecoder.class); private DeserializationFactory deserializationFactory; @Override public void channelRead0(final ChannelHandlerContext ctx, final VersionMessageUdpWrapper msg) throws Exception { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("UdpVersionMessageWrapper received"); - LOGGER.debug("<< {}", ByteBufUtils.byteBufToHexString(msg.getMessageBuffer())); + if (LOG.isDebugEnabled()) { + LOG.debug("UdpVersionMessageWrapper received"); + LOG.debug("<< {}", ByteBufUtils.byteBufToHexString(msg.getMessageBuffer())); } try { final DataObject dataObject = deserializationFactory.deserialize(msg.getMessageBuffer(),msg.getVersion()); if (dataObject == null) { - LOGGER.warn("Translated POJO is null"); + LOG.warn("Translated POJO is null"); } else { MessageConsumer consumer = UdpConnectionMap.getMessageConsumer(msg.getAddress()); consumer.consume(dataObject); } } catch(Exception e) { - LOGGER.warn("Message deserialization failed", e); + LOG.warn("Message deserialization failed", e); // TODO: delegate exception to allow easier deserialization // debugging / deserialization problem awareness } finally { diff --git a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/OFDatagramPacketEncoder.java b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/OFDatagramPacketEncoder.java index 73a7a00e..8b1faef3 100644 --- a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/OFDatagramPacketEncoder.java +++ b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/OFDatagramPacketEncoder.java @@ -28,19 +28,19 @@ import io.netty.util.concurrent.Future; */ public class OFDatagramPacketEncoder extends MessageToMessageEncoder { - private static final Logger LOGGER = LoggerFactory.getLogger(OFDatagramPacketEncoder.class); + private static final Logger LOG = LoggerFactory.getLogger(OFDatagramPacketEncoder.class); private SerializationFactory serializationFactory; @Override protected void encode(ChannelHandlerContext ctx, UdpMessageListenerWrapper wrapper, List out) throws Exception { - LOGGER.trace("Encoding"); + LOG.trace("Encoding"); try { ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer(); serializationFactory.messageToBuffer(wrapper.getMsg().getVersion(), buffer, wrapper.getMsg()); out.add(new DatagramPacket(buffer, wrapper.getAddress())); } catch(Exception e) { - LOGGER.warn("Message serialization failed: {}", e.getMessage()); + LOG.warn("Message serialization failed: {}", e.getMessage()); Future newFailedFuture = ctx.newFailedFuture(e); wrapper.getListener().operationComplete(newFailedFuture); return; diff --git a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/OFDatagramPacketHandler.java b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/OFDatagramPacketHandler.java index 16068a5e..0eb29161 100644 --- a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/OFDatagramPacketHandler.java +++ b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/OFDatagramPacketHandler.java @@ -31,7 +31,7 @@ import org.slf4j.LoggerFactory; */ public class OFDatagramPacketHandler extends MessageToMessageDecoder { - private static final Logger LOGGER = LoggerFactory.getLogger(OFDatagramPacketHandler.class); + private static final Logger LOG = LoggerFactory.getLogger(OFDatagramPacketHandler.class); /** Length of OpenFlow 1.3 header */ public static final byte LENGTH_OF_HEADER = 8; @@ -50,15 +50,15 @@ public class OFDatagramPacketHandler extends MessageToMessageDecoder out) throws Exception { - LOGGER.debug("OFDatagramPacketFramer"); + LOG.debug("OFDatagramPacketFramer"); MessageConsumer consumer = UdpConnectionMap.getMessageConsumer(msg.sender()); if (consumer == null) { ConnectionFacade connectionFacade = @@ -70,34 +70,34 @@ public class OFDatagramPacketHandler extends MessageToMessageDecoder { - private static final Logger LOGGER = LoggerFactory.getLogger(OFDecoder.class); + private static final Logger LOG = LoggerFactory.getLogger(OFDecoder.class); private final StatisticsCounters statisticsCounter; // TODO: make this final? @@ -37,7 +37,7 @@ public class OFDecoder extends MessageToMessageDecoder { * Constructor of class */ public OFDecoder() { - LOGGER.trace("Creating OF 1.3 Decoder"); + LOG.trace("Creating OF 1.3 Decoder"); // TODO: pass as argument statisticsCounter = StatisticsCounters.getInstance(); } @@ -46,23 +46,23 @@ public class OFDecoder extends MessageToMessageDecoder { protected void decode(ChannelHandlerContext ctx, VersionMessageWrapper msg, List out) throws Exception { statisticsCounter.incrementCounter(CounterEventTypes.US_RECEIVED_IN_OFJAVA); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("VersionMessageWrapper received"); - LOGGER.debug("<< {}", ByteBufUtils.byteBufToHexString(msg.getMessageBuffer())); + if (LOG.isDebugEnabled()) { + LOG.debug("VersionMessageWrapper received"); + LOG.debug("<< {}", ByteBufUtils.byteBufToHexString(msg.getMessageBuffer())); } try { final DataObject dataObject = deserializationFactory.deserialize(msg.getMessageBuffer(), msg.getVersion()); if (dataObject == null) { - LOGGER.warn("Translated POJO is null"); + LOG.warn("Translated POJO is null"); statisticsCounter.incrementCounter(CounterEventTypes.US_DECODE_FAIL); } else { out.add(dataObject); statisticsCounter.incrementCounter(CounterEventTypes.US_DECODE_SUCCESS); } } catch (Exception e) { - LOGGER.warn("Message deserialization failed", e); + LOG.warn("Message deserialization failed", e); statisticsCounter.incrementCounter(CounterEventTypes.US_DECODE_FAIL); } finally { msg.getMessageBuffer().release(); diff --git a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/OFFrameDecoder.java b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/OFFrameDecoder.java index f4ec8825..735070fa 100644 --- a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/OFFrameDecoder.java +++ b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/OFFrameDecoder.java @@ -29,7 +29,7 @@ public class OFFrameDecoder extends ByteToMessageDecoder { /** Length of OpenFlow 1.3 header */ public static final byte LENGTH_OF_HEADER = 8; private static final byte LENGTH_INDEX_IN_HEADER = 2; - private static final Logger LOGGER = LoggerFactory.getLogger(OFFrameDecoder.class); + private static final Logger LOG = LoggerFactory.getLogger(OFFrameDecoder.class); private ConnectionFacade connectionFacade; private boolean firstTlsPass = false; @@ -40,7 +40,7 @@ public class OFFrameDecoder extends ByteToMessageDecoder { * @param tlsPresent true is TLS is required, false otherwise */ public OFFrameDecoder(ConnectionFacade connectionFacade, boolean tlsPresent) { - LOGGER.trace("Creating OFFrameDecoder"); + LOG.trace("Creating OFFrameDecoder"); if (tlsPresent) { firstTlsPass = true; } @@ -50,11 +50,11 @@ public class OFFrameDecoder extends ByteToMessageDecoder { @Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { if (cause instanceof io.netty.handler.ssl.NotSslRecordException) { - LOGGER.warn("Not an TLS record exception - please verify TLS configuration."); + LOG.warn("Not an TLS record exception - please verify TLS configuration."); } else { - LOGGER.warn("Unexpected exception from downstream.", cause); + LOG.warn("Unexpected exception from downstream.", cause); } - LOGGER.warn("Closing connection."); + LOG.warn("Closing connection."); ctx.close(); } @@ -66,24 +66,24 @@ public class OFFrameDecoder extends ByteToMessageDecoder { } int readableBytes = bb.readableBytes(); if (readableBytes < LENGTH_OF_HEADER) { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("skipping bytebuf - too few bytes for header: {} < {}", readableBytes, LENGTH_OF_HEADER); - LOGGER.debug("bb: {}", ByteBufUtils.byteBufToHexString(bb)); + if (LOG.isDebugEnabled()) { + LOG.debug("skipping bytebuf - too few bytes for header: {} < {}", readableBytes, LENGTH_OF_HEADER); + LOG.debug("bb: {}", ByteBufUtils.byteBufToHexString(bb)); } return; } int length = bb.getUnsignedShort(bb.readerIndex() + LENGTH_INDEX_IN_HEADER); - LOGGER.debug("length of actual message: {}", length); + LOG.debug("length of actual message: {}", length); if (readableBytes < length) { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("skipping bytebuf - too few bytes for msg: {} < {}", readableBytes, length); - LOGGER.debug("bytebuffer: {}", ByteBufUtils.byteBufToHexString(bb)); + if (LOG.isDebugEnabled()) { + LOG.debug("skipping bytebuf - too few bytes for msg: {} < {}", readableBytes, length); + LOG.debug("bytebuffer: {}", ByteBufUtils.byteBufToHexString(bb)); } return; } - LOGGER.debug("OF Protocol message received, type:{}", bb.getByte(bb.readerIndex() + 1)); + LOG.debug("OF Protocol message received, type:{}", bb.getByte(bb.readerIndex() + 1)); ByteBuf messageBuffer = bb.slice(bb.readerIndex(), length); list.add(messageBuffer); diff --git a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/OFVersionDetector.java b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/OFVersionDetector.java index 0142ebfd..b635ef25 100644 --- a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/OFVersionDetector.java +++ b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/OFVersionDetector.java @@ -29,7 +29,7 @@ public class OFVersionDetector extends ByteToMessageDecoder { /** Version number of OpenFlow 1.3 protocol */ private static final byte OF13_VERSION_ID = EncodeConstants.OF13_VERSION_ID; private static final short OF_PACKETIN = 10; - private static final Logger LOGGER = LoggerFactory.getLogger(OFVersionDetector.class); + private static final Logger LOG = LoggerFactory.getLogger(OFVersionDetector.class); private final StatisticsCounters statisticsCounters; private volatile boolean filterPacketIns; @@ -37,7 +37,7 @@ public class OFVersionDetector extends ByteToMessageDecoder { * Constructor of class. */ public OFVersionDetector() { - LOGGER.trace("Creating OFVersionDetector"); + LOG.trace("Creating OFVersionDetector"); statisticsCounters = StatisticsCounters.getInstance(); } @@ -48,24 +48,24 @@ public class OFVersionDetector extends ByteToMessageDecoder { @Override protected void decode(final ChannelHandlerContext ctx, final ByteBuf in, final List out) { if (!in.isReadable()) { - LOGGER.debug("not enough data"); + LOG.debug("not enough data"); in.release(); return; } final byte version = in.readByte(); if (version == OF13_VERSION_ID || version == OF10_VERSION_ID) { - LOGGER.debug("detected version: {}", version); + LOG.debug("detected version: {}", version); if (!filterPacketIns || OF_PACKETIN != in.getUnsignedByte(in.readerIndex())) { ByteBuf messageBuffer = in.slice(); out.add(new VersionMessageWrapper(version, messageBuffer)); messageBuffer.retain(); } else { - LOGGER.debug("dropped packetin"); + LOG.debug("dropped packetin"); statisticsCounters.incrementCounter(CounterEventTypes.US_DROPPED_PACKET_IN); } } else { - LOGGER.warn("detected version: {} - currently not supported", version); + LOG.warn("detected version: {} - currently not supported", version); } in.skipBytes(in.readableBytes()); } diff --git a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/SslContextFactory.java b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/SslContextFactory.java index b2c5a199..dbaa2070 100644 --- a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/SslContextFactory.java +++ b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/SslContextFactory.java @@ -34,7 +34,7 @@ public class SslContextFactory { private static final String PROTOCOL = "TLS"; private TlsConfiguration tlsConfig; - private static final Logger LOGGER = LoggerFactory + private static final Logger LOG = LoggerFactory .getLogger(SslContextFactory.class); /** @@ -72,16 +72,16 @@ public class SslContextFactory { serverContext = SSLContext.getInstance(PROTOCOL); serverContext.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null); } catch (IOException e) { - LOGGER.warn("IOException - Failed to load keystore / truststore." + LOG.warn("IOException - Failed to load keystore / truststore." + " Failed to initialize the server-side SSLContext", e); } catch (NoSuchAlgorithmException e) { - LOGGER.warn("NoSuchAlgorithmException - Unsupported algorithm." + LOG.warn("NoSuchAlgorithmException - Unsupported algorithm." + " Failed to initialize the server-side SSLContext", e); } catch (CertificateException e) { - LOGGER.warn("CertificateException - Unable to access certificate (check password)." + LOG.warn("CertificateException - Unable to access certificate (check password)." + " Failed to initialize the server-side SSLContext", e); } catch (Exception e) { - LOGGER.warn("Exception - Failed to initialize the server-side SSLContext", e); + LOG.warn("Exception - Failed to initialize the server-side SSLContext", e); } return serverContext; } diff --git a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/SslKeyStore.java b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/SslKeyStore.java index 589c23cd..e4efea9f 100644 --- a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/SslKeyStore.java +++ b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/SslKeyStore.java @@ -24,7 +24,7 @@ import org.slf4j.LoggerFactory; */ public final class SslKeyStore { - private static final Logger LOGGER = LoggerFactory.getLogger(SslKeyStore.class); + private static final Logger LOG = LoggerFactory.getLogger(SslKeyStore.class); private SslKeyStore() { throw new UnsupportedOperationException("Utility class shouldn't be instantiated"); @@ -48,7 +48,7 @@ public final class SslKeyStore { } break; case PATH: - LOGGER.debug("Current dir using System:" + LOG.debug("Current dir using System:" + System.getProperty("user.dir")); File keystorefile = new File(filename); try { diff --git a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/SwitchConnectionProviderImpl.java b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/SwitchConnectionProviderImpl.java index 411a9b43..bb327361 100644 --- a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/SwitchConnectionProviderImpl.java +++ b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/SwitchConnectionProviderImpl.java @@ -58,7 +58,7 @@ import org.slf4j.LoggerFactory; */ public class SwitchConnectionProviderImpl implements SwitchConnectionProvider, ConnectionInitializer { - private static final Logger LOGGER = LoggerFactory + private static final Logger LOG = LoggerFactory .getLogger(SwitchConnectionProviderImpl.class); private SwitchConnectionHandler switchConnectionHandler; private ServerFacade serverFacade; @@ -88,15 +88,15 @@ public class SwitchConnectionProviderImpl implements SwitchConnectionProvider, C @Override public void setSwitchConnectionHandler(final SwitchConnectionHandler switchConnectionHandler) { - LOGGER.debug("setSwitchConnectionHandler"); + LOG.debug("setSwitchConnectionHandler"); this.switchConnectionHandler = switchConnectionHandler; } @Override public ListenableFuture shutdown() { - LOGGER.debug("Shutdown summoned"); + LOG.debug("Shutdown summoned"); if(serverFacade == null){ - LOGGER.warn("Can not shutdown - not configured or started"); + LOG.warn("Can not shutdown - not configured or started"); throw new IllegalStateException("SwitchConnectionProvider is not started or not configured."); } return serverFacade.shutdown(); @@ -104,7 +104,7 @@ public class SwitchConnectionProviderImpl implements SwitchConnectionProvider, C @Override public ListenableFuture startup() { - LOGGER.debug("Startup summoned"); + LOG.debug("Startup summoned"); ListenableFuture result = null; try { serverFacade = createAndConfigureServer(); @@ -125,7 +125,7 @@ public class SwitchConnectionProviderImpl implements SwitchConnectionProvider, C * @return */ private ServerFacade createAndConfigureServer() { - LOGGER.debug("Configuring .."); + LOG.debug("Configuring .."); ServerFacade server = null; final ChannelInitializerFactory factory = new ChannelInitializerFactory(); factory.setSwitchConnectionHandler(switchConnectionHandler); diff --git a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/TcpChannelInitializer.java b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/TcpChannelInitializer.java index 881f697a..376978d1 100644 --- a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/TcpChannelInitializer.java +++ b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/TcpChannelInitializer.java @@ -31,7 +31,7 @@ import org.slf4j.LoggerFactory; */ public class TcpChannelInitializer extends ProtocolChannelInitializer { - private static final Logger LOGGER = LoggerFactory + private static final Logger LOG = LoggerFactory .getLogger(TcpChannelInitializer.class); private final DefaultChannelGroup allChannels; private final ConnectionAdapterFactory connectionAdapterFactory; @@ -58,21 +58,21 @@ public class TcpChannelInitializer extends ProtocolChannelInitializer :{}", + LOG.debug("Incoming connection from (remote address): {}:{} --> :{}", switchAddress.toString(), remotePort, port); if (!getSwitchConnectionHandler().accept(switchAddress)) { ch.disconnect(); - LOGGER.debug("Incoming connection rejected"); + LOG.debug("Incoming connection rejected"); return; } } - LOGGER.debug("Incoming connection accepted - building pipeline"); + LOG.debug("Incoming connection accepted - building pipeline"); allChannels.add(ch); ConnectionFacade connectionFacade = null; connectionFacade = connectionAdapterFactory.createConnectionFacade(ch, null, useBarrier()); try { - LOGGER.debug("calling plugin: {}", getSwitchConnectionHandler()); + LOG.debug("calling plugin: {}", getSwitchConnectionHandler()); getSwitchConnectionHandler().onSwitchConnected(connectionFacade); connectionFacade.checkListeners(); ch.pipeline().addLast(PipelineHandlers.IDLE_HANDLER.name(), new IdleHandler(getSwitchIdleTimeout(), TimeUnit.MILLISECONDS)); @@ -87,10 +87,10 @@ public class TcpChannelInitializer extends ProtocolChannelInitializer suitesList = getTlsConfiguration().getCipherSuites(); if (suitesList != null && !suitesList.isEmpty()) { - LOGGER.debug("Requested Cipher Suites are: {}", suitesList); + LOG.debug("Requested Cipher Suites are: {}", suitesList); String[] suites = suitesList.toArray(new String[suitesList.size()]); engine.setEnabledCipherSuites(suites); - LOGGER.debug("Cipher suites enabled in SSLEngine are: {}", engine.getEnabledCipherSuites().toString()); + LOG.debug("Cipher suites enabled in SSLEngine are: {}", engine.getEnabledCipherSuites().toString()); } final SslHandler ssl = new SslHandler(engine); final Future handshakeFuture = ssl.handshakeFuture(); @@ -117,7 +117,7 @@ public class TcpChannelInitializer extends ProtocolChannelInitializer> LOG_ENCODER_LISTENER = new GenericFutureListener>() { - private final Logger LOGGER = LoggerFactory.getLogger("LogEncoderListener"); + private final Logger LOG = LoggerFactory.getLogger(GenericFutureListener.class); @Override public void operationComplete(final Future future) throws Exception { if (future.cause() != null) { - LOGGER.warn("Message encoding fail !", future.cause()); + LOG.warn("Message encoding fail !", future.cause()); } } }; diff --git a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/DeserializerRegistryImpl.java b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/DeserializerRegistryImpl.java index 6ee48183..7ba0f2c3 100644 --- a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/DeserializerRegistryImpl.java +++ b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/DeserializerRegistryImpl.java @@ -29,7 +29,7 @@ import org.slf4j.LoggerFactory; */ public class DeserializerRegistryImpl implements DeserializerRegistry { - private static final Logger LOGGER = LoggerFactory.getLogger(DeserializerRegistryImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(DeserializerRegistryImpl.class); private Map registry; /** @@ -79,7 +79,7 @@ public class DeserializerRegistryImpl implements DeserializerRegistry { } OFGeneralDeserializer desInRegistry = registry.put(key, deserializer); if (desInRegistry != null) { - LOGGER.debug("Deserializer for key {} overwritten. Old deserializer: {}, new deserializer: {}", key, + LOG.debug("Deserializer for key {} overwritten. Old deserializer: {}, new deserializer: {}", key, desInRegistry.getClass().getName(), deserializer.getClass().getName()); } if (deserializer instanceof DeserializerRegistryInjector) { diff --git a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/EchoReplyMessageFactory.java b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/EchoReplyMessageFactory.java index 8c8ba389..5d3ecde7 100644 --- a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/EchoReplyMessageFactory.java +++ b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/EchoReplyMessageFactory.java @@ -29,7 +29,9 @@ public class EchoReplyMessageFactory implements OFDeserializer { builder.setXid(rawMessage.readUnsignedInt()); int remainingBytes = rawMessage.readableBytes(); if (remainingBytes > 0) { - builder.setData(rawMessage.readBytes(remainingBytes).array()); + byte[] data = new byte[remainingBytes]; + rawMessage.readBytes(data); + builder.setData(data); } return builder.build(); } diff --git a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/EchoRequestMessageFactory.java b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/EchoRequestMessageFactory.java index 6e1e5597..446faf14 100644 --- a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/EchoRequestMessageFactory.java +++ b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/EchoRequestMessageFactory.java @@ -27,7 +27,9 @@ public class EchoRequestMessageFactory implements OFDeserializer, } decodeType(builder, errorType, type); decodeCode(rawMessage, builder, errorType); - if (rawMessage.readableBytes() > 0) { - builder.setData(rawMessage.readBytes(rawMessage.readableBytes()).array()); + int remainingBytes = rawMessage.readableBytes(); + if (remainingBytes > 0) { + byte[] data = new byte[remainingBytes]; + rawMessage.readBytes(data); + builder.setData(data); } return builder.build(); } diff --git a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/OF10EchoReplyMessageFactory.java b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/OF10EchoReplyMessageFactory.java index ec45475e..107faa5a 100644 --- a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/OF10EchoReplyMessageFactory.java +++ b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/OF10EchoReplyMessageFactory.java @@ -29,7 +29,9 @@ public class OF10EchoReplyMessageFactory implements OFDeserializer { builder.setXid(rawMessage.readUnsignedInt()); int remainingBytes = rawMessage.readableBytes(); if (remainingBytes > 0) { - builder.setData(rawMessage.readBytes(remainingBytes).array()); + byte[] data = new byte[remainingBytes]; + rawMessage.readBytes(data); + builder.setData(data); } return builder.build(); } diff --git a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/OF10EchoRequestMessageFactory.java b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/OF10EchoRequestMessageFactory.java index a63c255d..a90044ca 100644 --- a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/OF10EchoRequestMessageFactory.java +++ b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/OF10EchoRequestMessageFactory.java @@ -27,7 +27,9 @@ public class OF10EchoRequestMessageFactory implements OFDeserializer { ErrorTypeV10 errorType = ErrorTypeV10.forValue(type); decodeType(builder, errorType, type); decodeCode(rawMessage, builder, errorType); - if (rawMessage.readableBytes() > 0) { - builder.setData(rawMessage.readBytes(rawMessage.readableBytes()).array()); + int remainingBytes = rawMessage.readableBytes(); + if (remainingBytes > 0) { + byte[] data = new byte[remainingBytes]; + rawMessage.readBytes(data); + builder.setData(data); } return builder.build(); } diff --git a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/OF10PacketOutInputMessageFactory.java b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/OF10PacketOutInputMessageFactory.java index 1f4d2c1e..94cce9b1 100644 --- a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/OF10PacketOutInputMessageFactory.java +++ b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/OF10PacketOutInputMessageFactory.java @@ -47,7 +47,8 @@ public class OF10PacketOutInputMessageFactory implements OFDeserializer, OFDeserializer matchDeserializer = registry.getDeserializer(MATCH_KEY); builder.setMatch(matchDeserializer.deserialize(rawMessage)); rawMessage.skipBytes(PADDING_IN_PACKET_IN_HEADER); - builder.setData(rawMessage.readBytes(rawMessage.readableBytes()).array()); + byte[] data = new byte[rawMessage.readableBytes()]; + rawMessage.readBytes(data); + builder.setData(data); return builder.build(); } diff --git a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/PacketOutInputMessageFactory.java b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/PacketOutInputMessageFactory.java index 6b1ddc94..919a8e74 100644 --- a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/PacketOutInputMessageFactory.java +++ b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/PacketOutInputMessageFactory.java @@ -38,7 +38,8 @@ public class PacketOutInputMessageFactory implements OFDeserializer actions = ListDeserializer.deserializeList(EncodeConstants.OF13_VERSION_ID, actions_len, rawMessage, keyMaker, registry); builder.setAction(actions); - byte[] data = rawMessage.readBytes(rawMessage.readableBytes()).array(); + byte[] data = new byte[rawMessage.readableBytes()]; + rawMessage.readBytes(data); if (data != null) { builder.setData(data); } diff --git a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/SerializerRegistryImpl.java b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/SerializerRegistryImpl.java index 96307fa2..93831878 100644 --- a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/SerializerRegistryImpl.java +++ b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/SerializerRegistryImpl.java @@ -34,7 +34,7 @@ import org.slf4j.LoggerFactory; */ public class SerializerRegistryImpl implements SerializerRegistry { - private static final Logger LOGGER = LoggerFactory.getLogger(SerializerRegistryImpl.class); + private static final Logger LOG = LoggerFactory.getLogger(SerializerRegistryImpl.class); private static final short OF10 = EncodeConstants.OF10_VERSION_ID; private static final short OF13 = EncodeConstants.OF13_VERSION_ID; private Map, OFGeneralSerializer> registry; @@ -83,7 +83,7 @@ public class SerializerRegistryImpl implements SerializerRegistry { } OFGeneralSerializer serInRegistry = registry.put(msgTypeKey, serializer); if (serInRegistry != null) { - LOGGER.debug("Serializer for key {} overwritten. Old serializer: {}, new serializer: {}", msgTypeKey, + LOG.debug("Serializer for key {} overwritten. Old serializer: {}, new serializer: {}", msgTypeKey, serInRegistry.getClass().getName(), serializer.getClass().getName()); } if (serializer instanceof SerializerRegistryInjector) { diff --git a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/util/OF13MatchSerializer.java b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/util/OF13MatchSerializer.java index 32ecb5de..7022c98d 100644 --- a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/util/OF13MatchSerializer.java +++ b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/util/OF13MatchSerializer.java @@ -32,7 +32,7 @@ import org.slf4j.LoggerFactory; * @author timotej.kubas */ public class OF13MatchSerializer implements OFSerializer, SerializerRegistryInjector { - private static final Logger LOGGER = LoggerFactory.getLogger(OF13MatchSerializer.class); + private static final Logger LOG = LoggerFactory.getLogger(OF13MatchSerializer.class); private static final byte STANDARD_MATCH_TYPE_CODE = 0; private static final byte OXM_MATCH_TYPE_CODE = 1; private SerializerRegistry registry; @@ -40,7 +40,7 @@ public class OF13MatchSerializer implements OFSerializer, SerializerRegis @Override public void serialize(Match match, ByteBuf outBuffer) { if (match == null) { - LOGGER.debug("Match is null"); + LOG.debug("Match is null"); return; } int matchStartIndex = outBuffer.writerIndex(); @@ -72,7 +72,7 @@ public class OF13MatchSerializer implements OFSerializer, SerializerRegis */ public void serializeMatchEntries(List matchEntries, ByteBuf out) { if (matchEntries == null) { - LOGGER.debug("Match entries are null"); + LOG.debug("Match entries are null"); return; } for (MatchEntry entry : matchEntries) { diff --git a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/statistics/StatisticsCounters.java b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/statistics/StatisticsCounters.java index 3f900d80..d0c071e5 100644 --- a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/statistics/StatisticsCounters.java +++ b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/statistics/StatisticsCounters.java @@ -31,7 +31,7 @@ public final class StatisticsCounters implements StatisticsHandler { */ public static final int MINIMAL_LOG_REPORT_PERIOD = 500; private static StatisticsCounters instanceHolder; - private static final Logger LOGGER = LoggerFactory.getLogger(StatisticsCounters.class); + private static final Logger LOG = LoggerFactory.getLogger(StatisticsCounters.class); private Timer logReporter; private int logReportPeriod; @@ -70,7 +70,7 @@ public final class StatisticsCounters implements StatisticsHandler { runCounting = false; this.logReportPeriod = 0; this.runLogReport = false; - LOGGER.debug("StaticsCounters has been created"); + LOG.debug("StaticsCounters has been created"); } /** @@ -83,7 +83,7 @@ public final class StatisticsCounters implements StatisticsHandler { return; } resetCounters(); - LOGGER.debug("Counting started..."); + LOG.debug("Counting started..."); if(reportToLogs){ startLogReport(logReportDelay); } @@ -95,7 +95,7 @@ public final class StatisticsCounters implements StatisticsHandler { */ public void stopCounting(){ runCounting = false; - LOGGER.debug("Stop counting..."); + LOG.debug("Stop counting..."); stopLogReport(); } @@ -127,7 +127,7 @@ public final class StatisticsCounters implements StatisticsHandler { logReporter = new Timer("SC_Timer"); logReporter.schedule(new LogReporterTask(this), this.logReportPeriod, this.logReportPeriod); runLogReport = true; - LOGGER.debug("Statistics log reporter has been scheduled with period {} ms", this.logReportPeriod); + LOG.debug("Statistics log reporter has been scheduled with period {} ms", this.logReportPeriod); } /** @@ -137,7 +137,7 @@ public final class StatisticsCounters implements StatisticsHandler { if(runLogReport){ if(logReporter != null){ logReporter.cancel(); - LOGGER.debug("Statistics log reporter has been canceled"); + LOG.debug("Statistics log reporter has been canceled"); } runLogReport = false; } @@ -213,7 +213,7 @@ public final class StatisticsCounters implements StatisticsHandler { for(CounterEventTypes cet : enabledCounters){ countersMap.get(cet).reset(); } - LOGGER.debug("StaticsCounters has been reset"); + LOG.debug("StaticsCounters has been reset"); } @Override @@ -241,7 +241,7 @@ public final class StatisticsCounters implements StatisticsHandler { @Override public void run() { for(CounterEventTypes cet : sc.getEnabledCounters()){ - LOG.debug(cet.name() + ": " + sc.getCountersMap().get(cet).getStat()); + LOG.debug("{}: {}", cet.name(), sc.getCountersMap().get(cet).getStat()); } } } diff --git a/openflow-protocol-impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/openflow/_switch/connection/provider/impl/rev140328/StatisticsCollectionModule.java b/openflow-protocol-impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/openflow/_switch/connection/provider/impl/rev140328/StatisticsCollectionModule.java index 5de0a75f..e30b4d6b 100644 --- a/openflow-protocol-impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/openflow/_switch/connection/provider/impl/rev140328/StatisticsCollectionModule.java +++ b/openflow-protocol-impl/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/openflow/_switch/connection/provider/impl/rev140328/StatisticsCollectionModule.java @@ -11,7 +11,7 @@ import org.slf4j.LoggerFactory; */ public class StatisticsCollectionModule extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow._switch.connection.provider.impl.rev140328.AbstractStatisticsCollectionModule { - private static final Logger LOGGER = LoggerFactory.getLogger(StatisticsCollectionModule.class); + private static final Logger LOG = LoggerFactory.getLogger(StatisticsCollectionModule.class); public StatisticsCollectionModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) { super(identifier, dependencyResolver); @@ -54,7 +54,7 @@ public class StatisticsCollectionModule extends org.opendaylight.yang.gen.v1.urn if (statsConfig != null) { statsCounter.startCounting(statsConfig.getStatisticsCollect(), statsConfig.getLogReportDelay()); } else { - LOGGER.debug("Unable to start StatisticCounter - wrong configuration"); + LOG.debug("Unable to start StatisticCounter - wrong configuration"); } /* Internal MXBean implementation */ @@ -93,11 +93,11 @@ public class StatisticsCollectionModule extends org.opendaylight.yang.gen.v1.urn } catch (Exception e) { String errMsg = "Error by stoping StatisticsCollectionService."; - LOGGER.error(errMsg, e); + LOG.error(errMsg, e); throw new IllegalStateException(errMsg, e); } } - LOGGER.info("StatisticsCollection Service consumer (instance {} turn down.)", this); + LOG.info("StatisticsCollection Service consumer (instance {} turn down.)", this); } @Override @@ -112,7 +112,7 @@ public class StatisticsCollectionModule extends org.opendaylight.yang.gen.v1.urn } AutoCloseable ret = new AutoClosableStatisticsCollection(); - LOGGER.info("StatisticsCollection service (instance {}) initialized.", ret); + LOG.info("StatisticsCollection service (instance {}) initialized.", ret); return ret; } } \ No newline at end of file diff --git a/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/DummyDecoder.java b/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/DummyDecoder.java index fcab9887..55ebf43d 100644 --- a/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/DummyDecoder.java +++ b/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/core/DummyDecoder.java @@ -23,13 +23,13 @@ import org.slf4j.LoggerFactory; */ public class DummyDecoder extends ByteToMessageDecoder { - private static final Logger LOGGER = LoggerFactory + private static final Logger LOG = LoggerFactory .getLogger(DummyDecoder.class); @Override protected void decode(ChannelHandlerContext ctx, ByteBuf in, List out) throws Exception { - LOGGER.debug("decoding"); + LOG.debug("decoding"); ctx.fireChannelReadComplete(); } diff --git a/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/MultipartReplyMessageFactoryTest.java b/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/MultipartReplyMessageFactoryTest.java index 00785418..088201b3 100644 --- a/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/MultipartReplyMessageFactoryTest.java +++ b/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/MultipartReplyMessageFactoryTest.java @@ -87,7 +87,7 @@ public class MultipartReplyMessageFactoryTest { new MessageCodeKey(EncodeConstants.OF13_VERSION_ID, 19, MultipartReplyMessage.class)); } - private static final Logger LOGGER = LoggerFactory + private static final Logger LOG = LoggerFactory .getLogger(MultipartReplyMessageFactoryTest.class); /** @@ -678,7 +678,7 @@ public class MultipartReplyMessageFactoryTest { Assert.assertEquals("Wrong meterBandDscp.burstSize", 32, meterBandDscp.getBurstSize().intValue()); Assert.assertEquals("Wrong meterBandDscp.precLevel", 4, meterBandDscp.getPrecLevel().intValue()); - LOGGER.info(message.getMeterConfig().get(0).getFlags().toString()); + LOG.info(message.getMeterConfig().get(0).getFlags().toString()); Assert.assertEquals("Wrong flags01", new MeterFlags(false, true, true, false), message.getMeterConfig().get(1).getFlags()); Assert.assertEquals("Wrong meterId01", 7, diff --git a/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/EchoOutputMessageFactoryTest.java b/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/EchoOutputMessageFactoryTest.java index cc0ba0df..0f70b3ea 100644 --- a/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/EchoOutputMessageFactoryTest.java +++ b/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/EchoOutputMessageFactoryTest.java @@ -47,7 +47,8 @@ public class EchoOutputMessageFactoryTest { ByteBuf serializedBuffer = UnpooledByteBufAllocator.DEFAULT.buffer(); factory.serialize(message, serializedBuffer); BufferHelper.checkHeaderV13(serializedBuffer, MESSAGE_TYPE, 24); - Assert.assertArrayEquals("Wrong data", message.getData(), - serializedBuffer.readBytes(serializedBuffer.readableBytes()).array()); + byte[] readData = new byte[serializedBuffer.readableBytes()]; + serializedBuffer.readBytes(readData); + Assert.assertArrayEquals("Wrong data", message.getData(), readData); } } diff --git a/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/EchoRequestMessageFactoryTest.java b/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/EchoRequestMessageFactoryTest.java index 20f8b5fc..22135bb6 100644 --- a/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/EchoRequestMessageFactoryTest.java +++ b/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/EchoRequestMessageFactoryTest.java @@ -49,7 +49,8 @@ public class EchoRequestMessageFactoryTest { ByteBuf serializedBuffer = UnpooledByteBufAllocator.DEFAULT.buffer(); factory.serialize(message, serializedBuffer); BufferHelper.checkHeaderV13(serializedBuffer, MESSAGE_TYPE, 24); - Assert.assertArrayEquals("Wrong data", message.getData(), - serializedBuffer.readBytes(serializedBuffer.readableBytes()).array()); + byte[] readData = new byte[serializedBuffer.readableBytes()]; + serializedBuffer.readBytes(readData); + Assert.assertArrayEquals("Wrong data", message.getData(), readData); } } diff --git a/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/ErrorMessageFactoryTest.java b/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/ErrorMessageFactoryTest.java index ff3e70ea..929cbefe 100644 --- a/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/ErrorMessageFactoryTest.java +++ b/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/ErrorMessageFactoryTest.java @@ -52,7 +52,8 @@ public class ErrorMessageFactoryTest { BufferHelper.checkHeaderV13(serializedBuffer, MESSAGE_TYPE, 28); Assert.assertEquals("Wrong Type", message.getType().intValue(), serializedBuffer.readShort()); Assert.assertEquals("Wrong Code", message.getCode().intValue(), serializedBuffer.readShort()); - Assert.assertArrayEquals("Wrong data", message.getData(), - serializedBuffer.readBytes(serializedBuffer.readableBytes()).array()); + byte[] readData = new byte[serializedBuffer.readableBytes()]; + serializedBuffer.readBytes(readData); + Assert.assertArrayEquals("Wrong data", message.getData(), readData); } } diff --git a/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/HelloInputMessageFactoryTest.java b/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/HelloInputMessageFactoryTest.java index d947b3fd..e9319a96 100644 --- a/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/HelloInputMessageFactoryTest.java +++ b/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/HelloInputMessageFactoryTest.java @@ -38,7 +38,7 @@ import org.slf4j.LoggerFactory; */ public class HelloInputMessageFactoryTest { - private static final Logger LOGGER = LoggerFactory.getLogger(HelloInputMessageFactoryTest.class); + private static final Logger LOG = LoggerFactory.getLogger(HelloInputMessageFactoryTest.class); private SerializerRegistry registry; private OFSerializer helloFactory; @@ -84,8 +84,8 @@ public class HelloInputMessageFactoryTest { ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer(); helloFactory.serialize(message, out); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("bytebuf: {}", ByteBufUtils.byteBufToHexString(out)); + if (LOG.isDebugEnabled()) { + LOG.debug("bytebuf: {}", ByteBufUtils.byteBufToHexString(out)); } BufferHelper.checkHeaderV13(out, (byte) 0, 16); @@ -110,8 +110,8 @@ public class HelloInputMessageFactoryTest { ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer(); helloFactory.serialize(message, out); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("bytebuf: ", ByteBufUtils.byteBufToHexString(out)); + if (LOG.isDebugEnabled()) { + LOG.debug("bytebuf: ", ByteBufUtils.byteBufToHexString(out)); } BufferHelper.checkHeaderV13(out, (byte) 0, 24); @@ -146,7 +146,7 @@ public class HelloInputMessageFactoryTest { booleanList.add(false); } } - LOGGER.debug("boolsize {}", booleanList.size()); + LOG.debug("boolsize {}", booleanList.size()); elementsBuilder.setType(HelloElementType.forValue(1)); elementsBuilder.setVersionBitmap(booleanList); elementsList.add(elementsBuilder.build()); diff --git a/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/OF10PacketInMessageFactoryTest.java b/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/OF10PacketInMessageFactoryTest.java index 5d3c3a8d..abe0055d 100644 --- a/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/OF10PacketInMessageFactoryTest.java +++ b/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/OF10PacketInMessageFactoryTest.java @@ -58,7 +58,8 @@ public class OF10PacketInMessageFactoryTest { Assert.assertEquals("Wrong port in", message.getInPort().intValue(), serializedBuffer.readUnsignedShort()); Assert.assertEquals("Wrong reason", message.getReason().getIntValue(), serializedBuffer.readUnsignedByte()); serializedBuffer.skipBytes(1); - Assert.assertArrayEquals("Wrong data", message.getData(), - serializedBuffer.readBytes(serializedBuffer.readableBytes()).array()); + byte[] readData = new byte[serializedBuffer.readableBytes()]; + serializedBuffer.readBytes(readData); + Assert.assertArrayEquals("Wrong data", message.getData(), readData); } } diff --git a/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/OF10PacketOutInputMessageFactoryTest.java b/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/OF10PacketOutInputMessageFactoryTest.java index 6b1ff682..af4f139e 100644 --- a/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/OF10PacketOutInputMessageFactoryTest.java +++ b/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/OF10PacketOutInputMessageFactoryTest.java @@ -94,7 +94,9 @@ public class OF10PacketOutInputMessageFactoryTest { Assert.assertEquals("Wrong action type", 3, out.readUnsignedShort()); Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort()); out.skipBytes(4); - Assert.assertArrayEquals("Wrong data", message.getData(), out.readBytes(out.readableBytes()).array()); + byte[] readData = new byte[out.readableBytes()]; + out.readBytes(readData); + Assert.assertArrayEquals("Wrong data", message.getData(), readData); Assert.assertTrue("Unread data", out.readableBytes() == 0); } diff --git a/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/PacketInMessageFactoryTest.java b/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/PacketInMessageFactoryTest.java index 550e9c72..8f917b7b 100644 --- a/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/PacketInMessageFactoryTest.java +++ b/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/PacketInMessageFactoryTest.java @@ -121,8 +121,9 @@ public class PacketInMessageFactoryTest { Assert.assertEquals("Wrong oxm value", 4, serializedBuffer.readUnsignedByte()); serializedBuffer.skipBytes(7); serializedBuffer.skipBytes(PADDING); - Assert.assertArrayEquals("Wrong data", message.getData(), - serializedBuffer.readBytes(serializedBuffer.readableBytes()).array()); + byte[] readData = new byte[serializedBuffer.readableBytes()]; + serializedBuffer.readBytes(readData); + Assert.assertArrayEquals("Wrong data", message.getData(), readData); } } diff --git a/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/PacketOutInputMessageFactoryTest.java b/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/PacketOutInputMessageFactoryTest.java index 50c0839f..60ee5210 100644 --- a/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/PacketOutInputMessageFactoryTest.java +++ b/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/PacketOutInputMessageFactoryTest.java @@ -96,7 +96,9 @@ public class PacketOutInputMessageFactoryTest { Assert.assertEquals("Wrong action type", 18, out.readUnsignedShort()); Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort()); out.skipBytes(PADDING_IN_ACTION_HEADER); - Assert.assertArrayEquals("Wrong data", message.getData(), out.readBytes(out.readableBytes()).array()); + byte[] readData = new byte[out.readableBytes()]; + out.readBytes(readData); + Assert.assertArrayEquals("Wrong data", message.getData(), readData); } /** diff --git a/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/util/ActionsDeserializerTest.java b/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/util/ActionsDeserializerTest.java index 76fe9888..b9d2b0f5 100644 --- a/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/util/ActionsDeserializerTest.java +++ b/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/util/ActionsDeserializerTest.java @@ -46,7 +46,7 @@ import org.slf4j.LoggerFactory; */ public class ActionsDeserializerTest { - private static final Logger LOGGER = LoggerFactory + private static final Logger LOG = LoggerFactory .getLogger(ActionsDeserializerTest.class); private DeserializerRegistry registry; @@ -82,7 +82,7 @@ public class ActionsDeserializerTest { + "00 1B 00 08 00 00 00 00"); message.skipBytes(4); // skip XID - LOGGER.info("bytes: {}", message.readableBytes()); + LOG.info("bytes: {}", message.readableBytes()); CodeKeyMaker keyMaker = CodeKeyMakerFactory.createActionsKeyMaker(EncodeConstants.OF13_VERSION_ID); List actions = ListDeserializer.deserializeList(EncodeConstants.OF13_VERSION_ID, diff --git a/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/util/OF13MatchSerializerTest.java b/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/util/OF13MatchSerializerTest.java index 999607d2..94b90b9d 100644 --- a/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/util/OF13MatchSerializerTest.java +++ b/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/util/OF13MatchSerializerTest.java @@ -283,7 +283,7 @@ public class OF13MatchSerializerTest { byte[] label = new byte[4]; out.readBytes(label); - LOG.debug("label: "+ ByteBufUtils.bytesToHexString(label)); + LOG.debug("label: {}", ByteBufUtils.bytesToHexString(label)); Assert.assertArrayEquals("Wrong ipv6FLabel", new byte[]{0, 0x0f, (byte) 0x9e, (byte) 0x8d}, label); } diff --git a/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/statistics/StatisticsCountersTest.java b/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/statistics/StatisticsCountersTest.java index fb641622..6f2f772c 100644 --- a/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/statistics/StatisticsCountersTest.java +++ b/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/statistics/StatisticsCountersTest.java @@ -21,7 +21,7 @@ import org.slf4j.LoggerFactory; */ public class StatisticsCountersTest { - private static final Logger LOGGER = LoggerFactory.getLogger(StatisticsCountersTest.class); + private static final Logger LOG = LoggerFactory.getLogger(StatisticsCountersTest.class); private StatisticsCounters statCounters; /** @@ -81,7 +81,7 @@ public class StatisticsCountersTest { Assert.fail("No counter is enabled"); } incrementCounter(firstEnabledCET,testCount); - LOGGER.debug("Waiting to process event queue"); + LOG.debug("Waiting to process event queue"); Assert.assertEquals("Wrong - bad last read value.", 0,statCounters.getCounter(firstEnabledCET).getCounterLastReadValue()); Assert.assertEquals("Wrong - bad value", testCount,statCounters.getCounter(firstEnabledCET).getCounterValue(false)); Assert.assertEquals("Wrong - bad last read value.", 0,statCounters.getCounter(firstEnabledCET).getCounterLastReadValue()); diff --git a/simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/ListeningSimpleClient.java b/simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/ListeningSimpleClient.java index 559c2279..5afb039f 100644 --- a/simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/ListeningSimpleClient.java +++ b/simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/ListeningSimpleClient.java @@ -29,7 +29,7 @@ import com.google.common.util.concurrent.SettableFuture; */ public class ListeningSimpleClient implements OFClient { - private static final Logger LOGGER = LoggerFactory.getLogger(ListeningSimpleClient.class); + private static final Logger LOG = LoggerFactory.getLogger(ListeningSimpleClient.class); private int port; private boolean securedClient = false; private EventLoopGroup workerGroup; @@ -73,21 +73,21 @@ public class ListeningSimpleClient implements OFClient { isOnlineFuture.set(true); synchronized (scenarioHandler) { - LOGGER.debug("WAITING FOR SCENARIO"); + LOG.debug("WAITING FOR SCENARIO"); while (! scenarioHandler.isScenarioFinished()) { scenarioHandler.wait(); } } } catch (Exception ex) { - LOGGER.error(ex.getMessage(), ex); + LOG.error(ex.getMessage(), ex); } finally { - LOGGER.debug("listening client shutting down"); + LOG.debug("listening client shutting down"); try { workerGroup.shutdownGracefully().get(); bossGroup.shutdownGracefully().get(); - LOGGER.debug("listening client shutdown succesful"); + LOG.debug("listening client shutdown succesful"); } catch (InterruptedException | ExecutionException e) { - LOGGER.error(e.getMessage(), e); + LOG.error(e.getMessage(), e); } } scenarioDone.set(true); @@ -97,7 +97,7 @@ public class ListeningSimpleClient implements OFClient { * @return close future */ public Future disconnect() { - LOGGER.debug("disconnecting client"); + LOG.debug("disconnecting client"); return workerGroup.shutdownGracefully(); } diff --git a/simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/ScenarioHandler.java b/simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/ScenarioHandler.java index 57865d88..44abb36d 100644 --- a/simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/ScenarioHandler.java +++ b/simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/ScenarioHandler.java @@ -25,7 +25,7 @@ import org.slf4j.LoggerFactory; */ public class ScenarioHandler extends Thread { - private static final Logger LOGGER = LoggerFactory.getLogger(ScenarioHandler.class); + private static final Logger LOG = LoggerFactory.getLogger(ScenarioHandler.class); private Deque scenario; private BlockingQueue ofMsg; private ChannelHandlerContext ctx; @@ -45,19 +45,19 @@ public class ScenarioHandler extends Thread { public void run() { int freezeCounter = 0; while (!scenario.isEmpty()) { - LOGGER.debug("Running event #{}", eventNumber); + LOG.debug("Running event #{}", eventNumber); ClientEvent peek = scenario.peekLast(); if (peek instanceof WaitForMessageEvent) { - LOGGER.debug("WaitForMessageEvent"); + LOG.debug("WaitForMessageEvent"); try { WaitForMessageEvent event = (WaitForMessageEvent) peek; event.setHeaderReceived(ofMsg.poll(2000, TimeUnit.MILLISECONDS)); } catch (InterruptedException e) { - LOGGER.error(e.getMessage(), e); + LOG.error(e.getMessage(), e); break; } } else if (peek instanceof SendEvent) { - LOGGER.debug("Proceed - sendevent"); + LOG.debug("Proceed - sendevent"); SendEvent event = (SendEvent) peek; event.setCtx(ctx); } @@ -69,16 +69,16 @@ public class ScenarioHandler extends Thread { freezeCounter++; } if (freezeCounter > 2) { - LOGGER.warn("Scenario frozen: {}", freezeCounter); + LOG.warn("Scenario frozen: {}", freezeCounter); break; } try { sleep(100); } catch (InterruptedException e) { - LOGGER.error(e.getMessage(), e); + LOG.error(e.getMessage(), e); } } - LOGGER.debug("Scenario finished"); + LOG.debug("Scenario finished"); synchronized (this) { scenarioFinished = true; this.notify(); diff --git a/simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/SendEvent.java b/simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/SendEvent.java index 3f456d12..9318d231 100644 --- a/simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/SendEvent.java +++ b/simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/SendEvent.java @@ -22,7 +22,7 @@ import org.slf4j.LoggerFactory; */ public class SendEvent implements ClientEvent { - protected static final Logger LOGGER = LoggerFactory.getLogger(SendEvent.class); + private static final Logger LOG = LoggerFactory.getLogger(SendEvent.class); protected byte[] msgToSend; protected ChannelHandlerContext ctx; @@ -38,15 +38,15 @@ public class SendEvent implements ClientEvent { @Override public boolean eventExecuted() { - LOGGER.debug("sending message"); - LOGGER.debug("start of run"); + LOG.debug("sending message"); + LOG.debug("start of run"); ByteBuf buffer = ctx.alloc().buffer(); buffer.writeBytes(msgToSend); ctx.writeAndFlush(buffer); - if (LOGGER.isDebugEnabled()) { - LOGGER.debug(">> {}", ByteBufUtils.bytesToHexString(msgToSend)); - LOGGER.debug("message sent"); + if (LOG.isDebugEnabled()) { + LOG.debug(">> {}", ByteBufUtils.bytesToHexString(msgToSend)); + LOG.debug("message sent"); } return true; } diff --git a/simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/SimpleClient.java b/simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/SimpleClient.java index 5e98e3d6..fb0fda09 100644 --- a/simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/SimpleClient.java +++ b/simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/SimpleClient.java @@ -29,7 +29,7 @@ import com.google.common.util.concurrent.SettableFuture; */ public class SimpleClient implements OFClient { - private static final Logger LOGGER = LoggerFactory.getLogger(SimpleClient.class); + private static final Logger LOG = LoggerFactory.getLogger(SimpleClient.class); private final String host; private final int port; private boolean securedClient = false; @@ -72,20 +72,20 @@ public class SimpleClient implements OFClient { b.connect(host, port).sync(); synchronized (scenarioHandler) { - LOGGER.debug("WAITING FOR SCENARIO"); + LOG.debug("WAITING FOR SCENARIO"); while (! scenarioHandler.isScenarioFinished()) { scenarioHandler.wait(); } } } catch (Exception ex) { - LOGGER.error(ex.getMessage(), ex); + LOG.error(ex.getMessage(), ex); } finally { - LOGGER.debug("shutting down"); + LOG.debug("shutting down"); try { group.shutdownGracefully().get(); - LOGGER.debug("shutdown succesful"); + LOG.debug("shutdown succesful"); } catch (InterruptedException | ExecutionException e) { - LOGGER.error(e.getMessage(), e); + LOG.error(e.getMessage(), e); } } scenarioDone.set(true); @@ -95,7 +95,7 @@ public class SimpleClient implements OFClient { * @return close future */ public Future disconnect() { - LOGGER.debug("disconnecting client"); + LOG.debug("disconnecting client"); return group.shutdownGracefully(); } @@ -115,8 +115,8 @@ public class SimpleClient implements OFClient { int port; SimpleClient sc; if (args.length != 3) { - LOGGER.error("Usage: {} ", SimpleClient.class.getSimpleName()); - LOGGER.error("Trying to use default setting."); + LOG.error("Usage: {} ", SimpleClient.class.getSimpleName()); + LOG.error("Trying to use default setting."); InetAddress ia = InetAddress.getLocalHost(); InetAddress[] all = InetAddress.getAllByName(ia.getHostName()); host = all[0].getHostAddress(); diff --git a/simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/SimpleClientFramer.java b/simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/SimpleClientFramer.java index 1420ad8d..02c9cd98 100644 --- a/simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/SimpleClientFramer.java +++ b/simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/SimpleClientFramer.java @@ -28,34 +28,34 @@ public class SimpleClientFramer extends ByteToMessageDecoder { /** Length of OpenFlow 1.3 header */ public static final byte LENGTH_OF_HEADER = 8; private static final byte LENGTH_INDEX_IN_HEADER = 2; - private static final Logger LOGGER = LoggerFactory.getLogger(SimpleClientFramer.class); + private static final Logger LOG = LoggerFactory.getLogger(SimpleClientFramer.class); /** * Constructor of class. */ public SimpleClientFramer() { - LOGGER.trace("Creating OFFrameDecoder"); + LOG.trace("Creating OFFrameDecoder"); } @Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { - LOGGER.warn("Unexpected exception from downstream.", cause); + LOG.warn("Unexpected exception from downstream.", cause); ctx.close(); } @Override protected void decode(ChannelHandlerContext chc, ByteBuf bb, List list) throws Exception { if (bb.readableBytes() < LENGTH_OF_HEADER) { - LOGGER.debug("skipping bb - too few data for header: {}", bb.readableBytes()); + LOG.debug("skipping bb - too few data for header: {}", bb.readableBytes()); return; } int length = bb.getUnsignedShort(bb.readerIndex() + LENGTH_INDEX_IN_HEADER); if (bb.readableBytes() < length) { - LOGGER.debug("skipping bb - too few data for msg: {} < {}", bb.readableBytes(), length); + LOG.debug("skipping bb - too few data for msg: {} < {}", bb.readableBytes(), length); return; } - LOGGER.debug("OF Protocol message received, type:{}", bb.getByte(bb.readerIndex() + 1)); + LOG.debug("OF Protocol message received, type:{}", bb.getByte(bb.readerIndex() + 1)); ByteBuf messageBuffer = bb.slice(bb.readerIndex(), length); list.add(messageBuffer); diff --git a/simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/SimpleClientHandler.java b/simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/SimpleClientHandler.java index acc53834..863f9aeb 100644 --- a/simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/SimpleClientHandler.java +++ b/simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/SimpleClientHandler.java @@ -25,7 +25,7 @@ import com.google.common.util.concurrent.SettableFuture; */ public class SimpleClientHandler extends ChannelInboundHandlerAdapter { - protected static final Logger LOGGER = LoggerFactory.getLogger(SimpleClientHandler.class); + private static final Logger LOG = LoggerFactory.getLogger(SimpleClientHandler.class); private static final int LENGTH_INDEX_IN_HEADER = 2; private SettableFuture isOnlineFuture; protected ScenarioHandler scenarioHandler; @@ -42,20 +42,20 @@ public class SimpleClientHandler extends ChannelInboundHandlerAdapter { @Override public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { ByteBuf bb = (ByteBuf) msg; - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("<< {}", ByteBufUtils.byteBufToHexString(bb)); + if (LOG.isDebugEnabled()) { + LOG.debug("<< {}", ByteBufUtils.byteBufToHexString(bb)); } int length = bb.getUnsignedShort(bb.readerIndex() + LENGTH_INDEX_IN_HEADER); - LOGGER.trace("SimpleClientHandler - start of read"); + LOG.trace("SimpleClientHandler - start of read"); byte[] message = new byte[length]; bb.readBytes(message); scenarioHandler.addOfMsg(message); - LOGGER.trace("end of read"); + LOG.trace("end of read"); } @Override public void channelActive(ChannelHandlerContext ctx) throws Exception { - LOGGER.debug("Client is active"); + LOG.debug("Client is active"); if (isOnlineFuture != null) { isOnlineFuture.set(true); isOnlineFuture = null; diff --git a/simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/SleepEvent.java b/simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/SleepEvent.java index b1e1a50c..19229abc 100644 --- a/simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/SleepEvent.java +++ b/simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/SleepEvent.java @@ -18,7 +18,7 @@ import org.slf4j.LoggerFactory; */ public class SleepEvent implements ClientEvent { - private static final Logger LOGGER = LoggerFactory.getLogger(SleepEvent.class); + private static final Logger LOG = LoggerFactory.getLogger(SleepEvent.class); private long sleepTime; /** @@ -33,10 +33,10 @@ public class SleepEvent implements ClientEvent { public boolean eventExecuted() { try { Thread.sleep(sleepTime); - LOGGER.debug("Sleeping"); + LOG.debug("Sleeping"); return true; } catch (InterruptedException e) { - LOGGER.error(e.getMessage(), e); + LOG.error(e.getMessage(), e); } return false; } diff --git a/simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/UdpSimpleClient.java b/simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/UdpSimpleClient.java index e9d4644e..f7ff0a61 100644 --- a/simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/UdpSimpleClient.java +++ b/simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/UdpSimpleClient.java @@ -30,7 +30,7 @@ import com.google.common.util.concurrent.SettableFuture; */ public class UdpSimpleClient implements OFClient { - private static final Logger LOGGER = LoggerFactory.getLogger(UdpSimpleClient.class); + private static final Logger LOG = LoggerFactory.getLogger(UdpSimpleClient.class); private final String host; private final int port; private EventLoopGroup group; @@ -73,20 +73,20 @@ public class UdpSimpleClient implements OFClient { b.connect(host, port).sync(); synchronized (scenarioHandler) { - LOGGER.debug("WAITING FOR SCENARIO"); + LOG.debug("WAITING FOR SCENARIO"); while (! scenarioHandler.isScenarioFinished()) { scenarioHandler.wait(); } } } catch (Exception ex) { - LOGGER.error(ex.getMessage(), ex); + LOG.error(ex.getMessage(), ex); } finally { - LOGGER.debug("shutting down"); + LOG.debug("shutting down"); try { group.shutdownGracefully().get(); - LOGGER.debug("shutdown succesful"); + LOG.debug("shutdown succesful"); } catch (InterruptedException | ExecutionException e) { - LOGGER.error(e.getMessage(), e); + LOG.error(e.getMessage(), e); } } scenarioDone.set(true); @@ -96,7 +96,7 @@ public class UdpSimpleClient implements OFClient { * @return close future */ public Future disconnect() { - LOGGER.debug("disconnecting client"); + LOG.debug("disconnecting client"); return group.shutdownGracefully(); } @@ -111,8 +111,8 @@ public class UdpSimpleClient implements OFClient { int port; UdpSimpleClient sc; if (args.length != 2) { - LOGGER.error("Usage: {} ", UdpSimpleClient.class.getSimpleName()); - LOGGER.error("Trying to use default setting."); + LOG.error("Usage: {} ", UdpSimpleClient.class.getSimpleName()); + LOG.error("Trying to use default setting."); InetAddress ia = InetAddress.getLocalHost(); InetAddress[] all = InetAddress.getAllByName(ia.getHostName()); host = all[0].getHostAddress(); diff --git a/simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/UdpSimpleClientFramer.java b/simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/UdpSimpleClientFramer.java index be73d27c..b893a8f3 100644 --- a/simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/UdpSimpleClientFramer.java +++ b/simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/UdpSimpleClientFramer.java @@ -29,18 +29,18 @@ public class UdpSimpleClientFramer extends MessageToMessageDecoder list) throws Exception { ByteBuf bb = msg.content(); if (bb.readableBytes() < LENGTH_OF_HEADER) { - LOGGER.debug("skipping bb - too few data for header: {}", bb.readableBytes()); + LOG.debug("skipping bb - too few data for header: {}", bb.readableBytes()); return; } int length = bb.getUnsignedShort(bb.readerIndex() + LENGTH_INDEX_IN_HEADER); if (bb.readableBytes() < length) { - LOGGER.debug("skipping bb - too few data for msg: {} < {}", bb.readableBytes(), length); + LOG.debug("skipping bb - too few data for msg: {} < {}", bb.readableBytes(), length); return; } - LOGGER.debug("OF Protocol message received, type:{}", bb.getByte(bb.readerIndex() + 1)); + LOG.debug("OF Protocol message received, type:{}", bb.getByte(bb.readerIndex() + 1)); ByteBuf messageBuffer = bb.slice(bb.readerIndex(), length); list.add(messageBuffer); diff --git a/simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/WaitForMessageEvent.java b/simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/WaitForMessageEvent.java index b448111a..59228e36 100644 --- a/simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/WaitForMessageEvent.java +++ b/simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/WaitForMessageEvent.java @@ -20,7 +20,7 @@ import org.slf4j.LoggerFactory; */ public class WaitForMessageEvent implements ClientEvent { - private static final Logger LOGGER = LoggerFactory.getLogger(WaitForMessageEvent.class); + private static final Logger LOG = LoggerFactory.getLogger(WaitForMessageEvent.class); private byte[] headerExpected; private byte[] headerReceived; @@ -40,13 +40,13 @@ public class WaitForMessageEvent implements ClientEvent { return false; } if (!Arrays.equals(headerExpected, headerReceived)) { - if (LOGGER.isDebugEnabled()) { - LOGGER.debug("expected msg: {}", ByteBufUtils.bytesToHexString(headerExpected)); - LOGGER.debug("received msg: {}", ByteBufUtils.bytesToHexString(headerReceived)); + if (LOG.isDebugEnabled()) { + LOG.debug("expected msg: {}", ByteBufUtils.bytesToHexString(headerExpected)); + LOG.debug("received msg: {}", ByteBufUtils.bytesToHexString(headerReceived)); } return false; } - LOGGER.debug("Headers OK"); + LOG.debug("Headers OK"); return true; } -- 2.36.6