#----------------------------------------------------------
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
#
#----------------------------------------------------------
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"]
#
#----------------------------------------------------------
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"]
#
#----------------------------------------------------------
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"]
#
#----------------------------------------------------------
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 \
"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",
"host": "hostname",
"basePath": "/ric/v1",
"schemes": [
- "https",
"http"
],
"paths": {
"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": {
}
},
"definitions": {
- "AllXapps": {
+ "AllDeployableXapps": {
+ "type": "array",
+ "items": {
+ "type": "string",
+ "example": "xapp-dummy"
+ }
+ },
+ "AllDeployedXapps": {
"type": "array",
"items": {
"$ref": "#/definitions/Xapp"
]
},
"xApps": {
- "$ref": "#/definitions/AllXapps"
+ "$ref": "#/definitions/AllDeployedXapps"
}
}
}
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
host: hostname
basePath: /ric/v1
schemes:
- - https
- http
paths:
/health/alive :
'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}':
'400':
description: Invalid subscription supplied
definitions:
- AllXapps:
+ AllDeployableXapps:
+ type: array
+ items:
+ type: string
+ example: "xapp-dummy"
+ AllDeployedXapps:
type: array
items:
$ref: '#/definitions/Xapp'
- deleted
- updated
xApps:
- $ref: '#/definitions/AllXapps'
+ $ref: '#/definitions/AllDeployedXapps'
{"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},
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())
return xapps, helmError
}
+func (h *MockedHelmer) SearchAll() (s []string) {
+ return s
+}
+
func (h *MockedHelmer) List() (names []string, err error) {
return names, helmError
}
return
}
+func (cm *MockedConfigMapper) GetNamesFromHelmRepo() (names []string) {
+ return
+}
+
// Test cases
func TestGetMessages(t *testing.T) {
cm := ConfigMap{}
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 {
ApplyConfigMap(r XAppConfig, action string) (err error)
GetMessages(name string) (msgs MessageTypes)
GetNamespace(ns string) string
+ GetNamesFromHelmRepo() (names []string)
}
type Helmer interface {
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)
}