use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.Tlv in project bgpcep by opendaylight.
the class OFListTlvParser method serializeTlv.
@Override
public void serializeTlv(final Tlv tlv, final ByteBuf buffer) {
Preconditions.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) {
writeUnsignedShort(id.getValue(), body);
}
TlvUtil.formatTlv(TYPE, body, buffer);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.Tlv in project bgpcep by opendaylight.
the class OrderTlvParser method serializeTlv.
@Override
public void serializeTlv(final Tlv tlv, final ByteBuf buffer) {
Preconditions.checkArgument(tlv instanceof Order, "OrderTlv is mandatory.");
final Order otlv = (Order) tlv;
final ByteBuf body = Unpooled.buffer();
writeUnsignedInt(otlv.getDelete(), body);
writeUnsignedInt(otlv.getSetup(), body);
TlvUtil.formatTlv(TYPE, body, buffer);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.Tlv in project bgpcep by opendaylight.
the class PathSetupTypeTlvParser method serializeTlv.
@Override
public void serializeTlv(final Tlv tlv, final ByteBuf buffer) {
Preconditions.checkArgument(tlv instanceof PathSetupType, "PathSetupType is mandatory.");
final PathSetupType pstTlv = (PathSetupType) tlv;
Preconditions.checkArgument(checkPST(pstTlv.getPst()), UNSUPPORTED_PST);
final ByteBuf body = Unpooled.buffer(CONTENT_LENGTH);
body.writeZero(OFFSET);
writeUnsignedByte(pstTlv.getPst(), body);
TlvUtil.formatTlv(TYPE, body, buffer);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.Tlv in project bgpcep by opendaylight.
the class ReqMissingTlvParser method serializeTlv.
@Override
public void serializeTlv(final Tlv tlv, final ByteBuf buffer) {
Preconditions.checkArgument(tlv instanceof ReqMissing, "ReqMissingTlv is mandatory.");
final ReqMissing req = (ReqMissing) tlv;
final ByteBuf body = Unpooled.buffer();
Preconditions.checkArgument(req.getRequestId() != null, "RequestId is mandatory.");
writeUnsignedInt(req.getRequestId().getValue(), body);
TlvUtil.formatTlv(TYPE, body, buffer);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.Tlv in project bgpcep by opendaylight.
the class AigpAttributeParser method serializeAigpTLV.
/**
* Transform AIGP attribute data from instance of Aigp class into byte buffer representation.
*
* @param aigp
* instance of Aigp class
* @return
* byte buffer representation or empty buffer if AIGP TLV is null
*/
private static ByteBuf serializeAigpTLV(final Aigp aigp) {
final AigpTlv tlv = aigp.getAigpTlv();
if (tlv == null) {
return Unpooled.EMPTY_BUFFER;
}
final ByteBuf value = Unpooled.buffer(AIGP_TLV_SIZE);
value.writeByte(AIGP_TLV_TYPE);
value.writeShort(AIGP_TLV_SIZE);
value.writeLong(tlv.getMetric().getValue().longValue());
return value;
}
Aggregations