Search in sources :

Example 6 with SubTlvs

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev151014.range.tlv.SubTlvs 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 PrefixSidTlvCase prefixSidTlv = (PrefixSidTlvCase) rangeSubTlv;
            SrPrefixAttributesParser.serializePrefixAttributes(prefixSidTlv.getFlags(), prefixSidTlv.getAlgorithm(), prefixSidTlv.getSidLabelIndex(), buffer);
            TlvUtil.writeTLV(PREFIX_SID, buffer, aggregator);
        } else if (rangeSubTlv instanceof Ipv6PrefixSidTlvCase) {
            final Ipv6PrefixSidTlvCase prefixSidTlv = (Ipv6PrefixSidTlvCase) rangeSubTlv;
            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 : RangeSubTlv(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev151014.range.sub.tlvs.RangeSubTlv) SidLabelTlvCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev151014.range.sub.tlvs.range.sub.tlv.SidLabelTlvCase) Ipv6PrefixSidTlvCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev151014.range.sub.tlvs.range.sub.tlv.Ipv6PrefixSidTlvCase) BindingSidTlvCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev151014.range.sub.tlvs.range.sub.tlv.BindingSidTlvCase) SubTlvs(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev151014.range.tlv.SubTlvs) ByteBuf(io.netty.buffer.ByteBuf) Ipv6PrefixSidTlvCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev151014.range.sub.tlvs.range.sub.tlv.Ipv6PrefixSidTlvCase) PrefixSidTlvCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev151014.range.sub.tlvs.range.sub.tlv.PrefixSidTlvCase)

Aggregations

ArrayList (java.util.ArrayList)5 ByteBuf (io.netty.buffer.ByteBuf)4 BindingSubTlvs (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev151014.binding.sid.tlv.BindingSubTlvs)4 SubTlvs (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev151014.range.tlv.SubTlvs)4 BindingSubTlvsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev151014.binding.sid.tlv.BindingSubTlvsBuilder)3 BindingSidTlvCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev151014.range.sub.tlvs.range.sub.tlv.BindingSidTlvCaseBuilder)3 SubTlvsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev151014.range.tlv.SubTlvsBuilder)3 Test (org.junit.Test)2 SrRange (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.prefix.state.SrRange)2 SrRangeBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.prefix.state.SrRangeBuilder)2 Weight (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev151014.Weight)2 RangeSubTlv (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev151014.range.sub.tlvs.RangeSubTlv)2 PrefixSidTlvCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev151014.range.sub.tlvs.range.sub.tlv.PrefixSidTlvCaseBuilder)2 SidLabelTlvCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev151014.range.sub.tlvs.range.sub.tlv.SidLabelTlvCaseBuilder)2 BindingSubTlvsParser (org.opendaylight.protocol.bgp.linkstate.spi.BindingSubTlvsParser)1 Ipv6Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address)1 Ipv6EroBackupCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev151014.binding.sub.tlvs.binding.sub.tlv.Ipv6EroBackupCaseBuilder)1 Ipv6EroCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev151014.binding.sub.tlvs.binding.sub.tlv.Ipv6EroCaseBuilder)1 PrefixSidCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev151014.binding.sub.tlvs.binding.sub.tlv.PrefixSidCaseBuilder)1 BindingSidTlvCase (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev151014.range.sub.tlvs.range.sub.tlv.BindingSidTlvCase)1