Search in sources :

Example 96 with Tlv

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev200120.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);
}
Also used : VendorInformationTlv(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.vendor.information.tlvs.VendorInformationTlv) ByteBuf(io.netty.buffer.ByteBuf)

Example 97 with Tlv

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev200120.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);
}
Also used : NoPathVector(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pcrep.message.pcrep.message.replies.result.failure._case.no.path.tlvs.NoPathVector) BitArray(org.opendaylight.protocol.util.BitArray) Flags(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.NoPathVectorTlv.Flags) ByteBuf(io.netty.buffer.ByteBuf)

Example 98 with Tlv

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev200120.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);
}
Also used : Order(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.order.tlv.Order) ByteBuf(io.netty.buffer.ByteBuf)

Example 99 with Tlv

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev200120.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);
}
Also used : PathSetupType(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.path.setup.type.tlv.PathSetupType) ByteBuf(io.netty.buffer.ByteBuf)

Example 100 with Tlv

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev200120.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);
}
Also used : OfList(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.of.list.tlv.OfList) OfId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.OfId) ByteBuf(io.netty.buffer.ByteBuf)

Aggregations

ByteBuf (io.netty.buffer.ByteBuf)59 Test (org.junit.Test)28 Tlv (es.gob.jmulticard.asn1.Tlv)11 ArrayList (java.util.ArrayList)10 TunnelId (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.TunnelId)8 LspId (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.LspId)7 TlvException (es.gob.jmulticard.asn1.TlvException)6 Stateful (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.stateful.capability.tlv.Stateful)5 Ipv4ExtendedTunnelId (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.Ipv4ExtendedTunnelId)5 Asn1Exception (es.gob.jmulticard.asn1.Asn1Exception)4 DecoderObject (es.gob.jmulticard.asn1.DecoderObject)4 BitArray (org.opendaylight.protocol.util.BitArray)4 Ipv6ExtendedTunnelId (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.Ipv6ExtendedTunnelId)4 ObjectHeaderImpl (org.opendaylight.protocol.pcep.spi.ObjectHeaderImpl)3 EnterpriseNumber (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.iana.rev130816.EnterpriseNumber)3 Stateful (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.stateful.capability.tlv.Stateful)3 LspIdentifiers (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.identifiers.tlv.LspIdentifiers)3 LspIdentifiersBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.identifiers.tlv.LspIdentifiersBuilder)3 AddressFamily (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.identifiers.tlv.lsp.identifiers.AddressFamily)3 RsvpErrorSpec (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.rsvp.error.spec.tlv.RsvpErrorSpec)3