use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.gc.object.Gc in project bgpcep by opendaylight.
the class PCEPGlobalConstraintsObjectParser method parseObject.
@Override
public Gc parseObject(final ObjectHeader header, final ByteBuf bytes) throws PCEPDeserializerException {
Preconditions.checkArgument(bytes != null && bytes.isReadable(), "Array of bytes is mandatory. Can't be null or empty.");
final GcBuilder builder = new GcBuilder();
builder.setIgnore(header.isIgnore());
builder.setProcessingRule(header.isProcessingRule());
builder.setMaxHop(bytes.readUnsignedByte());
builder.setMaxUtilization(bytes.readUnsignedByte());
builder.setMinUtilization(bytes.readUnsignedByte());
builder.setOverBookingFactor(bytes.readUnsignedByte());
final TlvsBuilder tlvsBuilder = new TlvsBuilder();
parseTlvs(tlvsBuilder, bytes.slice());
builder.setTlvs(tlvsBuilder.build());
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.gc.object.Gc in project bgpcep by opendaylight.
the class PCEPGlobalConstraintsObjectParser method serializeObject.
@Override
public void serializeObject(final Object object, final ByteBuf buffer) {
Preconditions.checkArgument(object instanceof Gc, "Wrong instance of PCEPObject. Passed %s. Needed GcObject.", object.getClass());
final Gc specObj = (Gc) object;
final ByteBuf body = Unpooled.buffer();
writeUnsignedByte(specObj.getMaxHop(), body);
writeUnsignedByte(specObj.getMaxUtilization(), body);
writeUnsignedByte(specObj.getMinUtilization(), body);
writeUnsignedByte(specObj.getOverBookingFactor(), body);
serializeTlvs(specObj.getTlvs(), body);
ObjectUtil.formatSubobject(TYPE, CLASS, object.isProcessingRule(), object.isIgnore(), body, buffer);
}
Aggregations