From 4d6f9a14931a6aaaab28b482d73380e0960a82d6 Mon Sep 17 00:00:00 2001 From: "Lott, Christopher (cl778h)" Date: Mon, 20 May 2019 06:09:40 -0400 Subject: [PATCH] Update E2 manager API to version 20190515 Change-Id: Ieeef95a9086fcf07c7cb026349898b9f7f5a376d Signed-off-by: Lott, Christopher (cl778h) --- .gitignore | 1 + docs/release-notes.rst | 1 + e2-mgr-client/pom.xml | 4 +- .../src/main/resources/e2_manager_02052019_2.yaml | 147 --------------------- ...er_02052019.yaml => e2_manager_2019-05-15.yaml} | 65 +++------ .../src/main/resources/e2_mgr_rest_api_v0_0_1.yaml | 76 ----------- .../e2mgr/client/test/E2ManagerClientTest.java | 6 +- webapp-backend/pom.xml | 2 +- .../dashboard/config/E2ManagerConfiguration.java | 12 +- .../config/E2ManagerMockConfiguration.java | 20 ++- .../dashboard/controller/E2ManagerController.java | 28 ++-- 11 files changed, 66 insertions(+), 296 deletions(-) delete mode 100644 e2-mgr-client/src/main/resources/e2_manager_02052019_2.yaml rename e2-mgr-client/src/main/resources/{e2_manager_02052019.yaml => e2_manager_2019-05-15.yaml} (63%) delete mode 100644 e2-mgr-client/src/main/resources/e2_mgr_rest_api_v0_0_1.yaml diff --git a/.gitignore b/.gitignore index c147df40..b3a7f276 100644 --- a/.gitignore +++ b/.gitignore @@ -40,6 +40,7 @@ ### visual studio ### .vs +**/.vscode # OSx cruft **/.DS_Store diff --git a/docs/release-notes.rst b/docs/release-notes.rst index fa2b4601..4274ba62 100644 --- a/docs/release-notes.rst +++ b/docs/release-notes.rst @@ -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 diff --git a/e2-mgr-client/pom.xml b/e2-mgr-client/pom.xml index 48caf8e2..b180f895 100644 --- a/e2-mgr-client/pom.xml +++ b/e2-mgr-client/pom.xml @@ -31,7 +31,7 @@ limitations under the License. org.o-ran-sc.ric.e2mgr.client e2-mgr-client RIC E2 Manager client - 02052019-SNAPSHOT + 20190515-SNAPSHOT UTF-8 UTF-8 @@ -104,7 +104,7 @@ limitations under the License. generate - ${project.basedir}/src/main/resources/e2_manager_02052019_2.yaml + ${project.basedir}/src/main/resources/e2_manager_2019-05-15.yaml java ${client.base.package.name} ${client.base.package.name}.model 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 index 324593c0..00000000 --- a/e2-mgr-client/src/main/resources/e2_manager_02052019_2.yaml +++ /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 diff --git a/e2-mgr-client/src/main/resources/e2_manager_02052019.yaml b/e2-mgr-client/src/main/resources/e2_manager_2019-05-15.yaml similarity index 63% rename from e2-mgr-client/src/main/resources/e2_manager_02052019.yaml rename to e2-mgr-client/src/main/resources/e2_manager_2019-05-15.yaml index a5ff7f00..20c4ec9d 100644 --- a/e2-mgr-client/src/main/resources/e2_manager_02052019.yaml +++ b/e2-mgr-client/src/main/resources/e2_manager_2019-05-15.yaml @@ -18,22 +18,20 @@ 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 index f6b73625..00000000 --- a/e2-mgr-client/src/main/resources/e2_mgr_rest_api_v0_0_1.yaml +++ /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" diff --git a/e2-mgr-client/src/test/java/org/oransc/ric/portal/dashboard/e2mgr/client/test/E2ManagerClientTest.java b/e2-mgr-client/src/test/java/org/oransc/ric/portal/dashboard/e2mgr/client/test/E2ManagerClientTest.java index 3bad7bb5..7916cb98 100644 --- a/e2-mgr-client/src/test/java/org/oransc/ric/portal/dashboard/e2mgr/client/test/E2ManagerClientTest.java +++ b/e2-mgr-client/src/test/java/org/oransc/ric/portal/dashboard/e2mgr/client/test/E2ManagerClientTest.java @@ -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()); diff --git a/webapp-backend/pom.xml b/webapp-backend/pom.xml index ab61db54..5341f508 100644 --- a/webapp-backend/pom.xml +++ b/webapp-backend/pom.xml @@ -47,7 +47,7 @@ limitations under the License. org.o-ran-sc.ric.e2mgr.client e2-mgr-client - 02052019-SNAPSHOT + 20190515-SNAPSHOT org.o-ran-sc.ric.xappmgr.client diff --git a/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/config/E2ManagerConfiguration.java b/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/config/E2ManagerConfiguration.java index cedee21a..19836230 100644 --- a/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/config/E2ManagerConfiguration.java +++ b/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/config/E2ManagerConfiguration.java @@ -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()); } } diff --git a/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/config/E2ManagerMockConfiguration.java b/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/config/E2ManagerMockConfiguration.java index 400397c4..74d8c554 100644 --- a/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/config/E2ManagerMockConfiguration.java +++ b/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/config/E2ManagerMockConfiguration.java @@ -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; } diff --git a/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/controller/E2ManagerController.java b/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/controller/E2ManagerController.java index 8b1fe724..97ea3344 100644 --- a/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/controller/E2ManagerController.java +++ b/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/controller/E2ManagerController.java @@ -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 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); -- 2.16.6