Add a new API to return the list of undeployed xApps
Change-Id: I0cd95d5f19399aa94837b91338e544f1d8a20364
Signed-off-by: Mohamed Abukar <abukar.mohamed@nokia.com>
diff --git a/Dockerfile b/Dockerfile
index c20bde2..db660b9 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -69,9 +69,8 @@
#----------------------------------------------------------
FROM appmgr-xapp-base as appmgr-build
-ARG PACKAGEURL
-ARG HELMVERSION
-
+ARG HELMVERSION=v2.13.0-rc.1
+ARG PACKAGEURL=gerrit.o-ran-sc.org/r/c/ric-plt/appmgr/
#
# helm
@@ -105,7 +104,7 @@
#
#----------------------------------------------------------
FROM appmgr-build as appmgr-test_unit
-ARG PACKAGEURL
+ARG PACKAGEURL=gerrit.o-ran-sc.org/r/c/ric-plt/appmgr/
WORKDIR "/go/src/${PACKAGEURL}"
CMD ["make","go-test"]
@@ -114,7 +113,7 @@
#
#----------------------------------------------------------
FROM appmgr-build as appmgr-test_fmt
-ARG PACKAGEURL
+ARG PACKAGEURL=gerrit.o-ran-sc.org/r/c/ric-plt/appmgr/
WORKDIR "/go/src/${PACKAGEURL}"
CMD ["make","go-test-fmt"]
@@ -122,7 +121,7 @@
#
#----------------------------------------------------------
FROM appmgr-build as appmgr-test_sanity
-ARG PACKAGEURL
+ARG PACKAGEURL=gerrit.o-ran-sc.org/r/c/ric-plt/appmgr/
WORKDIR "/go/src/${PACKAGEURL}"
CMD ["jq","-s",".", "api/appmgr_rest_api.json"]
@@ -131,7 +130,7 @@
#
#----------------------------------------------------------
FROM ubuntu:16.04 as appmgr
-ARG PACKAGEURL
+ARG PACKAGEURL=gerrit.o-ran-sc.org/r/c/ric-plt/appmgr/
RUN apt-get update -y \
&& apt-get install -y sudo openssl ca-certificates ca-cacert \
diff --git a/api/appmgr_rest_api.json b/api/appmgr_rest_api.json
index 07390b0..9e8f076 100644
--- a/api/appmgr_rest_api.json
+++ b/api/appmgr_rest_api.json
@@ -2,7 +2,7 @@
"swagger": "2.0",
"info": {
"description": "This is a draft API for RIC appmgr",
- "version": "0.1.3",
+ "version": "0.1.5",
"title": "RIC appmgr",
"license": {
"name": "Apache 2.0",
@@ -12,7 +12,6 @@
"host": "hostname",
"basePath": "/ric/v1",
"schemes": [
- "https",
"http"
],
"paths": {
@@ -133,7 +132,30 @@
"200": {
"description": "successful query of xApps",
"schema": {
- "$ref": "#/definitions/AllXapps"
+ "$ref": "#/definitions/AllDeployedXapps"
+ }
+ },
+ "500": {
+ "description": "Internal error"
+ }
+ }
+ }
+ },
+ "/xapps/list": {
+ "get": {
+ "summary": "Returns the list of all deployable xapps",
+ "tags": [
+ "xapp"
+ ],
+ "operationId": "listAllXapps",
+ "produces": [
+ "application/json"
+ ],
+ "responses": {
+ "200": {
+ "description": "successful list of deployable xApps",
+ "schema": {
+ "$ref": "#/definitions/AllDeployableXapps"
}
},
"500": {
@@ -547,7 +569,14 @@
}
},
"definitions": {
- "AllXapps": {
+ "AllDeployableXapps": {
+ "type": "array",
+ "items": {
+ "type": "string",
+ "example": "xapp-dummy"
+ }
+ },
+ "AllDeployedXapps": {
"type": "array",
"items": {
"$ref": "#/definitions/Xapp"
@@ -803,7 +832,7 @@
]
},
"xApps": {
- "$ref": "#/definitions/AllXapps"
+ "$ref": "#/definitions/AllDeployedXapps"
}
}
}
diff --git a/api/appmgr_rest_api.yaml b/api/appmgr_rest_api.yaml
index afa90f7..a15448f 100644
--- a/api/appmgr_rest_api.yaml
+++ b/api/appmgr_rest_api.yaml
@@ -1,7 +1,7 @@
swagger: '2.0'
info:
description: This is a draft API for RIC appmgr
- version: 0.1.3
+ version: 0.1.5
title: RIC appmgr
license:
name: Apache 2.0
@@ -9,7 +9,6 @@
host: hostname
basePath: /ric/v1
schemes:
- - https
- http
paths:
/health/alive :
@@ -95,7 +94,22 @@
'200':
description: successful query of xApps
schema:
- $ref: '#/definitions/AllXapps'
+ $ref: '#/definitions/AllDeployedXapps'
+ '500':
+ description: Internal error
+ '/xapps/list':
+ get:
+ summary: Returns the list of all deployable xapps
+ tags:
+ - xapp
+ operationId: listAllXapps
+ produces:
+ - application/json
+ responses:
+ '200':
+ description: successful list of deployable xApps
+ schema:
+ $ref: '#/definitions/AllDeployableXapps'
'500':
description: Internal error
'/xapps/{xAppName}':
@@ -366,7 +380,12 @@
'400':
description: Invalid subscription supplied
definitions:
- AllXapps:
+ AllDeployableXapps:
+ type: array
+ items:
+ type: string
+ example: "xapp-dummy"
+ AllDeployedXapps:
type: array
items:
$ref: '#/definitions/Xapp'
@@ -557,4 +576,4 @@
- deleted
- updated
xApps:
- $ref: '#/definitions/AllXapps'
+ $ref: '#/definitions/AllDeployedXapps'
diff --git a/cmd/appmgr/api.go b/cmd/appmgr/api.go
index 2de8b05..db54eb2 100755
--- a/cmd/appmgr/api.go
+++ b/cmd/appmgr/api.go
@@ -42,6 +42,7 @@
{"GET", "/ric/v1/health/ready", m.getHealthStatus},
{"GET", "/ric/v1/xapps", m.getAllXapps},
+ {"GET", "/ric/v1/xapps/search", m.searchAllXapps},
{"GET", "/ric/v1/xapps/{name}", m.getXappByName},
{"GET", "/ric/v1/xapps/{name}/instances/{id}", m.getXappInstanceByName},
{"POST", "/ric/v1/xapps", m.deployXapp},
@@ -155,6 +156,10 @@
respondWithJSON(w, http.StatusOK, xapps)
}
+func (m *XappManager) searchAllXapps(w http.ResponseWriter, r *http.Request) {
+ respondWithJSON(w, http.StatusOK, m.helm.SearchAll())
+}
+
func (m *XappManager) deployXapp(w http.ResponseWriter, r *http.Request) {
if r.Body == nil {
Logger.Error("No xapp data found in request body - url=%s", r.URL.RequestURI())
diff --git a/cmd/appmgr/api_test.go b/cmd/appmgr/api_test.go
index 109f6e9..248ffee 100755
--- a/cmd/appmgr/api_test.go
+++ b/cmd/appmgr/api_test.go
@@ -55,6 +55,10 @@
return xapps, helmError
}
+func (h *MockedHelmer) SearchAll() (s []string) {
+ return s
+}
+
func (h *MockedHelmer) List() (names []string, err error) {
return names, helmError
}
diff --git a/cmd/appmgr/desc_test.go b/cmd/appmgr/desc_test.go
index bd4a3f3..a49836b 100755
--- a/cmd/appmgr/desc_test.go
+++ b/cmd/appmgr/desc_test.go
@@ -118,6 +118,10 @@
return
}
+func (cm *MockedConfigMapper) GetNamesFromHelmRepo() (names []string) {
+ return
+}
+
// Test cases
func TestGetMessages(t *testing.T) {
cm := ConfigMap{}
diff --git a/cmd/appmgr/helm.go b/cmd/appmgr/helm.go
index a3785c8..9e2fde7 100755
--- a/cmd/appmgr/helm.go
+++ b/cmd/appmgr/helm.go
@@ -208,6 +208,10 @@
return h.GetNames(string(out))
}
+func (h *Helm) SearchAll() (names []string) {
+ return h.cm.GetNamesFromHelmRepo()
+}
+
func (h *Helm) Delete(name string) (xapp Xapp, err error) {
xapp, err = h.Status(name)
if err != nil {
diff --git a/cmd/appmgr/types.go b/cmd/appmgr/types.go
index d452498..685d118 100755
--- a/cmd/appmgr/types.go
+++ b/cmd/appmgr/types.go
@@ -84,6 +84,7 @@
ApplyConfigMap(r XAppConfig, action string) (err error)
GetMessages(name string) (msgs MessageTypes)
GetNamespace(ns string) string
+ GetNamesFromHelmRepo() (names []string)
}
type Helmer interface {
@@ -92,6 +93,7 @@
Install(m XappDeploy) (xapp Xapp, err error)
Status(name string) (xapp Xapp, err error)
StatusAll() (xapps []Xapp, err error)
+ SearchAll() (xapps []string)
List() (xapps []string, err error)
Delete(name string) (xapp Xapp, err error)
}