Search in sources :

Example 6 with GeneralizedLabelBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.label.subobject.label.type.generalized.label._case.GeneralizedLabelBuilder in project bgpcep by opendaylight.

the class LabelSubobjectParserTest method testGeneralizedLabel.

@Test
public void testGeneralizedLabel() throws PCEPDeserializerException {
    final GeneralizedLabelParser parser = new GeneralizedLabelParser();
    final GeneralizedLabelBuilder iBuilder = new GeneralizedLabelBuilder();
    iBuilder.setGeneralizedLabel(ByteArray.cutBytes(generalizedLabelBytes, 2));
    final GeneralizedLabelCaseBuilder builder = new GeneralizedLabelCaseBuilder().setGeneralizedLabel(iBuilder.build());
    assertEquals(builder.build(), parser.parseLabel(Unpooled.wrappedBuffer(ByteArray.cutBytes(generalizedLabelBytes, 2))));
    final ByteBuf buff = Unpooled.buffer();
    parser.serializeLabel(true, false, builder.build(), buff);
    assertArrayEquals(generalizedLabelBytes, ByteArray.getAllBytes(buff));
    try {
        parser.parseLabel(null);
        fail();
    } catch (final IllegalArgumentException e) {
        assertEquals("Array of bytes is mandatory. Can't be null or empty.", e.getMessage());
    }
    try {
        parser.parseLabel(Unpooled.EMPTY_BUFFER);
        fail();
    } catch (final IllegalArgumentException e) {
        assertEquals("Array of bytes is mandatory. Can't be null or empty.", e.getMessage());
    }
}
Also used : GeneralizedLabelParser(org.opendaylight.protocol.pcep.parser.subobject.GeneralizedLabelParser) GeneralizedLabelCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.label.subobject.label.type.GeneralizedLabelCaseBuilder) GeneralizedLabelBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.label.subobject.label.type.generalized.label._case.GeneralizedLabelBuilder) ByteBuf(io.netty.buffer.ByteBuf) Test(org.junit.Test)

Aggregations

ByteBuf (io.netty.buffer.ByteBuf)6 Test (org.junit.Test)6 GeneralizedLabelCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.label.subobject.label.type.GeneralizedLabelCaseBuilder)6 GeneralizedLabelBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.label.subobject.label.type.generalized.label._case.GeneralizedLabelBuilder)6 LabelCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.LabelCaseBuilder)2 LabelBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.label._case.LabelBuilder)2 LabelCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.subobject.type.LabelCaseBuilder)2 LabelBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.subobject.type.label._case.LabelBuilder)2 BaseParserExtensionActivator (org.opendaylight.protocol.pcep.parser.BaseParserExtensionActivator)1 EROLabelSubobjectParser (org.opendaylight.protocol.pcep.parser.subobject.EROLabelSubobjectParser)1 GeneralizedLabelParser (org.opendaylight.protocol.pcep.parser.subobject.GeneralizedLabelParser)1 RROLabelSubobjectParser (org.opendaylight.protocol.pcep.parser.subobject.RROLabelSubobjectParser)1 SimplePCEPExtensionProviderContext (org.opendaylight.protocol.pcep.spi.pojo.SimplePCEPExtensionProviderContext)1 EROLabelSubobjectParser (org.opendaylight.protocol.rsvp.parser.impl.subobject.ero.EROLabelSubobjectParser)1 GeneralizedLabelParser (org.opendaylight.protocol.rsvp.parser.impl.subobject.label.GeneralizedLabelParser)1 RROLabelSubobjectParser (org.opendaylight.protocol.rsvp.parser.impl.subobject.rro.RROLabelSubobjectParser)1 SimpleRSVPExtensionProviderContext (org.opendaylight.protocol.rsvp.parser.spi.pojo.SimpleRSVPExtensionProviderContext)1 SubobjectBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.explicit.route.object.ero.SubobjectBuilder)1 SubobjectBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.reported.route.object.rro.SubobjectBuilder)1 SubobjectContainerBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.explicit.route.subobjects.list.SubobjectContainerBuilder)1