introduce graceful restart listener capability
[bgpcep.git] / bgp / rib-impl / src / main / java / org / opendaylight / protocol / bgp / rib / impl / TableContext.java
index d98f4958b813a924a1090e14aacb8c4a6fef2377..c03b266b10f7c1ab4bb658087ee8d34cf1be08e9 100644 (file)
@@ -9,6 +9,7 @@ package org.opendaylight.protocol.bgp.rib.impl;
 
 import static java.util.Objects.requireNonNull;
 
+import java.util.Collection;
 import javax.annotation.concurrent.NotThreadSafe;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
@@ -17,6 +18,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mess
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.update.attributes.MpReachNlri;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.update.attributes.MpUnreachNlri;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
 
 /**
  * A context for a single RIB table instance. It is always bound to a particular {@link AdjRibInWriter}.
@@ -46,11 +49,20 @@ final class TableContext {
         tx.delete(LogicalDatastoreType.OPERATIONAL, this.tableId);
     }
 
-    void writeRoutes(final DOMDataWriteTransaction tx, final MpReachNlri nlri, final Attributes attributes) {
-        this.tableSupport.writeRoutes(tx, this.tableId, nlri, attributes);
+    Collection<NodeIdentifierWithPredicates> writeRoutes(final DOMDataWriteTransaction tx, final MpReachNlri nlri,
+                                                         final Attributes attributes) {
+        return this.tableSupport.writeRoutes(tx, this.tableId, nlri, attributes);
     }
 
     void removeRoutes(final DOMDataWriteTransaction tx, final MpUnreachNlri nlri) {
         this.tableSupport.deleteRoutes(tx, this.tableId, nlri);
     }
+
+    YangInstanceIdentifier routesPath() {
+        return tableSupport.getRibSupport().routesPath(this.tableId);
+    }
+
+    YangInstanceIdentifier routePath(final PathArgument routeId) {
+        return tableSupport.getRibSupport().routePath(this.tableId, routeId);
+    }
 }