Search in sources :

Example 1 with SimpleRSVPExtensionProviderContext

use of org.opendaylight.protocol.rsvp.parser.spi.pojo.SimpleRSVPExtensionProviderContext in project bgpcep by opendaylight.

the class LinkstateAttributeParserTest method setUp.

@Before
public final void setUp() {
    this.context = new SimpleRSVPExtensionProviderContext();
    this.rsvpActivator = new RSVPActivator();
    this.rsvpActivator.start(this.context);
    this.parser = new LinkstateAttributeParser(false, this.context.getRsvpRegistry());
}
Also used : LinkstateAttributeParser(org.opendaylight.protocol.bgp.linkstate.impl.attribute.LinkstateAttributeParser) RSVPActivator(org.opendaylight.protocol.rsvp.parser.impl.RSVPActivator) SimpleRSVPExtensionProviderContext(org.opendaylight.protocol.rsvp.parser.spi.pojo.SimpleRSVPExtensionProviderContext) Before(org.junit.Before)

Example 2 with SimpleRSVPExtensionProviderContext

use of org.opendaylight.protocol.rsvp.parser.spi.pojo.SimpleRSVPExtensionProviderContext in project bgpcep by opendaylight.

the class EROSubobjectParserTest method setUp.

@Before
public void setUp() {
    this.ctx = new SimpleRSVPExtensionProviderContext();
    this.act = new RSVPActivator();
    this.act.start(this.ctx);
}
Also used : SimpleRSVPExtensionProviderContext(org.opendaylight.protocol.rsvp.parser.spi.pojo.SimpleRSVPExtensionProviderContext) Before(org.junit.Before)

Example 3 with SimpleRSVPExtensionProviderContext

use of org.opendaylight.protocol.rsvp.parser.spi.pojo.SimpleRSVPExtensionProviderContext in project bgpcep by opendaylight.

the class RROSubobjectParserTest method testRROLabelSubobject.

@Test
public void testRROLabelSubobject() throws Exception {
    final SimpleRSVPExtensionProviderContext ctx = new SimpleRSVPExtensionProviderContext();
    try (RSVPActivator a = new RSVPActivator()) {
        a.start(ctx);
        final RROLabelSubobjectParser parser = new RROLabelSubobjectParser(ctx.getLabelHandlerRegistry());
        final SubobjectContainerBuilder subs = new SubobjectContainerBuilder();
        subs.setSubobjectType(new LabelCaseBuilder().setLabel(new LabelBuilder().setUniDirectional(true).setGlobal(false).setLabelType(new GeneralizedLabelCaseBuilder().setGeneralizedLabel(new GeneralizedLabelBuilder().setGeneralizedLabel(new byte[] { (byte) 0x12, (byte) 0x00, (byte) 0x25, (byte) 0xFF }).build()).build()).build()).build());
        assertEquals(subs.build(), parser.parseSubobject(Unpooled.wrappedBuffer(ByteArray.cutBytes(LABEL_BYTES, 2))));
        final ByteBuf buff = Unpooled.buffer();
        parser.serializeSubobject(subs.build(), buff);
        Assert.assertArrayEquals(LABEL_BYTES, ByteArray.getAllBytes(buff));
        try {
            parser.parseSubobject(null);
            Assert.fail();
        } catch (final IllegalArgumentException e) {
            Assert.assertEquals("Array of bytes is mandatory. Can't be null or empty.", e.getMessage());
        }
        try {
            parser.parseSubobject(Unpooled.EMPTY_BUFFER);
            Assert.fail();
        } catch (final IllegalArgumentException e) {
            Assert.assertEquals("Array of bytes is mandatory. Can't be null or empty.", e.getMessage());
        }
    }
}
Also used : RROLabelSubobjectParser(org.opendaylight.protocol.rsvp.parser.impl.subobject.rro.RROLabelSubobjectParser) SubobjectContainerBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.list.SubobjectContainerBuilder) 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) SimpleRSVPExtensionProviderContext(org.opendaylight.protocol.rsvp.parser.spi.pojo.SimpleRSVPExtensionProviderContext) GeneralizedLabelBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.label.subobject.label.type.generalized.label._case.GeneralizedLabelBuilder) LabelBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.subobject.type.label._case.LabelBuilder) LabelCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.subobject.type.LabelCaseBuilder) GeneralizedLabelCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.label.subobject.label.type.GeneralizedLabelCaseBuilder) ByteBuf(io.netty.buffer.ByteBuf) Test(org.junit.Test)

Example 4 with SimpleRSVPExtensionProviderContext

use of org.opendaylight.protocol.rsvp.parser.spi.pojo.SimpleRSVPExtensionProviderContext in project bgpcep by opendaylight.

the class TEObjectTest method setUp.

@Before
public void setUp() {
    this.act = new RSVPActivator();
    this.context = new SimpleRSVPExtensionProviderContext();
    this.act.start(this.context);
}
Also used : RSVPActivator(org.opendaylight.protocol.rsvp.parser.impl.RSVPActivator) SimpleRSVPExtensionProviderContext(org.opendaylight.protocol.rsvp.parser.spi.pojo.SimpleRSVPExtensionProviderContext) Before(org.junit.Before)

Aggregations

SimpleRSVPExtensionProviderContext (org.opendaylight.protocol.rsvp.parser.spi.pojo.SimpleRSVPExtensionProviderContext)4 Before (org.junit.Before)3 RSVPActivator (org.opendaylight.protocol.rsvp.parser.impl.RSVPActivator)2 ByteBuf (io.netty.buffer.ByteBuf)1 Test (org.junit.Test)1 LinkstateAttributeParser (org.opendaylight.protocol.bgp.linkstate.impl.attribute.LinkstateAttributeParser)1 RROLabelSubobjectParser (org.opendaylight.protocol.rsvp.parser.impl.subobject.rro.RROLabelSubobjectParser)1 GeneralizedLabelCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.label.subobject.label.type.GeneralizedLabelCaseBuilder)1 GeneralizedLabelBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.label.subobject.label.type.generalized.label._case.GeneralizedLabelBuilder)1 SubobjectContainerBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.list.SubobjectContainerBuilder)1 LabelCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.subobject.type.LabelCaseBuilder)1 LabelBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.subobject.type.label._case.LabelBuilder)1