Update E2 manager API to version 20190515 76/176/3
authorLott, Christopher (cl778h) <cl778h@att.com>
Mon, 20 May 2019 10:09:40 +0000 (06:09 -0400)
committerLott, Christopher (cl778h) <cl778h@att.com>
Mon, 20 May 2019 14:46:00 +0000 (10:46 -0400)
Change-Id: Ieeef95a9086fcf07c7cb026349898b9f7f5a376d
Signed-off-by: Lott, Christopher (cl778h) <cl778h@att.com>
.gitignore
docs/release-notes.rst
e2-mgr-client/pom.xml
e2-mgr-client/src/main/resources/e2_manager_02052019_2.yaml [deleted file]
e2-mgr-client/src/main/resources/e2_manager_2019-05-15.yaml [moved from e2-mgr-client/src/main/resources/e2_manager_02052019.yaml with 63% similarity]
e2-mgr-client/src/main/resources/e2_mgr_rest_api_v0_0_1.yaml [deleted file]
e2-mgr-client/src/test/java/org/oransc/ric/portal/dashboard/e2mgr/client/test/E2ManagerClientTest.java
webapp-backend/pom.xml
webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/config/E2ManagerConfiguration.java
webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/config/E2ManagerMockConfiguration.java
webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/controller/E2ManagerController.java

index c147df4..b3a7f27 100644 (file)
@@ -40,6 +40,7 @@
 
 ### visual studio ###
 .vs
+**/.vscode
 
 # OSx cruft
 **/.DS_Store
index fa2b460..4274ba6 100644 (file)
@@ -25,6 +25,7 @@ Version 1.0.3, 20 May 2019
 * Add AC xapp controller
 * Add RAN type radio selector to connection setup
 * Update ANR xApp client to spec version 0.0.5
+* Update E2 manager client to spec version 20190515
 * Add get-version methods to all controllers
 * Add simple page footer with copyright and version
 
index 48caf8e..b180f89 100644 (file)
@@ -31,7 +31,7 @@ limitations under the License.
        <groupId>org.o-ran-sc.ric.e2mgr.client</groupId>
        <artifactId>e2-mgr-client</artifactId>
        <name>RIC E2 Manager client</name>
-       <version>02052019-SNAPSHOT</version>
+       <version>20190515-SNAPSHOT</version>
        <properties>
                <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
                <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -104,7 +104,7 @@ limitations under the License.
                                                        <goal>generate</goal>
                                                </goals>
                                                <configuration>
-                                                       <inputSpec>${project.basedir}/src/main/resources/e2_manager_02052019_2.yaml</inputSpec>
+                                                       <inputSpec>${project.basedir}/src/main/resources/e2_manager_2019-05-15.yaml</inputSpec>
                                                        <language>java</language>
                                                        <packageName>${client.base.package.name}</packageName>
                                                        <modelPackage>${client.base.package.name}.model</modelPackage>
diff --git a/e2-mgr-client/src/main/resources/e2_manager_02052019_2.yaml b/e2-mgr-client/src/main/resources/e2_manager_02052019_2.yaml
deleted file mode 100644 (file)
index 324593c..0000000
+++ /dev/null
@@ -1,147 +0,0 @@
-# ========================LICENSE_START=================================
-# O-RAN-SC
-# %%
-# Copyright (C) 2019 AT&T Intellectual Property and Nokia
-# %%
-# 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.
-# ========================LICENSE_END===================================
-openapi: 3.0.0
-info:
-  title: E2 Manager Service
-  description: This is a description of E2 manager service APIs
-  version: 1.0.0
-servers:
-  - url: http://{apiRoot}/nodeb/v1
-    variables:
-      apiRoot:
-        default: localhost:3800
-        description: >-
-           E2 manager
-paths:
-  /setup:
-    post:
-      summary: X2 Setup Request
-      tags:
-        - E2 Manager
-      operationId: setup
-      requestBody:
-        content:
-          application/json:
-            schema:
-              $ref: '#/components/schemas/SetupRequest'
-        required: true
-      responses:
-        '200':
-          description: Request was handled successfuly
-        '400':
-          description: Invalid input
-          content:
-            application/json:
-              schema:
-                $ref: '#/components/schemas/ErrorResponse'
-        '404':
-          description: Resource not found
-          content:
-            application/json:
-              schema:
-                $ref: '#/components/schemas/ErrorResponse'
-        '500':
-          description: Internal server error
-          content:
-            application/json:
-              schema:
-                $ref: '#/components/schemas/ErrorResponse'
-        default:
-          description: Unexpected error
-          content:
-            application/json:
-              schema:
-                $ref: '#/components/schemas/ErrorResponse'
-
-  /endcSetup:
-    post:
-      tags:
-        - E2 Manager
-      summary: ENDC Setup Request
-      operationId: endcSetup
-      requestBody:
-        content:
-          application/json:
-            schema:
-              $ref: '#/components/schemas/SetupRequest'
-        required: true
-      responses:
-        '200':
-          description: Request was handled successfuly
-        '400':
-          description: Invalid input
-          content:
-            application/json:
-              schema:
-                $ref: '#/components/schemas/ErrorResponse'
-        '404':
-          description: Resource not found
-          content:
-            application/json:
-              schema:
-                $ref: '#/components/schemas/ErrorResponse'
-        '500':
-          description: Internal server error
-          content:
-            application/json:
-              schema:
-                $ref: '#/components/schemas/ErrorResponse'
-        default:
-          description: Unexpected error
-          content:
-            application/json:
-              schema:
-                $ref: '#/components/schemas/ErrorResponse'
-
-  /health:
-    get:
-      tags:
-        - E2 Manager
-      summary: E2 Manager Service Health Check
-      operationId: healthCheck
-      responses:
-        '200':
-          description: OK
-components:
-  schemas:
-    SetupRequest:
-      type: object
-      required:
-        - ranIp
-        - ranPort
-        - ranName
-      properties:
-        ranIp:
-          type: string
-        ranPort:
-          type: integer
-          format: uint16
-        ranName:
-          type: string
-    ErrorResponse:
-      type: object
-      required:
-        - errorCode
-        - errorMessage
-      properties:
-        errorCode:
-          type: string
-          description: 401 - corrupted json, 402 - validation error, 501 - internal problem
-        errorMessage:
-          type: string
-          description: Human readable text
 openapi: 3.0.0
 info:
   title: E2 Manager Service
-  description: This is a description of E2 manager service APIs
+  description: E2 Manager Service APIs
   version: 1.0.0
 servers:
-  - url: http://{apiRoot}/nodeb/v1
+  - url: 'http://{apiRoot}/v1'
     variables:
       apiRoot:
-        default: localhost:3800
-        description: >-
-           E2 manager
+        default: 'localhost:3800'
 paths:
-  /setup:
+  /nodeb/x2-setup:
     post:
-      summary: X2 Setup Request
+      summary: X2 Setup
       tags:
-        - X2 Setup Request
-      operationId: setup
+        - nodeb
+      operationId: x2Setup
       requestBody:
         content:
           application/json:
@@ -42,37 +40,24 @@ paths:
         required: true
       responses:
         '200':
-          description: Request was handled successfuly
+          description: Success
         '400':
           description: Invalid input
           content:
-            application/json:
-              schema:
-                $ref: '#/components/schemas/ErrorResponse'
-        '404':
-          description: Resource not found
-          content:
-            application/json:
+            application/problem+json:
               schema:
                 $ref: '#/components/schemas/ErrorResponse'
         '500':
-          description: Internal server error
+          description: Internal error
           content:
-            application/json:
-              schema:
-                $ref: '#/components/schemas/ErrorResponse'
-        default:
-          description: Unexpected error
-          content:
-            application/json:
+            application/problem+json:
               schema:
                 $ref: '#/components/schemas/ErrorResponse'
-
-  /endcSetup:
+  /nodeb/endc-setup:
     post:
       tags:
-        - ENDC Setup Request
-      summary: ENDC Setup Request
+        - nodeb
+      summary: ENDC Setup
       operationId: endcSetup
       requestBody:
         content:
@@ -82,38 +67,24 @@ paths:
         required: true
       responses:
         '200':
-          description: Request was handled successfuly
+          description: Success
         '400':
           description: Invalid input
           content:
             application/json:
               schema:
                 $ref: '#/components/schemas/ErrorResponse'
-        '404':
-          description: Resource not found
-          content:
-            application/json:
-              schema:
-                $ref: '#/components/schemas/ErrorResponse'
         '500':
-          description: Internal server error
+          description: Internal Error
           content:
-            application/json:
-              schema:
-                $ref: '#/components/schemas/ErrorResponse'
-        default:
-          description: Unexpected error
-          content:
-            application/json:
+            application/problem+json:
               schema:
                 $ref: '#/components/schemas/ErrorResponse'
-
   /health:
     get:
       tags:
         - Health Check
       summary: E2 Manager Service Health Check
-      operationId: healthCheck
       responses:
         '200':
           description: OK
@@ -141,7 +112,7 @@ components:
       properties:
         errorCode:
           type: string
-          description: 401 - corrupted json, 402 - validation error, 501 - internal problem
+          description: '401 - corrupted json, 402 - validation error, 501 - internal problem'
         errorMessage:
           type: string
           description: Human readable text
diff --git a/e2-mgr-client/src/main/resources/e2_mgr_rest_api_v0_0_1.yaml b/e2-mgr-client/src/main/resources/e2_mgr_rest_api_v0_0_1.yaml
deleted file mode 100644 (file)
index f6b7362..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-###
-# ========================LICENSE_START=================================
-# O-RAN-SC
-# %%
-# Copyright (C) 2019 AT&T Intellectual Property and Nokia
-# %%
-# 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.
-# ========================LICENSE_END===================================
-###
----
-swagger: "2.0"
-info:
-  description: "Draft API for RIC e2-manager"
-  version: "0.0.1"
-  title: "RIC e2-manager"
-  license:
-    name: "Apache 2.0"
-    url: "http://www.apache.org/licenses/LICENSE-2.0.html"
-host: "localhost"
-basePath: "/e2/v1"
-schemes:
-  - "http"
-paths:
-  /e2/v1/health:
-    get:
-      summary: "Health check of E2 Manager"
-      operationId: "getHealth"
-      responses:
-        200:
-          description: "Health is good"
-        500:
-          description: "Health is poor"
-  /e2/v1/setup:
-    post:
-      summary: "Set up connection to a RAN element"
-      operationId: "setupRan"
-      consumes:
-        - "application/json"
-      produces:
-        - "application/json"
-      parameters:
-        - in: "body"
-          name: "ranSetupRequest"
-          description: "Setup request with host and port"
-          required: true
-          schema:
-            $ref: "#/definitions/ranSetupRequest"
-      responses:
-        200:
-          description: "Setup successful"
-        400:
-          description: "Invalid input"
-definitions:
-  ranSetupRequest:
-    type: "object"
-    properties:
-      ranIp:
-        type: "string"
-        description: "IPv4/IPv6 address"
-      ranPort:
-        type: "integer"
-        format: "int32"
-        example: 80
-      ranName:
-        type: "string"
-        description: "eNodeB/gNodeB name"
index 3bad7bb..7916cb9 100644 (file)
@@ -20,7 +20,7 @@
 package org.oransc.ric.portal.dashboard.e2mgr.client.test;
 
 import org.junit.jupiter.api.Test;
-import org.oransc.ric.e2mgr.client.api.E2ManagerApi;
+import org.oransc.ric.e2mgr.client.api.HealthCheckApi;
 import org.oransc.ric.e2mgr.client.invoker.ApiClient;
 import org.springframework.web.client.RestClientException;
 
@@ -35,9 +35,9 @@ public class E2ManagerClientTest {
        public void demo() {
                ApiClient apiClient = new ApiClient();
                apiClient.setBasePath("http://localhost:30099/");
-               E2ManagerApi e2Api = new E2ManagerApi(apiClient);
+               HealthCheckApi healthApi = new HealthCheckApi(apiClient);
                try {
-                       e2Api.healthCheck();
+                       healthApi.healthGet();
                        System.out.println("getHealth answered: " + apiClient.getStatusCode().toString());
                } catch (RestClientException e) {
                        System.err.println("getHealth failed: " + e.toString());
index ab61db5..5341f50 100644 (file)
@@ -47,7 +47,7 @@ limitations under the License.
                <dependency>
                        <groupId>org.o-ran-sc.ric.e2mgr.client</groupId>
                        <artifactId>e2-mgr-client</artifactId>
-                       <version>02052019-SNAPSHOT</version>
+                       <version>20190515-SNAPSHOT</version>
                </dependency>
                <dependency>
                        <groupId>org.o-ran-sc.ric.xappmgr.client</groupId>
index cedee21..1983623 100644 (file)
@@ -21,7 +21,8 @@ package org.oransc.ric.portal.dashboard.config;
 
 import java.lang.invoke.MethodHandles;
 
-import org.oransc.ric.e2mgr.client.api.E2ManagerApi;
+import org.oransc.ric.e2mgr.client.api.HealthCheckApi;
+import org.oransc.ric.e2mgr.client.api.NodebApi;
 import org.oransc.ric.e2mgr.client.invoker.ApiClient;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -59,8 +60,13 @@ public class E2ManagerConfiguration {
        }
 
        @Bean
-       public E2ManagerApi e2ManagerApi() {
-               return new E2ManagerApi(apiClient());
+       public HealthCheckApi e2HealthCheckApi() {
+               return new HealthCheckApi(apiClient());
+       }
+
+       @Bean
+       public NodebApi e2NodebApi() {
+               return new NodebApi(apiClient());
        }
 
 }
index 400397c..74d8c55 100644 (file)
@@ -26,7 +26,8 @@ import static org.mockito.Mockito.when;
 
 import java.lang.invoke.MethodHandles;
 
-import org.oransc.ric.e2mgr.client.api.E2ManagerApi;
+import org.oransc.ric.e2mgr.client.api.HealthCheckApi;
+import org.oransc.ric.e2mgr.client.api.NodebApi;
 import org.oransc.ric.e2mgr.client.invoker.ApiClient;
 import org.oransc.ric.e2mgr.client.model.SetupRequest;
 import org.slf4j.Logger;
@@ -57,14 +58,23 @@ public class E2ManagerMockConfiguration {
        }
 
        @Bean
-       public E2ManagerApi e2ManagerApi() {
+       public HealthCheckApi e2HealthCheckApi() {
                ApiClient apiClient = apiClient();
-               E2ManagerApi mockApi = mock(E2ManagerApi.class);
+               HealthCheckApi mockApi = mock(HealthCheckApi.class);
                when(mockApi.getApiClient()).thenReturn(apiClient);
 
                doAnswer(i -> {
                        return null;
-               }).when(mockApi).healthCheck();
+               }).when(mockApi).healthGet();
+               
+               return mockApi;
+       }
+
+       @Bean
+       public NodebApi e2NodebApi() {
+               ApiClient apiClient = apiClient();
+               NodebApi mockApi = mock(NodebApi.class);
+               when(mockApi.getApiClient()).thenReturn(apiClient);
 
                doAnswer(i -> {
                        return null;
@@ -72,7 +82,7 @@ public class E2ManagerMockConfiguration {
 
                doAnswer(i -> {
                        return null;
-               }).when(mockApi).setup(any(SetupRequest.class));
+               }).when(mockApi).x2Setup(any(SetupRequest.class));
 
                return mockApi;
        }
index 8b1fe72..97ea334 100644 (file)
@@ -25,7 +25,8 @@ import java.util.Set;
 
 import javax.servlet.http.HttpServletResponse;
 
-import org.oransc.ric.e2mgr.client.api.E2ManagerApi;
+import org.oransc.ric.e2mgr.client.api.HealthCheckApi;
+import org.oransc.ric.e2mgr.client.api.NodebApi;
 import org.oransc.ric.e2mgr.client.model.SetupRequest;
 import org.oransc.ric.portal.dashboard.DashboardApplication;
 import org.oransc.ric.portal.dashboard.DashboardConstants;
@@ -61,16 +62,19 @@ public class E2ManagerController {
        private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
 
        // Populated by the autowired constructor
-       private final E2ManagerApi e2ManagerApi;
+       private final HealthCheckApi e2HealthCheckApi;
+       private final NodebApi e2NodebApi;
 
        // Stores the requests and results.
        // TODO remove when the E2 manager is extended.
        private Set<E2SetupResponse> responses = new HashSet<>();
 
        @Autowired
-       public E2ManagerController(final E2ManagerApi e2ManagerApi) {
-               Assert.notNull(e2ManagerApi, "API must not be null");
-               this.e2ManagerApi = e2ManagerApi;
+       public E2ManagerController(final HealthCheckApi e2HealthCheckApi, final NodebApi e2NodebApi) {
+               Assert.notNull(e2HealthCheckApi, "API must not be null");
+               Assert.notNull(e2NodebApi, "API must not be null");
+               this.e2HealthCheckApi = e2HealthCheckApi;
+               this.e2NodebApi = e2NodebApi;
        }
 
        private void assertNotNull(Object o) {
@@ -88,15 +92,15 @@ public class E2ManagerController {
        @RequestMapping(value = DashboardConstants.VERSION_PATH, method = RequestMethod.GET)
        public SuccessTransport getVersion() {
                logger.debug("getVersion enter");
-               return new SuccessTransport(200, DashboardApplication.getImplementationVersion(E2ManagerApi.class));
+               return new SuccessTransport(200, DashboardApplication.getImplementationVersion(HealthCheckApi.class));
        }
 
        @ApiOperation(value = "Gets the health from the E2 manager, expressed as the response code.")
        @RequestMapping(value = "/health", method = RequestMethod.GET)
        public void getHealth(HttpServletResponse response) {
                logger.debug("getHealth");
-               e2ManagerApi.healthCheck();
-               response.setStatus(e2ManagerApi.getApiClient().getStatusCode().value());
+               e2HealthCheckApi.healthGet();
+               response.setStatus(e2HealthCheckApi.getApiClient().getStatusCode().value());
        }
 
        @ApiOperation(value = "Gets the unique requests submitted to the E2 manager.", response = E2SetupResponse.class, responseContainer = "List")
@@ -115,8 +119,8 @@ public class E2ManagerController {
                        assertNotEmpty(setupRequest.getRanIp());
                        assertNotEmpty(setupRequest.getRanName());
                        assertNotNull(setupRequest.getRanPort());
-                       e2ManagerApi.endcSetup(setupRequest);
-                       responseCode = e2ManagerApi.getApiClient().getStatusCode().value();
+                       e2NodebApi.endcSetup(setupRequest);
+                       responseCode = e2NodebApi.getApiClient().getStatusCode().value();
                } catch (Exception ex) {
                        logger.warn("endcSetup failed", ex);
                        response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
@@ -136,8 +140,8 @@ public class E2ManagerController {
                        assertNotEmpty(setupRequest.getRanIp());
                        assertNotEmpty(setupRequest.getRanName());
                        assertNotNull(setupRequest.getRanPort());
-                       e2ManagerApi.setup(setupRequest);
-                       responseCode = e2ManagerApi.getApiClient().getStatusCode().value();
+                       e2NodebApi.x2Setup(setupRequest);
+                       responseCode = e2NodebApi.getApiClient().getStatusCode().value();
                } catch (Exception ex) {
                        logger.warn("x2Setup failed", ex);
                        response.setStatus(HttpServletResponse.SC_BAD_REQUEST);