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.ipv4;
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.rev180329.bgp.rib.rib.loc.rib.tables.routes.FlowspecL3vpnIpv4RoutesCase;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.bgp.rib.rib.peer.effective.rib.in.tables.routes.FlowspecL3vpnIpv4RoutesCaseBuilder;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.flowspec.l3vpn.destination.ipv4.DestinationFlowspecL3vpnIpv4;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.flowspec.l3vpn.ipv4.route.FlowspecL3vpnRoute;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.flowspec.l3vpn.ipv4.route.FlowspecL3vpnRouteBuilder;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.flowspec.l3vpn.ipv4.route.FlowspecL3vpnRouteKey;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.flowspec.l3vpn.ipv4.routes.FlowspecL3vpnIpv4Routes;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.flowspec.l3vpn.ipv4.routes.FlowspecL3vpnIpv4RoutesBuilder;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.PathId;
21 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.path.attributes.Attributes;
22 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.tables.Routes;
23 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.Ipv4AddressFamily;
25 public final class FlowspecL3vpnIpv4RIBSupport extends AbstractFlowspecL3vpnRIBSupport<FlowspecL3vpnIpv4NlriParser,
26 FlowspecL3vpnRoute, FlowspecL3vpnRouteKey> {
28 public FlowspecL3vpnIpv4RIBSupport(final SimpleFlowspecExtensionProviderContext context) {
30 FlowspecL3vpnIpv4RoutesCase.class,
31 FlowspecL3vpnIpv4Routes.class,
32 FlowspecL3vpnRoute.class,
33 DestinationFlowspecL3vpnIpv4.QNAME,
34 Ipv4AddressFamily.class,
35 new FlowspecL3vpnIpv4NlriParser(context
36 .getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV4,
37 SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC_VPN))
41 public static FlowspecL3vpnIpv4RIBSupport getInstance(final SimpleFlowspecExtensionProviderContext context) {
42 return new FlowspecL3vpnIpv4RIBSupport(context);
46 public final FlowspecL3vpnRouteKey createRouteListKey(final long pathId, final String routeKey) {
47 return new FlowspecL3vpnRouteKey(new PathId(pathId), routeKey);
51 public FlowspecL3vpnRoute createRoute(final FlowspecL3vpnRoute route, final String routeKey,
52 final long pathId, final Attributes attributes) {
53 final FlowspecL3vpnRouteBuilder builder;
55 builder = new FlowspecL3vpnRouteBuilder(route);
57 builder = new FlowspecL3vpnRouteBuilder();
59 return builder.setKey(new FlowspecL3vpnRouteKey(new PathId(pathId), routeKey))
60 .setAttributes(attributes).build();
64 public Routes emptyRoutesContainer() {
65 return new FlowspecL3vpnIpv4RoutesCaseBuilder()
66 .setFlowspecL3vpnIpv4Routes(new FlowspecL3vpnIpv4RoutesBuilder().build()).build();