Bug 9116: SMR children of a prefix too
[lispflowmapping.git] / mappingservice / api / src / main / java / org / opendaylight / lispflowmapping / interfaces / dao / ILispDAO.java
index 8474f94e933a569fa279de4a94adba3597413dd3..203d6ab05b8a3787d391c2bef7e91c911fe4600e 100644 (file)
@@ -8,9 +8,10 @@
 
 package org.opendaylight.lispflowmapping.interfaces.dao;
 
-import java.util.Map;
 import java.util.AbstractMap.SimpleImmutableEntry;
+import java.util.Map;
 
+import java.util.Set;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid;
 
 public interface ILispDAO {
@@ -37,7 +38,7 @@ public interface ILispDAO {
     Object getSpecific(Object key, String valueKey);
 
     /**
-     * Get the entries from the DAO
+     * Get the entries from the DAO.
      *
      * @param key
      *            The key to be looked up as exact match.
@@ -46,7 +47,7 @@ public interface ILispDAO {
     Map<String, Object> get(Object key);
 
     /**
-     * Get value for longest prefix match from the DAO
+     * Get value for longest prefix match from the DAO.
      *
      * @param key
      *            The eid prefix, IPv4 or IPv6, to be looked up. Key must be normalized.
@@ -55,7 +56,7 @@ public interface ILispDAO {
     Map<String, Object> getBest(Object key);
 
     /**
-     * Get longest prefix match and value from the DAO
+     * Get longest prefix match and value from the DAO.
      *
      * @param key
      *            The eid prefix, IPv4 or IPv6, to be looked up. Key must be normalized
@@ -64,7 +65,44 @@ public interface ILispDAO {
     SimpleImmutableEntry<Eid, Map<String, ?>> getBestPair(Object key);
 
     /**
-     * Get widest negative prefix
+     * Look up the covering prefix for the argument, but exclude the argument itself, so the result is always less
+     * specific than the lookup key.
+     *
+     * @param key
+     *            The eid prefix, IPv4 or IPv6, to be looked up. Key must be normalized.
+     * @return The covering prefix.
+     */
+    Eid getCoveringLessSpecific(Eid key);
+
+    /**
+     * Get parent prefix.
+     *
+     * @param key
+     *            The eid prefix, IPv4 or IPv6, to be looked up. Key must be normalized.
+     * @return The parent prefix of the longest prefix match for the key.
+     */
+    Eid getParentPrefix(Eid key);
+
+    /**
+     * Get sibling prefix.
+     *
+     * @param key
+     *            The eid prefix, IPv4 or IPv6, to be looked up. Key must be normalized.
+     * @return The sibling prefix of the longest prefix match for the key.
+     */
+    Eid getSiblingPrefix(Eid key);
+
+    /**
+     * Get virtual parent sibling prefix.
+     *
+     * @param key
+     *            The eid prefix, IPv4 or IPv6, to be looked up. Key must be normalized.
+     * @return The longest prefix match node's virtual parent's sibling or null if nothing is found.
+     */
+    Eid getVirtualParentSiblingPrefix(Eid key);
+
+    /**
+     * Get widest negative prefix.
      *
      * @param key
      *            The eid prefix, IPv4 or IPv6, to be looked up. Key must be normalized.
@@ -73,7 +111,16 @@ public interface ILispDAO {
     Eid getWidestNegativePrefix(Eid key);
 
     /**
-     * Enumerate all the entries from the DAO
+     * Get the subtree of the given prefix.
+     *
+     * @param key
+     *            The eid prefix, IPv4 or IPv6, to be looked up. Key must be normalized.
+     * @return The set of EIDs that part of the subtree of the given EID.
+     */
+    Set<Eid> getSubtree(Eid key);
+
+    /**
+     * Enumerate all the entries from the DAO.
      *
      * @param visitor
      *            The visitor object.
@@ -81,7 +128,7 @@ public interface ILispDAO {
     void getAll(IRowVisitor visitor);
 
     /**
-     * Remove an entry from the DAO
+     * Remove an entry from the DAO.
      *
      * @param key
      *            The key of the entry to delete
@@ -89,7 +136,7 @@ public interface ILispDAO {
     void remove(Object key);
 
     /**
-     * Remove an entry from the DAO
+     * Remove an entry from the DAO.
      *
      * @param key
      *            The key of the entry
@@ -122,4 +169,11 @@ public interface ILispDAO {
      * @return The inserted table
      */
     ILispDAO putNestedTable(Object key, String valueKey);
+
+    /**
+     * Check if the DAO is empty.
+     *
+     * @return true if empty
+     */
+    boolean isEmpty();
 }