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();
final PathKey pathKey = pk.getPathKey();
checkArgument(pathKey != null, "PathKey is mandatory.");
ByteBufUtils.write(body, pathKey.getValue());
final PceId pceId = pk.getPceId();
checkArgument(pceId != null, "PceId is mandatory.");
body.writeBytes(pceId.getValue());
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) {
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();
checkArgument(pk.getPceId() != null, "PceId is mandatory.");
final byte[] pceId = pk.getPceId().getValue();
if (pceId.length == XROPathKey128SubobjectParser.PCE128_ID_F_LENGTH) {
XROPathKey128SubobjectParser.serializeSubobject(subobject, buffer);
}
final PathKey pathKey = pk.getPathKey();
checkArgument(pathKey != null, "PathKey is mandatory.");
ByteBufUtils.write(body, pathKey.getValue());
checkArgument(pceId.length == PCE_ID_F_LENGTH, "PceId 32 Bit required.");
body.writeBytes(pceId);
XROSubobjectUtil.formatSubobject(TYPE, subobject.getMandatory(), 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();
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.subobject.type.PathKeyCase in project bgpcep by opendaylight.
the class EROPathKey32SubobjectParser method serializeSubobject.
@Override
public void serializeSubobject(final SubobjectContainer subobject, final ByteBuf buffer) {
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().getValue().length == PCE_ID_F_LENGTH) {
EROSubobjectUtil.formatSubobject(TYPE, subobject.getLoose(), body, buffer);
} else if (pk.getPceId().getValue().length == EROPathKey128SubobjectParser.PCE128_ID_F_LENGTH) {
EROSubobjectUtil.formatSubobject(EROPathKey128SubobjectParser.TYPE, subobject.getLoose(), 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) {
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();
checkArgument(pk.getPceId() != null, "PceId is mandatory.");
final byte[] pceId = pk.getPceId().getValue();
if (pceId.length == RROPathKey128SubobjectParser.PCE128_ID_F_LENGTH) {
RROPathKey128SubobjectParser.serializeSubobject(subobject, buffer);
}
final PathKey pathKey = pk.getPathKey();
checkArgument(pathKey != null, "PathKey is mandatory.");
checkArgument(pceId.length == PCE_ID_F_LENGTH, "PathKey 32Bit is mandatory.");
ByteBufUtils.write(body, pathKey.getValue());
body.writeBytes(pceId);
RROSubobjectUtil.formatSubobject(TYPE, body, buffer);
}
Aggregations