ae51774240b566f4050c502954f0df5f459d3786
[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.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid;
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.authkey.container.MappingAuthkey;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.MappingOrigin;
14
15 /**
16  * Mapping System interface.
17  *
18  * @author Florin Coras
19  *
20  */
21
22 public interface IMappingSystem {
23     /**
24      * Add mapping.
25      *
26      * @param origin
27      *            Table where mapping should be added
28      * @param key
29      *            Key of the mapping
30      * @param data
31      *            Value to be stored
32      * @param merge
33      *            Select if mappings with the same key are merged
34      */
35     void addMapping(MappingOrigin origin, Eid key, Object data, boolean merge);
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 object found in the MappingSystem or null if nothing is found.
45      */
46     Object 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 object found in the Mapping System or null if nothing is found.
54      */
55     Object getMapping(Eid dst);
56
57     /**
58      * Retrieves mapping from table for provided key.
59      *
60      * @param origin
61      *            Table where mapping should be looked up
62      * @param key
63      *            Key to be looked up
64      * @return Returns the object found in the cache or null if nothing is found.
65      */
66     Object getMapping(MappingOrigin origin, Eid key);
67
68     /**
69      * Retrieves widest negative prefix from table for provided key.
70      *
71      * @param key
72      *            Key to be looked up
73      * @return Returns the prefix found in the cache or null if nothing is found.
74      */
75     Object getWidestNegativePrefix(Eid key);
76
77     /**
78      * Update mapping registration.
79      *
80      * @param origin
81      *            Table for mapping that should be updated
82      * @param key
83      *            The EID whose registration must be updated
84      * @param timestamp
85      *            New timestamp for the mapping
86      */
87     void updateMappingRegistration(MappingOrigin origin, Eid key, Long timestamp);
88
89     /**
90      * Remove mapping.
91      *
92      * @param origin
93      *            Table for mapping that should be removed
94      * @param key
95      *            Key to be removed
96      *
97      */
98     void removeMapping(MappingOrigin origin, Eid key);
99
100     /**
101      * Add authentication key.
102      *
103      * @param key
104      *            The key for which the authentication key is added
105      * @param authKey
106      *            The authentication key
107      */
108     void addAuthenticationKey(Eid key, MappingAuthkey authKey);
109
110     /**
111      * Retrieve authentication key.
112      *
113      * @param key
114      *            The key for which the authentication key is being looked up.
115      * @return The authentication key.
116      */
117     MappingAuthkey getAuthenticationKey(Eid key);
118
119     /**
120      * Remove authentication key.
121      *
122      * @param key
123      *            Key for which the authentication key should be removed.
124      */
125     void removeAuthenticationKey(Eid key);
126
127
128     /**
129      * Add data for key.
130      *
131      * @param origin
132      *            Table for data that should be added
133      * @param key
134      *            The key for which data is inserted
135      * @param subKey
136      *            The subKey where data should be inserted
137      * @param data
138      *            The data to be stored
139      */
140     void addData(MappingOrigin origin, Eid key, String subKey, Object data);
141
142     /**
143      * Generic retrieval of data.
144      *
145      * @param origin
146      *            Table from where data should be retrieved
147      * @param key
148      *            The key where the data is stored
149      * @param subKey
150      *            The subKey where data is stored
151      * @return The data
152      */
153     Object getData(MappingOrigin origin, Eid key, String subKey);
154
155
156     /**
157      * Generic removal of data.
158      *
159      * @param origin
160      *            Table from where data should be removed
161      * @param key
162      *            The key of the data to be removed
163      * @param subKey
164      *            The subKey of the data to be removed
165      */
166     void removeData(MappingOrigin origin, Eid key, String subKey);
167
168     /**
169      * Sets iterateMask. If set to true, longest prefix matching for IP keys is used.
170      *
171      * @param iterate
172      *            Value to configure
173      *
174      */
175     void setIterateMask(boolean iterate);
176
177     /**
178      * Configure overwrite policy. If set to true, mappings are overwritten.
179      *
180      * @param overwrite
181      *            Value to configure
182      */
183     void setOverwritePolicy(boolean overwrite);
184
185     /**
186      * Print all mappings. Used for testing, debugging and the karaf shell.
187      *
188      * @return String consisting of all mappings
189      */
190     String printMappings();
191 }