use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.OfId in project bgpcep by opendaylight.
the class PCEPObjectiveFunctionObjectParser method parseObject.
@Override
public Of parseObject(final ObjectHeader header, final ByteBuf bytes) throws PCEPDeserializerException {
checkArgument(bytes != null && bytes.isReadable(), "Array of bytes is mandatory. Can't be null or empty.");
final Uint16 ofId = ByteBufUtils.readUint16(bytes);
bytes.skipBytes(RESERVED);
final TlvsBuilder tlvsBuilder = new TlvsBuilder();
parseTlvs(tlvsBuilder, bytes.slice());
return new OfBuilder().setIgnore(header.getIgnore()).setProcessingRule(header.getProcessingRule()).setCode(new OfId(ofId)).setTlvs(tlvsBuilder.build()).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.OfId in project bgpcep by opendaylight.
the class OFListTlvParser method serializeTlv.
@Override
public void serializeTlv(final Tlv tlv, final ByteBuf buffer) {
checkArgument(tlv instanceof OfList, "OFListTlv is mandatory.");
final OfList oft = (OfList) tlv;
final ByteBuf body = Unpooled.buffer();
final List<OfId> ofCodes = oft.getCodes();
for (OfId id : ofCodes) {
ByteBufUtils.write(body, id.getValue());
}
TlvUtil.formatTlv(TYPE, body, buffer);
}
Aggregations