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 java.util.Collections;
11 import java.util.List;
12 import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer;
13 import org.opendaylight.protocol.bgp.flowspec.SimpleFlowspecExtensionProviderContext;
14 import org.opendaylight.protocol.bgp.flowspec.l3vpn.AbstractFlowspecL3vpnRIBSupport;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.bgp.rib.rib.loc.rib.tables.routes.FlowspecL3vpnIpv6RoutesCase;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.bgp.rib.rib.loc.rib.tables.routes.FlowspecL3vpnIpv6RoutesCaseBuilder;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.flowspec.l3vpn.destination.ipv6.DestinationFlowspecL3vpnIpv6;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.flowspec.l3vpn.ipv6.route.FlowspecL3vpnRoute;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.flowspec.l3vpn.ipv6.route.FlowspecL3vpnRouteBuilder;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.flowspec.l3vpn.ipv6.route.FlowspecL3vpnRouteKey;
21 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.flowspec.l3vpn.ipv6.routes.FlowspecL3vpnIpv6Routes;
22 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.flowspec.l3vpn.ipv6.routes.FlowspecL3vpnIpv6RoutesBuilder;
23 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.PathId;
24 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.path.attributes.Attributes;
25 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.Ipv6AddressFamily;
27 public final class FlowspecL3vpnIpv6RIBSupport
28 extends AbstractFlowspecL3vpnRIBSupport<FlowspecL3vpnIpv6NlriParser,
29 FlowspecL3vpnIpv6RoutesCase,
30 FlowspecL3vpnIpv6Routes,
32 FlowspecL3vpnRouteKey> {
33 private static final FlowspecL3vpnIpv6Routes EMPTY_CONTAINER
34 = new FlowspecL3vpnIpv6RoutesBuilder().setFlowspecL3vpnRoute(Collections.emptyList()).build();
35 private static final FlowspecL3vpnIpv6RoutesCase EMPTY_CASE = new FlowspecL3vpnIpv6RoutesCaseBuilder()
36 .setFlowspecL3vpnIpv6Routes(EMPTY_CONTAINER).build();
37 private static FlowspecL3vpnIpv6RIBSupport SINGLETON;
39 private FlowspecL3vpnIpv6RIBSupport(
40 final SimpleFlowspecExtensionProviderContext context,
41 final BindingNormalizedNodeSerializer mappingService) {
44 FlowspecL3vpnIpv6RoutesCase.class,
45 FlowspecL3vpnIpv6Routes.class,
46 FlowspecL3vpnRoute.class,
47 DestinationFlowspecL3vpnIpv6.QNAME,
48 Ipv6AddressFamily.class,
49 new FlowspecL3vpnIpv6NlriParser(context
50 .getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV6,
51 SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC_VPN))
55 public static synchronized FlowspecL3vpnIpv6RIBSupport getInstance(
56 final SimpleFlowspecExtensionProviderContext context,
57 final BindingNormalizedNodeSerializer mappingService) {
58 if (SINGLETON == null) {
59 SINGLETON = new FlowspecL3vpnIpv6RIBSupport(context, mappingService);
65 public FlowspecL3vpnRouteKey createRouteListKey(final PathId pathId, final String routeKey) {
66 return new FlowspecL3vpnRouteKey(pathId, routeKey);
70 public FlowspecL3vpnRoute createRoute(final FlowspecL3vpnRoute route, final FlowspecL3vpnRouteKey key,
71 final Attributes attributes) {
72 final FlowspecL3vpnRouteBuilder builder;
74 builder = new FlowspecL3vpnRouteBuilder(route);
76 builder = new FlowspecL3vpnRouteBuilder();
78 return builder.withKey(key).setAttributes(attributes).build();
82 public FlowspecL3vpnIpv6RoutesCase emptyRoutesCase() {
87 public FlowspecL3vpnIpv6Routes emptyRoutesContainer() {
88 return EMPTY_CONTAINER;
92 public List<FlowspecL3vpnRoute> routesFromContainer(final FlowspecL3vpnIpv6Routes container) {
93 return container.getFlowspecL3vpnRoute();
97 public PathId extractPathId(final FlowspecL3vpnRouteKey routeListKey) {
98 return routeListKey.getPathId();
102 public String extractRouteKey(final FlowspecL3vpnRouteKey routeListKey) {
103 return routeListKey.getRouteKey();