use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.req.missing.tlv.ReqMissing in project bgpcep by opendaylight.
the class PCEPTlvParserTest method testReqMissingTlv.
@Test
public void testReqMissingTlv() throws PCEPDeserializerException {
final ReqMissingTlvParser parser = new ReqMissingTlvParser();
final ReqMissing tlv = new ReqMissingBuilder().setRequestId(new RequestId(Uint32.valueOf(0xF7823517L))).build();
assertEquals(tlv, parser.parseTlv(Unpooled.wrappedBuffer(ByteArray.cutBytes(REQ_MISSING_BYTES, 4))));
final ByteBuf buff = Unpooled.buffer();
parser.serializeTlv(tlv, buff);
assertArrayEquals(REQ_MISSING_BYTES, ByteArray.getAllBytes(buff));
assertNull(parser.parseTlv(null));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.req.missing.tlv.ReqMissing in project bgpcep by opendaylight.
the class ReqMissingTlvParser method serializeTlv.
@Override
public void serializeTlv(final Tlv tlv, final ByteBuf buffer) {
checkArgument(tlv instanceof ReqMissing, "ReqMissingTlv is mandatory.");
final ReqMissing req = (ReqMissing) tlv;
final ByteBuf body = Unpooled.buffer();
final RequestId reqId = req.getRequestId();
checkArgument(reqId != null, "RequestId is mandatory.");
ByteBufUtils.write(body, reqId.getValue());
TlvUtil.formatTlv(TYPE, body, buffer);
}
Aggregations