/* * 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.Ipv4RoutesCase; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.ipv4.prefixes.DestinationIpv4; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.ipv4.prefixes.destination.ipv4.Ipv4Prefixes; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.ipv4.routes.Ipv4Routes; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.ipv4.routes.ipv4.routes.Ipv4Route; 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 IPv4 unicast RIBs. */ final class IPv4RIBSupport extends AbstractIPRIBSupport { private final static QName PREFIX_QNAME = QName.cachedReference(QName.create(Ipv4Route.QNAME, "prefix")); private static final IPv4RIBSupport SINGLETON = new IPv4RIBSupport(); private final ChoiceNode emptyRoutes = Builders.choiceBuilder() .withNodeIdentifier(new NodeIdentifier(Routes.QNAME)) .addChild(Builders.containerBuilder() .withNodeIdentifier(new NodeIdentifier(Ipv4Routes.QNAME)) .withChild(ImmutableNodes.mapNodeBuilder(Ipv4Route.QNAME).build()).build()).build(); private final NodeIdentifier destination = new NodeIdentifier(DestinationIpv4.QNAME); private final NodeIdentifier route = new NodeIdentifier(Ipv4Route.QNAME); private final NodeIdentifier nlriRoutesList = new NodeIdentifier(Ipv4Prefixes.QNAME); private final NodeIdentifier routeKeyKeaf = new NodeIdentifier(PREFIX_QNAME); private IPv4RIBSupport() { super(Ipv4RoutesCase.class, Ipv4Routes.class, Ipv4Route.class); } static IPv4RIBSupport 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 Ipv4Route.QNAME; } }