summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.readthedocs.yaml20
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V8.4__AddBBNameSelectionReference.sql16
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java38
-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--adapters/mso-ve-vnfm-adapter/pom.xml11
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/provider/AuthorizationHeadersProvider.java20
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/SubscriberService.java2
-rw-r--r--adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/provider/AuthorizationHeadersProviderTest.java47
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/Constants.java8
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/VnfmBasicHttpSecurityConfigurer.java9
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/converters/sol003/etsicatalog/PkgmSubscriptionRequestConverter.java11
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogServiceProvider.java12
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogServiceProviderImpl.java40
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/SubscriptionManager.java27
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/cache/PackageManagementCacheServiceProvider.java2
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/EtsiSubscriptionNotificationController.java4
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementSubscriptionController.java24
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementSubscriptionControllerTest.java63
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ControllerExecutionBB.bpmn241
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/PauseForManualTaskRainyDayTest.java10
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAIDeleteServiceInstance.java14
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAIServiceInstance.java79
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java18
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetwork.java9
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ControllerExecution.java109
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollection.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasks.java19
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceDeleteTasks.java7
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java6
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java9
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVolumeGroupResources.java9
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ControllerExecutionTest.java127
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java72
-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-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java61
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandlerTest.java50
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/Empty_workflowActivitySpecSequence_Response.json5
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/WorkflowSpecificationsForPnf.json20
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/WorkflowSpecificationsForPnfQuery_Response.json41
-rw-r--r--mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/OrchestrationTaskRepository.java33
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/OrchestrationTask.java143
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/BBNameSelectionReference.java115
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java85
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/BBNameSelectionReferenceRepository.java36
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/WorkflowRepository.java4
-rw-r--r--mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/WorkflowRepositoryTest.java3
-rw-r--r--mso-catalog-db/src/test/resources/data.sql6
-rw-r--r--mso-catalog-db/src/test/resources/schema.sql12
-rw-r--r--packages/docker/pom.xml960
-rw-r--r--packages/docker/src/main/docker/docker-files/scripts/start-app.sh20
-rw-r--r--pom.xml46
69 files changed, 2731 insertions, 903 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/main/resources/db/migration/V8.4__AddBBNameSelectionReference.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V8.4__AddBBNameSelectionReference.sql
new file mode 100644
index 0000000000..2b8d4ea69f
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V8.4__AddBBNameSelectionReference.sql
@@ -0,0 +1,16 @@
+use catalogdb;
+
+CREATE TABLE IF NOT EXISTS `bbname_selection_reference` (
+ `ID` INT(11) NOT NULL AUTO_INCREMENT,
+ `CONTROLLER_ACTOR` varchar(200) NOT NULL ,
+ `SCOPE` varchar(200) NOT NULL,
+ `ACTION` varchar(200) NOT NULL,
+ `BB_NAME` varchar(200) NOT NULL,
+ PRIMARY KEY (`ID`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+INSERT INTO bbname_selection_reference (CONTROLLER_ACTOR,SCOPE,ACTION,BB_NAME)
+VALUES
+('APPC', 'vfModule', 'healthCheck','GenericVnfHealthCheckBB'),
+('APPC', 'vfModule', 'configScaleOut','ConfigurationScaleOutBB'),
+('APPC', 'vnf', 'healthCheck','GenericVnfHealthCheckBB'); \ No newline at end of file
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..03ef24ded0 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;
@@ -33,6 +33,7 @@ import org.junit.Before;
import org.junit.Test;
import org.onap.so.adapters.catalogdb.CatalogDbAdapterBaseTest;
import org.onap.so.db.catalog.beans.AuthenticationType;
+import org.onap.so.db.catalog.beans.BBNameSelectionReference;
import org.onap.so.db.catalog.beans.CloudIdentity;
import org.onap.so.db.catalog.beans.CloudSite;
import org.onap.so.db.catalog.beans.CloudifyManager;
@@ -428,7 +429,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 +456,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
@@ -705,8 +719,8 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
}
@Test
- public void getWorkflowByModelUUID_validUuid_expectedOutput() {
- List<Workflow> workflows = client.findWorkflowByModelUUID("ff2ae348-214a-11e7-93ae-92361f002671");
+ public void getWorkflowByVnfModelUUID_validUuid_expectedOutput() {
+ List<Workflow> workflows = client.findWorkflowByVnfModelUUID("ff2ae348-214a-11e7-93ae-92361f002671");
assertTrue(workflows != null);
assertTrue(workflows.size() != 0);
@@ -741,5 +755,21 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
assertNotEquals(0, cloudSites.size());
}
+ @Test
+ public void getBBNameSelectionReference_validData_expectedOutput() {
+ BBNameSelectionReference bbNameSelectionReference =
+ client.getBBNameSelectionReference("APPC", "vfModule", "healthCheck");
+ assertNotNull(bbNameSelectionReference);
+ assertEquals("GenericVnfHealthCheckBB", bbNameSelectionReference.getBbName());
+ }
+
+ @Test
+ public void getBBNameSelectionReference_invalidData_nullOutput() {
+ BBNameSelectionReference bbNameSelectionReference =
+ client.getBBNameSelectionReference("ABC", "vfModule", "healthCheck");
+ assertNull(bbNameSelectionReference);
+
+ }
+
}
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/adapters/mso-ve-vnfm-adapter/pom.xml b/adapters/mso-ve-vnfm-adapter/pom.xml
index 3518445b45..4472956eb7 100644
--- a/adapters/mso-ve-vnfm-adapter/pom.xml
+++ b/adapters/mso-ve-vnfm-adapter/pom.xml
@@ -59,10 +59,21 @@
</dependencies>
<build>
+ <finalName>${project.artifactId}-${project.version}</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
+ <configuration>
+ <mainClass>org.onap.so.adapters.vevnfm.Application</mainClass>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>repackage</goal>
+ </goals>
+ </execution>
+ </executions>
</plugin>
</plugins>
</build>
diff --git a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/provider/AuthorizationHeadersProvider.java b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/provider/AuthorizationHeadersProvider.java
index eca5240cb5..251e0c426b 100644
--- a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/provider/AuthorizationHeadersProvider.java
+++ b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/provider/AuthorizationHeadersProvider.java
@@ -20,29 +20,15 @@
package org.onap.so.adapters.vevnfm.provider;
-import java.util.List;
-import org.apache.logging.log4j.util.Strings;
import org.onap.so.configuration.rest.BasicHttpHeadersProvider;
-import org.springframework.http.HttpHeaders;
public class AuthorizationHeadersProvider extends BasicHttpHeadersProvider {
- private List<String> previousAuthorization;
-
public void addAuthorization(final String authorization) {
- final HttpHeaders headers = getHttpHeaders();
- previousAuthorization = headers.get(AUTHORIZATION_HEADER);
- headers.set(AUTHORIZATION_HEADER, authorization);
- }
-
- public void resetPrevious() {
- if (!isPreviousAuthorizationBlank()) {
- getHttpHeaders().addAll(AUTHORIZATION_HEADER, previousAuthorization);
- }
+ getHttpHeaders().set(AUTHORIZATION_HEADER, authorization);
}
- private boolean isPreviousAuthorizationBlank() {
- return previousAuthorization == null || previousAuthorization.isEmpty()
- || Strings.isBlank(previousAuthorization.get(0));
+ public void removeAuthorization() {
+ getHttpHeaders().remove(AUTHORIZATION_HEADER);
}
}
diff --git a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/SubscriberService.java b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/SubscriberService.java
index 0e77ce4073..eefd9ba93b 100644
--- a/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/SubscriberService.java
+++ b/adapters/mso-ve-vnfm-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/SubscriberService.java
@@ -68,7 +68,7 @@ public class SubscriberService {
final LccnSubscriptionRequest request = createRequest();
return sender.send(info, request);
} finally {
- headersProvider.resetPrevious();
+ headersProvider.removeAuthorization();
}
}
diff --git a/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/provider/AuthorizationHeadersProviderTest.java b/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/provider/AuthorizationHeadersProviderTest.java
new file mode 100644
index 0000000000..64503ddfc2
--- /dev/null
+++ b/adapters/mso-ve-vnfm-adapter/src/test/java/org/onap/so/adapters/vevnfm/provider/AuthorizationHeadersProviderTest.java
@@ -0,0 +1,47 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SO
+ * ================================================================================
+ * Copyright (C) 2020 Samsung. 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.vevnfm.provider;
+
+import static org.junit.Assert.*;
+import static org.onap.so.configuration.rest.BasicHttpHeadersProvider.AUTHORIZATION_HEADER;
+import org.junit.Test;
+import org.springframework.http.HttpHeaders;
+
+public class AuthorizationHeadersProviderTest {
+
+ private static final String AUTHORIZATION_EXAMPLE = "authorization";
+
+ private final AuthorizationHeadersProvider provider = new AuthorizationHeadersProvider();
+
+ @Test
+ public void testSuccessValidAuthorizationAndRemoval() {
+ final HttpHeaders headers = provider.getHttpHeaders();
+ final int size = headers.size();
+
+ provider.addAuthorization(AUTHORIZATION_EXAMPLE);
+ assertEquals(size + 1, headers.size());
+ assertTrue(headers.containsKey(AUTHORIZATION_HEADER));
+
+ provider.removeAuthorization();
+ assertEquals(size, headers.size());
+ assertFalse(headers.containsKey(AUTHORIZATION_HEADER));
+ }
+}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/Constants.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/Constants.java
index fb32fb9605..d798267918 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/Constants.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/Constants.java
@@ -32,8 +32,12 @@ public class Constants {
public static final String SERVICE_VERSION = "v1";
public static final String BASE_URL = "/so/" + SERVICE_NAME + "/" + SERVICE_VERSION;
public static final String PACKAGE_MANAGEMENT_BASE_URL = BASE_URL + "/vnfpkgm/v1";
- public static final String ETSI_SUBSCRIPTION_NOTIFICATION_BASE_URL = BASE_URL + "/etsicatalogmanager/notification";
- public static final String ETSI_SUBSCRIPTION_NOTIFICATION_CONTROLLER_BASE_URL = BASE_URL + "/etsicatalogmanager";
+ public static final String ETSI_CATALOG_MANAGER_BASE_ENDPOINT = "/etsicatalogmanager";
+ public static final String ETSI_SUBSCRIPTION_NOTIFICATION_ENDPOINT = "/notification";
+ public static final String ETSI_SUBSCRIPTION_NOTIFICATION_CONTROLLER_BASE_URL =
+ BASE_URL + ETSI_CATALOG_MANAGER_BASE_ENDPOINT;
+ public static final String ETSI_SUBSCRIPTION_NOTIFICATION_BASE_URL =
+ ETSI_SUBSCRIPTION_NOTIFICATION_CONTROLLER_BASE_URL + ETSI_SUBSCRIPTION_NOTIFICATION_ENDPOINT;
public static final String APPLICATION_ZIP = "application/zip";
public static final String OPERATION_NOTIFICATION_ENDPOINT = "/lcn/VnfLcmOperationOccurrenceNotification";
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/VnfmBasicHttpSecurityConfigurer.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/VnfmBasicHttpSecurityConfigurer.java
index 1e0a18a339..f1815054e3 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/VnfmBasicHttpSecurityConfigurer.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/VnfmBasicHttpSecurityConfigurer.java
@@ -9,9 +9,9 @@
* 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.
@@ -35,7 +35,6 @@ import org.springframework.util.StringUtils;
/**
* @author Waqas Ikram (waqas.ikram@est.tech)
* @author Gareth Roper (gareth.roper@est.tech)
- *
*/
@Primary
@Component
@@ -53,10 +52,10 @@ public class VnfmBasicHttpSecurityConfigurer implements HttpSecurityConfigurer {
http.csrf().disable().authorizeRequests().anyRequest().permitAll();
} else {
http.csrf().disable().authorizeRequests().antMatchers("/manage/health", "/manage/info").permitAll()
- .antMatchers(HttpMethod.GET, "/etsi/subscription/notification").permitAll().antMatchers("/**")
+ .antMatchers(HttpMethod.GET, Constants.ETSI_SUBSCRIPTION_NOTIFICATION_BASE_URL).permitAll()
+ .antMatchers("/**")
.hasAnyRole(StringUtils.collectionToDelimitedString(soUserCredentialConfiguration.getRoles(), ","))
.and().httpBasic();
-
}
}
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/converters/sol003/etsicatalog/PkgmSubscriptionRequestConverter.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/converters/sol003/etsicatalog/PkgmSubscriptionRequestConverter.java
index c6d51c99aa..d0fd4c9e7c 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/converters/sol003/etsicatalog/PkgmSubscriptionRequestConverter.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/converters/sol003/etsicatalog/PkgmSubscriptionRequestConverter.java
@@ -20,14 +20,10 @@
package org.onap.so.adapters.vnfmadapter.converters.sol003.etsicatalog;
-import static org.slf4j.LoggerFactory.getLogger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
-import java.util.Optional;
-import java.util.UUID;
-import javax.swing.text.html.Option;
import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.Version;
import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.VnfProducts;
import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.VnfProductsProviders;
@@ -38,7 +34,6 @@ import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.SubscriptionsFilterVersions;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.SubscriptionsFilterVnfProducts;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.SubscriptionsFilterVnfProductsFromProviders;
-import org.slf4j.Logger;
import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Service;
@@ -48,14 +43,11 @@ import org.springframework.stereotype.Service;
*
* @author Ronan Kenny (ronan.kenny@est.tech)
* @author Gareth Roper (gareth.roper@est.tech)
- *
*/
@Service
public class PkgmSubscriptionRequestConverter implements
Converter<PkgmSubscriptionRequest, org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.PkgmSubscriptionRequest> {
- private static final Logger logger = getLogger(PkgmSubscriptionRequestConverter.class);
-
@Override
public org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.PkgmSubscriptionRequest convert(
PkgmSubscriptionRequest pkgmSubscriptionRequest) {
@@ -133,7 +125,8 @@ public class PkgmSubscriptionRequestConverter implements
final List<VnfProductsProviders> etsiCatalogManagerVnfProductsProviders = new ArrayList<>();
filterProductsFromProvider.forEach(vnfProduct -> {
etsiCatalogManagerVnfProductsProviders
- .add(new VnfProductsProviders().vnfProducts(getVnfProducts(vnfProduct.getVnfProducts())));
+ .add(new VnfProductsProviders().vnfProvider(vnfProduct.getVnfProvider())
+ .vnfProducts(getVnfProducts(vnfProduct.getVnfProducts())));
});
return etsiCatalogManagerVnfProductsProviders;
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogServiceProvider.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogServiceProvider.java
index 62b365745c..e0eed159c2 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogServiceProvider.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogServiceProvider.java
@@ -23,7 +23,6 @@ package org.onap.so.adapters.vnfmadapter.extclients.etsicatalog;
import java.util.Optional;
import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.PkgmSubscription;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.InlineResponse2001;
-import org.springframework.http.ResponseEntity;
/**
* Provides methods for invoking REST calls to the ETSI Catalog Manager.
@@ -74,11 +73,18 @@ public interface EtsiCatalogServiceProvider {
Optional<byte[]> getVnfPackageArtifact(final String vnfPkgId, final String artifactPath);
/**
- * Post the SubscriptionRequest Object.
+ * POST the SubscriptionRequest Object.
*
- * @return The ResponseEntity containing the ETSI Catalog Manager's PkgmSubscription object.
+ * @return The ETSI Catalog Manager's PkgmSubscription object.
*/
Optional<PkgmSubscription> postSubscription(
final org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.PkgmSubscriptionRequest etsiCatalogManagerSubscriptionRequest);
+ /**
+ * DELETE the SubscriptionRequest Object.
+ *
+ * @return A Boolean representing if the delete was successful or not.
+ */
+ Boolean deleteSubscription(final String subscriptionId);
+
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogServiceProviderImpl.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogServiceProviderImpl.java
index 1a48494e1a..73ec7053a7 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogServiceProviderImpl.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/etsicatalog/EtsiCatalogServiceProviderImpl.java
@@ -21,11 +21,14 @@
package org.onap.so.adapters.vnfmadapter.extclients.etsicatalog;
import java.util.Optional;
-import javax.swing.text.html.Option;
import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.PkgmSubscription;
import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.VnfPkgInfo;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.InlineResponse2001;
-import org.onap.so.adapters.vnfmadapter.rest.exceptions.*;
+import org.onap.so.adapters.vnfmadapter.rest.exceptions.EtsiCatalogManagerBadRequestException;
+import org.onap.so.adapters.vnfmadapter.rest.exceptions.EtsiCatalogManagerRequestFailureException;
+import org.onap.so.adapters.vnfmadapter.rest.exceptions.VnfPkgBadRequestException;
+import org.onap.so.adapters.vnfmadapter.rest.exceptions.VnfPkgConflictException;
+import org.onap.so.adapters.vnfmadapter.rest.exceptions.VnfPkgNotFoundException;
import org.onap.so.rest.exceptions.HttpResouceNotFoundException;
import org.onap.so.rest.exceptions.InvalidRestRequestException;
import org.onap.so.rest.exceptions.RestProcessingException;
@@ -76,7 +79,7 @@ public class EtsiCatalogServiceProviderImpl implements EtsiCatalogServiceProvide
etsiCatalogUrlProvider.getVnfPackageArtifactUrl(vnfPkgId, artifactPath), byte[].class);
logger.info("getVnfPackageArtifact Request to ETSI Catalog Manager Status Code: {}",
response.getStatusCodeValue());
- if (response.getStatusCode() == HttpStatus.OK) {
+ if (response.getStatusCode().is2xxSuccessful()) {
return Optional.ofNullable(response.getBody());
}
} catch (final HttpResouceNotFoundException httpResouceNotFoundException) {
@@ -101,7 +104,7 @@ public class EtsiCatalogServiceProviderImpl implements EtsiCatalogServiceProvide
httpServiceProvider.getHttpResponse(etsiCatalogUrlProvider.getVnfPackagesUrl(), VnfPkgInfo[].class);
logger.info("getVnfPackages Request to ETSI Catalog Manager Status Code: {}",
response.getStatusCodeValue());
- if (response.getStatusCode() == HttpStatus.OK) {
+ if (response.getStatusCode().is2xxSuccessful()) {
if (response.hasBody()) {
final VnfPkgInfo[] vnfPackages = response.getBody();
assert (vnfPackages != null);
@@ -142,7 +145,7 @@ public class EtsiCatalogServiceProviderImpl implements EtsiCatalogServiceProvide
.getHttpResponse(etsiCatalogUrlProvider.getVnfPackageUrl(vnfPkgId), VnfPkgInfo.class);
logger.info("getVnfPackage Request for vnfPkgId {} to ETSI Catalog Manager Status Code: {}", vnfPkgId,
response.getStatusCodeValue());
- if (response.getStatusCode() == HttpStatus.OK) {
+ if (response.getStatusCode().is2xxSuccessful()) {
if (response.hasBody()) {
final VnfPkgInfo vnfPkgInfo = response.getBody();
if (conversionService.canConvert(vnfPkgInfo.getClass(), InlineResponse2001.class)) {
@@ -180,7 +183,7 @@ public class EtsiCatalogServiceProviderImpl implements EtsiCatalogServiceProvide
final ResponseEntity<PkgmSubscription> responseEntity =
httpServiceProvider.postHttpRequest(etsiCatalogManagerSubscriptionRequest,
etsiCatalogUrlProvider.getSubscriptionUrl(), PkgmSubscription.class);
- if (responseEntity.getStatusCode() == HttpStatus.OK) {
+ if (responseEntity.getStatusCode().is2xxSuccessful()) {
if (responseEntity.hasBody()) {
return Optional.of(responseEntity.getBody());
}
@@ -190,7 +193,8 @@ public class EtsiCatalogServiceProviderImpl implements EtsiCatalogServiceProvide
return Optional.empty();
} catch (final InvalidRestRequestException invalidRestRequestException) {
logger.error("Caught InvalidRestRequestException", invalidRestRequestException);
- throw new EtsiCatalogManagerBadRequestException("Bad Request Received on postSubscription call.");
+ throw new EtsiCatalogManagerBadRequestException(
+ "Bad Request Received on postSubscription call to ETSI Catalog Manager.");
} catch (final RestProcessingException restProcessingException) {
logger.error("Caught RestProcessingException with Status Code: {}", restProcessingException.getStatusCode(),
restProcessingException);
@@ -200,6 +204,28 @@ public class EtsiCatalogServiceProviderImpl implements EtsiCatalogServiceProvide
}
}
+ public Boolean deleteSubscription(final String subscriptionId) {
+ try {
+ final ResponseEntity<Void> responseEntity = httpServiceProvider
+ .deleteHttpRequest(etsiCatalogUrlProvider.getSubscriptionUrl() + "/" + subscriptionId, Void.class);
+
+ if (responseEntity.getStatusCode().is2xxSuccessful()) {
+ logger.info("Subscription with ID: {} has been successfully deleted from the ETSI Catalog Manager",
+ subscriptionId);
+ return true;
+ }
+ logger.error("Unexpected Status Code Received on deleteSubscription: {}", responseEntity.getStatusCode());
+ return false;
+ } catch (final InvalidRestRequestException invalidRestRequestException) {
+ logger.error("Caught InvalidRestRequestException on deleteSubscription call to ETSI Catalog Manager.",
+ invalidRestRequestException);
+ throw new EtsiCatalogManagerBadRequestException(
+ "Bad Request Received on deleteSubscription call to ETSI Catalog Manager.");
+ }
+ }
+
+
+
private Optional<byte[]> requestVnfElement(final String vnfPkgId, final String vnfRequestUrl,
final String vnfRequestName) {
try {
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/SubscriptionManager.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/SubscriptionManager.java
index 30a16f70a8..efe747deae 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/SubscriptionManager.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/SubscriptionManager.java
@@ -31,7 +31,6 @@ import java.util.Objects;
import java.util.Optional;
import org.onap.so.adapters.vnfmadapter.Constants;
import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.EtsiCatalogServiceProvider;
-import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.EtsiCatalogUrlProvider;
import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.BasicAuth;
import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.PkgmSubscription;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.InlineResponse2002;
@@ -41,7 +40,6 @@ import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.
import org.onap.so.adapters.vnfmadapter.packagemanagement.subscriptionmanagement.cache.PackageManagementCacheServiceProvider;
import org.onap.so.adapters.vnfmadapter.rest.exceptions.InternalServerErrorException;
import org.onap.so.adapters.vnfmadapter.rest.exceptions.SubscriptionRequestConversionException;
-import org.onap.so.rest.service.HttpRestServiceProvider;
import org.onap.so.utils.CryptoUtils;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
@@ -55,15 +53,12 @@ import org.springframework.stereotype.Service;
*
* @author Ronan Kenny (ronan.kenny@est.tech)
* @author Gareth Roper (gareth.roper@est.tech)
- *
*/
@Service
public class SubscriptionManager {
private static final Logger logger = getLogger(SubscriptionManager.class);
private final PackageManagementCacheServiceProvider packageManagementCacheServiceProvider;
- private final EtsiCatalogUrlProvider etsiCatalogUrlProvider;
- private final HttpRestServiceProvider httpServiceProvider;
private final ConversionService conversionService;
private final EtsiCatalogServiceProvider etsiCatalogServiceProvider;
private final String vnfmAdapterEndpoint;
@@ -73,16 +68,12 @@ public class SubscriptionManager {
@Autowired
public SubscriptionManager(final PackageManagementCacheServiceProvider packageManagementCacheServiceProvider,
- final ConversionService conversionService, final HttpRestServiceProvider httpServiceProvider,
- final EtsiCatalogUrlProvider etsiCatalogUrlProvider,
- final EtsiCatalogServiceProvider etsiCatalogServiceProvider,
+ final ConversionService conversionService, final EtsiCatalogServiceProvider etsiCatalogServiceProvider,
@Value("${vnfmadapter.endpoint}") final String vnfmAdapterEndpoint,
@Value("${mso.key}") final String msoKeyString,
- @Value("${vnfmadapter.auth:D6CFE56451508B75536C5E8A1E7AE06D0346006A693BF29293A6E1C762EFD59C671911DB6E9294E4FE15E4C1C5524B}") final String vnfmAdapterAuth) {
+ @Value("${vnfmadapter.auth:BF29BA36F0CFE1C05507781F6B97EFBCA7EFAC9F595954D465FC43F646883EF585C20A58CBB02528A6FAAC}") final String vnfmAdapterAuth) {
this.packageManagementCacheServiceProvider = packageManagementCacheServiceProvider;
- this.etsiCatalogUrlProvider = etsiCatalogUrlProvider;
this.conversionService = conversionService;
- this.httpServiceProvider = httpServiceProvider;
this.etsiCatalogServiceProvider = etsiCatalogServiceProvider;
this.vnfmAdapterEndpoint = vnfmAdapterEndpoint;
this.vnfmAdapterAuth = vnfmAdapterAuth;
@@ -101,8 +92,8 @@ public class SubscriptionManager {
if (optionalEtsiCatalogManagerSubscription.isPresent()) {
PkgmSubscription etsiCatalogManagerSubscription = optionalEtsiCatalogManagerSubscription.get();
logger.debug("postPkgmSubscriptionRequest Response SubscriptionId: {}",
- Objects.requireNonNull(etsiCatalogManagerSubscription.getId().toString()));
- final String subscriptionId = etsiCatalogManagerSubscription.getId().toString();
+ Objects.requireNonNull(etsiCatalogManagerSubscription.getId()));
+ final String subscriptionId = etsiCatalogManagerSubscription.getId();
packageManagementCacheServiceProvider.addSubscription(subscriptionId, pkgmSubscriptionRequest);
@@ -120,7 +111,6 @@ public class SubscriptionManager {
}
-
public Optional<String> getSubscriptionId(final PkgmSubscriptionRequest pkgmSubscriptionRequest) {
return packageManagementCacheServiceProvider.getSubscriptionId(pkgmSubscriptionRequest);
}
@@ -143,6 +133,15 @@ public class SubscriptionManager {
return response;
}
+ public boolean deleteSubscription(final String subscriptionId) {
+ if (getSubscription(subscriptionId).isPresent()) {
+ if (etsiCatalogServiceProvider.deleteSubscription(subscriptionId)) {
+ return packageManagementCacheServiceProvider.deleteSubscription(subscriptionId);
+ }
+ }
+ return false;
+ }
+
public URI getSubscriptionUri(final String subscriptionId) {
return URI.create(
vnfmAdapterEndpoint + Constants.PACKAGE_MANAGEMENT_BASE_URL + "/subscriptions/" + subscriptionId);
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/cache/PackageManagementCacheServiceProvider.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/cache/PackageManagementCacheServiceProvider.java
index 6042513a50..437d20e593 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/cache/PackageManagementCacheServiceProvider.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/packagemanagement/subscriptionmanagement/cache/PackageManagementCacheServiceProvider.java
@@ -60,7 +60,7 @@ public interface PackageManagementCacheServiceProvider {
* Delete subscription from cache
*
* @param subscriptionId
- * @return true if subscription exists and able to be removed, otherwise returns false
+ * @return Boolean
*/
boolean deleteSubscription(final String subscriptionId);
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/EtsiSubscriptionNotificationController.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/EtsiSubscriptionNotificationController.java
index c5bd5bc14e..b4004b083d 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/EtsiSubscriptionNotificationController.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/EtsiSubscriptionNotificationController.java
@@ -36,9 +36,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
* @author Gareth Roper (gareth.roper@est.tech)
*/
@Controller
-@RequestMapping(value = ETSI_SUBSCRIPTION_NOTIFICATION_CONTROLLER_BASE_URL,
- produces = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML},
- consumes = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
+@RequestMapping(value = ETSI_SUBSCRIPTION_NOTIFICATION_CONTROLLER_BASE_URL)
public class EtsiSubscriptionNotificationController {
private static final Logger logger = getLogger(EtsiSubscriptionNotificationController.class);
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementSubscriptionController.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementSubscriptionController.java
index cbad564210..6db3797f9b 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementSubscriptionController.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementSubscriptionController.java
@@ -23,14 +23,13 @@ package org.onap.so.adapters.vnfmadapter.rest;
import static org.onap.so.adapters.vnfmadapter.Constants.PACKAGE_MANAGEMENT_BASE_URL;
import static org.slf4j.LoggerFactory.getLogger;
import java.net.URI;
-import java.net.URISyntaxException;
import java.security.GeneralSecurityException;
import java.util.List;
import java.util.Optional;
import javax.ws.rs.core.MediaType;
+import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.ProblemDetails;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.InlineResponse2002;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.PkgmSubscriptionRequest;
-import org.onap.so.adapters.vnfmadapter.extclients.etsicatalog.model.ProblemDetails;
import org.onap.so.adapters.vnfmadapter.packagemanagement.subscriptionmanagement.SubscriptionManager;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
@@ -38,6 +37,7 @@ import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
@@ -79,7 +79,7 @@ public class Sol003PackageManagementSubscriptionController {
@PostMapping(value = "/subscriptions")
public ResponseEntity<?> postSubscriptionRequest(@RequestBody final PkgmSubscriptionRequest pkgmSubscriptionRequest)
throws GeneralSecurityException {
- logger.info(LOG_REQUEST_RECEIVED, " postSubscriptionRequest Endpoint Called");
+ logger.info(LOG_REQUEST_RECEIVED, " postSubscriptionRequest Endpoint Called", pkgmSubscriptionRequest);
// Check if subscription exists already.
final Optional<String> exists = subscriptionManager.getSubscriptionId(pkgmSubscriptionRequest);
@@ -140,6 +140,24 @@ public class Sol003PackageManagementSubscriptionController {
}
/**
+ * DELETE a specific subscription, by subscriptionId. Section Number: 10.4.8.3.5
+ *
+ * @param subscriptionId The ID of the subscription that you wish to delete.
+ * @return Empty response if successful. Object: Void Response Code: 204 No Content
+ */
+ @DeleteMapping(value = "/subscriptions/{subscriptionId}")
+ public ResponseEntity<?> deleteSubscription(@PathVariable("subscriptionId") final String subscriptionId) {
+ if (subscriptionManager.deleteSubscription(subscriptionId)) {
+ logger.debug("Successfully deleted subscription with id {}", subscriptionId);
+ return ResponseEntity.noContent().build();
+ }
+ final String errorMessage =
+ "The requested subscription: " + subscriptionId + " was not found on call deleteSubscription";
+ logger.error(errorMessage);
+ return ResponseEntity.status(HttpStatus.NOT_FOUND).body(new ProblemDetails().detail(errorMessage));
+ }
+
+ /**
* Method to set the Location in the header with the URI parameter
*
* @param subscriptionUri
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementSubscriptionControllerTest.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementSubscriptionControllerTest.java
index f90978e0d5..c776e55ff0 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementSubscriptionControllerTest.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003PackageManagementSubscriptionControllerTest.java
@@ -20,21 +20,25 @@
package org.onap.so.adapters.vnfmadapter.rest;
+import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertThat;
import static org.onap.so.adapters.vnfmadapter.Constants.PACKAGE_MANAGEMENT_BASE_URL;
import static org.onap.so.client.RestTemplateConfig.CONFIGURABLE_REST_TEMPLATE;
+import static org.springframework.test.web.client.match.MockRestRequestMatchers.method;
import static org.springframework.test.web.client.match.MockRestRequestMatchers.requestTo;
-import java.security.GeneralSecurityException;
+import static org.springframework.test.web.client.response.MockRestResponseCreators.withStatus;
+import static org.springframework.test.web.client.response.MockRestResponseCreators.withSuccess;
+import com.google.gson.Gson;
import java.net.URI;
import java.net.URISyntaxException;
+import java.security.GeneralSecurityException;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.UUID;
-import com.google.gson.Gson;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -51,13 +55,13 @@ import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.SubscriptionsFilterVnfProductsFromProviders;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.SubscriptionsLinks;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.packagemanagement.model.VnfPackagesLinksSelf;
-import org.onap.so.utils.CryptoUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.cache.Cache;
import org.springframework.cache.CacheManager;
import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
@@ -65,35 +69,24 @@ import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.client.MockRestServiceServer;
import org.springframework.web.client.RestTemplate;
-import org.springframework.http.HttpMethod;
-import static org.springframework.test.web.client.match.MockRestRequestMatchers.method;
-import static org.hamcrest.Matchers.is;
-import static org.springframework.test.web.client.response.MockRestResponseCreators.withSuccess;
/**
* @author Ronan Kenny (ronan.kenny@est.tech)
* @author Gareth Roper (gareth.roper@est.tech)
- *
*/
@RunWith(SpringRunner.class)
@SpringBootTest(classes = VnfmAdapterApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@ActiveProfiles("test")
-@SuppressWarnings("unchecked")
public class Sol003PackageManagementSubscriptionControllerTest {
- private static String subscriptionId;
private final Gson gson = new Gson();
-
+ private final URI msbEndpoint = URI.create("http://msb-iag.onap:80/api/vnfpkgm/v1/subscriptions");
@Autowired
@Qualifier(CONFIGURABLE_REST_TEMPLATE)
private RestTemplate testRestTemplate;
-
private MockRestServiceServer mockRestServer;
-
@Autowired
private CacheManager cacheServiceProvider;
- private final URI msbEndpoint = URI.create("http://msb-iag.onap:80/api/vnfpkgm/v1/subscriptions");
-
@Autowired
private Sol003PackageManagementSubscriptionController sol003PackageManagementSubscriptionController;
@@ -134,7 +127,6 @@ public class Sol003PackageManagementSubscriptionControllerTest {
final ResponseEntity<InlineResponse2002> response =
(ResponseEntity<InlineResponse2002>) sol003PackageManagementSubscriptionController
.postSubscriptionRequest(pkgmSubscriptionRequest);
- subscriptionId = Objects.requireNonNull(response.getBody()).getId();
// Create duplicate entry
final PkgmSubscriptionRequest pkgmSubscriptionRequest2 = buildPkgmSubscriptionRequest();
@@ -153,7 +145,7 @@ public class Sol003PackageManagementSubscriptionControllerTest {
final ResponseEntity<InlineResponse2002> response =
(ResponseEntity<InlineResponse2002>) sol003PackageManagementSubscriptionController
.postSubscriptionRequest(pkgmSubscriptionRequest);
- subscriptionId = Objects.requireNonNull(response.getBody()).getId();
+ final String subscriptionId = response.getBody().getId();
final ResponseEntity<InlineResponse2002> response2002 =
(ResponseEntity<InlineResponse2002>) sol003PackageManagementSubscriptionController
@@ -161,9 +153,8 @@ public class Sol003PackageManagementSubscriptionControllerTest {
final HttpHeaders headers = buildHttpHeaders(response.getBody().getCallbackUri());
-
assertEquals(response.getBody().getFilter(), pkgmSubscriptionRequest.getFilter());
- assert (response.getHeaders().equals(headers));
+ assertEquals(response.getHeaders(), headers);
assertEquals(HttpStatus.OK, response2002.getStatusCode());
assertEquals(pkgmSubscriptionRequest.getFilter(), response.getBody().getFilter());
// Ensure CallBackUri is set to new URI
@@ -199,6 +190,40 @@ public class Sol003PackageManagementSubscriptionControllerTest {
assertEquals(HttpStatus.OK, response.getStatusCode());
}
+ @Test
+ public void testSuccessDeleteSubscriptionWithSubscriptionId() throws GeneralSecurityException {
+ final PkgmSubscriptionRequest pkgmSubscriptionRequest = buildPkgmSubscriptionRequest();
+ final PkgmSubscription pkgmSubscription = buildPkgmSubscription();
+ final String subscriptionId = pkgmSubscription.getId();
+
+ mockRestServer.expect(requestTo(msbEndpoint)).andExpect(method(HttpMethod.POST))
+ .andRespond(withSuccess(gson.toJson(pkgmSubscription), MediaType.APPLICATION_JSON));
+ mockRestServer.expect(requestTo(msbEndpoint + "/" + subscriptionId)).andExpect(method(HttpMethod.DELETE))
+ .andRespond(withStatus(HttpStatus.NO_CONTENT));
+
+ final ResponseEntity<InlineResponse2002> responsePost =
+ (ResponseEntity<InlineResponse2002>) sol003PackageManagementSubscriptionController
+ .postSubscriptionRequest(pkgmSubscriptionRequest);
+
+ final ResponseEntity responseDelete =
+ sol003PackageManagementSubscriptionController.deleteSubscription(subscriptionId);
+
+ // Attempt to retrieve the subscription after delete
+ final ResponseEntity<InlineResponse2002> responseGetSubscription =
+ (ResponseEntity<InlineResponse2002>) sol003PackageManagementSubscriptionController
+ .getSubscription(subscriptionId);
+
+ assertEquals(HttpStatus.NOT_FOUND, responseGetSubscription.getStatusCode());
+ assertEquals(HttpStatus.NO_CONTENT, responseDelete.getStatusCode());
+ }
+
+ @Test
+ public void testFailDeleteSubscriptionWithInvalidSubscriptionId() throws URISyntaxException, InterruptedException {
+ final ResponseEntity<Void> responseDelete = (ResponseEntity<Void>) sol003PackageManagementSubscriptionController
+ .deleteSubscription("invalidSubscriptionId");
+ assertEquals(HttpStatus.NOT_FOUND, responseDelete.getStatusCode());
+ }
+
private PkgmSubscriptionRequest buildPkgmSubscriptionRequest() {
final PkgmSubscriptionRequest pkgmSubscriptionRequest = new PkgmSubscriptionRequest();
final SubscriptionsFilter sub = buildSubscriptionsFilter();
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ControllerExecutionBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ControllerExecutionBB.bpmn
new file mode 100644
index 0000000000..32d3bce469
--- /dev/null
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ControllerExecutionBB.bpmn
@@ -0,0 +1,241 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1ahlzqg" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.14.0">
+ <bpmn:process id="ControllerExecution" name="ControllerExecutionBB" isExecutable="true">
+ <bpmn:startEvent id="StartEvent_1">
+ <bpmn:outgoing>SequenceFlow_0gmfit3</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_0gmfit3" sourceRef="StartEvent_1" targetRef="ServiceTask_0inxg9l" />
+ <bpmn:endEvent id="EndEvent_0lgvk82">
+ <bpmn:incoming>SequenceFlow_1mkhog2</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_0no1qag</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_1mkhog2" sourceRef="Task_1hs1mn0" targetRef="EndEvent_0lgvk82" />
+ <bpmn:callActivity id="CallActivity_1gfzi2g" name="Abstract CDS&#10;(CDS Call)&#10;" calledElement="AbstractCDSProcessingBB">
+ <bpmn:extensionElements>
+ <camunda:out source="WorkflowException" target="WorkflowException" />
+ <camunda:out source="CDSStatus" target="CDSStatus" />
+ <camunda:in source="executionObject" target="executionObject" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_05qembo</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0cvsnuu</bpmn:outgoing>
+ </bpmn:callActivity>
+ <bpmn:serviceTask id="Task_1hs1mn0" name="Update AAI" camunda:expression="${AAIUpdateTasks.updateOrchestrationStatus(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)),InjectExecution.execute(execution, execution.getVariable(&#34;scope&#34;)),InjectExecution.execute(execution, execution.getVariable(&#34;action&#34;)))}">
+ <bpmn:incoming>SequenceFlow_07tqu82</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1mkhog2</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_05qembo" sourceRef="Task_0bhf6tp" targetRef="CallActivity_1gfzi2g" />
+ <bpmn:serviceTask id="Task_0bhf6tp" name="PreProcess Abstract CDS Processing" camunda:expression="${GenericCDSProcessing.buildPayloadBasedOnScopeAndAction(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:incoming>SequenceFlow_0vzx2yr</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_05qembo</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:exclusiveGateway id="ExclusiveGateway_13q340y" default="SequenceFlow_15gxql1">
+ <bpmn:incoming>SequenceFlow_0cvsnuu</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_07tqu82</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_15gxql1</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:sequenceFlow id="SequenceFlow_0cvsnuu" sourceRef="CallActivity_1gfzi2g" targetRef="ExclusiveGateway_13q340y" />
+ <bpmn:sequenceFlow id="SequenceFlow_07tqu82" name="success" sourceRef="ExclusiveGateway_13q340y" targetRef="Task_1hs1mn0">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("CDSStatus").equals("Success")}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:endEvent id="EndEvent_0mnaj50">
+ <bpmn:incoming>SequenceFlow_15gxql1</bpmn:incoming>
+ <bpmn:errorEventDefinition id="ErrorEventDefinition_1s1hqgm" errorRef="Error_0aovtfv" />
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_15gxql1" sourceRef="ExclusiveGateway_13q340y" targetRef="EndEvent_0mnaj50" />
+ <bpmn:serviceTask id="ServiceTask_0inxg9l" name="Set Actor, Scope and Action Params" camunda:expression="${ControllerExecution.setControllerActorScopeAction(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:incoming>SequenceFlow_0gmfit3</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_05j6hg6</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_1lspfyy</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_05j6hg6" sourceRef="ServiceTask_0inxg9l" targetRef="ExclusiveGateway_0plxwkg" />
+ <bpmn:exclusiveGateway id="ExclusiveGateway_0plxwkg" default="SequenceFlow_1t7hs4k">
+ <bpmn:incoming>SequenceFlow_1lspfyy</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_05j6hg6</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1t7hs4k</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_0vzx2yr</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:sequenceFlow id="SequenceFlow_1lspfyy" sourceRef="ServiceTask_0inxg9l" targetRef="ExclusiveGateway_0plxwkg" />
+ <bpmn:callActivity id="BBToExecute" name="BB to Execute&#10;" calledElement="${bbName}">
+ <bpmn:extensionElements>
+ <camunda:out source="WorkflowException" target="WorkflowException" />
+ <camunda:out source="WorkflowExceptionErrorMessage" target="WorkflowExceptionErrorMessage" />
+ <camunda:in source="executionObject" target="executionObject" />
+ <camunda:in source="mso-request-id" target="mso-request-id" />
+ <camunda:in source="isRollback" target="isRollback" />
+ <camunda:out source="StatusMessage" target="StatusMessage" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_0fv03vt</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0no1qag</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_0op5irz</bpmn:outgoing>
+ </bpmn:callActivity>
+ <bpmn:sequenceFlow id="SequenceFlow_1t7hs4k" sourceRef="ExclusiveGateway_0plxwkg" targetRef="Task_1rc2j9" />
+ <bpmn:sequenceFlow id="SequenceFlow_0no1qag" sourceRef="BBToExecute" targetRef="EndEvent_0lgvk82" />
+ <bpmn:sequenceFlow id="SequenceFlow_0fv03vt" sourceRef="Task_1rc2j9" targetRef="BBToExecute" />
+ <bpmn:serviceTask id="Task_1rc2j9" name="select BB " camunda:expression="${ControllerExecution.selectBB(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:incoming>SequenceFlow_1t7hs4k</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0fv03vt</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:endEvent id="EndEvent_1lxwuh2">
+ <bpmn:incoming>SequenceFlow_0op5irz</bpmn:incoming>
+ <bpmn:errorEventDefinition id="ErrorEventDefinition_0z001cu" errorRef="Error_0aovtfv" />
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_0op5irz" sourceRef="BBToExecute" targetRef="EndEvent_1lxwuh2" />
+ <bpmn:sequenceFlow id="SequenceFlow_0vzx2yr" name="Actor= CDS" sourceRef="ExclusiveGateway_0plxwkg" targetRef="Task_0bhf6tp">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("controller_actor") == "CDS"}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ </bpmn:process>
+ <bpmn:error id="Error_0aovtfv" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="ControllerExecution">
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
+ <dc:Bounds x="160" y="323" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="-17" y="279" width="90" height="20" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0gmfit3_di" bpmnElement="SequenceFlow_0gmfit3">
+ <di:waypoint x="196" y="341" />
+ <di:waypoint x="259" y="341" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="32.5" y="236" width="90" height="20" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="EndEvent_0lgvk82_di" bpmnElement="EndEvent_0lgvk82">
+ <dc:Bounds x="1129" y="323" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1025" y="251" width="90" height="20" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1mkhog2_di" bpmnElement="SequenceFlow_1mkhog2">
+ <di:waypoint x="1079" y="462" />
+ <di:waypoint x="1147" y="462" />
+ <di:waypoint x="1147" y="359" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="918" y="357" width="90" height="20" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="CallActivity_1gfzi2g_di" bpmnElement="CallActivity_1gfzi2g">
+ <dc:Bounds x="725" y="422" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_0404s6a_di" bpmnElement="Task_1hs1mn0">
+ <dc:Bounds x="979" y="422" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_05qembo_di" bpmnElement="SequenceFlow_05qembo">
+ <di:waypoint x="672" y="462" />
+ <di:waypoint x="725" y="462" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="503.5" y="357" width="90" height="20" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_01mv1si_di" bpmnElement="Task_0bhf6tp">
+ <dc:Bounds x="572" y="422" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ExclusiveGateway_13q340y_di" bpmnElement="ExclusiveGateway_13q340y" isMarkerVisible="true">
+ <dc:Bounds x="868" y="437" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="698" y="327" width="90" height="20" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0cvsnuu_di" bpmnElement="SequenceFlow_0cvsnuu">
+ <di:waypoint x="825" y="462" />
+ <di:waypoint x="868" y="462" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="651.5" y="357" width="90" height="20" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_07tqu82_di" bpmnElement="SequenceFlow_07tqu82">
+ <di:waypoint x="918" y="462" />
+ <di:waypoint x="979" y="462" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="856" y="409" width="41" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="EndEvent_0mnaj50_di" bpmnElement="EndEvent_0mnaj50">
+ <dc:Bounds x="875" y="565" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="698" y="531" width="90" height="20" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_15gxql1_di" bpmnElement="SequenceFlow_15gxql1">
+ <di:waypoint x="893" y="487" />
+ <di:waypoint x="893" y="565" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="713" y="436" width="90" height="20" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_0inxg9l_di" bpmnElement="ServiceTask_0inxg9l">
+ <dc:Bounds x="259" y="301" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_05j6hg6_di" bpmnElement="SequenceFlow_05j6hg6">
+ <di:waypoint x="359" y="341" />
+ <di:waypoint x="399" y="341" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="184" y="240" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ExclusiveGateway_0plxwkg_di" bpmnElement="ExclusiveGateway_0plxwkg" isMarkerVisible="true">
+ <dc:Bounds x="399" y="316" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="309" y="255" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1lspfyy_di" bpmnElement="SequenceFlow_1lspfyy">
+ <di:waypoint x="359" y="341" />
+ <di:waypoint x="399" y="341" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="229" y="240" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="CallActivity_01dem38_di" bpmnElement="BBToExecute">
+ <dc:Bounds x="824" y="168" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1t7hs4k_di" bpmnElement="SequenceFlow_1t7hs4k">
+ <di:waypoint x="424" y="316" />
+ <di:waypoint x="424" y="208" />
+ <di:waypoint x="572" y="208" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="271" y="89" width="83" height="36" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0no1qag_di" bpmnElement="SequenceFlow_0no1qag">
+ <di:waypoint x="924" y="208" />
+ <di:waypoint x="1147" y="208" />
+ <di:waypoint x="1147" y="323" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="840.5" y="107" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0fv03vt_di" bpmnElement="SequenceFlow_0fv03vt">
+ <di:waypoint x="672" y="208" />
+ <di:waypoint x="824" y="208" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="598" y="107" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_0qd9p4w_di" bpmnElement="Task_1rc2j9">
+ <dc:Bounds x="572" y="168" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_1lxwuh2_di" bpmnElement="EndEvent_1lxwuh2">
+ <dc:Bounds x="856" y="84" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="679" y="50" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0op5irz_di" bpmnElement="SequenceFlow_0op5irz">
+ <di:waypoint x="874" y="168" />
+ <di:waypoint x="874" y="120" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="739" y="58" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0vzx2yr_di" bpmnElement="SequenceFlow_0vzx2yr">
+ <di:waypoint x="424" y="366" />
+ <di:waypoint x="424" y="462" />
+ <di:waypoint x="572" y="462" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="455" y="436" width="60" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions> \ No newline at end of file
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/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAIDeleteServiceInstance.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAIDeleteServiceInstance.java
index fb95ae3993..11707c4149 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAIDeleteServiceInstance.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAIDeleteServiceInstance.java
@@ -7,9 +7,9 @@
* 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.
@@ -27,9 +27,15 @@ 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.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class AAIDeleteServiceInstance implements JavaDelegate {
+ private static final Logger logger = LoggerFactory.getLogger(AAIDeleteServiceInstance.class);
+ private static final String ERROR_MESSAGE =
+ "Exception in Delete Serivce Instance. Service Instance could not be deleted in AAI.";
+
ExceptionUtil exceptionUtil = new ExceptionUtil();
public void execute(DelegateExecution execution) throws Exception {
@@ -41,8 +47,8 @@ public class AAIDeleteServiceInstance implements JavaDelegate {
aaiRC.delete(serviceInstanceURI);
execution.setVariable("GENDS_SuccessIndicator", true);
} catch (Exception ex) {
- String msg = "Exception in Delete Serivce Instance. Service Instance could not be deleted in AAI."
- + ex.getMessage();
+ logger.debug(ERROR_MESSAGE, ex);
+ String msg = ERROR_MESSAGE + ex.getMessage();
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg);
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAIServiceInstance.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAIServiceInstance.java
index 2d69351744..f7b0c662db 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAIServiceInstance.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAIServiceInstance.java
@@ -7,9 +7,9 @@
* 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,17 +30,70 @@ public class AAIServiceInstance {
String environmentContext;
String workloadContext;
- public AAIServiceInstance(String serviceInstanceName, String serviceType, String serviceRole,
- String orchestrationStatus, String modelInvariantUuid, String modelVersionId, String environmentContext,
- String workloadContext) {
- this.serviceInstanceName = serviceInstanceName;
- this.serviceType = serviceType;
- this.serviceRole = serviceRole;
- this.orchestrationStatus = orchestrationStatus;
- this.modelInvariantUuid = modelInvariantUuid;
- this.modelVersionId = modelVersionId;
- this.environmentContext = environmentContext;
- this.workloadContext = workloadContext;
+ public class AAIServiceInstanceBuilder {
+ private String serviceInstanceName;
+ private String serviceType;
+ private String serviceRole;
+ private String orchestrationStatus;
+ private String modelInvariantUuid;
+ private String modelVersionId;
+ private String environmentContext;
+ private String workloadContext;
+
+ public AAIServiceInstanceBuilder setServiceInstanceName(String serviceInstanceName) {
+ this.serviceInstanceName = serviceInstanceName;
+ return this;
+ }
+
+ public AAIServiceInstanceBuilder setServiceType(String serviceType) {
+ this.serviceType = serviceType;
+ return this;
+ }
+
+ public AAIServiceInstanceBuilder setServiceRole(String serviceRole) {
+ this.serviceRole = serviceRole;
+ return this;
+ }
+
+ public AAIServiceInstanceBuilder setOrchestrationStatus(String orchestrationStatus) {
+ this.orchestrationStatus = orchestrationStatus;
+ return this;
+ }
+
+ public AAIServiceInstanceBuilder setModelInvariantUuid(String modelInvariantUuid) {
+ this.modelInvariantUuid = modelInvariantUuid;
+ return this;
+ }
+
+ public AAIServiceInstanceBuilder setModelVersionId(String modelVersionId) {
+ this.modelVersionId = modelVersionId;
+ return this;
+ }
+
+ public AAIServiceInstanceBuilder setEnvironmentContext(String environmentContext) {
+ this.environmentContext = environmentContext;
+ return this;
+ }
+
+ public AAIServiceInstanceBuilder setWorkloadContext(String workloadContext) {
+ this.workloadContext = workloadContext;
+ return this;
+ }
+
+ public AAIServiceInstance createAAIServiceInstance() {
+ return new AAIServiceInstance(this);
+ }
+ }
+
+ public AAIServiceInstance(AAIServiceInstanceBuilder aaiServiceInstanceBuilder) {
+ this.serviceInstanceName = aaiServiceInstanceBuilder.serviceInstanceName;
+ this.serviceType = aaiServiceInstanceBuilder.serviceType;
+ this.serviceRole = aaiServiceInstanceBuilder.serviceRole;
+ this.orchestrationStatus = aaiServiceInstanceBuilder.orchestrationStatus;
+ this.modelInvariantUuid = aaiServiceInstanceBuilder.modelInvariantUuid;
+ this.modelVersionId = aaiServiceInstanceBuilder.modelVersionId;
+ this.environmentContext = aaiServiceInstanceBuilder.environmentContext;
+ this.workloadContext = aaiServiceInstanceBuilder.workloadContext;
}
public String getServiceInstanceName() {
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java
index 533dd89276..4522f7f2e7 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java
@@ -24,6 +24,7 @@
package org.onap.so.bpmn.infrastructure.activity;
+import java.io.IOException;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
@@ -89,8 +90,8 @@ public class ExecuteActivity implements JavaDelegate {
@Override
public void execute(DelegateExecution execution) throws Exception {
final String requestId = (String) execution.getVariable(G_REQUEST_ID);
- WorkflowException workflowException = null;
- String handlingCode = null;
+ WorkflowException workflowException;
+ String handlingCode;
try {
Boolean workflowSyncAckSent = (Boolean) execution.getVariable(WORKFLOW_SYNC_ACK_SENT);
if (workflowSyncAckSent == null || workflowSyncAckSent == false) {
@@ -114,7 +115,7 @@ public class ExecuteActivity implements JavaDelegate {
if (execution.getVariables() != null) {
execution.getVariables().forEach((key, value) -> {
if (value instanceof Serializable) {
- variables.put(key, (Serializable) value);
+ variables.put(key, value);
}
});
}
@@ -153,25 +154,22 @@ public class ExecuteActivity implements JavaDelegate {
}
protected BuildingBlock buildBuildingBlock(String activityName) {
- BuildingBlock buildingBlock = new BuildingBlock().setBpmnFlowName(activityName)
- .setMsoId(UUID.randomUUID().toString()).setKey("").setIsVirtualLink(false).setVirtualLinkKey("");
- return buildingBlock;
+ return new BuildingBlock().setBpmnFlowName(activityName).setMsoId(UUID.randomUUID().toString()).setKey("")
+ .setIsVirtualLink(false).setVirtualLinkKey("");
}
protected ExecuteBuildingBlock buildExecuteBuildingBlock(DelegateExecution execution, String requestId,
- BuildingBlock buildingBlock) throws Exception {
+ BuildingBlock buildingBlock) throws IOException {
WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
workflowResourceIds.setServiceInstanceId((String) execution.getVariable(SERVICE_INSTANCE_ID));
workflowResourceIds.setVnfId((String) execution.getVariable(VNF_ID));
String bpmnRequest = (String) execution.getVariable(G_BPMN_REQUEST);
ServiceInstancesRequest sIRequest = mapper.readValue(bpmnRequest, ServiceInstancesRequest.class);
RequestDetails requestDetails = sIRequest.getRequestDetails();
- ExecuteBuildingBlock executeBuildingBlock = new ExecuteBuildingBlock().setaLaCarte(true)
- .setRequestAction((String) execution.getVariable(G_ACTION))
+ return new ExecuteBuildingBlock().setaLaCarte(true).setRequestAction((String) execution.getVariable(G_ACTION))
.setResourceId((String) execution.getVariable(VNF_ID))
.setVnfType((String) execution.getVariable(VNF_TYPE)).setWorkflowResourceIds(workflowResourceIds)
.setRequestId(requestId).setBuildingBlock(buildingBlock).setRequestDetails(requestDetails);
- return executeBuildingBlock;
}
protected void buildAndThrowException(DelegateExecution execution, String msg, Exception ex) {
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetwork.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetwork.java
index 164480d7c7..ff0f9e76a3 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetwork.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetwork.java
@@ -6,6 +6,8 @@
* ================================================================================
* 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
@@ -46,17 +48,16 @@ public class AssignNetwork {
* @return
*/
public boolean networkFoundByName(BuildingBlockExecution execution) {
- boolean networkFound = false;
try {
L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
if (!OrchestrationStatus.PRECREATED.equals(l3network.getOrchestrationStatus())) {
- networkFound = true;
logger.debug("network found in NOT PRECREATED status");
+ return true;
}
} catch (Exception ex) {
- // return false if no network present
+ return false;
}
- return networkFound;
+ return false;
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ControllerExecution.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ControllerExecution.java
new file mode 100644
index 0000000000..86d56005f6
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ControllerExecution.java
@@ -0,0 +1,109 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 Tech Mahindra
+ * ================================================================================
+ * 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.bpmn.infrastructure.flowspecific.tasks;
+
+import java.util.Optional;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.db.catalog.beans.BBNameSelectionReference;
+import org.onap.so.db.catalog.beans.VnfResourceCustomization;
+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 ControllerExecution {
+ private static final Logger logger = LoggerFactory.getLogger(ControllerExecution.class);
+ private static final String CONTROLLER_ACTOR = "controllerActor";
+ private static final String BUILDING_BLOCK = "buildingBlock";
+ private static final String SCOPE = "scope";
+ private static final String ACTION = "action";
+ private static final String BBNAME = "bbName";
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+ @Autowired
+ private CatalogDbClient catalogDbClient;
+ @Autowired
+ private ExtractPojosForBB extractPojosForBB;
+
+ /**
+ * Setting Controller Actor, Scope and Action Variables in BuildingBlockExecution object
+ *
+ * @param execution - BuildingBlockExecution object
+ */
+ public void setControllerActorScopeAction(BuildingBlockExecution execution) {
+ try {
+ GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ String modleUuid = genericVnf.getModelInfoGenericVnf().getModelCustomizationUuid();
+ VnfResourceCustomization vnfResourceCustomization =
+ catalogDbClient.getVnfResourceCustomizationByModelCustomizationUUID(modleUuid);
+
+ // Fetching Controller Actor at VNF level if null then Controller Actor is set as "APPC"
+ String controllerActor = Optional.ofNullable(vnfResourceCustomization.getControllerActor()).orElse("APPC");
+ ExecuteBuildingBlock executeBuildingBlock = execution.getVariable(BUILDING_BLOCK);
+ BuildingBlock buildingBlock = executeBuildingBlock.getBuildingBlock();
+ String scope = Optional.ofNullable(buildingBlock.getBpmnScope()).orElseThrow(
+ () -> new NullPointerException("BPMN Scope is NULL in the orchestration_flow_reference table "));
+ String action = Optional.ofNullable(buildingBlock.getBpmnAction()).orElseThrow(
+ () -> new NullPointerException("BPMN Action is NULL in the orchestration_flow_reference table "));
+ execution.setVariable(SCOPE, scope);
+ execution.setVariable(ACTION, action);
+ execution.setVariable(CONTROLLER_ACTOR, controllerActor);
+ logger.debug("Executing Controller Execution for ControllerActor: {}, Scope: {} , Action: {}",
+ controllerActor, scope, action);
+
+ } catch (Exception ex) {
+ logger.error("An exception occurred while fetching Controller Actor,Scope and Action ", ex);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ /**
+ * Selecting bbName from BBNameSelectionReference and setting the value in a variable of BuildingBlockExecution
+ *
+ * @param execution - BuildingBlockExecution object
+ */
+ public void selectBB(BuildingBlockExecution execution) {
+ try {
+
+ String controllerActor = execution.getVariable(CONTROLLER_ACTOR);
+ String action = Optional.of((String) execution.getVariable(ACTION)).get();
+ String scope = Optional.of((String) execution.getVariable(SCOPE)).get();
+ BBNameSelectionReference bbNameSelectionReference =
+ catalogDbClient.getBBNameSelectionReference(controllerActor, scope, action);
+ String bbName = bbNameSelectionReference.getBbName();
+ execution.setVariable(BBNAME, bbName);
+ logger.debug(" Executing {} BPMN", bbName);
+ } catch (Exception ex) {
+ logger.error("An exception occurred while getting bbname from catalogdb ", ex);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+
+ }
+
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollection.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollection.java
index 36eab8f981..5e925bf9c6 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollection.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollection.java
@@ -6,6 +6,8 @@
* ================================================================================
* 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
@@ -29,8 +31,6 @@ import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.client.orchestration.AAINetworkResources;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasks.java
index ea0b408e41..ccbce2de6a 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasks.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * 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
@@ -20,25 +22,16 @@
package org.onap.so.bpmn.infrastructure.namingservice.tasks;
-import java.util.List;
-import java.util.Optional;
-import org.onap.aai.domain.yang.Zone;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.common.InjectionHelper;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup;
import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding;
-import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils;
import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
-import org.onap.so.client.aai.AAIObjectType;
-import org.onap.so.client.aai.entities.AAIResultWrapper;
-import org.onap.so.client.aai.entities.Relationships;
-import org.onap.so.client.aai.entities.uri.AAIResourceUri;
-import org.onap.so.client.aai.entities.uri.AAIUriFactory;
+import org.onap.so.client.exception.BBObjectNotFoundException;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.client.namingservice.NamingRequestObject;
import org.onap.so.client.namingservice.NamingServiceConstants;
@@ -65,7 +58,7 @@ public class NamingServiceCreateTasks {
this.bbInputSetupUtils = bbInputSetupUtils;
}
- public void createInstanceGroupName(BuildingBlockExecution execution) throws Exception {
+ public void createInstanceGroupName(BuildingBlockExecution execution) throws BBObjectNotFoundException {
InstanceGroup instanceGroup = extractPojosForBB.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID);
String policyInstanceName = execution.getVariable("policyInstanceName");
String nfNamingCode = execution.getVariable("nfNamingCode");
@@ -79,7 +72,7 @@ public class NamingServiceCreateTasks {
instanceGroup.setInstanceGroupName(generatedInstanceGroupName);
}
- public void createWanTransportServiceName(BuildingBlockExecution execution) throws Exception {
+ public void createWanTransportServiceName(BuildingBlockExecution execution) throws BBObjectNotFoundException {
ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
NamingRequestObject namingRequestObject = new NamingRequestObject();
namingRequestObject.setExternalKeyValue(serviceInstance.getServiceInstanceId());
@@ -98,7 +91,7 @@ public class NamingServiceCreateTasks {
serviceInstance.setServiceInstanceName(generatedWanTransportServiceName);
}
- public void createVpnBondingServiceName(BuildingBlockExecution execution) throws Exception {
+ public void createVpnBondingServiceName(BuildingBlockExecution execution) throws BBObjectNotFoundException {
ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
L3Network network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
VpnBinding vpnBinding = extractPojosForBB.extractByKey(execution, ResourceKey.VPN_ID);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceDeleteTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceDeleteTasks.java
index 507e14e42a..8d14bd3e89 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceDeleteTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceDeleteTasks.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * 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
@@ -26,6 +28,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.exception.BBObjectNotFoundException;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.client.namingservice.NamingRequestObject;
import org.onap.so.client.orchestration.NamingServiceResources;
@@ -43,7 +46,7 @@ public class NamingServiceDeleteTasks {
@Autowired
private NamingServiceResources namingServiceResources;
- public void deleteInstanceGroupName(BuildingBlockExecution execution) throws Exception {
+ public void deleteInstanceGroupName(BuildingBlockExecution execution) throws BBObjectNotFoundException {
InstanceGroup instanceGroup = extractPojosForBB.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID);
try {
@@ -53,7 +56,7 @@ public class NamingServiceDeleteTasks {
}
}
- public void deleteServiceInstanceName(BuildingBlockExecution execution) throws Exception {
+ public void deleteServiceInstanceName(BuildingBlockExecution execution) throws BBObjectNotFoundException {
ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
NamingRequestObject namingRequestObject = new NamingRequestObject();
namingRequestObject.setExternalKeyValue(serviceInstance.getServiceInstanceId());
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java
index 192cb3fc90..89d62e0752 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java
@@ -6,6 +6,8 @@
* ================================================================================
* 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
@@ -64,7 +66,7 @@ public class SDNCQueryTasks {
* @param execution
* @throws Exception
*/
- public void queryVnf(BuildingBlockExecution execution) throws Exception {
+ public void queryVnf(BuildingBlockExecution execution) throws BBObjectNotFoundException {
ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
@@ -99,7 +101,7 @@ public class SDNCQueryTasks {
* @param execution
* @throws Exception
*/
- public void queryVfModule(BuildingBlockExecution execution) throws Exception {
+ public void queryVfModule(BuildingBlockExecution execution) throws BBObjectNotFoundException {
ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
index 80c6f0b969..2284c4af1a 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
@@ -431,7 +431,12 @@ public class WorkflowAction {
execution.setVariable("isRollbackComplete", false);
} catch (Exception ex) {
- buildAndThrowException(execution, "Exception while setting execution list. ", ex);
+ if (!(execution.hasVariable("WorkflowException")
+ || execution.hasVariable("WorkflowExceptionExceptionMessage"))) {
+ buildAndThrowException(execution, "Exception while setting execution list. ", ex);
+ } else {
+ throw ex;
+ }
}
}
@@ -537,7 +542,7 @@ public class WorkflowAction {
if (configurations.size() > 1) {
String multipleRelationshipsError =
"Multiple relationships exist from VNFC " + vnfc.getVnfcName() + " to Configurations";
- buildAndThrowException(dataObj.getExecution(), multipleRelationshipsError,
+ buildAndThrowException(dataObj.getExecution(), "Exception in getConfigBuildingBlock: ",
new Exception(multipleRelationshipsError));
}
for (org.onap.aai.domain.yang.Configuration configuration : configurations) {
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVolumeGroupResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVolumeGroupResources.java
index 2ec63182a0..35e08563d1 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVolumeGroupResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVolumeGroupResources.java
@@ -6,6 +6,8 @@
* ================================================================================
* 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
@@ -32,10 +34,9 @@ import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext
import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
import org.onap.so.client.adapter.vnf.VnfVolumeAdapterClientImpl;
import org.onap.so.client.adapter.vnf.mapper.VnfAdapterObjectMapper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
+import java.io.IOException;
@Component
public class VnfAdapterVolumeGroupResources {
@@ -48,13 +49,13 @@ public class VnfAdapterVolumeGroupResources {
public CreateVolumeGroupRequest createVolumeGroupRequest(RequestContext requestContext, CloudRegion cloudRegion,
OrchestrationContext orchestrationContext, ServiceInstance serviceInstance, GenericVnf genericVnf,
- VolumeGroup volumeGroup, String sdncVfModuleQueryResponse) throws Exception {
+ VolumeGroup volumeGroup, String sdncVfModuleQueryResponse) throws IOException {
return vnfAdapterObjectMapper.createVolumeGroupRequestMapper(requestContext, cloudRegion, orchestrationContext,
serviceInstance, genericVnf, volumeGroup, sdncVfModuleQueryResponse);
}
public DeleteVolumeGroupRequest deleteVolumeGroupRequest(RequestContext requestContext, CloudRegion cloudRegion,
- ServiceInstance serviceInstance, VolumeGroup volumeGroup) throws Exception {
+ ServiceInstance serviceInstance, VolumeGroup volumeGroup) throws IOException {
return vnfAdapterObjectMapper.deleteVolumeGroupRequestMapper(requestContext, cloudRegion, serviceInstance,
volumeGroup);
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ControllerExecutionTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ControllerExecutionTest.java
new file mode 100644
index 0000000000..72a987c395
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ControllerExecutionTest.java
@@ -0,0 +1,127 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 Tech Mahindra
+ * ================================================================================
+ * 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.bpmn.infrastructure.flowspecific.tasks;
+
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.when;
+import java.util.UUID;
+import org.camunda.bpm.engine.delegate.BpmnError;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.ArgumentMatchers;
+import org.mockito.InjectMocks;
+import org.onap.so.bpmn.BaseTaskTest;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.client.exception.BBObjectNotFoundException;
+import org.onap.so.db.catalog.beans.BBNameSelectionReference;
+import org.onap.so.db.catalog.beans.VnfResourceCustomization;
+
+
+public class ControllerExecutionTest extends BaseTaskTest {
+
+ @InjectMocks
+ private ControllerExecution controllerExecution = new ControllerExecution();
+
+ private static final String TEST_SCOPE = "vfModule";
+ private static final String TEST_BBNAME = "ConfigurationScaleOut";
+ private static final String TEST_ACTION = "configScaleOut";
+ private static final String TEST_CONTROLLER_ACTOR = "APPC";
+
+ private BuildingBlock buildingBlock = new BuildingBlock();
+ VnfResourceCustomization vnfResourceCustomization = new VnfResourceCustomization();
+ private ExecuteBuildingBlock executeBuildingBlock = new ExecuteBuildingBlock();
+ private GenericVnf genericVnf;
+ private ServiceInstance serviceInstance;
+ private RequestContext requestContext;
+ private String msoRequestId;
+
+
+ @Before
+ public void before() throws BBObjectNotFoundException {
+
+ genericVnf = setGenericVnf();
+ serviceInstance = setServiceInstance();
+ msoRequestId = UUID.randomUUID().toString();
+ requestContext = setRequestContext();
+ requestContext.setMsoRequestId(msoRequestId);
+ gBBInput.setRequestContext(requestContext);
+ buildingBlock.setBpmnAction(TEST_ACTION);
+ buildingBlock.setBpmnScope(TEST_SCOPE);
+ executeBuildingBlock.setBuildingBlock(buildingBlock);
+ execution.setVariable("buildingBlock", executeBuildingBlock);
+
+ doThrow(new BpmnError("BPMN Error")).when(exceptionUtil)
+ .buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
+
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID)))
+ .thenReturn(genericVnf);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID)))
+ .thenReturn(serviceInstance);
+
+
+ }
+
+ @Test
+ public void testSetControllerActorScopeAction() throws Exception {
+
+
+ doReturn(vnfResourceCustomization).when(catalogDbClient).getVnfResourceCustomizationByModelCustomizationUUID(
+ genericVnf.getModelInfoGenericVnf().getModelCustomizationUuid());
+ controllerExecution.setControllerActorScopeAction(execution);
+ assertEquals(TEST_SCOPE, execution.getVariable("scope"));
+ assertEquals(TEST_ACTION, execution.getVariable("action"));
+ assertEquals(TEST_CONTROLLER_ACTOR, execution.getVariable("controllerActor"));
+
+ }
+
+
+ @Test
+ public void testSelectBB() throws Exception {
+ // given
+ BBNameSelectionReference bbNameSelectionReference = new BBNameSelectionReference();
+ bbNameSelectionReference.setBbName(TEST_BBNAME);
+ bbNameSelectionReference.setAction(TEST_ACTION);
+ bbNameSelectionReference.setControllerActor(TEST_CONTROLLER_ACTOR);
+ bbNameSelectionReference.setScope(TEST_SCOPE);
+ doReturn(bbNameSelectionReference).when(catalogDbClient).getBBNameSelectionReference(TEST_CONTROLLER_ACTOR,
+ TEST_SCOPE, TEST_ACTION);
+ execution.setVariable("controllerActor", TEST_CONTROLLER_ACTOR);
+ execution.setVariable("scope", TEST_SCOPE);
+ execution.setVariable("action", TEST_ACTION);
+
+ // when
+ controllerExecution.selectBB(execution);
+ // verify
+ assertEquals(TEST_BBNAME, execution.getVariable("bbName"));
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
index 8e47c34cb0..4fdd97d95a 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
@@ -41,6 +41,7 @@ import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.ArgumentMatchers.isA;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.when;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
@@ -228,6 +229,77 @@ public class WorkflowActionTest extends BaseTaskTest {
}
@Test
+ public void selectExecutionListExceptionAlreadyBuiltTest() throws Exception {
+ DelegateExecution delegateExecution = new DelegateExecutionFake();
+ String gAction = "deleteInstance";
+ String resource = "VfModule";
+ delegateExecution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
+ delegateExecution.setVariable("requestAction", gAction);
+ String bpmnRequest =
+ new String(Files.readAllBytes(Paths.get("src/test/resources/__files/VfModuleCreateWithFabric.json")));
+ delegateExecution.setVariable("bpmnRequest", bpmnRequest);
+ delegateExecution.setVariable("aLaCarte", true);
+ delegateExecution.setVariable("apiVersion", "7");
+ delegateExecution.setVariable("requestUri",
+ "v7/serviceInstances/f647e3ef-6d2e-4cd3-bff4-8df4634208de/vnfs/b80b16a5-f80d-4ffa-91c8-bd47c7438a3d/vfModules");
+
+ NorthBoundRequest northBoundRequest = new NorthBoundRequest();
+ List<OrchestrationFlow> orchFlows = createFlowList("DeactivateVfModuleBB", "DeleteVfModuleBB",
+ "UnassignVfModuleBB", "DeactivateFabricConfigurationBB", "UnassignFabricConfigurationBB");
+ northBoundRequest.setOrchestrationFlowList(orchFlows);
+
+ when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction, resource,
+ true, "my-custom-cloud-owner")).thenReturn(northBoundRequest);
+
+ doAnswer(invocation -> {
+ DelegateExecutionFake execution = invocation.getArgument(0);
+ execution.setVariable("WorkflowException", "exception");
+ execution.setVariable("WorkflowExceptionErrorMessage", "errorMessage");
+ throw new BpmnError("WorkflowException");
+ }).when(exceptionUtil).buildAndThrowWorkflowException(delegateExecution, 7000,
+ "Exception in getConfigBuildingBlock: Multiple relationships exist from VNFC testVnfcName to Configurations");
+
+
+ org.onap.aai.domain.yang.GenericVnf vnf = new org.onap.aai.domain.yang.GenericVnf();
+ vnf.setVnfId("vnf0");
+ vnf.setModelCustomizationId("modelCustomizationId");
+ when(bbSetupUtils.getAAIGenericVnf(any())).thenReturn(vnf);
+
+ org.onap.aai.domain.yang.VfModule vfModule = new org.onap.aai.domain.yang.VfModule();
+ vfModule.setModelCustomizationId("modelCustomizationId");
+ when(bbSetupUtils.getAAIVfModule(any(), any())).thenReturn(vfModule);
+
+ List<org.onap.aai.domain.yang.Vnfc> vnfcs = new ArrayList<org.onap.aai.domain.yang.Vnfc>();
+ org.onap.aai.domain.yang.Vnfc vnfc = new org.onap.aai.domain.yang.Vnfc();
+ vnfc.setModelInvariantId("modelInvariantId");
+ vnfc.setVnfcName("testVnfcName");
+ vnfcs.add(vnfc);
+ doReturn(vnfcs).when(SPY_workflowAction).getRelatedResourcesInVfModule(any(), any(), any(), any());
+
+ List<org.onap.aai.domain.yang.Configuration> configurations =
+ new ArrayList<org.onap.aai.domain.yang.Configuration>();
+ org.onap.aai.domain.yang.Configuration configuration = new org.onap.aai.domain.yang.Configuration();
+ configuration.setConfigurationId("configurationId");
+ configuration.setModelCustomizationId("modelCustimizationId");
+ configuration.setConfigurationName("testConfigurationName");
+ configurations.add(configuration);
+ org.onap.aai.domain.yang.Configuration configuration1 = new org.onap.aai.domain.yang.Configuration();
+ configuration1.setConfigurationId("configurationId");
+ configuration1.setModelCustomizationId("modelCustimizationId");
+ configuration1.setConfigurationName("testConfigurationName");
+ configurations.add(configuration1);
+ doReturn(configurations).when(SPY_workflowAction).getRelatedResourcesInVnfc(any(), any(), any());
+
+ doReturn("testName").when(SPY_workflowAction).getVnfcNameForConfiguration(any());
+
+ thrown.expect(BpmnError.class);
+ SPY_workflowAction.selectExecutionList(delegateExecution);
+ assertEquals(
+ "Exception in getConfigBuildingBlock: Multiple relationships exist from VNFC testVnfcName to Configurations",
+ delegateExecution.getVariable("WorkflowException"));
+ }
+
+ @Test
public void selectExecutionListDuplicateNameExceptionTest() throws Exception {
String gAction = "createInstance";
execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
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-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java
index 925d10179f..0d0e6ee92f 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java
@@ -23,6 +23,8 @@ package org.onap.so.apihandlerinfra;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.TreeSet;
+import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@@ -90,21 +92,40 @@ public class WorkflowSpecificationsHandler {
@Transactional
public Response queryWorkflowSpecifications(@QueryParam("vnfModelVersionId") String vnfModelVersionId,
- @PathParam("version") String version) throws Exception {
-
+ @QueryParam("pnfModelVersionId") String pnfModelVersionId, @PathParam("version") String version)
+ throws Exception {
String apiVersion = version.substring(1);
- ObjectMapper mapper1 = new ObjectMapper();
- mapper1.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
-
- List<Workflow> workflows = catalogDbClient.findWorkflowByModelUUID(vnfModelVersionId);
+ List<Workflow> workflows = new ArrayList<>();
+ if (vnfModelVersionId == null && pnfModelVersionId == null) {
+ workflows.addAll(queryWorkflowSpecificationsForAll());
+ } else {
+ // 1. query workflow specifications for given vnfModelVersionId if need.
+ if (vnfModelVersionId != null) {
+ List<Workflow> vnfWorkflows = queryWorkflowSpecificationsForVnf(vnfModelVersionId);
+ logger.debug("Retrieved " + vnfWorkflows.size() + " workflows for given vnfModelVersionId.");
+ if (vnfWorkflows.size() > 0) {
+ workflows.addAll(vnfWorkflows);
+ }
+ }
- List<Workflow> nativeWorkflows = catalogDbClient.findWorkflowBySource(NATIVE_WORKFLOW);
- if (nativeWorkflows != null && !nativeWorkflows.isEmpty()) {
- workflows.addAll(nativeWorkflows);
+ // 2. query workflow specifications for given pnfModelVersionId if need.
+ if (pnfModelVersionId != null) {
+ List<Workflow> pnfWorkflows = queryWorkflowSpecificationsForPnf(pnfModelVersionId);
+ logger.debug("Retrieved " + pnfWorkflows.size() + " workflows for given pnfModelVerionId.");
+ if (pnfWorkflows.size() > 0) {
+ workflows.addAll(pnfWorkflows);
+ }
+ }
}
- WorkflowSpecifications workflowSpecifications = mapWorkflowsToWorkflowSpecifications(workflows);
+ // Deduplication
+ List<Workflow> retWorkflows = workflows.stream()
+ .collect(Collectors.collectingAndThen(
+ Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(Workflow::getArtifactUUID))),
+ ArrayList::new));
+
+ WorkflowSpecifications workflowSpecifications = mapWorkflowsToWorkflowSpecifications(retWorkflows);
String jsonResponse;
try {
@@ -239,4 +260,24 @@ public class WorkflowSpecificationsHandler {
}
return validationList;
}
+
+ private List<Workflow> queryWorkflowSpecificationsForAll() {
+ List<Workflow> workflows = catalogDbClient.findWorkflowBySource(NATIVE_WORKFLOW);
+ return workflows;
+ }
+
+ private List<Workflow> queryWorkflowSpecificationsForVnf(String vnfModelVersionId) {
+ List<Workflow> workflows = catalogDbClient.findWorkflowByVnfModelUUID(vnfModelVersionId);
+
+ List<Workflow> nativeWorkflows = catalogDbClient.findWorkflowBySource(NATIVE_WORKFLOW);
+ if (!nativeWorkflows.isEmpty()) {
+ workflows.addAll(nativeWorkflows);
+ }
+ return workflows;
+ }
+
+ private List<Workflow> queryWorkflowSpecificationsForPnf(String pnfModelVersionId) {
+ List<Workflow> workflows = catalogDbClient.findWorkflowByPnfModelUUID(pnfModelVersionId);
+ return workflows;
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandlerTest.java
index 0beab1bd13..7af92cb8ef 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandlerTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandlerTest.java
@@ -68,7 +68,7 @@ public class WorkflowSpecificationsHandlerTest extends BaseTest {
private final String basePath = "onap/so/infra/workflowSpecifications/v1/workflows";
@Test
- public void queryWorkflowSpecifications_Test_Success()
+ public void queryWorkflowSpecificationsByVnfModelUUID_Test_Success()
throws ParseException, JSONException, JsonParseException, JsonMappingException, IOException {
HttpHeaders headers = new HttpHeaders();
@@ -77,7 +77,7 @@ public class WorkflowSpecificationsHandlerTest extends BaseTest {
HttpEntity<String> entity = new HttpEntity<String>(null, headers);
wireMockServer.stubFor(get(urlMatching(
- "/workflow/search/findWorkflowByModelUUID[?]vnfResourceModelUUID=b5fa707a-f55a-11e7-a796-005056856d52"))
+ "/workflow/search/findWorkflowByVnfModelUUID[?]vnfResourceModelUUID=b5fa707a-f55a-11e7-a796-005056856d52"))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBody(getWiremockResponseForCatalogdb("WorkflowSpecificationsQuery_Response.json"))
.withStatus(org.apache.http.HttpStatus.SC_OK)));
@@ -324,6 +324,52 @@ public class WorkflowSpecificationsHandlerTest extends BaseTest {
assertThat(expectedResult, sameBeanAs(workflowSpecifications).ignoring(WorkflowInputParameter.class));
}
+ @Test
+ public void queryWorkflowSpecificationsByPnfModelUUID_Test_Success()
+ throws ParseException, JSONException, JsonParseException, JsonMappingException, IOException {
+
+ HttpHeaders headers = new HttpHeaders();
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+ headers.set("Content-Type", MediaType.APPLICATION_JSON);
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+
+ wireMockServer.stubFor(get(urlMatching(
+ "/workflow/search/findWorkflowByPnfModelUUID[?]pnfResourceModelUUID=f2d1f2b2-88bb-49da-b716-36ae420ccbff"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb(
+ "WorkflowSpecificationsForPnfQuery_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+
+ wireMockServer.stubFor(get(urlMatching("/workflow/4/workflowActivitySpecSequence"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("Empty_workflowActivitySpecSequence_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+
+ UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(basePath))
+ .queryParam("pnfModelVersionId", "f2d1f2b2-88bb-49da-b716-36ae420ccbff");
+
+ ResponseEntity<String> response =
+ restTemplate.exchange(builder.toUriString(), HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+
+ WorkflowSpecifications expectedResponse = mapper.readValue(
+ new String(Files.readAllBytes(
+ Paths.get("src/test/resources/__files/catalogdb/WorkflowSpecificationsForPnf.json"))),
+ WorkflowSpecifications.class);
+ WorkflowSpecifications realResponse = mapper.readValue(response.getBody(), WorkflowSpecifications.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+ assertThat(expectedResponse, sameBeanAs(realResponse));
+ assertEquals("application/json", response.getHeaders().get(HttpHeaders.CONTENT_TYPE).get(0));
+ assertEquals("0", response.getHeaders().get("X-MinorVersion").get(0));
+ assertEquals("0", response.getHeaders().get("X-PatchVersion").get(0));
+ assertEquals("1.0.0", response.getHeaders().get("X-LatestVersion").get(0));
+ }
+
private String getWiremockResponseForCatalogdb(String file) {
try {
File resource = ResourceUtils.getFile("classpath:__files/catalogdb/" + file);
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/Empty_workflowActivitySpecSequence_Response.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/Empty_workflowActivitySpecSequence_Response.json
new file mode 100644
index 0000000000..89675e8f02
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/Empty_workflowActivitySpecSequence_Response.json
@@ -0,0 +1,5 @@
+{
+ "_embedded": {
+ "workflowActivitySpecSequence": []
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/WorkflowSpecificationsForPnf.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/WorkflowSpecificationsForPnf.json
new file mode 100644
index 0000000000..257b9dc843
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/WorkflowSpecificationsForPnf.json
@@ -0,0 +1,20 @@
+{
+ "workflowSpecificationList": [
+ {
+ "workflowSpecification": {
+ "artifactInfo": {
+ "artifactType": "workflow",
+ "artifactUuid": "b2fd5627-55e4-4f4f-8064-9e6f443e9152",
+ "artifactName": "DummyPnfWorkflow",
+ "artifactVersion": "1.0",
+ "artifactDescription": "Dummy Pnf Workflow to test custom Pnf workflow",
+ "workflowName": "Dummy Pnf Workflow",
+ "operationName": "DummyPnfWorkflow",
+ "workflowSource": "native",
+ "workflowResourceTarget": "pnf"
+ },
+ "workflowInputParameters": []
+ }
+ }
+ ]
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/WorkflowSpecificationsForPnfQuery_Response.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/WorkflowSpecificationsForPnfQuery_Response.json
new file mode 100644
index 0000000000..a4e1bbcdc5
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/WorkflowSpecificationsForPnfQuery_Response.json
@@ -0,0 +1,41 @@
+{
+ "_embedded": {
+ "workflow": [
+ {
+ "artifactChecksum": "MANUAL RECORD",
+ "artifactName": "DummyPnfWorkflow",
+ "artifactUUID": "b2fd5627-55e4-4f4f-8064-9e6f443e9152",
+ "body": null,
+ "created": "2020-02-18T08:28:15.000+0000",
+ "description": "Dummy Pnf Workflow to test custom Pnf workflow",
+ "id": 4,
+ "name": "Dummy Pnf Workflow",
+ "operationName": "DummyPnfWorkflow",
+ "pnfResourceWorkflow": null,
+ "resourceTarget": "pnf",
+ "source": "native",
+ "timeoutMinutes": null,
+ "version": 1.0,
+ "_links": {
+ "self": {
+ "href": "http://localhost:8090/workflow/search/findWorkflowByPnfModelUUID?pnfResourceModelUUID=f2d1f2b2-88bb-49da-b716-36ae420ccbff"
+ },
+ "workflow": {
+ "href": "http://localhost:8090/workflow/4"
+ },
+ "workflowActivitySpecSequence": {
+ "href": "http://localhost:8090/workflow/4/workflowActivitySpecSequence"
+ }
+ }
+ }
+ ]
+ },
+ "_links": {
+ "self": {
+ "href": "http://localhost:8090/workflow/search/findWorkflowByPnfModelUUID?pnfResourceModelUUID=f2d1f2b2-88bb-49da-b716-36ae420ccbff"
+ },
+ "workflowActivitySpecSequence": {
+ "href": "http://localhost:8090/workflow/4/workflowActivitySpecSequence"
+ }
+ }
+}
diff --git a/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/OrchestrationTaskRepository.java b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/OrchestrationTaskRepository.java
new file mode 100644
index 0000000000..1093c79638
--- /dev/null
+++ b/mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/OrchestrationTaskRepository.java
@@ -0,0 +1,33 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 Huawei Technologies Co., Ltd. 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.db.request.data.repository;
+
+import org.onap.so.db.request.beans.OrchestrationTask;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.repository.query.Param;
+import org.springframework.data.rest.core.annotation.RepositoryRestResource;
+import java.util.List;
+
+@RepositoryRestResource(collectionResourceRel = "orchestrationTask", path = "orchestrationTask")
+public interface OrchestrationTaskRepository extends JpaRepository<OrchestrationTask, String> {
+
+ public List<OrchestrationTask> findByStatus(@Param("status") String status);
+}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/OrchestrationTask.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/OrchestrationTask.java
new file mode 100644
index 0000000000..53760f1b00
--- /dev/null
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/OrchestrationTask.java
@@ -0,0 +1,143 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 Huawei Technologies Co., Ltd. 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.db.request.beans;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.hibernate.annotations.DynamicUpdate;
+import javax.persistence.*;
+import java.io.Serializable;
+import java.util.Date;
+import java.util.Objects;
+
+@Entity
+@DynamicUpdate
+@Table(name = "orchestration_task")
+public class OrchestrationTask implements Serializable {
+
+ private static final long serialVersionUID = -9158494554305291596L;
+
+ @Id
+ @Column(name = "TASK_ID", nullable = false, updatable = false)
+ private String taskId;
+
+ @Column(name = "REQUEST_ID", nullable = false, updatable = false)
+ private String requestId;
+
+ @Column(name = "NAME")
+ private String name;
+
+ @Column(name = "CREATED_TIME")
+ private Date createdTime;
+
+ @Column(name = "STATUS")
+ private String status;
+
+ @Column(name = "IS_MANUAL")
+ private String isManual;
+
+ @Column(name = "PARAMS")
+ private String params;
+
+ public String getTaskId() {
+ return taskId;
+ }
+
+ public void setTaskId(String taskId) {
+ this.taskId = taskId;
+ }
+
+ public String getRequestId() {
+ return requestId;
+ }
+
+ public void setRequestId(String requestId) {
+ this.requestId = requestId;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Date getCreatedTime() {
+ return createdTime;
+ }
+
+ public void setCreatedTime(Date createdTime) {
+ this.createdTime = createdTime;
+ }
+
+ public String getStatus() {
+ return status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
+ public String getIsManual() {
+ return isManual;
+ }
+
+ public void setIsManual(String isManual) {
+ this.isManual = isManual;
+ }
+
+ public String getParams() {
+ return params;
+ }
+
+ public void setParams(String parameters) {
+ this.params = parameters;
+ }
+
+ @Override
+ public boolean equals(final Object other) {
+ if (this == other) {
+ return true;
+ }
+ if (!(other instanceof OrchestrationTask)) {
+ return false;
+ }
+ OrchestrationTask castOther = (OrchestrationTask) other;
+ return Objects.equals(getTaskId(), castOther.getTaskId());
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(this.getTaskId());
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("taskId", getTaskId()).toString();
+ }
+
+ @PrePersist
+ protected void onCreate() {
+ this.createdTime = new Date();
+ }
+
+}
+
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/BBNameSelectionReference.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/BBNameSelectionReference.java
new file mode 100644
index 0000000000..9b71c970a7
--- /dev/null
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/BBNameSelectionReference.java
@@ -0,0 +1,115 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 Tech Mahindra
+ * ================================================================================
+ * 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.db.catalog.beans;
+
+import java.io.Serializable;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.Table;
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import com.openpojo.business.annotation.BusinessKey;
+
+@Entity
+@Table(name = "bbname_selection_reference")
+public class BBNameSelectionReference implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ @Id
+ @Column(name = "ID", nullable = false, updatable = false)
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ private Integer ID;
+
+ @BusinessKey
+ @Column(name = "CONTROLLER_ACTOR")
+ private String controllerActor;
+
+ @Column(name = "SCOPE")
+ private String scope;
+
+ @Column(name = "ACTION")
+ private String action;
+
+ @BusinessKey
+ @Column(name = "BB_NAME")
+ private String bbName;
+
+ public String getControllerActor() {
+ return controllerActor;
+ }
+
+ public void setControllerActor(String controllerActor) {
+ this.controllerActor = controllerActor;
+ }
+
+ public String getScope() {
+ return scope;
+ }
+
+ public void setScope(String scope) {
+ this.scope = scope;
+ }
+
+ public String getAction() {
+ return action;
+ }
+
+ public void setAction(String action) {
+ this.action = action;
+ }
+
+ public Integer getID() {
+ return ID;
+ }
+
+ public String getBbName() {
+ return bbName;
+ }
+
+ public void setBbName(String bbName) {
+ this.bbName = bbName;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("ID", ID).append("controllerActor", controllerActor)
+ .append("scope", scope).append("action", action).append("bbName", bbName).toString();
+ }
+
+ @Override
+ public boolean equals(final Object other) {
+ if (!(other instanceof BBNameSelectionReference)) {
+ return false;
+ }
+ BBNameSelectionReference castOther = (BBNameSelectionReference) other;
+ return new EqualsBuilder().append(controllerActor, castOther.controllerActor).isEquals();
+ }
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder().append(controllerActor).append(bbName).toHashCode();
+ }
+}
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..cf066f9721 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
@@ -32,6 +32,7 @@ import javax.ws.rs.core.UriBuilder;
import org.apache.http.HttpStatus;
import org.onap.logging.filter.base.Constants;
import org.onap.logging.filter.spring.SpringClientPayloadFilter;
+import org.onap.so.db.catalog.beans.BBNameSelectionReference;
import org.onap.so.db.catalog.beans.BuildingBlockDetail;
import org.onap.so.db.catalog.beans.CloudSite;
import org.onap.so.db.catalog.beans.CloudifyManager;
@@ -119,6 +120,7 @@ public class CatalogDbClient {
private static final String PNF_RESOURCE = "/pnfResource";
private static final String PNF_RESOURCE_CUSTOMIZATION = "/pnfResourceCustomization";
private static final String WORKFLOW = "/workflow";
+ private static final String BB_NAME_SELECTION_REFERENCE = "/bbNameSelectionReference";
private static final String SEARCH = "/search";
@@ -201,10 +203,12 @@ public class CatalogDbClient {
private String findServiceByServiceInstanceId = "/findServiceByServiceInstanceId";
private String findPnfResourceCustomizationByModelUuid = "/findPnfResourceCustomizationByModelUuid";
private String findWorkflowByArtifactUUID = "/findByArtifactUUID";
- private String findWorkflowByModelUUID = "/findWorkflowByModelUUID";
+ private String findWorkflowByVnfModelUUID = "/findWorkflowByVnfModelUUID";
private String findWorkflowByPnfModelUUID = "/findWorkflowByPnfModelUUID";
private String findWorkflowBySource = "/findBySource";
private String findVnfResourceCustomizationByModelUuid = "/findVnfResourceCustomizationByModelUuid";
+ private String findBBNameSelectionReferenceByControllerActorAndScopeAndAction =
+ "/findBBNameSelectionReferenceByControllerActorAndScopeAndAction";
private String serviceURI;
private String vfModuleURI;
@@ -277,6 +281,8 @@ public class CatalogDbClient {
private final Client<Workflow> workflowClient;
+ private final Client<BBNameSelectionReference> bbNameSelectionReferenceClient;
+
@Value("${mso.catalog.db.spring.endpoint:#{null}}")
private String endpoint;
@@ -339,13 +345,16 @@ public class CatalogDbClient {
endpoint + PNF_RESOURCE_CUSTOMIZATION + SEARCH + findPnfResourceCustomizationByModelUuid;
findWorkflowByArtifactUUID = endpoint + WORKFLOW + SEARCH + findWorkflowByArtifactUUID;
- findWorkflowByModelUUID = endpoint + WORKFLOW + SEARCH + findWorkflowByModelUUID;
+ findWorkflowByVnfModelUUID = endpoint + WORKFLOW + SEARCH + findWorkflowByVnfModelUUID;
findWorkflowByPnfModelUUID = endpoint + WORKFLOW + SEARCH + findWorkflowByPnfModelUUID;
findWorkflowBySource = endpoint + WORKFLOW + SEARCH + findWorkflowBySource;
findVnfResourceCustomizationByModelUuid =
endpoint + VNF_RESOURCE_CUSTOMIZATION + SEARCH + findVnfResourceCustomizationByModelUuid;
+ findBBNameSelectionReferenceByControllerActorAndScopeAndAction = endpoint + BB_NAME_SELECTION_REFERENCE + SEARCH
+ + findBBNameSelectionReferenceByControllerActorAndScopeAndAction;
+
serviceURI = endpoint + SERVICE + URI_SEPARATOR;
vfModuleURI = endpoint + VFMODULE + URI_SEPARATOR;
vnfResourceURI = endpoint + VNF_RESOURCE + URI_SEPARATOR;
@@ -412,6 +421,8 @@ public class CatalogDbClient {
pnfResourceClient = clientFactory.create(PnfResource.class);
pnfResourceCustomizationClient = clientFactory.create(PnfResourceCustomization.class);
workflowClient = clientFactory.create(Workflow.class);
+ bbNameSelectionReferenceClient = clientFactory.create(BBNameSelectionReference.class);
+
}
public CatalogDbClient(String baseUri, String auth) {
@@ -462,6 +473,7 @@ public class CatalogDbClient {
pnfResourceClient = clientFactory.create(PnfResource.class);
pnfResourceCustomizationClient = clientFactory.create(PnfResourceCustomization.class);
workflowClient = clientFactory.create(Workflow.class);
+ bbNameSelectionReferenceClient = clientFactory.create(BBNameSelectionReference.class);
}
public NetworkCollectionResourceCustomization getNetworkCollectionResourceCustomizationByID(
@@ -689,6 +701,14 @@ public class CatalogDbClient {
UriBuilder.fromUri(findFirstByModelNameURI).queryParam(MODEL_NAME, modelName).build());
}
+ public BBNameSelectionReference getBBNameSelectionReference(String controllerActor, String scope, String action) {
+
+ return this.getSingleResource(bbNameSelectionReferenceClient,
+ getUri(UriBuilder.fromUri(findBBNameSelectionReferenceByControllerActorAndScopeAndAction)
+ .queryParam("CONTROLLER_ACTOR", controllerActor).queryParam("SCOPE", scope)
+ .queryParam("ACTION", action).build().toString()));
+ }
+
public ExternalServiceToInternalService findExternalToInternalServiceByServiceName(String serviceName) {
return this.getSingleResource(externalServiceToInternalServiceClient,
getUri(UriBuilder.fromUri(findExternalToInternalServiceByServiceName)
@@ -764,8 +784,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() {
@@ -996,8 +1069,8 @@ public class CatalogDbClient {
.queryParam(ARTIFACT_UUID, artifactUUID).build().toString()));
}
- public List<Workflow> findWorkflowByModelUUID(String vnfResourceModelUUID) {
- return this.getMultipleResources(workflowClient, getUri(UriBuilder.fromUri(findWorkflowByModelUUID)
+ public List<Workflow> findWorkflowByVnfModelUUID(String vnfResourceModelUUID) {
+ return this.getMultipleResources(workflowClient, getUri(UriBuilder.fromUri(findWorkflowByVnfModelUUID)
.queryParam(VNF_RESOURCE_MODEL_UUID, vnfResourceModelUUID).build().toString()));
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/BBNameSelectionReferenceRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/BBNameSelectionReferenceRepository.java
new file mode 100644
index 0000000000..38f1291f37
--- /dev/null
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/BBNameSelectionReferenceRepository.java
@@ -0,0 +1,36 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 Tech Mahindra
+ * ================================================================================
+ * 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.db.catalog.data.repository;
+
+
+import org.onap.so.db.catalog.beans.BBNameSelectionReference;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.repository.query.Param;
+import org.springframework.data.rest.core.annotation.RepositoryRestResource;
+
+
+@RepositoryRestResource(collectionResourceRel = "bbNameSelectionReference", path = "bbNameSelectionReference")
+public interface BBNameSelectionReferenceRepository extends JpaRepository<BBNameSelectionReference, Integer> {
+
+ public BBNameSelectionReference findBBNameSelectionReferenceByControllerActorAndScopeAndAction(
+ @Param("CONTROLLER_ACTOR") String controllerActor, @Param("SCOPE") String scope,
+ @Param("ACTION") String action);
+}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/WorkflowRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/WorkflowRepository.java
index f1b399325e..91c6940e95 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/WorkflowRepository.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/WorkflowRepository.java
@@ -37,14 +37,14 @@ public interface WorkflowRepository extends JpaRepository<Workflow, Integer> {
* Used to fetch the @{link Workflow} by the Model UUID.
*
* This operation is required by {@link org.onap.so.db.catalog.client.CatalogDbClient} to provide Workflow based on
- * model UUID without projection.
+ * vnf model UUID without projection.
*
* @param vnfResourceModelUUID UUID
* @return List of Workflow
*/
@Query(value = "select b.* from vnf_resource_to_workflow a join workflow b where a.WORKFLOW_ID = b.ID and a.VNF_RESOURCE_MODEL_UUID = ?1",
nativeQuery = true)
- List<Workflow> findWorkflowByModelUUID(String vnfResourceModelUUID);
+ List<Workflow> findWorkflowByVnfModelUUID(String vnfResourceModelUUID);
/**
* Used to fetch the @{link Workflow} by the Pnf Model UUID.
diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/WorkflowRepositoryTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/WorkflowRepositoryTest.java
index 7d1b8d0d96..b07e82b8a8 100644
--- a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/WorkflowRepositoryTest.java
+++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/WorkflowRepositoryTest.java
@@ -36,7 +36,8 @@ public class WorkflowRepositoryTest extends BaseTest {
@Test
public void findByVnfResourceModelUUIDTest() throws Exception {
- List<Workflow> workflows = workflowRepository.findWorkflowByModelUUID("ff2ae348-214a-11e7-93ae-92361f002671");
+ List<Workflow> workflows =
+ workflowRepository.findWorkflowByVnfModelUUID("ff2ae348-214a-11e7-93ae-92361f002671");
Assert.assertTrue(workflows != null);
Assert.assertTrue(workflows.size() != 0);
diff --git a/mso-catalog-db/src/test/resources/data.sql b/mso-catalog-db/src/test/resources/data.sql
index e5963c183f..0852aa026d 100644
--- a/mso-catalog-db/src/test/resources/data.sql
+++ b/mso-catalog-db/src/test/resources/data.sql
@@ -957,3 +957,9 @@ VALUES
(select ID from user_parameters where NAME='existing_software_version')),
((select ID from activity_spec where NAME='VNFUpgradeSoftwareActivity' and VERSION=1.0),
(select ID from user_parameters where NAME='new_software_version'));
+
+INSERT INTO bbname_selection_reference (CONTROLLER_ACTOR,SCOPE,ACTION,BB_NAME)
+VALUES
+('APPC', 'vfModule', 'healthCheck','GenericVnfHealthCheckBB'),
+('APPC', 'vfModule', 'configScaleOut','ConfigurationScaleOutBB'),
+('APPC', 'vnf', 'healthCheck','GenericVnfHealthCheckBB'); \ No newline at end of file
diff --git a/mso-catalog-db/src/test/resources/schema.sql b/mso-catalog-db/src/test/resources/schema.sql
index 9037e431d4..6573def570 100644
--- a/mso-catalog-db/src/test/resources/schema.sql
+++ b/mso-catalog-db/src/test/resources/schema.sql
@@ -1387,6 +1387,18 @@ CREATE TABLE IF NOT EXISTS `activity_spec_to_user_parameters` (
ENGINE = InnoDB
DEFAULT CHARACTER SET = latin1;
+--
+-- Table structure for table `bbname_selection_reference`
+--
+DROP TABLE IF EXISTS `bbname_selection_reference`;
+CREATE TABLE IF NOT EXISTS `bbname_selection_reference` (
+ `ID` INT(11) NOT NULL AUTO_INCREMENT,
+ `CONTROLLER_ACTOR` varchar(200) NOT NULL ,
+ `SCOPE` varchar(200) NOT NULL,
+ `ACTION` varchar(200) NOT NULL,
+ `BB_NAME` varchar(200) NOT NULL,
+ PRIMARY KEY (`ID`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
diff --git a/packages/docker/pom.xml b/packages/docker/pom.xml
index f29a4451f6..c78979eccb 100644
--- a/packages/docker/pom.xml
+++ b/packages/docker/pom.xml
@@ -1,47 +1,47 @@
<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/xsd/maven-4.0.0.xsd">
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
+ <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.onap.so</groupId>
- <artifactId>packages</artifactId>
- <version>1.4.0-SNAPSHOT</version>
- </parent>
+ <parent>
+ <groupId>org.onap.so</groupId>
+ <artifactId>packages</artifactId>
+ <version>1.4.0-SNAPSHOT</version>
+ </parent>
- <packaging>pom</packaging>
- <artifactId>docker</artifactId>
- <name>Docker Images</name>
- <description>Docker Images</description>
+ <packaging>pom</packaging>
+ <artifactId>docker</artifactId>
+ <name>Docker Images</name>
+ <description>Docker Images</description>
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
- <so.project.version>${project.version}</so.project.version>
- <docker.skip>false</docker.skip>
- <docker.skip.build>false</docker.skip.build>
- <docker.skip.push>false</docker.skip.push>
- <docker.pull.registry>nexus3.onap.org:10001</docker.pull.registry>
- <docker.push.registry>nexus3.onap.org:10003</docker.push.registry>
- <docker.image.prefix>onap/so</docker.image.prefix>
- <docker.push.phase>deploy</docker.push.phase>
- </properties>
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+ <so.project.version>${project.version}</so.project.version>
+ <docker.skip>false</docker.skip>
+ <docker.skip.build>false</docker.skip.build>
+ <docker.skip.push>false</docker.skip.push>
+ <docker.pull.registry>nexus3.onap.org:10001</docker.pull.registry>
+ <docker.push.registry>nexus3.onap.org:10003</docker.push.registry>
+ <docker.image.prefix>onap/so</docker.image.prefix>
+ <docker.push.phase>deploy</docker.push.phase>
+ </properties>
- <build>
- <finalName>${project.artifactId}-${project.version}</finalName>
- <plugins>
- <plugin>
- <groupId>org.codehaus.groovy.maven</groupId>
- <artifactId>gmaven-plugin</artifactId>
- <version>1.0</version>
- <executions>
- <execution>
- <phase>validate</phase>
- <goals>
- <goal>execute</goal>
- </goals>
- <configuration>
- <source>
+ <build>
+ <finalName>${project.artifactId}-${project.version}</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.groovy.maven</groupId>
+ <artifactId>gmaven-plugin</artifactId>
+ <version>1.0</version>
+ <executions>
+ <execution>
+ <phase>validate</phase>
+ <goals>
+ <goal>execute</goal>
+ </goals>
+ <configuration>
+ <source>
println 'Project version: ' + project.properties['so.project.version'];
def versionArray;
if ( project.properties['so.project.version'] != null ) {
@@ -56,439 +56,469 @@
println 'New tag for docker: ' + project.properties['project.docker.latesttag.version'];
</source>
- </configuration>
- </execution>
- </executions>
- </plugin>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
- <plugin>
- <groupId>io.fabric8</groupId>
- <artifactId>docker-maven-plugin</artifactId>
- <version>0.31.0</version>
+ <plugin>
+ <groupId>io.fabric8</groupId>
+ <artifactId>docker-maven-plugin</artifactId>
+ <version>0.31.0</version>
- <configuration>
- <verbose>true</verbose>
- <apiVersion>1.23</apiVersion>
- <pullRegistry>${docker.pull.registry}</pullRegistry>
- <pushRegistry>${docker.push.registry}</pushRegistry>
+ <configuration>
+ <verbose>true</verbose>
+ <apiVersion>1.23</apiVersion>
+ <pullRegistry>${docker.pull.registry}</pullRegistry>
+ <pushRegistry>${docker.push.registry}</pushRegistry>
- <images>
- <image>
- <name>${docker.image.prefix}/base-image:1.0</name>
- <build>
- <cleanup>try</cleanup>
- <dockerFileDir>docker-files</dockerFileDir>
- <dockerFile>Dockerfile.so-base-image</dockerFile>
- </build>
- </image>
- <image>
- <name>${docker.image.prefix}/vnfm-adapter</name>
- <build>
- <cleanup>try</cleanup>
- <dockerFileDir>docker-files</dockerFileDir>
- <dockerFile>Dockerfile.so-app</dockerFile>
- <tags>
- <tag>${project.version}</tag>
- <tag>${project.version}-${maven.build.timestamp}</tag>
- <tag>${project.docker.latesttag.version}</tag>
- </tags>
- <assembly>
- <inline>
- <dependencySets>
- <dependencySet>
- <includes>
- <include>org.onap.so.adapters:mso-vnfm-etsi-adapter</include>
- </includes>
- <outputFileNameMapping>app.jar</outputFileNameMapping>
- </dependencySet>
- </dependencySets>
- </inline>
- </assembly>
- </build>
- </image>
- <image>
- <name>${docker.image.prefix}/catalog-db-adapter</name>
- <build>
- <cleanup>try</cleanup>
- <dockerFileDir>docker-files</dockerFileDir>
- <dockerFile>Dockerfile.so-app</dockerFile>
- <tags>
- <tag>${project.version}</tag>
- <tag>${project.version}-${maven.build.timestamp}</tag>
- <tag>${project.docker.latesttag.version}</tag>
- </tags>
- <assembly>
- <inline>
- <dependencySets>
- <dependencySet>
- <includes>
- <include>org.onap.so.adapters:mso-catalog-db-adapter</include>
- </includes>
- <outputFileNameMapping>app.jar</outputFileNameMapping>
- </dependencySet>
- </dependencySets>
- </inline>
- </assembly>
- </build>
- </image>
- <image>
- <name>${docker.image.prefix}/request-db-adapter</name>
- <build>
- <cleanup>try</cleanup>
- <dockerFileDir>docker-files</dockerFileDir>
- <dockerFile>Dockerfile.so-app</dockerFile>
- <tags>
- <tag>${project.version}</tag>
- <tag>${project.version}-${maven.build.timestamp}</tag>
- <tag>${project.docker.latesttag.version}</tag>
- </tags>
- <assembly>
- <inline>
- <dependencySets>
- <dependencySet>
- <includes>
- <include>org.onap.so.adapters:mso-requests-db-adapter</include>
- </includes>
- <outputFileNameMapping>app.jar</outputFileNameMapping>
- </dependencySet>
- </dependencySets>
- </inline>
- </assembly>
- </build>
- </image>
- <image>
- <name>${docker.image.prefix}/sdnc-adapter</name>
- <build>
- <cleanup>try</cleanup>
- <dockerFileDir>docker-files</dockerFileDir>
- <dockerFile>Dockerfile.so-app</dockerFile>
- <tags>
- <tag>${project.version}</tag>
- <tag>${project.version}-${maven.build.timestamp}</tag>
- <tag>${project.docker.latesttag.version}</tag>
- </tags>
- <assembly>
- <inline>
- <dependencySets>
- <dependencySet>
- <includes>
- <include>org.onap.so:mso-sdnc-adapter</include>
- </includes>
- <outputFileNameMapping>app.jar</outputFileNameMapping>
- </dependencySet>
- </dependencySets>
- </inline>
- </assembly>
- </build>
- </image>
- <image>
- <name>${docker.image.prefix}/openstack-adapter</name>
- <build>
- <cleanup>try</cleanup>
- <dockerFileDir>docker-files</dockerFileDir>
- <dockerFile>Dockerfile.so-app</dockerFile>
- <tags>
- <tag>${project.version}</tag>
- <tag>${project.version}-${maven.build.timestamp}</tag>
- <tag>${project.docker.latesttag.version}</tag>
- </tags>
- <assembly>
- <inline>
- <dependencySets>
- <dependencySet>
- <includes>
- <include>org.onap.so:mso-openstack-adapters</include>
- </includes>
- <outputFileNameMapping>app.jar</outputFileNameMapping>
- </dependencySet>
- </dependencySets>
- </inline>
- </assembly>
- </build>
- </image>
- <image>
- <name>${docker.image.prefix}/vfc-adapter</name>
- <build>
- <cleanup>try</cleanup>
- <dockerFileDir>docker-files</dockerFileDir>
- <dockerFile>Dockerfile.so-app</dockerFile>
- <tags>
- <tag>${project.version}</tag>
- <tag>${project.version}-${maven.build.timestamp}</tag>
- <tag>${project.docker.latesttag.version}</tag>
- </tags>
- <assembly>
- <inline>
- <dependencySets>
- <dependencySet>
- <includes>
- <include>org.onap.so.adapters:mso-vfc-adapter</include>
- </includes>
- <outputFileNameMapping>app.jar</outputFileNameMapping>
- </dependencySet>
- </dependencySets>
- </inline>
- </assembly>
- </build>
- </image>
- <image>
- <name>${docker.image.prefix}/so-appc-orchestrator</name>
- <build>
- <cleanup>try</cleanup>
- <dockerFileDir>docker-files</dockerFileDir>
- <dockerFile>Dockerfile.so-app</dockerFile>
- <tags>
- <tag>${project.version}</tag>
- <tag>${project.version}-${maven.build.timestamp}</tag>
- <tag>${project.docker.latesttag.version}</tag>
- </tags>
- <assembly>
- <inline>
- <dependencySets>
- <dependencySet>
- <includes>
- <include>org.onap.so.adapters:so-appc-orchestrator</include>
- </includes>
- <outputFileNameMapping>app.jar</outputFileNameMapping>
- </dependencySet>
- </dependencySets>
- </inline>
- </assembly>
- </build>
- </image>
- <image>
- <name>${docker.image.prefix}/sdc-controller</name>
- <build>
- <cleanup>try</cleanup>
- <dockerFileDir>docker-files</dockerFileDir>
- <dockerFile>Dockerfile.so-app</dockerFile>
- <tags>
- <tag>${project.version}</tag>
- <tag>${project.version}-${maven.build.timestamp}</tag>
- <tag>${project.docker.latesttag.version}</tag>
- </tags>
- <assembly>
- <inline>
- <dependencySets>
- <dependencySet>
- <includes>
- <include>org.onap.so:asdc-controller</include>
- </includes>
- <outputFileNameMapping>app.jar</outputFileNameMapping>
- </dependencySet>
- </dependencySets>
- </inline>
- </assembly>
- </build>
- </image>
- <image>
- <name>${docker.image.prefix}/bpmn-infra</name>
- <build>
- <cleanup>try</cleanup>
- <dockerFileDir>docker-files</dockerFileDir>
- <dockerFile>Dockerfile.so-app</dockerFile>
- <tags>
- <tag>${project.version}</tag>
- <tag>${project.version}-${maven.build.timestamp}</tag>
- <tag>${project.docker.latesttag.version}</tag>
- </tags>
- <assembly>
- <inline>
- <dependencySets>
- <dependencySet>
- <includes>
- <include>org.onap.so:mso-infrastructure-bpmn</include>
- </includes>
- <outputFileNameMapping>app.jar</outputFileNameMapping>
- </dependencySet>
- </dependencySets>
- </inline>
- </assembly>
- </build>
- </image>
- <image>
- <name>${docker.image.prefix}/api-handler-infra</name>
- <build>
- <cleanup>try</cleanup>
- <dockerFileDir>docker-files</dockerFileDir>
- <dockerFile>Dockerfile.so-app</dockerFile>
- <tags>
- <tag>${project.version}</tag>
- <tag>${project.version}-${maven.build.timestamp}</tag>
- <tag>${project.docker.latesttag.version}</tag>
- </tags>
- <assembly>
- <inline>
- <dependencySets>
- <dependencySet>
- <includes>
- <include>org.onap.so:mso-api-handler-infra</include>
- </includes>
- <outputFileNameMapping>app.jar</outputFileNameMapping>
- </dependencySet>
- </dependencySets>
- </inline>
- </assembly>
- </build>
- </image>
- <image>
- <name>${docker.image.prefix}/so-monitoring</name>
- <build>
- <cleanup>try</cleanup>
- <dockerFileDir>docker-files</dockerFileDir>
- <dockerFile>Dockerfile.so-app</dockerFile>
- <tags>
- <tag>${project.version}</tag>
- <tag>${project.version}-${maven.build.timestamp}</tag>
- <tag>${project.docker.latesttag.version}</tag>
- </tags>
- <assembly>
- <inline>
- <dependencySets>
- <dependencySet>
- <includes>
- <include>org.onap.so.monitoring:so-monitoring-service</include>
- </includes>
- <outputFileNameMapping>app.jar</outputFileNameMapping>
- </dependencySet>
- </dependencySets>
- </inline>
- </assembly>
- </build>
- </image>
- <image>
- <name>${docker.image.prefix}/so-simulator</name>
- <build>
- <cleanup>try</cleanup>
- <dockerFileDir>docker-files</dockerFileDir>
- <dockerFile>Dockerfile.so-app</dockerFile>
- <tags>
- <tag>${project.version}</tag>
- <tag>${project.version}-${maven.build.timestamp}</tag>
- <tag>${project.docker.latesttag.version}</tag>
- </tags>
- <assembly>
- <inline>
- <dependencySets>
- <dependencySet>
- <includes>
- <include>org.onap.so:so-simulator</include>
- </includes>
- <outputFileNameMapping>app.jar</outputFileNameMapping>
- </dependencySet>
- </dependencySets>
- </inline>
- </assembly>
- </build>
- </image>
- </images>
- </configuration>
+ <images>
+ <image>
+ <name>${docker.image.prefix}/base-image:1.0</name>
+ <build>
+ <cleanup>try</cleanup>
+ <dockerFileDir>docker-files</dockerFileDir>
+ <dockerFile>Dockerfile.so-base-image</dockerFile>
+ </build>
+ </image>
+ <image>
+ <name>${docker.image.prefix}/vnfm-adapter</name>
+ <build>
+ <cleanup>try</cleanup>
+ <dockerFileDir>docker-files</dockerFileDir>
+ <dockerFile>Dockerfile.so-app</dockerFile>
+ <tags>
+ <tag>${project.version}</tag>
+ <tag>${project.version}-${maven.build.timestamp}</tag>
+ <tag>${project.docker.latesttag.version}</tag>
+ </tags>
+ <assembly>
+ <inline>
+ <dependencySets>
+ <dependencySet>
+ <includes>
+ <include>org.onap.so.adapters:mso-vnfm-etsi-adapter</include>
+ </includes>
+ <outputFileNameMapping>app.jar</outputFileNameMapping>
+ </dependencySet>
+ </dependencySets>
+ </inline>
+ </assembly>
+ </build>
+ </image>
+ <image>
+ <name>${docker.image.prefix}/ve-vnfm-adapter</name>
+ <build>
+ <cleanup>try</cleanup>
+ <dockerFileDir>docker-files</dockerFileDir>
+ <dockerFile>Dockerfile.so-app</dockerFile>
+ <tags>
+ <tag>${project.version}</tag>
+ <tag>${project.version}-${maven.build.timestamp}</tag>
+ <tag>${project.docker.latesttag.version}</tag>
+ </tags>
+ <assembly>
+ <inline>
+ <dependencySets>
+ <dependencySet>
+ <includes>
+ <include>org.onap.so.adapters:mso-ve-vnfm-adapter</include>
+ </includes>
+ <outputFileNameMapping>app.jar</outputFileNameMapping>
+ </dependencySet>
+ </dependencySets>
+ </inline>
+ </assembly>
+ </build>
+ </image>
+ <image>
+ <name>${docker.image.prefix}/catalog-db-adapter</name>
+ <build>
+ <cleanup>try</cleanup>
+ <dockerFileDir>docker-files</dockerFileDir>
+ <dockerFile>Dockerfile.so-app</dockerFile>
+ <tags>
+ <tag>${project.version}</tag>
+ <tag>${project.version}-${maven.build.timestamp}</tag>
+ <tag>${project.docker.latesttag.version}</tag>
+ </tags>
+ <assembly>
+ <inline>
+ <dependencySets>
+ <dependencySet>
+ <includes>
+ <include>org.onap.so.adapters:mso-catalog-db-adapter</include>
+ </includes>
+ <outputFileNameMapping>app.jar</outputFileNameMapping>
+ </dependencySet>
+ </dependencySets>
+ </inline>
+ </assembly>
+ </build>
+ </image>
+ <image>
+ <name>${docker.image.prefix}/request-db-adapter</name>
+ <build>
+ <cleanup>try</cleanup>
+ <dockerFileDir>docker-files</dockerFileDir>
+ <dockerFile>Dockerfile.so-app</dockerFile>
+ <tags>
+ <tag>${project.version}</tag>
+ <tag>${project.version}-${maven.build.timestamp}</tag>
+ <tag>${project.docker.latesttag.version}</tag>
+ </tags>
+ <assembly>
+ <inline>
+ <dependencySets>
+ <dependencySet>
+ <includes>
+ <include>org.onap.so.adapters:mso-requests-db-adapter</include>
+ </includes>
+ <outputFileNameMapping>app.jar</outputFileNameMapping>
+ </dependencySet>
+ </dependencySets>
+ </inline>
+ </assembly>
+ </build>
+ </image>
+ <image>
+ <name>${docker.image.prefix}/sdnc-adapter</name>
+ <build>
+ <cleanup>try</cleanup>
+ <dockerFileDir>docker-files</dockerFileDir>
+ <dockerFile>Dockerfile.so-app</dockerFile>
+ <tags>
+ <tag>${project.version}</tag>
+ <tag>${project.version}-${maven.build.timestamp}</tag>
+ <tag>${project.docker.latesttag.version}</tag>
+ </tags>
+ <assembly>
+ <inline>
+ <dependencySets>
+ <dependencySet>
+ <includes>
+ <include>org.onap.so:mso-sdnc-adapter</include>
+ </includes>
+ <outputFileNameMapping>app.jar</outputFileNameMapping>
+ </dependencySet>
+ </dependencySets>
+ </inline>
+ </assembly>
+ </build>
+ </image>
+ <image>
+ <name>${docker.image.prefix}/openstack-adapter</name>
+ <build>
+ <cleanup>try</cleanup>
+ <dockerFileDir>docker-files</dockerFileDir>
+ <dockerFile>Dockerfile.so-app</dockerFile>
+ <tags>
+ <tag>${project.version}</tag>
+ <tag>${project.version}-${maven.build.timestamp}</tag>
+ <tag>${project.docker.latesttag.version}</tag>
+ </tags>
+ <assembly>
+ <inline>
+ <dependencySets>
+ <dependencySet>
+ <includes>
+ <include>org.onap.so:mso-openstack-adapters</include>
+ </includes>
+ <outputFileNameMapping>app.jar</outputFileNameMapping>
+ </dependencySet>
+ </dependencySets>
+ </inline>
+ </assembly>
+ </build>
+ </image>
+ <image>
+ <name>${docker.image.prefix}/vfc-adapter</name>
+ <build>
+ <cleanup>try</cleanup>
+ <dockerFileDir>docker-files</dockerFileDir>
+ <dockerFile>Dockerfile.so-app</dockerFile>
+ <tags>
+ <tag>${project.version}</tag>
+ <tag>${project.version}-${maven.build.timestamp}</tag>
+ <tag>${project.docker.latesttag.version}</tag>
+ </tags>
+ <assembly>
+ <inline>
+ <dependencySets>
+ <dependencySet>
+ <includes>
+ <include>org.onap.so.adapters:mso-vfc-adapter</include>
+ </includes>
+ <outputFileNameMapping>app.jar</outputFileNameMapping>
+ </dependencySet>
+ </dependencySets>
+ </inline>
+ </assembly>
+ </build>
+ </image>
+ <image>
+ <name>${docker.image.prefix}/so-appc-orchestrator</name>
+ <build>
+ <cleanup>try</cleanup>
+ <dockerFileDir>docker-files</dockerFileDir>
+ <dockerFile>Dockerfile.so-app</dockerFile>
+ <tags>
+ <tag>${project.version}</tag>
+ <tag>${project.version}-${maven.build.timestamp}</tag>
+ <tag>${project.docker.latesttag.version}</tag>
+ </tags>
+ <assembly>
+ <inline>
+ <dependencySets>
+ <dependencySet>
+ <includes>
+ <include>org.onap.so.adapters:so-appc-orchestrator</include>
+ </includes>
+ <outputFileNameMapping>app.jar</outputFileNameMapping>
+ </dependencySet>
+ </dependencySets>
+ </inline>
+ </assembly>
+ </build>
+ </image>
+ <image>
+ <name>${docker.image.prefix}/sdc-controller</name>
+ <build>
+ <cleanup>try</cleanup>
+ <dockerFileDir>docker-files</dockerFileDir>
+ <dockerFile>Dockerfile.so-app</dockerFile>
+ <tags>
+ <tag>${project.version}</tag>
+ <tag>${project.version}-${maven.build.timestamp}</tag>
+ <tag>${project.docker.latesttag.version}</tag>
+ </tags>
+ <assembly>
+ <inline>
+ <dependencySets>
+ <dependencySet>
+ <includes>
+ <include>org.onap.so:asdc-controller</include>
+ </includes>
+ <outputFileNameMapping>app.jar</outputFileNameMapping>
+ </dependencySet>
+ </dependencySets>
+ </inline>
+ </assembly>
+ </build>
+ </image>
+ <image>
+ <name>${docker.image.prefix}/bpmn-infra</name>
+ <build>
+ <cleanup>try</cleanup>
+ <dockerFileDir>docker-files</dockerFileDir>
+ <dockerFile>Dockerfile.so-app</dockerFile>
+ <tags>
+ <tag>${project.version}</tag>
+ <tag>${project.version}-${maven.build.timestamp}</tag>
+ <tag>${project.docker.latesttag.version}</tag>
+ </tags>
+ <assembly>
+ <inline>
+ <dependencySets>
+ <dependencySet>
+ <includes>
+ <include>org.onap.so:mso-infrastructure-bpmn</include>
+ </includes>
+ <outputFileNameMapping>app.jar</outputFileNameMapping>
+ </dependencySet>
+ </dependencySets>
+ </inline>
+ </assembly>
+ </build>
+ </image>
+ <image>
+ <name>${docker.image.prefix}/api-handler-infra</name>
+ <build>
+ <cleanup>try</cleanup>
+ <dockerFileDir>docker-files</dockerFileDir>
+ <dockerFile>Dockerfile.so-app</dockerFile>
+ <tags>
+ <tag>${project.version}</tag>
+ <tag>${project.version}-${maven.build.timestamp}</tag>
+ <tag>${project.docker.latesttag.version}</tag>
+ </tags>
+ <assembly>
+ <inline>
+ <dependencySets>
+ <dependencySet>
+ <includes>
+ <include>org.onap.so:mso-api-handler-infra</include>
+ </includes>
+ <outputFileNameMapping>app.jar</outputFileNameMapping>
+ </dependencySet>
+ </dependencySets>
+ </inline>
+ </assembly>
+ </build>
+ </image>
+ <image>
+ <name>${docker.image.prefix}/so-monitoring</name>
+ <build>
+ <cleanup>try</cleanup>
+ <dockerFileDir>docker-files</dockerFileDir>
+ <dockerFile>Dockerfile.so-app</dockerFile>
+ <tags>
+ <tag>${project.version}</tag>
+ <tag>${project.version}-${maven.build.timestamp}</tag>
+ <tag>${project.docker.latesttag.version}</tag>
+ </tags>
+ <assembly>
+ <inline>
+ <dependencySets>
+ <dependencySet>
+ <includes>
+ <include>org.onap.so.monitoring:so-monitoring-service</include>
+ </includes>
+ <outputFileNameMapping>app.jar</outputFileNameMapping>
+ </dependencySet>
+ </dependencySets>
+ </inline>
+ </assembly>
+ </build>
+ </image>
+ <image>
+ <name>${docker.image.prefix}/so-simulator</name>
+ <build>
+ <cleanup>try</cleanup>
+ <dockerFileDir>docker-files</dockerFileDir>
+ <dockerFile>Dockerfile.so-app</dockerFile>
+ <tags>
+ <tag>${project.version}</tag>
+ <tag>${project.version}-${maven.build.timestamp}</tag>
+ <tag>${project.docker.latesttag.version}</tag>
+ </tags>
+ <assembly>
+ <inline>
+ <dependencySets>
+ <dependencySet>
+ <includes>
+ <include>org.onap.so.simulator:so-simulator</include>
+ </includes>
+ <outputFileNameMapping>app.jar</outputFileNameMapping>
+ </dependencySet>
+ </dependencySets>
+ </inline>
+ </assembly>
+ </build>
+ </image>
+ </images>
+ </configuration>
- <executions>
- <execution>
- <id>clean-images</id>
- <phase>pre-clean</phase>
- <goals>
- <goal>remove</goal>
- </goals>
- <configuration>
- <removeAll>true</removeAll>
- </configuration>
- </execution>
+ <executions>
+ <execution>
+ <id>clean-images</id>
+ <phase>pre-clean</phase>
+ <goals>
+ <goal>remove</goal>
+ </goals>
+ <configuration>
+ <removeAll>true</removeAll>
+ </configuration>
+ </execution>
- <execution>
- <id>generate-images</id>
- <phase>generate-sources</phase>
- <goals>
- <goal>build</goal>
- </goals>
- </execution>
+ <execution>
+ <id>generate-images</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>build</goal>
+ </goals>
+ </execution>
- <execution>
- <id>push-images</id>
- <phase>${docker.push.phase}</phase>
- <goals>
- <goal>build</goal>
- <goal>push</goal>
- </goals>
- <configuration>
- <image>${docker.image.prefix}/catalog-db-adapter,${docker.image.prefix}/request-db-adapter,${docker.image.prefix}/sdnc-adapter,${docker.image.prefix}/openstack-adapter,${docker.image.prefix}/vfc-adapter,${docker.image.prefix}/sdc-controller,${docker.image.prefix}/bpmn-infra,${docker.image.prefix}/api-handler-infra,${docker.image.prefix}/so-monitoring,${docker.image.prefix}/so-simulator</image>
- </configuration>
- </execution>
- </executions>
- </plugin>
+ <execution>
+ <id>push-images</id>
+ <phase>${docker.push.phase}</phase>
+ <goals>
+ <goal>build</goal>
+ <goal>push</goal>
+ </goals>
+ <configuration>
+ <image>${docker.image.prefix}/catalog-db-adapter,${docker.image.prefix}/request-db-adapter,${docker.image.prefix}/sdnc-adapter,${docker.image.prefix}/openstack-adapter,${docker.image.prefix}/vfc-adapter,${docker.image.prefix}/sdc-controller,${docker.image.prefix}/bpmn-infra,${docker.image.prefix}/api-handler-infra,${docker.image.prefix}/so-monitoring,${docker.image.prefix}/so-simulator</image>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-deploy-plugin</artifactId>
- <version>2.8</version>
- <configuration>
- <skip>true</skip>
- </configuration>
- </plugin>
- </plugins>
- </build>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-deploy-plugin</artifactId>
+ <version>2.8</version>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
- <dependencies>
- <dependency>
- <groupId>org.onap.so.adapters</groupId>
- <artifactId>mso-vnfm-etsi-adapter</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.so.adapters</groupId>
- <artifactId>mso-catalog-db-adapter</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.so.adapters</groupId>
- <artifactId>mso-requests-db-adapter</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.so</groupId>
- <artifactId>mso-sdnc-adapter</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.so</groupId>
- <artifactId>mso-openstack-adapters</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.so.adapters</groupId>
- <artifactId>mso-vfc-adapter</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.so.adapters</groupId>
- <artifactId>so-appc-orchestrator</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.so</groupId>
- <artifactId>asdc-controller</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.so</groupId>
- <artifactId>mso-infrastructure-bpmn</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.so</groupId>
- <artifactId>mso-api-handler-infra</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.so.monitoring</groupId>
- <artifactId>so-monitoring-service</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.so</groupId>
- <artifactId>so-simulator</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
+ <dependencies>
+ <dependency>
+ <groupId>org.onap.so.adapters</groupId>
+ <artifactId>mso-vnfm-etsi-adapter</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.so.adapters</groupId>
+ <artifactId>mso-ve-vnfm-adapter</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.so.adapters</groupId>
+ <artifactId>mso-catalog-db-adapter</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.so.adapters</groupId>
+ <artifactId>mso-requests-db-adapter</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.so</groupId>
+ <artifactId>mso-sdnc-adapter</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.so</groupId>
+ <artifactId>mso-openstack-adapters</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.so.adapters</groupId>
+ <artifactId>mso-vfc-adapter</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.so.adapters</groupId>
+ <artifactId>so-appc-orchestrator</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.so</groupId>
+ <artifactId>asdc-controller</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.so</groupId>
+ <artifactId>mso-infrastructure-bpmn</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.so</groupId>
+ <artifactId>mso-api-handler-infra</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.so.monitoring</groupId>
+ <artifactId>so-monitoring-service</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.so.simulator</groupId>
+ <artifactId>so-simulator</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
</project>
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
diff --git a/pom.xml b/pom.xml
index 9f453d4ee8..0955338a4e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -32,8 +32,8 @@
<module>cloudify-client</module>
<module>cxf-logging</module>
<module>so-monitoring</module>
- <module>packages</module>
<module>so-simulator</module>
+ <module>packages</module>
</modules>
<properties>
<project.mso.base.folder>.</project.mso.base.folder>
@@ -42,12 +42,12 @@
<sonar.language>java</sonar.language>
<sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
<sonar.surefire.reportsPath>${project.build.directory}/surefire-reports</sonar.surefire.reportsPath>
- <sonar.jacoco.reportPath>${project.build.directory}/code-coverage/jacoco-ut.exec</sonar.jacoco.reportPath>
+ <sonar.coverage.jacoco.xmlReportPaths>${project.reporting.outputDirectory}/jacoco-ut/jacoco.xml</sonar.coverage.jacoco.xmlReportPaths>
<!--sonar.jacoco.itReportPath>${project.mso.base.folder}/packages/arquillian-unit-tests/target/mso-automated-tests/jacoco-it.exec</sonar.jacoco.itReportPath -->
<sonar.jacoco.reportMissing.force.zero>true</sonar.jacoco.reportMissing.force.zero>
<sonar.projectVersion>${project.version}</sonar.projectVersion>
<sonar.cpd.exclusions>**/*</sonar.cpd.exclusions>
- <jacoco.version>0.7.5.201505241946</jacoco.version>
+ <jacoco.version>0.8.5</jacoco.version>
<org.apache.maven.user-settings />
<openstack.version>1.5.1</openstack.version>
<maven.build.timestamp.format>yyyyMMdd'T'HHmm</maven.build.timestamp.format>
@@ -337,24 +337,28 @@
</configuration>
</plugin>
<plugin>
- <groupId>org.jacoco</groupId>
- <artifactId>jacoco-maven-plugin</artifactId>
- <version>${jacoco.version}</version>
- <executions>
- <execution>
- <id>default-prepare-agent</id>
- <goals>
- <goal>prepare-agent</goal>
- </goals>
- </execution>
- <execution>
- <id>default-report</id>
- <goals>
- <goal>report</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
+ <groupId>org.jacoco</groupId>
+ <artifactId>jacoco-maven-plugin</artifactId>
+ <version>${jacoco.version}</version>
+ <executions>
+ <execution>
+ <id>prepare-agent</id>
+ <goals>
+ <goal>prepare-agent</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>report</id>
+ <goals>
+ <goal>report</goal>
+ </goals>
+ <configuration>
+ <dataFile>${project.build.directory}/code-coverage/jacoco.exec</dataFile>
+ <outputDirectory>${project.reporting.outputDirectory}/jacoco-ut</outputDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>license-maven-plugin</artifactId>