Provide Add Path support for all AFI/SAFI
[bgpcep.git] / bgp / rib-spi / src / main / java / org / opendaylight / protocol / bgp / rib / spi / RIBSupport.java
index e403925f602784f122604a30d70470b65017c275..5b86b084e3fe4265074cf364065b55daefae7c93 100644 (file)
@@ -12,13 +12,12 @@ import java.util.Collection;
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.PathId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.Update;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.Attributes;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.Route;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.rib.Tables;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.rib.TablesKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.rib.tables.Routes;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.Route;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.Tables;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.TablesKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.tables.Routes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.AddressFamily;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.SubsequentAddressFamily;
 import org.opendaylight.yangtools.yang.binding.DataObject;
@@ -156,7 +155,7 @@ public interface RIBSupport<R extends Route, N extends Identifier> extends AddPa
      * @return collection of modified nodes or empty collection if no node was modified
      */
     @Nonnull
-    Collection<DataTreeCandidateNode> changedDOMRoutes(@Nonnull DataTreeCandidateNode routes);
+    Collection<DataTreeCandidateNode> changedRoutes(@Nonnull DataTreeCandidateNode routes);
 
     /**
      * Constructs an instance identifier path to routeId.
@@ -174,7 +173,9 @@ public interface RIBSupport<R extends Route, N extends Identifier> extends AddPa
      * only have their key and attributes, complex routes are those which include more structured data.
      *
      * @return True if this is a complex route, false otherwise.
+     * @deprecated All routes are complex.
      */
+    @Deprecated
     boolean isComplexRoute();
 
     /**
@@ -189,8 +190,10 @@ public interface RIBSupport<R extends Route, N extends Identifier> extends AddPa
      * @return Update message ready to be sent out
      */
     @Nonnull
-    Update buildUpdate(@Nonnull Collection<MapEntryNode> advertised,
-            @Nonnull Collection<MapEntryNode> withdrawn, @Nonnull Attributes attr);
+    Update buildUpdate(
+            @Nonnull Collection<MapEntryNode> advertised,
+            @Nonnull Collection<MapEntryNode> withdrawn,
+            @Nonnull Attributes attr);
 
     @Nonnull
     Class<? extends AddressFamily> getAfi();
@@ -199,35 +202,53 @@ public interface RIBSupport<R extends Route, N extends Identifier> extends AddPa
     Class<? extends SubsequentAddressFamily> getSafi();
 
     /**
-     * Creates Route Rib out Peer InstanceIdentifier.
+     * Creates Route table Peer InstanceIdentifier.
      *
-     * @param ribOutIId   table InstanceIdentifier
+     * @param tableKey    table InstanceIdentifier
      * @param newRouteKey route key
      * @return InstanceIdentifier
      */
     @Nonnull
-    InstanceIdentifier<R> createRouteIId(
-            @Nonnull KeyedInstanceIdentifier<Tables, TablesKey> ribOutIId,
+    InstanceIdentifier<R> createRouteIdentifier(
+            @Nonnull KeyedInstanceIdentifier<Tables, TablesKey> tableKey,
             @Nonnull N newRouteKey);
 
-    @Nonnull
-    R createRoute(@Nullable R route, N routeKey, @Nullable PathId pathId, @Nonnull Attributes attributes);
-
     /**
-     * Construct a PathArgument to an AddPathRoute.
+     * Creates a route with new path Id and attributes.
      *
-     * @param pathId  The path identifier
-     * @param routeKey RouteKey
-     * @return routeId PathArgument + pathId or Null in case Add-path is not supported
+     * @param route route
+     * @param routeKey route key
+     * @param pathId new path Id
+     * @param attributes route attributes
+     * @return Route List key
      */
-    @Nullable
-    default Identifier createNewRouteKey(@Nonnull PathId pathId, @Nonnull N routeKey) {
-        return null;
-    }
+    @Nonnull
+    R createRoute(@Nullable R route, String routeKey, @Nullable long pathId, @Nonnull Attributes attributes);
 
     interface ApplyRoute {
         void apply(@Nonnull DOMDataWriteTransaction tx, @Nonnull YangInstanceIdentifier base,
                 @Nonnull NodeIdentifierWithPredicates routeKey,
                 @Nonnull DataContainerNode<?> route, ContainerNode attributes);
     }
+
+    /**
+     * Return the table-type-specific empty routes container, as augmented into the
+     * bgp-peer model under /peer/effect-rib-in/tables/routes choice node. This needs to include all
+     * the skeleton nodes under which the individual routes will be stored.
+     *
+     * @return Protocol-specific case in the routes choice, may not be null.
+     */
+    @Nonnull
+    Routes emptyRoutesContainer();
+
+
+    /**
+     * Construct a Route List Key using new path Id for Families.
+     *
+     * @param pathId   The path identifier
+     * @param routeKey RouteKey
+     * @return route list Key (RouteKey + pathId)
+     */
+    @Nonnull
+    N createRouteListKey(@Nonnull long pathId, @Nonnull String routeKey);
 }