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);
52 * Table where mapping should be added
56 * Mapping to be stored
58 void updateMapping(MappingOrigin origin, Eid key, MappingData mapping);
61 * Retrieves mapping for the provided src and dst key.
64 * Source Key to be looked up
66 * Destination Key to be looked up
67 * @return Returns the mapping found in the MappingSystem or null if nothing is found.
69 MappingData getMapping(Eid src, Eid dst);
72 * Retrieves mapping for the provided dst key.
75 * Destination Key to be looked up
76 * @return Returns the mapping found in the Mapping System or null if nothing is found.
78 MappingData getMapping(Eid dst);
81 * Retrieves mapping for the provided dst key for a particular xtr id.
83 * Source Key to be looked up.
85 * Destination Key to be looked up.
87 * Xtr Id for which this look to be done. If null, this method works like
88 * regular getMapping(src, dst)
89 * @return Returns the mapping found in the simple map cache or null if nothing is found.
91 MappingData getMapping(Eid src, Eid dst, XtrId xtrId);
94 * Retrieves mapping from table for provided key.
97 * Table where mapping should be looked up
100 * @return Returns the mapping found in the cache or null if nothing is found.
102 MappingData getMapping(MappingOrigin origin, Eid key);
105 * Retrieves widest negative prefix from table for provided key.
108 * Key to be looked up
109 * @return Returns the prefix found in the cache or null if nothing is found.
111 Eid getWidestNegativePrefix(Eid key);
114 * Retrieves the subtree of a maskable prefix from the given map-cache.
117 * Table where the key should be looked up
119 * Key to be looked up
120 * @return The child prefixes of the prefix, including the prefix itself if present
122 Set<Eid> getSubtree(MappingOrigin origin, Eid key);
125 * Refresh southbound mapping registration timestamp.
128 * The EID whose registration must be refreshed
130 * xTR-ID of the mapping to be refreshed
132 * New timestamp for the mapping
134 void refreshMappingRegistration(Eid key, XtrId xtrId, Long timestamp);
140 * Table for mapping that should be removed
145 void removeMapping(MappingOrigin origin, Eid key);
148 * Subscribe a Subscriber to receive updates about mapping changes for an EID.
151 * The Subscriber object with information about the subscriber
152 * @param subscribedEid
153 * The EID for which the subscriber will receive updates
155 void subscribe(Subscriber subscriber, Eid subscribedEid);
158 * Retrieves the subscribers for an EID.
161 * The EID to be looked up
163 * The set of subscribers for the EID
165 Set<Subscriber> getSubscribers(Eid eid);
168 * Add authentication key.
171 * The key for which the authentication key is added
173 * The authentication key
175 void addAuthenticationKey(Eid key, MappingAuthkey authKey);
178 * Retrieve authentication key.
181 * The key for which the authentication key is being looked up.
182 * @return The authentication key.
184 MappingAuthkey getAuthenticationKey(Eid key);
187 * Remove authentication key.
190 * Key for which the authentication key should be removed.
192 void removeAuthenticationKey(Eid key);
199 * Table for data that should be added
201 * The key for which data is inserted
203 * The subKey where data should be inserted
205 * The data to be stored
207 void addData(MappingOrigin origin, Eid key, String subKey, Object data);
210 * Generic retrieval of data.
213 * Table from where data should be retrieved
215 * The key where the data is stored
217 * The subKey where data is stored
220 Object getData(MappingOrigin origin, Eid key, String subKey);
224 * Generic removal of data.
227 * Table from where data should be removed
229 * The key of the data to be removed
231 * The subKey of the data to be removed
233 void removeData(MappingOrigin origin, Eid key, String subKey);
236 * Returns the parent prefix for given key.
239 * The key which parent is to be returned.
240 * @return The parent perfix of a specific key.
242 Eid getParentPrefix(Eid key);
245 * Sets iterateMask. If set to true, longest prefix matching for IP keys is used.
251 void setIterateMask(boolean iterate);
254 * Configure merge policy. If set to true, mappings are merged.
256 * @param mappingMerge
259 void setMappingMerge(boolean mappingMerge);
262 * Print all mappings. Used for testing, debugging and the karaf shell.
264 * @return String consisting of all mappings
266 String printMappings();
269 * Print mappings in cache in a human friendly format.
271 * @return a String consisting of all the mappings in the cache
273 String prettyPrintMappings();
276 * Print all authentication keys. Used for testing, debugging and the karaf shell.
278 * @return String consisting of all mappings
283 * Print keys in cache in a human friendly format.
285 * @return a String consisting of all the keys in the cache
287 String prettyPrintKeys();
290 * Set cluster master status.
295 void setIsMaster(boolean isMaster);
298 * Get cluster master status.