BGP.parser.impl.messages: minor changes 60/22160/4
authorIveta Halanova <iveta.halanova@pantheon.sk>
Tue, 9 Jun 2015 08:18:05 +0000 (10:18 +0200)
committerGerrit Code Review <gerrit@opendaylight.org>
Wed, 10 Jun 2015 10:10:14 +0000 (10:10 +0000)
KeepaliveMsgParser - made final
NotifyMsgParser:
- Log just-built ByteBuf
- Reordered line - getData()
OpenMsgParser - log just-built ByteBuf
UpdateMsgParser - made final

Change-Id: I09283ee4505dfa5f8c747d7bfc12fc6a701efa96
Signed-off-by: Iveta Halanova <iveta.halanova@pantheon.sk>
bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/BGPKeepAliveMessageParser.java
bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/BGPNotificationMessageParser.java
bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/BGPOpenMessageParser.java
bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/BGPUpdateMessageParser.java

index 2d6cb7cc0403d236694c9910d37dd16d22a7f14a..0898497766b53eb62cef6c9588f3345f6e0bd9e6 100644 (file)
@@ -8,10 +8,8 @@
 package org.opendaylight.protocol.bgp.parser.impl.message;
 
 import com.google.common.base.Preconditions;
-
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
-
 import org.opendaylight.protocol.bgp.parser.BGPDocumentedException;
 import org.opendaylight.protocol.bgp.parser.spi.MessageParser;
 import org.opendaylight.protocol.bgp.parser.spi.MessageSerializer;
@@ -20,7 +18,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mess
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.KeepaliveBuilder;
 import org.opendaylight.yangtools.yang.binding.Notification;
 
-public class BGPKeepAliveMessageParser implements MessageParser, MessageSerializer {
+public final class BGPKeepAliveMessageParser implements MessageParser, MessageSerializer {
     public static final int TYPE = 4;
     private static final Keepalive KEEPALIVE_MSG = new KeepaliveBuilder().build();
     private static final ByteBuf KEEPALIVE_BYTES = Unpooled.buffer();
index 3079f66d4ed98a81b894415e53f10d47432fd8ce..199f9c15d324c01282c7d2c1a08e2bdf73489885 100644 (file)
@@ -47,14 +47,14 @@ public final class BGPNotificationMessageParser implements MessageParser, Messag
         final Notify ntf = (Notify) msg;
         LOG.trace("Started serializing Notification message: {}", ntf);
 
-        final byte[] data = ntf.getData();
         final ByteBuf msgBody = Unpooled.buffer();
         msgBody.writeByte(ntf.getErrorCode());
         msgBody.writeByte(ntf.getErrorSubcode());
+        final byte[] data = ntf.getData();
         if (data != null) {
             msgBody.writeBytes(data);
         }
-        LOG.trace("Notification message serialized to: {}", ByteBufUtil.hexDump(bytes));
+        LOG.trace("Notification message serialized to: {}", ByteBufUtil.hexDump(msgBody));
         MessageUtil.formatMessage(TYPE, msgBody, bytes);
     }
 
index f5e1eadc53e5599939b9e7ac9fd007e40a5b7c7c..36e9fffef050ec4c08af7c3d50b0ecd3e85bc71a 100644 (file)
@@ -91,7 +91,7 @@ public final class BGPOpenMessageParser implements MessageParser, MessageSeriali
         msgBody.writeByte(paramsBuffer.writerIndex());
         msgBody.writeBytes(paramsBuffer);
 
-        LOG.trace("Open message serialized to: {}", ByteBufUtil.hexDump(bytes));
+        LOG.trace("Open message serialized to: {}", ByteBufUtil.hexDump(msgBody));
         MessageUtil.formatMessage(TYPE, msgBody, bytes);
     }
 
index 6201ad9296e6937d84c04df55313cd51a1a2ca6d..0525ee43cbfd921300487352fecbd962e1480b5c 100644 (file)
@@ -39,7 +39,7 @@ import org.slf4j.LoggerFactory;
  *
  * @see <a href="http://tools.ietf.org/html/rfc4271#section-4.3">BGP-4 Update Message Format</a>
  */
-public class BGPUpdateMessageParser implements MessageParser, MessageSerializer {
+public final class BGPUpdateMessageParser implements MessageParser, MessageSerializer {
     public static final int TYPE = 2;
 
     private static final Logger LOG = LoggerFactory.getLogger(BGPUpdateMessageParser.class);