Add a new API to return the list of undeployed xApps
[ric-plt/appmgr.git] / api / appmgr_rest_api.yaml
1 swagger: '2.0'
2 info:
3   description: This is a draft API for RIC appmgr
4   version: 0.1.5
5   title: RIC appmgr
6   license:
7     name: Apache 2.0
8     url: 'http://www.apache.org/licenses/LICENSE-2.0.html'
9 host: hostname
10 basePath: /ric/v1
11 schemes:
12   - http
13 paths:
14   /health/alive :
15     get :
16       summary     : Health check of xApp Manager - Liveness probe
17       tags        : 
18         - health
19       operationId : getHealthAlive
20       responses   :
21         '200' :
22           description : Status of xApp Manager is ok
23   /health/ready :
24     get :
25       summary     : Readiness check of xApp Manager - Readiness probe
26       tags        : 
27         - health
28       operationId : getHealthReady
29       responses   :
30         '200':
31           description : xApp Manager is ready for service
32         '503':
33           description: xApp Manager is not ready for service
34   /xapps:
35     post:
36       summary: Deploy a xapp
37       tags:
38         - xapp
39       operationId: deployXapp
40       consumes:
41         - application/json
42       produces:
43         - application/json
44       parameters:
45         - name: xAppInfo
46           in: body
47           description: xApp information
48           schema:
49             type: object
50             required:
51               - name
52             properties:
53               name:
54                 type: string
55                 description: Name of the xApp.
56                 example: xapp-dummy
57               configName:
58                 type: string
59                 description: Name of the xApp configmap. Overrides the value given in Helm chart value file.
60                 example: xapp-dummy-configmap
61               namespace:
62                 type: string
63                 description: Name of the namespace to which xApp is deployed. Overrides the value given in Helm chart value file.
64                 example: ricxapps
65               serviceName:
66                 type: string
67                 description: Name of the service xApp is providing. Overrides the value given in Helm chart value file.
68                 example: xapp-dummy-service
69               imageRepo:
70                 type: string
71                 description: Name of the docker repository xApp is located. Overrides the value given in Helm chart value file.
72                 example: xapprepo
73               hostname:
74                 type: string
75                 description: Hostname for the pod. Used by messaging library. Overrides the value given in Helm chart value file.
76                 example: xapp-dummy
77       responses:
78         '201':
79           description: xApp successfully created
80           schema:
81             $ref: '#/definitions/Xapp'
82         '400':
83           description: Invalid input
84         '500':
85           description: Internal error
86     get:
87       summary: Returns the status of all xapps
88       tags:
89         - xapp
90       operationId: getAllXapps
91       produces:
92         - application/json
93       responses:
94         '200':
95           description: successful query of xApps
96           schema:
97             $ref: '#/definitions/AllDeployedXapps'
98         '500':
99           description: Internal error
100   '/xapps/list':
101     get:
102       summary: Returns the list of all deployable xapps
103       tags:
104         - xapp
105       operationId: listAllXapps
106       produces:
107         - application/json
108       responses:
109         '200':
110           description: successful list of deployable xApps
111           schema:
112             $ref: '#/definitions/AllDeployableXapps'
113         '500':
114           description: Internal error
115   '/xapps/{xAppName}':
116     get:
117       summary: Returns the status of a given xapp
118       tags:
119         - xapp
120       operationId: getXappByName
121       produces:
122         - application/json
123       parameters:
124         - name: xAppName
125           in: path
126           description: Name of xApp
127           required: true
128           type: string
129       responses:
130         '200':
131           description: successful operation
132           schema:
133             $ref: '#/definitions/Xapp'
134         '400':
135           description: Invalid ID supplied
136         '404':
137           description: Xapp not found
138         '500':
139           description: Internal error
140     delete:
141       summary: Undeploy an existing xapp
142       tags:
143         - xapp
144       operationId: undeployXapp
145       parameters:
146         - name: xAppName
147           in: path
148           description: Xapp to be undeployed
149           required: true
150           type: string
151       responses:
152         '204':
153           description: Successful deletion of xApp
154         '400':
155           description: Invalid xApp name supplied
156         '500':
157           description: Internal error
158   '/xapps/{xAppName}/instances/{xAppInstanceName}':
159     get:
160       summary: Returns the status of a given xapp
161       tags:
162         - xapp
163       operationId: getXappInstanceByName
164       produces:
165         - application/json
166       parameters:
167         - name: xAppName
168           in: path
169           description: Name of xApp
170           required: true
171           type: string
172         - name: xAppInstanceName
173           in: path
174           description: Name of xApp instance to get information
175           required: true
176           type: string
177       responses:
178         '200':
179           description: successful operation
180           schema:
181             $ref: '#/definitions/XappInstance'
182         '400':
183           description: Invalid name supplied
184         '404':
185           description: Xapp not found
186         '500':
187           description: Internal error
188   /config:
189     post:
190       summary: Create xApp config
191       tags:
192         - xapp
193       operationId: createXappConfig
194       consumes:
195         - application/json
196       produces:
197         - application/json
198       parameters:
199         - name: XAppConfig
200           in: body
201           description: xApp config
202           schema:
203             $ref: '#/definitions/XAppConfig'
204       responses:
205         '201':
206           description: xApp config successfully created
207           schema:
208             $ref: '#/definitions/XAppConfig'
209         '400':
210           description: Invalid input
211         '422':
212           description: Validation of configuration failed
213         '500':
214           description: Internal error
215     put:
216       summary: Modify xApp config
217       tags:
218         - xapp
219       operationId: ModifyXappConfig
220       consumes:
221         - application/json
222       produces:
223         - application/json
224       parameters:
225         - name: XAppConfig
226           in: body
227           description: xApp config
228           schema:
229             $ref: '#/definitions/XAppConfig'
230       responses:
231         '200':
232           description: xApp config successfully modified
233           schema:
234             $ref: '#/definitions/XAppConfig'
235         '400':
236           description: Invalid input
237         '422':
238           description: Validation of configuration failed
239         '500':
240           description: Internal error
241     get:
242       summary: Returns the configuration of all xapps
243       tags:
244         - xapp
245       operationId: getAllXappConfig
246       produces:
247         - application/json
248       responses:
249         '200':
250           description: successful query of xApp config
251           schema:
252             $ref: '#/definitions/AllXappConfig'
253         '500':
254           description: Internal error
255     delete:
256       summary: Delete xApp configuration
257       tags:
258         - xapp
259       operationId: deleteXappConfig
260       parameters:
261         - name: ConfigMetadata
262           in: body
263           description: xApp configuration information
264           schema:
265             $ref: '#/definitions/ConfigMetadata'
266       responses:
267         '204':
268           description: Successful deletion of xApp
269         '400':
270           description: Invalid parameters supplied
271         '500':
272           description: Internal error
273   /subscriptions:
274     post:
275       summary: Subscribe event
276       tags:
277         - xapp
278         - subscriptions
279       operationId: addSubscription
280       consumes:
281         - application/json
282       produces:
283         - application/json
284       parameters:
285         - name: subscriptionRequest
286           in: body
287           description: New subscription
288           required: true
289           schema:
290             $ref: '#/definitions/subscriptionRequest'
291       responses:
292         '200':
293           description: Subscription successful
294           schema:
295             $ref: '#/definitions/subscriptionResponse'
296         '400':
297           description: Invalid input
298     get:
299       summary: Returns all subscriptions
300       tags:
301         - xapp
302         - subscriptions
303       operationId: getSubscriptions
304       produces:
305         - application/json
306       responses:
307         '200':
308           description: successful query of subscriptions
309           schema:
310             $ref: '#/definitions/allSubscriptions'
311   '/subscriptions/{subscriptionId}':
312     get:
313       summary: Returns the information of subscription
314       tags:
315         - xapp
316         - subscriptions
317       operationId: getSubscriptionById
318       produces:
319         - application/json
320       parameters:
321         - name: subscriptionId
322           in: path
323           description: ID of subscription
324           required: true
325           type: string
326       responses:
327         '200':
328           description: successful operation
329           schema:
330             $ref: '#/definitions/subscription'
331         '400':
332           description: Invalid ID supplied
333         '404':
334           description: Subscription not found
335     put:
336       summary: Modify event subscription
337       tags:
338         - xapp
339         - subscriptions
340       operationId: modifySubscription
341       consumes:
342         - application/json
343       produces:
344         - application/json
345       parameters:
346         - name: subscriptionId
347           in: path
348           description: ID of subscription
349           required: true
350           type: string
351         - in: body
352           name: subscriptionRequest
353           description: Modified subscription
354           required: true
355           schema:
356             $ref: '#/definitions/subscriptionRequest'
357       responses:
358         '200':
359           description: Subscription modification successful
360           schema:
361             $ref: '#/definitions/subscriptionResponse'
362         '400':
363           description: Invalid input
364     delete:
365       summary: Unsubscribe event
366       tags:
367         - xapp
368         - subscriptions
369       description: ''
370       operationId: deleteSubscription
371       parameters:
372         - name: subscriptionId
373           in: path
374           description: ID of subscription
375           required: true
376           type: string
377       responses:
378         '204':
379           description: Successful deletion of subscription
380         '400':
381           description: Invalid subscription supplied
382 definitions:
383   AllDeployableXapps:
384     type: array
385     items:
386       type: string
387       example: "xapp-dummy"
388   AllDeployedXapps:
389     type: array
390     items:
391       $ref: '#/definitions/Xapp'
392   Xapp:
393     type: object
394     required:
395       - name
396     properties:
397       name:
398         type: string
399         example: xapp-dummy
400       status:
401         type: string
402         description: xapp status in the RIC
403         enum:
404           - unknown
405           - deployed
406           - deleted
407           - superseded
408           - failed
409           - deleting
410       version:
411         type: string
412         example: 1.2.3
413       instances:
414         type: array
415         items:
416           $ref: '#/definitions/XappInstance'
417   XappInstance:
418     type: object
419     required:
420       - name
421     properties:
422       name:
423         type: string
424         example: xapp-dummy-6cd577d9-4v255
425       status:
426         type: string
427         description: xapp instance status
428         enum:
429           - pending
430           - running
431           - succeeded
432           - failed
433           - unknown
434           - completed
435           - crashLoopBackOff
436       ip:
437         type: string
438         example: 192.168.0.1
439       port:
440         type: integer
441         example: 32300
442       txMessages:
443         type: array
444         items:
445           type: string
446           example: ControlIndication
447       rxMessages:
448         type: array
449         items:
450           type: string
451           example: LoadIndication
452   ConfigMetadata:
453     type: object
454     required:
455       - name
456       - configName
457       - namespace
458     properties:
459       name:
460         type: string
461         description: Name of the xApp
462         example: xapp-dummy
463       configName:
464         type: string
465         description: Name of the config map
466         example: xapp-dummy-config-map
467       namespace:
468         type: string
469         description: Name of the namespace
470         example: ricxapp
471   XAppConfig:
472     type: object
473     required:
474       - metadata
475       - descriptor
476       - config
477     properties:
478       metadata:
479         $ref: '#/definitions/ConfigMetadata'
480       descriptor:
481         type: object
482         description: Schema of configuration in JSON format
483       config:
484         type: object
485         description: Configuration in JSON format
486   AllXappConfig:
487     type: array
488     items:
489       $ref: '#/definitions/XAppConfig'
490   subscriptionRequest:
491     type: object
492     required:
493       - targetUrl
494       - eventType
495       - maxRetries
496       - retryTimer
497     properties:
498       targetUrl:
499         type: string
500         example: 'http://localhost:11111/apps/webhook/'
501       eventType:
502         type: string
503         description: Event which is subscribed
504         enum:
505           - created
506           - deleted
507           - all
508       maxRetries:
509         type: integer
510         description: Maximum number of retries
511         example: 11
512       retryTimer:
513         type: integer
514         description: Time in seconds to wait before next retry
515         example: 22
516   subscriptionResponse:
517     type: object
518     properties:
519       id:
520         type: string
521         example: 1ILBltYYzEGzWRrVPZKmuUmhwcc
522       version:
523         type: integer
524         example: 2
525       eventType:
526         type: string
527         description: Event which is subscribed
528         enum:
529           - created
530           - deleted
531           - updated
532           - all
533   allSubscriptions:
534     type: array
535     items:
536       $ref: '#/definitions/subscription'
537   subscription:
538     type: object
539     properties:
540       id:
541         type: string
542         example: 1ILBltYYzEGzWRrVPZKmuUmhwcc
543       targetUrl:
544         type: string
545         example: 'http://localhost:11111/apps/webhook/'
546       eventType:
547         type: string
548         description: Event which is subscribed
549         enum:
550           - created
551           - deleted
552           - updated
553           - all
554       maxRetries:
555         type: integer
556         description: Maximum number of retries
557         example: 11
558       retryTimer:
559         type: integer
560         description: Time in seconds to wait before next retry
561         example: 22
562   subscriptionNotification:
563     type: object
564     properties:
565       id:
566         type: string
567         example: 1ILBltYYzEGzWRrVPZKmuUmhwcc
568       version:
569         type: integer
570         example: 2
571       eventType:
572         type: string
573         description: Event to be notified
574         enum:
575           - created
576           - deleted
577           - updated
578       xApps:
579         $ref: '#/definitions/AllDeployedXapps'