* @param nlriByteBuf where the operands will be serialized
*/
@Override
- public final <T extends NumericOneByteValue> void serialize(final List<T> list, final ByteBuf nlriByteBuf) {
+ public <T extends NumericOneByteValue> void serialize(final List<T> list, final ByteBuf nlriByteBuf) {
for (final T operand : list) {
super.serialize(operand.getOp(), 1, nlriByteBuf);
Util.writeShortest(operand.getValue(), nlriByteBuf);
// TODO: duplicate code with NumericTwoByteValue
@Override
- public final<T extends NumericOneByteValue> String toString(final List<T> list) {
+ public <T extends NumericOneByteValue> String toString(final List<T> list) {
final StringBuilder buffer = new StringBuilder();
boolean isFirst = true;
for (final T item : list) {
* @param nlriByteBuf where the operands will be serialized
*/
@Override
- public final <T extends NumericTwoByteValue> void serialize(final List<T> list, final ByteBuf nlriByteBuf) {
+ public <T extends NumericTwoByteValue> void serialize(final List<T> list, final ByteBuf nlriByteBuf) {
for (final T operand : list) {
final ByteBuf protoBuf = Unpooled.buffer();
Util.writeShortest(operand.getValue(), protoBuf);
// TODO: duplicate code with NumericOneByteValue
@Override
- public final<T extends NumericTwoByteValue> String toString(final List<T> list) {
+ public <T extends NumericTwoByteValue> String toString(final List<T> list) {
final StringBuilder buffer = new StringBuilder();
boolean isFirst = true;
for (final T item : list) {
* @param value integer to be written
* @param buffer ByteBuf where the value will be written
*/
- protected static final void writeShortest(final int value, final ByteBuf buffer) {
+ protected static void writeShortest(final int value, final ByteBuf buffer) {
if (value <= Values.UNSIGNED_BYTE_MAX_VALUE) {
buffer.writeByte(UnsignedBytes.checkedCast(value));
} else if (value <= Values.UNSIGNED_SHORT_MAX_VALUE) {
public static final int TYPE = 65;
- private static final int PCE128_ID_F_LENGTH = 16;
+ protected static final int PCE128_ID_F_LENGTH = 16;
private static final int CONTENT128_LENGTH = 2 + PCE128_ID_F_LENGTH;
.subobjects.subobject.type.path.key._case.PathKey pk = ((PathKeyCase) subobject.getSubobjectType()).getPathKey();
final ByteBuf body = Unpooled.buffer();
Preconditions.checkArgument(pk.getPceId() != null, "PceId is mandatory.");
- if(pk.getPceId().getBinary().length == 16) {
+ if(pk.getPceId().getBinary().length == EROPathKey128SubobjectParser.PCE128_ID_F_LENGTH) {
EROPathKey128SubobjectParser.serializeSubobject(subobject,buffer);
}
Preconditions.checkArgument(pk.getPathKey() != null, "PathKey is mandatory.");
writeUnsignedShort(pk.getPathKey().getValue(), body);
- Preconditions.checkArgument(pk.getPceId().getBinary().length == 4, "PceId 32 Bit required.");
+ Preconditions.checkArgument(pk.getPceId().getBinary().length == PCE_ID_F_LENGTH, "PceId 32 Bit required.");
body.writeBytes(pk.getPceId().getBinary());
EROSubobjectUtil.formatSubobject(TYPE, subobject.isLoose(), body, buffer);
}
private static final int PK_F_LENGTH = 2;
- private static final int PCE128_ID_F_LENGTH = 16;
+ protected static final int PCE128_ID_F_LENGTH = 16;
private static final int PK_F_OFFSET = 0;
private static final int PCE_ID_F_OFFSET = PK_F_OFFSET + PK_F_LENGTH;
.subobject.type.path.key._case.PathKey pk = pkcase.getPathKey();
final ByteBuf body = Unpooled.buffer();
Preconditions.checkArgument(pk.getPceId() != null, "PceId is mandatory.");
- if(pk.getPceId().getBinary().length == 16) {
+ if(pk.getPceId().getBinary().length == RROPathKey128SubobjectParser.PCE128_ID_F_LENGTH) {
RROPathKey128SubobjectParser.serializeSubobject(subobject,buffer);
}
Preconditions.checkArgument(pk.getPathKey() != null, "PathKey is mandatory.");
writeUnsignedShort(pk.getPathKey().getValue(), body);
- Preconditions.checkArgument(pk.getPceId().getBinary().length == 4, "PceId 32 Bit required.");
+ Preconditions.checkArgument(pk.getPceId().getBinary().length == PCE_ID_F_LENGTH, "PceId 32 Bit required.");
body.writeBytes(pk.getPceId().getBinary());
RROSubobjectUtil.formatSubobject(TYPE, body, buffer);
}
public static final int TYPE = 65;
- private static final int PCE128_ID_F_LENGTH = 16;
+ protected static final int PCE128_ID_F_LENGTH = 16;
private static final int CONTENT128_LENGTH = 2 + PCE128_ID_F_LENGTH;
.subobjects.subobject.type.path.key._case.PathKey pk = ((PathKeyCase) subobject.getSubobjectType()).getPathKey();
final ByteBuf body = Unpooled.buffer();
Preconditions.checkArgument(pk.getPceId() != null, "PceId is mandatory.");
- if(pk.getPceId().getBinary().length == 16) {
+ if(pk.getPceId().getBinary().length == XROPathKey128SubobjectParser.PCE128_ID_F_LENGTH) {
XROPathKey128SubobjectParser.serializeSubobject(subobject,buffer);
}
Preconditions.checkArgument(pk.getPathKey() != null, "PathKey is mandatory.");
writeUnsignedShort(pk.getPathKey().getValue(), body);
- Preconditions.checkArgument(pk.getPceId().getBinary().length == 4, "PceId 32 Bit required.");
+ Preconditions.checkArgument(pk.getPceId().getBinary().length == PCE_ID_F_LENGTH, "PceId 32 Bit required.");
body.writeBytes(pk.getPceId().getBinary());
XROSubobjectUtil.formatSubobject(TYPE, subobject.isMandatory(), body, buffer);
}
private static final int PK_F_LENGTH = 2;
- private static final int PCE128_ID_F_LENGTH = 16;
+ protected static final int PCE128_ID_F_LENGTH = 16;
private static final int PK_F_OFFSET = 0;
private static final int PCE_ID_F_OFFSET = PK_F_OFFSET + PK_F_LENGTH;
final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.subobject.type.path.key._case.PathKey pk = pkcase.getPathKey();
final ByteBuf body = Unpooled.buffer();
Preconditions.checkArgument(pk.getPceId() != null, "PceId is mandatory.");
- if (pk.getPceId().getBinary().length == 16) {
+ if (pk.getPceId().getBinary().length == RROPathKey128SubobjectParser.PCE128_ID_F_LENGTH) {
RROPathKey128SubobjectParser.serializeSubobject(subobject, buffer);
}
Preconditions.checkArgument(pk.getPathKey() != null, "PathKey is mandatory.");
- Preconditions.checkArgument(pk.getPceId().getBinary().length == 4, "PathKey 32Bit is mandatory.");
+ Preconditions.checkArgument(pk.getPceId().getBinary().length == PCE_ID_F_LENGTH, "PathKey 32Bit is mandatory.");
writeUnsignedShort(pk.getPathKey().getValue(), body);
body.writeBytes(pk.getPceId().getBinary());
RROSubobjectUtil.formatSubobject(TYPE, body, buffer);
protected static final int TLV_HEADER_SIZE = 4;
private static final Logger LOG = LoggerFactory.getLogger(AttributesObjectParser.class);
- protected static final List<FlagContainer> parseFlag(final ByteBuf byteBuf) {
+ protected static List<FlagContainer> parseFlag(final ByteBuf byteBuf) {
final List<FlagContainer> flagList = new ArrayList<>();
while (byteBuf.isReadable()) {
final byte[] value = ByteArray.readBytes(byteBuf, FLAG_TLV_SIZE);
return flagList;
}
- protected static final void serializeFlag(final List<FlagContainer> flagList, final ByteBuf bufferAux) {
- for (FlagContainer flagContainer : flagList) {
+ protected static void serializeFlag(final List<FlagContainer> flagList, final ByteBuf bufferAux) {
+ for (final FlagContainer flagContainer : flagList) {
bufferAux.writeBytes(flagContainer.getFlags());
}
}
- protected static final void serializeTLV(final int tlvType, final int lenght, final ByteBuf value, final ByteBuf auxBuffer) {
+ protected static void serializeTLV(final int tlvType, final int lenght, final ByteBuf value, final ByteBuf auxBuffer) {
auxBuffer.writeShort(tlvType);
auxBuffer.writeShort(lenght);
auxBuffer.writeBytes(value);
protected RsvpTeObject localParseObject(final ByteBuf byteBuf) throws RSVPParsingException {
final LspAttributesObjectBuilder builder = new LspAttributesObjectBuilder();
- List<SubobjectContainer> subObjectList = new ArrayList<>();
+ final List<SubobjectContainer> subObjectList = new ArrayList<>();
while (byteBuf.isReadable()) {
final int type = byteBuf.readUnsignedShort();
final int length = byteBuf.readUnsignedShort();
final LspAttributesObject lspAttributesObject = (LspAttributesObject) teLspObject;
final ByteBuf bufferAux = Unpooled.buffer();
- int lenght = 0;
- for (SubobjectContainer subObject : lspAttributesObject.getSubobjectContainer()) {
+ int length = 0;
+ for (final SubobjectContainer subObject : lspAttributesObject.getSubobjectContainer()) {
final LspSubobject lspSubonject = subObject.getLspSubobject();
if (lspSubonject instanceof FlagsTlv) {
final ByteBuf flagTLVValue = Unpooled.buffer();
final List<FlagContainer> flagList = ((FlagsTlv) lspSubonject).getFlagContainer();
- lenght = FLAG_TLV_SIZE * flagList.size();
+ length = FLAG_TLV_SIZE * flagList.size();
serializeFlag(flagList, flagTLVValue);
- serializeTLV(FLAG_TLV_TYPE, lenght, flagTLVValue, bufferAux);
- lenght += TLV_HEADER_SIZE;
+ serializeTLV(FLAG_TLV_TYPE, length, flagTLVValue, bufferAux);
+ length += TLV_HEADER_SIZE;
}
}
- serializeAttributeHeader(lenght, CLASS_NUM, CTYPE, byteAggregator);
+ serializeAttributeHeader(length, CLASS_NUM, CTYPE, byteAggregator);
byteAggregator.writeBytes(bufferAux);
}
}