use of org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock in project so by onap.
the class ExecuteBuildingBlockBuilder method buildExecuteBuildingBlock.
protected ExecuteBuildingBlock buildExecuteBuildingBlock(OrchestrationFlow orchFlow, String requestId, Resource resource, String apiVersion, String resourceId, String requestAction, boolean aLaCarte, String vnfType, WorkflowResourceIds workflowResourceIds, RequestDetails requestDetails, boolean isVirtualLink, String virtualLinkKey, String vnfcName, boolean isConfiguration, ReplaceInstanceRelatedInformation replaceInfo) {
BuildingBlock buildingBlock = new BuildingBlock().setBpmnFlowName(orchFlow.getFlowName()).setMsoId(UUID.randomUUID().toString()).setIsVirtualLink(isVirtualLink).setVirtualLinkKey(virtualLinkKey).setKey(Optional.ofNullable(resource).map(Resource::getResourceId).orElse(""));
Optional.ofNullable(orchFlow.getBpmnAction()).ifPresent(buildingBlock::setBpmnAction);
Optional.ofNullable(orchFlow.getBpmnScope()).ifPresent(buildingBlock::setBpmnScope);
String oldVolumeGroupName = "";
if (replaceInfo != null) {
oldVolumeGroupName = replaceInfo.getOldVolumeGroupName();
}
if (resource != null && (orchFlow.getFlowName().contains(VOLUMEGROUP) && (requestAction.equalsIgnoreCase(REPLACEINSTANCE) || requestAction.equalsIgnoreCase(REPLACEINSTANCERETAINASSIGNMENTS)))) {
logger.debug("Setting resourceId to volume group id for volume group flow on replace");
resourceId = workflowResourceIds.getVolumeGroupId();
}
ExecuteBuildingBlock executeBuildingBlock = new ExecuteBuildingBlock().setApiVersion(apiVersion).setaLaCarte(aLaCarte).setRequestAction(requestAction).setResourceId(resourceId).setVnfType(vnfType).setWorkflowResourceIds(workflowResourceIds).setRequestId(requestId).setBuildingBlock(buildingBlock).setRequestDetails(requestDetails).setOldVolumeGroupName(oldVolumeGroupName);
if (resource != null && (isConfiguration || resource.getResourceType().equals(WorkflowType.CONFIGURATION))) {
ConfigurationResourceKeys configurationResourceKeys = getConfigurationResourceKeys(resource, vnfcName);
executeBuildingBlock.setConfigurationResourceKeys(configurationResourceKeys);
}
return executeBuildingBlock;
}
use of org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock in project so by onap.
the class WorkflowActionTest method sortExecutionPathByObjectForVlanTaggingCreateTest.
@Test
public void sortExecutionPathByObjectForVlanTaggingCreateTest() throws Exception {
List<ExecuteBuildingBlock> executeFlows = new ArrayList<>();
BuildingBlock bb = new BuildingBlock().setBpmnFlowName("AssignNetworkBB").setKey("0");
ExecuteBuildingBlock ebb = new ExecuteBuildingBlock().setBuildingBlock(bb);
executeFlows.add(ebb);
BuildingBlock bb2 = new BuildingBlock().setBpmnFlowName("AssignNetworkBB").setKey("1");
ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock().setBuildingBlock(bb2);
executeFlows.add(ebb2);
BuildingBlock bb3 = new BuildingBlock().setBpmnFlowName("CreateNetworkBB").setKey("0");
ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock().setBuildingBlock(bb3);
executeFlows.add(ebb3);
BuildingBlock bb4 = new BuildingBlock().setBpmnFlowName("CreateNetworkBB").setKey("1");
ExecuteBuildingBlock ebb4 = new ExecuteBuildingBlock().setBuildingBlock(bb4);
executeFlows.add(ebb4);
BuildingBlock bb5 = new BuildingBlock().setBpmnFlowName("ActivateNetworkBB").setKey("0");
ExecuteBuildingBlock ebb5 = new ExecuteBuildingBlock().setBuildingBlock(bb5);
executeFlows.add(ebb5);
BuildingBlock bb6 = new BuildingBlock().setBpmnFlowName("ActivateNetworkBB").setKey("1");
ExecuteBuildingBlock ebb6 = new ExecuteBuildingBlock().setBuildingBlock(bb6);
executeFlows.add(ebb6);
List<ExecuteBuildingBlock> sorted = workflowAction.sortExecutionPathByObjectForVlanTagging(executeFlows, "createInstance");
assertEqualsBulkFlowName(sorted, "AssignNetworkBB", "CreateNetworkBB", "ActivateNetworkBB", "AssignNetworkBB", "CreateNetworkBB", "ActivateNetworkBB");
}
use of org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock in project so by onap.
the class MultiStageSkipListenerTest method testProcessMultiStageSkip.
@Test
public void testProcessMultiStageSkip() {
String vfModuleId = "vfModuleId";
String vnfId = "vnfId";
List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>();
WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
workflowResourceIds.setServiceInstanceId("serviceInstanceId");
workflowResourceIds.setVnfId(vnfId);
BuildingBlock bb = new BuildingBlock().setBpmnFlowName("AssignVfModuleBB");
ExecuteBuildingBlock ebb = new ExecuteBuildingBlock().setResourceId(vfModuleId).setBuildingBlock(bb).setWorkflowResourceIds(workflowResourceIds);
flowsToExecute.add(ebb);
flowsToExecute.add(new ExecuteBuildingBlock());
flowsToExecute.add(new ExecuteBuildingBlock());
BuildingBlockExecution execution = new DelegateExecutionImpl(new DelegateExecutionFake());
org.onap.aai.domain.yang.VfModule vfModule = new org.onap.aai.domain.yang.VfModule();
vfModule.setVfModuleId(vfModuleId);
org.onap.aai.domain.yang.GenericVnf vnf = new org.onap.aai.domain.yang.GenericVnf();
vnf.setModelCustomizationId("modelCustomizationUUID");
VnfResourceCustomization vnfCust = new VnfResourceCustomization();
vnfCust.setModelCustomizationUUID("modelCustomizationUUID");
vnfCust.setMultiStageDesign("true");
when(catalogDbClient.getVnfResourceCustomizationByModelCustomizationUUID(vnf.getModelCustomizationId())).thenReturn(vnfCust);
when(bbInputSetupUtils.getAAIVfModule(eq(vnfId), eq(vfModuleId))).thenReturn(null);
when(bbInputSetupUtils.getAAIGenericVnf(eq(vnfId))).thenReturn(vnf);
multiStageSkipListener.run(flowsToExecute, flowsToExecute.get(0), execution);
assertEquals("Flows should only have Assign", flowsToExecute.size(), 1);
assertEquals("Flows should only have Assign", flowsToExecute.get(0).getBuildingBlock().getBpmnFlowName(), "AssignVfModuleBB");
}
use of org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock in project so by onap.
the class SkipConfigVnfListenerTest method createExecuteBuildingBlock.
private ExecuteBuildingBlock createExecuteBuildingBlock() {
ModelInfo modelInfo = new ModelInfo();
modelInfo.setModelUuid(MODEL_UUID);
RequestDetails requestDetails = new RequestDetails();
requestDetails.setModelInfo(modelInfo);
ExecuteBuildingBlock executeBuildingBlock = new ExecuteBuildingBlock();
BuildingBlock buildingBlock = new BuildingBlock();
buildingBlock.setKey(VNF_CUSTOMIZATION_UUID);
executeBuildingBlock.setBuildingBlock(buildingBlock);
executeBuildingBlock.setRequestDetails(requestDetails);
return executeBuildingBlock;
}
use of org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock in project so by onap.
the class WorkflowActionBBFailureTest method updateRequestStatusToFailedRollbackFabric.
@Test
public void updateRequestStatusToFailedRollbackFabric() {
BuildingBlock bb = new BuildingBlock().setBpmnFlowName("UnassignFabricConfigurationBB");
ExecuteBuildingBlock ebb = new ExecuteBuildingBlock().setBuildingBlock(bb);
execution.setVariable("buildingBlock", ebb);
execution.setVariable("mso-request-id", "123");
execution.setVariable("isRollbackComplete", false);
execution.setVariable("isRollback", true);
InfraActiveRequests req = new InfraActiveRequests();
req.setStatusMessage("PINC failure.");
WorkflowException wfe = new WorkflowException("processKey123", 1, "error in rollback");
execution.setVariable("WorkflowException", wfe);
doReturn(req).when(requestsDbClient).getInfraActiveRequestbyRequestId("123");
doNothing().when(requestsDbClient).updateInfraActiveRequests(isA(InfraActiveRequests.class));
workflowActionBBFailure.updateRequestStatusToFailed(execution);
String errorMsg = (String) execution.getVariable("RollbackErrorMessage");
assertEquals("error in rollback", errorMsg);
assertEquals("PINC failure. Warning: The vf-module is active but configuration was not removed completely for one or more VMs.", req.getStatusMessage());
assertEquals(Status.FAILED.toString(), req.getRequestStatus());
}
Aggregations