aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java33
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/AssignFlows.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java76
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java12
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java17
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationAction.java1
7 files changed, 86 insertions, 59 deletions
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java
index 5951fda16e..4617299f48 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java
@@ -107,12 +107,15 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
private static final String USER_ERROR = "USER ERROR";
private static final String VERSION_MIN = "VersionMin";
private static final String VERSION_MAX = "VersionMax";
- private static final String VF_EXIST_STATUS_MESSAGE =
- "The vf module was found to already exist, thus no new vf module was created in the cloud via this request";
- private static final String VF_CREATED_STATUS_MESSAGE = "The new vf module was successfully created in the cloud";
- private static final String VF_NOT_EXIST_STATUS_MESSAGE =
- "The vf module was not found, thus no vf module was deleted in the cloud via this request";
- private static final String VF_DELETED_STATUS_MESSAGE = "The vf module was successfully deleted in the cloud";
+ private static final String RESOURCE_EXIST_STATUS_MESSAGE =
+ "The %s was found to already exist, thus no new %s was created in the cloud via this request";
+ private static final String RESOURCE_CREATED_STATUS_MESSAGE = "The new %s was successfully created in the cloud";
+ private static final String RESOURCE_NOT_EXIST_STATUS_MESSAGE =
+ "The %s was not found, thus no %s was deleted in the cloud via this request";
+ private static final String RESOURCE_DELETED_STATUS_MESSAGE = "The %s was successfully deleted in the cloud";
+ private static final String VF_MODULE = "vf module";
+ private static final String VOLUME_GROUP = "volume group";
+
@Autowired
private VFModuleCustomizationRepository vfModuleCustomRepo;
@@ -303,7 +306,11 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
logger.debug("Deleting VNF {} in {}", vnfName, cloudSiteId + "/" + tenantId);
try {
- msoHeatUtils.deleteStack(tenantId, cloudOwner, cloudSiteId, vnfName, true, 118);
+ StackInfo stackInfo = msoHeatUtils.deleteStack(tenantId, cloudOwner, cloudSiteId, vnfName, true, 118);
+
+ msoHeatUtils.updateResourceStatus(msoRequest.getRequestId(),
+ stackInfo.isOperationPerformed() ? String.format(RESOURCE_DELETED_STATUS_MESSAGE, VOLUME_GROUP)
+ : String.format(RESOURCE_NOT_EXIST_STATUS_MESSAGE, VOLUME_GROUP, VOLUME_GROUP));
} catch (MsoException me) {
me.addContext(DELETE_VNF);
// Failed to query the Stack due to an openstack exception.
@@ -1088,9 +1095,15 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
template, goldenInputs, pollForCompletion, heatTemplate.getTimeoutMinutes(),
newEnvironmentString, nestedTemplatesChecked, heatFilesObjects, backout.booleanValue(),
failIfExists);
+ String resource = VF_MODULE;
+ if (isVolumeRequest) {
+ resource = VOLUME_GROUP;
+ }
if (msoRequest.getRequestId() != null) {
msoHeatUtils.updateResourceStatus(msoRequest.getRequestId(),
- heatStack.isOperationPerformed() ? VF_CREATED_STATUS_MESSAGE : VF_EXIST_STATUS_MESSAGE);
+ heatStack.isOperationPerformed()
+ ? String.format(RESOURCE_CREATED_STATUS_MESSAGE, resource)
+ : String.format(RESOURCE_EXIST_STATUS_MESSAGE, resource, resource));
}
} else {
throw new MsoHeatNotFoundException();
@@ -1178,8 +1191,8 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
outputs.value.put("canonicalStackId", currentStack.getCanonicalName());
}
msoHeatUtils.updateResourceStatus(msoRequest.getRequestId(),
- currentStack.isOperationPerformed() ? VF_DELETED_STATUS_MESSAGE : VF_NOT_EXIST_STATUS_MESSAGE);
-
+ currentStack.isOperationPerformed() ? String.format(RESOURCE_DELETED_STATUS_MESSAGE, VF_MODULE)
+ : String.format(RESOURCE_NOT_EXIST_STATUS_MESSAGE, VF_MODULE, VF_MODULE));
} catch (MsoException me) {
me.addContext(DELETE_VNF);
// Failed to query the Stack due to an openstack exception.
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/AssignFlows.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/AssignFlows.java
index f23f62d763..9eef3ffbf5 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/AssignFlows.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/AssignFlows.java
@@ -29,7 +29,7 @@ public enum AssignFlows {
NETWORK_MACRO("AssignNetworkBB"),
VOLUME_GROUP("AssignVolumeGroupBB"),
NETWORK_COLLECTION("CreateNetworkCollectionBB"),
- FABRIC_CONFIGURATION("AssignFabricConfigurationBB"),
+ FABRIC_CONFIGURATION("AddFabricConfigurationBB"),
VRF_CONFIGURATION("AssignVrfConfigurationBBV2");
private final String flowName;
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 e01149f981..d26b9d6d03 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
@@ -168,46 +168,22 @@ public class WorkflowAction {
}
public void selectExecutionList(DelegateExecution execution) throws Exception {
- execution.setVariable("sentSyncResponse", false);
- execution.setVariable("homing", false);
- execution.setVariable("calledHoming", false);
- execution.setVariable(BBConstants.G_ISTOPLEVELFLOW, true);
-
try {
final String bpmnRequest = (String) execution.getVariable(BBConstants.G_BPMN_REQUEST);
ServiceInstancesRequest sIRequest =
new ObjectMapper().readValue(bpmnRequest, ServiceInstancesRequest.class);
RequestDetails requestDetails = sIRequest.getRequestDetails();
- execution.setVariable("suppressRollback", requestDetails.getRequestInfo().getSuppressRollback());
String uri = (String) execution.getVariable(BBConstants.G_URI);
final String requestId = (String) execution.getVariable(BBConstants.G_REQUEST_ID);
final boolean aLaCarte = (boolean) execution.getVariable(BBConstants.G_ALACARTE);
boolean isResume = isUriResume(uri);
- if (!aLaCarte && isResume) {
- logger.debug("replacing URI {}", uri);
- uri = bbInputSetupUtils.loadOriginalInfraActiveRequestById(requestId).getRequestUrl();
- logger.debug("for RESUME with original value {}", uri);
- }
- Resource resource = extractResourceIdAndTypeFromUri(uri);
- WorkflowType resourceType = resource.getResourceType();
- execution.setVariable("resourceName", resourceType.toString());
- String resourceId = "";
String requestAction = (String) execution.getVariable(BBConstants.G_ACTION);
WorkflowResourceIds workflowResourceIds = populateResourceIdsFromApiHandler(execution);
- if (resource.isGenerated() && requestAction.equalsIgnoreCase("createInstance")
- && sIRequest.getRequestDetails().getRequestInfo().getInstanceName() != null) {
- resourceId = validateResourceIdInAAI(resource.getResourceId(), resourceType,
- sIRequest.getRequestDetails().getRequestInfo().getInstanceName(), sIRequest.getRequestDetails(),
- workflowResourceIds);
- } else {
- resourceId = resource.getResourceId();
- }
- String serviceInstanceId = (String) execution.getVariable("serviceInstanceId");
- if ((serviceInstanceId == null || serviceInstanceId.isEmpty()) && resourceType == WorkflowType.SERVICE) {
- serviceInstanceId = resourceId;
- }
- execution.setVariable("resourceId", resourceId);
- execution.setVariable("resourceType", resourceType);
+ Resource resource = getResource(bbInputSetupUtils, isResume, aLaCarte, uri, requestId);
+ String resourceId = getResourceId(resource, requestAction, requestDetails, workflowResourceIds);
+ WorkflowType resourceType = resource.getResourceType();
+ String serviceInstanceId = getServiceInstanceId(execution, resourceId, resourceType);
+ fillExecution(execution, requestDetails.getRequestInfo().getSuppressRollback(), resourceId, resourceType);
List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>();
if (isRequestMacroServiceResume(aLaCarte, resourceType, requestAction, serviceInstanceId)) {
flowsToExecute = bbInputSetupUtils.loadOriginalFlowExecutionPath(requestId);
@@ -1681,4 +1657,46 @@ public class WorkflowAction {
}
return generatedResourceId;
}
+
+ private void fillExecution(DelegateExecution execution, boolean suppressRollback, String resourceId,
+ WorkflowType resourceType) {
+ execution.setVariable("sentSyncResponse", false);
+ execution.setVariable("homing", false);
+ execution.setVariable("calledHoming", false);
+ execution.setVariable(BBConstants.G_ISTOPLEVELFLOW, true);
+ execution.setVariable("suppressRollback", suppressRollback);
+ execution.setVariable("resourceId", resourceId);
+ execution.setVariable("resourceType", resourceType);
+ execution.setVariable("resourceName", resourceType.toString());
+ }
+
+ private Resource getResource(BBInputSetupUtils bbInputSetupUtils, boolean isResume, boolean alaCarte, String uri,
+ String requestId) {
+ if (!alaCarte && isResume) {
+ logger.debug("replacing URI {}", uri);
+ uri = bbInputSetupUtils.loadOriginalInfraActiveRequestById(requestId).getRequestUrl();
+ logger.debug("for RESUME with original value {}", uri);
+ }
+ return extractResourceIdAndTypeFromUri(uri);
+ }
+
+ private String getResourceId(Resource resource, String requestAction, RequestDetails requestDetails,
+ WorkflowResourceIds workflowResourceIds) throws Exception {
+ if (resource.isGenerated() && requestAction.equalsIgnoreCase("createInstance")
+ && requestDetails.getRequestInfo().getInstanceName() != null) {
+ return validateResourceIdInAAI(resource.getResourceId(), resource.getResourceType(),
+ requestDetails.getRequestInfo().getInstanceName(), requestDetails, workflowResourceIds);
+ } else {
+ return resource.getResourceId();
+ }
+ }
+
+ private String getServiceInstanceId(DelegateExecution execution, String resourceId, WorkflowType resourceType) {
+ String serviceInstanceId = (String) execution.getVariable("serviceInstanceId");
+ if ((serviceInstanceId == null || serviceInstanceId.isEmpty()) && WorkflowType.SERVICE.equals(resourceType)) {
+ serviceInstanceId = resourceId;
+ }
+ return serviceInstanceId;
+ }
+
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java
index 56cd9fd70f..8d9e020f67 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java
@@ -41,6 +41,7 @@ public class WorkflowActionBBFailure {
private static final String DEACTIVATE_FABRIC_CONFIGURATION_FLOW = "DeactivateFabricConfigurationBB";
private static final String UNASSIGN_FABRIC_CONFIGURATION_FLOW = "UnassignFabricConfigurationBB";
+ private static final String DELETE_FABRIC_CONFIGURATION_FLOW = "DeleteFabricConfigurationBB";
private static final Logger logger = LoggerFactory.getLogger(WorkflowActionBBFailure.class);
public static final String ROLLBACK_TARGET_STATE = "rollbackTargetState";
@Autowired
@@ -101,7 +102,8 @@ public class WorkflowActionBBFailure {
if (ebb != null && ebb.getBuildingBlock() != null && ebb.getBuildingBlock().getBpmnFlowName() != null) {
String flowName = ebb.getBuildingBlock().getBpmnFlowName();
if (DEACTIVATE_FABRIC_CONFIGURATION_FLOW.equalsIgnoreCase(flowName)
- || UNASSIGN_FABRIC_CONFIGURATION_FLOW.equalsIgnoreCase(flowName)) {
+ || UNASSIGN_FABRIC_CONFIGURATION_FLOW.equalsIgnoreCase(flowName)
+ || DELETE_FABRIC_CONFIGURATION_FLOW.equalsIgnoreCase(flowName)) {
String statusMessage = String.format(
"%s Warning: The vf-module is active but configuration was not removed completely for one or more VMs.",
request.getStatusMessage());
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
index ba5d283c01..5edb2b9dd8 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
@@ -70,8 +70,7 @@ public class WorkflowActionBBTasks {
private static final String G_ACTION = "requestAction";
private static final String RETRY_COUNT = "retryCount";
private static final String FABRIC_CONFIGURATION = "FabricConfiguration";
- private static final String ASSIGN_FABRIC_CONFIGURATION_BB = "AssignFabricConfigurationBB";
- private static final String ACTIVATE_FABRIC_CONFIGURATION_BB = "ActivateFabricConfigurationBB";
+ private static final String ADD_FABRIC_CONFIGURATION_BB = "AddFabricConfigurationBB";
private static final String COMPLETED = "completed";
private static final String HANDLINGCODE = "handlingCode";
private static final String ROLLBACKTOCREATED = "RollbackToCreated";
@@ -304,6 +303,8 @@ public class WorkflowActionBBTasks {
flowName = flowName.replaceFirst("Create", "Delete");
} else if (flowName.startsWith("Activate")) {
flowName = flowName.replaceFirst("Activate", "Deactivate");
+ } else if (flowName.startsWith("Add")) {
+ flowName = flowName.replaceFirst("Add", "Delete");
} else {
continue;
}
@@ -415,12 +416,9 @@ public class WorkflowActionBBTasks {
configurationResourceKeys.setVfModuleCustomizationUUID(vfModuleCustomizationUUID);
configurationResourceKeys.setVnfResourceCustomizationUUID(vnfCustomizationUUID);
configurationResourceKeys.setVnfcName(vnfc.getVnfcName());
- ExecuteBuildingBlock assignConfigBB = getExecuteBBForConfig(ASSIGN_FABRIC_CONFIGURATION_BB, ebb,
+ ExecuteBuildingBlock addConfigBB = getExecuteBBForConfig(ADD_FABRIC_CONFIGURATION_BB, ebb,
configurationId, configurationResourceKeys);
- ExecuteBuildingBlock activateConfigBB = getExecuteBBForConfig(ACTIVATE_FABRIC_CONFIGURATION_BB, ebb,
- configurationId, configurationResourceKeys);
- flowsToExecute.add(assignConfigBB);
- flowsToExecute.add(activateConfigBB);
+ flowsToExecute.add(addConfigBB);
flowsToExecute.stream()
.forEach(executeBB -> logger.info("Flows to Execute After Post Processing: {}",
executeBB.getBuildingBlock().getBpmnFlowName()));
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java
index ff1246bc46..fc7f603d17 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java
@@ -328,25 +328,20 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock3);
flowsToExecute.add(ebb3);
- BuildingBlock buildingBlock4 = new BuildingBlock().setBpmnFlowName("AssignFabricConfigurationBB");
+ BuildingBlock buildingBlock4 = new BuildingBlock().setBpmnFlowName("AddFabricConfigurationBB");
ExecuteBuildingBlock ebb4 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock4);
flowsToExecute.add(ebb4);
- BuildingBlock buildingBlock5 = new BuildingBlock().setBpmnFlowName("ActivateFabricConfigurationBB");
- ExecuteBuildingBlock ebb5 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock5);
- flowsToExecute.add(ebb5);
-
execution.setVariable("flowsToExecute", flowsToExecute);
- execution.setVariable("gCurrentSequence", 5);
+ execution.setVariable("gCurrentSequence", 4);
workflowActionBBTasks.rollbackExecutionPath(execution);
List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
assertEquals(0, execution.getVariable("gCurrentSequence"));
- assertEquals(4, ebbs.size());
- assertEquals("DeactivateFabricConfigurationBB", ebbs.get(0).getBuildingBlock().getBpmnFlowName());
- assertEquals("UnassignFabricConfigurationBB", ebbs.get(1).getBuildingBlock().getBpmnFlowName());
- assertEquals("DeactivateVfModuleBB", ebbs.get(2).getBuildingBlock().getBpmnFlowName());
- assertEquals("DeleteVfModuleBB", ebbs.get(3).getBuildingBlock().getBpmnFlowName());
+ assertEquals(3, ebbs.size());
+ assertEquals("DeleteFabricConfigurationBB", ebbs.get(0).getBuildingBlock().getBpmnFlowName());
+ assertEquals("DeactivateVfModuleBB", ebbs.get(1).getBuildingBlock().getBpmnFlowName());
+ assertEquals("DeleteVfModuleBB", ebbs.get(2).getBuildingBlock().getBpmnFlowName());
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationAction.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationAction.java
index b340fdea2b..a49be130e4 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationAction.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationAction.java
@@ -30,6 +30,7 @@ public enum OrchestrationAction {
CREATE("Create"),
DELETE("Delete"),
UPDATE("Update"),
+ ADD("Add"),
ADD_MEMBERS("AddMembers"),
REMOVE_MEMBERS("RemoveMembers"),
CUSTOM("Custom");