Search in sources :

Example 1 with SrBindingSidLabels

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.prefix.state.SrBindingSidLabels in project bgpcep by opendaylight.

the class PrefixAttributesParser method serializeSrBindingLabel.

private static void serializeSrBindingLabel(final List<SrBindingSidLabels> srBindingSidLabels, final ByteBuf byteAggregator) {
    if (srBindingSidLabels != null) {
        for (final SrBindingSidLabels bindingSid : srBindingSidLabels) {
            final ByteBuf sidBuffer = Unpooled.buffer();
            BindingSidLabelParser.serializeBindingSidAttributes(bindingSid.getWeight(), bindingSid.getFlags(), bindingSid.getBindingSubTlvs(), sidBuffer);
            TlvUtil.writeTLV(PrefixAttributesParser.BINDING_SID, sidBuffer, byteAggregator);
        }
    }
}
Also used : SrBindingSidLabels(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.prefix.state.SrBindingSidLabels) ByteBuf(io.netty.buffer.ByteBuf)

Example 2 with SrBindingSidLabels

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.prefix.state.SrBindingSidLabels in project bgpcep by opendaylight.

the class BindingSidLabelParser method parseBindingSidLabel.

public static SrBindingSidLabels parseBindingSidLabel(final ByteBuf buffer, final ProtocolId protocolId) {
    final SrBindingSidLabelsBuilder bindingSid = new SrBindingSidLabelsBuilder();
    bindingSid.setWeight(new Weight(readUint8(buffer)));
    final BitArray flags = BitArray.valueOf(buffer, FLAGS_SIZE);
    bindingSid.setFlags(parseBindingSidFlags(flags, protocolId));
    buffer.skipBytes(RESERVED_BINDING_SID);
    bindingSid.setBindingSubTlvs(SimpleBindingSubTlvsRegistry.getInstance().parseBindingSubTlvs(buffer, protocolId));
    return bindingSid.build();
}
Also used : SrBindingSidLabelsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.prefix.state.SrBindingSidLabelsBuilder) BitArray(org.opendaylight.protocol.util.BitArray) Weight(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.Weight)

Example 3 with SrBindingSidLabels

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.prefix.state.SrBindingSidLabels in project bgpcep by opendaylight.

the class PrefixAttributesParser method parseBindingSid.

private static void parseBindingSid(final PrefixAttributesBuilder builder, final ByteBuf value, final ProtocolId protocolId) {
    final List<SrBindingSidLabels> labels;
    if (builder.getSrBindingSidLabels() != null) {
        labels = builder.getSrBindingSidLabels();
    } else {
        labels = new ArrayList<>();
        builder.setSrBindingSidLabels(labels);
    }
    final SrBindingSidLabels label = BindingSidLabelParser.parseBindingSidLabel(value, protocolId);
    labels.add(label);
    LOG.debug("Parsed SR Binding SID {}", label);
}
Also used : SrBindingSidLabels(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.prefix.state.SrBindingSidLabels)

Aggregations

SrBindingSidLabels (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.prefix.state.SrBindingSidLabels)2 ByteBuf (io.netty.buffer.ByteBuf)1 BitArray (org.opendaylight.protocol.util.BitArray)1 SrBindingSidLabelsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.prefix.state.SrBindingSidLabelsBuilder)1 Weight (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.Weight)1