From 9457e10be41282c973744cdced34cdeff65837f7 Mon Sep 17 00:00:00 2001 From: "Lott, Christopher (cl778h)" Date: Thu, 9 May 2019 08:47:08 -0400 Subject: [PATCH] Add E2 setup response message Revise controller to answer setup requests with a message that contains request info plus request type, timestamp and result. Change-Id: I70bb38f611aee286f8d80a156fbd1b145085462f Issue-Id: RICPLT-1203 Signed-off-by: Lott, Christopher (cl778h) --- a1-med-client/pom.xml | 2 +- anr-xapp-client/pom.xml | 2 +- docs/release-notes.rst | 6 +- e2-mgr-client/pom.xml | 2 +- pom.xml | 2 +- webapp-backend/pom.xml | 2 +- .../dashboard/config/A1MediatorConfiguration.java | 3 +- .../config/E2ManagerMockConfiguration.java | 3 +- .../config/XappManagerMockConfiguration.java | 12 ++- .../dashboard/controller/E2ManagerController.java | 52 +++++++--- .../portal/dashboard/model/E2SetupRequestType.java | 25 +++++ .../portal/dashboard/model/E2SetupResponse.java | 107 +++++++++++++++++++++ webapp-frontend/pom.xml | 2 +- xapp-mgr-client/pom.xml | 2 +- 14 files changed, 194 insertions(+), 28 deletions(-) create mode 100644 webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/model/E2SetupRequestType.java create mode 100644 webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/model/E2SetupResponse.java diff --git a/a1-med-client/pom.xml b/a1-med-client/pom.xml index 0709cc89..372761ce 100644 --- a/a1-med-client/pom.xml +++ b/a1-med-client/pom.xml @@ -25,7 +25,7 @@ limitations under the License. org.o-ran-sc.portal.ric-dashboard ric-dash-parent - 1.0.1-SNAPSHOT + 1.0.2-SNAPSHOT org.o-ran-sc.ric.a1med.client diff --git a/anr-xapp-client/pom.xml b/anr-xapp-client/pom.xml index 25608bd3..08689f92 100644 --- a/anr-xapp-client/pom.xml +++ b/anr-xapp-client/pom.xml @@ -25,7 +25,7 @@ limitations under the License. org.o-ran-sc.portal.ric-dashboard ric-dash-parent - 1.0.1-SNAPSHOT + 1.0.2-SNAPSHOT org.o-ran-sc.ric.anrxapp.client diff --git a/docs/release-notes.rst b/docs/release-notes.rst index 04682738..6f69db91 100644 --- a/docs/release-notes.rst +++ b/docs/release-notes.rst @@ -20,7 +20,11 @@ RIC Dashboard Release Notes =========================== -Version 1.0.1, 9 May 2019 +Version 1.0.2, 9 May 2019 +------------------------- +* Add E2 response message with timestamp and status code + +Version 1.0.1, 6 May 2019 ------------------------- * Add draft A1 Mediator API definition * Use E2 Manager API definition dated 2 May 2019, with tag modifications diff --git a/e2-mgr-client/pom.xml b/e2-mgr-client/pom.xml index eaf961c3..46f86d99 100644 --- a/e2-mgr-client/pom.xml +++ b/e2-mgr-client/pom.xml @@ -25,7 +25,7 @@ limitations under the License. org.o-ran-sc.portal.ric-dashboard ric-dash-parent - 1.0.1-SNAPSHOT + 1.0.2-SNAPSHOT org.o-ran-sc.ric.e2mgr.client diff --git a/pom.xml b/pom.xml index d4dc5a09..c9b2878e 100644 --- a/pom.xml +++ b/pom.xml @@ -32,7 +32,7 @@ limitations under the License. ric-dash-parent RIC Dashboard project pom - 1.0.1-SNAPSHOT + 1.0.2-SNAPSHOT AT&T Intellectual Property and Nokia diff --git a/webapp-backend/pom.xml b/webapp-backend/pom.xml index f4cf8878..5eecd334 100644 --- a/webapp-backend/pom.xml +++ b/webapp-backend/pom.xml @@ -25,7 +25,7 @@ limitations under the License. org.o-ran-sc.portal.ric-dashboard ric-dash-parent - 1.0.1-SNAPSHOT + 1.0.2-SNAPSHOT ric-dash-be RIC Dashboard Webapp backend diff --git a/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/config/A1MediatorConfiguration.java b/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/config/A1MediatorConfiguration.java index 04ae8572..5ea4b057 100644 --- a/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/config/A1MediatorConfiguration.java +++ b/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/config/A1MediatorConfiguration.java @@ -34,7 +34,8 @@ import org.springframework.util.Assert; import org.springframework.web.client.RestTemplate; /** - * Creates an A1 mediator client as a bean to be managed by the Spring container. + * Creates an A1 mediator client as a bean to be managed by the Spring + * container. */ @Configuration @Profile("!mock") 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 d2921482..400397c4 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 @@ -37,7 +37,8 @@ import org.springframework.context.annotation.Profile; import org.springframework.http.HttpStatus; /** - * Creates a mock implementation of the E2 manager client API. + * Creates a mock implementation of the E2 manager client API. This version + * answers only status codes, no data, so the mock implementations are trivial. */ @Profile("mock") @Configuration diff --git a/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/config/XappManagerMockConfiguration.java b/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/config/XappManagerMockConfiguration.java index 27d713bc..f6bb3787 100644 --- a/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/config/XappManagerMockConfiguration.java +++ b/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/config/XappManagerMockConfiguration.java @@ -58,13 +58,17 @@ public class XappManagerMockConfiguration { public XappManagerMockConfiguration() { logger.info("Configuring mock xApp Manager"); Xapp ac = new Xapp().name("Admission Control").version("v3").status(StatusEnum.FAILED); - ac.addInstancesItem(new XappInstance().name("cdef-3456").ip("3.4.5.6").port(200).status(XappInstance.StatusEnum.RUNNING)); + ac.addInstancesItem( + new XappInstance().name("cdef-3456").ip("3.4.5.6").port(200).status(XappInstance.StatusEnum.RUNNING)); Xapp an = new Xapp().name("ANR Control").version("v0").status(StatusEnum.SUPERSEDED); - an.addInstancesItem(new XappInstance().name("fedc-8765").ip("8.7.6.5").port(400).status(XappInstance.StatusEnum.RUNNING)); + an.addInstancesItem( + new XappInstance().name("fedc-8765").ip("8.7.6.5").port(400).status(XappInstance.StatusEnum.RUNNING)); Xapp dc = new Xapp().name("Dual Connectivity").version("v2").status(StatusEnum.DELETED); - dc.addInstancesItem(new XappInstance().name("def0-6789").ip("6.7.8.9").port(300).status(XappInstance.StatusEnum.COMPLETED)); + dc.addInstancesItem( + new XappInstance().name("def0-6789").ip("6.7.8.9").port(300).status(XappInstance.StatusEnum.COMPLETED)); Xapp pc = new Xapp().name("Pendulum Control").version("v1").status(StatusEnum.DEPLOYED); - pc.addInstancesItem(new XappInstance().name("abcd-1234").ip("1.2.3.4").port(100).status(XappInstance.StatusEnum.RUNNING)); + pc.addInstancesItem( + new XappInstance().name("abcd-1234").ip("1.2.3.4").port(100).status(XappInstance.StatusEnum.RUNNING)); allXapps = new AllXapps(); allXapps.add(ac); allXapps.add(an); 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 fb1add86..26b404a5 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 @@ -28,6 +28,9 @@ import javax.servlet.http.HttpServletResponse; import org.oransc.ric.e2mgr.client.api.E2ManagerApi; import org.oransc.ric.e2mgr.client.model.SetupRequest; import org.oransc.ric.portal.dashboard.DashboardConstants; +import org.oransc.ric.portal.dashboard.model.E2SetupRequestType; +import org.oransc.ric.portal.dashboard.model.E2SetupResponse; +import org.oransc.ric.portal.dashboard.model.IDashboardResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -46,7 +49,7 @@ import io.swagger.annotations.ApiOperation; * * As of this writing the E2 interface only supports setup connection and check * health actions; it does not support query or close operations on existing - * connections. So this class mocks up some of that needed functionality. + * connections. So this class mocks up some of that functionality. */ @Configuration @RestController @@ -58,9 +61,9 @@ public class E2ManagerController { // Populated by the autowired constructor private final E2ManagerApi e2ManagerApi; - // Tracks the requests previously submitted. + // Stores the requests and results. // TODO remove when the E2 manager is extended. - private Set requests = new HashSet<>(); + private Set responses = new HashSet<>(); @Autowired public E2ManagerController(final E2ManagerApi e2ManagerApi) { @@ -87,32 +90,53 @@ public class E2ManagerController { response.setStatus(e2ManagerApi.getApiClient().getStatusCode().value()); } - @ApiOperation(value = "Gets the unique requests submitted to the E2 manager.", response = SetupRequest.class, responseContainer = "List") + @ApiOperation(value = "Gets the unique requests submitted to the E2 manager.", response = E2SetupResponse.class, responseContainer = "List") @RequestMapping(value = "/setup", method = RequestMethod.GET) - public Iterable getRequests() { + public Iterable getRequests() { logger.debug("getRequests"); - return requests; + return responses; } - @ApiOperation(value = "Sets up a RAN connection via the E2 manager.") - @RequestMapping(value = "/setup", method = RequestMethod.POST) - public void setup(@RequestBody SetupRequest setupRequest, HttpServletResponse response) { - logger.debug("setup {}", setupRequest); + @ApiOperation(value = "Sets up an EN-DC RAN connection via the E2 manager.", response = E2SetupResponse.class) + @RequestMapping(value = "/endcSetup", method = RequestMethod.POST) + public E2SetupResponse endcSetup(@RequestBody SetupRequest setupRequest, HttpServletResponse response) { + logger.debug("endcSetup {}", setupRequest); + int responseCode = -1; try { assertNotEmpty(setupRequest.getRanIp()); assertNotEmpty(setupRequest.getRanName()); assertNotNull(setupRequest.getRanPort()); + e2ManagerApi.endcSetup(setupRequest); + responseCode = e2ManagerApi.getApiClient().getStatusCode().value(); } catch (Exception ex) { - logger.error("Bad request", ex); + logger.warn("endcSetup failed", ex); response.setStatus(HttpServletResponse.SC_BAD_REQUEST); + responseCode = HttpServletResponse.SC_BAD_REQUEST; } + E2SetupResponse r = new E2SetupResponse(E2SetupRequestType.ENDC, setupRequest, responseCode); + responses.add(r); + return r; + } + + @ApiOperation(value = "Sets up an X2 RAN connection via the E2 manager.", response = E2SetupResponse.class) + @RequestMapping(value = "/x2Setup", method = RequestMethod.POST) + public IDashboardResponse x2Setup(@RequestBody SetupRequest setupRequest, HttpServletResponse response) { + logger.debug("x2Setup {}", setupRequest); + int responseCode = -1; try { - requests.add(setupRequest); + assertNotEmpty(setupRequest.getRanIp()); + assertNotEmpty(setupRequest.getRanName()); + assertNotNull(setupRequest.getRanPort()); e2ManagerApi.setup(setupRequest); + responseCode = e2ManagerApi.getApiClient().getStatusCode().value(); } catch (Exception ex) { - logger.error("Failed", ex); - response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); + logger.warn("x2Setup failed", ex); + response.setStatus(HttpServletResponse.SC_BAD_REQUEST); + responseCode = HttpServletResponse.SC_BAD_REQUEST; } + E2SetupResponse r = new E2SetupResponse(E2SetupRequestType.X2, setupRequest, responseCode); + responses.add(r); + return r; } } diff --git a/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/model/E2SetupRequestType.java b/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/model/E2SetupRequestType.java new file mode 100644 index 00000000..a8d822f7 --- /dev/null +++ b/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/model/E2SetupRequestType.java @@ -0,0 +1,25 @@ +/*- + * ========================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=================================== + */ + +package org.oransc.ric.portal.dashboard.model; + +public enum E2SetupRequestType { + ENDC, X2; +} diff --git a/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/model/E2SetupResponse.java b/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/model/E2SetupResponse.java new file mode 100644 index 00000000..15f60fa6 --- /dev/null +++ b/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/model/E2SetupResponse.java @@ -0,0 +1,107 @@ +/*- + * ========================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=================================== + */ +package org.oransc.ric.portal.dashboard.model; + +import java.time.Instant; + +import org.oransc.ric.e2mgr.client.model.SetupRequest; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Response to an E2 Manager setupRequest message carries the original + * information plus request type, timestamp and HTTP response code. + */ +public class E2SetupResponse extends SetupRequest implements IDashboardResponse { + + public E2SetupResponse() { + } + + public E2SetupResponse(E2SetupRequestType type, SetupRequest request, int responseCode) { + super.ranName(request.getRanName()).ranIp(request.getRanIp()).ranPort(request.getRanPort()); + this.requestType = type; + this.timeStamp = Instant.now(); + this.responseCode = responseCode; + } + + @JsonProperty("requestType") + private E2SetupRequestType requestType = null; + + public SetupRequest requestType(E2SetupRequestType type) { + this.requestType = type; + return this; + } + + /** + * Get requestType + * + * @return requestType + **/ + public E2SetupRequestType getRequestType() { + return requestType; + } + + public void setRequestType(E2SetupRequestType type) { + this.requestType = type; + } + + @JsonProperty("timeStamp") + private Instant timeStamp = null; + + public SetupRequest timeStamp(Instant timeStamp) { + this.timeStamp = timeStamp; + return this; + } + + /** + * Get timeStamp + * + * @return timeStamp + **/ + public Instant getTimeStamp() { + return timeStamp; + } + + public void setTimeStamp(Instant timeStamp) { + this.timeStamp = timeStamp; + } + + @JsonProperty("responseCode") + private Integer responseCode = null; + + public SetupRequest responseCode(Integer responseCode) { + this.responseCode = responseCode; + return this; + } + + /** + * Get responseCode + * + * @return responseCode + **/ + public Integer getResponseCode() { + return responseCode; + } + + public void setResponseCode(Integer responseCode) { + this.responseCode = responseCode; + } + +} diff --git a/webapp-frontend/pom.xml b/webapp-frontend/pom.xml index 180db42a..2ac083ed 100644 --- a/webapp-frontend/pom.xml +++ b/webapp-frontend/pom.xml @@ -25,7 +25,7 @@ limitations under the License. org.o-ran-sc.portal.ric-dashboard ric-dash-parent - 1.0.1-SNAPSHOT + 1.0.2-SNAPSHOT ric-dash-fe RIC Dashboard Webapp frontend diff --git a/xapp-mgr-client/pom.xml b/xapp-mgr-client/pom.xml index 496510af..9146e19d 100644 --- a/xapp-mgr-client/pom.xml +++ b/xapp-mgr-client/pom.xml @@ -25,7 +25,7 @@ limitations under the License. org.o-ran-sc.portal.ric-dashboard ric-dash-parent - 1.0.1-SNAPSHOT + 1.0.2-SNAPSHOT org.o-ran-sc.ric.xappmgr.client -- 2.16.6