Add RIC instance list and controller method 80/1880/3
authorLott, Christopher (cl778h) <cl778h@att.com>
Fri, 29 Nov 2019 19:12:02 +0000 (14:12 -0500)
committerLott, Christopher (cl778h) <cl778h@att.com>
Tue, 3 Dec 2019 13:43:52 +0000 (08:43 -0500)
In the "B" release the Dashboard is expected to support multiple RIC
instances.  Switch config file format to YAML for ease of maintaining
a list, add a mock list of instances, and a new admin controller method
that publishes the list.
Bump the POM versions to 2.0.

Change-Id: Iaa2558b4e1670482d5e7b32f454f9d24de9cef04
Signed-off-by: Lott, Christopher (cl778h) <cl778h@att.com>
21 files changed:
a1-med-client/pom.xml
app-mgr-client/pom.xml
docs/config-deploy.rst
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/DashboardApplication.java
webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/config/RICInstanceConfiguration.java [new file with mode: 0644]
webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/controller/AdminController.java
webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/controller/AppManagerController.java
webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/model/AppTransport.java
webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/model/EcompUserDetails.java
webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/model/ErrorTransport.java
webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/model/InstanceTransport.java [new file with mode: 0644]
webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/model/RanDetailsTransport.java
webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/model/SuccessTransport.java
webapp-backend/src/main/resources/application.properties [deleted file]
webapp-backend/src/main/resources/application.yaml [new file with mode: 0644]
webapp-backend/src/test/java/org/oransc/ric/portal/dashboard/controller/AdminControllerTest.java
webapp-frontend/pom.xml

index f4c88c3..ca0a871 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>
        <parent>
                <groupId>org.o-ran-sc.portal.ric-dashboard</groupId>
                <artifactId>ric-dash-parent</artifactId>
-               <version>1.3.0-SNAPSHOT</version>
+               <version>2.0.0-SNAPSHOT</version>
        </parent>
        <!-- This groupId will NOT allow deployment in LF -->
        <groupId>org.o-ran-sc.ric.plt.a1med.client</groupId>
        </parent>
        <!-- This groupId will NOT allow deployment in LF -->
        <groupId>org.o-ran-sc.ric.plt.a1med.client</groupId>
index 4b41b8e..4d65e49 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>
        <parent>
                <groupId>org.o-ran-sc.portal.ric-dashboard</groupId>
                <artifactId>ric-dash-parent</artifactId>
-               <version>1.3.0-SNAPSHOT</version>
+               <version>2.0.0-SNAPSHOT</version>
        </parent>
        <!-- This groupId will NOT allow deployment in LF -->
        <groupId>org.o-ran-sc.ric.plt.appmgr.client</groupId>
        </parent>
        <!-- This groupId will NOT allow deployment in LF -->
        <groupId>org.o-ran-sc.ric.plt.appmgr.client</groupId>
index 11144ed..f02cbbd 100644 (file)
@@ -14,7 +14,7 @@ Configuration
 
 The application requires the following configuration files::
 
 
 The application requires the following configuration files::
 
-    application.properties
+    application.yaml
     key.properties
     portal.properties
 
     key.properties
     portal.properties
 
@@ -24,16 +24,16 @@ a configuration map.
 Application Properties
 ^^^^^^^^^^^^^^^^^^^^^^
 
 Application Properties
 ^^^^^^^^^^^^^^^^^^^^^^
 
-The file ``application.properties`` must be provided when the
-application is launched, either in the current working directory or in
-a ``config`` subdirectory (latter is preferred). The Helm chart that
-deploys the application should mount this file appropriately.
+The file ``application.yaml`` must be provided when the application
+is launched, either in the current working directory or in a ``config``
+subdirectory (latter is preferred). The Helm chart that deploys the
+application should mount this file appropriately.
 
 Many properties have default values cached within the application, in
 
 Many properties have default values cached within the application, in
-file ``src/main/resources/application.properties``.  Properties with
-default values do NOT need to be repeated in a deployment-specific
-configuration.  Properties without default values MUST be specified in
-deployment-specific configuration.
+file ``src/main/resources/application.yaml``.  Properties with default
+values do NOT need to be repeated in a deployment-specific configuration.
+Properties without default values MUST be specified in a
+deployment-specific configuration.
 
 The properties are listed below in alphabetical order.
 
 
 The properties are listed below in alphabetical order.
 
@@ -200,7 +200,7 @@ Deployment
 A production server requires the configuration files listed above.
 All files should be placed in a ``config`` directory.  That name is
 important; Spring automatically searches that directory for the
 A production server requires the configuration files listed above.
 All files should be placed in a ``config`` directory.  That name is
 important; Spring automatically searches that directory for the
-``application.properties`` file. Further, that directory can easily be
+``application.yaml`` file. Further, that directory can easily be
 placed on the Java classpath so the additional files can be found at
 runtime.
 
 placed on the Java classpath so the additional files can be found at
 runtime.
 
@@ -243,11 +243,3 @@ include the ``config`` directory on the Java classpath::
     java -cp config:target/ric-dash-be-1.2.0-SNAPSHOT.jar \
         -Dloader.main=org.oransc.ric.portal.dashboard.DashboardApplication \
         org.springframework.boot.loader.PropertiesLauncher
     java -cp config:target/ric-dash-be-1.2.0-SNAPSHOT.jar \
         -Dloader.main=org.oransc.ric.portal.dashboard.DashboardApplication \
         org.springframework.boot.loader.PropertiesLauncher
-
-Alternately, to use the configuration in the "application-abc.properties" file,
-modify the command to have "spring.config.name=name" like this::
-
-    java -cp config:target/ric-dash-be-1.2.0-SNAPSHOT.jar \
-        -Dspring.config.name=application-abc \
-        -Dloader.main=org.oransc.ric.portal.dashboard.DashboardApplication \
-        org.springframework.boot.loader.PropertiesLauncher
index 35f6aab..697f46e 100644 (file)
@@ -5,6 +5,12 @@
 RIC Dashboard Release Notes
 ===========================
 
 RIC Dashboard Release Notes
 ===========================
 
+Version 2.0.0, 2 Dec 2019
+-------------------------
+* Change application properties file to YAML format
+* Add mock list of RIC instances to application properties
+* Add admin controller method to fetch list of RIC instances
+
 Version 1.3.0, 26 Nov 2019
 --------------------------
 * This is the Amber release version
 Version 1.3.0, 26 Nov 2019
 --------------------------
 * This is the Amber release version
index c50b0d5..ec60d53 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>
        <parent>
                <groupId>org.o-ran-sc.portal.ric-dashboard</groupId>
                <artifactId>ric-dash-parent</artifactId>
-               <version>1.3.0-SNAPSHOT</version>
+               <version>2.0.0-SNAPSHOT</version>
        </parent>
        <!-- This groupId will NOT allow deployment in LF -->
        <groupId>org.o-ran-sc.ric.plt.e2mgr.client</groupId>
        </parent>
        <!-- This groupId will NOT allow deployment in LF -->
        <groupId>org.o-ran-sc.ric.plt.e2mgr.client</groupId>
diff --git a/pom.xml b/pom.xml
index 8b9657b..8bee35b 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -33,7 +33,7 @@ limitations under the License.
        <artifactId>ric-dash-parent</artifactId>
        <name>RIC Dashboard project</name>
        <packaging>pom</packaging>
        <artifactId>ric-dash-parent</artifactId>
        <name>RIC Dashboard project</name>
        <packaging>pom</packaging>
-       <version>1.3.0-SNAPSHOT</version>
+       <version>2.0.0-SNAPSHOT</version>
        <properties>
                <java.version>11</java.version>
                <!-- Properties for the license-maven-plugin in child POMs -->
        <properties>
                <java.version>11</java.version>
                <!-- Properties for the license-maven-plugin in child POMs -->
index 892ca6f..7e3f1b5 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>
        <parent>
                <groupId>org.o-ran-sc.portal.ric-dashboard</groupId>
                <artifactId>ric-dash-parent</artifactId>
-               <version>1.3.0-SNAPSHOT</version>
+               <version>2.0.0-SNAPSHOT</version>
        </parent>
        <artifactId>ric-dash-be</artifactId>
        <name>RIC Dashboard Webapp backend</name>
        </parent>
        <artifactId>ric-dash-be</artifactId>
        <name>RIC Dashboard Webapp backend</name>
index ed5cf17..8cb774f 100644 (file)
@@ -22,8 +22,12 @@ package org.oransc.ric.portal.dashboard;
 
 import java.lang.invoke.MethodHandles;
 
 
 import java.lang.invoke.MethodHandles;
 
+import org.oransc.ric.portal.dashboard.config.RICInstanceConfiguration;
+import org.oransc.ric.portal.dashboard.model.InstanceTransport;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.CommandLineRunner;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.context.annotation.ComponentScan;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.context.annotation.ComponentScan;
@@ -31,15 +35,23 @@ import org.springframework.context.annotation.ComponentScan;
 @SpringBootApplication
 // Limit scan to dashboard classes; exclude generated API classes
 @ComponentScan("org.oransc.ric.portal.dashboard")
 @SpringBootApplication
 // Limit scan to dashboard classes; exclude generated API classes
 @ComponentScan("org.oransc.ric.portal.dashboard")
-public class DashboardApplication {
+public class DashboardApplication implements CommandLineRunner {
 
        private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
 
 
        private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
 
+       @Autowired
+       private RICInstanceConfiguration instanceConfig;
+
        public static void main(String[] args) {
                SpringApplication.run(DashboardApplication.class, args);
        public static void main(String[] args) {
                SpringApplication.run(DashboardApplication.class, args);
-               // Ensure this appears on the console by using level WARN
-               logger.warn("main: version '{}' successful start",
-                               getImplementationVersion(MethodHandles.lookup().lookupClass()));
+       }
+
+       @Override
+       public void run(String... args) throws Exception {
+               // Ensure output appears on the console by using level WARN
+               logger.warn("run: version '{}'", getImplementationVersion(MethodHandles.lookup().lookupClass()));
+               for (InstanceTransport it : instanceConfig.getInstances())
+                       logger.warn("run: RIC instance {}", it);
        }
 
        /**
        }
 
        /**
diff --git a/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/config/RICInstanceConfiguration.java b/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/config/RICInstanceConfiguration.java
new file mode 100644 (file)
index 0000000..f39f200
--- /dev/null
@@ -0,0 +1,58 @@
+/*-
+ * ========================LICENSE_START=================================
+ * O-RAN-SC
+ * %%
+ * Copyright (C) 2019 AT&T Intellectual Property
+ * %%
+ * 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.config;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.oransc.ric.portal.dashboard.model.InstanceTransport;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.context.annotation.Configuration;
+
+/**
+ * Holds the list of RIC instances read from configuration data. This asserts no
+ * Spring profile such as ("!test"). No mock version of this class is required.
+ * Populated from a YAML list in the application properties like this:
+ * 
+ * <pre>
+ * ric-instance-list:
+    instances:
+        -
+          key: key1
+          name: Friendly Name One
+        -
+          key: key2
+          name: Friendly Name Two
+ * </pre>
+ */
+@Configuration
+@ConfigurationProperties(prefix = "ric-instance-list")
+public class RICInstanceConfiguration {
+       private List<InstanceTransport> instances = new ArrayList<>();
+
+       public List<InstanceTransport> getInstances() {
+               return instances;
+       }
+
+       public void setInstances(List<InstanceTransport> instances) {
+               this.instances = instances;
+       }
+}
index bb3700e..39488bd 100644 (file)
@@ -28,8 +28,10 @@ import org.onap.portalsdk.core.restful.domain.EcompUser;
 import org.oransc.ric.portal.dashboard.DashboardApplication;
 import org.oransc.ric.portal.dashboard.DashboardConstants;
 import org.oransc.ric.portal.dashboard.DashboardUserManager;
 import org.oransc.ric.portal.dashboard.DashboardApplication;
 import org.oransc.ric.portal.dashboard.DashboardConstants;
 import org.oransc.ric.portal.dashboard.DashboardUserManager;
+import org.oransc.ric.portal.dashboard.config.RICInstanceConfiguration;
 import org.oransc.ric.portal.dashboard.model.ErrorTransport;
 import org.oransc.ric.portal.dashboard.model.IDashboardResponse;
 import org.oransc.ric.portal.dashboard.model.ErrorTransport;
 import org.oransc.ric.portal.dashboard.model.IDashboardResponse;
+import org.oransc.ric.portal.dashboard.model.InstanceTransport;
 import org.oransc.ric.portal.dashboard.model.SuccessTransport;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.oransc.ric.portal.dashboard.model.SuccessTransport;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -55,8 +57,9 @@ public class AdminController {
 
        // Publish paths in constants so tests are easy to write
        public static final String CONTROLLER_PATH = DashboardConstants.ENDPOINT_PREFIX + "/admin";
 
        // Publish paths in constants so tests are easy to write
        public static final String CONTROLLER_PATH = DashboardConstants.ENDPOINT_PREFIX + "/admin";
-       public static final String USER_METHOD = "user";
        public static final String HEALTH_METHOD = "health";
        public static final String HEALTH_METHOD = "health";
+       public static final String INSTANCE_METHOD = "instance";
+       public static final String USER_METHOD = "user";
        public static final String VERSION_METHOD = DashboardConstants.VERSION_METHOD;
        public static final String XAPPMETRICS_METHOD = "metrics";
 
        public static final String VERSION_METHOD = DashboardConstants.VERSION_METHOD;
        public static final String XAPPMETRICS_METHOD = "metrics";
 
@@ -69,6 +72,9 @@ public class AdminController {
        @Autowired
        private DashboardUserManager dashboardUserManager;
 
        @Autowired
        private DashboardUserManager dashboardUserManager;
 
+       @Autowired
+       private RICInstanceConfiguration instanceConfig;
+
        @ApiOperation(value = "Gets the Dashboard MANIFEST.MF property Implementation-Version.", response = SuccessTransport.class)
        @GetMapping(VERSION_METHOD)
        // No role required
        @ApiOperation(value = "Gets the Dashboard MANIFEST.MF property Implementation-Version.", response = SuccessTransport.class)
        @GetMapping(VERSION_METHOD)
        // No role required
@@ -96,9 +102,17 @@ public class AdminController {
                return dashboardUserManager.getUsers();
        }
 
                return dashboardUserManager.getUsers();
        }
 
+       @ApiOperation(value = "Gets the list of RIC instances.", response = InstanceTransport.class, responseContainer = "List")
+       @GetMapping(INSTANCE_METHOD)
+       @Secured({ DashboardConstants.ROLE_ADMIN, DashboardConstants.ROLE_STANDARD })
+       public List<InstanceTransport> getInstances() {
+               logger.debug("getInstances");
+               return instanceConfig.getInstances();
+       }
+
        @ApiOperation(value = "Gets the kibana metrics URL for the specified app.", response = SuccessTransport.class)
        @GetMapping(XAPPMETRICS_METHOD)
        @ApiOperation(value = "Gets the kibana metrics URL for the specified app.", response = SuccessTransport.class)
        @GetMapping(XAPPMETRICS_METHOD)
-       // No role required
+       @Secured({ DashboardConstants.ROLE_ADMIN, DashboardConstants.ROLE_STANDARD })
        public IDashboardResponse getAppMetricsUrl(@RequestParam String app, HttpServletResponse response) {
                String metricsUrl = null;
                if (DashboardConstants.APP_NAME_AC.equals(app))
        public IDashboardResponse getAppMetricsUrl(@RequestParam String app, HttpServletResponse response) {
                String metricsUrl = null;
                if (DashboardConstants.APP_NAME_AC.equals(app))
index 0415746..cf267da 100644 (file)
@@ -158,7 +158,7 @@ public class AppManagerController {
        @ApiOperation(value = "Returns a list of deployable xapps.", response = DashboardDeployableXapps.class)
        @GetMapping(XAPPS_LIST_METHOD)
        @Secured({ DashboardConstants.ROLE_ADMIN, DashboardConstants.ROLE_STANDARD })
        @ApiOperation(value = "Returns a list of deployable xapps.", response = DashboardDeployableXapps.class)
        @GetMapping(XAPPS_LIST_METHOD)
        @Secured({ DashboardConstants.ROLE_ADMIN, DashboardConstants.ROLE_STANDARD })
-       public Object getAvailableXapps() {
+       public DashboardDeployableXapps getAvailableXapps() {
                logger.debug("getAvailableXapps");
                AllDeployableXapps appNames = xappApi.listAllDeployableXapps();
                // Answer a collection of structure instead of string
                logger.debug("getAvailableXapps");
                AllDeployableXapps appNames = xappApi.listAllDeployableXapps();
                // Answer a collection of structure instead of string
index fbc7bbc..ea04067 100644 (file)
@@ -21,9 +21,8 @@
 package org.oransc.ric.portal.dashboard.model;
 
 /**
 package org.oransc.ric.portal.dashboard.model;
 
 /**
- * Trivial model to transport available application from the App manager. I
- * expect that system will soon add additional attributes. This allows coding to
- * a structure rather than a scalar.
+ * Trivial model to transport available application details from the App
+ * manager.
  */
 public class AppTransport implements IDashboardResponse {
 
  */
 public class AppTransport implements IDashboardResponse {
 
@@ -63,4 +62,9 @@ public class AppTransport implements IDashboardResponse {
                this.version = version;
        }
 
                this.version = version;
        }
 
+       @Override
+       public String toString() {
+               return this.getClass().getName() + "[name=" + getName() + ", version=" + getVersion() + "]";
+       }
+
 }
 }
index 25a0073..c81a66b 100644 (file)
@@ -83,4 +83,11 @@ public class EcompUserDetails implements UserDetails {
                return ecompUser.isActive();
        }
 
                return ecompUser.isActive();
        }
 
+       @Override
+       public String toString() {
+               return this.getClass().getName() + "[ecompUser=" + ecompUser + ", isAccountNonExpired=" + isAccountNonExpired()
+                               + ", isAccountNonLocked=" + isAccountNonLocked() + ", isCredentialsNonExpired="
+                               + isCredentialsNonExpired() + "]";
+       }
+
 }
 }
index 516e3c8..df5c3e4 100644 (file)
@@ -130,4 +130,10 @@ public class ErrorTransport implements IDashboardResponse {
                this.path = path;
        }
 
                this.path = path;
        }
 
+       @Override
+       public String toString() {
+               return this.getClass().getName() + "[timestamp=" + getTimestamp() + ", error=" + getError() + ", path="
+                               + getPath() + "]";
+       }
+
 }
 }
diff --git a/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/model/InstanceTransport.java b/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/model/InstanceTransport.java
new file mode 100644 (file)
index 0000000..9f0ad2b
--- /dev/null
@@ -0,0 +1,52 @@
+/*-
+ * ========================LICENSE_START=================================
+ * O-RAN-SC
+ * %%
+ * Copyright (C) 2019 AT&T Intellectual Property
+ * %%
+ * 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;
+
+/**
+ * Trivial model to transport key-name pairs that represent RIC instances.
+ */
+public class InstanceTransport implements IDashboardResponse {
+
+       private String key;
+       private String name;
+
+       public String getKey() {
+               return key;
+       }
+
+       public void setKey(String key) {
+               this.key = key;
+       }
+
+       public String getName() {
+               return name;
+       }
+
+       public void setName(String s) {
+               this.name = s;
+       }
+
+       @Override
+       public String toString() {
+               return this.getClass().getName() + "[key=" + getKey() + ", name=" + getName() + "]";
+       }
+
+}
index 237ebb0..130a1c5 100644 (file)
@@ -22,7 +22,7 @@ package org.oransc.ric.portal.dashboard.model;
 import org.oransc.ric.e2mgr.client.model.GetNodebResponse;
 import org.oransc.ric.e2mgr.client.model.NodebIdentity;
 
 import org.oransc.ric.e2mgr.client.model.GetNodebResponse;
 import org.oransc.ric.e2mgr.client.model.NodebIdentity;
 
-public class RanDetailsTransport {
+public class RanDetailsTransport implements IDashboardResponse {
 
        private NodebIdentity nodebIdentity;
        private GetNodebResponse nodebStatus;
 
        private NodebIdentity nodebIdentity;
        private GetNodebResponse nodebStatus;
@@ -61,4 +61,10 @@ public class RanDetailsTransport {
                return this;
        }
 
                return this;
        }
 
+       @Override
+       public String toString() {
+               return this.getClass().getName() + "[nodebIdentity=" + getNodebIdentity() + ", nodebStatus=" + getNodebStatus()
+                               + "]";
+       }
+
 }
 }
index 9e13789..c0c9a24 100644 (file)
@@ -60,4 +60,9 @@ public class SuccessTransport implements IDashboardResponse {
                this.data = data;
        }
 
                this.data = data;
        }
 
+       @Override
+       public String toString() {
+               return this.getClass().getName() + "[status=" + getStatus() + ", data=" + getData() + "]";
+       }
+
 }
 }
diff --git a/webapp-backend/src/main/resources/application.properties b/webapp-backend/src/main/resources/application.properties
deleted file mode 100644 (file)
index a497f09..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-# ========================LICENSE_START=================================
-# O-RAN-SC
-# %%
-# Copyright (C) 2019 AT&T Intellectual Property
-# %%
-# 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===================================
-
-# Defines RIC Dashboard property keys and default values.
-# Create a copy in the launch directory to override values; or
-# copy to "application-abc.properties" as mentioned in the README.
-
-# A spring property but without a "spring" prefix;
-# the port number is chosen RANDOMLY when running tests
-server.port = 8080
-
-# path to file that stores user details;
-# use a persistent volume in a K8S deployment
-userfile = users.json
-
-# boolean flag whether to enforce Portal user and roles on requests
-portalapi.security = true
-# class that decrypts ciphertext from Portal
-portalapi.decryptor = org.oransc.ric.portal.dashboard.portalapi.PortalSdkDecryptorAes
-# name of request cookie with user ID
-portalapi.usercookie = UserId
-
-# portal credentials must be supplied at deployment time
-portalapi.appname = RIC Dashboard
-portalapi.username =
-portalapi.password =
-
-# endpoint URLs must be supplied at deployment time
-# A1 Mediator
-a1med.url.prefix = http://jar-app-props-default-A1-URL-prefix
-a1med.url.suffix =
-# App Manager
-appmgr.url.prefix = http://jar-app-props-default-Xapp-Mgr-URL
-appmgr.url.suffix = /ric/v1
-# E2 Manager
-e2mgr.url.prefix = http://jar-app-props-default-E2-URL
-e2mgr.url.suffix = /v1
-# Kubernetes API via https://github.com/nokia/caas-ingress
-# Set insecure=true to disable SSL certificate and hostname checking
-caasingress.insecure = true
-caasingress.aux.url.prefix = https://jar-app-props-default-caas-ingress-aux-URL
-caasingress.aux.url.suffix = /api
-caasingress.plt.url.prefix = https://jar-app-props-default-caas-ingress-plt-URL
-caasingress.plt.url.suffix = /api
-
-# Mimic slow endpoints by defining sleep period, in milliseconds
-mock.config.delay = 0
-
-# Kibana report on metrics
-metrics.url.ac = http://jar-app-props-kibana-url-ac
-metrics.url.mc = http://jar-app-props-kibana-url-mc
diff --git a/webapp-backend/src/main/resources/application.yaml b/webapp-backend/src/main/resources/application.yaml
new file mode 100644 (file)
index 0000000..ae4bdee
--- /dev/null
@@ -0,0 +1,100 @@
+# ========================LICENSE_START=================================
+# O-RAN-SC
+# %%
+# Copyright (C) 2019 AT&T Intellectual Property
+# %%
+# 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===================================
+
+# Defines RIC Dashboard property keys and default values.
+# Create a copy in the launch directory to override values.
+---
+
+# This file defines no profile(s).
+# These properties are largely ignored when the test profile is active.
+
+# A spring property but without a "spring" prefix;
+# the port number is chosen RANDOMLY when running tests
+server:
+    port: 8080
+
+# path to file that stores user details;
+# use a persistent volume in a K8S deployment
+userfile: users.json
+
+# Dashboard properties related to Portal
+portalapi:
+    # boolean flag whether to enforce Portal user and roles on requests
+    security: true
+    # class that decrypts ciphertext from Portal
+    decryptor: org.oransc.ric.portal.dashboard.portalapi.PortalSdkDecryptorAes
+    # name of request cookie with user ID
+    usercookie: UserId
+    # portal credentials must be supplied at deployment time
+    appname: RIC Dashboard
+    username:
+    password:
+
+# endpoint URLs must be supplied at deployment time
+
+# A1 Mediator
+a1med:
+    url:
+        prefix: http://jar-app-props-default-A1-URL-prefix
+        suffix:
+
+# App Manager
+appmgr:
+    url:
+        prefix: http://jar-app-props-default-Xapp-Mgr-URL
+        suffix: /ric/v1
+
+# E2 Manager
+e2mgr:
+    url:
+        prefix: http://jar-app-props-default-E2-URL
+        suffix: /v1
+
+# Kubernetes API via https://github.com/nokia/caas-ingress
+caasingress:
+    # Set insecure=true to disable SSL certificate and hostname checking
+    insecure: true
+    aux:
+        url:
+            prefix: https://jar-app-props-default-caas-ingress-aux-URL
+            suffix: /api
+    plt:
+        url:
+            prefix: https://jar-app-props-default-caas-ingress-plt-URL
+            suffix: /api
+
+# Mimic slow endpoints by defining sleep period, in milliseconds
+mock:
+    config:
+        delay: 0
+
+# Kibana report on metrics
+metrics:
+    url:
+        ac: http://jar-app-props-kibana-url-ac
+        mc: http://jar-app-props-kibana-url-mc
+
+# Instances
+ric-instance-list:
+    instances:
+        -
+          key: i1
+          name: Primary RIC Instance
+        -
+          key: i2
+          name: RIC Instance Nr Two
index 8e426ad..f1c2680 100644 (file)
@@ -30,6 +30,7 @@ import org.junit.jupiter.api.Test;
 import org.onap.portalsdk.core.restful.domain.EcompUser;
 import org.oransc.ric.portal.dashboard.DashboardConstants;
 import org.oransc.ric.portal.dashboard.model.ErrorTransport;
 import org.onap.portalsdk.core.restful.domain.EcompUser;
 import org.oransc.ric.portal.dashboard.DashboardConstants;
 import org.oransc.ric.portal.dashboard.model.ErrorTransport;
+import org.oransc.ric.portal.dashboard.model.InstanceTransport;
 import org.oransc.ric.portal.dashboard.model.SuccessTransport;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.oransc.ric.portal.dashboard.model.SuccessTransport;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -57,6 +58,16 @@ public class AdminControllerTest extends AbstractControllerTest {
                Assertions.assertTrue(voidResponse.getStatusCode().is2xxSuccessful());
        }
 
                Assertions.assertTrue(voidResponse.getStatusCode().is2xxSuccessful());
        }
 
+       @Test
+       public void getInstancesTest() {
+               URI uri = buildUri(null, AdminController.CONTROLLER_PATH, AdminController.INSTANCE_METHOD);
+               logger.info("Invoking {}", uri);
+               ResponseEntity<List<InstanceTransport>> response = testRestTemplateStandardRole().exchange(uri, HttpMethod.GET,
+                               null, new ParameterizedTypeReference<List<InstanceTransport>>() {
+                               });
+               Assertions.assertFalse(response.getBody().isEmpty());
+       }
+
        @Test
        public void getUsersTest() {
                URI uri = buildUri(null, AdminController.CONTROLLER_PATH, AdminController.USER_METHOD);
        @Test
        public void getUsersTest() {
                URI uri = buildUri(null, AdminController.CONTROLLER_PATH, AdminController.USER_METHOD);
index 9ae5d0b..c10fe17 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>
        <parent>
                <groupId>org.o-ran-sc.portal.ric-dashboard</groupId>
                <artifactId>ric-dash-parent</artifactId>
-               <version>1.3.0-SNAPSHOT</version>
+               <version>2.0.0-SNAPSHOT</version>
        </parent>
        <artifactId>ric-dash-fe</artifactId>
        <name>RIC Dashboard Webapp frontend</name>
        </parent>
        <artifactId>ric-dash-fe</artifactId>
        <name>RIC Dashboard Webapp frontend</name>