Add API yaml for ricdms
[ric-plt/ricdms.git] / api / ric-dms-api.yaml
1 # ==================================================================================
2 #   Copyright (c) 2021 Samsung.
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 #   This source code is part of the near-RT RIC (RAN Intelligent Controller)
17 #   platform project (RICP).
18 # ==================================================================================
19
20 openapi: 3.0.1
21 info:
22   title: RIC DMS API
23   description: APIs for RIC-DMS
24   version: "1.0"
25 servers:
26 - url: /api/v1
27 tags:
28 - name: onboard
29   description: onboard xApps
30 - name: health
31   description: health check
32 - name: charts
33   description: Managing helm charts
34 - name: deploy
35   description: Managing deployment
36 paths:
37   /charts:
38     get:
39       tags:
40       - charts
41       summary: Returns the list of xApp helm charts that have been onboarded
42       operationId: get_charts_list
43       responses:
44         200:
45           description: Get helm chart list
46           content:
47             application/json:
48               schema:
49                 type: object
50         500:
51           description: Get helm chart list failed
52           content:
53             application/json:
54               schema:
55                 $ref: '#/components/schemas/error_message'
56
57   /charts/xApp/{xApp_name}:
58     get:
59       tags:
60       - charts
61       summary: Returns the helm chart for the specified xApp
62       operationId: get_chart
63       parameters:
64       - name: xApp_name
65         in: path
66         required: true
67         schema:
68           type: string
69       responses:
70         200:
71           description: Get helm chart
72           content:
73             application/json:
74               schema:
75                 type: object
76         500:
77           description: Get helm chart failed
78           content:
79             application/json:
80               schema:
81                 $ref: '#/components/schemas/error_message'
82
83   /charts/xApp/{xApp_name}/ver/{version}:
84     get:
85       tags:
86       - charts
87       summary: get the helm chart for the specified xApp and version
88       operationId: get_charts_fetcher
89       parameters:
90       - name: xApp_name
91         in: path
92         required: true
93         schema:
94           type: string
95       - name: version
96         in: path
97         required: true
98         schema:
99           type: string
100       responses:
101         200:
102           description: Get helm chart package OK
103           content:
104             application/json:
105               schema:
106                 type: object
107         500:
108           description: Get helm chart package failed
109           content:
110             application/gzip:
111               schema:
112                 $ref: '#/components/schemas/error_message'
113     delete:
114       tags:
115       - charts
116       summary: Delete helm chart for the specified xApp and version
117       operationId: delete_chart
118       parameters:
119       - name: xApp_name
120         in: path
121         required: true
122         schema:
123           type: string
124       - name: version
125         in: path
126         required: true
127         schema:
128           type: string
129       responses:
130         200:
131           description: Deleted specified helm chart
132           content:
133             application/json:
134               schema:
135                 type: object
136         500:
137           description: Delete helm chart failed
138           content:
139             application/gzip:
140               schema:
141                 $ref: '#/components/schemas/error_message'
142
143   /charts/xApp/download/{xApp_name}/ver/{version}:
144     get:
145       tags:
146       - charts
147       summary: Download helm chart
148       description: Download helm chart.
149       operationId: download_helm_chart
150       parameters:
151       - name: xApp_name
152         in: path
153         required: true
154         schema:
155           type: string
156       - name: version
157         in: path
158         required: true
159         schema:
160           type: string
161       responses:
162         200:
163           description: Download helm chart OK
164           content:
165             application/zip:
166               schema:
167                 type: string
168                 format: binary
169         500:
170           description: Get helm chart values.yaml failed
171           content:
172             text/json:
173               schema:
174                 $ref: '#/components/schemas/error_message'
175
176   /charts/xApp/{xApp_name}/ver/{version}/values.yaml:
177     get:
178       tags:
179       - charts
180       summary: Returns the helm values
181       description: yaml file of the specified xApp and version.
182       operationId: get_values_yaml_fetcher
183       parameters:
184       - name: xApp_name
185         in: path
186         required: true
187         schema:
188           type: string
189       - name: version
190         in: path
191         required: true
192         schema:
193           type: string
194       responses:
195         200:
196           description: Get helm chart values.yaml OK
197           content:
198             application/json:
199               schema:
200                 type: object
201         500:
202           description: Get helm chart values.yaml failed
203           content:
204             text/json:
205               schema:
206                 $ref: '#/components/schemas/error_message'
207
208   /health:
209     get:
210       tags:
211       - health
212       summary: Returns the health condition of ric dms
213       operationId: get_health_check
214       responses:
215         200:
216           description: Health check OK
217           content:
218             application/json:
219               schema:
220                 $ref: '#/components/schemas/status'
221         500:
222           description: ric-dms is not ready
223           content:
224             application/json:
225               schema:
226                 $ref: '#/components/schemas/error_message'
227
228   /healthcheck/xApp/{xApp_name}/namespace/{namespace}:
229     get:
230       tags:
231       - health
232       summary: Return status of xApp deployment
233       parameters:
234         - name: xApp_name
235           in: path
236           required: true
237           schema:
238             type: string
239         - name: namespace
240           in: path
241           required: true
242           schema:
243             type: string
244       responses:
245         200:
246           description: Health check OK
247           content:
248             application/json:
249               schema:
250                 $ref: '#/components/schemas/status'
251         500:
252           description: xApp onboarder is not ready
253           content:
254             application/json:
255               schema:
256                 $ref: '#/components/schemas/error_message'
257
258   /onboarder:
259     post:
260       tags:
261       - onboard
262       summary: Onboard xApp using the xApp descriptor and schema or URL of descriptor and schema.
263       operationId: post_onboardx_apps
264       requestBody:
265         content:
266           application/json:
267             schema:
268               $ref: '#/components/schemas/descriptor'
269         required: true
270       responses:
271         201:
272           description: xApp onboard successfully.
273           content:
274             application/json:
275               schema:
276                 $ref: '#/components/schemas/status'
277         400:
278           description: xApp descriptor format error
279           content:
280             application/json:
281               schema:
282                 $ref: '#/components/schemas/error_message'
283         500:
284           description: xApp onboarder is not ready
285           content:
286             application/json:
287               schema:
288                 $ref: '#/components/schemas/error_message'
289       x-codegen-request-body-name: payload
290     delete:
291       tags:
292       - onboard
293       summary: offload xApp using the xApp name and version
294       operationId: delete_onboardx_apps
295       requestBody:
296         content:
297           application/json:
298             schema:
299               type: object
300               required:
301                 - appname
302               properties:
303                 appname:
304                   type: string
305                 version:
306                   type: string
307       responses:
308         201:
309           description: xApp onboard successfully.
310           content:
311             application/json:
312               schema:
313                 $ref: '#/components/schemas/status'
314         400:
315           description: xApp descriptor format error
316           content:
317             application/json:
318               schema:
319                 $ref: '#/components/schemas/error_message'
320         500:
321           description: xApp onboarder is not ready
322           content:
323             application/json:
324               schema:
325                 $ref: '#/components/schemas/error_message'
326       x-codegen-request-body-name: payload
327
328   /deploy:
329     post:
330       tags:
331       - deploy
332       summary: deploy xApp
333       requestBody:
334         description: Input for the xApp deployment
335         required: true
336         content:
337           application/json:
338             schema:
339               $ref: '#/components/schemas/deploymentDesc'
340       responses:
341         201:
342           description: successful deployment of xApp
343           content:
344             application/json:
345               schema:
346                 type: object
347         501:
348           description: deployment failed
349           content:
350             application/json:
351               schema:
352                 $ref: '#/components/schemas/error_message'
353
354     put:
355       tags:
356       - deploy
357       summary: update xApp
358       requestBody:
359         description: Input for the xApp deploy
360         required: true
361         content:
362           application/json:
363             schema:
364               $ref: '#/components/schemas/updateDeploymentDesc'
365
366       responses:
367         201:
368           description: successful updated xApp
369           content:
370             application/json:
371               schema:
372                 type: object
373         501:
374           description: un-deployment failed
375           content:
376             application/json:
377               schema:
378                 $ref: '#/components/schemas/error_message'
379     delete:
380       tags:
381       - deploy
382       summary: Undeploy xApp
383       requestBody:
384         description: Input for the xApp deploy
385         required: true
386         content:
387           application/json:
388             schema:
389               $ref: '#/components/schemas/deleteDeploymentDesc'
390       responses:
391         201:
392           description: successful un-deploy xApp
393           content:
394             application/json:
395               schema:
396                 type: object
397         501:
398           description: un-deployment failed
399           content:
400             application/json:
401               schema:
402                 $ref: '#/components/schemas/error_message'
403
404
405
406 components:
407   schemas:
408     name:
409       type: object
410       properties:
411         property:
412           type: integer
413     descriptor:
414       type: object
415       properties:
416         config:
417           type: string
418           description: represents content of config file for xApp onboarding.
419         schema:
420           type: string
421           description: represents conent of schema file for xApp onboarding.
422         config-file_url:
423           type: string
424           description: specify url of config-file.
425         schema-file_url:
426           type: string
427           description: specify url of schema-file.
428
429     deploymentDesc:
430       required:
431       - namespace
432       type: object
433       properties:
434         xAppname:
435           type: string
436         version:
437            type: string
438         namespace:
439           type: string
440           description: namespace to deploy xApp
441         overridefile:
442           type: string
443           description: override file
444
445     updateDeploymentDesc:
446       required:
447       - namespace
448       type: object
449       properties:
450         xAppname:
451           type: string
452         oldVersion:
453           type: string
454         newVersion:
455           type: string
456         namespace:
457           type: string
458           description: namespace to deploy xApp
459         operation:
460           type: string
461           enum:
462           - rollback
463           - upgrade
464
465     deleteDeploymentDesc:
466       required:
467       - xAppname
468       - version
469       type: object
470       properties:
471         xAppname:
472           type: string
473         version:
474           type: string
475         namespace:
476           type: string
477           description: namespace to deploy xApp
478
479     error_message:
480       required:
481       - error_message
482       - error_source
483       - status
484       type: object
485       properties:
486         error_source:
487           type: string
488           description: source of the error
489         error_message:
490           type: string
491           description: source of the error
492         status:
493           type: string
494           description: http response message
495     status:
496       required:
497       - status
498       type: object
499       properties:
500         status:
501           type: string
502           description: status of the service
503