aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java16
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowProcessorException.java19
-rw-r--r--bpmn/att-services-bpmn/src/test/resources/__files/dhv/DHVChangeSpeed/getPInterface.json19
-rw-r--r--bpmn/att-services-bpmn/src/test/resources/__files/dhv/DHVChangeSpeed/getPInterfaces.json42
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResource.java7
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java18
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResourceExceptionHandlingTest.java78
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateVfModuleBB.bpmn2
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateVolumeGroupBB.bpmn2
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java7
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java3
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java1
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java26
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiVfModuleBaseMap.json12
18 files changed, 177 insertions, 87 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
index b5203c676a..67fb6a6f37 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
@@ -346,13 +346,15 @@ public class BBInputSetup implements JavaDelegate {
ModelInfo vnfModelInfo = new ModelInfo();
vnfModelInfo.setModelCustomizationUuid(vnfModelCustomizationUUID);
this.mapCatalogVnf(tempVnf, vnfModelInfo, service);
- for(VolumeGroup volumeGroup : tempVnf.getVolumeGroups()) {
- String volumeGroupCustId =
- this.bbInputSetupUtils.getAAIVolumeGroup(CLOUD_OWNER,
- cloudConfiguration.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId()).getModelCustomizationId();
- if(modelInfo.getModelCustomizationId().equalsIgnoreCase(volumeGroupCustId)) {
- lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, volumeGroup.getVolumeGroupId());
- break;
+ if (lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID) == null) {
+ for(VolumeGroup volumeGroup : tempVnf.getVolumeGroups()) {
+ String volumeGroupCustId =
+ this.bbInputSetupUtils.getAAIVolumeGroup(CLOUD_OWNER,
+ cloudConfiguration.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId()).getModelCustomizationId();
+ if(modelInfo.getModelCustomizationId().equalsIgnoreCase(volumeGroupCustId)) {
+ lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, volumeGroup.getVolumeGroupId());
+ break;
+ }
}
}
break;
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowProcessorException.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowProcessorException.java
new file mode 100644
index 0000000000..768bee578c
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowProcessorException.java
@@ -0,0 +1,19 @@
+package org.openecomp.mso.bpmn.common.workflow.service;
+
+import org.onap.so.bpmn.common.workflow.context.WorkflowResponse;
+
+/**
+ * Exception thrown when an error occurs while processing the workflow.
+ * This encapsulates the workflow response so that the same can be sent back to api handler.
+ */
+public class WorkflowProcessorException extends RuntimeException {
+ WorkflowResponse workflowResponse;
+
+ public WorkflowProcessorException(WorkflowResponse workflowResponse) {
+ this.workflowResponse = workflowResponse;
+ }
+
+ public WorkflowResponse getWorkflowResponse() {
+ return workflowResponse;
+ }
+}
diff --git a/bpmn/att-services-bpmn/src/test/resources/__files/dhv/DHVChangeSpeed/getPInterface.json b/bpmn/att-services-bpmn/src/test/resources/__files/dhv/DHVChangeSpeed/getPInterface.json
deleted file mode 100644
index b8c123eb15..0000000000
--- a/bpmn/att-services-bpmn/src/test/resources/__files/dhv/DHVChangeSpeed/getPInterface.json
+++ /dev/null
@@ -1,19 +0,0 @@
-{
- "interface-name": "Xe-7/1/10",
- "port-description": "VVIG EGRESS",
- "resource-version": "1494002035673",
- "relationship-list": {
- "relationship": [
- {
- "related-to": "physical-link",
- "related-link": "/aai/v11/network/physical-links/physical-link/testPhysicalLinkUcpe",
- "relationship-data": [
- {
- "relationship-key": "physical-link.link-name",
- "relationship-value": "L4YS.999964..ATI_EGRESS"
- }
- ]
- }
- ]
- }
-}
diff --git a/bpmn/att-services-bpmn/src/test/resources/__files/dhv/DHVChangeSpeed/getPInterfaces.json b/bpmn/att-services-bpmn/src/test/resources/__files/dhv/DHVChangeSpeed/getPInterfaces.json
deleted file mode 100644
index 9ea3869121..0000000000
--- a/bpmn/att-services-bpmn/src/test/resources/__files/dhv/DHVChangeSpeed/getPInterfaces.json
+++ /dev/null
@@ -1,42 +0,0 @@
-{
- "p-interface": [
- {
- "interface-name": "Xe-7/1/10",
- "port-description": "VVIG EGRESS",
- "resource-version": "1494002035673",
- "relationship-list": {
- "relationship": [
- {
- "related-to": "physical-link",
- "related-link": "/aai/v11/network/physical-links/physical-link/testPhysicalLinkUcpe",
- "relationship-data": [
- {
- "relationship-key": "physical-link.link-name",
- "relationship-value": "L4YS.999964..ATI_EGRESS"
- }
- ]
- }
- ]
- }
- },
- {
- "interface-name": "Xe-8/2/11",
- "port-description": "VVIG EGRESS",
- "resource-version": "1494002035673",
- "relationship-list": {
- "relationship": [
- {
- "related-to": "physical-link",
- "related-link": "/aai/v11/network/physical-links/physical-link/testPhysicalLinkUcpe2",
- "relationship-data": [
- {
- "relationship-key": "physical-link.link-name",
- "relationship-value": "L4YS.999964..ATI_EGRESS"
- }
- ]
- }
- ]
- }
- }
- ]
-} \ No newline at end of file
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResource.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResource.java
index cfd07d8c39..ef72149d10 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResource.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResource.java
@@ -40,6 +40,7 @@ import org.onap.so.bpmn.common.workflow.context.WorkflowContext;
import org.onap.so.bpmn.common.workflow.context.WorkflowContextHolder;
import org.onap.so.bpmn.common.workflow.context.WorkflowResponse;
import org.onap.so.logger.MsoLogger;
+import org.openecomp.mso.bpmn.common.workflow.service.WorkflowProcessorException;
import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -92,7 +93,6 @@ public class WorkflowAsyncResource extends ProcessEngineAwareService {
/**
* Asynchronous JAX-RS method that starts a process instance.
- * @param asyncResponse an object that will receive the asynchronous response
* @param processKey the process key
* @param variableMap input variables to the process
* @return
@@ -114,7 +114,10 @@ public class WorkflowAsyncResource extends ProcessEngineAwareService {
processor.startProcess(processKey, variableMap);
WorkflowResponse response = waitForResponse(getRequestId(inputVariables));
return Response.status(202).entity(response).build();
- } catch (Exception e) {
+ } catch (WorkflowProcessorException e) {
+ WorkflowResponse response = e.getWorkflowResponse();
+ return Response.status(500).entity(response).build();
+ }catch (Exception e) {
WorkflowResponse response = buildUnkownError(getRequestId(inputVariables),e.getMessage());
return Response.status(500).entity(response).build();
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java
index edc05afba2..da24ba14fd 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java
@@ -28,11 +28,10 @@ import java.util.UUID;
import org.camunda.bpm.engine.RuntimeService;
import org.camunda.bpm.engine.runtime.ProcessInstance;
import org.camunda.bpm.engine.variable.impl.VariableMapImpl;
-import org.onap.so.bpmn.common.workflow.context.WorkflowCallbackResponse;
-import org.onap.so.bpmn.common.workflow.context.WorkflowContextHolder;
+import org.onap.so.bpmn.common.workflow.context.WorkflowResponse;
import org.onap.so.logger.MsoLogger;
+import org.openecomp.mso.bpmn.common.workflow.service.WorkflowProcessorException;
import org.slf4j.MDC;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
@@ -79,13 +78,12 @@ public class WorkflowProcessor extends ProcessEngineAwareService {
msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError,
logMarker + "Error in starting the process: " + e.getMessage());
- WorkflowCallbackResponse callbackResponse = new WorkflowCallbackResponse();
- callbackResponse.setStatusCode(500);
- callbackResponse.setMessage("Fail");
- callbackResponse.setResponse("Error occurred while executing the process: " + e);
-
- WorkflowContextHolder.getInstance().processCallback(processKey, processInstanceId,
- getRequestId(inputVariables), callbackResponse);
+ WorkflowResponse workflowResponse = new WorkflowResponse();
+ workflowResponse.setResponse("Error occurred while executing the process: " + e);
+ workflowResponse.setProcessInstanceID(processInstanceId);
+ workflowResponse.setMessageCode(500);
+ workflowResponse.setMessage("Fail");
+ throw new WorkflowProcessorException(workflowResponse);
}
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResourceExceptionHandlingTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResourceExceptionHandlingTest.java
new file mode 100644
index 0000000000..ff5e18c210
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResourceExceptionHandlingTest.java
@@ -0,0 +1,78 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 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.workflow.service;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+import javax.ws.rs.core.Response;
+
+import org.camunda.bpm.engine.test.Deployment;
+import org.camunda.bpm.engine.variable.impl.VariableMapImpl;
+import org.junit.Test;
+import org.onap.so.bpmn.common.workflow.context.WorkflowResponse;
+
+
+public class WorkflowAsyncResourceExceptionHandlingTest {
+
+ @Test
+ @Deployment(resources = { "testAsyncResource.bpmn" })
+ public void asyncRequestSuccess() throws InterruptedException {
+ VariableMapImpl variableMap = new VariableMapImpl();
+
+ Map<String, Object> variableValueType = new HashMap<>();
+
+ Map<String, Object> requestMsg = new HashMap<>();
+ requestMsg.put("value", "");
+ requestMsg.put("type", "String");
+
+ Map<String, Object> msorequestId = new HashMap<>();
+ msorequestId.put("type", "String");
+ msorequestId.put("value",UUID.randomUUID().toString());
+
+ Map<String, Object> timeout = new HashMap<>();
+ timeout.put("type", "String");
+ timeout.put("value","5");
+
+ variableValueType.put("testAsyncRequestMsg", requestMsg);
+ variableValueType.put("mso-request-id", msorequestId);
+ variableValueType.put("mso-service-request-timeout", timeout);
+
+ variableMap.put("variables", variableValueType);
+ WorkflowAsyncResource workflowAsyncResource = new WorkflowAsyncResource();
+ workflowAsyncResource.setProcessor(new WorkflowProcessor());
+ Response res = workflowAsyncResource.startProcessInstanceByKey("randomKey", variableMap);
+ assertEquals(500,res.getStatus());
+ WorkflowResponse workflowResponse = (WorkflowResponse)res.getEntity();
+ assertNotNull(workflowResponse);
+ assertEquals(500, workflowResponse.getMessageCode());
+ assertTrue(workflowResponse.getResponse().startsWith("Error occurred while executing the process:"));
+ assertEquals("Fail", workflowResponse.getMessage());
+
+
+ }
+
+}
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateVfModuleBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateVfModuleBB.bpmn
index abc017c957..bd24eeaed7 100644
--- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateVfModuleBB.bpmn
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateVfModuleBB.bpmn
@@ -29,7 +29,7 @@
<camunda:in source="gBuildingBlockExecution" target="gBuildingBlockExecution" />
<camunda:out source="WorkflowException" target="WorkflowException" />
<camunda:in source="VNFREST_Request" target="VNFREST_Request" />
- <camunda:out source="gBuildingBlockExecution" target="gBuildingBlockExecution" />
+ <camunda:out source="heatStackId" target="heatStackId" />
</bpmn:extensionElements>
<bpmn:incoming>SequenceFlow_16g4dz0</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_0ecr393</bpmn:outgoing>
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateVolumeGroupBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateVolumeGroupBB.bpmn
index a95dc9ce73..ffe74d1295 100644
--- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateVolumeGroupBB.bpmn
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateVolumeGroupBB.bpmn
@@ -28,7 +28,7 @@
<camunda:in source="gBuildingBlockExecution" target="gBuildingBlockExecution" />
<camunda:out source="WorkflowException" target="WorkflowException" />
<camunda:in source="VNFREST_Request" target="VNFREST_Request" />
- <camunda:out source="gBuildingBlockExecution" target="gBuildingBlockExecution" />
+ <camunda:out source="heatStackId" target="heatStackId" />
</bpmn:extensionElements>
<bpmn:incoming>SequenceFlow_0kfkpbh</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_06flg6h</bpmn:outgoing>
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn
index 07d0b18938..832a96cae7 100644
--- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn
@@ -24,7 +24,7 @@
<camunda:out source="WorkflowException" target="WorkflowException" />
<camunda:in source="deleteVfModuleRequest" target="deleteVfModuleRequest" />
<camunda:in source="VNFREST_Request" target="VNFREST_Request" />
- <camunda:out source="gBuildingBlockExecution" target="gBuildingBlockExecution" />
+ <camunda:out source="heatStackId" target="heatStackId" />
</bpmn:extensionElements>
<bpmn:incoming>SequenceFlow_08tvhtf</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_02lpx87</bpmn:outgoing>
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java
index 9c1fba62e9..b059a77641 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java
@@ -144,9 +144,11 @@ public class AAIUpdateTasks {
public void updateHeatStackIdVolumeGroup(BuildingBlockExecution execution) {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+ String heatStackId = execution.getVariable("heatStackId");
VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID));
CloudRegion cloudRegion = gBBInput.getCloudRegion();
+ volumeGroup.setHeatStackId(heatStackId);
aaiVolumeGroupResources.updateHeatStackIdVolumeGroup(volumeGroup, cloudRegion);
} catch (Exception ex) {
@@ -296,8 +298,10 @@ public class AAIUpdateTasks {
public void updateHeatStackIdVfModule(BuildingBlockExecution execution) {
try {
+ String heatStackId = execution.getVariable("heatStackId");
VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ vfModule.setHeatStackId(heatStackId);
aaiVfModuleResources.updateHeatStackIdVfModule(vfModule, vnf);
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java
index 0b712452fd..554af37924 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java
@@ -65,6 +65,7 @@ public class VnfAdapterImpl {
execution.setVariable("isDebugLogEnabled", "true");
execution.setVariable("mso-request-id", gBBInput.getRequestContext().getMsoRequestId());
execution.setVariable("mso-service-instance-id", serviceInstance.getServiceInstanceId());
+ execution.setVariable("heatStackId", null);
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
@@ -80,23 +81,25 @@ public class VnfAdapterImpl {
String heatStackId = ((CreateVfModuleResponse) vnfRestResponse).getVfModuleStackId();
if(!StringUtils.isEmpty(heatStackId)) {
vfModule.setHeatStackId(heatStackId);
+ execution.setVariable("heatStackId", heatStackId);
}
} else if(vnfRestResponse instanceof DeleteVfModuleResponse) {
VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
Boolean vfModuleDelete = ((DeleteVfModuleResponse) vnfRestResponse).getVfModuleDeleted();
if(null!= vfModuleDelete && vfModuleDelete) {
vfModule.setHeatStackId(null);
+ execution.setVariable("heatStackId", null);
}
} else if(vnfRestResponse instanceof CreateVolumeGroupResponse) {
VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID));
String heatStackId = ((CreateVolumeGroupResponse) vnfRestResponse).getVolumeGroupStackId();
if(!StringUtils.isEmpty(heatStackId)) {
volumeGroup.setHeatStackId(heatStackId);
+ execution.setVariable("heatStackId", heatStackId);
}else{
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "HeatStackId is missing from create VolumeGroup Vnf Adapter response.");
}
- }
- execution.setVariable("generalBuildingBlock", execution.getGeneralBuildingBlock());
+ }
}
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
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 2e4a4d06bf..0fa0c69118 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
@@ -137,6 +137,7 @@ public class WorkflowAction {
RequestDetails requestDetails = sIRequest.getRequestDetails();
Resource resource = extractResourceIdAndTypeFromUri(uri);
WorkflowType resourceType = resource.getResourceType();
+ execution.setVariable("resourceName", resourceType.toString());
String resourceId = "";
if (resource.isGenerated()) {
resourceId = validateResourceIdInAAI(resource.getResourceId(), resourceType,
@@ -241,7 +242,7 @@ public class WorkflowAction {
}
if (resourceType == WorkflowType.SERVICE
&& (requestAction.equals(CREATEINSTANCE) || requestAction.equals(ASSIGNINSTANCE))
- && !resourceCounter.stream().filter(x -> VNF.equals(x.getResourceType())).collect(Collectors.toList()).isEmpty()) {
+ && !resourceCounter.stream().filter(x -> WorkflowType.VNF.equals(x.getResourceType())).collect(Collectors.toList()).isEmpty()) {
execution.setVariable("homing", true);
execution.setVariable("calledHoming", false);
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java
index 94dfdcc747..8661c8e91e 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java
@@ -96,6 +96,7 @@ public class AAIObjectMapper {
map().setModelInvariantId(source.getModelInfoVfModule().getModelInvariantUUID());
map().setModelVersionId(source.getModelInfoVfModule().getModelUUID());
map().setPersonaModelVersion(source.getModelInfoVfModule().getModelInvariantUUID());
+ map().setIsBaseVfModule(source.getModelInfoVfModule().getIsBaseBoolean());
}
});
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java
index c9433a6212..b45752957e 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java
@@ -204,11 +204,13 @@ public class AAIUpdateTasksTest extends BaseTaskTest{
@Test
public void updateHeatStackIdVfModuleTest() throws Exception {
+ execution.setVariable("heatStackId", "newHeatStackId");
doNothing().when(aaiVfModuleResources).updateHeatStackIdVfModule(vfModule, genericVnf);
aaiUpdateTasks.updateHeatStackIdVfModule(execution);
verify(aaiVfModuleResources, times(1)).updateHeatStackIdVfModule(vfModule, genericVnf);
+ assertEquals("newHeatStackId", vfModule.getHeatStackId());
}
@Test
@@ -270,11 +272,13 @@ public class AAIUpdateTasksTest extends BaseTaskTest{
}
@Test
public void updateHeatStackIdVolumeGroupTest() throws Exception {
+ execution.setVariable("heatStackId", "newHeatStackId");
doNothing().when(aaiVolumeGroupResources).updateHeatStackIdVolumeGroup(volumeGroup, cloudRegion);
aaiUpdateTasks.updateHeatStackIdVolumeGroup(execution);
verify(aaiVolumeGroupResources, times(1)).updateHeatStackIdVolumeGroup(volumeGroup, cloudRegion);
+ assertEquals("newHeatStackId", volumeGroup.getHeatStackId());
}
@Test
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 8de32eaba1..3869988c40 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
@@ -778,7 +778,7 @@ public class WorkflowActionTest extends BaseTaskTest {
assertEquals(UUID.randomUUID().toString().length(),ebbs.get(14).getWorkflowResourceIds().getVnfId().length());
assertEquals(ebbs.get(15).getBuildingBlock().getBpmnFlowName(),"ActivateServiceInstanceBB");
assertEquals(3,ebbs.get(0).getWorkflowResourceIds().getServiceInstanceId().length());
-
+ assertEquals(true, execution.getVariable("homing"));
}
@Test
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java
index 6edda44c0a..c3b0048e07 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java
@@ -245,6 +245,32 @@ public class AAIObjectMapperTest{
assertThat(reqMapper1, sameBeanAs(AAIVfModule));
}
+
+ @Test
+ public void vfModuleBaseMap() throws Exception {
+ VfModule vfModule = new VfModule();
+ vfModule.setVfModuleId("a");
+ vfModule.setVfModuleName("b");
+ vfModule.setOrchestrationStatus(OrchestrationStatus.ASSIGNED);
+ ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule();
+ modelInfoVfModule.setModelCustomizationUUID("f");
+ modelInfoVfModule.setModelInvariantUUID("g");
+ modelInfoVfModule.setModelUUID("h");
+ modelInfoVfModule.setIsBaseBoolean(true);
+ vfModule.setModelInfoVfModule(modelInfoVfModule);
+
+ org.onap.aai.domain.yang.VfModule AAIVfModule = aaiObjectMapper.mapVfModule(vfModule);
+
+ String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "aaiVfModuleBaseMap.json")));
+
+ ObjectMapper omapper = new ObjectMapper();
+ org.onap.aai.domain.yang.VfModule reqMapper1 = omapper.readValue(
+ jsonToCompare,
+ org.onap.aai.domain.yang.VfModule.class);
+
+ assertThat(reqMapper1, sameBeanAs(AAIVfModule));
+
+ }
@Test
public void testMapInstanceGroup() {
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiVfModuleBaseMap.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiVfModuleBaseMap.json
new file mode 100644
index 0000000000..9637e00fe1
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiVfModuleBaseMap.json
@@ -0,0 +1,12 @@
+{
+
+ "modelCustomizationId" : "f",
+ "vfModuleId" : "a",
+ "vfModuleName" : "b",
+ "modelInvariantId" : "g",
+ "modelVersionId" : "h",
+ "orchestrationStatus" : "Assigned",
+ "personaModelVersion" : "g",
+ "isBaseVfModule" : true
+
+} \ No newline at end of file