use of org.opendaylight.protocol.rsvp.parser.impl.subobject.ero.SEROBasicProtectionSubobjectParser in project bgpcep by opendaylight.
the class TEObjectTest method testSEROBasicProtectionSubobjectParser.
@Test
public void testSEROBasicProtectionSubobjectParser() throws RSVPParsingException {
final SEROBasicProtectionSubobjectParser parser = new SEROBasicProtectionSubobjectParser();
final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.explicit.route.subobjects.list.SubobjectContainer sub = parser.parseSubobject(Unpooled.copiedBuffer(ByteArray.subByte(TEObjectUtil.TE_LSP_BASIC_SERO_PROTECTION, 2, TEObjectUtil.TE_LSP_BASIC_SERO_PROTECTION.length - 2)), true);
final ByteBuf output = Unpooled.buffer();
parser.serializeSubobject(sub, output);
assertArrayEquals(TEObjectUtil.TE_LSP_BASIC_SERO_PROTECTION, ByteArray.getAllBytes(output));
}
use of org.opendaylight.protocol.rsvp.parser.impl.subobject.ero.SEROBasicProtectionSubobjectParser in project bgpcep by opendaylight.
the class TEObjectTest method testWrongSerializeSERO.
@Test(expected = IllegalArgumentException.class)
public void testWrongSerializeSERO() throws RSVPParsingException {
final SEROBasicProtectionSubobjectParser parser = new SEROBasicProtectionSubobjectParser();
parser.serializeSubobject(new SubobjectContainerBuilder().setSubobjectType(new DynamicControlProtectionCaseBuilder().build()).build(), Unpooled.buffer());
}
use of org.opendaylight.protocol.rsvp.parser.impl.subobject.ero.SEROBasicProtectionSubobjectParser in project bgpcep by opendaylight.
the class TEObjectTest method testWrongParseSERO.
@Test(expected = IllegalArgumentException.class)
public void testWrongParseSERO() throws RSVPParsingException {
final SEROBasicProtectionSubobjectParser parser = new SEROBasicProtectionSubobjectParser();
parser.parseSubobject(null, false);
}
use of org.opendaylight.protocol.rsvp.parser.impl.subobject.ero.SEROBasicProtectionSubobjectParser in project bgpcep by opendaylight.
the class TEObjectTest method testSERODynamicProtectionSubobjectParser.
@Test
public void testSERODynamicProtectionSubobjectParser() throws RSVPParsingException {
final SEROBasicProtectionSubobjectParser parser = new SEROBasicProtectionSubobjectParser();
final SERODynamicProtectionSubobjectParser dynamicParser = new SERODynamicProtectionSubobjectParser();
final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.explicit.route.subobjects.list.SubobjectContainer sub = parser.parseSubobject(Unpooled.copiedBuffer(ByteArray.subByte(TEObjectUtil.TE_LSP_DYNAMIC_SERO_PROTECTION, 2, TEObjectUtil.TE_LSP_DYNAMIC_SERO_PROTECTION.length - 2)), true);
final ByteBuf output = Unpooled.buffer();
dynamicParser.serializeSubobject(sub, output);
assertArrayEquals(TEObjectUtil.TE_LSP_DYNAMIC_SERO_PROTECTION, ByteArray.getAllBytes(output));
}
use of org.opendaylight.protocol.rsvp.parser.impl.subobject.ero.SEROBasicProtectionSubobjectParser in project bgpcep by opendaylight.
the class RSVPActivator method registerEROParsers.
private static void registerEROParsers(final List<AutoCloseable> regs, final RSVPExtensionProviderContext context, final LabelRegistry labelReg) {
final EROIpv4PrefixSubobjectParser ipv4prefixParser = new EROIpv4PrefixSubobjectParser();
regs.add(context.registerEROSubobjectParser(EROIpv4PrefixSubobjectParser.TYPE, ipv4prefixParser));
regs.add(context.registerEROSubobjectSerializer(IpPrefixCase.class, ipv4prefixParser));
regs.add(context.registerEROSubobjectParser(EROIpv6PrefixSubobjectParser.TYPE, new EROIpv6PrefixSubobjectParser()));
final EROAsNumberSubobjectParser asNumberParser = new EROAsNumberSubobjectParser();
regs.add(context.registerEROSubobjectParser(EROAsNumberSubobjectParser.TYPE, asNumberParser));
regs.add(context.registerEROSubobjectSerializer(AsNumberCase.class, asNumberParser));
final EROUnnumberedInterfaceSubobjectParser unnumberedParser = new EROUnnumberedInterfaceSubobjectParser();
regs.add(context.registerEROSubobjectParser(EROUnnumberedInterfaceSubobjectParser.TYPE, unnumberedParser));
regs.add(context.registerEROSubobjectSerializer(UnnumberedCase.class, unnumberedParser));
final EROPathKey32SubobjectParser pathKeyParser = new EROPathKey32SubobjectParser();
regs.add(context.registerEROSubobjectParser(EROPathKey32SubobjectParser.TYPE, pathKeyParser));
regs.add(context.registerEROSubobjectParser(EROPathKey128SubobjectParser.TYPE, new EROPathKey128SubobjectParser()));
regs.add(context.registerEROSubobjectSerializer(PathKeyCase.class, pathKeyParser));
final EROLabelSubobjectParser labelParser = new EROLabelSubobjectParser(labelReg);
regs.add(context.registerEROSubobjectParser(EROLabelSubobjectParser.TYPE, labelParser));
regs.add(context.registerEROSubobjectSerializer(LabelCase.class, labelParser));
final SERODynamicProtectionSubobjectParser seroDynamicParser = new SERODynamicProtectionSubobjectParser();
final SEROBasicProtectionSubobjectParser seroBasicParser = new SEROBasicProtectionSubobjectParser();
regs.add(context.registerEROSubobjectParser(SERODynamicProtectionSubobjectParser.TYPE, seroBasicParser));
regs.add(context.registerEROSubobjectSerializer(DynamicControlProtectionCase.class, seroDynamicParser));
regs.add(context.registerEROSubobjectSerializer(BasicProtectionCase.class, seroBasicParser));
}
Aggregations