Search in sources :

Example 1 with PathSetupTypeTlvParser

use of org.opendaylight.protocol.pcep.parser.tlv.PathSetupTypeTlvParser in project bgpcep by opendaylight.

the class PCEPTlvParserTest method testUnsupportedPSTParser.

@Test(expected = PCEPDeserializerException.class)
public void testUnsupportedPSTParser() throws PCEPDeserializerException {
    final PathSetupTypeTlvParser parser = new PathSetupTypeTlvParser();
    parser.parseTlv(Unpooled.wrappedBuffer(ByteArray.cutBytes(PST_TLV_BYTES_UNSUPPORTED, 4)));
}
Also used : PathSetupTypeTlvParser(org.opendaylight.protocol.pcep.parser.tlv.PathSetupTypeTlvParser) Test(org.junit.Test)

Example 2 with PathSetupTypeTlvParser

use of org.opendaylight.protocol.pcep.parser.tlv.PathSetupTypeTlvParser in project bgpcep by opendaylight.

the class PCEPTlvParserTest method testUnsupportedPSTSerializer.

@Test(expected = IllegalArgumentException.class)
public void testUnsupportedPSTSerializer() {
    final PathSetupTypeTlvParser parser = new PathSetupTypeTlvParser();
    final PathSetupType pstTlv = new PathSetupTypeBuilder().setPst((short) 1).build();
    final ByteBuf buff = Unpooled.buffer();
    parser.serializeTlv(pstTlv, buff);
}
Also used : PathSetupTypeBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.path.setup.type.tlv.PathSetupTypeBuilder) PathSetupType(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.path.setup.type.tlv.PathSetupType) ByteBuf(io.netty.buffer.ByteBuf) PathSetupTypeTlvParser(org.opendaylight.protocol.pcep.parser.tlv.PathSetupTypeTlvParser) Test(org.junit.Test)

Example 3 with PathSetupTypeTlvParser

use of org.opendaylight.protocol.pcep.parser.tlv.PathSetupTypeTlvParser in project bgpcep by opendaylight.

the class PCEPTlvParserTest method testPathSetupTypeTlvParser.

@Test
public void testPathSetupTypeTlvParser() throws PCEPDeserializerException {
    final PathSetupTypeTlvParser parser = new PathSetupTypeTlvParser();
    final PathSetupType pstTlv = new PathSetupTypeBuilder().setPst((short) 0).build();
    assertEquals(pstTlv, parser.parseTlv(Unpooled.wrappedBuffer(ByteArray.cutBytes(PST_TLV_BYTES, 4))));
    final ByteBuf buff = Unpooled.buffer();
    parser.serializeTlv(pstTlv, buff);
    assertArrayEquals(PST_TLV_BYTES, ByteArray.getAllBytes(buff));
}
Also used : PathSetupTypeBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.path.setup.type.tlv.PathSetupTypeBuilder) PathSetupType(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.path.setup.type.tlv.PathSetupType) ByteBuf(io.netty.buffer.ByteBuf) PathSetupTypeTlvParser(org.opendaylight.protocol.pcep.parser.tlv.PathSetupTypeTlvParser) Test(org.junit.Test)

Example 4 with PathSetupTypeTlvParser

use of org.opendaylight.protocol.pcep.parser.tlv.PathSetupTypeTlvParser in project bgpcep by opendaylight.

the class BaseParserExtensionActivator method registerTlvParsers.

private static void registerTlvParsers(final List<AutoCloseable> regs, final PCEPExtensionProviderContext context) {
    final NoPathVectorTlvParser noPathParser = new NoPathVectorTlvParser();
    regs.add(context.registerTlvParser(NoPathVectorTlvParser.TYPE, noPathParser));
    regs.add(context.registerTlvSerializer(NoPathVector.class, noPathParser));
    final OverloadedDurationTlvParser overloadedDurationParser = new OverloadedDurationTlvParser();
    regs.add(context.registerTlvParser(OverloadedDurationTlvParser.TYPE, overloadedDurationParser));
    regs.add(context.registerTlvSerializer(OverloadDuration.class, overloadedDurationParser));
    final ReqMissingTlvParser reqMissingParser = new ReqMissingTlvParser();
    regs.add(context.registerTlvParser(ReqMissingTlvParser.TYPE, reqMissingParser));
    regs.add(context.registerTlvSerializer(ReqMissing.class, reqMissingParser));
    final OFListTlvParser ofListParser = new OFListTlvParser();
    regs.add(context.registerTlvParser(OFListTlvParser.TYPE, ofListParser));
    regs.add(context.registerTlvSerializer(OfList.class, ofListParser));
    final OrderTlvParser orderParser = new OrderTlvParser();
    regs.add(context.registerTlvParser(OrderTlvParser.TYPE, orderParser));
    regs.add(context.registerTlvSerializer(Order.class, orderParser));
    final PathSetupTypeTlvParser pstParser = new PathSetupTypeTlvParser();
    regs.add(context.registerTlvParser(PathSetupTypeTlvParser.TYPE, pstParser));
    regs.add(context.registerTlvSerializer(PathSetupType.class, pstParser));
}
Also used : Order(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.order.tlv.Order) NoPathVector(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcrep.message.pcrep.message.replies.result.failure._case.no.path.tlvs.NoPathVector) OfList(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.of.list.tlv.OfList) OverloadDuration(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.overload.duration.tlv.OverloadDuration) OverloadedDurationTlvParser(org.opendaylight.protocol.pcep.parser.tlv.OverloadedDurationTlvParser) ReqMissing(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.req.missing.tlv.ReqMissing) PathSetupType(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.path.setup.type.tlv.PathSetupType) NoPathVectorTlvParser(org.opendaylight.protocol.pcep.parser.tlv.NoPathVectorTlvParser) ReqMissingTlvParser(org.opendaylight.protocol.pcep.parser.tlv.ReqMissingTlvParser) OFListTlvParser(org.opendaylight.protocol.pcep.parser.tlv.OFListTlvParser) PathSetupTypeTlvParser(org.opendaylight.protocol.pcep.parser.tlv.PathSetupTypeTlvParser) OrderTlvParser(org.opendaylight.protocol.pcep.parser.tlv.OrderTlvParser)

Aggregations

PathSetupTypeTlvParser (org.opendaylight.protocol.pcep.parser.tlv.PathSetupTypeTlvParser)4 Test (org.junit.Test)3 PathSetupType (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.path.setup.type.tlv.PathSetupType)3 ByteBuf (io.netty.buffer.ByteBuf)2 PathSetupTypeBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.path.setup.type.tlv.PathSetupTypeBuilder)2 NoPathVectorTlvParser (org.opendaylight.protocol.pcep.parser.tlv.NoPathVectorTlvParser)1 OFListTlvParser (org.opendaylight.protocol.pcep.parser.tlv.OFListTlvParser)1 OrderTlvParser (org.opendaylight.protocol.pcep.parser.tlv.OrderTlvParser)1 OverloadedDurationTlvParser (org.opendaylight.protocol.pcep.parser.tlv.OverloadedDurationTlvParser)1 ReqMissingTlvParser (org.opendaylight.protocol.pcep.parser.tlv.ReqMissingTlvParser)1 OfList (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.of.list.tlv.OfList)1 Order (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.order.tlv.Order)1 OverloadDuration (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.overload.duration.tlv.OverloadDuration)1 NoPathVector (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcrep.message.pcrep.message.replies.result.failure._case.no.path.tlvs.NoPathVector)1 ReqMissing (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.req.missing.tlv.ReqMissing)1