2 * Copyright (c) 2015 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 * Retrieves mapping with given origin for the provided key. The lookup policy for the key is defined in the Mapping
48 * Table where the mapping should be looked up.
51 * @return Returns the mapping found in the Mapping System or null if nothing is found.
53 MappingData getMapping(MappingOrigin origin, Eid key);
56 * Retrieves mapping for given key.The lookup policy for the key is defined in the Mapping
61 * @return Returns the mapping found in the Mapping System or null if nothing is found.
63 MappingData getMapping(Eid key);
66 * Retrieves mapping with a Source/Dest policy. This method is meant to avoid the overhead of building
67 * LcafSourceDest addresses.
70 * Source key being looked up
72 * Destination key being looked up
73 * @return Returns the mapping found in the Mapping System or null if nothing is found.
75 MappingData getMapping(Eid srcKey, Eid dstKey);
78 * Retrieves widest negative prefix found in the Mapping System for given key.
82 * @return Returns the widest negative prefix or null if nothing is found.
84 Eid getWidestNegativePrefix(Eid key);
87 * Refresh southbound mapping registration timestamp.
90 * The EID whose registration must be refreshed
92 * xTR-ID of the mapping to be refreshed
94 * New timestamp for the mapping
96 void refreshMappingRegistration(Eid key, XtrId xtrId, Long timestamp);
102 * Table from where the mapping should be removed
106 void removeMapping(MappingOrigin origin, Eid key);
109 * Add authentication key.
112 * The key for which the authentication key is added
114 * The authentication key
116 void addAuthenticationKey(Eid key, MappingAuthkey authKey);
119 * Retrieve authentication key.
122 * The key for which the authentication key is being looked up.
123 * @return The authentication key.
125 MappingAuthkey getAuthenticationKey(Eid key);
128 * Remove authentication key.
131 * Key for which the authentication key should be removed.
133 void removeAuthenticationKey(Eid key);
136 * Generic addition of data. Not stored in MD-SAL datastore!
139 * Table where data should be inserted
141 * The key where data should be inserted
143 * The subKey where data should be inserted
145 * The data to be stored
147 void addData(MappingOrigin origin, Eid key, String subKey, Object data);
150 * Generic retrieval of data.
153 * Table from where the data should be read
155 * The key where the data is stored
157 * The subKey where data is stored
160 Object getData(MappingOrigin origin, Eid key, String subKey);
163 * Generic removal of data.
166 * The table from where the data should be removed
168 * The key of the data to be removed
170 * The subKey of the data to be removed
172 void removeData(MappingOrigin origin, Eid key, String subKey);
175 * Returns the parent prefix for given key.
178 * The key which parent is to be returned.
179 * @return The parent perfix of a specific key.
181 Eid getParentPrefix(Eid key);
184 * Configures Mapping Service mapping merge option. If set to false, mappings with the same key are overwritten,
185 * otherwise, mappings with the same key but from different xTR-IDs are all stored.
187 * @param mappingMerge
188 * enables or disables mapping merge
190 void setMappingMerge(boolean mappingMerge);
193 * Configures Mapping Service mapping lookup policy option.
196 * the policy to be activated
198 void setLookupPolicy(LookupPolicy policy);
201 * Print all mappings. Used for testing, debugging and the karaf shell.
203 * @return String consisting of all mappings
205 String printMappings();
208 * Print all authentication keys. Used for testing, debugging and the karaf shell.
210 * @return String consisting of all mappings
215 * Cleans all cached mappings.Used for testing.
217 void cleanCachedMappings();
220 * Set cluster master status.
225 void setIsMaster(final boolean isMaster);
228 * Get cluster master status.