aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.readthedocs.yaml20
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java17
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/cloudregion/CloudException.java14
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/cloudregion/CloudRegionRestV1.java102
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/cloudregion/CloudRestImpl.java97
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/CXFConfiguration.java26
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/cloudregion/CloudRegionRestImplTest.java96
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/PauseForManualTaskRainyDayTest.java10
-rw-r--r--common/pom.xml5
-rw-r--r--common/src/main/java/org/onap/so/spring/GracefulShutdown.java41
-rw-r--r--common/src/main/java/org/onap/so/spring/GracefulShutdownBeans.java20
-rw-r--r--docs/.gitignore3
-rw-r--r--docs/_static/css/ribbon.css63
-rwxr-xr-xdocs/_static/favicon.icobin0 -> 2102 bytes
-rw-r--r--docs/_static/logo_onap_2017.pngbin0 -> 12278 bytes
-rw-r--r--docs/conf.py15
-rw-r--r--docs/conf.yaml7
-rw-r--r--docs/requirements-docs.txt15
-rw-r--r--docs/tox.ini22
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/InstanceManagement.java106
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java232
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequest.java35
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java8
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java57
-rw-r--r--packages/docker/src/main/docker/docker-files/scripts/start-app.sh20
25 files changed, 775 insertions, 256 deletions
diff --git a/.readthedocs.yaml b/.readthedocs.yaml
new file mode 100644
index 0000000000..3797dc8bb9
--- /dev/null
+++ b/.readthedocs.yaml
@@ -0,0 +1,20 @@
+---
+# .readthedocs.yml
+# Read the Docs configuration file
+# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
+# Required
+version: 2
+
+formats:
+ - htmlzip
+
+build:
+ image: latest
+
+python:
+ version: 3.7
+ install:
+ - requirements: docs/requirements-docs.txt
+
+sphinx:
+ configuration: docs/conf.py
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java
index 707a2a45af..739b4b62de 100644
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java
@@ -22,8 +22,8 @@ package org.onap.so.db.catalog.client;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
@@ -428,7 +428,7 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
}
@Test
- public void testPostCloudSite() {
+ public void testCloudSiteClient() {
CatalogDbClientPortChanger localClient = new CatalogDbClientPortChanger(
"http://localhost:" + client.wiremockPort, msoAdaptersAuth, client.wiremockPort);
CloudSite cloudSite = new CloudSite();
@@ -455,6 +455,19 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
assertEquals("TESTCLLI", getCloudSite.getClli());
assertEquals("regionId", getCloudSite.getRegionId());
assertEquals("RANDOMID", getCloudSite.getIdentityServiceId());
+
+ getCloudSite.setClli("clli2");
+ getCloudSite.setRegionId("region2");
+
+ CloudSite updatedCloudSite = this.client.updateCloudSite(getCloudSite);
+ assertNotNull(updatedCloudSite);
+ assertNotNull(updatedCloudSite.getIdentityService());
+ assertEquals("clli2", updatedCloudSite.getClli());
+ assertEquals("region2", updatedCloudSite.getRegionId());
+
+ this.client.deleteCloudSite(getCloudSite.getId());
+ getCloudSite = this.client.getCloudSite("MTN6");
+ assertNull(getCloudSite);
}
@Test
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/cloudregion/CloudException.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/cloudregion/CloudException.java
new file mode 100644
index 0000000000..9cdf7e3b2a
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/cloudregion/CloudException.java
@@ -0,0 +1,14 @@
+package org.onap.so.adapters.cloudregion;
+
+public class CloudException extends RuntimeException {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -2631715095942372451L;
+
+ public CloudException(String error, Exception e) {
+ super(error, e);
+ }
+
+}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/cloudregion/CloudRegionRestV1.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/cloudregion/CloudRegionRestV1.java
new file mode 100644
index 0000000000..780480507b
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/cloudregion/CloudRegionRestV1.java
@@ -0,0 +1,102 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Modifications Copyright (C) 2018 IBM.
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
+ * 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.onap.so.adapters.cloudregion;
+
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import org.apache.http.HttpStatus;
+import org.onap.so.db.catalog.beans.CloudSite;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import io.swagger.annotations.ApiResponse;
+import io.swagger.annotations.ApiResponses;
+
+
+@Path("/v1/cloud-region")
+@Api(value = "/v1/cloud-region", description = "root of cloud region adapter")
+@Component
+public class CloudRegionRestV1 {
+ private static Logger logger = LoggerFactory.getLogger(CloudRegionRestV1.class);
+
+ @Autowired
+ private CloudRestImpl cloudRestImpl;
+
+ @POST
+ @Path("{cloud-region-id}/{cloud-owner}")
+ @Consumes({MediaType.APPLICATION_JSON})
+ @Produces({MediaType.APPLICATION_JSON})
+ @ApiOperation(value = "CreateCloudRegion", response = Response.class,
+ notes = "Create a cloud site in MSO and Region In AAI")
+ @ApiResponses({@ApiResponse(code = 201, message = "Cloud Region has been created"),
+ @ApiResponse(code = 500, message = "Create Cloud Region has failed")})
+ public Response createCloudRegion(
+ @ApiParam(value = "cloud-region-id", required = true) @PathParam("cloud-region-id") String cloudRegionId,
+ @ApiParam(value = "cloud-owner", required = true) @PathParam("cloud-owner") String cloudOwner,
+ @ApiParam(value = "CloudSite", required = true) final CloudSite cloudSite) {
+ cloudRestImpl.createCloudRegion(cloudSite, cloudOwner);
+ return Response.status(HttpStatus.SC_CREATED).build();
+ }
+
+ @DELETE
+ @Path("{cloud-region-id}/{cloud-owner}")
+ @Consumes({MediaType.APPLICATION_JSON})
+ @Produces({MediaType.APPLICATION_JSON})
+ @ApiOperation(value = "CreateCloudRegion", response = Response.class, notes = "Delete an cloud Region in SO")
+ @ApiResponses({@ApiResponse(code = 204, message = "cloud Region has been deleted"),
+ @ApiResponse(code = 500, message = "Cloud Region delete has failed")})
+ public Response deleteCloudRegion(
+ @ApiParam(value = "cloud-region-id", required = true) @PathParam("cloud-region-id") String cloudRegionId,
+ @ApiParam(value = "cloud-owner", required = true) @PathParam("cloud-owner") String cloudOwner) {
+ cloudRestImpl.deleteCloudRegion(cloudRegionId);
+ return Response.status(HttpStatus.SC_NO_CONTENT).build();
+ }
+
+ @PUT
+ @Path("{cloud-region-id}/{cloud-owner}")
+ @Consumes({MediaType.APPLICATION_JSON})
+ @Produces({MediaType.APPLICATION_JSON})
+ @ApiOperation(value = "CreateCloudRegion", response = Response.class, notes = "Update an existing Cloud Region")
+ @ApiResponses({@ApiResponse(code = 200, message = "Cloud Region has been updated"),
+ @ApiResponse(code = 500, message = "Update Cloud Region has failed examine entity object for details")})
+ public Response updateCloudRegion(
+ @ApiParam(value = "cloud-region-id", required = true) @PathParam("cloud-region-id") String cloudRegionId,
+ @ApiParam(value = "cloud-owner", required = true) @PathParam("cloud-owner") String cloudOwner,
+ @ApiParam(value = "CloudSite", required = true) final CloudSite cloudSite) {
+ cloudRestImpl.updateCloudRegion(cloudSite, cloudOwner);
+ return Response.status(HttpStatus.SC_OK).build();
+ }
+}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/cloudregion/CloudRestImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/cloudregion/CloudRestImpl.java
new file mode 100644
index 0000000000..4cde8655ae
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/cloudregion/CloudRestImpl.java
@@ -0,0 +1,97 @@
+package org.onap.so.adapters.cloudregion;
+
+import java.util.Optional;
+import org.onap.aai.domain.yang.CloudRegion;
+import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.aai.AAIResourcesClient;
+import org.onap.so.client.aai.entities.uri.AAIResourceUri;
+import org.onap.so.client.aai.entities.uri.AAIUriFactory;
+import org.onap.so.db.catalog.beans.CloudSite;
+import org.onap.so.db.catalog.client.CatalogDbClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+
+@Component
+public class CloudRestImpl {
+ private static final Logger logger = LoggerFactory.getLogger(CloudRestImpl.class);
+
+ private AAIResourcesClient aaiClient;
+
+ @Autowired
+ private CatalogDbClient catalogDBClient;
+
+ public void createCloudRegion(CloudSite cloudSite, String cloudOwner) throws CloudException {
+ createRegionInCatalogDb(cloudSite);
+ createCloudRegionInAAI(cloudSite, cloudOwner);
+ }
+
+ public void updateCloudRegion(CloudSite cloudSite, String cloudOwner) throws CloudException {
+ updateRegionInCatalogDb(cloudSite);
+ }
+
+ protected void updateRegionInCatalogDb(CloudSite cloudSite) {
+ try {
+ catalogDBClient.updateCloudSite(cloudSite);
+ } catch (Exception e) {
+ logger.error("Error updating cloud region in catalogdb", e);
+ throw new CloudException("Error updating cloud region in Catalog: " + e.getMessage(), e);
+ }
+ }
+
+ public void deleteCloudRegion(String cloudRegionId) throws CloudException {
+ try {
+ catalogDBClient.deleteCloudSite(cloudRegionId);
+ } catch (Exception e) {
+ logger.error("Error deleting cloud region in catalogdb", e);
+ throw new CloudException("Error deleting cloud region in Catalog: " + e.getMessage(), e);
+ }
+ }
+
+ protected void createCloudRegionInAAI(CloudSite cloudSite, String cloudOwner) {
+ try {
+ CloudRegion cloudRegion = mapCloudRegion(cloudSite, cloudOwner);
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION,
+ cloudRegion.getCloudOwner(), cloudRegion.getCloudRegionId());
+ getAaiClient().createIfNotExists(uri, Optional.of(cloudRegion));
+ } catch (Exception e) {
+ logger.error("Error creating cloud region in AAI", e);
+ throw new CloudException("Error creating cloud region in AAI: " + e.getMessage(), e);
+ }
+ }
+
+ protected void createRegionInCatalogDb(CloudSite cloudSite) throws CloudException {
+ try {
+ CloudSite existingCloudSite = catalogDBClient.getCloudSite(cloudSite.getRegionId());
+ if (existingCloudSite == null) {
+ catalogDBClient.postCloudSite(cloudSite);
+ }
+ } catch (Exception e) {
+ logger.error("Error creating cloud site in Catalog Adapter: " + e.getMessage(), e);
+ throw new CloudException("Error creating cloud site in Catalog Adapter", e);
+ }
+ }
+
+ protected CloudRegion mapCloudRegion(CloudSite cloudSite, String cloudOwner) {
+ CloudRegion region = new CloudRegion();
+ region.setCloudOwner(cloudOwner);
+ region.setCloudRegionId(cloudSite.getRegionId());
+ region.setCloudRegionVersion(cloudSite.getCloudVersion());
+ region.setOwnerDefinedType("cLCP");
+ region.setOrchestrationDisabled(false);
+ region.setComplexName("NA");
+ region.setInMaint(false);
+ region.setCloudType("openstack");
+ return region;
+ }
+
+ protected AAIResourcesClient getAaiClient() {
+ if (aaiClient == null)
+ return new AAIResourcesClient();
+ else
+ return aaiClient;
+ }
+
+}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/CXFConfiguration.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/CXFConfiguration.java
index 9fc5c979d8..9badd795eb 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/CXFConfiguration.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/CXFConfiguration.java
@@ -32,6 +32,7 @@ import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
import org.apache.cxf.jaxrs.swagger.Swagger2Feature;
import org.apache.cxf.jaxws.EndpointImpl;
import org.apache.cxf.transport.servlet.CXFServlet;
+import org.onap.so.adapters.cloudregion.CloudRegionRestV1;
import org.onap.so.adapters.network.MsoNetworkAdapterAsyncImpl;
import org.onap.so.adapters.network.MsoNetworkAdapterImpl;
import org.onap.so.adapters.network.NetworkAdapterRest;
@@ -47,10 +48,12 @@ import org.onap.so.adapters.vnf.VolumeAdapterRestV2;
import org.onap.so.client.policy.JettisonStyleMapperProvider;
import org.onap.so.logging.cxf.interceptor.SOAPLoggingInInterceptor;
import org.onap.so.logging.cxf.interceptor.SOAPLoggingOutInterceptor;
+import org.onap.so.logging.jaxrs.filter.SOAuditLogContainerFilter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
+import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
@@ -81,7 +84,14 @@ public class CXFConfiguration {
@Autowired
private MsoVnfCloudifyAdapterImpl vnfCloudifyAdapterImpl;
@Autowired
+ private CloudRegionRestV1 cloudRegionRestV1;
+ @Autowired
private JettisonStyleMapperProvider jettisonStyleObjectMapper;
+ @Autowired
+ private ObjectMapper mapper;
+ @Autowired
+ private SOAuditLogContainerFilter soAuditLogContainerFilter;
+
@Bean(name = Bus.DEFAULT_BUS_ID)
public SpringBus springBus() {
@@ -170,6 +180,7 @@ public class CXFConfiguration {
return endpoint;
}
+ // Uses Jettson Style marshalling semantics
@Bean
public Server rsServer() {
JAXRSServerFactoryBean endpoint = new JAXRSServerFactoryBean();
@@ -178,7 +189,20 @@ public class CXFConfiguration {
vnfAdapterRestV2, volumeAdapterRest, volumeAdapterRestV2));
endpoint.setAddress("/rest");
endpoint.setFeatures(Arrays.asList(createSwaggerFeature(), new LoggingFeature()));
- endpoint.setProvider(new JacksonJsonProvider(jettisonStyleObjectMapper.getMapper()));
+ endpoint.setProviders(Arrays.asList(new JacksonJsonProvider(jettisonStyleObjectMapper.getMapper()),
+ soAuditLogContainerFilter));
+ return endpoint.create();
+ }
+
+ // Uses normal Jackson marshalling semantics
+ @Bean
+ public Server rsServerApi() {
+ JAXRSServerFactoryBean endpoint = new JAXRSServerFactoryBean();
+ endpoint.setBus(springBus());
+ endpoint.setServiceBeans(Arrays.<Object>asList(cloudRegionRestV1));
+ endpoint.setAddress("/api");
+ endpoint.setFeatures(Arrays.asList(new LoggingFeature()));
+ endpoint.setProviders(Arrays.asList(new JacksonJsonProvider(mapper), soAuditLogContainerFilter));
return endpoint.create();
}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/cloudregion/CloudRegionRestImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/cloudregion/CloudRegionRestImplTest.java
new file mode 100644
index 0000000000..9c62c286ac
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/cloudregion/CloudRegionRestImplTest.java
@@ -0,0 +1,96 @@
+package org.onap.so.adapters.cloudregion;
+
+import static com.shazam.shazamcrest.MatcherAssert.assertThat;
+import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+import java.util.Optional;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.ArgumentCaptor;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.Spy;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.aai.domain.yang.CloudRegion;
+import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.aai.AAIResourcesClient;
+import org.onap.so.client.aai.entities.uri.AAIResourceUri;
+import org.onap.so.client.aai.entities.uri.AAIUriFactory;
+import org.onap.so.db.catalog.beans.CloudSite;
+import org.onap.so.db.catalog.client.CatalogDbClient;
+
+
+@RunWith(MockitoJUnitRunner.class)
+public class CloudRegionRestImplTest {
+
+ @Spy
+ @InjectMocks
+ private CloudRestImpl cloudRestImpl;
+
+ @Mock
+ private CatalogDbClient catalogDbClientMock;
+
+ @Mock
+ private AAIResourcesClient aaiResClientMock;
+
+ private CloudSite cloudSite = new CloudSite();
+
+ private CloudRegion testCloudRegion = new CloudRegion();
+
+ @Before
+ public void setup() {
+ cloudSite.setCloudVersion("1.0");
+ cloudSite.setRegionId("region1");
+ Mockito.doReturn(aaiResClientMock).when(cloudRestImpl).getAaiClient();
+ testCloudRegion.setCloudOwner("bob");
+ testCloudRegion.setCloudRegionId("region1");
+ testCloudRegion.setCloudRegionVersion("1.0");
+ testCloudRegion.setInMaint(false);
+ testCloudRegion.setOrchestrationDisabled(false);
+ testCloudRegion.setComplexName("NA");
+ testCloudRegion.setCloudRegionVersion("1.0");
+ testCloudRegion.setOwnerDefinedType("cLCP");
+ testCloudRegion.setCloudType("openstack");
+ }
+
+ @Test
+ public void mapCloudRegionTest() {
+ CloudRegion mappedRegion = cloudRestImpl.mapCloudRegion(cloudSite, "bob");
+ assertThat(mappedRegion, sameBeanAs(testCloudRegion));
+ }
+
+ @Test
+ public void createCloudRegionTest() {
+ when(catalogDbClientMock.getCloudSite("region1")).thenReturn(null);
+ when(catalogDbClientMock.postCloudSite(cloudSite)).thenReturn(cloudSite);
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, "bob", "region1");
+ cloudRestImpl.createCloudRegion(cloudSite, "bob");
+ ArgumentCaptor<AAIResourceUri> actualURI = ArgumentCaptor.forClass(AAIResourceUri.class);
+ ArgumentCaptor<Optional<Object>> actualCloudRegion = ArgumentCaptor.forClass(Optional.class);
+ verify(catalogDbClientMock, times(1)).getCloudSite("region1");
+ verify(catalogDbClientMock, times(1)).postCloudSite(cloudSite);
+ verify(aaiResClientMock, times(1)).createIfNotExists(Mockito.eq(uri), Mockito.any());
+ verify(aaiResClientMock, times(1)).createIfNotExists(actualURI.capture(), actualCloudRegion.capture());
+ assertThat((CloudRegion) actualCloudRegion.getValue().get(), sameBeanAs(testCloudRegion));
+ }
+
+ @Test
+ public void updateCloudRegionTest() {
+ when(catalogDbClientMock.updateCloudSite(cloudSite)).thenReturn(cloudSite);
+ cloudRestImpl.updateCloudRegion(cloudSite, "bob");
+ verify(catalogDbClientMock, times(1)).updateCloudSite(cloudSite);
+ }
+
+ @Test
+ public void deleteCloudRegionTest() {
+ doNothing().when(catalogDbClientMock).deleteCloudSite("region1");
+ cloudRestImpl.deleteCloudRegion(cloudSite.getRegionId());
+ verify(catalogDbClientMock, times(1)).deleteCloudSite("region1");
+ }
+
+}
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/PauseForManualTaskRainyDayTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/PauseForManualTaskRainyDayTest.java
index 576f9c4f01..29d7a80f63 100644
--- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/PauseForManualTaskRainyDayTest.java
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/PauseForManualTaskRainyDayTest.java
@@ -20,24 +20,24 @@
package org.onap.so.bpmn.infrastructure.bpmn.subprocess;
-import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat;
+import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat;
import static org.junit.Assert.assertNotNull;
-import static org.mockito.Matchers.any;
+import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doThrow;
import org.camunda.bpm.engine.ManagementService;
import org.camunda.bpm.engine.TaskService;
import org.camunda.bpm.engine.delegate.BpmnError;
import org.camunda.bpm.engine.runtime.Job;
import org.camunda.bpm.engine.runtime.ProcessInstance;
-import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.task.Task;
import org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions;
+import org.junit.Ignore;
import org.junit.Test;
-import org.springframework.beans.factory.annotation.Autowired;
import org.onap.so.bpmn.BaseBPMNTest;
import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.springframework.beans.factory.annotation.Autowired;
-
+@Ignore
public class PauseForManualTaskRainyDayTest extends BaseBPMNTest {
private static final String TIMEOUT_10_S = "PT10S";
diff --git a/common/pom.xml b/common/pom.xml
index 529841da72..04deacf129 100644
--- a/common/pom.xml
+++ b/common/pom.xml
@@ -97,6 +97,11 @@
</exclusions>
</dependency>
<dependency>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>tomcat-catalina</artifactId>
+ <version>9.0.30</version>
+ </dependency>
+ <dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-ext</artifactId>
</dependency>
diff --git a/common/src/main/java/org/onap/so/spring/GracefulShutdown.java b/common/src/main/java/org/onap/so/spring/GracefulShutdown.java
new file mode 100644
index 0000000000..60f5b076cd
--- /dev/null
+++ b/common/src/main/java/org/onap/so/spring/GracefulShutdown.java
@@ -0,0 +1,41 @@
+package org.onap.so.spring;
+
+import java.util.concurrent.Executor;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
+import org.apache.catalina.connector.Connector;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.boot.web.embedded.tomcat.TomcatConnectorCustomizer;
+import org.springframework.context.event.ContextClosedEvent;
+import org.springframework.context.event.EventListener;
+
+public class GracefulShutdown implements TomcatConnectorCustomizer {
+
+ private static final Logger logger = LoggerFactory.getLogger(GracefulShutdown.class);
+
+ private volatile Connector connector;
+
+ @Override
+ public void customize(Connector connector) {
+ this.connector = connector;
+ }
+
+ @EventListener
+ public void handleClosedEvent(ContextClosedEvent event) {
+ this.connector.pause();
+ Executor executor = this.connector.getProtocolHandler().getExecutor();
+ if (executor instanceof ThreadPoolExecutor) {
+ try {
+ ThreadPoolExecutor threadPoolExecutor = (ThreadPoolExecutor) executor;
+ threadPoolExecutor.shutdown();
+ if (!threadPoolExecutor.awaitTermination(30, TimeUnit.SECONDS)) {
+ logger.warn("Tomcat thread pool did not shut down gracefully within "
+ + "30 seconds. Proceeding with forceful shutdown");
+ }
+ } catch (InterruptedException ex) {
+ Thread.currentThread().interrupt();
+ }
+ }
+ }
+}
diff --git a/common/src/main/java/org/onap/so/spring/GracefulShutdownBeans.java b/common/src/main/java/org/onap/so/spring/GracefulShutdownBeans.java
new file mode 100644
index 0000000000..219c82fb19
--- /dev/null
+++ b/common/src/main/java/org/onap/so/spring/GracefulShutdownBeans.java
@@ -0,0 +1,20 @@
+package org.onap.so.spring;
+
+import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
+import org.springframework.boot.web.servlet.server.ConfigurableServletWebServerFactory;
+import org.springframework.context.annotation.Bean;
+
+public class GracefulShutdownBeans {
+
+ @Bean
+ public GracefulShutdown gracefulShutdown() {
+ return new GracefulShutdown();
+ }
+
+ @Bean
+ public ConfigurableServletWebServerFactory webServerFactory(final GracefulShutdown gracefulShutdown) {
+ TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory();
+ factory.addConnectorCustomizers(gracefulShutdown);
+ return factory;
+ }
+}
diff --git a/docs/.gitignore b/docs/.gitignore
new file mode 100644
index 0000000000..43ca5b671f
--- /dev/null
+++ b/docs/.gitignore
@@ -0,0 +1,3 @@
+/.tox
+/_build/*
+/__pycache__/*
diff --git a/docs/_static/css/ribbon.css b/docs/_static/css/ribbon.css
new file mode 100644
index 0000000000..6008cb1a08
--- /dev/null
+++ b/docs/_static/css/ribbon.css
@@ -0,0 +1,63 @@
+.ribbon {
+ z-index: 1000;
+ background-color: #a00;
+ overflow: hidden;
+ white-space: nowrap;
+ position: fixed;
+ top: 25px;
+ right: -50px;
+ -webkit-transform: rotate(45deg);
+ -moz-transform: rotate(45deg);
+ -ms-transform: rotate(45deg);
+ -o-transform: rotate(45deg);
+ transform: rotate(45deg);
+ -webkit-box-shadow: 0 0 10px #888;
+ -moz-box-shadow: 0 0 10px #888;
+ box-shadow: 0 0 10px #888;
+
+}
+
+.ribbon a {
+ border: 1px solid #faa;
+ color: #fff;
+ display: block;
+ font: bold 81.25% 'Helvetica Neue', Helvetica, Arial, sans-serif;
+ margin: 1px 0;
+ padding: 10px 50px;
+ text-align: center;
+ text-decoration: none;
+ text-shadow: 0 0 5px #444;
+ transition: 0.5s;
+}
+
+.ribbon a:hover {
+ background: #c11;
+ color: #fff;
+}
+
+
+/* override table width restrictions */
+@media screen and (min-width: 767px) {
+
+ .wy-table-responsive table td, .wy-table-responsive table th {
+ /* !important prevents the common CSS stylesheets from overriding
+ this as on RTD they are loaded after this stylesheet */
+ white-space: normal !important;
+ }
+
+ .wy-table-responsive {
+ overflow: visible !important;
+ }
+}
+
+@media screen and (max-width: 767px) {
+ .wy-table-responsive table td {
+ white-space: nowrap;
+ }
+}
+
+/* fix width of the screen */
+
+.wy-nav-content {
+ max-width: none;
+}
diff --git a/docs/_static/favicon.ico b/docs/_static/favicon.ico
new file mode 100755
index 0000000000..cb712ebd20
--- /dev/null
+++ b/docs/_static/favicon.ico
Binary files differ
diff --git a/docs/_static/logo_onap_2017.png b/docs/_static/logo_onap_2017.png
new file mode 100644
index 0000000000..5d064f431c
--- /dev/null
+++ b/docs/_static/logo_onap_2017.png
Binary files differ
diff --git a/docs/conf.py b/docs/conf.py
new file mode 100644
index 0000000000..8f40e8b817
--- /dev/null
+++ b/docs/conf.py
@@ -0,0 +1,15 @@
+from docs_conf.conf import *
+
+branch = 'latest'
+master_doc = 'index'
+
+linkcheck_ignore = [
+ 'http://localhost',
+]
+
+intersphinx_mapping = {}
+
+html_last_updated_fmt = '%d-%b-%y %H:%M'
+
+def setup(app):
+ app.add_stylesheet("css/ribbon_onap.css")
diff --git a/docs/conf.yaml b/docs/conf.yaml
new file mode 100644
index 0000000000..ab5928131c
--- /dev/null
+++ b/docs/conf.yaml
@@ -0,0 +1,7 @@
+---
+project_cfg: onap
+project: onap
+
+# Change this to ReleaseBranchName to modify the header
+default-version: latest
+#
diff --git a/docs/requirements-docs.txt b/docs/requirements-docs.txt
new file mode 100644
index 0000000000..b3188ddd38
--- /dev/null
+++ b/docs/requirements-docs.txt
@@ -0,0 +1,15 @@
+tox
+Sphinx
+doc8
+docutils
+setuptools
+six
+sphinx_rtd_theme>=0.4.3
+sphinxcontrib-blockdiag
+sphinxcontrib-needs>=0.2.3
+sphinxcontrib-nwdiag
+sphinxcontrib-seqdiag
+sphinxcontrib-swaggerdoc
+sphinxcontrib-plantuml
+sphinx_bootstrap_theme
+lfdocs-conf
diff --git a/docs/tox.ini b/docs/tox.ini
new file mode 100644
index 0000000000..edac8c35fc
--- /dev/null
+++ b/docs/tox.ini
@@ -0,0 +1,22 @@
+[tox]
+minversion = 1.6
+envlist = docs,
+skipsdist = true
+
+[testenv:docs]
+basepython = python3
+deps = -r{toxinidir}/requirements-docs.txt
+commands =
+ sphinx-build -b html -n -d {envtmpdir}/doctrees ./ {toxinidir}/_build/html
+ echo "Generated docs available in {toxinidir}/_build/html"
+whitelist_externals =
+ echo
+ git
+ sh
+
+[testenv:docs-linkcheck]
+basepython = python3
+#deps = -r{toxinidir}/requirements-docs.txt
+commands = echo "Link Checking not enforced"
+#commands = sphinx-build -b linkcheck -d {envtmpdir}/doctrees ./ {toxinidir}/_build/linkcheck
+whitelist_externals = echo
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/InstanceManagement.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/InstanceManagement.java
index dbdc274bc6..028abd6d25 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/InstanceManagement.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/InstanceManagement.java
@@ -7,12 +7,14 @@
* ================================================================================
* Modifications Copyright (c) 2019 Samsung
* ================================================================================
+ * Modifications Copyright (c) 2020 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.
@@ -133,7 +135,7 @@ public class InstanceManagement {
HashMap<String, String> instanceIdMap, String version, String requestId,
ContainerRequestContext requestContext) throws ApiException {
String serviceInstanceId;
- Boolean aLaCarte = true;
+ boolean aLaCarte = true;
ServiceInstancesRequest sir;
String apiVersion = version.substring(1);
@@ -162,26 +164,14 @@ public class InstanceManagement {
currentActiveReq);
requestHandlerUtils.setInstanceId(currentActiveReq, requestScope, null, instanceIdMap);
- int requestVersion = Integer.parseInt(version.substring(1));
- String vnfType = msoRequest.getVnfType(sir, requestScope, action, requestVersion);
+ String vnfType = msoRequest.getVnfType(sir, requestScope);
if (requestScope.equalsIgnoreCase(ModelType.vnf.name()) && vnfType != null) {
currentActiveReq.setVnfType(vnfType);
}
- InfraActiveRequests dup = null;
- boolean inProgress = false;
-
- dup = requestHandlerUtils.duplicateCheck(action, instanceIdMap, null, requestScope, currentActiveReq);
-
- if (dup != null) {
- inProgress = requestHandlerUtils.camundaHistoryCheck(dup, currentActiveReq);
- }
+ checkDuplicateAndBuildError(action, instanceIdMap, requestScope, currentActiveReq);
- if (dup != null && inProgress) {
- requestHandlerUtils.buildErrorOnDuplicateRecord(currentActiveReq, action, instanceIdMap, null, requestScope,
- dup);
- }
ServiceInstancesResponse serviceResponse = new ServiceInstancesResponse();
RequestReferences referencesResponse = new RequestReferences();
@@ -189,7 +179,7 @@ public class InstanceManagement {
referencesResponse.setRequestId(requestId);
serviceResponse.setRequestReferences(referencesResponse);
- Boolean isBaseVfModule = false;
+ boolean isBaseVfModule = false;
String workflowUuid = null;
if (instanceIdMap != null) {
@@ -207,17 +197,9 @@ public class InstanceManagement {
vnfId = sir.getVnfInstanceId();
}
- try {
- infraActiveRequestsClient.save(currentActiveReq);
- } catch (Exception e) {
- ErrorLoggerInfo errorLoggerInfo =
- new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, ErrorCode.DataError)
- .errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
- throw new RequestDbFailureException.Builder(SAVE_TO_DB, e.toString(), HttpStatus.SC_INTERNAL_SERVER_ERROR,
- ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).cause(e).errorInfo(errorLoggerInfo).build();
- }
+ saveCurrentActiveRequest(currentActiveReq);
- RequestClientParameter requestClientParameter = null;
+ RequestClientParameter requestClientParameter;
try {
requestClientParameter = new RequestClientParameter.Builder().setRequestId(requestId)
.setBaseVfModule(isBaseVfModule).setRecipeTimeout(recipeLookupResult.getRecipeTimeout())
@@ -237,10 +219,38 @@ public class InstanceManagement {
recipeLookupResult.getOrchestrationURI(), requestScope);
}
+ private void saveCurrentActiveRequest(InfraActiveRequests currentActiveReq) throws RequestDbFailureException {
+ try {
+ infraActiveRequestsClient.save(currentActiveReq);
+ } catch (Exception e) {
+ ErrorLoggerInfo errorLoggerInfo =
+ new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, ErrorCode.DataError)
+ .errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ throw new RequestDbFailureException.Builder(SAVE_TO_DB, e.toString(), HttpStatus.SC_INTERNAL_SERVER_ERROR,
+ ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).cause(e).errorInfo(errorLoggerInfo).build();
+ }
+ }
+
+ private void checkDuplicateAndBuildError(Actions action, HashMap<String, String> instanceIdMap, String requestScope,
+ InfraActiveRequests currentActiveReq) throws ApiException {
+
+ InfraActiveRequests dup =
+ requestHandlerUtils.duplicateCheck(action, instanceIdMap, null, requestScope, currentActiveReq);
+ if (dup == null) {
+ return;
+ }
+
+ boolean inProgress = requestHandlerUtils.camundaHistoryCheck(dup, currentActiveReq);
+ if (inProgress) {
+ requestHandlerUtils.buildErrorOnDuplicateRecord(currentActiveReq, action, instanceIdMap, null, requestScope,
+ dup);
+ }
+ }
+
private Response processPNFCustomWorkflowRequest(String requestJSON, Actions action,
HashMap<String, String> instanceIdMap, String version, String requestId,
ContainerRequestContext requestContext) throws ApiException {
- Boolean aLaCarte = false;
+ boolean aLaCarte = false;
ServiceInstancesRequest sir;
String apiVersion = version.substring(1);
@@ -279,33 +289,13 @@ public class InstanceManagement {
currentActiveReq);
requestHandlerUtils.setInstanceId(currentActiveReq, requestScope, null, instanceIdMap);
- InfraActiveRequests dup = null;
- boolean inProgress = false;
-
- dup = requestHandlerUtils.duplicateCheck(action, instanceIdMap, null, requestScope, currentActiveReq);
-
- if (dup != null) {
- inProgress = requestHandlerUtils.camundaHistoryCheck(dup, currentActiveReq);
- }
-
- if (dup != null && inProgress) {
- requestHandlerUtils.buildErrorOnDuplicateRecord(currentActiveReq, action, instanceIdMap, null, requestScope,
- dup);
- }
+ checkDuplicateAndBuildError(action, instanceIdMap, requestScope, currentActiveReq);
RecipeLookupResult recipeLookupResult = getInstanceManagementWorkflowRecipe(currentActiveReq, workflowUuid);
- try {
- infraActiveRequestsClient.save(currentActiveReq);
- } catch (Exception e) {
- ErrorLoggerInfo errorLoggerInfo =
- new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, ErrorCode.DataError)
- .errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
- throw new RequestDbFailureException.Builder(SAVE_TO_DB, e.toString(), HttpStatus.SC_INTERNAL_SERVER_ERROR,
- ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).cause(e).errorInfo(errorLoggerInfo).build();
- }
+ saveCurrentActiveRequest(currentActiveReq);
- RequestClientParameter requestClientParameter = null;
+ RequestClientParameter requestClientParameter;
try {
requestClientParameter = new RequestClientParameter.Builder().setRequestId(requestId)
.setRecipeTimeout(recipeLookupResult.getRecipeTimeout()).setRequestAction(action.toString())
@@ -326,7 +316,7 @@ public class InstanceManagement {
private RecipeLookupResult getInstanceManagementWorkflowRecipe(InfraActiveRequests currentActiveReq,
String workflowUuid) throws ApiException {
- RecipeLookupResult recipeLookupResult = null;
+ RecipeLookupResult recipeLookupResult;
try {
recipeLookupResult = getCustomWorkflowUri(workflowUuid);
@@ -359,14 +349,12 @@ public class InstanceManagement {
private RecipeLookupResult getCustomWorkflowUri(String workflowUuid) {
- String recipeUri = null;
Workflow workflow = catalogDbClient.findWorkflowByArtifactUUID(workflowUuid);
- if (workflow == null) {
- return null;
- } else {
+ if (workflow != null) {
String workflowName = workflow.getName();
- recipeUri = "/mso/async/services/" + workflowName;
+ String recipeUri = "/mso/async/services/" + workflowName;
+ return new RecipeLookupResult(recipeUri, 180);
}
- return new RecipeLookupResult(recipeUri, 180);
+ return null;
}
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java
index c077558301..5c81f4e6a5 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java
@@ -7,12 +7,14 @@
* ================================================================================
* Modifications Copyright (c) 2019 Samsung
* ================================================================================
+ * Modifications Copyright (c) 2020 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.
@@ -30,7 +32,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.Map.Entry;
+import java.util.Optional;
import java.util.StringTokenizer;
import javax.ws.rs.core.MultivaluedMap;
import javax.ws.rs.core.Response;
@@ -69,7 +71,6 @@ import org.onap.so.db.request.client.RequestsDbClient;
import org.onap.so.exceptions.ValidationException;
import org.onap.so.logger.LogConstants;
import org.onap.so.serviceinstancebeans.CloudConfiguration;
-import org.onap.so.serviceinstancebeans.InstanceDirection;
import org.onap.so.serviceinstancebeans.ModelInfo;
import org.onap.so.serviceinstancebeans.ModelType;
import org.onap.so.serviceinstancebeans.PolicyException;
@@ -148,7 +149,6 @@ public class MsoRequest {
}
-
// Parse request JSON
public void parse(ServiceInstancesRequest sir, HashMap<String, String> instanceIdMap, Actions action,
String version, String originalRequestJSON, int reqVersion, Boolean aLaCarteFlag)
@@ -222,44 +222,31 @@ public class MsoRequest {
}
}
- public Map<String, List<String>> getOrchestrationFilters(MultivaluedMap<String, String> queryParams)
- throws ValidationException {
-
- String queryParam = null;
+ public Map<String, List<String>> getOrchestrationFilters(MultivaluedMap<String, String> queryParams) {
+ final String FILTER_KEY = "filter";
Map<String, List<String>> orchestrationFilterParams = new HashMap<>();
+ Optional.ofNullable(queryParams.get(FILTER_KEY)).ifPresent(listValues -> listValues
+ .forEach(value -> addValueToOrchestrationFilterParamsMap(orchestrationFilterParams, value)));
- for (Entry<String, List<String>> entry : queryParams.entrySet()) {
- queryParam = entry.getKey();
-
- try {
- if ("filter".equalsIgnoreCase(queryParam)) {
- for (String value : entry.getValue()) {
- StringTokenizer st = new StringTokenizer(value, ":");
-
- int counter = 0;
- String mapKey = null;
- List<String> orchestrationList = new ArrayList<>();
- while (st.hasMoreElements()) {
- if (counter == 0) {
- mapKey = st.nextElement() + "";
- } else {
- orchestrationList.add(st.nextElement() + "");
- }
- counter++;
- }
- orchestrationFilterParams.put(mapKey, orchestrationList);
- }
- }
+ return orchestrationFilterParams;
+ }
- } catch (Exception e) {
- throw new ValidationException("QueryParam ServiceInfo", e);
- }
+ private void addValueToOrchestrationFilterParamsMap(Map<String, List<String>> orchestrationFilterParams,
+ String value) {
+ final String TOKEN_DELIMITER = ":";
+ StringTokenizer stringTokenizer = new StringTokenizer(value, TOKEN_DELIMITER);
+ if (!stringTokenizer.hasMoreTokens()) {
+ return;
+ }
+ String mapKey = stringTokenizer.nextToken();
+ List<String> orchestrationList = new ArrayList<>();
+ while (stringTokenizer.hasMoreTokens()) {
+ orchestrationList.add(stringTokenizer.nextToken());
}
-
- return orchestrationFilterParams;
+ orchestrationFilterParams.put(mapKey, orchestrationList);
}
public InfraActiveRequests createRequestObject(ServiceInstancesRequest servInsReq, Actions action, String requestId,
@@ -465,7 +452,6 @@ public class MsoRequest {
}
-
public Response buildResponse(int httpResponseCode, String errorCode, InfraActiveRequests inProgress) {
return buildResponseWithError(httpResponseCode, errorCode, inProgress, null);
}
@@ -474,7 +460,6 @@ public class MsoRequest {
String errorString) {
-
// Log the failed request into the MSO Requests database
return Response.status(httpResponseCode).entity(null).build();
@@ -487,7 +472,6 @@ public class MsoRequest {
}
-
public String getServiceType(VnfInputs vnfInputs) {
if (vnfInputs.getServiceType() != null)
return vnfInputs.getServiceType();
@@ -625,156 +609,78 @@ public class MsoRequest {
}
- public String getVfModuleType(ServiceInstancesRequest sir, String requestScope, Actions action, int reqVersion) {
+ public String getVfModuleType(ServiceInstancesRequest sir, String requestScope) {
- String serviceInstanceType = null;
-
- String vnfType = null;
+ String vnfType;
String vfModuleType = null;
- String vfModuleModelName = null;
+ String vfModuleModelName;
ModelInfo modelInfo = sir.getRequestDetails().getModelInfo();
RelatedInstanceList[] instanceList = sir.getRequestDetails().getRelatedInstanceList();
String serviceModelName = null;
String vnfModelName = null;
- String asdcServiceModelVersion = null;
String volumeGroupId = null;
- boolean isRelatedServiceInstancePresent = false;
- boolean isRelatedVnfInstancePresent = false;
- boolean isSourceVnfPresent = false;
- boolean isDestinationVnfPresent = false;
- boolean isConnectionPointPresent = false;
-
- if (instanceList != null) {
- for (RelatedInstanceList relatedInstanceList : instanceList) {
- RelatedInstance relatedInstance = relatedInstanceList.getRelatedInstance();
- ModelInfo relatedInstanceModelInfo = relatedInstance.getModelInfo();
-
- if (action != Action.deleteInstance) {
-
- if (ModelType.configuration.name().equalsIgnoreCase(requestScope)) {
- if (InstanceDirection.source.equals(relatedInstance.getInstanceDirection())
- && relatedInstanceModelInfo.getModelType().equals(ModelType.vnf)) {
- isSourceVnfPresent = true;
- } else if (InstanceDirection.destination.equals(relatedInstance.getInstanceDirection())
- && (relatedInstanceModelInfo.getModelType().equals(ModelType.vnf)
- || (relatedInstanceModelInfo.getModelType().equals(ModelType.pnf)
- && reqVersion == 6))) {
- isDestinationVnfPresent = true;
- }
- }
- if (ModelType.connectionPoint.equals(relatedInstanceModelInfo.getModelType())
- && ModelType.configuration.name().equalsIgnoreCase(requestScope)) {
- isConnectionPointPresent = true;
- }
- }
-
-
- if (relatedInstanceModelInfo.getModelType().equals(ModelType.service)) {
- isRelatedServiceInstancePresent = true;
- serviceModelName = relatedInstanceModelInfo.getModelName();
- asdcServiceModelVersion = relatedInstanceModelInfo.getModelVersion();
- } else if (relatedInstanceModelInfo.getModelType().equals(ModelType.vnf)
- && !(ModelType.configuration.name().equalsIgnoreCase(requestScope))) {
- isRelatedVnfInstancePresent = true;
- vnfModelName = relatedInstanceModelInfo.getModelCustomizationName();
- } else if (relatedInstanceModelInfo.getModelType().equals(ModelType.volumeGroup)) {
- volumeGroupId = relatedInstance.getInstanceId();
- }
+ if (instanceList == null) {
+ return null;
+ }
+ for (RelatedInstanceList relatedInstanceList : instanceList) {
+ RelatedInstance relatedInstance = relatedInstanceList.getRelatedInstance();
+ ModelInfo relatedInstanceModelInfo = relatedInstance.getModelInfo();
+
+ if (relatedInstanceModelInfo.getModelType().equals(ModelType.service)) {
+ serviceModelName = relatedInstanceModelInfo.getModelName();
+ } else if (relatedInstanceModelInfo.getModelType().equals(ModelType.vnf)
+ && !(ModelType.configuration.name().equalsIgnoreCase(requestScope))) {
+ vnfModelName = relatedInstanceModelInfo.getModelCustomizationName();
+ } else if (relatedInstanceModelInfo.getModelType().equals(ModelType.volumeGroup)) {
+ volumeGroupId = relatedInstance.getInstanceId();
}
-
- if (requestScope.equalsIgnoreCase(ModelType.volumeGroup.name())) {
- serviceInstanceType = serviceModelName;
- vnfType = serviceModelName + "/" + vnfModelName;
- } else if (requestScope.equalsIgnoreCase(ModelType.vfModule.name())) {
- vfModuleModelName = modelInfo.getModelName();
- serviceInstanceType = serviceModelName;
- vnfType = serviceModelName + "/" + vnfModelName;
- vfModuleType = vnfType + "::" + vfModuleModelName;
- sir.setVolumeGroupInstanceId(volumeGroupId);
- } else if (requestScope.equalsIgnoreCase(ModelType.vnf.name()))
- vnfType = serviceModelName + "/" + sir.getRequestDetails().getModelInfo().getModelCustomizationName();
-
+ }
+ if (requestScope.equalsIgnoreCase(ModelType.vfModule.name())) {
+ vfModuleModelName = modelInfo.getModelName();
+ vnfType = serviceModelName + "/" + vnfModelName;
+ vfModuleType = vnfType + "::" + vfModuleModelName;
+ sir.setVolumeGroupInstanceId(volumeGroupId);
}
return vfModuleType;
}
- public String getVnfType(ServiceInstancesRequest sir, String requestScope, Actions action, int reqVersion) {
+ public String getVnfType(ServiceInstancesRequest sir, String requestScope) {
- String serviceInstanceType = null;
- String networkType = null;
String vnfType = null;
- String vfModuleType = null;
- String vfModuleModelName = null;
- ModelInfo modelInfo = sir.getRequestDetails().getModelInfo();
RelatedInstanceList[] instanceList = sir.getRequestDetails().getRelatedInstanceList();
String serviceModelName = null;
String vnfModelName = null;
- String asdcServiceModelVersion = null;
String volumeGroupId = null;
- boolean isRelatedServiceInstancePresent = false;
- boolean isRelatedVnfInstancePresent = false;
- boolean isSourceVnfPresent = false;
- boolean isDestinationVnfPresent = false;
- boolean isConnectionPointPresent = false;
-
- if (instanceList != null) {
- for (RelatedInstanceList relatedInstanceList : instanceList) {
- RelatedInstance relatedInstance = relatedInstanceList.getRelatedInstance();
- ModelInfo relatedInstanceModelInfo = relatedInstance.getModelInfo();
-
- if (action != Action.deleteInstance) {
-
- if (ModelType.configuration.name().equalsIgnoreCase(requestScope)) {
- if (InstanceDirection.source.equals(relatedInstance.getInstanceDirection())
- && relatedInstanceModelInfo.getModelType().equals(ModelType.vnf)) {
- isSourceVnfPresent = true;
- } else if (InstanceDirection.destination.equals(relatedInstance.getInstanceDirection())
- && (relatedInstanceModelInfo.getModelType().equals(ModelType.vnf)
- || (relatedInstanceModelInfo.getModelType().equals(ModelType.pnf)
- && reqVersion == 6))) {
- isDestinationVnfPresent = true;
- }
- }
- if (ModelType.connectionPoint.equals(relatedInstanceModelInfo.getModelType())
- && ModelType.configuration.name().equalsIgnoreCase(requestScope)) {
- isConnectionPointPresent = true;
- }
- }
-
-
- if (relatedInstanceModelInfo.getModelType().equals(ModelType.service)) {
- isRelatedServiceInstancePresent = true;
- serviceModelName = relatedInstanceModelInfo.getModelName();
- asdcServiceModelVersion = relatedInstanceModelInfo.getModelVersion();
- } else if (relatedInstanceModelInfo.getModelType().equals(ModelType.vnf)
- && !(ModelType.configuration.name().equalsIgnoreCase(requestScope))) {
- isRelatedVnfInstancePresent = true;
- vnfModelName = relatedInstanceModelInfo.getModelCustomizationName();
- } else if (relatedInstanceModelInfo.getModelType().equals(ModelType.volumeGroup)) {
- volumeGroupId = relatedInstance.getInstanceId();
- }
+ if (instanceList == null) {
+ return null;
+ }
+ for (RelatedInstanceList relatedInstanceList : instanceList) {
+ RelatedInstance relatedInstance = relatedInstanceList.getRelatedInstance();
+ ModelInfo relatedInstanceModelInfo = relatedInstance.getModelInfo();
+
+ if (relatedInstanceModelInfo.getModelType().equals(ModelType.service)) {
+ serviceModelName = relatedInstanceModelInfo.getModelName();
+ } else if (relatedInstanceModelInfo.getModelType().equals(ModelType.vnf)
+ && !(ModelType.configuration.name().equalsIgnoreCase(requestScope))) {
+ vnfModelName = relatedInstanceModelInfo.getModelCustomizationName();
+ } else if (relatedInstanceModelInfo.getModelType().equals(ModelType.volumeGroup)) {
+ volumeGroupId = relatedInstance.getInstanceId();
}
-
- if (requestScope.equalsIgnoreCase(ModelType.volumeGroup.name())) {
- serviceInstanceType = serviceModelName;
- vnfType = serviceModelName + "/" + vnfModelName;
- } else if (requestScope.equalsIgnoreCase(ModelType.vfModule.name())) {
- vfModuleModelName = modelInfo.getModelName();
- serviceInstanceType = serviceModelName;
- vnfType = serviceModelName + "/" + vnfModelName;
- vfModuleType = vnfType + "::" + vfModuleModelName;
- sir.setVolumeGroupInstanceId(volumeGroupId);
- } else if (requestScope.equalsIgnoreCase(ModelType.vnf.name()))
- vnfType = serviceModelName + "/" + sir.getRequestDetails().getModelInfo().getModelCustomizationName();
-
}
- return vnfType;
+ if (requestScope.equalsIgnoreCase(ModelType.volumeGroup.name())) {
+ vnfType = serviceModelName + "/" + vnfModelName;
+ } else if (requestScope.equalsIgnoreCase(ModelType.vfModule.name())) {
+ vnfType = serviceModelName + "/" + vnfModelName;
+ sir.setVolumeGroupInstanceId(volumeGroupId);
+ } else if (requestScope.equalsIgnoreCase(ModelType.vnf.name()))
+ vnfType = serviceModelName + "/" + sir.getRequestDetails().getModelInfo().getModelCustomizationName();
+ return vnfType;
}
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequest.java
index 65537cbba0..a15d9cfd48 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequest.java
@@ -251,25 +251,22 @@ public class ResumeOrchestrationRequest {
}
try {
- requestClientParameter =
- new RequestClientParameter.Builder().setRequestId(currentActiveRequest.getRequestId())
- .setBaseVfModule(isBaseVfModule).setRecipeTimeout(recipeLookupResult.getRecipeTimeout())
- .setRequestAction(infraActiveRequest.getRequestAction())
- .setServiceInstanceId(infraActiveRequest.getServiceInstanceId())
- .setPnfCorrelationId(pnfCorrelationId).setVnfId(infraActiveRequest.getVnfId())
- .setVfModuleId(infraActiveRequest.getVfModuleId())
- .setVolumeGroupId(infraActiveRequest.getVolumeGroupId())
- .setNetworkId(infraActiveRequest.getNetworkId())
- .setServiceType(infraActiveRequest.getServiceType())
- .setVnfType(infraActiveRequest.getVnfType())
- .setVfModuleType(msoRequest.getVfModuleType(sir, infraActiveRequest.getRequestScope(),
- action, Integer.parseInt(version)))
- .setNetworkType(infraActiveRequest.getNetworkType())
- .setRequestDetails(requestHandlerUtils
- .mapJSONtoMSOStyle(infraActiveRequest.getRequestBody(), sir, aLaCarte, action))
- .setApiVersion(version).setALaCarte(aLaCarte)
- .setRequestUri(currentActiveRequest.getRequestUrl())
- .setInstanceGroupId(infraActiveRequest.getInstanceGroupId()).build();
+ requestClientParameter = new RequestClientParameter.Builder()
+ .setRequestId(currentActiveRequest.getRequestId()).setBaseVfModule(isBaseVfModule)
+ .setRecipeTimeout(recipeLookupResult.getRecipeTimeout())
+ .setRequestAction(infraActiveRequest.getRequestAction())
+ .setServiceInstanceId(infraActiveRequest.getServiceInstanceId())
+ .setPnfCorrelationId(pnfCorrelationId).setVnfId(infraActiveRequest.getVnfId())
+ .setVfModuleId(infraActiveRequest.getVfModuleId())
+ .setVolumeGroupId(infraActiveRequest.getVolumeGroupId())
+ .setNetworkId(infraActiveRequest.getNetworkId()).setServiceType(infraActiveRequest.getServiceType())
+ .setVnfType(infraActiveRequest.getVnfType())
+ .setVfModuleType(msoRequest.getVfModuleType(sir, infraActiveRequest.getRequestScope()))
+ .setNetworkType(infraActiveRequest.getNetworkType())
+ .setRequestDetails(requestHandlerUtils.mapJSONtoMSOStyle(infraActiveRequest.getRequestBody(), sir,
+ aLaCarte, action))
+ .setApiVersion(version).setALaCarte(aLaCarte).setRequestUri(currentActiveRequest.getRequestUrl())
+ .setInstanceGroupId(infraActiveRequest.getInstanceGroupId()).build();
} catch (IOException e) {
logger.error("IOException while generating requestClientParameter to send to BPMN", e);
ErrorLoggerInfo errorLoggerInfo =
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java
index 175b212c86..33eae43e44 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java
@@ -844,17 +844,15 @@ public class ServiceInstances extends AbstractRestHandler {
}
requestHandlerUtils.setInstanceId(currentActiveReq, requestScope, null, instanceIdMap);
-
- int requestVersion = Integer.parseInt(version.substring(1));
String instanceName = null;
if (sir.getRequestDetails().getRequestInfo() != null) {
instanceName = sir.getRequestDetails().getRequestInfo().getInstanceName();
}
boolean alaCarteFlag = msoRequest.getAlacarteFlag(sir);
- String vnfType = msoRequest.getVnfType(sir, requestScope, action, requestVersion);
+ String vnfType = msoRequest.getVnfType(sir, requestScope);
String networkType = msoRequest.getNetworkType(sir, requestScope);
String sdcServiceModelVersion = msoRequest.getSDCServiceModelVersion(sir);
- String vfModuleType = msoRequest.getVfModuleType(sir, requestScope, action, requestVersion);
+ String vfModuleType = msoRequest.getVfModuleType(sir, requestScope);
if (requestScope.equalsIgnoreCase(ModelType.vnf.name()) && vnfType != null) {
currentActiveReq.setVnfType(vnfType);
@@ -935,7 +933,7 @@ public class ServiceInstances extends AbstractRestHandler {
}
- RequestClientParameter requestClientParameter = null;
+ RequestClientParameter requestClientParameter;
try {
requestClientParameter = new RequestClientParameter.Builder().setRequestId(requestId)
.setBaseVfModule(isBaseVfModule).setRecipeTimeout(recipeLookupResult.getRecipeTimeout())
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java
index 7f5907e9bf..161ca2a2fb 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java
@@ -764,8 +764,61 @@ public class CatalogDbClient {
return this.getSingleResource(cloudSiteClient, getUri(uri + id));
}
- public void postCloudSite(CloudSite cloudSite) {
- this.postSingleResource(cloudSiteClient, cloudSite);
+ public CloudSite postCloudSite(CloudSite cloudSite) {
+ if (cloudSite == null) {
+ throw new EntityNotFoundException("CloudSite passed as null");
+ }
+ try {
+ HttpHeaders headers = getHttpHeaders();
+ HttpEntity<CloudSite> entity = new HttpEntity<>(cloudSite, headers);
+ CloudSite updatedCloudSite = restTemplate
+ .exchange(UriComponentsBuilder.fromUriString(endpoint + "/cloudSite").build().encode().toString(),
+ HttpMethod.POST, entity, CloudSite.class)
+ .getBody();
+ return updatedCloudSite;
+ } catch (HttpClientErrorException e) {
+ if (HttpStatus.SC_NOT_FOUND == e.getStatusCode().value()) {
+ throw new EntityNotFoundException("Unable to find CloudSite with Cloud Site Id: " + cloudSite.getId());
+ }
+ throw e;
+ }
+ }
+
+ public CloudSite updateCloudSite(CloudSite cloudSite) {
+ if (cloudSite == null) {
+ throw new EntityNotFoundException("CloudSite passed as null");
+ }
+ try {
+ HttpHeaders headers = getHttpHeaders();
+ HttpEntity<CloudSite> entity = new HttpEntity<>(cloudSite, headers);
+ CloudSite updatedCloudSite = restTemplate
+ .exchange(UriComponentsBuilder.fromUriString(endpoint + "/cloudSite/" + cloudSite.getId()).build()
+ .encode().toString(), HttpMethod.PUT, entity, CloudSite.class)
+ .getBody();
+ return updatedCloudSite;
+ } catch (HttpClientErrorException e) {
+ if (HttpStatus.SC_NOT_FOUND == e.getStatusCode().value()) {
+ throw new EntityNotFoundException("Unable to find CloudSite with Cloud Site Id: " + cloudSite.getId());
+ }
+ throw e;
+ }
+ }
+
+ public void deleteCloudSite(String cloudSiteId) {
+ if (cloudSiteId == null) {
+ throw new EntityNotFoundException("CloudSiteId passed as null");
+ }
+ try {
+ HttpHeaders headers = getHttpHeaders();
+ HttpEntity<String> entity = new HttpEntity<>(null, headers);
+ restTemplate.exchange(UriComponentsBuilder.fromUriString(endpoint + "/cloudSite/" + cloudSiteId).build()
+ .encode().toString(), HttpMethod.DELETE, entity, CloudSite.class).getBody();
+ } catch (HttpClientErrorException e) {
+ if (HttpStatus.SC_NOT_FOUND == e.getStatusCode().value()) {
+ throw new EntityNotFoundException("Unable to find CloudSite with Cloud Site Id: " + cloudSiteId);
+ }
+ throw e;
+ }
}
public List<CloudSite> getCloudSites() {
diff --git a/packages/docker/src/main/docker/docker-files/scripts/start-app.sh b/packages/docker/src/main/docker/docker-files/scripts/start-app.sh
index cea680c682..75d64fefa0 100644
--- a/packages/docker/src/main/docker/docker-files/scripts/start-app.sh
+++ b/packages/docker/src/main/docker/docker-files/scripts/start-app.sh
@@ -83,6 +83,26 @@ fi
jvmargs="${JVM_ARGS} -Dspring.profiles.active=${ACTIVE_PROFILE} -Djava.security.egd=file:/dev/./urandom -Dlogs_dir=${LOG_PATH} -Dlogging.config=/app/logback-spring.xml $jksargs -Dspring.config.additional-location=$CONFIG_PATH ${SSL_DEBUG} ${DISABLE_SNI}"
+
+read_properties(){
+ while IFS="=" read -r key value; do
+ case "${key}" in
+ '#'*) ;;
+ *)
+ eKey=$(echo $key | tr '[:lower:]' '[:upper:]')
+ export "$eKey"="$value"
+ esac
+ done <<-EOF
+ $1
+ EOF
+}
+
+
+
+if [ -n "${AAF_SSL_CERTS_ENABLED}" ]; then
+read_properties "$(head -n 4 /app/certs/.passphrases)"
+fi
+
echo "JVM Arguments: ${jvmargs}"
java ${jvmargs} -jar app.jar