Checkstyle: fix build due to odlparent changes
[lispflowmapping.git] / mappingservice / api / src / main / java / org / opendaylight / lispflowmapping / interfaces / mappingservice / IMappingService.java
1 /*
2  * Copyright (c) 2015 Cisco Systems, Inc.  All rights reserved.
3  *
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
7  */
8
9 package org.opendaylight.lispflowmapping.interfaces.mappingservice;
10
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;
15
16 /**
17  * Mapping Service Java API.
18  *
19  * @author Florin Coras
20  *
21  */
22
23 public interface IMappingService {
24
25     enum LookupPolicy { NB_FIRST, NB_AND_SB }
26
27     /**
28      * Add mapping.
29      *
30      * @param origin
31      *            Table where mapping should be added
32      * @param key
33      *            Key of the mapping
34      * @param siteId
35      *            Site that stores the mapping
36      * @param data
37      *            Value to be stored
38      * @param merge
39      *            Select if mappings with the same key are merged
40      */
41     void addMapping(MappingOrigin origin, Eid key, SiteId siteId, Object data, boolean merge);
42
43     /**
44      * Retrieves mapping with given origin for the provided key. The lookup policy for the key is defined in the Mapping
45      * System.
46      *
47      * @param origin
48      *            Table where the mapping should be looked up.
49      * @param key
50      *            Key to be looked up
51      * @return Returns the object found in the Mapping System or null if nothing is found.
52      */
53     Object getMapping(MappingOrigin origin, Eid key);
54
55     /**
56      * Retrieves mapping for given key.The lookup policy for the key is defined in the Mapping
57      * System.
58      *
59      * @param key
60      *            Key to be looked up
61      * @return Returns the object found in the Mapping System or null if nothing is found.
62      */
63     Object getMapping(Eid key);
64
65     /**
66      * Retrieves mapping with a Source/Dest policy. This method is meant to avoid the overhead of building
67      * LcafSourceDest addresses.
68      *
69      * @param srcKey
70      *            Source key being looked up
71      * @param dstKey
72      *            Destination key being looked up
73      * @return Returns the object found in the Mapping System or null if nothing is found.
74      */
75     Object getMapping(Eid srcKey, Eid dstKey);
76
77     /**
78      * Retrieves widest negative prefix found in the Mapping System for given key.
79      *
80      * @param key
81      *            Key being looked up
82      * @return Returns the widest negative prefix or null if nothing is found.
83      */
84     Eid getWidestNegativePrefix(Eid key);
85
86     /**
87      * Update mapping registration.
88      *
89      * @param origin
90      *            Table for mapping that should be updated
91      * @param key
92      *            The EID whose registration must be updated
93      * @param timestamp
94      *            New timestamp for the mapping
95      */
96     void updateMappingRegistration(MappingOrigin origin, Eid key, Long timestamp);
97
98     /**
99      * Remove mapping.
100      *
101      * @param origin
102      *            Table from where the mapping should be removed
103      * @param key
104      *            Key to be removed
105      */
106     void removeMapping(MappingOrigin origin, Eid key);
107
108     /**
109      * Add authentication key.
110      *
111      * @param key
112      *            The key for which the authentication key is added
113      * @param authKey
114      *            The authentication key
115      */
116     void addAuthenticationKey(Eid key, MappingAuthkey authKey);
117
118     /**
119      * Retrieve authentication key.
120      *
121      * @param key
122      *            The key for which the authentication key is being looked up.
123      * @return The authentication key.
124      */
125     MappingAuthkey getAuthenticationKey(Eid key);
126
127     /**
128      * Remove authentication key.
129      *
130      * @param key
131      *            Key for which the authentication key should be removed.
132      */
133     void removeAuthenticationKey(Eid key);
134
135     /**
136      * Generic addition of data. Not stored in MD-SAL datastore!
137      *
138      * @param origin
139      *            Table where data should be inserted
140      * @param key
141      *            The key where data should be inserted
142      * @param subKey
143      *            The subKey where data should be inserted
144      * @param data
145      *            The data to be stored
146      */
147     void addData(MappingOrigin origin, Eid key, String subKey, Object data);
148
149     /**
150      * Generic retrieval of data.
151      *
152      * @param origin
153      *            Table from where the data should be read
154      * @param key
155      *            The key where the data is stored
156      * @param subKey
157      *            The subKey where data is stored
158      * @return The data
159      */
160     Object getData(MappingOrigin origin, Eid key, String subKey);
161
162     /**
163      * Generic removal of data.
164      *
165      * @param origin
166      *            The table from where the data should be removed
167      * @param key
168      *            The key of the data to be removed
169      * @param subKey
170      *            The subKey of the data to be removed
171      */
172     void removeData(MappingOrigin origin, Eid key, String subKey);
173
174     /**
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.
177      *
178      * @param overwrite
179      *            enables or disables mapping overwrite
180      */
181     void setMappingOverwrite(boolean overwrite);
182
183     /**
184      * Configures Mapping Service mapping lookup policy option.
185      *
186      * @param policy
187      *            the policy to be activated
188      */
189     void setLookupPolicy(LookupPolicy policy);
190
191     /**
192      * Print all mappings. Used for testing, debugging and the karaf shell.
193      *
194      * @return String consisting of all mappings
195      */
196     String printMappings();
197
198     /**
199      * Cleans all cached mappings.Used for testing.
200      */
201     void cleanCachedMappings();
202 }