Bug 9116: SMR children of a prefix too
[lispflowmapping.git] / mappingservice / api / src / main / java / org / opendaylight / lispflowmapping / interfaces / mapcache / IMappingSystem.java
index cb04452e42153a96c3a7db3a4e1d0b687b052e03..613b75fb32d5da3eb99678cce67c2ee54653eb31 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 Cisco Systems, Inc.  All rights reserved.
+ * Copyright (c) 2015, 2017 Cisco Systems, Inc.  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,
@@ -8,6 +8,8 @@
 
 package org.opendaylight.lispflowmapping.interfaces.mapcache;
 
+import java.util.Set;
+import org.opendaylight.lispflowmapping.interfaces.dao.Subscriber;
 import org.opendaylight.lispflowmapping.lisp.type.MappingData;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.XtrId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid;
@@ -34,6 +36,27 @@ public interface IMappingSystem {
      */
     void addMapping(MappingOrigin origin, Eid key, MappingData mapping);
 
+    /**
+     * Generate and add a negative mapping entry originated from the southbound, and return the generated mapping.
+     *
+     * @param key
+     *            Key of the mapping
+     * @return Returns the generated negative mapping (which is never null).
+     */
+    MappingData addNegativeMapping(Eid key);
+
+    /**
+     * Update mapping.
+     *
+     * @param origin
+     *            Table where mapping should be added
+     * @param key
+     *            Key of the mapping
+     * @param mapping
+     *            Mapping to be stored
+     */
+    void updateMapping(MappingOrigin origin, Eid key, MappingData mapping);
+
     /**
      * Retrieves mapping for the provided src and dst key.
      *
@@ -87,6 +110,17 @@ public interface IMappingSystem {
      */
     Eid getWidestNegativePrefix(Eid key);
 
+    /**
+     * Retrieves the subtree of a maskable prefix from the given map-cache.
+     *
+     * @param origin
+     *            Table where the key should be looked up
+     * @param key
+     *            Key to be looked up
+     * @return The child prefixes of the prefix, including the prefix itself if present
+     */
+    Set<Eid> getSubtree(MappingOrigin origin, Eid key);
+
     /**
      * Refresh southbound mapping registration timestamp.
      *
@@ -110,6 +144,26 @@ public interface IMappingSystem {
      */
     void removeMapping(MappingOrigin origin, Eid key);
 
+    /**
+     * Subscribe a Subscriber to receive updates about mapping changes for an EID.
+     *
+     * @param subscriber
+     *            The Subscriber object with information about the subscriber
+     * @param subscribedEid
+     *            The EID for which the subscriber will receive updates
+     */
+    void subscribe(Subscriber subscriber, Eid subscribedEid);
+
+    /**
+     * Retrieves the subscribers for an EID.
+     *
+     * @param eid
+     *            The EID to be looked up
+     * @return
+     *            The set of subscribers for the EID
+     */
+    Set<Subscriber> getSubscribers(Eid eid);
+
     /**
      * Add authentication key.
      *
@@ -178,6 +232,15 @@ public interface IMappingSystem {
      */
     void removeData(MappingOrigin origin, Eid key, String subKey);
 
+    /**
+     * Returns the parent prefix for given key.
+     *
+     * @param key
+     *            The key which parent is to be returned.
+     * @return The parent perfix of a specific key.
+     */
+    Eid getParentPrefix(Eid key);
+
     /**
      * Sets iterateMask. If set to true, longest prefix matching for IP keys is used.
      *
@@ -202,13 +265,34 @@ public interface IMappingSystem {
      */
     String printMappings();
 
+    /**
+     * Print mappings in cache in a human friendly format.
+     *
+     * @return a String consisting of all the mappings in the cache
+     */
+    String prettyPrintMappings();
+
+    /**
+     * Print all authentication keys. Used for testing, debugging and the karaf shell.
+     *
+     * @return String consisting of all mappings
+     */
+    String printKeys();
+
+    /**
+     * Print keys in cache in a human friendly format.
+     *
+     * @return a String consisting of all the keys in the cache
+     */
+    String prettyPrintKeys();
+
     /**
      * Set cluster master status.
      *
      * @param isMaster
      *            is|isn't master
      */
-    void setIsMaster(final boolean isMaster);
+    void setIsMaster(boolean isMaster);
 
     /**
      * Get cluster master status.