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.flowspec.l3vpn.ipv6;
10 import org.opendaylight.protocol.bgp.flowspec.SimpleFlowspecExtensionProviderContext;
11 import org.opendaylight.protocol.bgp.flowspec.l3vpn.AbstractFlowspecL3vpnRIBSupport;
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.bgp.rib.rib.loc.rib.tables.routes.FlowspecL3vpnIpv6RoutesCase;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.bgp.rib.rib.peer.effective.rib.in.tables.routes.FlowspecL3vpnIpv6RoutesCaseBuilder;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.flowspec.l3vpn.destination.ipv6.DestinationFlowspecL3vpnIpv6;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.flowspec.l3vpn.ipv6.route.FlowspecL3vpnRoute;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.flowspec.l3vpn.ipv6.route.FlowspecL3vpnRouteBuilder;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.flowspec.l3vpn.ipv6.route.FlowspecL3vpnRouteKey;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.flowspec.l3vpn.ipv6.routes.FlowspecL3vpnIpv6Routes;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.flowspec.l3vpn.ipv6.routes.FlowspecL3vpnIpv6RoutesBuilder;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.PathId;
21 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.Attributes;
22 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.rib.tables.Routes;
23 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.Ipv6AddressFamily;
25 public final class FlowspecL3vpnIpv6RIBSupport extends AbstractFlowspecL3vpnRIBSupport<FlowspecL3vpnIpv6NlriParser,
26 FlowspecL3vpnRoute, FlowspecL3vpnRouteKey> {
27 private FlowspecL3vpnIpv6RIBSupport(SimpleFlowspecExtensionProviderContext context) {
29 FlowspecL3vpnIpv6RoutesCase.class,
30 FlowspecL3vpnIpv6Routes.class,
31 FlowspecL3vpnRoute.class,
32 DestinationFlowspecL3vpnIpv6.QNAME,
33 Ipv6AddressFamily.class,
34 new FlowspecL3vpnIpv6NlriParser(context
35 .getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV6,
36 SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC_VPN))
40 public static FlowspecL3vpnIpv6RIBSupport getInstance(final SimpleFlowspecExtensionProviderContext context) {
41 return new FlowspecL3vpnIpv6RIBSupport(context);
45 public final FlowspecL3vpnRouteKey createNewRouteKey(final long pathId, final FlowspecL3vpnRouteKey routeKey) {
46 return new FlowspecL3vpnRouteKey(new PathId(pathId), routeKey.getRouteKey());
50 public FlowspecL3vpnRoute createRoute(final FlowspecL3vpnRoute route, final FlowspecL3vpnRouteKey routeKey,
51 final long pathId, final Attributes attributes) {
52 final FlowspecL3vpnRouteBuilder builder;
54 builder = new FlowspecL3vpnRouteBuilder(route);
56 builder = new FlowspecL3vpnRouteBuilder();
58 return builder.setRouteKey(routeKey.getRouteKey()).setPathId(new PathId(pathId))
59 .setAttributes(attributes).build();
63 public Routes emptyRoutesContainer() {
64 return new FlowspecL3vpnIpv6RoutesCaseBuilder()
65 .setFlowspecL3vpnIpv6Routes(new FlowspecL3vpnIpv6RoutesBuilder().build()).build();