2 * Copyright (c) 2016 Brocade Communications Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.protocol.bgp.l3vpn.unicast.ipv6;
10 import java.util.List;
11 import org.opendaylight.protocol.bgp.l3vpn.unicast.AbstractVpnNlriParser;
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.destination.DestinationType;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.update.attributes.mp.reach.nlri.AdvertizedRoutes;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.update.attributes.mp.reach.nlri.AdvertizedRoutesBuilder;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.update.attributes.mp.unreach.nlri.WithdrawnRoutes;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.update.attributes.mp.unreach.nlri.WithdrawnRoutesBuilder;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.vpn.ipv6.rev180329.L3vpnIpv6Destination;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.vpn.ipv6.rev180329.l3vpn.ipv6.destination.VpnIpv6DestinationBuilder;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.vpn.rev180329.l3vpn.ip.destination.type.VpnDestination;
21 public class VpnIpv6NlriParser extends AbstractVpnNlriParser {
23 private static <T extends L3vpnIpv6Destination> List<VpnDestination> getVpnDestination(final DestinationType dst,
24 final Class<T> dstTypeCaseClazz) {
25 return dstTypeCaseClazz.isInstance(dst) ? dstTypeCaseClazz.cast(dst).getVpnIpv6Destination().getVpnDestination()
30 protected List<VpnDestination> getWithdrawnVpnDestination(final DestinationType dstType) {
31 return getVpnDestination(dstType,
32 org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.vpn.ipv6.rev180329.update.attributes
33 .mp.unreach.nlri.withdrawn.routes.destination.type.DestinationVpnIpv6Case.class);
37 protected List<VpnDestination> getAdvertizedVpnDestination(final DestinationType dstType) {
38 return getVpnDestination(
40 org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.vpn.ipv6.rev180329.update.attributes
41 .mp.reach.nlri.advertized.routes.destination.type.DestinationVpnIpv6Case.class);
45 protected WithdrawnRoutes getWithdrawnRoutesByDestination(final List<VpnDestination> dst) {
46 return new WithdrawnRoutesBuilder().setDestinationType(
47 new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.vpn.ipv6.rev180329.update
48 .attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationVpnIpv6CaseBuilder()
49 .setVpnIpv6Destination(new VpnIpv6DestinationBuilder()
50 .setVpnDestination(dst).build()).build()).build();
54 protected AdvertizedRoutes getAdvertizedRoutesByDestination(final List<VpnDestination> dst) {
55 return new AdvertizedRoutesBuilder().setDestinationType(
56 new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.vpn.ipv6.rev180329.update
57 .attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationVpnIpv6CaseBuilder()
58 .setVpnIpv6Destination(new VpnIpv6DestinationBuilder()
59 .setVpnDestination(dst).build()).build()).build();