package org.opendaylight.protocol.bgp.parser.impl.message.update;
import io.netty.buffer.ByteBuf;
-
+import org.opendaylight.protocol.bgp.parser.AttributeFlags;
import org.opendaylight.protocol.bgp.parser.spi.AttributeParser;
import org.opendaylight.protocol.bgp.parser.spi.AttributeSerializer;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.PathAttributes;
public final class LocalPreferenceAttributeParser implements AttributeParser,AttributeSerializer {
public static final int TYPE = 5;
+ public static final int LOCAL_PREFS_LENGTH = 4;
@Override
public void parseAttribute(final ByteBuf buffer, final PathAttributesBuilder builder) {
if (lp == null) {
return;
}
- byteAggregator.writeInt(lp.getPref().shortValue());
+
+ byteAggregator.writeByte(AttributeFlags.TRANSITIVE);
+ byteAggregator.writeByte(TYPE);
+ byteAggregator.writeByte(LOCAL_PREFS_LENGTH);
+ byteAggregator.writeInt(lp.getPref().intValue());
}
}