Introduce rAPP Catalogue API 20/4920/5
authorelinuxhenrik <henrik.b.andersson@est.tech>
Mon, 19 Oct 2020 08:39:59 +0000 (10:39 +0200)
committerelinuxhenrik <henrik.b.andersson@est.tech>
Wed, 28 Oct 2020 10:10:23 +0000 (11:10 +0100)
Change-Id: I0128c5b6405d2efd4de49d4ced200cd9fed6cf96
Issue-ID: NONRTRIC-287
Signed-off-by: elinuxhenrik <henrik.b.andersson@est.tech>
18 files changed:
.gitignore
docs/.project [deleted file]
docs/api-docs.rst
docs/conf.py
docs/images/swagger.png [new file with mode: 0644]
docs/images/yaml_logo.png [new file with mode: 0644]
docs/requirements-docs.txt
pom.xml
r-app-catalogue/.gitignore [new file with mode: 0644]
r-app-catalogue/Dockerfile [new file with mode: 0644]
r-app-catalogue/README.md [new file with mode: 0644]
r-app-catalogue/api/rac-api.json [new file with mode: 0644]
r-app-catalogue/api/rac-api.yaml [new file with mode: 0644]
r-app-catalogue/config/application.yaml [new file with mode: 0644]
r-app-catalogue/pom.xml [new file with mode: 0644]
r-app-catalogue/src/main/java/org/oransc/rappcatalogue/api/ServicesApiDelegateImpl.java [new file with mode: 0644]
r-app-catalogue/src/test/java/org/oransc/rappcatalogue/api/ServicesApiDelegateImplTest.java [new file with mode: 0644]
tox.ini

index e5a2f72..26c6731 100644 (file)
@@ -6,10 +6,12 @@ docs/_build/
 
 # Eclipse
 .checkstyle
+.classpath
+target/
 .sts4-cache
 .project
 .settings
 .pydevproject
 infer-out/
 
-.vscode
\ No newline at end of file
+.vscode
diff --git a/docs/.project b/docs/.project
deleted file mode 100644 (file)
index e248a4f..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
-       <name>docs</name>
-       <comment></comment>
-       <projects>
-       </projects>
-       <buildSpec>
-       </buildSpec>
-       <natures>
-       </natures>
-</projectDescription>
index 12ff516..9b0608a 100644 (file)
@@ -15,9 +15,10 @@ This is the API-docs of Non-RT RIC.
    :depth: 3
    :local:
 
-The Non-RT RIC consists of two parts, described in the sections below:
+The Non-RT RIC consists of three parts, described in the sections below:
  * The Policy Agent
  * The SDNC A1 Controller
+ * The rAPP Catalogue
 
 
 Policy Agent
@@ -44,6 +45,26 @@ See :ref:`sdnc-a1-controller-api` for how to use the API.
 
 See the README.md file in the nonrtric/sdnc-a1-controller repo for info about how to use it.
 
+rAPP Catalogue
+==============
+
+The Non RT-RIC Service Catalogue provides a way for services to register themselves for other services to discover.
+
+See `RAC API <./rac-api.html>`_ for how to use the API.
+
+.. |swagger-icon| image:: ./images/swagger.png
+                  :width: 40px
+
+.. |yaml-icon| image:: ./images/yaml_logo.png
+                  :width: 40px
+
+
+.. csv-table::
+   :header: "API name", "|swagger-icon|", "|yaml-icon|"
+   :widths: 10,5, 5
+
+   "RAC API", ":download:`link <../r-app-catalogue/api/rac-api.json>`", ":download:`link <../r-app-catalogue/api/rac-api.yaml>`"
+
 Complementary tools
 ===================
 
index d620289..a6ae7f9 100644 (file)
@@ -7,9 +7,23 @@ branch = 'latest'
 linkcheck_ignore = [
     'http://localhost.*',
     'http://127.0.0.1.*',
-    'https://gerrit.o-ran-sc.org.*'
+    'https://gerrit.o-ran-sc.org.*',
+    './rac-api.html' #Generated file that doesn't exist at link check.
 ]
 
+extensions = ['sphinxcontrib.redoc', 'sphinx.ext.intersphinx',]
+
+redoc = [
+            {
+                'name': 'RAC API',
+                'page': 'rac-api',
+                'spec': '../r-app-catalogue/api/rac-api.json',
+                'embed': True,
+            }
+        ]
+
+redoc_uri = 'https://cdn.jsdelivr.net/npm/redoc@next/bundles/redoc.standalone.js'
+
 #intershpinx mapping with other projects
 intersphinx_mapping = {}
 
diff --git a/docs/images/swagger.png b/docs/images/swagger.png
new file mode 100644 (file)
index 0000000..f5a9e0c
Binary files /dev/null and b/docs/images/swagger.png differ
diff --git a/docs/images/yaml_logo.png b/docs/images/yaml_logo.png
new file mode 100644 (file)
index 0000000..0492eb4
Binary files /dev/null and b/docs/images/yaml_logo.png differ
index 09a0c1c..78db685 100644 (file)
@@ -1,5 +1,12 @@
-sphinx
-sphinx-rtd-theme
-sphinxcontrib-httpdomain
-recommonmark
-lfdocs-conf
+tox
+Sphinx>=2,<4
+doc8
+docutils
+setuptools
+six
+sphinx_rtd_theme>=0.4.3
+sphinxcontrib-needs>=0.2.3
+sphinxcontrib-swaggerdoc
+sphinx_bootstrap_theme
+sphinxcontrib-redoc
+lfdocs-conf
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index cb8302e..f21502f 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -36,6 +36,7 @@
         <module>policy-agent</module>
         <module>sdnc-a1-controller</module>
         <module>enrichment-coordinator-service</module>
+        <module>r-app-catalogue</module>
     </modules>
     <build>
         <plugins>
diff --git a/r-app-catalogue/.gitignore b/r-app-catalogue/.gitignore
new file mode 100644 (file)
index 0000000..ad56f2d
--- /dev/null
@@ -0,0 +1,3 @@
+.swagger-codegen-ignore
+.swagger-codegen/
+api/README.md
diff --git a/r-app-catalogue/Dockerfile b/r-app-catalogue/Dockerfile
new file mode 100644 (file)
index 0000000..a85f57d
--- /dev/null
@@ -0,0 +1,39 @@
+#
+# ============LICENSE_START=======================================================
+#  Copyright (C) 2020 Nordix Foundation.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+#
+FROM openjdk:11-jre-slim
+
+ARG JAR
+
+WORKDIR /opt/app/r-app-catalogue
+RUN mkdir -p /var/log/r-app-catalogue
+
+EXPOSE 8081 8433
+
+ADD /config/application.yaml /opt/app/r-app-catalogue/config/application.yaml
+ADD target/${JAR} /opt/app/r-app-catalogue/r-app-catalogue.jar
+
+
+RUN chmod -R 777 /opt/app/r-app-catalogue/config/
+
+CMD ["java", "-jar", "/opt/app/r-app-catalogue/r-app-catalogue.jar"]
+
+
+
+
diff --git a/r-app-catalogue/README.md b/r-app-catalogue/README.md
new file mode 100644 (file)
index 0000000..863713d
--- /dev/null
@@ -0,0 +1,27 @@
+# O-RAN-SC Non-RT RIC rAPP Catalogue
+
+The O-RAN Non-RT RIC rApp Catalogue provides an OpenApi 3.0 REST API for services to register themselves and discover
+other services.
+
+**NOTE!** The definition of the REST API is done in the `api/rac-api.json` file. The yaml version of the file is
+generated during compilation.
+
+The application is a SpringBoot application generated using the openapitools openapi-generator-maven-plugin.
+
+To start the application run:
+`mvn spring-boot:run`
+
+## License
+
+Copyright (C) 2020 Nordix Foundation. All rights reserved.
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
diff --git a/r-app-catalogue/api/rac-api.json b/r-app-catalogue/api/rac-api.json
new file mode 100644 (file)
index 0000000..3741bdd
--- /dev/null
@@ -0,0 +1,246 @@
+{
+  "openapi": "3.0.0",
+  "info": {
+    "title": "rAPP Catalogue API",
+    "description": "The Non RT-RIC Service Catalogue provides a way for services to register themselves for other services to discover.",
+    "version": "1.0.0"
+  },
+  "paths": {
+    "/services": {
+      "get": {
+        "summary": "Service names",
+        "deprecated": false,
+        "operationId": "getServiceNamesUsingGET",
+        "responses": {
+          "200": {
+            "description": "Service names",
+            "content": {
+              "application/json": {
+                "schema": {
+                  "type": "array",
+                  "items": {
+                    "type": "string"
+                  }
+                },
+                "example": [
+                  "DroneIdentifier",
+                  "Collector"
+                ]
+              }
+            }
+          },
+          "401": {
+            "description": "Unauthorized"
+          },
+          "403": {
+            "description": "Forbidden"
+          },
+          "404": {
+            "description": "Not used"
+          }
+        },
+        "tags": [
+          "rAPP Catalogue API"
+        ]
+      }
+    },
+    "/services/{serviceName}": {
+      "get": {
+        "summary": "Individual Service",
+        "deprecated": false,
+        "operationId": "getIndividualServiceUsingGET",
+        "responses": {
+          "200": {
+            "description": "EI Job",
+            "content": {
+              "application/json": {
+                "schema": {
+                  "$ref": "#/components/schemas/service"
+                }
+              }
+            }
+          },
+          "401": {
+            "description": "Unauthorized"
+          },
+          "403": {
+            "description": "Forbidden"
+          },
+          "404": {
+            "description": "Service is not found",
+            "content": {
+              "application/json": {
+                "schema": {
+                  "$ref": "#/components/schemas/error_information"
+                }
+              }
+            }
+          }
+        },
+        "parameters": [
+          {
+            "in": "path",
+            "name": "serviceName",
+            "description": "serviceName",
+            "schema": {
+              "type": "string"
+            },
+            "required": true,
+            "example": "DroneIdentifier"
+          }
+        ],
+        "tags": [
+          "rAPP Catalogue API"
+        ]
+      },
+      "put": {
+        "summary": "Create or update a Service",
+        "deprecated": false,
+        "operationId": "putIndividualServiceUsingPUT",
+        "responses": {
+          "200": {
+            "description": "Service updated"
+          },
+          "201": {
+            "description": "Service created"
+          },
+          "401": {
+            "description": "Unauthorized"
+          },
+          "403": {
+            "description": "Forbidden"
+          },
+          "404": {
+            "description": "Provided service is not correct",
+            "content": {
+              "application/json": {
+                "schema": {
+                  "$ref": "#/components/schemas/error_information"
+                },
+                "example": {
+                  "detail": "Service is missing required property version",
+                  "status": 404
+                }
+              }
+            }
+          }
+        },
+        "parameters": [
+          {
+            "name": "serviceName",
+            "in": "path",
+            "required": true,
+            "schema": {
+              "type": "string"
+            },
+            "example": "DroneIdentifier"
+          }
+        ],
+        "requestBody": {
+          "description": "Service to create/update",
+          "required": true,
+          "content": {
+            "application/json": {
+              "schema": {
+                "$ref": "#/components/schemas/service"
+              }
+            }
+          }
+        },
+        "tags": [
+          "rAPP Catalogue API"
+        ]
+      },
+      "delete": {
+        "summary": "Remove a Service from the catalogue",
+        "deprecated": false,
+        "operationId": "deleteIndividualServiceUsingDELETE",
+        "responses": {
+          "200": {
+            "description": "Not used"
+          },
+          "204": {
+            "description": "Job deleted"
+          },
+          "401": {
+            "description": "Unauthorized"
+          },
+          "403": {
+            "description": "Forbidden"
+          },
+          "404": {
+            "description": "Service is not found",
+            "content": {
+              "application/json": {
+                "schema": {
+                  "$ref": "#/components/schemas/error_information"
+                }
+              }
+            }
+          }
+        },
+        "parameters": [
+          {
+            "name": "serviceName",
+            "in": "path",
+            "required": true,
+            "schema": {
+              "type": "string"
+            },
+            "example": "DroneIdentifier"
+          }
+        ],
+        "tags": [
+          "rAPP Catalogue API"
+        ]
+      }
+    }
+  },
+  "components": {
+    "schemas": {
+      "service": {
+        "description": "A Service",
+        "type": "object",
+        "title": "service",
+        "required": [
+          "version"
+        ],
+        "properties": {
+          "version": {
+            "description": "Version of the Service",
+            "type": "string",
+            "example": "1.0.0"
+          },
+          "display_name": {
+            "description": "Display name for the Service",
+            "type": "string",
+            "example": "Drone Identifier"
+          },
+          "description": {
+            "description": "Description of the Service",
+            "type": "string",
+            "example": "Detects if a UE is a drone"
+          }
+        }
+      },
+      "error_information": {
+        "description": "Problem as defined in https://tools.ietf.org/html/rfc7807",
+        "type": "object",
+        "title": "error_information",
+        "properties": {
+          "detail": {
+            "description": "A human-readable explanation specific to this occurrence of the problem.",
+            "type": "string",
+            "example": "Service not found"
+          },
+          "status": {
+            "format": "int32",
+            "description": "The HTTP status code generated by the origin server for this occurrence of the problem.",
+            "type": "integer",
+            "example": 404
+          }
+        }
+      }
+    }
+  }
+}
\ No newline at end of file
diff --git a/r-app-catalogue/api/rac-api.yaml b/r-app-catalogue/api/rac-api.yaml
new file mode 100644 (file)
index 0000000..87e2eb9
--- /dev/null
@@ -0,0 +1,175 @@
+openapi: 3.0.0
+info:
+  title: rAPP Catalogue API
+  description: The Non RT-RIC Service Catalogue provides a way for services to register
+    themselves for other services to discover.
+  version: 1.0.0
+servers:
+- url: /
+paths:
+  /services:
+    get:
+      tags:
+      - rAPP Catalogue API
+      summary: Service names
+      operationId: getServiceNamesUsingGET
+      responses:
+        200:
+          description: Service names
+          content:
+            application/json:
+              schema:
+                type: array
+                items:
+                  type: string
+              example:
+              - DroneIdentifier
+              - Collector
+        401:
+          description: Unauthorized
+        403:
+          description: Forbidden
+        404:
+          description: Not used
+      deprecated: false
+  /services/{serviceName}:
+    get:
+      tags:
+      - rAPP Catalogue API
+      summary: Individual Service
+      operationId: getIndividualServiceUsingGET
+      parameters:
+      - name: serviceName
+        in: path
+        description: serviceName
+        required: true
+        style: simple
+        explode: false
+        schema:
+          type: string
+        example: DroneIdentifier
+      responses:
+        200:
+          description: EI Job
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/service'
+        401:
+          description: Unauthorized
+        403:
+          description: Forbidden
+        404:
+          description: Service is not found
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/error_information'
+      deprecated: false
+    put:
+      tags:
+      - rAPP Catalogue API
+      summary: Create or update a Service
+      operationId: putIndividualServiceUsingPUT
+      parameters:
+      - name: serviceName
+        in: path
+        required: true
+        style: simple
+        explode: false
+        schema:
+          type: string
+        example: DroneIdentifier
+      requestBody:
+        description: Service to create/update
+        content:
+          application/json:
+            schema:
+              $ref: '#/components/schemas/service'
+        required: true
+      responses:
+        200:
+          description: Service updated
+        201:
+          description: Service created
+        401:
+          description: Unauthorized
+        403:
+          description: Forbidden
+        404:
+          description: Provided service is not correct
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/error_information'
+              example:
+                detail: Service is missing required property version
+                status: 404
+      deprecated: false
+    delete:
+      tags:
+      - rAPP Catalogue API
+      summary: Remove a Service from the catalogue
+      operationId: deleteIndividualServiceUsingDELETE
+      parameters:
+      - name: serviceName
+        in: path
+        required: true
+        style: simple
+        explode: false
+        schema:
+          type: string
+        example: DroneIdentifier
+      responses:
+        200:
+          description: Not used
+        204:
+          description: Job deleted
+        401:
+          description: Unauthorized
+        403:
+          description: Forbidden
+        404:
+          description: Service is not found
+          content:
+            application/json:
+              schema:
+                $ref: '#/components/schemas/error_information'
+      deprecated: false
+components:
+  schemas:
+    service:
+      title: service
+      required:
+      - version
+      type: object
+      properties:
+        version:
+          type: string
+          description: Version of the Service
+          example: 1.0.0
+        display_name:
+          type: string
+          description: Display name for the Service
+          example: Drone Identifier
+        description:
+          type: string
+          description: Description of the Service
+          example: Detects if a UE is a drone
+      description: A Service
+    error_information:
+      title: error_information
+      type: object
+      properties:
+        detail:
+          type: string
+          description: A human-readable explanation specific to this occurrence of
+            the problem.
+          example: Service not found
+        status:
+          type: integer
+          description: The HTTP status code generated by the origin server for this
+            occurrence of the problem.
+          format: int32
+          example: 404
+      description: Problem as defined in https://tools.ietf.org/html/rfc7807
diff --git a/r-app-catalogue/config/application.yaml b/r-app-catalogue/config/application.yaml
new file mode 100644 (file)
index 0000000..fadf7d2
--- /dev/null
@@ -0,0 +1,4 @@
+spring:
+  profiles:
+    active: prod
+
diff --git a/r-app-catalogue/pom.xml b/r-app-catalogue/pom.xml
new file mode 100644 (file)
index 0000000..3ac8562
--- /dev/null
@@ -0,0 +1,250 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<!--\r
+* ========================LICENSE_START=================================\r
+* O-RAN-SC\r
+* %%\r
+* Copyright (C) 2020 Nordix Foundation\r
+* %%\r
+* Licensed under the Apache License, Version 2.0 (the "License");\r
+* you may not use this file except in compliance with the License.\r
+* You may obtain a copy of the License at\r
+*\r
+* http://www.apache.org/licenses/LICENSE-2.0\r
+*\r
+* Unless required by applicable law or agreed to in writing, software\r
+* distributed under the License is distributed on an "AS IS" BASIS,\r
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+* See the License for the specific language governing permissions and\r
+* limitations under the License.\r
+* ========================LICENSE_END===================================\r
+-->\r
+<project xmlns="http://maven.apache.org/POM/4.0.0"\r
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\r
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">\r
+    <modelVersion>4.0.0</modelVersion>\r
+\r
+    <parent>\r
+        <groupId>org.springframework.boot</groupId>\r
+        <artifactId>spring-boot-starter-parent</artifactId>\r
+        <version>2.3.4.RELEASE</version>\r
+        <relativePath />\r
+    </parent>\r
+    <groupId>org.o-ran-sc.nonrtric</groupId>\r
+    <artifactId>r-app-catalogue</artifactId>\r
+    <version>1.0.0-SNAPSHOT</version>\r
+    <licenses>\r
+        <license>\r
+            <name>The Apache Software License, Version 2.0</name>\r
+            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>\r
+        </license>\r
+    </licenses>\r
+    <properties>\r
+        <java.version>11</java.version>\r
+        <swagger-annotations.version>1.5.22</swagger-annotations.version>\r
+        <springfox.version>2.9.2</springfox.version>\r
+        <jackson-databind-nullable.version>0.2.1</jackson-databind-nullable.version>\r
+        <openapi-generator-maven-plugin.version>4.3.1</openapi-generator-maven-plugin.version>\r
+        <swagger-codegen-maven-plugin.version>3.0.11</swagger-codegen-maven-plugin.version>\r
+        <docker-maven-plugin.version>0.30.0</docker-maven-plugin.version>\r
+    </properties>\r
+\r
+    <dependencies>\r
+        <dependency>\r
+            <groupId>io.swagger</groupId>\r
+            <artifactId>swagger-annotations</artifactId>\r
+            <version>${swagger-annotations.version}</version>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>com.fasterxml.jackson.core</groupId>\r
+            <artifactId>jackson-annotations</artifactId>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.springframework</groupId>\r
+            <artifactId>spring-beans</artifactId>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.springframework.boot</groupId>\r
+            <artifactId>spring-boot-autoconfigure</artifactId>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.springframework</groupId>\r
+            <artifactId>spring-web</artifactId>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.springframework.boot</groupId>\r
+            <artifactId>spring-boot</artifactId>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.springframework</groupId>\r
+            <artifactId>spring-webmvc</artifactId>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.springframework</groupId>\r
+            <artifactId>spring-context</artifactId>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>io.springfox</groupId>\r
+            <artifactId>springfox-swagger2</artifactId>\r
+            <version>${springfox.version}</version>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>io.springfox</groupId>\r
+            <artifactId>springfox-core</artifactId>\r
+            <version>${springfox.version}</version>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>io.springfox</groupId>\r
+            <artifactId>springfox-spring-web</artifactId>\r
+            <version>${springfox.version}</version>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>io.springfox</groupId>\r
+            <artifactId>springfox-spi</artifactId>\r
+            <version>${springfox.version}</version>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.assertj</groupId>\r
+            <artifactId>assertj-core</artifactId>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.apache.tomcat.embed</groupId>\r
+            <artifactId>tomcat-embed-core</artifactId>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.openapitools</groupId>\r
+            <artifactId>jackson-databind-nullable</artifactId>\r
+            <version>${jackson-databind-nullable.version}</version>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>javax.validation</groupId>\r
+            <artifactId>validation-api</artifactId>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>com.fasterxml.jackson.core</groupId>\r
+            <artifactId>jackson-databind</artifactId>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.yaml</groupId>\r
+            <artifactId>snakeyaml</artifactId>\r
+            <scope>runtime</scope>\r
+        </dependency>\r
+        <!-- TEST -->\r
+        <dependency>\r
+            <groupId>org.springframework</groupId>\r
+            <artifactId>spring-test</artifactId>\r
+            <scope>test</scope>\r
+        </dependency>\r
+        <dependency>\r
+            <groupId>org.junit.jupiter</groupId>\r
+            <artifactId>junit-jupiter-api</artifactId>\r
+            <scope>test</scope>\r
+        </dependency>\r
+    </dependencies>\r
+\r
+    <build>\r
+        <plugins>\r
+            <plugin>\r
+                <groupId>org.openapitools</groupId>\r
+                <artifactId>openapi-generator-maven-plugin</artifactId>\r
+                <version>${openapi-generator-maven-plugin.version}</version>\r
+                <executions>\r
+                    <execution>\r
+                        <goals>\r
+                            <goal>generate</goal>\r
+                        </goals>\r
+                        <configuration>\r
+                            <inputSpec>${project.basedir}/api/rac-api.json</inputSpec>\r
+                            <generatorName>spring</generatorName>\r
+                            <apiPackage>org.oransc.rappcatalogue.api</apiPackage>\r
+                            <modelPackage>org.oransc.rappcatalogue.model</modelPackage>\r
+                            <configOptions>\r
+                                <delegatePattern>true</delegatePattern>\r
+                            </configOptions>\r
+                        </configuration>\r
+                    </execution>\r
+                </executions>\r
+            </plugin>\r
+            <plugin>\r
+                <groupId>io.swagger.codegen.v3</groupId>\r
+                <artifactId>swagger-codegen-maven-plugin</artifactId>\r
+                <version>${swagger-codegen-maven-plugin.version}</version>\r
+                <executions>\r
+                    <execution>\r
+                        <goals>\r
+                            <goal>generate</goal>\r
+                        </goals>\r
+                        <configuration>\r
+                            <inputSpec>${project.basedir}/api/rac-api.json</inputSpec>\r
+                            <language>openapi-yaml</language>\r
+                            <output>${project.basedir}/api/</output>\r
+                            <configOptions>\r
+                                <outputFile>rac-api.yaml</outputFile>\r
+                            </configOptions>\r
+                        </configuration>\r
+                    </execution>\r
+                </executions>\r
+            </plugin>\r
+            <plugin>\r
+                <groupId>io.fabric8</groupId>\r
+                <artifactId>docker-maven-plugin</artifactId>\r
+                <version>${docker-maven-plugin.version}</version>\r
+                <inherited>false</inherited>\r
+                <executions>\r
+                    <execution>\r
+                        <id>generate-r-app-catalogue-image</id>\r
+                        <phase>package</phase>\r
+                        <goals>\r
+                            <goal>build</goal>\r
+                        </goals>\r
+                        <configuration>\r
+                            <pullRegistry>${env.CONTAINER_PULL_REGISTRY}</pullRegistry>\r
+                            <images>\r
+                                <image>\r
+                                    <name>o-ran-sc/nonrtric-r-app-catalogue:${project.version}</name>\r
+                                    <build>\r
+                                        <cleanup>try</cleanup>\r
+                                        <contextDir>${basedir}</contextDir>\r
+                                        <dockerFile>Dockerfile</dockerFile>\r
+                                        <args>\r
+                                            <JAR>${project.build.finalName}.jar</JAR>\r
+                                        </args>\r
+                                        <tags>\r
+                                            <tag>${project.version}</tag>\r
+                                        </tags>\r
+                                    </build>\r
+                                </image>\r
+                            </images>\r
+                        </configuration>\r
+                    </execution>\r
+                    <execution>\r
+                        <id>push-r-app-catalogue-image</id>\r
+                        <goals>\r
+                            <goal>build</goal>\r
+                            <goal>push</goal>\r
+                        </goals>\r
+                        <configuration>\r
+                            <pullRegistry>${env.CONTAINER_PULL_REGISTRY}</pullRegistry>\r
+                            <pushRegistry>${env.CONTAINER_PUSH_REGISTRY}</pushRegistry>\r
+                            <images>\r
+                                <image>\r
+                                    <name>o-ran-sc/nonrtric-r-app-catalogue:${project.version}</name>\r
+                                    <build>\r
+                                        <contextDir>${basedir}</contextDir>\r
+                                        <dockerFile>Dockerfile</dockerFile>\r
+                                        <args>\r
+                                            <JAR>${project.build.finalName}.jar</JAR>\r
+                                        </args>\r
+                                        <tags>\r
+                                            <tag>${project.version}</tag>\r
+                                            <tag>latest</tag>\r
+                                        </tags>\r
+                                    </build>\r
+                                </image>\r
+                            </images>\r
+                        </configuration>\r
+                    </execution>\r
+                </executions>\r
+            </plugin>\r
+        </plugins>\r
+    </build>\r
+</project>
\ No newline at end of file
diff --git a/r-app-catalogue/src/main/java/org/oransc/rappcatalogue/api/ServicesApiDelegateImpl.java b/r-app-catalogue/src/main/java/org/oransc/rappcatalogue/api/ServicesApiDelegateImpl.java
new file mode 100644 (file)
index 0000000..701f1d8
--- /dev/null
@@ -0,0 +1,34 @@
+package org.oransc.rappcatalogue.api;\r
+\r
+import java.util.Arrays;\r
+import java.util.List;\r
+\r
+import org.springframework.http.HttpStatus;\r
+import org.springframework.http.ResponseEntity;\r
+\r
+@org.springframework.stereotype.Service\r
+public class ServicesApiDelegateImpl implements ServicesApiDelegate {\r
+\r
+    @Override\r
+    public ResponseEntity<Void> deleteIndividualServiceUsingDELETE(String serviceName) {\r
+        return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);\r
+    }\r
+\r
+    // @Override\r
+    // public ResponseEntity<Service> getIndividualServiceUsingGET(String serviceName) {\r
+    //     return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);\r
+\r
+    // }\r
+\r
+    @Override\r
+    public ResponseEntity<List<String>> getServiceNamesUsingGET() {\r
+        List<String> services = Arrays.asList("a", "b");\r
+        return ResponseEntity.ok(services);\r
+    }\r
+\r
+    // @Override\r
+    // public ResponseEntity<Void> putIndividualServiceUsingPUT(String serviceName, Service service) {\r
+    //     return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);\r
+\r
+    // }\r
+}\r
diff --git a/r-app-catalogue/src/test/java/org/oransc/rappcatalogue/api/ServicesApiDelegateImplTest.java b/r-app-catalogue/src/test/java/org/oransc/rappcatalogue/api/ServicesApiDelegateImplTest.java
new file mode 100644 (file)
index 0000000..53dfc1a
--- /dev/null
@@ -0,0 +1,33 @@
+package org.oransc.rappcatalogue.api;\r
+\r
+import static org.assertj.core.api.Assertions.assertThat;\r
+\r
+import java.util.Arrays;\r
+import java.util.List;\r
+\r
+import org.junit.jupiter.api.Test;\r
+import org.junit.jupiter.api.extension.ExtendWith;\r
+import org.springframework.http.HttpStatus;\r
+import org.springframework.http.ResponseEntity;\r
+import org.springframework.test.context.junit.jupiter.SpringExtension;\r
+\r
+@ExtendWith(SpringExtension.class)\r
+class ServicesApiDelegateImplTest {\r
+\r
+    @Test\r
+    void putValidService_shouldBeOk() {\r
+        ServicesApiDelegateImpl delegateUnderTest = new ServicesApiDelegateImpl();\r
+\r
+        ResponseEntity<List<String>> response = delegateUnderTest.getServiceNamesUsingGET();\r
+    }\r
+\r
+    @Test\r
+    void getServices_shouldProvideArrayOfServices() throws Exception {\r
+        ServicesApiDelegateImpl delegateUnderTest = new ServicesApiDelegateImpl();\r
+\r
+        ResponseEntity<List<String>> response = delegateUnderTest.getServiceNamesUsingGET();\r
+\r
+        assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK);\r
+        assertThat(response.getBody()).isEqualTo(Arrays.asList("a", "b"));\r
+    }\r
+}\r
diff --git a/tox.ini b/tox.ini
index 4491722..2705e16 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -24,23 +24,14 @@ skipsdist = true
 
 [testenv:docs]
 basepython = python3
-deps =
-    sphinx
-    sphinx-rtd-theme
-    sphinxcontrib-httpdomain
-    recommonmark
-    lfdocs-conf
+deps = -r{toxinidir}/docs/requirements-docs.txt
 
 commands =
-    sphinx-build -W -b html -n -d {envtmpdir}/doctrees ./docs/ {toxinidir}/docs/_build/html
+    sphinx-build -W -b html -n -d {envtmpdir}/docs/doctrees ./docs/ {toxinidir}/docs/_build/html
     echo "Generated docs available in {toxinidir}/docs/_build/html"
 whitelist_externals = echo
 
 [testenv:docs-linkcheck]
 basepython = python3
-deps = sphinx
-       sphinx-rtd-theme
-       sphinxcontrib-httpdomain
-       recommonmark
-       lfdocs-conf
+deps = -r{toxinidir}/docs/requirements-docs.txt
 commands = sphinx-build -W -b linkcheck -d {envtmpdir}/doctrees ./docs/ {toxinidir}/docs/_build/linkcheck