use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Tlv in project bgpcep by opendaylight.
the class AbstractVendorInformationTlvParser method serializeTlv.
@Override
public final void serializeTlv(final Tlv tlv, final ByteBuf buffer) {
checkArgument(tlv instanceof VendorInformationTlv, "Vendor Specific Tlv is mandatory.");
final VendorInformationTlv viTlv = (VendorInformationTlv) tlv;
final ByteBuf body = Unpooled.buffer();
ByteBufUtils.write(body, getEnterpriseNumber().getValue());
serializeEnterpriseSpecificInformation(viTlv.getEnterpriseSpecificInformation(), body);
TlvUtil.formatTlv(VENDOR_INFORMATION_TLV_TYPE, body, buffer);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Tlv in project bgpcep by opendaylight.
the class NoPathVectorTlvParser method serializeTlv.
@Override
public void serializeTlv(final Tlv tlv, final ByteBuf buffer) {
Preconditions.checkArgument(tlv instanceof NoPathVector, "NoPathVectorTlv is mandatory.");
final NoPathVector noPath = (NoPathVector) tlv;
final ByteBuf body = Unpooled.buffer();
final BitArray flags = new BitArray(FLAGS_SIZE);
final Flags f = noPath.getFlags();
flags.set(REACHABLITY_PROBLEM, f.getP2mpUnreachable());
flags.set(NO_GCO_SOLUTION, f.getNoGcoSolution());
flags.set(NO_GCO_MIGRATION_PATH, f.getNoGcoMigration());
flags.set(PATH_KEY, f.getPathKey());
flags.set(CHAIN_UNAVAILABLE, f.getChainUnavailable());
flags.set(UNKNOWN_SRC, f.getUnknownSource());
flags.set(UNKNOWN_DEST, f.getUnknownDestination());
flags.set(PCE_UNAVAILABLE, f.getPceUnavailable());
flags.toByteBuf(body);
TlvUtil.formatTlv(TYPE, body, buffer);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Tlv in project bgpcep by opendaylight.
the class OrderTlvParser method serializeTlv.
@Override
public void serializeTlv(final Tlv tlv, final ByteBuf buffer) {
checkArgument(tlv instanceof Order, "OrderTlv is mandatory.");
final Order otlv = (Order) tlv;
final ByteBuf body = Unpooled.buffer();
ByteBufUtils.writeOrZero(body, otlv.getDelete());
ByteBufUtils.writeOrZero(body, otlv.getSetup());
TlvUtil.formatTlv(TYPE, body, buffer);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Tlv in project bgpcep by opendaylight.
the class PathSetupTypeTlvParser method serializeTlv.
@Override
public void serializeTlv(final Tlv tlv, final ByteBuf buffer) {
checkArgument(tlv instanceof PathSetupType, "PathSetupType is mandatory.");
final PathSetupType pstTlv = (PathSetupType) tlv;
checkArgument(checkPST(pstTlv.getPst()), UNSUPPORTED_PST);
final ByteBuf body = Unpooled.buffer(CONTENT_LENGTH);
body.writeZero(OFFSET);
ByteBufUtils.writeOrZero(body, pstTlv.getPst());
TlvUtil.formatTlv(TYPE, body, buffer);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Tlv 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