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