Search in sources :

Example 1 with DynamicControlProtectionCase

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.secondary._record.route.subobjects.subobject.type.DynamicControlProtectionCase in project bgpcep by opendaylight.

the class SERODynamicProtectionSubobjectParser method serializeSubobject.

@Override
public void serializeSubobject(final SubobjectContainer subobject, final ByteBuf buffer) {
    Preconditions.checkArgument(subobject.getSubobjectType() instanceof DynamicControlProtectionCase, "Unknown subobject instance. Passed %s. Needed UnnumberedCase.", subobject.getSubobjectType());
    final ProtectionSubobject protObj = ((DynamicControlProtectionCase) subobject.getSubobjectType()).getDynamicControlProtection().getProtectionSubobject();
    final ByteBuf body = Unpooled.buffer();
    serializeBody(CTYPE, protObj, body);
    EROSubobjectUtil.formatSubobject(TYPE, subobject.getLoose(), body, buffer);
}
Also used : DynamicControlProtectionCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.secondary.explicit.route.subobjects.subobject.type.DynamicControlProtectionCase) ByteBuf(io.netty.buffer.ByteBuf) ProtectionSubobject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.protection.subobject.ProtectionSubobject)

Example 2 with DynamicControlProtectionCase

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.secondary._record.route.subobjects.subobject.type.DynamicControlProtectionCase in project bgpcep by opendaylight.

the class SRRODynamicProtectionSubobjectParser method serializeSubobject.

@Override
public void serializeSubobject(final SubobjectContainer subobject, final ByteBuf buffer) {
    Preconditions.checkArgument(subobject.getSubobjectType() instanceof DynamicControlProtectionCase, "Unknown subobject instance. Passed %s. Needed UnnumberedCase.", subobject.getSubobjectType());
    final ProtectionSubobject protObj = ((DynamicControlProtectionCase) subobject.getSubobjectType()).getDynamicControlProtection().getProtectionSubobject();
    final ByteBuf body = Unpooled.buffer();
    serializeBody(CTYPE, protObj, body);
    RROSubobjectUtil.formatSubobject(TYPE, body, buffer);
}
Also used : DynamicControlProtectionCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.secondary._record.route.subobjects.subobject.type.DynamicControlProtectionCase) ByteBuf(io.netty.buffer.ByteBuf) ProtectionSubobject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.protection.subobject.ProtectionSubobject)

Example 3 with DynamicControlProtectionCase

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.secondary._record.route.subobjects.subobject.type.DynamicControlProtectionCase in project bgpcep by opendaylight.

the class TEObjectTest method testWrongSerializeSRRO.

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

Aggregations

ByteBuf (io.netty.buffer.ByteBuf)2 ProtectionSubobject (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.protection.subobject.ProtectionSubobject)2 DynamicControlProtectionCase (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.secondary._record.route.subobjects.subobject.type.DynamicControlProtectionCase)2 Test (org.junit.Test)1 SRROBasicProtectionSubobjectParser (org.opendaylight.protocol.rsvp.parser.impl.subobject.rro.SRROBasicProtectionSubobjectParser)1 DynamicControlProtectionCase (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.secondary.explicit.route.subobjects.subobject.type.DynamicControlProtectionCase)1