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.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.SiteId;
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.MappingOrigin;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.mapping.authkey.container.MappingAuthkey;
17 * Mapping Service Java API.
19 * @author Florin Coras
23 public interface IMappingService {
25 enum LookupPolicy { NB_FIRST, NB_AND_SB }
31 * Table where mapping should be added
35 * Site that stores the mapping
39 * Select if mappings with the same key are merged
41 void addMapping(MappingOrigin origin, Eid key, SiteId siteId, Object data, boolean merge);
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 object found in the Mapping System or null if nothing is found.
53 Object 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 object found in the Mapping System or null if nothing is found.
63 Object 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 object found in the Mapping System or null if nothing is found.
75 Object 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 * Update mapping registration.
90 * Table for mapping that should be updated
92 * The EID whose registration must be updated
94 * New timestamp for the mapping
96 void updateMappingRegistration(MappingOrigin origin, Eid key, 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 * Configures Mapping Service mapping overwrite option. If set to true, mappings with the same key are overwritten,
176 * otherwise, mappings with the same key but from different xTR-IDs are all stored.
179 * enables or disables mapping overwrite
181 void setMappingOverwrite(boolean overwrite);
184 * Configures Mapping Service mapping lookup policy option.
187 * the policy to be activated
189 void setLookupPolicy(LookupPolicy policy);
192 * Print all mappings. Used for testing, debugging and the karaf shell.
194 * @return String consisting of all mappings
196 String printMappings();
199 * Cleans all cached mappings.Used for testing.
201 void cleanCachedMappings();