Merge "Remove overwrite configuration and convert it to mapping merge configuration"
[lispflowmapping.git] / mappingservice / api / src / main / java / org / opendaylight / lispflowmapping / interfaces / mapcache / IMappingSystem.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.mapcache;
10
11 import org.opendaylight.lispflowmapping.lisp.type.MappingData;
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.XtrId;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.authkey.container.MappingAuthkey;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.MappingOrigin;
16
17 /**
18  * Mapping System interface.
19  *
20  * @author Florin Coras
21  *
22  */
23
24 public interface IMappingSystem {
25     /**
26      * Add mapping.
27      *
28      * @param origin
29      *            Table where mapping should be added
30      * @param key
31      *            Key of the mapping
32      * @param mapping
33      *            Mapping to be stored
34      */
35     void addMapping(MappingOrigin origin, Eid key, MappingData mapping);
36
37     /**
38      * Retrieves mapping for the provided src and dst key.
39      *
40      * @param src
41      *            Source Key to be looked up
42      * @param dst
43      *            Destination Key to be looked up
44      * @return Returns the mapping found in the MappingSystem or null if nothing is found.
45      */
46     MappingData getMapping(Eid src, Eid dst);
47
48     /**
49      * Retrieves mapping for the provided dst key.
50      *
51      * @param dst
52      *            Destination Key to be looked up
53      * @return Returns the mapping found in the Mapping System or null if nothing is found.
54      */
55     MappingData getMapping(Eid dst);
56
57     /**
58      * Retrieves mapping for the provided dst key for a particular xtr id.
59      * @param src
60      *            Source Key to be looked up.
61      * @param dst
62      *            Destination Key to be looked up.
63      * @param xtrId
64      *            Xtr Id for which this look to be done. If null, this method works like
65      *            regular getMapping(src, dst)
66      * @return Returns the mapping found in the simple map cache or null if nothing is found.
67      */
68     MappingData getMapping(Eid src, Eid dst, XtrId xtrId);
69
70     /**
71      * Retrieves mapping from table for provided key.
72      *
73      * @param origin
74      *            Table where mapping should be looked up
75      * @param key
76      *            Key to be looked up
77      * @return Returns the mapping found in the cache or null if nothing is found.
78      */
79     MappingData getMapping(MappingOrigin origin, Eid key);
80
81     /**
82      * Retrieves widest negative prefix from table for provided key.
83      *
84      * @param key
85      *            Key to be looked up
86      * @return Returns the prefix found in the cache or null if nothing is found.
87      */
88     Eid getWidestNegativePrefix(Eid key);
89
90     /**
91      * Refresh southbound mapping registration timestamp.
92      *
93      * @param key
94      *            The EID whose registration must be refreshed
95      * @param xtrId
96      *            xTR-ID of the mapping to be refreshed
97      * @param timestamp
98      *            New timestamp for the mapping
99      */
100     void refreshMappingRegistration(Eid key, XtrId xtrId, Long timestamp);
101
102     /**
103      * Remove mapping.
104      *
105      * @param origin
106      *            Table for mapping that should be removed
107      * @param key
108      *            Key to be removed
109      *
110      */
111     void removeMapping(MappingOrigin origin, Eid key);
112
113     /**
114      * Add authentication key.
115      *
116      * @param key
117      *            The key for which the authentication key is added
118      * @param authKey
119      *            The authentication key
120      */
121     void addAuthenticationKey(Eid key, MappingAuthkey authKey);
122
123     /**
124      * Retrieve authentication key.
125      *
126      * @param key
127      *            The key for which the authentication key is being looked up.
128      * @return The authentication key.
129      */
130     MappingAuthkey getAuthenticationKey(Eid key);
131
132     /**
133      * Remove authentication key.
134      *
135      * @param key
136      *            Key for which the authentication key should be removed.
137      */
138     void removeAuthenticationKey(Eid key);
139
140
141     /**
142      * Add data for key.
143      *
144      * @param origin
145      *            Table for data that should be added
146      * @param key
147      *            The key for which data is inserted
148      * @param subKey
149      *            The subKey where data should be inserted
150      * @param data
151      *            The data to be stored
152      */
153     void addData(MappingOrigin origin, Eid key, String subKey, Object data);
154
155     /**
156      * Generic retrieval of data.
157      *
158      * @param origin
159      *            Table from where data should be retrieved
160      * @param key
161      *            The key where the data is stored
162      * @param subKey
163      *            The subKey where data is stored
164      * @return The data
165      */
166     Object getData(MappingOrigin origin, Eid key, String subKey);
167
168
169     /**
170      * Generic removal of data.
171      *
172      * @param origin
173      *            Table from where data should be removed
174      * @param key
175      *            The key of the data to be removed
176      * @param subKey
177      *            The subKey of the data to be removed
178      */
179     void removeData(MappingOrigin origin, Eid key, String subKey);
180
181     /**
182      * Sets iterateMask. If set to true, longest prefix matching for IP keys is used.
183      *
184      * @param iterate
185      *            Value to configure
186      *
187      */
188     void setIterateMask(boolean iterate);
189
190     /**
191      * Configure merge policy. If set to true, mappings are merged.
192      *
193      * @param mappingMerge
194      *            Value to configure
195      */
196     void setMappingMerge(boolean mappingMerge);
197
198     /**
199      * Print all mappings. Used for testing, debugging and the karaf shell.
200      *
201      * @return String consisting of all mappings
202      */
203     String printMappings();
204
205     /**
206      * Set cluster master status.
207      *
208      * @param isMaster
209      *            is|isn't master
210      */
211     void setIsMaster(final boolean isMaster);
212
213     /**
214      * Get cluster master status.
215      *
216      * @return isMaster
217      *            is|isn't master
218      */
219     boolean isMaster();
220 }