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;
11 import org.opendaylight.lispflowmapping.lisp.type.MappingData;
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.SiteId;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.XtrId;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.authkey.container.MappingAuthkey;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.MappingOrigin;
19 * Mapping Service Java API.
21 * @author Florin Coras
25 public interface IMappingService {
27 enum LookupPolicy { NB_FIRST, NB_AND_SB }
33 * Table where mapping should be added
37 * Site that stores the mapping
39 * Mapping to be stored
41 void addMapping(MappingOrigin origin, Eid key, SiteId siteId, MappingData mapping);
44 * Generate and add a negative mapping entry originated from the southbound, and return the generated mapping.
48 * @return Returns the generated negative mapping (which is never null).
50 MappingData addNegativeMapping(Eid key);
53 * Retrieves mapping with given origin for the provided key. The lookup policy for the key is defined in the Mapping
57 * Table where the mapping should be looked up.
60 * @return Returns the mapping found in the Mapping System or null if nothing is found.
62 MappingData getMapping(MappingOrigin origin, Eid key);
65 * Retrieves mapping for given key.The lookup policy for the key is defined in the Mapping
70 * @return Returns the mapping found in the Mapping System or null if nothing is found.
72 MappingData getMapping(Eid key);
75 * Retrieves mapping with a Source/Dest policy. This method is meant to avoid the overhead of building
76 * LcafSourceDest addresses.
79 * Source key being looked up
81 * Destination key being looked up
82 * @return Returns the mapping found in the Mapping System or null if nothing is found.
84 MappingData getMapping(Eid srcKey, Eid dstKey);
87 * Retrieves widest negative prefix found in the Mapping System for given key.
91 * @return Returns the widest negative prefix or null if nothing is found.
93 Eid getWidestNegativePrefix(Eid key);
96 * Refresh southbound mapping registration timestamp.
99 * The EID whose registration must be refreshed
101 * xTR-ID of the mapping to be refreshed
103 * New timestamp for the mapping
105 void refreshMappingRegistration(Eid key, XtrId xtrId, Long timestamp);
111 * Table from where the mapping should be removed
115 void removeMapping(MappingOrigin origin, Eid key);
118 * Add authentication key.
121 * The key for which the authentication key is added
123 * The authentication key
125 void addAuthenticationKey(Eid key, MappingAuthkey authKey);
128 * Retrieve authentication key.
131 * The key for which the authentication key is being looked up.
132 * @return The authentication key.
134 MappingAuthkey getAuthenticationKey(Eid key);
137 * Remove authentication key.
140 * Key for which the authentication key should be removed.
142 void removeAuthenticationKey(Eid key);
145 * Generic addition of data. Not stored in MD-SAL datastore!
148 * Table where data should be inserted
150 * The key where data should be inserted
152 * The subKey where data should be inserted
154 * The data to be stored
156 void addData(MappingOrigin origin, Eid key, String subKey, Object data);
159 * Generic retrieval of data.
162 * Table from where the data should be read
164 * The key where the data is stored
166 * The subKey where data is stored
169 Object getData(MappingOrigin origin, Eid key, String subKey);
172 * Generic removal of data.
175 * The table from where the data should be removed
177 * The key of the data to be removed
179 * The subKey of the data to be removed
181 void removeData(MappingOrigin origin, Eid key, String subKey);
184 * Returns the parent prefix for given key.
187 * The key which parent is to be returned.
188 * @return The parent perfix of a specific key.
190 Eid getParentPrefix(Eid key);
193 * Configures Mapping Service mapping merge option. If set to false, mappings with the same key are overwritten,
194 * otherwise, mappings with the same key but from different xTR-IDs are all stored.
196 * @param mappingMerge
197 * enables or disables mapping merge
199 void setMappingMerge(boolean mappingMerge);
202 * Configures Mapping Service mapping lookup policy option.
205 * the policy to be activated
207 void setLookupPolicy(LookupPolicy policy);
210 * Print all mappings. Used for testing, debugging and the karaf shell.
212 * @return String consisting of all mappings
214 String printMappings();
217 * Print mappings in cache in a human friendly format.
219 * @return a String consisting of all the mappings in the cache
221 String prettyPrintMappings();
224 * Print all authentication keys. Used for testing, debugging and the karaf shell.
226 * @return String consisting of all mappings
231 * Cleans all cached mappings.Used for testing.
233 void cleanCachedMappings();
236 * Set cluster master status.
241 void setIsMaster(boolean isMaster);
244 * Get cluster master status.