use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.protection.subobject.ProtectionSubobject in project bgpcep by opendaylight.
the class DynamicProtectionObjectParser method localParseObject.
@Override
protected RsvpTeObject localParseObject(final ByteBuf byteBuf) throws RSVPParsingException {
final DynamicControlProtectionObjectBuilder builder = new DynamicControlProtectionObjectBuilder();
final ProtectionSubobject pSub = ProtectionCommonParser.parseCommonProtectionBodyType2(byteBuf);
return builder.setProtectionSubobject(pSub).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.protection.subobject.ProtectionSubobject in project bgpcep by opendaylight.
the class SRROBasicProtectionSubobjectParser method parseSubobject.
@Override
public SubobjectContainer parseSubobject(final ByteBuf buffer) throws RSVPParsingException {
Preconditions.checkArgument(buffer != null && buffer.isReadable(), "Array of bytes is mandatory. Can't be null or empty.");
final SubobjectContainerBuilder builder = new SubobjectContainerBuilder();
// skip reserved
buffer.readByte();
final short cType = buffer.readUnsignedByte();
final ProtectionSubobject prot = parseCommonProtectionBody(cType, buffer);
if (cType == CTYPE) {
builder.setSubobjectType(new BasicProtectionCaseBuilder().setBasicProtection(new BasicProtectionBuilder().setProtectionSubobject(prot).build()).build());
} else if (cType == SRRODynamicProtectionSubobjectParser.CTYPE) {
builder.setSubobjectType(new DynamicControlProtectionCaseBuilder().setDynamicControlProtection(new DynamicControlProtectionBuilder().setProtectionSubobject(prot).build()).build());
}
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.protection.subobject.ProtectionSubobject in project bgpcep by opendaylight.
the class SRROBasicProtectionSubobjectParser method serializeSubobject.
@Override
public void serializeSubobject(final SubobjectContainer subobject, final ByteBuf buffer) {
Preconditions.checkArgument(subobject.getSubobjectType() instanceof BasicProtectionCase, "Unknown subobject instance. Passed %s. Needed UnnumberedCase.", subobject.getSubobjectType().getClass());
final ProtectionSubobject protObj = ((BasicProtectionCase) subobject.getSubobjectType()).getBasicProtection().getProtectionSubobject();
final ByteBuf body = Unpooled.buffer();
serializeBody(CTYPE, protObj, body);
RROSubobjectUtil.formatSubobject(TYPE, body, buffer);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.protection.subobject.ProtectionSubobject 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);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.protection.subobject.ProtectionSubobject 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.isLoose(), body, buffer);
}
Aggregations