Support for XApp configuration update (new retry)
[ric-plt/appmgr.git] / api / appmgr_rest_api.json
1 {
2   "swagger": "2.0",
3   "info": {
4     "description": "This is a draft API for RIC appmgr",
5     "version": "0.1.2",
6     "title": "RIC appmgr",
7     "license": {
8       "name": "Apache 2.0",
9       "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
10     }
11   },
12   "host": "hostname",
13   "basePath": "/ric/v1",
14   "schemes": [
15     "https",
16     "http"
17   ],
18   "paths": {
19     "/health": {
20       "get": {
21         "summary": "Health check of xApp Manager",
22         "tags": [
23           "health"
24         ],
25         "operationId": "getHealth",
26         "responses": {
27           "200": {
28             "description": "Status of xApp Manager is ok"
29           }
30         }
31       }
32     },
33     "/xapps": {
34       "post": {
35         "summary": "Deploy a xapp",
36         "tags": [
37           "xapp"
38         ],
39         "operationId": "deployXapp",
40         "consumes": [
41           "application/json"
42         ],
43         "produces": [
44           "application/json"
45         ],
46         "parameters": [
47           {
48             "name": "xAppInfo",
49             "in": "body",
50             "description": "xApp information",
51             "schema": {
52               "type": "object",
53               "required": [
54                 "xAppName"
55               ],
56               "properties": {
57                 "xAppName": {
58                   "type":"string",
59                   "description":"Name of the xApp",
60                   "example": "xapp-dummy"
61                 }
62               }
63             }
64           }
65         ],
66         "responses": {
67           "201": {
68             "description": "xApp successfully created",
69             "schema": {
70               "$ref": "#/definitions/Xapp"
71             }
72           },
73           "400": {
74             "description": "Invalid input"
75           },
76           "500": {
77             "description": "Internal error"
78           }
79         }
80       },
81       "get": {
82         "summary": "Returns the status of all xapps",
83         "tags": [
84           "xapp"
85         ],
86         "operationId": "getAllXapps",
87         "produces": [
88           "application/json"
89         ],
90         "responses": {
91           "200": {
92             "description": "successful query of xApps",
93             "schema": {
94               "$ref": "#/definitions/AllXapps"
95             }
96           },
97           "500": {
98             "description": "Internal error"
99           }
100         }
101       }
102     },
103     "/xapps/{xAppName}": {
104       "get": {
105         "summary": "Returns the status of a given xapp",
106         "tags": [
107           "xapp"
108         ],
109         "operationId": "getXappByName",
110         "produces": [
111           "application/json"
112         ],
113         "parameters": [
114           {
115             "name": "xAppName",
116             "in": "path",
117             "description": "Name of xApp",
118             "required": true,
119             "type": "string"
120           }
121         ],
122         "responses": {
123           "200": {
124             "description": "successful operation",
125             "schema": {
126               "$ref": "#/definitions/Xapp"
127             }
128           },
129           "400": {
130             "description": "Invalid ID supplied"
131           },
132           "404": {
133             "description": "Xapp not found"
134           },
135           "500": {
136             "description": "Internal error"
137           }
138         }
139       },
140       "delete": {
141         "summary": "Undeploy an existing xapp",
142         "tags": [
143           "xapp"
144         ],
145         "operationId": "undeployXapp",
146         "parameters": [
147           {
148             "name": "xAppName",
149             "in": "path",
150             "description": "Xapp to be undeployed",
151             "required": true,
152             "type": "string"
153           }
154         ],
155         "responses": {
156           "204": {
157             "description": "Successful deletion of xApp"
158           },
159           "400": {
160             "description": "Invalid xApp name supplied"
161           },
162           "500": {
163             "description": "Internal error"
164           }
165         }
166       }
167     },
168     "/xapps/{xAppName}/instances/{xAppInstanceName}": {
169       "get": {
170         "summary": "Returns the status of a given xapp",
171         "tags": [
172           "xapp"
173         ],
174         "operationId": "getXappInstanceByName",
175         "produces": [
176           "application/json"
177         ],
178         "parameters": [
179           {
180             "name": "xAppName",
181             "in": "path",
182             "description": "Name of xApp",
183             "required": true,
184             "type": "string"
185           },
186           {
187             "name": "xAppInstanceName",
188             "in": "path",
189             "description": "Name of xApp instance to get information",
190             "required": true,
191             "type": "string"
192           }
193         ],
194         "responses": {
195           "200": {
196             "description": "successful operation",
197             "schema": {
198               "$ref": "#/definitions/XappInstance"
199             }
200           },
201           "400": {
202             "description": "Invalid name supplied"
203           },
204           "404": {
205             "description": "Xapp not found"
206           },
207           "500": {
208             "description": "Internal error"
209           }
210         }
211       }
212     },
213     "/config": {
214       "post": {
215         "summary": "Create xApp config",
216         "tags": [
217           "xapp"
218         ],
219         "operationId": "createXappConfig",
220         "consumes": [
221           "application/json"
222         ],
223         "produces": [
224           "application/json"
225         ],
226         "parameters": [
227           {
228             "name": "xAppConfig",
229             "in": "body",
230             "description": "xApp config",
231             "schema": {
232               "$ref": "#/definitions/xAppConfig"
233             }
234           }
235         ],
236         "responses": {
237           "201": {
238             "description": "xApp config successfully created",
239             "schema": {
240               "$ref": "#/definitions/xAppConfig"
241             }
242           },
243           "400": {
244             "description": "Invalid input"
245           },
246           "422": {
247             "description": "Validation of configuration failed"
248           },
249           "500": {
250             "description": "Internal error"
251           }
252         }
253       },
254       "put": {
255         "summary": "Modify xApp config",
256         "tags": [
257           "xapp"
258         ],
259         "operationId": "ModifyXappConfig",
260         "consumes": [
261           "application/json"
262         ],
263         "produces": [
264           "application/json"
265         ],
266         "parameters": [
267           {
268             "name": "xAppConfig",
269             "in": "body",
270             "description": "xApp config",
271             "schema": {
272               "$ref": "#/definitions/xAppConfig"
273             }
274           }
275         ],
276         "responses": {
277           "200": {
278             "description": "xApp config successfully modified",
279             "schema": {
280               "$ref": "#/definitions/xAppConfig"
281             }
282           },
283           "400": {
284             "description": "Invalid input"
285           },
286           "422": {
287             "description": "Validation of configuration failed"
288           },
289           "500": {
290             "description": "Internal error"
291           }
292         }
293       },
294       "get": {
295         "summary": "Returns the configuration of all xapps",
296         "tags": [
297           "xapp"
298         ],
299         "operationId": "getAllXappConfig",
300         "produces": [
301           "application/json"
302         ],
303         "responses": {
304           "200": {
305             "description": "successful query of xApp config",
306             "schema": {
307               "$ref": "#/definitions/AllXappConfig"
308             }
309           },
310           "500": {
311             "description": "Internal error"
312           }
313         }
314       },
315       "delete": {
316         "summary": "Delete xApp configuration",
317         "tags": [
318           "xapp"
319         ],
320         "operationId": "deleteXappConfig",
321         "parameters": [
322           {
323             "name": "xAppConfigInfo",
324             "in": "body",
325             "description": "xApp configuration information",
326             "schema": {
327               "$ref": "#/definitions/xAppConfigInfo"
328             }
329           }
330         ],
331         "responses": {
332           "204": {
333             "description": "Successful deletion of xApp"
334           },
335           "400": {
336             "description": "Invalid parameters supplied"
337           },
338           "500": {
339             "description": "Internal error"
340           }
341         }
342       }
343     },
344     "/subscriptions": {
345       "post": {
346         "summary": "Subscribe event",
347         "tags": [
348           "xapp",
349           "subscriptions"
350         ],
351         "operationId": "addSubscription",
352         "consumes": [
353           "application/json"
354         ],
355         "produces": [
356           "application/json"
357         ],
358         "parameters": [
359           {
360             "name": "subscriptionRequest",
361             "in": "body",
362             "description": "New subscription",
363             "required": true,
364             "schema": {
365               "$ref": "#/definitions/subscriptionRequest"
366             }
367           }
368         ],
369         "responses": {
370           "200": {
371             "description": "Subscription successful",
372             "schema": {
373               "$ref": "#/definitions/subscriptionResponse"
374             }
375           },
376           "400": {
377             "description": "Invalid input"
378           }
379         }
380       },
381       "get": {
382         "summary": "Returns all subscriptions",
383         "tags": [
384           "xapp",
385           "subscriptions"
386         ],
387         "operationId": "getSubscriptions",
388         "produces": [
389           "application/json"
390         ],
391         "responses": {
392           "200": {
393             "description": "successful query of subscriptions",
394             "schema": {
395               "$ref": "#/definitions/allSubscriptions"
396             }
397           }
398         }
399       }
400     },
401     "/subscriptions/{subscriptionId}": {
402       "get": {
403         "summary": "Returns the information of subscription",
404         "tags": [
405           "xapp",
406           "subscriptions"
407         ],
408         "operationId": "getSubscriptionById",
409         "produces": [
410           "application/json"
411         ],
412         "parameters": [
413           {
414             "name": "subscriptionId",
415             "in": "path",
416             "description": "ID of subscription",
417             "required": true,
418             "type": "integer"
419           }
420         ],
421         "responses": {
422           "200": {
423             "description": "successful operation",
424             "schema": {
425               "$ref": "#/definitions/subscription"
426             }
427           },
428           "400": {
429             "description": "Invalid ID supplied"
430           },
431           "404": {
432             "description": "Subscription not found"
433           }
434         }
435       },
436       "put": {
437         "summary": "Modify event subscription",
438         "tags": [
439           "xapp",
440           "subscriptions"
441         ],
442         "operationId": "modifySubscription",
443         "consumes": [
444           "application/json"
445         ],
446         "produces": [
447           "application/json"
448         ],
449         "parameters": [
450           {
451             "name": "subscriptionId",
452             "in": "path",
453             "description": "ID of subscription",
454             "required": true,
455             "type": "integer"
456           },
457           {
458             "in": "body",
459             "name": "subscriptionRequest",
460             "description": "Modified subscription",
461             "required": true,
462             "schema": {
463               "$ref": "#/definitions/subscriptionRequest"
464             }
465           }
466         ],
467         "responses": {
468           "200": {
469             "description": "Subscription modification successful",
470             "schema": {
471               "$ref": "#/definitions/subscriptionResponse"
472             }
473           },
474           "400": {
475             "description": "Invalid input"
476           }
477         }
478       },
479       "delete": {
480         "summary": "Unsubscribe event",
481         "tags": [
482           "xapp",
483           "subscriptions"
484         ],
485         "description": "",
486         "operationId": "deleteSubscription",
487         "parameters": [
488           {
489             "name": "subscriptionId",
490             "in": "path",
491             "description": "ID of subscription",
492             "required": true,
493             "type": "integer"
494           }
495         ],
496         "responses": {
497           "204": {
498             "description": "Successful deletion of subscription"
499           },
500           "400": {
501             "description": "Invalid subscription supplied"
502           }
503         }
504       }
505     }
506   },
507   "definitions": {
508     "AllXapps": {
509       "type": "array",
510       "items": {
511         "$ref": "#/definitions/Xapp"
512       }
513     },
514     "Xapp": {
515       "type": "object",
516       "required": [
517         "name"
518       ],
519       "properties": {
520         "name": {
521           "type": "string",
522           "example": "xapp-dummy"
523         },
524         "status": {
525           "type": "string",
526           "description": "xapp status in the RIC",
527           "enum": [
528             "unknown",
529             "deployed",
530             "deleted",
531             "superseded",
532             "failed",
533             "deleting"
534           ]
535         },
536         "version": {
537           "type": "string",
538           "example": "1.2.3"
539         },
540         "instances": {
541           "type": "array",
542           "items": {
543             "$ref": "#/definitions/XappInstance"
544           }
545         }
546       }
547     },
548     "XappInstance": {
549       "type": "object",
550       "required": [
551         "name"
552       ],
553       "properties": {
554         "name": {
555           "type": "string",
556           "example": "xapp-dummy-6cd577d9-4v255"
557         },
558         "status": {
559           "type": "string",
560           "description": "xapp instance status",
561           "enum": [
562             "pending",
563             "running",
564             "succeeded",
565             "failed",
566             "unknown",
567             "completed",
568             "crashLoopBackOff"
569           ]
570         },
571         "ip": {
572           "type": "string",
573           "example": "192.168.0.1"
574         },
575         "port": {
576           "type": "integer",
577           "example": 32300
578         },
579         "txMessages" : {
580           "type": "array",
581           "items": {
582             "type" : "string",
583             "example" : "ControlIndication"
584           }
585         },
586         "rxMessages" : {
587           "type": "array",
588           "items": {
589             "type" : "string",
590             "example" : "LoadIndication"
591           }
592         }
593       }
594     },
595     "xAppConfigInfo": {
596       "type": "object",
597       "required": [
598         "xAppName",
599         "configMapName",
600         "namespace"
601       ],
602       "properties": {
603         "xAppName": {
604           "type":"string",
605           "description":"Name of the xApp",
606           "example": "xapp-dummy"
607         },
608         "configMapName": {
609           "type":"string",
610           "description":"Name of the config map",
611           "example": "xapp-dummy-config-map"
612         },
613         "namespace": {
614           "type":"string",
615           "description":"Name of the namespace",
616           "example": "ricxapp"
617         }
618       }
619     },
620     "xAppConfig": {
621       "type": "object",
622       "required": [
623         "xAppConfigInfo",
624         "configSchema",
625         "configMap"
626       ],
627       "properties": {
628         "xAppConfigInfo": {
629           "$ref": "#/definitions/xAppConfigInfo"
630         },
631         "configSchema": {
632           "type":"object",
633           "description":"Schema of configuration in JSON format"
634         },
635         "configMap": {
636           "type":"object",
637           "description":"Configuration in JSON format"
638         }
639       }
640     },
641     "AllXappConfig": {
642       "type": "array",
643       "items": {
644         "$ref": "#/definitions/xAppConfig"
645       }
646     },
647     "subscriptionRequest": {
648       "type": "object",
649       "required": [
650         "targetUrl",
651         "eventType",
652         "maxRetries",
653         "retryTimer"
654       ],
655       "properties": {
656         "targetUrl": {
657           "type": "string",
658           "example": "http://localhost:11111/apps/webhook/"
659         },
660         "eventType": {
661           "type": "string",
662           "description": "Event which is subscribed",
663           "enum": [
664             "created",
665             "deleted",
666             "all"
667           ]
668         },
669         "maxRetries": {
670           "type": "integer",
671           "description": "Maximum number of retries",
672           "example": 11
673         },
674         "retryTimer": {
675           "type": "integer",
676           "description": "Time in seconds to wait before next retry",
677           "example": 22
678         }
679       }
680     },
681     "subscriptionResponse": {
682       "type": "object",
683       "properties": {
684         "id": {
685           "type": "string",
686           "example": "1ILBltYYzEGzWRrVPZKmuUmhwcc"
687         },
688         "version": {
689           "type": "integer",
690           "example": 2
691         },
692         "eventType": {
693           "type": "string",
694           "description": "Event which is subscribed",
695           "enum": [
696             "created",
697             "deleted",
698             "updated",
699             "all"
700           ]
701         }
702       }
703     },
704     "allSubscriptions": {
705       "type": "array",
706       "items": {
707         "$ref": "#/definitions/subscription"
708       }
709     },
710     "subscription": {
711       "type": "object",
712       "properties": {
713         "id": {
714           "type": "string",
715           "example": "1ILBltYYzEGzWRrVPZKmuUmhwcc"
716         },
717         "targetUrl": {
718           "type": "string",
719           "example": "http://localhost:11111/apps/webhook/"
720         },
721         "eventType": {
722           "type": "string",
723           "description": "Event which is subscribed",
724           "enum": [
725             "created",
726             "deleted",
727             "updated",
728             "all"
729           ]
730         },
731         "maxRetries": {
732           "type": "integer",
733           "description": "Maximum number of retries",
734           "example": 11
735         },
736         "retryTimer": {
737           "type": "integer",
738           "description": "Time in seconds to wait before next retry",
739           "example": 22
740         }
741       }
742     },
743     "subscriptionNotification": {
744       "type": "object",
745       "properties": {
746         "id": {
747           "type": "string",
748           "example": "1ILBltYYzEGzWRrVPZKmuUmhwcc"
749         },
750         "version": {
751           "type": "integer",
752           "example": 2
753         },
754         "eventType": {
755           "type": "string",
756           "description": "Event to be notified",
757           "enum": [
758             "created",
759             "deleted",
760             "updated"
761           ]
762         },
763         "xApps": {
764           "$ref": "#/definitions/AllXapps"
765         }
766       }
767     }
768   }
769 }