use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.overload.duration.tlv.OverloadDuration in project bgpcep by opendaylight.
the class OverloadedDurationTlvParser method serializeTlv.
@Override
public void serializeTlv(final Tlv tlv, final ByteBuf buffer) {
Preconditions.checkArgument(tlv instanceof OverloadDuration, "OverloadedTlv is mandatory.");
final ByteBuf body = Unpooled.buffer();
writeUnsignedInt(((OverloadDuration) tlv).getDuration(), body);
TlvUtil.formatTlv(TYPE, body, buffer);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.overload.duration.tlv.OverloadDuration in project bgpcep by opendaylight.
the class PCEPTlvParserTest method testOverloadedDurationTlv.
@Test
public void testOverloadedDurationTlv() throws PCEPDeserializerException {
final OverloadedDurationTlvParser parser = new OverloadedDurationTlvParser();
final OverloadDuration tlv = new OverloadDurationBuilder().setDuration(0x7FFFFFFFL).build();
assertEquals(tlv, parser.parseTlv(Unpooled.wrappedBuffer(ByteArray.cutBytes(overloadedBytes, 4))));
final ByteBuf buff = Unpooled.buffer();
parser.serializeTlv(tlv, buff);
assertArrayEquals(overloadedBytes, ByteArray.getAllBytes(buff));
assertNull(parser.parseTlv(null));
}
Aggregations