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;
18 * Mapping Service Java API
20 * @author Florin Coras
24 public interface IMappingService {
26 public enum LookupPolicy {NB_FIRST, NB_AND_SB}
32 * Table where mapping should be added
36 * Site that stores the mapping
40 * Select if mappings with the same key are merged
42 void addMapping(MappingOrigin origin, Eid key, SiteId siteId, Object data, boolean merge);
45 * Retrieves mapping with given origin for the provided key. The lookup policy for the key is defined in the Mapping
49 * Table where the mapping should be looked up.
52 * @return Returns the object found in the Mapping System or null if nothing is found.
54 Object getMapping(MappingOrigin origin, Eid key);
57 * Retrieves mapping for given key.The lookup policy for the key is defined in the Mapping
62 * @return Returns the object found in the Mapping System or null if nothing is found.
64 Object getMapping(Eid key);
67 * Retrieves mapping with a Source/Dest policy. This method is meant to avoid the overhead of building
68 * LcafSourceDest addresses.
71 * Source key being looked up
73 * Destination key being looked up
74 * @return Returns the object found in the Mapping System or null if nothing is found.
76 Object getMapping(Eid srcKey, Eid dstKey);
82 * Table from where the mapping should be removed
86 void removeMapping(MappingOrigin origin, Eid key);
89 * Add authentication key
92 * The key for which the authentication key is added
94 * The authentication key
96 void addAuthenticationKey(Eid key, MappingAuthkey authKey);
99 * Retrieve authentication key
102 * The key for which the authentication key is being looked up.
103 * @return The authentication key.
105 MappingAuthkey getAuthenticationKey(Eid key);
108 * Remove authentication key
111 * Key for which the authentication key should be removed.
113 void removeAuthenticationKey(Eid key);
116 * Generic addition of data. Not stored in MD-SAL datastore!
119 * Table where data should be inserted
121 * The key where data should be inserted
123 * The subKey where data should be inserted
125 * The data to be stored
127 void addData(MappingOrigin origin, Eid key, String subKey, Object data);
130 * Generic retrieval of data
133 * Table from where the data should be read
135 * The key where the data is stored
137 * The subKey where data is stored
140 Object getData(MappingOrigin origin, Eid key, String subKey);
143 * Generic removal of data
146 * The table from where the data should be removed
148 * The key of the data to be removed
150 * The subKey of the data to be removed
152 void removeData(MappingOrigin origin, Eid key, String subKey);
155 * Configures Mapping Service mapping overwrite option. If set to true, mappings with the same key are overwritten,
156 * otherwise, mappings with the same key but from different xTR-IDs are all stored
159 * enables or disables mapping overwrite
161 void setMappingOverwrite(boolean overwrite);
164 * Configures Mapping Service mapping lookup policy option.
167 * the policy to be activated
169 void setLookupPolicy(LookupPolicy policy);
172 * Print all mappings. Used for testing, debugging and the karaf shell
174 * @return String consisting of all mappings
176 String printMappings();
179 * Cleans all cached mappings.Used for testing.
181 void cleanCachedMappings();