2 * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
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
8 package org.opendaylight.protocol.bgp.rib.spi;
10 import com.google.common.collect.ImmutableCollection;
11 import java.util.Collection;
12 import javax.annotation.Nonnull;
13 import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.Route;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.rib.tables.Routes;
16 import org.opendaylight.yangtools.yang.binding.DataObject;
17 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
18 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
19 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
20 import org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode;
21 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
22 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateNode;
25 * Interface implemented for AFI/SAFI-specific RIB extensions. The extensions need
26 * to register an implementation of this class and the RIB core then calls into it
27 * to inquire about details specific to that particular model.
29 public interface RIBSupport {
31 * Return the table-type-specific empty routes container, as augmented into the
32 * bgp-rib model under /rib/tables/routes choice node. This needs to include all
33 * the skeleton nodes under which the individual routes will be stored.
35 * @return Protocol-specific case in the routes choice, may not be null.
37 @Nonnull ChoiceNode emptyRoutes();
40 * Return the localized identifier of the attributes route member, as expanded
41 * from the route grouping in the specific augmentation of the base routes choice.
43 * @return The attributes identifier, may not be null.
45 @Nonnull NodeIdentifier routeAttributesIdentifier();
48 * Return class object of the Routes Case statement.
52 @Nonnull Class<? extends Routes> routesCaseClass();
55 * Return class object of the Routes Container statement.
59 @Nonnull Class<? extends DataObject> routesContainerClass();
62 * Return class object of the Routes List statement.
66 @Nonnull Class<? extends Route> routesListClass();
68 @Nonnull ImmutableCollection<Class<? extends DataObject>> cacheableAttributeObjects();
69 @Nonnull ImmutableCollection<Class<? extends DataObject>> cacheableNlriObjects();
72 * Given the NLRI as ContainerNode, this method should extract withdrawn routes
73 * from the DOM model and delete them from RIBs.
75 * @param tx DOMDataWriteTransaction
76 * @param tablePath YangInstanceIdentifier
77 * @param nlri ContainerNode DOM representation of NLRI in Update message
79 void deleteRoutes(@Nonnull DOMDataWriteTransaction tx, @Nonnull YangInstanceIdentifier tablePath, @Nonnull ContainerNode nlri);
82 * Given the NLRI as ContainerNode, this method should extract advertised routes
83 * from the DOM model and put them into RIBs.
85 * @param tx DOMDataWriteTransaction
86 * @param tablePath YangInstanceIdentifier
87 * @param nlri ContainerNode DOM representation of NLRI in Update message
88 * @param attributes ContainerNode
90 void putRoutes(@Nonnull DOMDataWriteTransaction tx, @Nonnull YangInstanceIdentifier tablePath, @Nonnull ContainerNode nlri, @Nonnull ContainerNode attributes);
93 * Returns routes that were modified within this RIB support instance.
95 * @param routes DataTreeCandidateNode
96 * @return collection of modified nodes or empty collection if no node was modified
98 @Nonnull Collection<DataTreeCandidateNode> changedRoutes(@Nonnull DataTreeCandidateNode routes);
101 * Constructs an instance identifier path to routeId.
103 * @param routesPath YangInstanceIdentifier base path
104 * @param routeId PathArgument leaf path
105 * @return YangInstanceIdentifier with routesPath + specific RIB support routes path + routeId
107 @Nonnull YangInstanceIdentifier routePath(@Nonnull YangInstanceIdentifier routesPath, @Nonnull PathArgument routeId);