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