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.mapcache;
11 import org.opendaylight.lispflowmapping.lisp.type.MappingData;
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.XtrId;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.authkey.container.MappingAuthkey;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.MappingOrigin;
18 * Mapping System interface.
20 * @author Florin Coras
24 public interface IMappingSystem {
29 * Table where mapping should be added
33 * Mapping to be stored
35 void addMapping(MappingOrigin origin, Eid key, MappingData mapping);
38 * Generate and add a negative mapping entry originated from the southbound, and return the generated mapping.
42 * @return Returns the generated negative mapping (which is never null).
44 MappingData addNegativeMapping(Eid key);
47 * Retrieves mapping for the provided src and dst key.
50 * Source Key to be looked up
52 * Destination Key to be looked up
53 * @return Returns the mapping found in the MappingSystem or null if nothing is found.
55 MappingData getMapping(Eid src, Eid dst);
58 * Retrieves mapping for the provided dst key.
61 * Destination Key to be looked up
62 * @return Returns the mapping found in the Mapping System or null if nothing is found.
64 MappingData getMapping(Eid dst);
67 * Retrieves mapping for the provided dst key for a particular xtr id.
69 * Source Key to be looked up.
71 * Destination Key to be looked up.
73 * Xtr Id for which this look to be done. If null, this method works like
74 * regular getMapping(src, dst)
75 * @return Returns the mapping found in the simple map cache or null if nothing is found.
77 MappingData getMapping(Eid src, Eid dst, XtrId xtrId);
80 * Retrieves mapping from table for provided key.
83 * Table where mapping should be looked up
86 * @return Returns the mapping found in the cache or null if nothing is found.
88 MappingData getMapping(MappingOrigin origin, Eid key);
91 * Retrieves widest negative prefix from table for provided key.
95 * @return Returns the prefix found in the cache or null if nothing is found.
97 Eid getWidestNegativePrefix(Eid key);
100 * Refresh southbound mapping registration timestamp.
103 * The EID whose registration must be refreshed
105 * xTR-ID of the mapping to be refreshed
107 * New timestamp for the mapping
109 void refreshMappingRegistration(Eid key, XtrId xtrId, Long timestamp);
115 * Table for mapping that should be removed
120 void removeMapping(MappingOrigin origin, Eid key);
123 * Add authentication key.
126 * The key for which the authentication key is added
128 * The authentication key
130 void addAuthenticationKey(Eid key, MappingAuthkey authKey);
133 * Retrieve authentication key.
136 * The key for which the authentication key is being looked up.
137 * @return The authentication key.
139 MappingAuthkey getAuthenticationKey(Eid key);
142 * Remove authentication key.
145 * Key for which the authentication key should be removed.
147 void removeAuthenticationKey(Eid key);
154 * Table for data that should be added
156 * The key for which data is inserted
158 * The subKey where data should be inserted
160 * The data to be stored
162 void addData(MappingOrigin origin, Eid key, String subKey, Object data);
165 * Generic retrieval of data.
168 * Table from where data should be retrieved
170 * The key where the data is stored
172 * The subKey where data is stored
175 Object getData(MappingOrigin origin, Eid key, String subKey);
179 * Generic removal of data.
182 * Table from where data should be removed
184 * The key of the data to be removed
186 * The subKey of the data to be removed
188 void removeData(MappingOrigin origin, Eid key, String subKey);
191 * Returns the parent prefix for given key.
194 * The key which parent is to be returned.
195 * @return The parent perfix of a specific key.
197 Eid getParentPrefix(Eid key);
200 * Sets iterateMask. If set to true, longest prefix matching for IP keys is used.
206 void setIterateMask(boolean iterate);
209 * Configure merge policy. If set to true, mappings are merged.
211 * @param mappingMerge
214 void setMappingMerge(boolean mappingMerge);
217 * Print all mappings. Used for testing, debugging and the karaf shell.
219 * @return String consisting of all mappings
221 String printMappings();
224 * Print mappings in cache in a human friendly format.
226 * @return a String consisting of all the mappings in the cache
228 String prettyPrintMappings();
231 * Print all authentication keys. Used for testing, debugging and the karaf shell.
233 * @return String consisting of all mappings
238 * Set cluster master status.
243 void setIsMaster(boolean isMaster);
246 * Get cluster master status.