Search in sources :

Example 1 with ReqMissing

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.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(0xF7823517L)).build();
    assertEquals(tlv, parser.parseTlv(Unpooled.wrappedBuffer(ByteArray.cutBytes(reqMissingBytes, 4))));
    final ByteBuf buff = Unpooled.buffer();
    parser.serializeTlv(tlv, buff);
    assertArrayEquals(reqMissingBytes, ByteArray.getAllBytes(buff));
    assertNull(parser.parseTlv(null));
}
Also used : RequestId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.RequestId) ReqMissing(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.req.missing.tlv.ReqMissing) ReqMissingBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.req.missing.tlv.ReqMissingBuilder) ReqMissingTlvParser(org.opendaylight.protocol.pcep.parser.tlv.ReqMissingTlvParser) ByteBuf(io.netty.buffer.ByteBuf) Test(org.junit.Test)

Example 2 with ReqMissing

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.req.missing.tlv.ReqMissing in project bgpcep by opendaylight.

the class ReqMissingTlvParser method serializeTlv.

@Override
public void serializeTlv(final Tlv tlv, final ByteBuf buffer) {
    Preconditions.checkArgument(tlv instanceof ReqMissing, "ReqMissingTlv is mandatory.");
    final ReqMissing req = (ReqMissing) tlv;
    final ByteBuf body = Unpooled.buffer();
    Preconditions.checkArgument(req.getRequestId() != null, "RequestId is mandatory.");
    writeUnsignedInt(req.getRequestId().getValue(), body);
    TlvUtil.formatTlv(TYPE, body, buffer);
}
Also used : ReqMissing(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.req.missing.tlv.ReqMissing) ByteBuf(io.netty.buffer.ByteBuf)

Aggregations

ByteBuf (io.netty.buffer.ByteBuf)2 ReqMissing (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.req.missing.tlv.ReqMissing)2 Test (org.junit.Test)1 ReqMissingTlvParser (org.opendaylight.protocol.pcep.parser.tlv.ReqMissingTlvParser)1 RequestId (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.RequestId)1 ReqMissingBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.req.missing.tlv.ReqMissingBuilder)1