--- /dev/null
+*.class
+
+# Mobile Tools for Java (J2ME)
+.mtj.tmp/
+
+# Package Files #
+*.jar
+*.war
+*.ear
+
+# exclude jar for gradle wrapper
+!gradle/wrapper/*.jar
+
+# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
+hs_err_pid*
+
+# build files
+**/target
+target
+.gradle
+build
+
+logs/
--- /dev/null
+# E2 Manager Client Generator
+
+This projects generates a REST client library from the Swagger specification
+file stored here and packages it in a jar.
+
+## License
+
+Copyright (C) 2019 AT&T Intellectual Property & Nokia. All rights reserved.
+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.
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--<![CDATA[
+========================LICENSE_START=================================
+ORAN-OSC
+%%
+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===================================
+]]>-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.oranosc.ric.portal.dashboard</groupId>
+ <artifactId>ric-dash-parent</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </parent>
+ <groupId>org.oranosc.ric.e2mgr.client</groupId>
+ <artifactId>e2-mgr-client</artifactId>
+ <name>RIC E2 Manager client</name>
+ <version>0.0.1-SNAPSHOT</version>
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <swagger-annotations-version>1.5.15</swagger-annotations-version>
+ <client.base.package.name>org.oranosc.ric.e2mgr.client</client.base.package.name>
+ </properties>
+ <!-- Successful compilation requires generated code dependencies -->
+ <dependencies>
+ <dependency>
+ <groupId>io.swagger</groupId>
+ <artifactId>swagger-annotations</artifactId>
+ <version>${swagger-annotations-version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ </dependency>
+ <!-- HTTP client: Spring RestTemplate -->
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-web</artifactId>
+ <!-- <version>${spring-web-version}</version> -->
+ </dependency>
+ <!-- JSON processing: jackson -->
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-core</artifactId>
+ <!-- <version>${jackson-version}</version> -->
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-annotations</artifactId>
+ <!-- <version>${jackson-version}</version> -->
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-databind</artifactId>
+ <!-- <version>${jackson-version}</version> -->
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.jaxrs</groupId>
+ <artifactId>jackson-jaxrs-json-provider</artifactId>
+ <!-- <version>${jackson-version}</version> -->
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.datatype</groupId>
+ <artifactId>jackson-datatype-jsr310</artifactId>
+ <!-- <version>${jackson-version}</version> -->
+ </dependency>
+ <!-- test dependencies -->
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-api</artifactId>
+ <!-- spring sets the <version>5.4.2</version> -->
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>io.swagger</groupId>
+ <artifactId>swagger-codegen-maven-plugin</artifactId>
+ <version>2.3.1</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ <configuration>
+ <inputSpec>${project.basedir}/src/main/resources/e2_mgr_rest_api_v0_0_1.yaml</inputSpec>
+ <language>java</language>
+ <configOptions>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>${project.artifactId}</artifactId>
+ <artifactVersion>${project.version}</artifactVersion>
+ <artifactUrl>www.oran-osc.org</artifactUrl>
+ <artifactDescription>E2 manager client library</artifactDescription>
+ <library>resttemplate</library>
+ <java8>true</java8>
+ <dateLibrary>java8</dateLibrary>
+ <licenseName>Apache 2.0</licenseName>
+ <licenseUrl>https://www.apache.org/licenses/LICENSE-2.0</licenseUrl>
+ <scmConnection></scmConnection>
+ <scmDeveloperConnection></scmDeveloperConnection>
+ <scmUrl>http://gerrit.oran-osc.org</scmUrl>
+ <developerName>RIC Team</developerName>
+ <developerEmail></developerEmail>
+ <developerOrganization>AT&T and Nokia</developerOrganization>
+ <developerOrganizationUrl></developerOrganizationUrl>
+ </configOptions>
+ <packageName>${client.base.package.name}</packageName>
+ <modelPackage>${client.base.package.name}.model</modelPackage>
+ <apiPackage>${client.base.package.name}.api</apiPackage>
+ <invokerPackage>${client.base.package.name}.invoker</invokerPackage>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <!-- Require Java 1.8 -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <!-- Spring sets the <version></version> -->
+ <configuration>
+ <source>1.8</source>
+ <target>1.8</target>
+ </configuration>
+ </plugin>
+ <!-- Generate javadoc jar; see profile for Java 8 -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <!-- <version>2.10.3</version> -->
+ <executions>
+ <execution>
+ <id>attach-javadocs</id>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <!-- Generate source jar -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-source-plugin</artifactId>
+ <!-- <version>3.0.0</version> -->
+ <executions>
+ <execution>
+ <id>attach-sources</id>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
--- /dev/null
+###
+# ========================LICENSE_START=================================
+# ORAN-OSC
+# %%
+# 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"
--- /dev/null
+/*-
+ * ========================LICENSE_START=================================
+ * ORAN-OSC
+ * %%
+ * 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.oranosc.ric.portal.dashboard.e2mgr.demo;
+
+import org.junit.jupiter.api.Test;
+import org.oranosc.ric.e2mgr.client.api.DefaultApi;
+import org.oranosc.ric.e2mgr.client.invoker.ApiClient;
+import org.springframework.web.client.RestClientException;
+
+/**
+ * Demonstrates use of the generated E2 manager client.
+ *
+ * The test fails because no server is available.
+ */
+public class E2ManagerClientTest {
+
+ @Test
+ public void demo() {
+ ApiClient apiClient = new ApiClient();
+ apiClient.setBasePath("http://localhost:30099/");
+ DefaultApi e2Mgr = new DefaultApi(apiClient);
+ try {
+ e2Mgr.getHealth();
+ System.out.println("getHealth answered: " + apiClient.getStatusCode().toString());
+ } catch (RestClientException e) {
+ System.err.println("getHealth failed: " + e.toString());
+ }
+ }
+}
<module>webapp-frontend</module>
<module>webapp-backend</module>
<module>xapp-mgr-client</module>
+ <module>e2-mgr-client</module>
</modules>
<build>
<plugins>
</properties>
<dependencies>
<dependency>
- <groupId>${project.groupId}</groupId>
+ <groupId>org.oranosc.ric.e2mgr.client</groupId>
+ <artifactId>e2-mgr-client</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.oranosc.ric.xappmgr.client</groupId>
<artifactId>xapp-mgr-client</artifactId>
<version>0.0.10-SNAPSHOT</version>
</dependency>
<artifactId>springfox-swagger-ui</artifactId>
<version>${springfox.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-api</artifactId>
+ <!-- spring sets the <version>5.4.2</version> -->
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
<plugins>
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.context.annotation.ComponentScan;
@SpringBootApplication
+// Limit the annotation scan to the dashboard classes;
+// exclude the generated client classes!
+@ComponentScan("org.oranosc.ric.portal.dashboard")
public class DashboardApplication {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
--- /dev/null
+/*-
+ * ========================LICENSE_START=================================
+ * ORAN-OSC
+ * %%
+ * 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.oranosc.ric.portal.dash;
+
+import org.oranosc.ric.e2mgr.client.api.DefaultApi;
+import org.oranosc.ric.e2mgr.client.invoker.ApiClient;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.client.RestTemplate;
+
+@Configuration
+public class E2ManagerConfiguration {
+
+ @Value("${e2.manager.base.url}")
+ private String e2ManagerBaseUrl;
+
+ /**
+ * Required by autowired constructor {@link DefaultApi#DefaultApi(ApiClient)}
+ *
+ * @return Instance of E2 Manager client configured from properties
+ */
+ @Bean
+ public ApiClient e2ManagerClient() {
+ ApiClient apiClient = new ApiClient(new RestTemplate());
+ apiClient.setBasePath(e2ManagerBaseUrl);
+ return apiClient;
+ }
+
+}
*/
package org.oranosc.ric.portal.dash;
-import org.oranosc.ric.portal.dashboard.xmc.api.DefaultApi;
-import org.oranosc.ric.portal.dashboard.xmc.invoker.ApiClient;
+import org.oranosc.ric.xappmgr.client.api.DefaultApi;
+import org.oranosc.ric.xappmgr.client.invoker.ApiClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;
@Configuration
-@ComponentScan("org.oranosc.ric.portal")
public class XappManagerConfiguration {
@Value("${xapp.manager.base.url}")
* @return Instance of ApiClient configured from properties
*/
@Bean
- public ApiClient apiClient() {
- ApiClient apiClient = new ApiClient();
+ public ApiClient xappApiClient() {
+ ApiClient apiClient = new ApiClient(new RestTemplate());
apiClient.setBasePath(xappManagerBaseUrl);
return apiClient;
}
- /**
- * Required by autowired constructor {@link ApiClient#ApiClient(RestTemplate)}
- *
- * @return Instance of RestTemplate
- */
- @Bean
- public RestTemplate restTemplate() {
- return new RestTemplate();
- }
-
}
--- /dev/null
+/*-
+ * ========================LICENSE_START=================================
+ * ORAN-OSC
+ * %%
+ * 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.oranosc.ric.portal.dash.controller;
+
+import java.lang.invoke.MethodHandles;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.servlet.http.HttpServletResponse;
+
+import org.oranosc.ric.e2mgr.client.api.DefaultApi;
+import org.oranosc.ric.e2mgr.client.model.RanSetupRequest;
+import org.oranosc.ric.portal.dash.DashboardConstants;
+import org.oranosc.ric.portal.dash.model.SuccessTransport;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.http.MediaType;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+import io.swagger.annotations.ApiOperation;
+
+/**
+ * Provides methods to contact the E2 Manager.
+ *
+ * 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.
+ */
+@Configuration
+@RestController
+@RequestMapping(value = DashboardConstants.ENDPOINT_PREFIX + "/e2mgr", produces = MediaType.APPLICATION_JSON_VALUE)
+public class E2ManagerController {
+
+ private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
+
+ @Autowired
+ private DefaultApi e2ManagerClient;
+
+ // Tracks the requests previously submitted.
+ // TODO remove when the E2 manager is extended.
+ private Set<RanSetupRequest> requests = new HashSet<>();
+
+ private void assertNotNull(Object o) {
+ if (o == null)
+ throw new IllegalArgumentException("Null not permitted");
+ }
+
+ private void assertNotEmpty(String s) {
+ assertNotNull(s);
+ if (s.isEmpty())
+ throw new IllegalArgumentException("Empty not permitted");
+ }
+
+ @ApiOperation(value = "Gets the health from the E2 manager, expressed as the response code.", response = String.class)
+ @RequestMapping(value = "/health", method = RequestMethod.GET)
+ public SuccessTransport getHealth() {
+ logger.debug("getHealth");
+ return new SuccessTransport();
+ }
+
+ @ApiOperation(value = "Gets the unique requests submitted to the E2 manager.", response = RanSetupRequest.class, responseContainer = "List")
+ @RequestMapping(value = "/setup", method = RequestMethod.GET)
+ public Iterable<RanSetupRequest> getRequests() {
+ logger.debug("getRequests");
+ return requests;
+ }
+
+ @ApiOperation(value = "Sets up a RAN connection via the E2 manager.")
+ @RequestMapping(value = "/setup", method = RequestMethod.POST)
+ public void setup(@RequestBody RanSetupRequest rsr, HttpServletResponse response) {
+ logger.debug("setup {}", rsr);
+ try {
+ assertNotEmpty(rsr.getRanIp());
+ assertNotEmpty(rsr.getRanName());
+ assertNotNull(rsr.getRanPort());
+ } catch (Exception ex) {
+ logger.error("Bad request", ex);
+ response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
+ }
+ try {
+ requests.add(rsr);
+ e2ManagerClient.setupRan(rsr);
+ } catch (Exception ex) {
+ logger.error("Failed", ex);
+ response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ }
+ }
+
+}
--- /dev/null
+/*-
+ * ========================LICENSE_START=================================
+ * ORAN-OSC
+ * %%
+ * 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.oranosc.ric.portal.dash.controller;
+
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.web.servlet.error.ErrorAttributes;
+import org.springframework.boot.web.servlet.error.ErrorController;
+import org.springframework.util.Assert;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.context.request.ServletWebRequest;
+import org.springframework.web.context.request.WebRequest;
+
+import springfox.documentation.annotations.ApiIgnore;
+
+/**
+ * Returns JSON on error within the Spring-managed context. Does not fire for
+ * anything else; e.g., resource not found outside the context. If trace is
+ * requested via request parameter ("?trace=true") and available, adds stack
+ * trace information to the standard JSON error response.
+ *
+ * Excluded from Swagger API documentation.
+ *
+ * https://stackoverflow.com/questions/25356781/spring-boot-remove-whitelabel-error-page
+ * https://www.baeldung.com/spring-boot-custom-error-page
+ */
+@ApiIgnore
+@RestController
+public class SimpleErrorController implements ErrorController {
+
+ private static final String ERROR_PATH = "/error";
+ private static final String TRACE = "trace";
+ private final ErrorAttributes errorAttributes;
+
+ /**
+ * Constructor
+ *
+ * @param errorAttributes
+ * error attributes must not be null
+ */
+ @Autowired
+ public SimpleErrorController(ErrorAttributes errorAttributes) {
+ Assert.notNull(errorAttributes, "ErrorAttributes must not be null");
+ this.errorAttributes = errorAttributes;
+ }
+
+ @Override
+ public String getErrorPath() {
+ return ERROR_PATH;
+ }
+
+ /**
+ * Builds a map with error details
+ *
+ * @param aRequest
+ * HttpServletRequest
+ * @return Map of String to Object
+ */
+ @RequestMapping(ERROR_PATH)
+ public Map<String, Object> error(HttpServletRequest aRequest) {
+ Map<String, Object> body = getErrorAttributes(aRequest, getTraceParameter(aRequest));
+ body.put("decorated-by", SimpleErrorController.class.getName());
+ body.computeIfPresent(TRACE, (key, value) -> body.put(TRACE, ((String) value).split("\n\t")));
+ return body;
+ }
+
+ private boolean getTraceParameter(HttpServletRequest request) {
+ String parameter = request.getParameter(TRACE);
+ if (parameter == null)
+ return false;
+ return !"false".equalsIgnoreCase(parameter);
+ }
+
+ private Map<String, Object> getErrorAttributes(HttpServletRequest aRequest, boolean includeStackTrace) {
+ WebRequest webRequest = new ServletWebRequest(aRequest);
+ return errorAttributes.getErrorAttributes(webRequest, includeStackTrace);
+ }
+
+}
import java.lang.invoke.MethodHandles;
import org.oranosc.ric.portal.dash.DashboardConstants;
-import org.oranosc.ric.portal.dashboard.xmc.model.AllXapps;
-import org.oranosc.ric.portal.dashboard.xmc.model.Xapp;
-import org.oranosc.ric.portal.dashboard.xmc.model.Xapp.StatusEnum;
+import org.oranosc.ric.xappmgr.client.model.AllXapps;
+import org.oranosc.ric.xappmgr.client.model.Xapp;
+import org.oranosc.ric.xappmgr.client.model.Xapp.StatusEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.MediaType;
@RestController
@RequestMapping(value = DashboardConstants.ENDPOINT_PREFIX + "/catalog", produces = MediaType.APPLICATION_JSON_VALUE)
-public class CatalogController {
+public class XappCatalogController {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
import java.lang.invoke.MethodHandles;
import org.oranosc.ric.portal.dash.DashboardConstants;
-import org.oranosc.ric.portal.dashboard.xmc.api.DefaultApi;
-import org.oranosc.ric.portal.dashboard.xmc.model.AllXapps;
+import org.oranosc.ric.xappmgr.client.api.DefaultApi;
+import org.oranosc.ric.xappmgr.client.model.AllXapps;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
###
# Default properties for the RIC Dashboard backend REST server
+# This lacks any spring prefix
+# The server port number is chosen RANDOMLY when running a test
+server.port = 8080
+
# A1 mediation URL is editable
a1.mediation.url = http://localhost:12345
a1.mediation.delay.path = /a1ric/delay
a1.mediation.load.path = /a1ric/load
a1.mediation.metrics.path = /a1ric/metrics
-xapp.manager.base.url = http://localhost:30099
\ No newline at end of file
+# E2
+e2.manager.base.url = http://localhost:30098
+
+# Xapp Manager (not A1 mediator)
+xapp.manager.base.url = http://localhost:30099
<artifactId>ric-dash-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
+ <groupId>org.oranosc.ric.xappmgr.client</groupId>
<artifactId>xapp-mgr-client</artifactId>
<name>RIC xApp Manager client</name>
<version>0.0.10-SNAPSHOT</version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<swagger-annotations-version>1.5.15</swagger-annotations-version>
- <client.base.package.name>${project.groupId}.xmc</client.base.package.name>
+ <client.base.package.name>org.oranosc.ric.xappmgr.client</client.base.package.name>
</properties>
<!-- Successful compilation requires generated code dependencies -->
<dependencies>
</dependency>
<!-- test dependencies -->
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <!-- <version>${junit-version}</version> -->
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-api</artifactId>
+ <!-- spring sets the <version>5.4.2</version> -->
<scope>test</scope>
</dependency>
</dependencies>
<goal>generate</goal>
</goals>
<configuration>
- <inputSpec>${project.basedir}/xapp_manager_rest_api_v0_0_10.json</inputSpec>
+ <inputSpec>${project.basedir}/src/main/resources/xapp_manager_rest_api_v0_0_10.json</inputSpec>
<language>java</language>
<configOptions>
<groupId>${project.groupId}</groupId>
*/
package org.oranosc.ric.portal.dashboard.xmc.demo;
-import org.oranosc.ric.portal.dashboard.api.DefaultApi;
-import org.oranosc.ric.portal.dashboard.model.AllXapps;
-import org.oranosc.ric.portal.dashboard.invoker.ApiClient;
-import org.oranosc.ric.portal.dashboard.model.Xapp;
+import org.junit.jupiter.api.Test;
+import org.oranosc.ric.xappmgr.client.api.DefaultApi;
+import org.oranosc.ric.xappmgr.client.invoker.ApiClient;
+import org.oranosc.ric.xappmgr.client.model.AllXapps;
+import org.oranosc.ric.xappmgr.client.model.Xapp;
import org.springframework.web.client.RestClientException;
-public class XappManagerClientDemo {
+/**
+ * Demonstrates use of the generated xApp manager client.
+ *
+ * The test fails because no server is available.
+ */
+public class XappManagerClientTest {
- public static void main(String[] args) {
+ @Test
+ public void demo() {
ApiClient apiClient = new ApiClient();
apiClient.setBasePath("http://localhost:30099/");
DefaultApi apiInstance = new DefaultApi(apiClient);
try {
apiInstance.getHealth();
- System.out.println("Healthcheck answered " + apiClient.getStatusCode().toString());
+ System.out.println("getHealth answered: " + apiClient.getStatusCode().toString());
} catch (RestClientException e) {
- System.err.println("Failed on DefaultApi#getHealth: " + e.toString());
+ System.err.println("getHealth failed: " + e.toString());
}
try {
AllXapps allXapps = apiInstance.getAllXapps();
- System.out.println("getAllXapps answered " + apiClient.getStatusCode().toString());
+ System.out.println("getAllXapps answered: " + apiClient.getStatusCode().toString());
System.out.println("xApp count: " + allXapps.size());
for (Xapp x : allXapps)
System.out.println("xApp: " + x.toString());
} catch (RestClientException e) {
- System.err.println("Failed on DefaultApi#getAllXapps: " + e.toString());
+ System.err.println("getAllXapps failed: " + e.toString());
}
}