Merge "Do not replicate Sonar config"
[bgpcep.git] / bgp / rib-impl / src / main / java / org / opendaylight / protocol / bgp / rib / impl / IPv6RIBSupport.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.rib.impl;
9
10 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.destination.destination.type.DestinationIpv6Case;
11 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.rib.tables.Routes;
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.rib.tables.routes.ipv6.routes._case.Ipv6Routes;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.rib.tables.routes.ipv6.routes._case.ipv6.routes.Ipv6Route;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.route.Attributes;
15 import org.opendaylight.yangtools.yang.common.QName;
16 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
17 import org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode;
18 import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
19 import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
20
21 final class IPv6RIBSupport extends AbstractIPRIBSupport {
22     private static final IPv6RIBSupport SINGLETON = new IPv6RIBSupport();
23     private final ChoiceNode emptyRoutes = Builders.choiceBuilder()
24             .withNodeIdentifier(new NodeIdentifier(Routes.QNAME))
25             .addChild(Builders.containerBuilder()
26                 .withNodeIdentifier(new NodeIdentifier(Ipv6Routes.QNAME))
27                 .withChild(ImmutableNodes.mapNodeBuilder(Ipv6Route.QNAME).build()).build()).build();
28     private final NodeIdentifier destination = new NodeIdentifier(DestinationIpv6Case.QNAME);
29     private final NodeIdentifier routes = new NodeIdentifier(Ipv6Routes.QNAME);
30     private final NodeIdentifier route = new NodeIdentifier(Ipv6Route.QNAME);
31     private final NodeIdentifier attributes = new NodeIdentifier(QName.create(Ipv6Route.QNAME, Attributes.QNAME.getLocalName()));
32
33     private IPv6RIBSupport() {
34
35     }
36
37     static IPv6RIBSupport getInstance() {
38         return SINGLETON;
39     }
40
41     @Override
42     public ChoiceNode emptyRoutes() {
43         return emptyRoutes;
44     }
45
46     @Override
47     public NodeIdentifier routeAttributes() {
48         return attributes;
49     }
50
51     @Override
52     protected NodeIdentifier destinationIdentifier() {
53         return destination;
54     }
55
56     @Override
57     protected NodeIdentifier routeIdentifier() {
58         return route;
59     }
60
61     @Override
62     protected NodeIdentifier routesIdentifier() {
63         return routes;
64     }
65 }