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;
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.XtrId;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.authkey.container.MappingAuthkey;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.MappingOrigin;
20 * Mapping System interface.
22 * @author Florin Coras
26 public interface IMappingSystem {
31 * Table where mapping should be added
35 * Mapping to be stored
37 void addMapping(MappingOrigin origin, Eid key, MappingData mapping);
40 * Generate and add a negative mapping entry originated from the southbound, and return the generated mapping.
44 * @return Returns the generated negative mapping (which is never null).
46 MappingData addNegativeMapping(Eid key);
49 * Retrieves mapping for the provided src and dst key.
52 * Source Key to be looked up
54 * Destination Key to be looked up
55 * @return Returns the mapping found in the MappingSystem or null if nothing is found.
57 MappingData getMapping(Eid src, Eid dst);
60 * Retrieves mapping for the provided dst key.
63 * Destination Key to be looked up
64 * @return Returns the mapping found in the Mapping System or null if nothing is found.
66 MappingData getMapping(Eid dst);
69 * Retrieves mapping for the provided dst key for a particular xtr id.
71 * Source Key to be looked up.
73 * Destination Key to be looked up.
75 * Xtr Id for which this look to be done. If null, this method works like
76 * regular getMapping(src, dst)
77 * @return Returns the mapping found in the simple map cache or null if nothing is found.
79 MappingData getMapping(Eid src, Eid dst, XtrId xtrId);
82 * Retrieves mapping from table for provided key.
85 * Table where mapping should be looked up
88 * @return Returns the mapping found in the cache or null if nothing is found.
90 MappingData getMapping(MappingOrigin origin, Eid key);
93 * Retrieves widest negative prefix from table for provided key.
97 * @return Returns the prefix found in the cache or null if nothing is found.
99 Eid getWidestNegativePrefix(Eid key);
102 * Refresh southbound mapping registration timestamp.
105 * The EID whose registration must be refreshed
107 * xTR-ID of the mapping to be refreshed
109 * New timestamp for the mapping
111 void refreshMappingRegistration(Eid key, XtrId xtrId, Long timestamp);
117 * Table for mapping that should be removed
122 void removeMapping(MappingOrigin origin, Eid key);
125 * Subscribe a Subscriber to receive updates about mapping changes for an EID.
128 * The Subscriber object with information about the subscriber
129 * @param subscribedEid
130 * The EID for which the subscriber will receive updates
132 void subscribe(Subscriber subscriber, Eid subscribedEid);
135 * Retrieves the subscribers for an EID.
138 * The EID to be looked up
140 * The set of subscribers for the EID
142 Set<Subscriber> getSubscribers(Eid eid);
145 * Add authentication key.
148 * The key for which the authentication key is added
150 * The authentication key
152 void addAuthenticationKey(Eid key, MappingAuthkey authKey);
155 * Retrieve authentication key.
158 * The key for which the authentication key is being looked up.
159 * @return The authentication key.
161 MappingAuthkey getAuthenticationKey(Eid key);
164 * Remove authentication key.
167 * Key for which the authentication key should be removed.
169 void removeAuthenticationKey(Eid key);
176 * Table for data that should be added
178 * The key for which data is inserted
180 * The subKey where data should be inserted
182 * The data to be stored
184 void addData(MappingOrigin origin, Eid key, String subKey, Object data);
187 * Generic retrieval of data.
190 * Table from where data should be retrieved
192 * The key where the data is stored
194 * The subKey where data is stored
197 Object getData(MappingOrigin origin, Eid key, String subKey);
201 * Generic removal of data.
204 * Table from where data should be removed
206 * The key of the data to be removed
208 * The subKey of the data to be removed
210 void removeData(MappingOrigin origin, Eid key, String subKey);
213 * Returns the parent prefix for given key.
216 * The key which parent is to be returned.
217 * @return The parent perfix of a specific key.
219 Eid getParentPrefix(Eid key);
222 * Sets iterateMask. If set to true, longest prefix matching for IP keys is used.
228 void setIterateMask(boolean iterate);
231 * Configure merge policy. If set to true, mappings are merged.
233 * @param mappingMerge
236 void setMappingMerge(boolean mappingMerge);
239 * Print all mappings. Used for testing, debugging and the karaf shell.
241 * @return String consisting of all mappings
243 String printMappings();
246 * Print mappings in cache in a human friendly format.
248 * @return a String consisting of all the mappings in the cache
250 String prettyPrintMappings();
253 * Print all authentication keys. Used for testing, debugging and the karaf shell.
255 * @return String consisting of all mappings
260 * Print keys in cache in a human friendly format.
262 * @return a String consisting of all the keys in the cache
264 String prettyPrintKeys();
267 * Set cluster master status.
272 void setIsMaster(boolean isMaster);
275 * Get cluster master status.