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.mappingservice.rev150906.MappingOrigin;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.mapping.authkey.container.MappingAuthkey;
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 */
33 void addMapping(MappingOrigin origin, Eid key, Object data);
34
35 /**
36 * Retrieves mapping for the provided src and dst key.
37 *
38 * @param src
39 * Source Key to be looked up
40 * @param dst
41 * Destination Key to be looked up
42 * @return Returns the object found in the MappingSystem or null if nothing is found.
43 */
44 Object getMapping(Eid src, Eid dst);
45
46 /**
47 * Retrieves mapping for the provided dst key.
48 *
49 * @param dst
50 * Destination 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(Eid dst);
54
55 /**
56 * Retrieves mapping from table for provided key
57 *
58 * @param origin
59 * Table where mapping should be looked up
60 * @param key
61 * Key to be looked up
62 * @return Returns the object found in the cache or null if nothing is found.
63 */
64 Object getMapping(MappingOrigin origin, Eid key);
65
66 /**
67 * Update key registration
68 *
69 * @param origin
70 * Table for mapping that should be updated
71 * @param key
72 * The key whose registration must be updated
73 */
74 void updateMappingRegistration(MappingOrigin origin, Eid key);
75
76 /**
77 * Remove mapping
78 *
79 * @param origin
80 * Table for mapping that should be removed
81 * @param key
82 * Key to be removed
83 *
84 */
85 void removeMapping(MappingOrigin origin, Eid key);
86
87 /**
88 * Add authentication key
89 *
90 * @param key
91 * The key for which the authentication key is added
92 * @param authKey
93 * The authentication key
94 */
95 void addAuthenticationKey(Eid key, MappingAuthkey authKey);
96
97 /**
98 * Retrieve authentication key
99 *
100 * @param key
101 * The key for which the authentication key is being looked up.
102 * @return The authentication key.
103 */
104 MappingAuthkey getAuthenticationKey(Eid key);
105
106 /**
107 * Remove authentication key
108 *
109 * @param key
110 * Key for which the authentication key should be removed.
111 */
112 void removeAuthenticationKey(Eid key);
113
114
115 /**
116 * Add data for key
117 *
118 * @param origin
119 * Table for data that should be added
120 * @param key
121 * The key for which data is inserted
122 * @param subKey
123 * The subKey where data should be inserted
124 * @param data
125 * The data to be stored
126 */
127 void addData(MappingOrigin origin, Eid key, String subKey, Object data);
128
129 /**
130 * Generic retrieval of data
131 *
132 * @param origin
133 * Table from where data should be retrieved
134 * @param key
135 * The key where the data is stored
136 * @param subKey
137 * The subKey where data is stored
138 * @return The data
139 */
140 Object getData(MappingOrigin origin, Eid key, String subKey);
141
142
143 /**
144 * Generic removal of data
145 *
146 * @param origin
147 * Table from where data should be removed
148 * @param key
149 * The key of the data to be removed
150 * @param subKey
151 * The subKey of the data to be removed
152 */
153 void removeData(MappingOrigin origin, Eid key, String subKey);
154
155 /**
156 * Sets iterateMask. If set to true, longest prefix matching for IP keys is used.
157 *
158 * @param iterate
159 * Value to configure
160 *
161 */
162 void setIterateMask(boolean iterate);
163
164 /**
165 * Configure overwrite policy. If set to true, mappings are overwritten.
166 *
167 * @param overwrite
168 * Value to configure
169 */
170 public void setOverwritePolicy(boolean overwrite);
171
172 /**
173 * Print all mappings. Used for testing, debugging and the karaf shell
174 *
175 * @return String consisting of all mappings
176 */
177 String printMappings();
178 }