use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820._record.route.subobjects.list.SubobjectContainer 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));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820._record.route.subobjects.list.SubobjectContainer 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));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820._record.route.subobjects.list.SubobjectContainer in project bgpcep by opendaylight.
the class RROIpv6PrefixSubobjectParser method serializeSubobject.
@Override
public void serializeSubobject(final SubobjectContainer subobject, final ByteBuf buffer) {
checkArgument(subobject.getSubobjectType() instanceof IpPrefixCase, "Unknown subobject instance. Passed %s. Needed IpPrefixCase.", subobject.getSubobjectType().getClass());
final IpPrefixSubobject specObj = ((IpPrefixCase) subobject.getSubobjectType()).getIpPrefix();
final Ipv6Prefix ipv6Prefix = specObj.getIpPrefix().getIpv6Prefix();
checkArgument(ipv6Prefix != null, "Ipv6Prefix is mandatory.");
serializeSubobject(buffer, subobject, ipv6Prefix);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820._record.route.subobjects.list.SubobjectContainer in project bgpcep by opendaylight.
the class RROPathKey128SubobjectParser method serializeSubobject.
public static void serializeSubobject(final SubobjectContainer subobject, final ByteBuf buffer) {
final PathKeyCase pkcase = (PathKeyCase) subobject.getSubobjectType();
RROSubobjectUtil.formatSubobject(TYPE, PathKeyUtils.serializePathKey(pkcase.getPathKey()), buffer);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820._record.route.subobjects.list.SubobjectContainer in project bgpcep by opendaylight.
the class XROAsNumberSubobjectParser method serializeSubobject.
@Override
public void serializeSubobject(final SubobjectContainer subobject, final ByteBuf buffer) {
Preconditions.checkArgument(subobject.getSubobjectType() instanceof AsNumberCase, "Unknown subobject instance. Passed %s. Needed AsNumberCase.", subobject.getSubobjectType().getClass());
final ByteBuf body = AsNumberCaseParser.serializeSubobject((AsNumberCase) subobject.getSubobjectType());
XROSubobjectUtil.formatSubobject(TYPE, subobject.getMandatory(), body, buffer);
}
Aggregations