BGPCEP-574: Remove unnesary methods
[bgpcep.git] / bgp / flowspec / src / main / java / org / opendaylight / protocol / bgp / flowspec / FlowspecIpv6RIBSupport.java
1 /*
2  * Copyright (c) 2015 Cisco 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;
9
10 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.FlowspecSubsequentAddressFamily;
11 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.bgp.rib.rib.loc.rib.tables.routes.FlowspecIpv6RoutesCase;
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.flowspec.destination.ipv6.DestinationFlowspec;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.flowspec.ipv6.route.FlowspecRoute;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.flowspec.ipv6.route.FlowspecRouteBuilder;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.flowspec.ipv6.route.FlowspecRouteKey;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.flowspec.ipv6.routes.FlowspecIpv6Routes;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.PathId;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.Attributes;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.Ipv6AddressFamily;
20
21 public final class FlowspecIpv6RIBSupport extends AbstractFlowspecRIBSupport<SimpleFlowspecIpv6NlriParser,
22         FlowspecRoute, FlowspecRouteKey> {
23
24     public FlowspecIpv6RIBSupport(SimpleFlowspecExtensionProviderContext context) {
25         super(
26                 FlowspecIpv6RoutesCase.class,
27                 FlowspecIpv6Routes.class,
28                 FlowspecRoute.class,
29                 Ipv6AddressFamily.class,
30                 FlowspecSubsequentAddressFamily.class,
31                 DestinationFlowspec.QNAME,
32                 new SimpleFlowspecIpv6NlriParser(context
33                         .getFlowspecTypeRegistry(SimpleFlowspecExtensionProviderContext.AFI.IPV6,
34                                 SimpleFlowspecExtensionProviderContext.SAFI.FLOWSPEC))
35         );
36     }
37
38     static FlowspecIpv6RIBSupport getInstance(SimpleFlowspecExtensionProviderContext context) {
39         return new FlowspecIpv6RIBSupport(context);
40     }
41
42     @Override
43     public FlowspecRoute createRoute(final FlowspecRoute route, final FlowspecRouteKey routeKey,
44             final PathId pathId, final Attributes attributes) {
45         final FlowspecRouteBuilder builder;
46         if (route != null) {
47             builder = new FlowspecRouteBuilder(route);
48         } else {
49             builder = new FlowspecRouteBuilder();
50         }
51         return builder.setRouteKey(routeKey.getRouteKey()).setPathId(pathId).setAttributes(attributes).build();
52     }
53
54     @Override
55     public FlowspecRouteKey createNewRouteKey(final PathId pathId, final FlowspecRouteKey routeKey) {
56         return new FlowspecRouteKey(pathId, routeKey.getRouteKey());
57     }
58 }