Search in sources :

Example 1 with L3vpnMcastDestinationBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.l3vpn.mcast.rev180417.l3vpn.mcast.destination.L3vpnMcastDestinationBuilder in project bgpcep by opendaylight.

the class L3vpnMcastNlriSerializer method extractDest.

static List<L3vpnMcastDestination> extractDest(final ByteBuf nlri, final boolean addPath) {
    List<L3vpnMcastDestination> dests = new ArrayList<>();
    while (nlri.isReadable()) {
        final L3vpnMcastDestinationBuilder builder = new L3vpnMcastDestinationBuilder();
        if (addPath) {
            builder.setPathId(PathIdUtil.readPathId(nlri));
        }
        final int length = nlri.readUnsignedByte();
        final int initialLength = nlri.readableBytes();
        builder.setRouteDistinguisher(RouteDistinguisherUtil.parseRouteDistinguisher(nlri));
        if (length == Ipv6Util.IPV6_BITS_LENGTH) {
            builder.setPrefix(new IpPrefix(Ipv6Util.prefixForByteBuf(nlri)));
        } else {
            builder.setPrefix(new IpPrefix(Ipv4Util.prefixForByteBuf(nlri)));
        }
        dests.add(builder.build());
        int readed = initialLength - nlri.readableBytes();
        while (readed % 8 != 0) {
            nlri.readByte();
            readed = initialLength - nlri.readableBytes();
        }
    }
    return dests;
}
Also used : IpPrefix(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix) L3vpnMcastDestination(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.l3vpn.mcast.rev180417.l3vpn.mcast.destination.L3vpnMcastDestination) ArrayList(java.util.ArrayList) L3vpnMcastDestinationBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.l3vpn.mcast.rev180417.l3vpn.mcast.destination.L3vpnMcastDestinationBuilder)

Aggregations

ArrayList (java.util.ArrayList)1 IpPrefix (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix)1 L3vpnMcastDestination (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.l3vpn.mcast.rev180417.l3vpn.mcast.destination.L3vpnMcastDestination)1 L3vpnMcastDestinationBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.l3vpn.mcast.rev180417.l3vpn.mcast.destination.L3vpnMcastDestinationBuilder)1