Logging updated 19/4719/1
authorMichal Polkorab <michal.polkorab@pantheon.sk>
Fri, 24 Jan 2014 15:15:07 +0000 (16:15 +0100)
committerMichal Polkorab <michal.polkorab@pantheon.sk>
Fri, 24 Jan 2014 15:15:54 +0000 (16:15 +0100)
Signed-off-by: Michal Polkorab <michal.polkorab@pantheon.sk>
15 files changed:
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/DelegatingInboundHandler.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/IdleHandler.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/OFDecoder.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/OFEncoder.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/OFFrameDecoder.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/OFVersionDetector.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/core/TlsDetector.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/HelloInputMessageFactory.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/util/MatchSerializer.java
openflow-protocol-it/src/test/java/org/opendaylight/openflowjava/protocol/impl/integration/MockPlugin.java
simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/ScenarioHandler.java
simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/SimpleClient.java
simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/SimpleClientFramer.java
simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/SimpleClientHandler.java
simple-client/src/main/java/org/opendaylight/openflowjava/protocol/impl/clients/WaitForMessageEvent.java

index 4279bcbbe498c619f2844a7d61ce24357e16765a..ded7bc8655547d8229b5f2f6dd8e16ac1a1e148b 100644 (file)
@@ -35,20 +35,19 @@ public class DelegatingInboundHandler extends ChannelInboundHandlerAdapter {
      * @param connectionAdapter reference for adapter communicating with upper layers outside library
      */
     public DelegatingInboundHandler(MessageConsumer connectionAdapter) {
-        LOGGER.debug("Creating DelegatingInboundHandler");
+        LOGGER.trace("Creating DelegatingInboundHandler");
         consumer = connectionAdapter;
     }
     
     @Override
     public void channelRead(ChannelHandlerContext ctx, final Object msg)
             throws Exception {
-        LOGGER.debug("Reading");
         consumer.consume((DataObject) msg);
     }
     
     @Override
     public void channelInactive(ChannelHandlerContext ctx) throws Exception {
-        LOGGER.info("Channel inactive");
+        LOGGER.debug("Channel inactive");
         if (!inactiveMessageSent) {
             DisconnectEventBuilder builder = new DisconnectEventBuilder();
             builder.setInfo("Channel inactive");
@@ -59,7 +58,7 @@ public class DelegatingInboundHandler extends ChannelInboundHandlerAdapter {
 
     @Override
     public void channelUnregistered(ChannelHandlerContext ctx) throws Exception {
-        LOGGER.info("Channel unregistered");
+        LOGGER.debug("Channel unregistered");
         if (!inactiveMessageSent) {
             DisconnectEventBuilder builder = new DisconnectEventBuilder();
             builder.setInfo("Channel unregistered");
index 65af251677882578339809afe7c1d07d8778f99a..1284618cae15802802ecf7f3d2ad645b0d71c038 100644 (file)
@@ -42,7 +42,7 @@ public class IdleHandler extends IdleStateHandler{
     protected void channelIdle(ChannelHandlerContext ctx, IdleStateEvent evt)
             throws Exception {
         if ((evt.state() == IdleState.READER_IDLE) && (evt.isFirst())) {
-            LOGGER.info("Switch idle");
+            LOGGER.debug("Switch idle");
             SwitchIdleEventBuilder builder = new SwitchIdleEventBuilder();
             builder.setInfo("Switch idle");
             ctx.fireChannelRead(builder.build());
index af04a525dcefd5d25a4eb05d832cac890a31d5c8..9c706a8848712ecf87a439054cec2dbda98c611d 100644 (file)
@@ -31,7 +31,7 @@ public class OFDecoder extends MessageToMessageDecoder<VersionMessageWrapper> {
      * Constructor of class
      */
     public OFDecoder() {
-        LOGGER.debug("Creating OF 1.3 Decoder");
+        LOGGER.trace("Creating OF 1.3 Decoder");
     }
 
     @Override
@@ -39,7 +39,6 @@ public class OFDecoder extends MessageToMessageDecoder<VersionMessageWrapper> {
             List<Object> out) throws Exception {
         if (LOGGER.isDebugEnabled()) {
             LOGGER.debug("VersionMessageWrapper received");
-            LOGGER.debug("buffer size: " + msg.getMessageBuffer().readableBytes());
             LOGGER.debug("<< " + ByteBufUtils.byteBufToHexString(msg.getMessageBuffer()));
         }
         DataObject dataObject = null;
index a62384178473422f9cbaf96825fab3e08485e010..62972b7093cd376e7537830416bc6ea23ae749cd 100644 (file)
@@ -28,13 +28,13 @@ public class OFEncoder extends MessageToByteEncoder<OfHeader> {
     
     /** Constructor of class */
     public OFEncoder() {
-        LOGGER.debug("Creating OF13Encoder");
+        LOGGER.trace("Creating OF13Encoder");
     }
     
     @Override
     protected void encode(ChannelHandlerContext ctx, OfHeader msg, ByteBuf out)
             throws Exception {
-        LOGGER.debug("Encoding");
+        LOGGER.trace("Encoding");
         try {
             SerializationFactory.messageToBuffer(msg.getVersion(), out, msg);
         } catch(Exception e) {
index 7a3e105a705a70b1c6bc70ee3bb19e8eeee0e978..dab263a2da458df32ce07fea8c0ff6af6e5fc188 100644 (file)
@@ -34,7 +34,7 @@ public class OFFrameDecoder extends ByteToMessageDecoder {
      * Constructor of class.
      */
     public OFFrameDecoder() {
-        LOGGER.debug("Creating OFFrameDecoder");
+        LOGGER.trace("Creating OFFrameDecoder");
     }
 
     @Override
@@ -59,14 +59,10 @@ public class OFFrameDecoder extends ByteToMessageDecoder {
                 LOGGER.debug("skipping bb - too few data for msg: " +
                         readableBytes + " < " + length);
                 LOGGER.debug("bb: " + ByteBufUtils.byteBufToHexString(bb));
-                LOGGER.debug("readableBytes: " + readableBytes);
             }
-            
             return;
-        } else {
-            LOGGER.debug("[enough bytes] readableBytes: " + readableBytes);
         }
-        LOGGER.info("OF Protocol message received, type:{}", bb.getByte(bb.readerIndex() + 1));
+        LOGGER.debug("OF Protocol message received, type:{}", bb.getByte(bb.readerIndex() + 1));
         
         ByteBuf messageBuffer = bb.slice(bb.readerIndex(), length);
         list.add(messageBuffer);
index 671b8dd97fa730a3d1a831c569d30b9e5dd2a110..719965b9dd44e001d04b4feafe805033d5488878 100644 (file)
@@ -34,7 +34,7 @@ public class OFVersionDetector extends ByteToMessageDecoder {
      * Constructor of class.
      */
     public OFVersionDetector() {
-        LOGGER.debug("Creating OFVersionDetector");
+        LOGGER.trace("Creating OFVersionDetector");
     }
 
     @Override
@@ -44,9 +44,7 @@ public class OFVersionDetector extends ByteToMessageDecoder {
             bb.release();
             return;
         }
-        LOGGER.debug("RI: " + bb.readerIndex());
         byte version = bb.readByte();
-
         if ((version == OF13_VERSION_ID) || (version == OF10_VERSION_ID)) {
             LOGGER.debug("detected version: " + version);
         } else {
index 93b296d0f2461f514d7ac3851a21d77fe3f2e14d..75ce2cc87c7593e728c5e3ef6c772971bdf25ffe 100644 (file)
@@ -43,7 +43,7 @@ public class TlsDetector extends ByteToMessageDecoder {
      * Constructor of class
      */
     public TlsDetector() {
-        LOGGER.debug("Creating TLS Detector");
+        LOGGER.trace("Creating TLS Detector");
         detectSsl = true;
     }
 
@@ -56,7 +56,7 @@ public class TlsDetector extends ByteToMessageDecoder {
 
     private boolean isSsl(ByteBuf bb) {
         if (detectSsl) {
-            LOGGER.info("Testing connection for TLS");
+            LOGGER.trace("Testing connection for TLS");
             return SslHandler.isEncrypted(bb);
         }
         return false;
@@ -64,7 +64,7 @@ public class TlsDetector extends ByteToMessageDecoder {
 
     private static void enableSsl(ChannelHandlerContext ctx) {
         if (ctx.pipeline().get(COMPONENT_NAMES.SSL_HANDLER.name()) == null) {
-            LOGGER.info("Engaging TLS handler");
+            LOGGER.trace("Engaging TLS handler");
             ChannelPipeline p = ctx.channel().pipeline();
             SSLEngine engine = SslContextFactory.getServerContext()
                     .createSSLEngine();
@@ -84,14 +84,14 @@ public class TlsDetector extends ByteToMessageDecoder {
             LOGGER.debug(ByteBufUtils.byteBufToHexString(bb));
         }
         if (isSsl(bb)) {
-            LOGGER.info("Connection is encrypted");
+            LOGGER.debug("Connection is encrypted");
             enableSsl(ctx);
         } else {
-            LOGGER.info("Connection is not encrypted");
+            LOGGER.debug("Connection is not encrypted");
         }
         
         if (connectionFacade != null) {
-            LOGGER.debug("Firing onConnectionReady notification");
+            LOGGER.trace("Firing onConnectionReady notification");
             connectionFacade.fireConnectionReadyNotification();
         }
         
index a0ffc2dd9354268dabd26e99cc1aeaf010889baa..04abc4ebca26621d47f600c55530c47a24fc19c0 100644 (file)
@@ -18,8 +18,6 @@ import org.opendaylight.openflowjava.protocol.impl.util.EncodeConstants;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.HelloElementType;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.hello.Elements;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 /**
  * Translates Hello messages
@@ -34,11 +32,7 @@ public class HelloInputMessageFactory implements OFSerializer<HelloInput>{
     /** Size of hello element header (in bytes) */
     public static final byte HELLO_ELEMENT_HEADER_SIZE = 4;
     private static HelloInputMessageFactory instance;
-    
-    private static final Logger LOGGER = LoggerFactory
-            .getLogger(HelloInputMessageFactory.class);
-    
-    
+
     private HelloInputMessageFactory() {
         // do nothing, just singleton
     }
@@ -60,7 +54,6 @@ public class HelloInputMessageFactory implements OFSerializer<HelloInput>{
         encodeElementsList(message, out);
         int endWriterIndex = out.writerIndex();
         int writtenBytesDiff = computeLength(message) - (endWriterIndex - startWriterIndex);
-        LOGGER.debug("writtenbytes: " + writtenBytesDiff);
         ByteBufUtils.padBuffer(writtenBytesDiff, out);
     }
 
@@ -97,10 +90,7 @@ public class HelloInputMessageFactory implements OFSerializer<HelloInput>{
                     short bitmapLength = computeVersionBitmapLength(currElement);
                     output.writeShort(bitmapLength);
                     versionBitmap = ByteBufUtils.fillBitMaskFromList(currElement.getVersionBitmap());
-                    LOGGER.debug("vbs: " + versionBitmap.length);
-                    LOGGER.debug("Version bitmap (below):");
                     for (int i = 0; i < versionBitmap.length; i++) {
-                        LOGGER.debug(Integer.toBinaryString(versionBitmap[i]));
                         output.writeInt(versionBitmap[i]);
                     }
                     int padding = bitmapLength - versionBitmap.length * 4 - HELLO_ELEMENT_HEADER_SIZE;
index adae1e243e2a9f880459b9fe8afd6b19fd068c94..430ef20c90218fee0cf6622cc390bc9022efafcc 100644 (file)
@@ -145,7 +145,7 @@ public abstract class MatchSerializer {
      */
     public static void encodeMatchEntries(List<MatchEntries> matchEntries, ByteBuf out) {
         if (matchEntries == null) {
-            LOGGER.warn("Match entries are null");
+            LOGGER.debug("Match entries are null");
             return;
         }
         for (MatchEntries entry : matchEntries) {
@@ -161,7 +161,7 @@ public abstract class MatchSerializer {
      */
     public static void encodeMatchIds(List<MatchEntries> matchEntries, ByteBuf out) {
         if (matchEntries == null) {
-            LOGGER.warn("Match entries are null");
+            LOGGER.debug("Match entries are null");
             return;
         }
         for (MatchEntries entry : matchEntries) {
index f31ed029e40ba3d3416eec9bca03ee1333fb64b3..e8834a9863db857489c09dab966a36a4d615d487 100644 (file)
@@ -58,14 +58,14 @@ public class MockPlugin implements OpenflowProtocolListener, SwitchConnectionHan
 
     /** Creates MockPlugin */
     public MockPlugin() {
-        LOGGER.info("Creating MockPlugin");
+        LOGGER.trace("Creating MockPlugin");
         finishedFuture = SettableFuture.create();
-        LOGGER.info("mockPlugin: "+System.identityHashCode(this));
+        LOGGER.debug("mockPlugin: "+System.identityHashCode(this));
     }
     
     @Override
     public void onSwitchConnected(ConnectionAdapter connection) {
-        LOGGER.info("onSwitchConnected: " + connection);
+        LOGGER.debug("onSwitchConnected: " + connection);
         this.adapter = connection;
         connection.setMessageListener(this);
         connection.setSystemListener(this);
@@ -147,7 +147,7 @@ public class MockPlugin implements OpenflowProtocolListener, SwitchConnectionHan
             if (rpcResult.isSuccessful()) {
                 byte[] byteArray = rpcResult.getResult().getDatapathId()
                         .toByteArray();
-                LOGGER.info("DatapathId: " + Arrays.toString(byteArray));
+                LOGGER.debug("DatapathId: " + Arrays.toString(byteArray));
             } else {
                 RpcError rpcError = rpcResult.getErrors().iterator().next();
                 LOGGER.warn("rpcResult failed: "
@@ -156,18 +156,18 @@ public class MockPlugin implements OpenflowProtocolListener, SwitchConnectionHan
         } catch (InterruptedException | ExecutionException | TimeoutException e) {
             LOGGER.error(e.getMessage(), e);
         }
-        LOGGER.info("After FeaturesReply message");
+        LOGGER.debug("After FeaturesReply message");
     }
 
     protected void shutdown() {
         LOGGER.debug("adapter: "+adapter);
         try {
-            LOGGER.info("mockPlugin: "+System.identityHashCode(this));
+            LOGGER.debug("mockPlugin: "+System.identityHashCode(this));
             Thread.sleep(500);
             if (adapter != null) {
                 Future<Boolean> disconnect = adapter.disconnect();
                 disconnect.get();
-                LOGGER.info("Disconnected");
+                LOGGER.debug("Disconnected");
             } 
         } catch (Exception e) {
             LOGGER.error(e.getMessage(), e);
index 24f90c9df6f54ed465bd2a7567c75ebbd993d5eb..71f7be9022b743b3011badf9115325466d677f63 100644 (file)
@@ -77,7 +77,7 @@ public class ScenarioHandler extends Thread {
                 LOGGER.error(e.getMessage(), e);
             }
         }
-        LOGGER.info("Scenario finished");
+        LOGGER.debug("Scenario finished");
         synchronized (this) {
             this.notify();
         }
index 159471ceb34a4d9c348ff3150aa765b0ff73c447..72ef9d435c86561b5ff7cd0df28a461264bbadc9 100644 (file)
@@ -79,10 +79,10 @@ public class SimpleClient extends Thread {
         } catch (Exception ex) {
             LOGGER.error(ex.getMessage(), ex);
         } finally {
-            LOGGER.info("shutting down");
+            LOGGER.debug("shutting down");
             try {
                 group.shutdownGracefully().get();
-                LOGGER.info("shutdown succesful");
+                LOGGER.debug("shutdown succesful");
             } catch (InterruptedException | ExecutionException e) {
                 LOGGER.error(e.getMessage(), e);
             }
index 48d7e475ef01044b5cffc633e034c35bd6a8230d..21639668b9cfa9de6c95652d763513294a36070f 100644 (file)
@@ -34,7 +34,7 @@ public class SimpleClientFramer extends ByteToMessageDecoder {
      * Constructor of class.
      */
     public SimpleClientFramer() {
-        LOGGER.debug("Creating OFFrameDecoder");
+        LOGGER.trace("Creating OFFrameDecoder");
     }
 
     @Override
@@ -56,7 +56,7 @@ public class SimpleClientFramer extends ByteToMessageDecoder {
                     bb.readableBytes() + " < " + length);
             return;
         }
-        LOGGER.info("OF Protocol message received, type:{}", bb.getByte(1));
+        LOGGER.debug("OF Protocol message received, type:{}", bb.getByte(1));
 
         ByteBuf messageBuffer = bb.slice(bb.readerIndex(), length);
         list.add(messageBuffer);
index 9c7ae5dbad8da936a1620e9cbb145c3cd795ad50..6e3540dd3c19b75c9cfe37fc6823e0b4f66d28b5 100644 (file)
@@ -45,17 +45,17 @@ public class SimpleClientHandler extends ChannelInboundHandlerAdapter {
         if (LOGGER.isDebugEnabled()) {
             LOGGER.debug("<< " + ByteBufUtils.byteBufToHexString(bb));
         }
-        int length = bb.getUnsignedShort(LENGTH_INDEX_IN_HEADER);
-        LOGGER.info("SimpleClientHandler - start of read");
+        int length = bb.getUnsignedShort(bb.readerIndex() + LENGTH_INDEX_IN_HEADER);
+        LOGGER.trace("SimpleClientHandler - start of read");
         byte[] message = new byte[length];
         bb.readBytes(message);
         scenarioHandler.addOfMsg(message);
-        LOGGER.info("end of read");
+        LOGGER.trace("end of read");
     }
 
     @Override
     public void channelActive(ChannelHandlerContext ctx) throws Exception {
-        LOGGER.info("Client is active");
+        LOGGER.debug("Client is active");
         if (isOnlineFuture != null) {
             isOnlineFuture.set(true);
             isOnlineFuture = null;
index 688a128e4ec616f206423cde15040dbbd7020fd4..b4b80cfb0718f9947d73883c8f3353e9f7a8cff3 100644 (file)
@@ -41,7 +41,7 @@ public class WaitForMessageEvent implements ClientEvent {
             LOGGER.debug("received msg: " + ByteBufUtils.bytesToHexString(headerReceived));
             return false;
         }
-        LOGGER.info("Headers OK");
+        LOGGER.debug("Headers OK");
         return true;
     }