Add support for RT policies
[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.2.0
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: XappDescriptor
46           in: body
47           description: xApp deployment info
48           schema:
49             $ref: '#/definitions/XappDescriptor'
50       responses:
51         '201':
52           description: xApp successfully created
53           schema:
54             $ref: '#/definitions/Xapp'
55         '400':
56           description: Invalid input
57         '500':
58           description: Internal error
59     get:
60       summary: Returns the status of all xapps
61       tags:
62         - xapp
63       operationId: getAllXapps
64       produces:
65         - application/json
66       responses:
67         '200':
68           description: successful query of xApps
69           schema:
70             $ref: '#/definitions/AllDeployedXapps'
71         '500':
72           description: Internal error
73   /xapps/list:
74     get:
75       summary: Returns the list of all deployable xapps
76       tags:
77         - xapp
78       operationId: listAllXapps
79       produces:
80         - application/json
81       responses:
82         '200':
83           description: successful list of deployable xApps
84           schema:
85             $ref: '#/definitions/AllDeployableXapps'
86         '500':
87           description: Internal error
88   /xapps/{xAppName}:
89     get:
90       summary: Returns the status of a given xapp
91       tags:
92         - xapp
93       operationId: getXappByName
94       produces:
95         - application/json
96       parameters:
97         - name: xAppName
98           in: path
99           description: Name of xApp
100           required: true
101           type: string
102       responses:
103         '200':
104           description: successful operation
105           schema:
106             $ref: '#/definitions/Xapp'
107         '400':
108           description: Invalid ID supplied
109         '404':
110           description: Xapp not found
111         '500':
112           description: Internal error
113     delete:
114       summary: Undeploy an existing xapp
115       tags:
116         - xapp
117       operationId: undeployXapp
118       parameters:
119         - name: xAppName
120           in: path
121           description: Xapp to be undeployed
122           required: true
123           type: string
124       responses:
125         '204':
126           description: Successful deletion of xApp
127         '400':
128           description: Invalid xApp name supplied
129         '500':
130           description: Internal error
131   /xapps/{xAppName}/instances/{xAppInstanceName}:
132     get:
133       summary: Returns the status of a given xapp
134       tags:
135         - xapp
136       operationId: getXappInstanceByName
137       produces:
138         - application/json
139       parameters:
140         - name: xAppName
141           in: path
142           description: Name of xApp
143           required: true
144           type: string
145         - name: xAppInstanceName
146           in: path
147           description: Name of xApp instance to get information
148           required: true
149           type: string
150       responses:
151         '200':
152           description: successful operation
153           schema:
154             $ref: '#/definitions/XappInstance'
155         '400':
156           description: Invalid name supplied
157         '404':
158           description: Xapp not found
159         '500':
160           description: Internal error
161   /xapps/{xAppName}/instances/{xAppInstanceName}/start:
162     put:
163       summary: Start given xapp instance
164       tags:
165         - xapp
166       operationId: startXappInstanceByName
167       produces:
168         - application/json
169       parameters:
170         - name: xAppName
171           in: path
172           description: Name of xApp
173           required: true
174           type: string
175         - name: xAppInstanceName
176           in: path
177           description: Name of xApp instance to get information
178           required: true
179           type: string
180       responses:
181         '200':
182           description: successful operation
183         '400':
184           description: Invalid name supplied
185         '404':
186           description: Xapp not found
187         '500':
188           description: Internal error
189   /xapps/{xAppName}/instances/{xAppInstanceName}/stop:
190     put:
191       summary: Stop given xapp instance
192       tags:
193         - xapp
194       operationId: stopXappInstanceByName
195       produces:
196         - application/json
197       parameters:
198         - name: xAppName
199           in: path
200           description: Name of xApp
201           required: true
202           type: string
203         - name: xAppInstanceName
204           in: path
205           description: Name of xApp instance to get information
206           required: true
207           type: string
208       responses:
209         '200':
210           description: successful operation
211         '400':
212           description: Invalid name supplied
213         '404':
214           description: Xapp not found
215         '500':
216           description: Internal error
217   /config:
218     post:
219       summary: Create xApp config
220       tags:
221         - xapp
222       operationId: createXappConfig
223       consumes:
224         - application/json
225       produces:
226         - application/json
227       parameters:
228         - name: XAppConfig
229           in: body
230           description: xApp config
231           schema:
232             $ref: '#/definitions/XAppConfig'
233       responses:
234         '201':
235           description: xApp config successfully created
236           schema:
237             $ref: '#/definitions/ConfigValidationErrors'
238         '400':
239           description: Invalid input
240         '422':
241           description: Validation of configuration failed
242         '500':
243           description: Internal error
244     put:
245       summary: Modify xApp config
246       tags:
247         - xapp
248       operationId: ModifyXappConfig
249       consumes:
250         - application/json
251       produces:
252         - application/json
253       parameters:
254         - name: XAppConfig
255           in: body
256           description: xApp config
257           schema:
258             $ref: '#/definitions/XAppConfig'
259       responses:
260         '200':
261           description: xApp config successfully modified
262           schema:
263             $ref: '#/definitions/ConfigValidationErrors'
264         '400':
265           description: Invalid input
266         '422':
267           description: Validation of configuration failed
268         '500':
269           description: Internal error
270     get:
271       summary: Returns the configuration of all xapps
272       tags:
273         - xapp
274       operationId: getAllXappConfig
275       produces:
276         - application/json
277       responses:
278         '200':
279           description: successful query of xApp config
280           schema:
281             $ref: '#/definitions/AllXappConfig'
282         '500':
283           description: Internal error
284     delete:
285       summary: Delete xApp configuration
286       tags:
287         - xapp
288       operationId: deleteXappConfig
289       parameters:
290         - name: ConfigMetadata
291           in: body
292           description: xApp configuration information
293           schema:
294             $ref: '#/definitions/ConfigMetadata'
295       responses:
296         '204':
297           description: Successful deletion of xApp config
298         '400':
299           description: Invalid parameters supplied
300         '500':
301           description: Internal error
302   /config/{configName}:
303     get:
304       summary: Returns the configuration of a single xapp
305       tags:
306         - xapp
307       operationId: getXappConfig
308       produces:
309         - application/json
310       parameters:
311         - name: configName
312           in: path
313           description: Name of xApp
314           required: true
315           type: string
316       responses:
317         '200':
318           description: successful query of xApp config
319           schema:
320             $ref: '#/definitions/XAppConfig'
321         '500':
322           description: Internal error
323   /subscriptions:
324     post:
325       summary: Subscribe event
326       tags:
327         - xapp
328         - subscriptions
329       operationId: addSubscription
330       consumes:
331         - application/json
332       produces:
333         - application/json
334       parameters:
335         - name: subscriptionRequest
336           in: body
337           description: New subscription
338           required: true
339           schema:
340             $ref: '#/definitions/subscriptionRequest'
341       responses:
342         '201':
343           description: Subscription successfully created
344           schema:
345             $ref: '#/definitions/subscriptionResponse'
346         '400':
347           description: Invalid input
348     get:
349       summary: Returns all subscriptions
350       tags:
351         - xapp
352         - subscriptions
353       operationId: getSubscriptions
354       produces:
355         - application/json
356       responses:
357         '200':
358           description: successful query of subscriptions
359           schema:
360             $ref: '#/definitions/allSubscriptions'
361   /subscriptions/{subscriptionId}:
362     get:
363       summary: Returns the information of subscription
364       tags:
365         - xapp
366         - subscriptions
367       operationId: getSubscriptionById
368       produces:
369         - application/json
370       parameters:
371         - name: subscriptionId
372           in: path
373           description: ID of subscription
374           required: true
375           type: string
376       responses:
377         '200':
378           description: successful operation
379           schema:
380             $ref: '#/definitions/subscription'
381         '400':
382           description: Invalid ID supplied
383         '404':
384           description: Subscription not found
385     put:
386       summary: Modify event subscription
387       tags:
388         - xapp
389         - subscriptions
390       operationId: modifySubscription
391       consumes:
392         - application/json
393       produces:
394         - application/json
395       parameters:
396         - name: subscriptionId
397           in: path
398           description: ID of subscription
399           required: true
400           type: string
401         - in: body
402           name: subscriptionRequest
403           description: Modified subscription
404           required: true
405           schema:
406             $ref: '#/definitions/subscriptionRequest'
407       responses:
408         '200':
409           description: Subscription modification successful
410           schema:
411             $ref: '#/definitions/subscriptionResponse'
412         '400':
413           description: Invalid input
414     delete:
415       summary: Unsubscribe event
416       tags:
417         - xapp
418         - subscriptions
419       description: ''
420       operationId: deleteSubscription
421       parameters:
422         - name: subscriptionId
423           in: path
424           description: ID of subscription
425           required: true
426           type: string
427       responses:
428         '204':
429           description: Successful deletion of subscription
430         '400':
431           description: Invalid subscription supplied
432 definitions:
433   AllDeployableXapps:
434     type: array
435     items:
436       type: string
437   AllDeployedXapps:
438     type: array
439     items:
440       $ref: '#/definitions/Xapp'
441   Xapp:
442     type: object
443     required:
444       - name
445     properties:
446       name:
447         type: string
448       status:
449         type: string
450         description: xapp status in the RIC
451         enum:
452           - unknown
453           - deployed
454           - deleted
455           - superseded
456           - failed
457           - deleting
458       version:
459         type: string
460       instances:
461         type: array
462         items:
463           $ref: '#/definitions/XappInstance'
464   XappInstance:
465     type: object
466     required:
467       - name
468     properties:
469       name:
470         type: string
471       status:
472         type: string
473         description: xapp instance status
474         enum:
475           - pending
476           - running
477           - succeeded
478           - failed
479           - unknown
480           - completed
481           - crashLoopBackOff
482       ip:
483         type: string
484       port:
485         type: integer
486       txMessages:
487         type: array
488         items:
489           type: string
490       rxMessages:
491         type: array
492         items:
493           type: string
494       policies:
495          type: array
496          items:
497            type: integer
498   XappDescriptor:
499     type: object
500     required:
501       - xappName
502     properties:
503       xappName:
504         type: string
505         description: Name of the xApp in helm chart
506       helmVersion:
507         type: string
508         description: The exact xapp helm chart version to install
509       releaseName:
510         type: string
511         description: Name of the xapp to be visible in Kubernetes
512       namespace:
513         type: string
514         description: Name of the namespace to which xApp is deployed. Overrides the value given in Helm chart value file.
515       overrideFile:
516         type: object
517         description: JSON string of override file for 'helm install' command
518   XappDescriptorList:
519     type: array
520     items:
521       $ref: '#/definitions/XappDescriptor'
522   ConfigMetadata:
523     type: object
524     required:
525       - name
526     properties:
527       name:
528         type: string
529         description: Name of the xApp
530       configName:
531         type: string
532         description: Name of the config map
533       namespace:
534         type: string
535         description: Name of the namespace
536   ConfigValidationError:
537     type: object
538     required:
539       - field
540       - error
541     properties:
542       field:
543         type: string
544         description: Name of the parameter
545       error:
546         type: string
547         description: Description of validation error
548   ConfigValidationErrors:
549     type: array
550     items:
551       $ref: '#/definitions/ConfigValidationError'
552   XAppConfig:
553     type: object
554     required:
555       - metadata
556       - descriptor
557       - config
558     properties:
559       metadata:
560         $ref: '#/definitions/ConfigMetadata'
561       descriptor:
562         type: object
563         description: Schema of configuration in JSON format
564       config:
565         type: object
566         description: Configuration in JSON format
567   AllXappConfig:
568     type: array
569     items:
570       $ref: '#/definitions/XAppConfig'
571   EventType:
572     type: string
573     description: Event which is subscribed
574     enum:
575       - deployed
576       - undeployed
577       - created
578       - modified
579       - deleted
580       - restarted
581       - all
582   SubscriptionData:
583     type: object
584     required:
585       - targetUrl
586       - eventType
587       - maxRetries
588       - retryTimer
589     properties:
590       targetUrl:
591         type: string
592         example: 'http://localhost:11111/apps/webhook/'
593       eventType:
594         $ref: '#/definitions/EventType'
595       maxRetries:
596         type: integer
597         description: Maximum number of retries
598       retryTimer:
599         type: integer
600         description: Time in seconds to wait before next retry
601   subscriptionRequest:
602     type: object
603     required:
604       - data
605     properties:
606       data:
607         $ref: '#/definitions/SubscriptionData'
608   subscriptionResponse:
609     type: object
610     properties:
611       id:
612         type: string
613       version:
614         type: integer
615       eventType:
616         $ref: '#/definitions/EventType'
617   allSubscriptions:
618     type: array
619     items:
620       $ref: '#/definitions/subscription'
621   subscription:
622     type: object
623     properties:
624       id:
625         type: string
626       data:
627         $ref: '#/definitions/SubscriptionData'
628   subscriptionNotification:
629     type: object
630     properties:
631       id:
632         type: string
633       version:
634         type: integer
635       eventType:
636         $ref: '#/definitions/EventType'
637       xApps:
638         $ref: '#/definitions/AllDeployedXapps'