blob: 6c9c8fcce0f180d03f3cdbc422bf28ebf0ebdab0 [file] [log] [blame]
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -08001/*
2 * Copyright 2017-present Open Networking Foundation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package org.onosproject.xran;
18
19import com.fasterxml.jackson.databind.JsonNode;
20import com.fasterxml.jackson.databind.node.ObjectNode;
21import com.google.common.collect.BiMap;
22import io.netty.channel.ChannelHandlerContext;
23import org.onosproject.store.Store;
24import org.onosproject.xran.asn1lib.api.CRNTI;
25import org.onosproject.xran.asn1lib.api.ECGI;
26import org.onosproject.xran.asn1lib.api.PCIARFCN;
27import org.onosproject.xran.impl.entities.RnibCell;
28import org.onosproject.xran.impl.entities.RnibLink;
29import org.onosproject.xran.impl.entities.RnibSlice;
30import org.onosproject.xran.impl.entities.RnibUe;
31import org.onosproject.xran.impl.identifiers.EcgiCrntiPair;
32import org.onosproject.xran.impl.identifiers.LinkId;
33
34import java.util.List;
35import java.util.Optional;
36
37/**
38 * Created by dimitris on 7/22/17.
39 */
40public interface XranStore extends Store {
41
42 // LINKS STORE
43
44 /**
45 * Get all active links.
46 *
47 * @return list of links
48 */
49 List<RnibLink> getLinks();
50
51 /**
52 * Get all links for that CELL based on ECGI.
53 *
54 * @param ecgi CELL ECGI
55 *
56 * @return list of links
57 */
58 List<RnibLink> getLinks(ECGI ecgi);
59
60 /**
61 * Get all links for that CELL based on ECI.
62 *
63 * @param eciHex HEX string of ECI
64 *
65 * @return list of links
66 */
67 List<RnibLink> getLinks(String eciHex);
68
69 /**
70 * Get all links for the UE based on UE ID.
71 *
72 * @param ueId UE ID
73 *
74 * @return list of links
75 */
76 List<RnibLink> getLinks(long ueId);
77
78 /**
79 * Get a link between a CELL and UE.
80 *
81 * @param cellId HEX string ECI
82 * @param ueId UE id
83 *
84 * @return link
85 */
86 Optional<RnibLink> getLink(String cellId, long ueId);
87
88 /**
89 * Get a link between a CELL's ECGI and UE's id.
90 *
91 * @param ecgi CELL ECGI
92 * @param ueId UE id
93 *
94 * @return link
95 */
96 Optional<RnibLink> getLink(ECGI ecgi, Long ueId);
97
98 /**
99 * Get link based on ECGI and CRNTI.
100 *
101 * @param src CELL ECGI
102 * @param dst CELL unique CRNTI
103 * @return link if found
104 */
105 Optional<RnibLink> getLink(ECGI src, CRNTI dst);
106
107 /**
108 * Modify specified link's RRM Configuration.
109 *
110 * @param link LINK entity
111 * @param rrmConf json node of RRM Configuration
112 */
113 void modifyLinkRrmConf(RnibLink link, JsonNode rrmConf);
114
115 /**
116 * Put new link to store.
117 *
118 * @param link LINK entity
119 */
120 void storeLink(RnibLink link);
121
122 /**
123 * Remove link from store.
124 *
125 * @param link LINK entity
126 *
127 * @return true if remove succeeded
128 */
129 boolean removeLink(LinkId link);
130
131 // NODES
132
133 /**
134 * Get all CELLs and UEs.
135 *
136 * @return list of UEs and CELLs
137 */
138 List<Object> getNodes();
139
140 /**
141 * Get all CELLs.
142 *
143 * @return list of CELLs
144 */
145 List<RnibCell> getCellNodes();
146
147 /**
148 * Get all UEs.
149 *
150 * @return list of UEs
151 */
152 List<RnibUe> getUeNodes();
153
154 /**
155 * Get node by node id.
156 *
157 * @param nodeId HEX string ECI or UE id
158 *
159 * @return CELL or UE
160 */
161 Optional<Object> getNode(String nodeId);
162
163 // CELL
164
165 /**
166 * Get cell based on HEX string ECI.
167 *
168 * @param eci HEX string ECI
169 *
170 * @return CELL if found
171 */
172 Optional<RnibCell> getCell(String eci);
173
174 /**
175 * Get cell based on ECGI.
176 *
177 * @param cellId CELL ECGI
178 *
179 * @return CELL if found
180 */
181 Optional<RnibCell> getCell(ECGI cellId);
182
183 /**
184 * Get cell based on PCI-ARFCN.
185 *
186 * @param id PCI-ARFCN
187 *
188 * @return CELL entity if found
189 */
190 Optional<RnibCell> getCell(PCIARFCN id);
191
192 /**
193 * Modify CELL's RRM Configuration.
194 *
195 * @param cell CELL entity
196 * @param rrmConf json node of RRM Configuration
197 *
198 * @throws Exception exception
199 */
200 void modifyCellRrmConf(RnibCell cell, JsonNode rrmConf) throws Exception;
201
202 /**
203 * Put new CELL to the store.
204 *
205 * @param cell CELL entity
206 */
207 void storeCell(RnibCell cell);
208
209 /**
210 * Remove CELL from the store.
211 *
212 * @param ecgi CELL's ECGI
213 *
214 * @return ture if remove succeeded
215 */
216 boolean removeCell(ECGI ecgi);
217
218 /**
219 * Remove cell from three maps based on PCI-ARFCN.
220 *
221 * @param pciarfcn pci-arfcn of cell to remove
222 *
223 * @return true if remove succeeded
224 */
225 boolean removeCell(PCIARFCN pciarfcn);
226
227 // SLICE
228
229 /**
230 * Get SLICE based on SLICE id.
231 *
232 * @param sliceId SLICE id
233 * @return SLICE
234 */
235 Optional<RnibSlice> getSlice(long sliceId);
236
237 /**
238 * Put new SLICE to the store.
239 *
240 * @param attributes json node of SLICE attributes
241 *
242 * @return true if put succeeded
243 */
244 boolean createSlice(ObjectNode attributes);
245
246 /**
247 * Remove SLICE based on SLICE id.
248 *
249 * @param sliceId SLICE id
250 *
251 * @return true if remove succeeded
252 */
253 boolean removeCell(long sliceId);
254
255 // CONTROLLER
256
257 /**
258 * Get the xran xranServer instance.
259 *
260 * @return xran xranServer
261 */
262 Optional<XranService> getController();
263
264 /**
265 * Set the xran xranServer instance.
266 *
267 * @param controller xran xranServer
268 */
269 void setController(XranService controller);
270
271 // UE
272
273 /**
274 * Get UE based on UE id.
275 *
276 * @param euId UE id
277 *
278 * @return UE entity
279 */
280 Optional<RnibUe> getUe(long euId);
281
282 /**
283 * Get UE based on ECGI and CRNTI.
284 *
285 * @param ecgi CELL ECGI
286 * @param crnti CELL unique CRNTI
287 *
288 * @return UE entity if found
289 */
290 Optional<RnibUe> getUe(ECGI ecgi, CRNTI crnti);
291
292 /**
293 * Put new UE to store.
294 *
295 * @param ue UE entity
296 */
297 void storeUe(RnibUe ue);
298
299 /**
300 * Put new UE to the store and update the ECGI, CRNTI pair.
301 *
302 * @param cell new primary CELL
303 * @param ue UE
304 */
305 void storeUe(RnibCell cell, RnibUe ue);
306
307 /**
308 * Remove UE from store.
309 *
310 * @param ueId UE id
311 *
312 * @return true if remove succeeded
313 */
314 boolean removeUe(long ueId);
315
316 /**
317 * Put the PCI-ARFCN to ECGI map from new cell.
318 *
319 * @param value CELL entity
320 */
321 void storePciArfcn(RnibCell value);
322
323
324 /**
325 * Put inside ECGI to CTX map.
326 *
327 * @param value CELL entity to get ECGI from
328 * @param ctx context channel
329 */
330 void storeCtx(RnibCell value, ChannelHandlerContext ctx);
331
332 /**
333 * Get context handler for specified ECGI.
334 *
335 * @param ecgi CELL ECGI
336 * @return context handler if found
337 */
338 Optional<ChannelHandlerContext> getCtx(ECGI ecgi);
339
340 /**
341 * Get the ECGI, CRNTI to UE bimap.
342 *
343 * @return BiMap of EcgiCrntiPair to Long
344 */
345 BiMap<EcgiCrntiPair, Long> getCrnti();
346
347 /**
348 * Put new ECGI, CRNTI pair of primary link to UE and remove old one.
349 *
350 * @param cell new primary CELL
351 * @param ue UE
352 */
353 void storeCrnti(RnibCell cell, RnibUe ue);
354
355 /**
356 * Put a new primary link between a CELL and a UE.
357 *
358 * @param cell CELL entity
359 * @param ue UE entity
360 */
361 void putPrimaryLink(RnibCell cell, RnibUe ue);
362
363 /**
364 * Put non-serving link based on CELL and CRNTI.
365 *
366 * @param cell CELL entity
367 * @param crnti CRNTI
368 * @return new link after creation
369 */
370 Optional<RnibLink> putNonServingLink(RnibCell cell, CRNTI crnti);
371
372 /**
373 * Put non-serving link based on CELL and UE id.
374 *
375 * @param cell CELL entity
376 * @param ueId UE id
377 * @return new link after creation
378 */
379 Optional<RnibLink> putNonServingLink(RnibCell cell, Long ueId);
380
381 /**
382 * Get CRNTI based on UE id.
383 *
384 * @param ueId UE id
385 * @return UE if found
386 */
387 Optional<CRNTI> getCrnti(Long ueId);
388
389 /**
390 * Get primary CELL for specified UE.
391 *
392 * @param ue UE entity
393 * @return primary CELL if found
394 */
395 Optional<RnibCell> getPrimaryCell(RnibUe ue);
396}