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