Search in sources :

Example 1 with PrefixSidTlv

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.range.sub.tlvs.range.sub.tlv.prefix.sid.tlv._case.PrefixSidTlv in project bgpcep by opendaylight.

the class RangeTlvParser method serializeSubTlvs.

private static void serializeSubTlvs(final ByteBuf aggregator, final List<SubTlvs> subTlvs) {
    for (final SubTlvs subTlv : subTlvs) {
        ByteBuf buffer = Unpooled.buffer();
        final RangeSubTlv rangeSubTlv = subTlv.getRangeSubTlv();
        if (rangeSubTlv instanceof PrefixSidTlvCase) {
            final PrefixSidTlv prefixSidTlv = ((PrefixSidTlvCase) rangeSubTlv).getPrefixSidTlv();
            SrPrefixAttributesParser.serializePrefixAttributes(prefixSidTlv.getFlags(), prefixSidTlv.getAlgorithm(), prefixSidTlv.getSidLabelIndex(), buffer);
            TlvUtil.writeTLV(PREFIX_SID, buffer, aggregator);
        } else if (rangeSubTlv instanceof Ipv6PrefixSidTlvCase) {
            final Ipv6PrefixSidTlv prefixSidTlv = ((Ipv6PrefixSidTlvCase) rangeSubTlv).getIpv6PrefixSidTlv();
            Ipv6SrPrefixAttributesParser.serializePrefixAttributes(prefixSidTlv.getAlgorithm(), buffer);
            TlvUtil.writeTLV(IPV6_PREFIX_SID, buffer, aggregator);
        } else if (rangeSubTlv instanceof BindingSidTlvCase) {
            final BindingSidTlvCase rangeTlv = (BindingSidTlvCase) rangeSubTlv;
            BindingSidLabelParser.serializeBindingSidAttributes(rangeTlv.getWeight(), rangeTlv.getFlags(), rangeTlv.getBindingSubTlvs(), buffer);
            TlvUtil.writeTLV(BINDING_SID, buffer, aggregator);
        } else if (rangeSubTlv instanceof SidLabelTlvCase) {
            buffer = SidLabelIndexParser.serializeSidValue(((SidLabelTlvCase) rangeSubTlv).getSidLabelIndex());
            TlvUtil.writeTLV(SID_TYPE, buffer, aggregator);
        }
    }
}
Also used : Ipv6PrefixSidTlv(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.range.sub.tlvs.range.sub.tlv.ipv6.prefix.sid.tlv._case.Ipv6PrefixSidTlv) RangeSubTlv(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.range.sub.tlvs.RangeSubTlv) SidLabelTlvCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.range.sub.tlvs.range.sub.tlv.SidLabelTlvCase) Ipv6PrefixSidTlvCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.range.sub.tlvs.range.sub.tlv.Ipv6PrefixSidTlvCase) BindingSidTlvCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.range.sub.tlvs.range.sub.tlv.BindingSidTlvCase) Ipv6PrefixSidTlv(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.range.sub.tlvs.range.sub.tlv.ipv6.prefix.sid.tlv._case.Ipv6PrefixSidTlv) PrefixSidTlv(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.range.sub.tlvs.range.sub.tlv.prefix.sid.tlv._case.PrefixSidTlv) SubTlvs(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.range.tlv.SubTlvs) ByteBuf(io.netty.buffer.ByteBuf) Ipv6PrefixSidTlvCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.range.sub.tlvs.range.sub.tlv.Ipv6PrefixSidTlvCase) PrefixSidTlvCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.range.sub.tlvs.range.sub.tlv.PrefixSidTlvCase)

Aggregations

ByteBuf (io.netty.buffer.ByteBuf)1 RangeSubTlv (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.range.sub.tlvs.RangeSubTlv)1 BindingSidTlvCase (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.range.sub.tlvs.range.sub.tlv.BindingSidTlvCase)1 Ipv6PrefixSidTlvCase (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.range.sub.tlvs.range.sub.tlv.Ipv6PrefixSidTlvCase)1 PrefixSidTlvCase (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.range.sub.tlvs.range.sub.tlv.PrefixSidTlvCase)1 SidLabelTlvCase (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.range.sub.tlvs.range.sub.tlv.SidLabelTlvCase)1 Ipv6PrefixSidTlv (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.range.sub.tlvs.range.sub.tlv.ipv6.prefix.sid.tlv._case.Ipv6PrefixSidTlv)1 PrefixSidTlv (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.range.sub.tlvs.range.sub.tlv.prefix.sid.tlv._case.PrefixSidTlv)1 SubTlvs (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.range.tlv.SubTlvs)1