use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.subobject.type.PathKeyCase in project bgpcep by opendaylight.
the class RROPathKey128SubobjectParser method serializeSubobject.
public static void serializeSubobject(final Subobject subobject, final ByteBuf buffer) {
final PathKeyCase pkcase = (PathKeyCase) subobject.getSubobjectType();
final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.subobject.type.path.key._case.PathKey pk = pkcase.getPathKey();
final ByteBuf body = Unpooled.buffer();
Preconditions.checkArgument(pk.getPathKey() != null, "PathKey is mandatory.");
writeUnsignedShort(pk.getPathKey().getValue(), body);
Preconditions.checkArgument(pk.getPceId() != null, "PceId is mandatory.");
body.writeBytes(pk.getPceId().getBinary());
RROSubobjectUtil.formatSubobject(TYPE, body, buffer);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.subobject.type.PathKeyCase in project bgpcep by opendaylight.
the class XROPathKey32SubobjectParser method serializeSubobject.
@Override
public void serializeSubobject(final Subobject subobject, final ByteBuf buffer) {
Preconditions.checkArgument(subobject.getSubobjectType() instanceof PathKeyCase, "Unknown subobject instance. Passed %s. Needed PathKey.", subobject.getSubobjectType().getClass());
final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.explicit.route.subobjects.subobject.type.path.key._case.PathKey pk = ((PathKeyCase) subobject.getSubobjectType()).getPathKey();
final ByteBuf body = Unpooled.buffer();
Preconditions.checkArgument(pk.getPceId() != null, "PceId is mandatory.");
if (pk.getPceId().getBinary().length == XROPathKey128SubobjectParser.PCE128_ID_F_LENGTH) {
XROPathKey128SubobjectParser.serializeSubobject(subobject, buffer);
}
Preconditions.checkArgument(pk.getPathKey() != null, "PathKey is mandatory.");
writeUnsignedShort(pk.getPathKey().getValue(), body);
Preconditions.checkArgument(pk.getPceId().getBinary().length == PCE_ID_F_LENGTH, "PceId 32 Bit required.");
body.writeBytes(pk.getPceId().getBinary());
XROSubobjectUtil.formatSubobject(TYPE, subobject.isMandatory(), body, buffer);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.subobject.type.PathKeyCase 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();
final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.subobject.type.path.key._case.PathKey pk = pkcase.getPathKey();
final ByteBuf body = Unpooled.buffer();
Preconditions.checkArgument(pk.getPathKey() != null, "PathKey is mandatory.");
writeUnsignedShort(pk.getPathKey().getValue(), body);
Preconditions.checkArgument(pk.getPceId() != null, "PceId is mandatory.");
body.writeBytes(pk.getPceId().getBinary());
RROSubobjectUtil.formatSubobject(TYPE, body, buffer);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.subobject.type.PathKeyCase in project bgpcep by opendaylight.
the class RROPathKey32SubobjectParser method serializeSubobject.
@Override
public void serializeSubobject(final SubobjectContainer subobject, final ByteBuf buffer) {
Preconditions.checkArgument(subobject.getSubobjectType() instanceof PathKeyCase, "Unknown subobject instance.Passed %s. Needed PathKey.", subobject.getSubobjectType().getClass());
final PathKeyCase pkcase = (PathKeyCase) subobject.getSubobjectType();
final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.subobject.type.path.key._case.PathKey pk = pkcase.getPathKey();
final ByteBuf body = Unpooled.buffer();
Preconditions.checkArgument(pk.getPceId() != null, "PceId is mandatory.");
if (pk.getPceId().getBinary().length == RROPathKey128SubobjectParser.PCE128_ID_F_LENGTH) {
RROPathKey128SubobjectParser.serializeSubobject(subobject, buffer);
}
Preconditions.checkArgument(pk.getPathKey() != null, "PathKey is mandatory.");
Preconditions.checkArgument(pk.getPceId().getBinary().length == PCE_ID_F_LENGTH, "PathKey 32Bit is mandatory.");
writeUnsignedShort(pk.getPathKey().getValue(), body);
body.writeBytes(pk.getPceId().getBinary());
RROSubobjectUtil.formatSubobject(TYPE, body, buffer);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.subobject.type.PathKeyCase in project bgpcep by opendaylight.
the class EROPathKey32SubobjectParser method serializeSubobject.
@Override
public void serializeSubobject(final SubobjectContainer subobject, final ByteBuf buffer) {
Preconditions.checkArgument(subobject.getSubobjectType() instanceof PathKeyCase, "Unknown subobject instance.Passed %s. Needed PathKey.", subobject.getSubobjectType().getClass());
final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.explicit.route.subobjects.subobject.type.path.key._case.PathKey pk = ((PathKeyCase) subobject.getSubobjectType()).getPathKey();
final ByteBuf body = serializePathKey(pk);
if (pk.getPceId().getBinary().length == PCE_ID_F_LENGTH) {
EROSubobjectUtil.formatSubobject(TYPE, subobject.isLoose(), body, buffer);
} else if (pk.getPceId().getBinary().length == EROPathKey128SubobjectParser.PCE128_ID_F_LENGTH) {
EROSubobjectUtil.formatSubobject(EROPathKey128SubobjectParser.TYPE, subobject.isLoose(), body, buffer);
}
}
Aggregations