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;
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();
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);
}
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);
}
*
* @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);