Add E2 setup response message 27/127/2
authorLott, Christopher (cl778h) <cl778h@att.com>
Thu, 9 May 2019 12:47:08 +0000 (08:47 -0400)
committerLott, Christopher (cl778h) <cl778h@att.com>
Thu, 9 May 2019 15:18:01 +0000 (11:18 -0400)
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) <cl778h@att.com>
14 files changed:
a1-med-client/pom.xml
anr-xapp-client/pom.xml
docs/release-notes.rst
e2-mgr-client/pom.xml
pom.xml
webapp-backend/pom.xml
webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/config/A1MediatorConfiguration.java
webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/config/E2ManagerMockConfiguration.java
webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/config/XappManagerMockConfiguration.java
webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/controller/E2ManagerController.java
webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/model/E2SetupRequestType.java [new file with mode: 0644]
webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/model/E2SetupResponse.java [new file with mode: 0644]
webapp-frontend/pom.xml
xapp-mgr-client/pom.xml

index 0709cc8..372761c 100644 (file)
@@ -25,7 +25,7 @@ limitations under the License.
        <parent>
                <groupId>org.o-ran-sc.portal.ric-dashboard</groupId>
                <artifactId>ric-dash-parent</artifactId>
-               <version>1.0.1-SNAPSHOT</version>
+               <version>1.0.2-SNAPSHOT</version>
        </parent>
        <!-- This groupId will NOT allow deployment in LF -->
        <groupId>org.o-ran-sc.ric.a1med.client</groupId>
index 25608bd..08689f9 100644 (file)
@@ -25,7 +25,7 @@ limitations under the License.
        <parent>
                <groupId>org.o-ran-sc.portal.ric-dashboard</groupId>
                <artifactId>ric-dash-parent</artifactId>
-               <version>1.0.1-SNAPSHOT</version>
+               <version>1.0.2-SNAPSHOT</version>
        </parent>
        <!-- This groupId will NOT allow deployment in LF -->
        <groupId>org.o-ran-sc.ric.anrxapp.client</groupId>
index 0468273..6f69db9 100644 (file)
 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
index eaf961c..46f86d9 100644 (file)
@@ -25,7 +25,7 @@ limitations under the License.
        <parent>
                <groupId>org.o-ran-sc.portal.ric-dashboard</groupId>
                <artifactId>ric-dash-parent</artifactId>
-               <version>1.0.1-SNAPSHOT</version>
+               <version>1.0.2-SNAPSHOT</version>
        </parent>
        <!-- This groupId will NOT allow deployment in LF -->
        <groupId>org.o-ran-sc.ric.e2mgr.client</groupId>
diff --git a/pom.xml b/pom.xml
index d4dc5a0..c9b2878 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -32,7 +32,7 @@ limitations under the License.
        <artifactId>ric-dash-parent</artifactId>
        <name>RIC Dashboard project</name>
        <packaging>pom</packaging>
-       <version>1.0.1-SNAPSHOT</version>
+       <version>1.0.2-SNAPSHOT</version>
        <!-- Properties for the license-maven-plugin in child POMs -->
        <properties>
                <lmp.organization.name>AT&amp;T Intellectual Property and Nokia</lmp.organization.name>
index f4cf887..5eecd33 100644 (file)
@@ -25,7 +25,7 @@ limitations under the License.
        <parent>
                <groupId>org.o-ran-sc.portal.ric-dashboard</groupId>
                <artifactId>ric-dash-parent</artifactId>
-               <version>1.0.1-SNAPSHOT</version>
+               <version>1.0.2-SNAPSHOT</version>
        </parent>
        <artifactId>ric-dash-be</artifactId>
        <name>RIC Dashboard Webapp backend</name>
index 04ae857..5ea4b05 100644 (file)
@@ -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")
index d292148..400397c 100644 (file)
@@ -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
index 27d713b..f6bb378 100644 (file)
@@ -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);
index fb1add8..26b404a 100644 (file)
@@ -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<SetupRequest> requests = new HashSet<>();
+       private Set<E2SetupResponse> 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<SetupRequest> getRequests() {
+       public Iterable<E2SetupResponse> 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 (file)
index 0000000..a8d822f
--- /dev/null
@@ -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 (file)
index 0000000..15f60fa
--- /dev/null
@@ -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;
+       }
+
+}
index 180db42..2ac083e 100644 (file)
@@ -25,7 +25,7 @@ limitations under the License.
        <parent>
                <groupId>org.o-ran-sc.portal.ric-dashboard</groupId>
                <artifactId>ric-dash-parent</artifactId>
-               <version>1.0.1-SNAPSHOT</version>
+               <version>1.0.2-SNAPSHOT</version>
        </parent>
        <artifactId>ric-dash-fe</artifactId>
        <name>RIC Dashboard Webapp frontend</name>
index 496510a..9146e19 100644 (file)
@@ -25,7 +25,7 @@ limitations under the License.
        <parent>
                <groupId>org.o-ran-sc.portal.ric-dashboard</groupId>
                <artifactId>ric-dash-parent</artifactId>
-               <version>1.0.1-SNAPSHOT</version>
+               <version>1.0.2-SNAPSHOT</version>
        </parent>
        <!-- This groupId will NOT allow deployment in LF -->
        <groupId>org.o-ran-sc.ric.xappmgr.client</groupId>