Add mock implementations of E2, xapp.
Also adjust config keys to match configmap
Change-Id: I0427160c9d2018e509064d9afe5746f596363945
Issue-Id: RICPLT-959
Signed-off-by: Lott, Christopher (cl778h) <cl778h@att.com>
This projects generates a REST client library from the Swagger specification
file stored here and packages it in a jar.
+## Eclipse and STS Users
+
+The Swagger Codegen maven plugin is not supported in Eclipse/STS. You can
+limp along by taking these steps:
+
+1. Generate the code using maven:
+ mvn install
+2. Add this folder to the project build path:
+ target/generated-sources/swagger/src/main/java
+
## License
Copyright (C) 2019 AT&T Intellectual Property & Nokia. All rights reserved.
<plugin>
<groupId>io.swagger</groupId>
<artifactId>swagger-codegen-maven-plugin</artifactId>
- <version>2.3.1</version>
+ <version>2.4.5</version>
<executions>
<execution>
<goals>
</execution>
</executions>
</plugin>
+ <!-- Skip the deploy-jar-to-nexus step -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-deploy-plugin</artifactId>
+ <!-- Spring sets the <version>2.8</version> -->
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
</plugins>
+ <pluginManagement>
+ <plugins>
+ <!--This plugin's configuration is used to store Eclipse m2e settings
+ only. It has no influence on the Maven build itself. -->
+ <plugin>
+ <groupId>org.eclipse.m2e</groupId>
+ <artifactId>lifecycle-mapping</artifactId>
+ <version>1.0.0</version>
+ <configuration>
+ <lifecycleMappingMetadata>
+ <pluginExecutions>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>io.swagger</groupId>
+ <artifactId>swagger-codegen-maven-plugin</artifactId>
+ <versionRange>[1.0,)</versionRange>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </pluginExecutionFilter>
+ <action>
+ <ignore />
+ </action>
+ </pluginExecution>
+ </pluginExecutions>
+ </lifecycleMappingMetadata>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
</build>
</project>
e2Mgr.getHealth();
System.out.println("getHealth answered: " + apiClient.getStatusCode().toString());
} catch (RestClientException e) {
- System.err.println("getHealth failed: " + e.toString());
+ System.err.println("getHealth failed: " + e.toString());
}
}
}
--- /dev/null
+# RIC Dashboard Web Application Backend
+
+## Development server
+
+Run `mvn -Dspring.profiles.active=mock spring-boot:run` for a dev server. Navigate to `http://localhost:8080/swagger-ui.html`.
+
+## 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.
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-test</artifactId>
- <scope>test</scope>
- </dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
- <!-- Spring-boot sets the version -->
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
- <!-- Spring-boot sets the version -->
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
- <!-- Spring-boot sets the version -->
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>${springfox.version}</version>
</dependency>
+ <!-- Mockito supports development, not just testing -->
<dependency>
- <groupId>org.junit.jupiter</groupId>
- <artifactId>junit-jupiter-api</artifactId>
- <!-- spring sets the <version>5.4.2</version> -->
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ </dependency>
+ <!-- Test dependencies -->
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
@SpringBootApplication
// Limit the annotation scan to the dashboard classes;
// exclude the generated client classes!
-@ComponentScan("org.oranosc.ric.portal.dashboard")
+@ComponentScan("org.oranosc.ric.portal.dash")
public class DashboardApplication {
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
* limitations under the License.
* ========================LICENSE_END===================================
*/
-package org.oranosc.ric.portal.dash;
+package org.oranosc.ric.portal.dash.config;
import org.oranosc.ric.e2mgr.client.api.DefaultApi;
import org.oranosc.ric.e2mgr.client.invoker.ApiClient;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
+import org.springframework.util.Assert;
import org.springframework.web.client.RestTemplate;
+/**
+ * Creates an E2 manager client as a bean to be managed by the Spring container.
+ */
@Configuration
public class E2ManagerConfiguration {
- @Value("${e2.manager.base.url}")
- private String e2ManagerBaseUrl;
+ // Populated by the autowired constructor
+ private final String e2mgrBasepath;
+
+ @Autowired
+ public E2ManagerConfiguration(@Value("${e2mgr.basepath}") final String e2mgrBasepath) {
+ Assert.notNull(e2mgrBasepath, "base path must not be null");
+ this.e2mgrBasepath = e2mgrBasepath;
+ }
/**
- * Required by autowired constructor {@link DefaultApi#DefaultApi(ApiClient)}
- *
- * @return Instance of E2 Manager client configured from properties
+ * @return A DefaultApi with an ApiClient configured from properties
*/
@Bean
- public ApiClient e2ManagerClient() {
+ public DefaultApi e2ManagerClient() {
ApiClient apiClient = new ApiClient(new RestTemplate());
- apiClient.setBasePath(e2ManagerBaseUrl);
- return apiClient;
+ apiClient.setBasePath(e2mgrBasepath);
+ return new DefaultApi(apiClient);
}
}
--- /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.config;
+
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.doAnswer;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.oranosc.ric.e2mgr.client.api.DefaultApi;
+import org.oranosc.ric.e2mgr.client.invoker.ApiClient;
+import org.oranosc.ric.e2mgr.client.model.RanSetupRequest;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Primary;
+import org.springframework.context.annotation.Profile;
+import org.springframework.http.HttpStatus;
+
+/**
+ * Creates an implementation of the E2 manager client that answers requests with
+ * mock data.
+ */
+@Profile("mock")
+@Configuration
+public class E2ManagerMockConfiguration {
+
+ @Bean
+ @Primary
+ public DefaultApi e2ManagerMockClient() {
+ ApiClient mockClient = mock(ApiClient.class);
+ when(mockClient.getStatusCode()).thenReturn(HttpStatus.OK);
+
+ DefaultApi mockApi = mock(DefaultApi.class);
+ when(mockApi.getApiClient()).thenReturn(mockClient);
+
+ doAnswer(i -> {
+ return null;
+ }).when(mockApi).getHealth();
+
+ doAnswer(i -> {
+ return null;
+ }).when(mockApi).setupRan(any(RanSetupRequest.class));
+
+ return mockApi;
+ }
+
+}
* ========================LICENSE_END===================================
*/
-package org.oranosc.ric.portal.dash;
+package org.oranosc.ric.portal.dash.config;
+import org.oranosc.ric.portal.dash.DashboardApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
final String version = DashboardApplication.class.getPackage().getImplementationVersion();
return new ApiInfoBuilder() //
.title("RIC Dashboard backend") //
- .description("Provides demonstration services.")//
+ .description("Proxies access to RIC services.")//
.termsOfServiceUrl("Terms of service") //
.contact(new Contact("RIC Dashboard Dev Team", //
"http://no-docs-yet.org/", //
* limitations under the License.
* ========================LICENSE_END===================================
*/
-package org.oranosc.ric.portal.dash;
+package org.oranosc.ric.portal.dash.config;
import org.oranosc.ric.xappmgr.client.api.DefaultApi;
import org.oranosc.ric.xappmgr.client.invoker.ApiClient;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
+import org.springframework.util.Assert;
import org.springframework.web.client.RestTemplate;
+/**
+ * Creates an xApp manager client as a bean to be managed by the Spring
+ * container.
+ */
@Configuration
public class XappManagerConfiguration {
- @Value("${xapp.manager.base.url}")
- private String xappManagerBaseUrl;
+ // Populated by the autowired constructor
+ private final String xappMgrBasepath;
+
+ @Autowired
+ public XappManagerConfiguration(@Value("${xappmgr.basepath}") final String xappMgrBasepath) {
+ Assert.notNull(xappMgrBasepath, "base path must not be null");
+ this.xappMgrBasepath = xappMgrBasepath;
+ }
/**
- * Required by autowired constructor {@link DefaultApi#DefaultApi(ApiClient)}
- *
- * @return Instance of ApiClient configured from properties
+ * @return A DefaultApi with an ApiClient configured from properties
*/
@Bean
- public ApiClient xappApiClient() {
+ public DefaultApi xappClient() {
ApiClient apiClient = new ApiClient(new RestTemplate());
- apiClient.setBasePath(xappManagerBaseUrl);
- return apiClient;
+ apiClient.setBasePath(xappMgrBasepath);
+ return new DefaultApi(apiClient);
}
}
--- /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.config;
+
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.doAnswer;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+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.SubscriptionRequest;
+import org.oranosc.ric.xappmgr.client.model.SubscriptionResponse;
+import org.oranosc.ric.xappmgr.client.model.XAppInfo;
+import org.oranosc.ric.xappmgr.client.model.Xapp;
+import org.oranosc.ric.xappmgr.client.model.Xapp.StatusEnum;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Primary;
+import org.springframework.context.annotation.Profile;
+import org.springframework.http.HttpStatus;
+
+/**
+ * Creates an implementation of the xApp manager client that answers requests
+ * with mock data.
+ */
+@Profile("mock")
+@Configuration
+public class XappManagerMockConfiguration {
+
+ private final AllXapps allXapps;
+
+ public XappManagerMockConfiguration() {
+ allXapps = new AllXapps();
+ allXapps.add(new Xapp().name("Pendulum Control").version("v1").status(StatusEnum.DEPLOYED));
+ allXapps.add(new Xapp().name("Dual Connectivity").version("v2").status(StatusEnum.DELETED));
+ allXapps.add(new Xapp().name("Admission Control").version("v3").status(StatusEnum.FAILED));
+ allXapps.add(new Xapp().name("ANR Control").version("v0").status(StatusEnum.SUPERSEDED));
+ }
+
+ @Bean
+ @Primary
+ public DefaultApi xappManagerMockClient() {
+ ApiClient mockClient = mock(ApiClient.class);
+ when(mockClient.getStatusCode()).thenReturn(HttpStatus.OK);
+
+ DefaultApi mockApi = mock(DefaultApi.class);
+ when(mockApi.getApiClient()).thenReturn(mockClient);
+
+ SubscriptionResponse subRes = new SubscriptionResponse().eventType(SubscriptionResponse.EventTypeEnum.ALL)
+ .id("subid").version(1);
+ when(mockApi.addSubscription(any(SubscriptionRequest.class))).thenReturn(subRes);
+
+ doAnswer(i -> {
+ return null;
+ }).when(mockApi).deleteSubscription(any(Integer.class));
+
+ when(mockApi.deployXapp(any(XAppInfo.class))).thenReturn(new Xapp());
+
+ when(mockApi.getAllXapps()).thenReturn(allXapps);
+
+ doAnswer(i -> {
+ return null;
+ }).when(mockApi).getHealth();
+
+ Xapp xappByName = new Xapp().name("name").status(StatusEnum.UNKNOWN).version("v1");
+ when(mockApi.getXappByName(any(String.class))).thenReturn(xappByName);
+
+ doAnswer(i -> {
+ return null;
+ }).when(mockApi).undeployXapp(any(String.class));
+
+ return mockApi;
+ }
+
+}
private static final String A1_MEDIATION_METRICS = "metrics";
private static final String A1_MEDIATION_METRICS_PATH = A1_MEDIATION_METRICS + "path";
- @Value("${a1.mediation.url}")
+ @Value("${a1med.basepath}")
private String a1MediationUrl;
- @Value("${a1.mediation.delay.path}")
+ @Value("${a1med.delaypath}")
private String a1MediationDelayPath;
- @Value("${a1.mediation.load.path}")
+ @Value("${a1med.loadpath}")
private String a1MediationLoadPath;
- @Value("${a1.mediation.metrics.path}")
+ @Value("${a1med.metricspath}")
private String a1MediationMetricsPath;
// For demo purposes
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.util.Assert;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
- @Autowired
- private DefaultApi e2ManagerClient;
+ // Populated by the autowired constructor
+ private final DefaultApi e2MgrClient;
// Tracks the requests previously submitted.
// TODO remove when the E2 manager is extended.
private Set<RanSetupRequest> requests = new HashSet<>();
+ @Autowired
+ public E2ManagerController(final DefaultApi e2MgrClient) {
+ Assert.notNull(e2MgrClient, "client must not be null");
+ this.e2MgrClient = e2MgrClient;
+ }
+
private void assertNotNull(Object o) {
if (o == null)
throw new IllegalArgumentException("Null not permitted");
throw new IllegalArgumentException("Empty not permitted");
}
- @ApiOperation(value = "Gets the health from the E2 manager, expressed as the response code.", response = String.class)
+ @ApiOperation(value = "Gets the health from the E2 manager, expressed as the response code.")
@RequestMapping(value = "/health", method = RequestMethod.GET)
- public SuccessTransport getHealth() {
+ public void getHealth(HttpServletResponse response) {
logger.debug("getHealth");
- return new SuccessTransport();
+ e2MgrClient.getHealth();
+ response.setStatus(e2MgrClient.getApiClient().getStatusCode().value());
}
@ApiOperation(value = "Gets the unique requests submitted to the E2 manager.", response = RanSetupRequest.class, responseContainer = "List")
}
try {
requests.add(rsr);
- e2ManagerClient.setupRan(rsr);
+ e2MgrClient.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.lang.invoke.MethodHandles;
-
-import org.oranosc.ric.portal.dash.DashboardConstants;
-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;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RestController;
-
-@RestController
-@RequestMapping(value = DashboardConstants.ENDPOINT_PREFIX + "/catalog", produces = MediaType.APPLICATION_JSON_VALUE)
-public class XappCatalogController {
-
- private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
-
- @RequestMapping(method = RequestMethod.GET)
- public AllXapps getXapps() {
- logger.debug("getXapps: enter");
- return populateCatalog();
- }
-
- // @TODO This method to be removed when endpoint for data fetch from RIC team
- // available
- private AllXapps populateCatalog() {
- AllXapps cList = new AllXapps();
- cList.add(buildXapp("Pendulum Control", "v1", StatusEnum.DEPLOYED));
- cList.add(buildXapp("Dual Connectivity", "v2", StatusEnum.DELETED));
- cList.add(buildXapp("Admission Control", "v1", StatusEnum.FAILED));
- cList.add(buildXapp("ANR Control", "v0", StatusEnum.SUPERSEDED));
- return cList;
- }
-
- private Xapp buildXapp(String name, String version, StatusEnum status) {
- Xapp xapp = new Xapp();
- xapp.setName(name);
- xapp.setVersion(version);
- xapp.setStatus(status);
- return xapp;
- }
-
-}
import java.lang.invoke.MethodHandles;
+import javax.servlet.http.HttpServletResponse;
+
import org.oranosc.ric.portal.dash.DashboardConstants;
+import org.oranosc.ric.portal.dash.model.ErrorTransport;
import org.oranosc.ric.xappmgr.client.api.DefaultApi;
import org.oranosc.ric.xappmgr.client.model.AllXapps;
+import org.oranosc.ric.xappmgr.client.model.XAppInfo;
+import org.oranosc.ric.xappmgr.client.model.Xapp;
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.util.Assert;
+import org.springframework.web.bind.annotation.PathVariable;
+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;
+/**
+ * Mimics the xApp Manager API. These controller methods just proxy calls from
+ * the front-end thru to the real back-end.
+ *
+ */
@Configuration
@RestController
@RequestMapping(value = DashboardConstants.ENDPOINT_PREFIX + "/xappmgr", produces = MediaType.APPLICATION_JSON_VALUE)
private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
+ // Populated by the autowired constructor
+ private final DefaultApi xappMgrClient;
+
@Autowired
- private DefaultApi xappManagerClient;
+ public XappManagerController(final DefaultApi xappMgrClient) {
+ Assert.notNull(xappMgrClient, "client must not be null");
+ this.xappMgrClient = xappMgrClient;
+ }
+
+ @ApiOperation(value = "Calls the xApp Manager health check.")
+ @RequestMapping(value = "/health", method = RequestMethod.GET)
+ public void getHealth(HttpServletResponse response) {
+ logger.debug("getHealth");
+ xappMgrClient.getHealth();
+ response.setStatus(xappMgrClient.getApiClient().getStatusCode().value());
+ }
- @ApiOperation(value = "Gets the list of xApps from the xApp manager.", response = AllXapps.class)
+ @ApiOperation(value = "Calls the xApp Manager to get the list of xApps.", response = AllXapps.class)
@RequestMapping(value = "/xapps", method = RequestMethod.GET)
public AllXapps getAllXapps() {
- logger.debug("getAllXapps via " + xappManagerClient.getApiClient().getBasePath());
- AllXapps all = xappManagerClient.getAllXapps();
- return all;
+ logger.debug("getAllXapps via " + xappMgrClient.getApiClient().getBasePath());
+ return xappMgrClient.getAllXapps();
+ }
+
+ @ApiOperation(value = "Calls the xApp Manager to get the named xApp.", response = Xapp.class)
+ @RequestMapping(value = "/xapps/{xAppName}", method = RequestMethod.GET)
+ public Xapp getXapp(@PathVariable("xAppName") String xAppName) {
+ logger.debug("getXapp {}", xAppName);
+ return xappMgrClient.getXappByName(xAppName);
+ }
+
+ @ApiOperation(value = "Calls the xApp Manager to deploy the specified Xapp.", response = Xapp.class)
+ @RequestMapping(value = "/xapps", method = RequestMethod.POST)
+ public Object deployXapp(@RequestBody XAppInfo xAppInfo, HttpServletResponse response) {
+ logger.debug("deployXapp {}", xAppInfo);
+ try {
+ return xappMgrClient.deployXapp(xAppInfo);
+ } catch (Exception ex) {
+ logger.error("deployXapp failed", ex);
+ response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
+ return new ErrorTransport(500, "deployXapp failed", ex);
+ }
+ }
+
+ @ApiOperation(value = "Calls the xApp Manager to undeploy the named Xapp.")
+ @RequestMapping(value = "/xapps/{xAppName}", method = RequestMethod.DELETE)
+ public void undeployXapp(@PathVariable("xAppName") String xAppName, HttpServletResponse response) {
+ logger.debug("undeployXapp {}", xAppName);
+ try {
+ xappMgrClient.undeployXapp(xAppName);
+ } catch (Exception ex) {
+ logger.error("deployXapp failed", ex);
+ response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
+ }
}
}
# limitations under the License.
# ========================LICENSE_END===================================
###
-# Default properties for the RIC Dashboard backend REST server
+
+# Default properties for the RIC Dashboard backend REST services
# 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
+# A1 Mediator
+a1med.basepath = http://localhost:12345
+a1med.delaypath = /a1ric/delay
+a1med.loadpath = /a1ric/load
+a1med.metricspath = /a1ric/metrics
-# E2
-e2.manager.base.url = http://localhost:30098
+# E2 Manager
+e2mgr.basepath = http://localhost:30098
-# Xapp Manager (not A1 mediator)
-xapp.manager.base.url = http://localhost:30099
+# Xapp Manager
+xappmgr.basepath = http://localhost:30099
* limitations under the License.
* ========================LICENSE_END===================================
*/
-package org.oranosc.ric.portal.dash.test;
+package org.oranosc.ric.portal.dash;
import org.junit.Test;
import org.junit.runner.RunWith;
@RunWith(SpringRunner.class)
@SpringBootTest
-public class DashboardApplicationTests {
+public class DashboardApplicationTest {
@Test
public void contextLoads() {
## Development server
-Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
+Run `./ng serve --proxy-config proxy.conf.json` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
## Code scaffolding
"version": "0.0.0",
"scripts": {
"ng": "ng",
- "start": "ng serve",
+ "start": "ng serve --proxy-config proxy.conf.json",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
This projects generates a REST client library from the Swagger specification
file stored here and packages it in a jar.
+## Eclipse and STS Users
+
+The Swagger Codegen maven plugin is not supported in Eclipse/STS. You can
+limp along by taking these steps:
+
+1. Generate the code using maven:
+ mvn install
+2. Add this folder to the project build path:
+ target/generated-sources/swagger/src/main/java
+
## License
Copyright (C) 2019 AT&T Intellectual Property & Nokia. All rights reserved.
<artifactId>ric-dash-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
- <groupId>org.oranosc.ric.xappmgr.client</groupId>
+ <groupId>org.oranosc.ric.xappmgr.client</groupId>
<artifactId>xapp-mgr-client</artifactId>
<name>RIC xApp Manager client</name>
<version>0.0.10-SNAPSHOT</version>
<plugin>
<groupId>io.swagger</groupId>
<artifactId>swagger-codegen-maven-plugin</artifactId>
- <version>2.2.3</version>
+ <version>2.4.5</version>
<executions>
<execution>
<goals>
</execution>
</executions>
</plugin>
+ <!-- Skip the deploy-jar-to-nexus step -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-deploy-plugin</artifactId>
+ <!-- Spring sets the <version>2.8</version> -->
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
</plugins>
+ <pluginManagement>
+ <plugins>
+ <!--This plugin's configuration is used to store Eclipse m2e settings
+ only. It has no influence on the Maven build itself. -->
+ <plugin>
+ <groupId>org.eclipse.m2e</groupId>
+ <artifactId>lifecycle-mapping</artifactId>
+ <version>1.0.0</version>
+ <configuration>
+ <lifecycleMappingMetadata>
+ <pluginExecutions>
+ <pluginExecution>
+ <pluginExecutionFilter>
+ <groupId>io.swagger</groupId>
+ <artifactId>swagger-codegen-maven-plugin</artifactId>
+ <versionRange>[1.0,)</versionRange>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </pluginExecutionFilter>
+ <action>
+ <ignore/>
+ </action>
+ </pluginExecution>
+ </pluginExecutions>
+ </lifecycleMappingMetadata>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
</build>
</project>