Bug 9116: SMR children of a prefix too
[lispflowmapping.git] / mappingservice / api / src / main / java / org / opendaylight / lispflowmapping / interfaces / mappingservice / IMappingService.java
index 9b96bd0c0a58db3377bf48e880d39b44a91b40f0..7891d6e70aa6c0b5565a2b9aea1fe44afe78c53b 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.mappingservice;
 
+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.SiteId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.XtrId;
@@ -40,6 +42,15 @@ public interface IMappingService {
      */
     void addMapping(MappingOrigin origin, Eid key, SiteId siteId, 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);
+
     /**
      * Retrieves mapping with given origin for the provided key. The lookup policy for the key is defined in the Mapping
      * System.
@@ -83,6 +94,17 @@ public interface IMappingService {
      */
     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.
      *
@@ -115,6 +137,27 @@ public interface IMappingService {
      */
     void addAuthenticationKey(Eid key, MappingAuthkey authKey);
 
+
+    /**
+     * 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);
+
     /**
      * Retrieve authentication key.
      *
@@ -171,6 +214,15 @@ public interface IMappingService {
      */
     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);
+
     /**
      * Configures Mapping Service mapping merge option. If set to false, mappings with the same key are overwritten,
      * otherwise, mappings with the same key but from different xTR-IDs are all stored.
@@ -195,6 +247,13 @@ public interface IMappingService {
      */
     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.
      *
@@ -202,6 +261,13 @@ public interface IMappingService {
      */
     String printKeys();
 
+    /**
+     * Print keys in cache in a human friendly format.
+     *
+     * @return a String consisting of all the keys in the cache
+     */
+    String prettyPrintKeys();
+
     /**
      * Cleans all cached mappings.Used for testing.
      */
@@ -213,7 +279,7 @@ public interface IMappingService {
      * @param isMaster
      *            is|isn't master
      */
-    void setIsMaster(final boolean isMaster);
+    void setIsMaster(boolean isMaster);
 
     /**
      * Get cluster master status.