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 * Refresh southbound mapping registration timestamp.
101 * The EID whose registration must be refreshed
103 * xTR-ID of the mapping to be refreshed
105 * New timestamp for the mapping
107 void refreshMappingRegistration(Eid key, XtrId xtrId, Long timestamp);
113 * Table from where the mapping should be removed
117 void removeMapping(MappingOrigin origin, Eid key);
120 * Add authentication key.
123 * The key for which the authentication key is added
125 * The authentication key
127 void addAuthenticationKey(Eid key, MappingAuthkey authKey);
131 * Subscribe a Subscriber to receive updates about mapping changes for an EID.
134 * The Subscriber object with information about the subscriber
135 * @param subscribedEid
136 * The EID for which the subscriber will receive updates
138 void subscribe(Subscriber subscriber, Eid subscribedEid);
141 * Retrieves the subscribers for an EID.
144 * The EID to be looked up
146 * The set of subscribers for the EID
148 Set<Subscriber> getSubscribers(Eid eid);
151 * Retrieve authentication key.
154 * The key for which the authentication key is being looked up.
155 * @return The authentication key.
157 MappingAuthkey getAuthenticationKey(Eid key);
160 * Remove authentication key.
163 * Key for which the authentication key should be removed.
165 void removeAuthenticationKey(Eid key);
168 * Generic addition of data. Not stored in MD-SAL datastore!
171 * Table where data should be inserted
173 * The key where data should be inserted
175 * The subKey where data should be inserted
177 * The data to be stored
179 void addData(MappingOrigin origin, Eid key, String subKey, Object data);
182 * Generic retrieval of data.
185 * Table from where the data should be read
187 * The key where the data is stored
189 * The subKey where data is stored
192 Object getData(MappingOrigin origin, Eid key, String subKey);
195 * Generic removal of data.
198 * The table from where the data should be removed
200 * The key of the data to be removed
202 * The subKey of the data to be removed
204 void removeData(MappingOrigin origin, Eid key, String subKey);
207 * Returns the parent prefix for given key.
210 * The key which parent is to be returned.
211 * @return The parent perfix of a specific key.
213 Eid getParentPrefix(Eid key);
216 * Configures Mapping Service mapping merge option. If set to false, mappings with the same key are overwritten,
217 * otherwise, mappings with the same key but from different xTR-IDs are all stored.
219 * @param mappingMerge
220 * enables or disables mapping merge
222 void setMappingMerge(boolean mappingMerge);
225 * Configures Mapping Service mapping lookup policy option.
228 * the policy to be activated
230 void setLookupPolicy(LookupPolicy policy);
233 * Print all mappings. Used for testing, debugging and the karaf shell.
235 * @return String consisting of all mappings
237 String printMappings();
240 * Print mappings in cache in a human friendly format.
242 * @return a String consisting of all the mappings in the cache
244 String prettyPrintMappings();
247 * Print all authentication keys. Used for testing, debugging and the karaf shell.
249 * @return String consisting of all mappings
254 * Print keys in cache in a human friendly format.
256 * @return a String consisting of all the keys in the cache
258 String prettyPrintKeys();
261 * Cleans all cached mappings.Used for testing.
263 void cleanCachedMappings();
266 * Set cluster master status.
271 void setIsMaster(boolean isMaster);
274 * Get cluster master status.