<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>
<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>
The application requires the following configuration files::
- application.properties
+ application.yaml
key.properties
portal.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
-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
-a 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.
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.
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
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
<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>
<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 -->
<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>
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.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;
@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());
+ @Autowired
+ private RICInstanceConfiguration instanceConfig;
+
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);
}
/**
--- /dev/null
+/*-
+ * ========================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;
+ }
+}
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.InstanceTransport;
import org.oransc.ric.portal.dashboard.model.SuccessTransport;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
// 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 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";
@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
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)
- // 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))
@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
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 {
this.version = version;
}
+ @Override
+ public String toString() {
+ return this.getClass().getName() + "[name=" + getName() + ", version=" + getVersion() + "]";
+ }
+
}
return ecompUser.isActive();
}
+ @Override
+ public String toString() {
+ return this.getClass().getName() + "[ecompUser=" + ecompUser + ", isAccountNonExpired=" + isAccountNonExpired()
+ + ", isAccountNonLocked=" + isAccountNonLocked() + ", isCredentialsNonExpired="
+ + isCredentialsNonExpired() + "]";
+ }
+
}
this.path = path;
}
+ @Override
+ public String toString() {
+ return this.getClass().getName() + "[timestamp=" + getTimestamp() + ", error=" + getError() + ", path="
+ + getPath() + "]";
+ }
+
}
--- /dev/null
+/*-
+ * ========================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() + "]";
+ }
+
+}
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;
return this;
}
+ @Override
+ public String toString() {
+ return this.getClass().getName() + "[nodebIdentity=" + getNodebIdentity() + ", nodebStatus=" + getNodebStatus()
+ + "]";
+ }
+
}
this.data = data;
}
+ @Override
+ public String toString() {
+ return this.getClass().getName() + "[status=" + getStatus() + ", data=" + getData() + "]";
+ }
+
}
+++ /dev/null
-# ========================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
--- /dev/null
+# ========================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
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;
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);
<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>