aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn')
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/DecomposeServiceTest.groovy76
-rw-r--r--bpmn/MSOCommonBPMN/src/test/resources/__files/decomposition/catalogDbResponse.json33
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceDecomposition.java2
-rw-r--r--bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/ServiceDecompositionTest.java2
-rw-r--r--bpmn/MSOCoreBPMN/src/test/resources/json-examples/ServiceDecompositionExpected.json108
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java7
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java12
7 files changed, 186 insertions, 54 deletions
diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/DecomposeServiceTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/DecomposeServiceTest.groovy
new file mode 100644
index 0000000000..5deec5b434
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/DecomposeServiceTest.groovy
@@ -0,0 +1,76 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. 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.bpmn.common.scripts
+
+import org.junit.Before
+import org.mockito.MockitoAnnotations
+import org.onap.so.bpmn.core.domain.ModelInfo
+import org.onap.so.bpmn.core.domain.NetworkResource
+import org.onap.so.bpmn.core.domain.ServiceDecomposition
+import org.onap.so.bpmn.core.json.DecomposeJsonUtil
+import org.onap.so.bpmn.core.domain.ServiceInstance
+
+import org.onap.so.bpmn.mock.FileUtil
+import static org.mockito.Mockito.*
+import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
+import static org.junit.Assert.*;
+import org.junit.Test;
+import static com.shazam.shazamcrest.MatcherAssert.assertThat;
+import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
+
+class DecomposeServiceTest {
+
+ @Test
+ public void testDecomposeService() {
+
+ String catalogDbResponse = FileUtil.readResourceFile("__files/decomposition/catalogDbResponse.json");
+
+ ServiceDecomposition serviceDecomposition = new ServiceDecomposition();
+ ServiceInstance serviceInstance = new ServiceInstance();
+ serviceInstance.setInstanceId("serviceInstanceID");
+ serviceDecomposition.setServiceType("");
+ serviceDecomposition.setServiceRole("");
+
+ ArrayList networkResources = new ArrayList();
+ NetworkResource networkResource = new NetworkResource();
+ networkResource.setNetworkType("testNetworkType");
+ networkResource.setNetworkRole("testNetworkRole");
+ networkResource.setNetworkScope("testNetworkScope");
+ networkResource.setToscaNodeType("testToscaModelType")
+ networkResource.setNetworkTechnology("testNetworkTechnology");
+ ModelInfo modelInfo = new ModelInfo();
+ modelInfo.setModelName("testModleName");
+ modelInfo.setModelUuid("testModelUuid")
+ modelInfo.setModelInvariantUuid("testModelInvariantId")
+ modelInfo.setModelVersion("testModelVersion");
+ modelInfo.setModelCustomizationUuid("testModelCustomizationUuid");
+ modelInfo.setModelInstanceName("testModelInstanceName");
+ networkResource.setModelInfo(modelInfo);
+
+ networkResources.add(networkResource);
+ serviceDecomposition.setNetworkResources(networkResources)
+ serviceDecomposition.setServiceInstance(serviceInstance);
+
+ ServiceDecomposition serviceDecompositionExtracted = DecomposeJsonUtil.jsonToServiceDecomposition(catalogDbResponse, "serviceInstanceID")
+
+ assertThat(serviceDecompositionExtracted, sameBeanAs(serviceDecomposition).ignoring("modelInfo").ignoring("vnfResources").ignoring("allottedResources").ignoring("networkResources.resourceId"));
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/decomposition/catalogDbResponse.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/decomposition/catalogDbResponse.json
new file mode 100644
index 0000000000..087233d08b
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/decomposition/catalogDbResponse.json
@@ -0,0 +1,33 @@
+{
+ "serviceResources": {
+ "serviceType": "",
+ "workloadContext": "testWorkloadContext",
+ "serviceAllottedResources": [],
+ "modelInfo": {
+ "modelInvariantUuid": "testModelInvariantId",
+ "modelName": "testModleName",
+ "modelVersion": "testModelVersion",
+ "modelUuid": "testModelUuid"
+ },
+ "environmentContext": "testEnvironmentContent",
+ "serviceRole": "",
+ "serviceVnfs": [],
+ "serviceNetworks": [
+ {
+ "toscaNodeType": "testToscaModelType",
+ "networkTechnology": "testNetworkTechnology",
+ "networkScope": "testNetworkScope",
+ "modelInfo": {
+ "modelInvariantUuid": "testModelInvariantId",
+ "modelName": "testModleName",
+ "modelVersion": "testModelVersion",
+ "modelCustomizationUuid": "testModelCustomizationUuid",
+ "modelInstanceName": "testModelInstanceName",
+ "modelUuid": "testModelUuid"
+ },
+ "networkRole": "testNetworkRole",
+ "networkType": "testNetworkType"
+ }
+ ]
+ }
+} \ No newline at end of file
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceDecomposition.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceDecomposition.java
index 099f084637..5e7a4796c4 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceDecomposition.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceDecomposition.java
@@ -69,7 +69,7 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
private OwningEntity owningEntity;
@JsonProperty("serviceVnfs")
private List <VnfResource> vnfResources;
- @JsonProperty("networkResource")
+ @JsonProperty("serviceNetworks")
private List <NetworkResource> networkResources;
@JsonProperty("serviceAllottedResources")
private List <AllottedResource> allottedResources;
diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/ServiceDecompositionTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/ServiceDecompositionTest.java
index 82470f125b..5d8d55152c 100644
--- a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/ServiceDecompositionTest.java
+++ b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/ServiceDecompositionTest.java
@@ -103,6 +103,8 @@ public class ServiceDecompositionTest {
serviceDecomp.addResource(allottedResource);
serviceDecomp.addResource(configResource);
+ System.out.println(serviceDecomp.toJsonString());
+
assertThat(serviceDecomp.getServiceResource(vnfResource.getResourceId()), sameBeanAs(vnfResource));
assertThat(serviceDecomp.getServiceResource(networkResource.getResourceId()), sameBeanAs(networkResource));
assertThat(serviceDecomp.getServiceResource(allottedResource.getResourceId()), sameBeanAs(allottedResource));
diff --git a/bpmn/MSOCoreBPMN/src/test/resources/json-examples/ServiceDecompositionExpected.json b/bpmn/MSOCoreBPMN/src/test/resources/json-examples/ServiceDecompositionExpected.json
index c424293ca2..f094e99782 100644
--- a/bpmn/MSOCoreBPMN/src/test/resources/json-examples/ServiceDecompositionExpected.json
+++ b/bpmn/MSOCoreBPMN/src/test/resources/json-examples/ServiceDecompositionExpected.json
@@ -1,51 +1,59 @@
{
- "serviceResources" : {
- "modelInfo" : {
- "modelName" : "modelName",
- "modelUuid" : "modelUuid",
- "modelInvariantUuid" : "modelInvariantUuid",
- "modelVersion" : "modelVersion",
- "modelCustomizationUuid" : "modelCustomizationUuid",
- "modelCustomizationName" : "modelCustomizationName",
- "modelInstanceName" : "modelInstanceName",
- "modelType" : "modelType"
- },
- "serviceType" : "serviceType",
- "serviceRole" : "serviceRole",
- "project" : {},
- "owningEntity" : {},
- "serviceInstance" : {
- "serviceInstanceId" : "serviceInstanceId"
- },
- "serviceVnfs" : [
- {
- "resourceId" : "vnfResourceId",
- "resourceType" : "VNF",
- "resourceInstance" : {},
- "homingSolution" : {
- "license" : {},
- "rehome" : false
- },
- "vfModules" : []
- }
- ],
- "networkResource" : [
- {
- "resourceId" : "networkResourceId",
- "resourceType" : "NETWORK"
- }
- ],
- "serviceAllottedResources" : [
- {
- "resourceId" : "allottedResourceId",
- "resourceType" : "ALLOTTED_RESOURCE"
- }
- ],
- "configResource" : [
- {
- "resourceId" : "configResourceId",
- "resourceType" : "CONFIGURATION"
- }
- ]
- }
-}
+ "serviceResources" : {
+ "serviceInstance" : {
+ "instanceId" : "serviceInstanceId",
+ "customer" : { }
+ },
+ "modelInfo" : {
+ "modelName" : "modelName",
+ "modelUuid" : "modelUuid",
+ "modelInvariantUuid" : "modelInvariantUuid",
+ "modelVersion" : "modelVersion",
+ "modelCustomizationUuid" : "modelCustomizationUuid",
+ "modelCustomizationName" : "modelCustomizationName",
+ "modelInstanceName" : "modelInstanceName",
+ "modelType" : "modelType"
+ },
+ "serviceType" : "serviceType",
+ "serviceRole" : "serviceRole",
+ "project" : { },
+ "owningEntity" : { },
+ "serviceVnfs" : [ {
+ "resourceId" : "vnfResourceId",
+ "resourceType" : "VNF",
+ "resourceInstance" : { },
+ "homingSolution" : {
+ "license" : { },
+ "rehome" : false
+ },
+ "vfModules" : [ ]
+ } ],
+ "serviceNetworks" : [ {
+ "resourceId" : "networkResourceId",
+ "resourceType" : "NETWORK",
+ "resourceInstance" : { },
+ "homingSolution" : {
+ "license" : { },
+ "rehome" : false
+ }
+ } ],
+ "serviceAllottedResources" : [ {
+ "resourceId" : "allottedResourceId",
+ "resourceType" : "ALLOTTED_RESOURCE",
+ "resourceInstance" : { },
+ "homingSolution" : {
+ "license" : { },
+ "rehome" : false
+ }
+ } ],
+ "configResource" : [ {
+ "resourceId" : "configResourceId",
+ "resourceType" : "CONFIGURATION",
+ "resourceInstance" : { },
+ "homingSolution" : {
+ "license" : { },
+ "rehome" : false
+ }
+ } ]
+ }
+} \ No newline at end of file
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 c6a63e1431..2e4a4d06bf 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
@@ -88,6 +88,7 @@ public class WorkflowAction {
private static final String VOLUMEGROUP = "VolumeGroup";
private static final String NETWORK = "Network";
private static final String NETWORKCOLLECTION = "NetworkCollection";
+ private static final String CONFIGURATION = "Configuration";
private static final String ASSIGNINSTANCE = "assignInstance";
private static final String CREATEINSTANCE = "createInstance";
private static final String USERPARAMSERVICE = "service";
@@ -802,6 +803,12 @@ public class WorkflowAction {
.collect(Collectors.toList()).get(i).getResourceId(), apiVersion, resourceId,
requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null));
}
+ } else if (orchFlow.getFlowName().contains(CONFIGURATION)) {
+ for (int i = 0; i < resourceCounter.stream().filter(x -> WorkflowType.CONFIGURATION == x.getResourceType()).collect(Collectors.toList()).size(); i++) {
+ flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resourceCounter.stream().filter(x -> WorkflowType.CONFIGURATION == x.getResourceType())
+ .collect(Collectors.toList()).get(i).getResourceId(), apiVersion, resourceId,
+ requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null));
+ }
} else {
flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, "", apiVersion, resourceId,
requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null));
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 283f8881c7..8de32eaba1 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
@@ -427,14 +427,20 @@ public class WorkflowActionTest extends BaseTaskTest {
orch12.setFlowName("ActivateVfModuleBB");
orchFlows.add(orch12);
OrchestrationFlow orch13 = new OrchestrationFlow();
- orch13.setFlowName("ActivateVnfBB");
+ orch13.setFlowName("AssignFabricConfigurationBB");
orchFlows.add(orch13);
OrchestrationFlow orch14 = new OrchestrationFlow();
- orch14.setFlowName("ActivateNetworkCollectionBB");
+ orch14.setFlowName("ActivateFabricConfigurationBB");
orchFlows.add(orch14);
OrchestrationFlow orch15 = new OrchestrationFlow();
- orch15.setFlowName("ActivateServiceInstanceBB");
+ orch15.setFlowName("ActivateVnfBB");
orchFlows.add(orch15);
+ OrchestrationFlow orch16 = new OrchestrationFlow();
+ orch16.setFlowName("ActivateNetworkCollectionBB");
+ orchFlows.add(orch16);
+ OrchestrationFlow orch17 = new OrchestrationFlow();
+ orch17.setFlowName("ActivateServiceInstanceBB");
+ orchFlows.add(orch17);
Service service = new Service();
doReturn(service).when(catalogDbClient).getServiceByID("3c40d244-808e-42ca-b09a-256d83d19d0a");