/* * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ package org.opendaylight.protocol.bgp.rib.impl; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.bgp.rib.rib.loc.rib.tables.routes.Ipv6RoutesCase; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.ipv6.prefixes.DestinationIpv6; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.ipv6.prefixes.destination.ipv6.Ipv6Prefixes; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.ipv6.routes.Ipv6Routes; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.ipv6.routes.ipv6.routes.Ipv6Route; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.rib.tables.Routes; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier; import org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode; import org.opendaylight.yangtools.yang.data.impl.schema.Builders; import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes; /** * Class supporting IPv6 unicast RIBs. */ final class IPv6RIBSupport extends AbstractIPRIBSupport { private final static QName PREFIX_QNAME = QName.cachedReference(QName.create(Ipv6Route.QNAME, "prefix")); private static final IPv6RIBSupport SINGLETON = new IPv6RIBSupport(); private final ChoiceNode emptyRoutes = Builders.choiceBuilder() .withNodeIdentifier(new NodeIdentifier(Routes.QNAME)) .addChild(Builders.containerBuilder() .withNodeIdentifier(new NodeIdentifier(Ipv6Routes.QNAME)) .withChild(ImmutableNodes.mapNodeBuilder(Ipv6Route.QNAME).build()).build()).build(); private final NodeIdentifier destination = new NodeIdentifier(DestinationIpv6.QNAME); private final NodeIdentifier route = new NodeIdentifier(Ipv6Route.QNAME); private final NodeIdentifier nlriRoutesList = new NodeIdentifier(Ipv6Prefixes.QNAME); private final NodeIdentifier routeKeyKeaf = new NodeIdentifier(PREFIX_QNAME); private IPv6RIBSupport() { super(Ipv6RoutesCase.class, Ipv6Routes.class, Ipv6Route.class); } static IPv6RIBSupport getInstance() { return SINGLETON; } @Override public ChoiceNode emptyRoutes() { return this.emptyRoutes; } @Override protected NodeIdentifier destinationContainerIdentifier() { return this.destination; } @Override protected NodeIdentifier routeIdentifier() { return this.route; } @Override protected NodeIdentifier routeKeyLeafIdentifier() { return routeKeyKeaf; } @Override protected NodeIdentifier nlriRoutesListIdentifier() { return this.nlriRoutesList; } @Override protected QName keyLeafQName() { return PREFIX_QNAME; } @Override protected QName routeQName() { return Ipv6Route.QNAME; } }