BGPCEP-574: Remove unnesary methods
[bgpcep.git] / bgp / flowspec / src / main / java / org / opendaylight / protocol / bgp / flowspec / l3vpn / ipv4 / FlowspecL3vpnIpv4RIBSupport.java
1 /*
2  * Copyright (c) 2016 Brocade Communications Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.protocol.bgp.flowspec.l3vpn.ipv4;
9
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.FlowspecL3vpnIpv4RoutesCase;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.flowspec.l3vpn.destination.ipv4.DestinationFlowspecL3vpnIpv4;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.flowspec.l3vpn.ipv4.route.FlowspecL3vpnRoute;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.flowspec.l3vpn.ipv4.route.FlowspecL3vpnRouteBuilder;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.flowspec.l3vpn.ipv4.route.FlowspecL3vpnRouteKey;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.flowspec.l3vpn.ipv4.routes.FlowspecL3vpnIpv4Routes;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.PathId;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.Attributes;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.Ipv4AddressFamily;
21
22 public final class FlowspecL3vpnIpv4RIBSupport extends AbstractFlowspecL3vpnRIBSupport<FlowspecL3vpnIpv4NlriParser,
23         FlowspecL3vpnRoute, FlowspecL3vpnRouteKey> {
24
25     public FlowspecL3vpnIpv4RIBSupport(final SimpleFlowspecExtensionProviderContext context) {
26         super(
27                 FlowspecL3vpnIpv4RoutesCase.class,
28                 FlowspecL3vpnIpv4Routes.class,
29                 FlowspecL3vpnRoute.class,
30                 DestinationFlowspecL3vpnIpv4.QNAME,
31                 Ipv4AddressFamily.class,
32                 new FlowspecL3vpnIpv4NlriParser(context
33                         .getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV4,
34                                 SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC_VPN))
35         );
36     }
37
38     public static FlowspecL3vpnIpv4RIBSupport getInstance(final SimpleFlowspecExtensionProviderContext context) {
39         return new FlowspecL3vpnIpv4RIBSupport(context);
40     }
41
42     @Override
43     public final FlowspecL3vpnRouteKey createNewRouteKey(final PathId pathId, final FlowspecL3vpnRouteKey routeKey) {
44         return new FlowspecL3vpnRouteKey(pathId, routeKey.getRouteKey());
45     }
46
47     @Override
48     public FlowspecL3vpnRoute createRoute(
49             final FlowspecL3vpnRoute route,
50             final FlowspecL3vpnRouteKey routeKey,
51             final PathId pathId,
52             final Attributes attributes) {
53         final FlowspecL3vpnRouteBuilder builder;
54         if (route != null) {
55             builder = new FlowspecL3vpnRouteBuilder(route);
56         } else {
57             builder = new FlowspecL3vpnRouteBuilder();
58         }
59         return builder.setRouteKey(routeKey.getRouteKey()).setPathId(pathId).setAttributes(attributes).build();
60     }
61 }