2 * Copyright (c) 2015, 2017 Cisco Systems, Inc. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.lispflowmapping.interfaces.mappingservice;
12 import org.opendaylight.lispflowmapping.interfaces.dao.Subscriber;
13 import org.opendaylight.lispflowmapping.lisp.type.MappingData;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.SiteId;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.XtrId;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.authkey.container.MappingAuthkey;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.MappingOrigin;
21 * Mapping Service Java API.
23 * @author Florin Coras
27 public interface IMappingService {
29 enum LookupPolicy { NB_FIRST, NB_AND_SB }
35 * Table where mapping should be added
39 * Site that stores the mapping
41 * Mapping to be stored
43 void addMapping(MappingOrigin origin, Eid key, SiteId siteId, MappingData mapping);
46 * Generate and add a negative mapping entry originated from the southbound, and return the generated mapping.
50 * @return Returns the generated negative mapping (which is never null).
52 MappingData addNegativeMapping(Eid key);
55 * Retrieves mapping with given origin for the provided key. The lookup policy for the key is defined in the Mapping
59 * Table where the mapping should be looked up.
62 * @return Returns the mapping found in the Mapping System or null if nothing is found.
64 MappingData getMapping(MappingOrigin origin, Eid key);
67 * Retrieves mapping for given key.The lookup policy for the key is defined in the Mapping
72 * @return Returns the mapping found in the Mapping System or null if nothing is found.
74 MappingData getMapping(Eid key);
77 * Retrieves mapping with a Source/Dest policy. This method is meant to avoid the overhead of building
78 * LcafSourceDest addresses.
81 * Source key being looked up
83 * Destination key being looked up
84 * @return Returns the mapping found in the Mapping System or null if nothing is found.
86 MappingData getMapping(Eid srcKey, Eid dstKey);
89 * Retrieves widest negative prefix found in the Mapping System for given key.
93 * @return Returns the widest negative prefix or null if nothing is found.
95 Eid getWidestNegativePrefix(Eid key);
98 * Retrieves the subtree of a maskable prefix from the given map-cache.
101 * Table where the key should be looked up
103 * Key to be looked up
104 * @return The child prefixes of the prefix, including the prefix itself if present
106 Set<Eid> getSubtree(MappingOrigin origin, Eid key);
109 * Refresh southbound mapping registration timestamp.
112 * The EID whose registration must be refreshed
114 * xTR-ID of the mapping to be refreshed
116 * New timestamp for the mapping
118 void refreshMappingRegistration(Eid key, XtrId xtrId, Long timestamp);
124 * Table from where the mapping should be removed
128 void removeMapping(MappingOrigin origin, Eid key);
131 * Add authentication key.
134 * The key for which the authentication key is added
136 * The authentication key
138 void addAuthenticationKey(Eid key, MappingAuthkey authKey);
142 * Subscribe a Subscriber to receive updates about mapping changes for an EID.
145 * The Subscriber object with information about the subscriber
146 * @param subscribedEid
147 * The EID for which the subscriber will receive updates
149 void subscribe(Subscriber subscriber, Eid subscribedEid);
152 * Retrieves the subscribers for an EID.
155 * The EID to be looked up
157 * The set of subscribers for the EID
159 Set<Subscriber> getSubscribers(Eid eid);
162 * Retrieve authentication key.
165 * The key for which the authentication key is being looked up.
166 * @return The authentication key.
168 MappingAuthkey getAuthenticationKey(Eid key);
171 * Remove authentication key.
174 * Key for which the authentication key should be removed.
176 void removeAuthenticationKey(Eid key);
179 * Generic addition of data. Not stored in MD-SAL datastore!
182 * Table where data should be inserted
184 * The key where data should be inserted
186 * The subKey where data should be inserted
188 * The data to be stored
190 void addData(MappingOrigin origin, Eid key, String subKey, Object data);
193 * Generic retrieval of data.
196 * Table from where the data should be read
198 * The key where the data is stored
200 * The subKey where data is stored
203 Object getData(MappingOrigin origin, Eid key, String subKey);
206 * Generic removal of data.
209 * The table from where the data should be removed
211 * The key of the data to be removed
213 * The subKey of the data to be removed
215 void removeData(MappingOrigin origin, Eid key, String subKey);
218 * Returns the parent prefix for given key.
221 * The key which parent is to be returned.
222 * @return The parent perfix of a specific key.
224 Eid getParentPrefix(Eid key);
227 * Configures Mapping Service mapping merge option. If set to false, mappings with the same key are overwritten,
228 * otherwise, mappings with the same key but from different xTR-IDs are all stored.
230 * @param mappingMerge
231 * enables or disables mapping merge
233 void setMappingMerge(boolean mappingMerge);
236 * Configures Mapping Service mapping lookup policy option.
239 * the policy to be activated
241 void setLookupPolicy(LookupPolicy policy);
244 * Print all mappings. Used for testing, debugging and the karaf shell.
246 * @return String consisting of all mappings
248 String printMappings();
251 * Print mappings in cache in a human friendly format.
253 * @return a String consisting of all the mappings in the cache
255 String prettyPrintMappings();
258 * Print all authentication keys. Used for testing, debugging and the karaf shell.
260 * @return String consisting of all mappings
265 * Print keys in cache in a human friendly format.
267 * @return a String consisting of all the keys in the cache
269 String prettyPrintKeys();
272 * Cleans all cached mappings.Used for testing.
274 void cleanCachedMappings();
277 * Set cluster master status.
282 void setIsMaster(boolean isMaster);
285 * Get cluster master status.