Search in sources :

Example 1 with SRROBasicProtectionSubobjectParser

use of org.opendaylight.protocol.rsvp.parser.impl.subobject.rro.SRROBasicProtectionSubobjectParser in project bgpcep by opendaylight.

the class TEObjectTest method testSSRODynamicProtectionSubobjectParser.

@Test
public void testSSRODynamicProtectionSubobjectParser() throws RSVPParsingException {
    final SRROBasicProtectionSubobjectParser parser = new SRROBasicProtectionSubobjectParser();
    final SRRODynamicProtectionSubobjectParser dynamicParser = new SRRODynamicProtectionSubobjectParser();
    final SubobjectContainer sub = parser.parseSubobject(Unpooled.copiedBuffer(ByteArray.subByte(TEObjectUtil.TE_LSP_DYNAMIC_SRRO_PROTECTION, 2, TEObjectUtil.TE_LSP_DYNAMIC_SRRO_PROTECTION.length - 2)));
    final ByteBuf output = Unpooled.buffer();
    dynamicParser.serializeSubobject(sub, output);
    assertArrayEquals(TEObjectUtil.TE_LSP_DYNAMIC_SRRO_PROTECTION, ByteArray.getAllBytes(output));
}
Also used : SubobjectContainer(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.list.SubobjectContainer) SRRODynamicProtectionSubobjectParser(org.opendaylight.protocol.rsvp.parser.impl.subobject.rro.SRRODynamicProtectionSubobjectParser) SRROBasicProtectionSubobjectParser(org.opendaylight.protocol.rsvp.parser.impl.subobject.rro.SRROBasicProtectionSubobjectParser) ByteBuf(io.netty.buffer.ByteBuf) Test(org.junit.Test)

Example 2 with SRROBasicProtectionSubobjectParser

use of org.opendaylight.protocol.rsvp.parser.impl.subobject.rro.SRROBasicProtectionSubobjectParser in project bgpcep by opendaylight.

the class TEObjectTest method testSSROBasicProtectionSubobjectParser.

@Test
public void testSSROBasicProtectionSubobjectParser() throws RSVPParsingException {
    final SRROBasicProtectionSubobjectParser parser = new SRROBasicProtectionSubobjectParser();
    final SubobjectContainer sub = parser.parseSubobject(Unpooled.copiedBuffer(ByteArray.subByte(TEObjectUtil.TE_LSP_BASIC_SRRO_PROTECTION, 2, TEObjectUtil.TE_LSP_BASIC_SRRO_PROTECTION.length - 2)));
    final ByteBuf output = Unpooled.buffer();
    parser.serializeSubobject(sub, output);
    assertArrayEquals(TEObjectUtil.TE_LSP_BASIC_SRRO_PROTECTION, ByteArray.getAllBytes(output));
}
Also used : SubobjectContainer(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.list.SubobjectContainer) SRROBasicProtectionSubobjectParser(org.opendaylight.protocol.rsvp.parser.impl.subobject.rro.SRROBasicProtectionSubobjectParser) ByteBuf(io.netty.buffer.ByteBuf) Test(org.junit.Test)

Example 3 with SRROBasicProtectionSubobjectParser

use of org.opendaylight.protocol.rsvp.parser.impl.subobject.rro.SRROBasicProtectionSubobjectParser in project bgpcep by opendaylight.

the class TEObjectTest method testWrongParseSRRO.

@Test(expected = IllegalArgumentException.class)
public void testWrongParseSRRO() throws RSVPParsingException {
    final SRROBasicProtectionSubobjectParser parser = new SRROBasicProtectionSubobjectParser();
    parser.parseSubobject(null);
}
Also used : SRROBasicProtectionSubobjectParser(org.opendaylight.protocol.rsvp.parser.impl.subobject.rro.SRROBasicProtectionSubobjectParser) Test(org.junit.Test)

Example 4 with SRROBasicProtectionSubobjectParser

use of org.opendaylight.protocol.rsvp.parser.impl.subobject.rro.SRROBasicProtectionSubobjectParser in project bgpcep by opendaylight.

the class RSVPActivator method registerRROParsers.

private static void registerRROParsers(final List<AutoCloseable> regs, final RSVPExtensionProviderContext context, final LabelRegistry labelReg) {
    final RROIpv4PrefixSubobjectParser ipv4prefixParser = new RROIpv4PrefixSubobjectParser();
    regs.add(context.registerRROSubobjectParser(RROIpv4PrefixSubobjectParser.TYPE, ipv4prefixParser));
    regs.add(context.registerRROSubobjectSerializer(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.subobject.type.IpPrefixCase.class, ipv4prefixParser));
    regs.add(context.registerRROSubobjectParser(RROIpv6PrefixSubobjectParser.TYPE, new RROIpv6PrefixSubobjectParser()));
    final RROUnnumberedInterfaceSubobjectParser unnumberedParser = new RROUnnumberedInterfaceSubobjectParser();
    regs.add(context.registerRROSubobjectParser(RROUnnumberedInterfaceSubobjectParser.TYPE, unnumberedParser));
    regs.add(context.registerRROSubobjectSerializer(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.subobject.type.UnnumberedCase.class, unnumberedParser));
    final RROPathKey32SubobjectParser pathKey32Parser = new RROPathKey32SubobjectParser();
    final RROPathKey128SubobjectParser pathKey128Parser = new RROPathKey128SubobjectParser();
    regs.add(context.registerRROSubobjectParser(RROPathKey32SubobjectParser.TYPE, pathKey32Parser));
    regs.add(context.registerRROSubobjectParser(RROPathKey128SubobjectParser.TYPE, pathKey128Parser));
    regs.add(context.registerRROSubobjectSerializer(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.subobject.type.PathKeyCase.class, pathKey32Parser));
    final RROLabelSubobjectParser labelParser = new RROLabelSubobjectParser(labelReg);
    regs.add(context.registerRROSubobjectParser(RROLabelSubobjectParser.TYPE, labelParser));
    regs.add(context.registerRROSubobjectSerializer(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.subobject.type.LabelCase.class, labelParser));
    final SRROBasicProtectionSubobjectParser srroBasicParser = new SRROBasicProtectionSubobjectParser();
    final SRRODynamicProtectionSubobjectParser srroDynamicParser = new SRRODynamicProtectionSubobjectParser();
    regs.add(context.registerRROSubobjectParser(SRROBasicProtectionSubobjectParser.TYPE, srroBasicParser));
    regs.add(context.registerRROSubobjectSerializer(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.secondary.record.route.object.secondary.record.route.object.subobject.container.subobject.type.BasicProtectionCase.class, srroBasicParser));
    regs.add(context.registerRROSubobjectSerializer(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.secondary.record.route.object.secondary.record.route.object.subobject.container.subobject.type.DynamicControlProtectionCase.class, srroDynamicParser));
}
Also used : DynamicControlProtectionCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.secondary.explicit.route.object.secondary.explicit.route.object.subobject.container.subobject.type.DynamicControlProtectionCase) RROUnnumberedInterfaceSubobjectParser(org.opendaylight.protocol.rsvp.parser.impl.subobject.rro.RROUnnumberedInterfaceSubobjectParser) RROIpv4PrefixSubobjectParser(org.opendaylight.protocol.rsvp.parser.impl.subobject.rro.RROIpv4PrefixSubobjectParser) RROPathKey32SubobjectParser(org.opendaylight.protocol.rsvp.parser.impl.subobject.rro.RROPathKey32SubobjectParser) RROLabelSubobjectParser(org.opendaylight.protocol.rsvp.parser.impl.subobject.rro.RROLabelSubobjectParser) IpPrefixCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.IpPrefixCase) GeneralizedLabelCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.label.subobject.label.type.GeneralizedLabelCase) Type1LabelCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.label.subobject.label.type.Type1LabelCase) LabelCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.LabelCase) WavebandSwitchingLabelCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.label.subobject.label.type.WavebandSwitchingLabelCase) BasicProtectionCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.secondary.explicit.route.object.secondary.explicit.route.object.subobject.container.subobject.type.BasicProtectionCase) SRROBasicProtectionSubobjectParser(org.opendaylight.protocol.rsvp.parser.impl.subobject.rro.SRROBasicProtectionSubobjectParser) UnnumberedCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.UnnumberedCase) SRRODynamicProtectionSubobjectParser(org.opendaylight.protocol.rsvp.parser.impl.subobject.rro.SRRODynamicProtectionSubobjectParser) PathKeyCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.explicit.route.subobjects.subobject.type.PathKeyCase) RROIpv6PrefixSubobjectParser(org.opendaylight.protocol.rsvp.parser.impl.subobject.rro.RROIpv6PrefixSubobjectParser) RROPathKey128SubobjectParser(org.opendaylight.protocol.rsvp.parser.impl.subobject.rro.RROPathKey128SubobjectParser)

Example 5 with SRROBasicProtectionSubobjectParser

use of org.opendaylight.protocol.rsvp.parser.impl.subobject.rro.SRROBasicProtectionSubobjectParser in project bgpcep by opendaylight.

the class TEObjectTest method testWrongSerializeSRRO.

@Test(expected = IllegalArgumentException.class)
public void testWrongSerializeSRRO() throws RSVPParsingException {
    final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.secondary.record.route.object.secondary.record.route.object.subobject.container.subobject.type.DynamicControlProtectionCase dynamicProtection = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.secondary.record.route.object.secondary.record.route.object.subobject.container.subobject.type.DynamicControlProtectionCaseBuilder().build();
    final SRROBasicProtectionSubobjectParser parser = new SRROBasicProtectionSubobjectParser();
    final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.list.SubobjectContainer subContainer = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.list.SubobjectContainerBuilder().setSubobjectType(dynamicProtection).build();
    parser.serializeSubobject(subContainer, Unpooled.buffer());
}
Also used : SRROBasicProtectionSubobjectParser(org.opendaylight.protocol.rsvp.parser.impl.subobject.rro.SRROBasicProtectionSubobjectParser) SubobjectContainer(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.list.SubobjectContainer) SubobjectContainerBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.explicit.route.subobjects.list.SubobjectContainerBuilder) Test(org.junit.Test)

Aggregations

SRROBasicProtectionSubobjectParser (org.opendaylight.protocol.rsvp.parser.impl.subobject.rro.SRROBasicProtectionSubobjectParser)5 Test (org.junit.Test)4 SubobjectContainer (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.list.SubobjectContainer)3 ByteBuf (io.netty.buffer.ByteBuf)2 SRRODynamicProtectionSubobjectParser (org.opendaylight.protocol.rsvp.parser.impl.subobject.rro.SRRODynamicProtectionSubobjectParser)2 RROIpv4PrefixSubobjectParser (org.opendaylight.protocol.rsvp.parser.impl.subobject.rro.RROIpv4PrefixSubobjectParser)1 RROIpv6PrefixSubobjectParser (org.opendaylight.protocol.rsvp.parser.impl.subobject.rro.RROIpv6PrefixSubobjectParser)1 RROLabelSubobjectParser (org.opendaylight.protocol.rsvp.parser.impl.subobject.rro.RROLabelSubobjectParser)1 RROPathKey128SubobjectParser (org.opendaylight.protocol.rsvp.parser.impl.subobject.rro.RROPathKey128SubobjectParser)1 RROPathKey32SubobjectParser (org.opendaylight.protocol.rsvp.parser.impl.subobject.rro.RROPathKey32SubobjectParser)1 RROUnnumberedInterfaceSubobjectParser (org.opendaylight.protocol.rsvp.parser.impl.subobject.rro.RROUnnumberedInterfaceSubobjectParser)1 IpPrefixCase (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.IpPrefixCase)1 LabelCase (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.LabelCase)1 UnnumberedCase (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.UnnumberedCase)1 SubobjectContainerBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.explicit.route.subobjects.list.SubobjectContainerBuilder)1 PathKeyCase (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.explicit.route.subobjects.subobject.type.PathKeyCase)1 GeneralizedLabelCase (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.label.subobject.label.type.GeneralizedLabelCase)1 Type1LabelCase (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.label.subobject.label.type.Type1LabelCase)1 WavebandSwitchingLabelCase (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.label.subobject.label.type.WavebandSwitchingLabelCase)1 BasicProtectionCase (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.secondary.explicit.route.object.secondary.explicit.route.object.subobject.container.subobject.type.BasicProtectionCase)1