diff options
author | Marcus Williams <marcus.williams@intel.com> | 2018-10-24 14:10:15 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-10-24 14:10:15 +0000 |
commit | d0c0de2ddf2b7cfc32c2a769f79f682ebd4be772 (patch) | |
tree | db36f77f04ef3822d4bdd8705aa1255ed27947b4 /bpmn/so-bpmn-tasks/src/main | |
parent | 8a1d80171bc7a19e43799e40d86c6269c3d35ce1 (diff) | |
parent | 6cf9ff1f1f2360a406f68f3147d86fd864d31910 (diff) |
Merge "8/23: merge casablanca to master"
Diffstat (limited to 'bpmn/so-bpmn-tasks/src/main')
3 files changed, 59 insertions, 2 deletions
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 c84e26911c..87c04d7ecc 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 @@ -54,6 +54,8 @@ import org.springframework.stereotype.Component; @Component public class AAIUpdateTasks { private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, AAIUpdateTasks.class); + private static final String MULTI_STAGE_DESIGN_OFF = "false"; + private static final String MULTI_STAGE_DESIGN_ON = "true"; @Autowired private AAIServiceInstanceResources aaiServiceInstanceResources; @Autowired @@ -185,6 +187,26 @@ public class AAIUpdateTasks { } } + public void updateOrchestrationStatusAssignedOrPendingActivationVfModule(BuildingBlockExecution execution) { + try { + VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID)); + vfModule.setHeatStackId(""); + GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + String multiStageDesign = MULTI_STAGE_DESIGN_OFF; + if (vnf.getModelInfoGenericVnf() != null) { + multiStageDesign = vnf.getModelInfoGenericVnf().getMultiStageDesign(); + } + if (multiStageDesign != null && multiStageDesign.equalsIgnoreCase(MULTI_STAGE_DESIGN_ON)) { + aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule,vnf,OrchestrationStatus.PENDING_ACTIVATION); + } + else { + aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule,vnf,OrchestrationStatus.ASSIGNED); + } + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + public void updateOrchestrationStatusCreatedVfModule(BuildingBlockExecution execution) { try { VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID)); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java index 55ebad68aa..88ae3746ab 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java @@ -23,12 +23,15 @@ package org.onap.so.bpmn.infrastructure.workflow.tasks; import org.onap.so.bpmn.common.BuildingBlockExecution; 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.exception.OrchestrationStatusValidationException; import org.onap.so.db.catalog.beans.BuildingBlockDetail; +import org.onap.so.db.catalog.beans.OrchestrationAction; import org.onap.so.db.catalog.beans.OrchestrationStatus; import org.onap.so.db.catalog.beans.OrchestrationStatusStateTransitionDirective; import org.onap.so.db.catalog.beans.OrchestrationStatusValidationDirective; +import org.onap.so.db.catalog.beans.ResourceType; import org.onap.so.db.catalog.client.CatalogDbClient; import org.onap.so.logger.MsoLogger; import org.springframework.beans.factory.annotation.Autowired; @@ -42,6 +45,8 @@ public class OrchestrationStatusValidator { private static final String UNKNOWN_RESOURCE_TYPE = "Building Block (%s) not set up correctly in Orchestration_Status_Validation table in CatalogDB. ResourceType=(%s), TargetAction=(%s)"; private static final String ORCHESTRATION_VALIDATION_FAIL = "Orchestration Status Validation failed. ResourceType=(%s), TargetAction=(%s), OrchestrationStatus=(%s)"; private static final String ORCHESTRATION_STATUS_VALIDATION_RESULT = "orchestrationStatusValidationResult"; + private static final String MULTI_STAGE_DESIGN_OFF = "false"; + private static final String MULTI_STAGE_DESIGN_ON = "true"; @Autowired @@ -53,9 +58,11 @@ public class OrchestrationStatusValidator { public void validateOrchestrationStatus(BuildingBlockExecution execution) { try { + OrchestrationStatusValidationDirective previousOrchestrationStatusValidationResult = execution.getVariable(ORCHESTRATION_STATUS_VALIDATION_RESULT); + execution.setVariable(ORCHESTRATION_STATUS_VALIDATION_RESULT, null); - String buildingBlockFlowName = (String) execution.getVariable("flowToBeCalled"); + String buildingBlockFlowName = execution.getFlowToBeCalled(); BuildingBlockDetail buildingBlockDetail = catalogDbClient.getBuildingBlockDetail(buildingBlockFlowName); @@ -105,13 +112,40 @@ public class OrchestrationStatusValidator { } OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective = catalogDbClient.getOrchestrationStatusStateTransitionDirective(buildingBlockDetail.getResourceType(), orchestrationStatus, buildingBlockDetail.getTargetAction()); + if(ResourceType.VF_MODULE.equals(buildingBlockDetail.getResourceType()) && OrchestrationAction.CREATE.equals(buildingBlockDetail.getTargetAction()) && + OrchestrationStatus.PENDING_ACTIVATION.equals(orchestrationStatus)) { + org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + orchestrationStatusStateTransitionDirective = processPossibleSecondStageofVfModuleCreate(execution, previousOrchestrationStatusValidationResult, + genericVnf, orchestrationStatusStateTransitionDirective); + } + if (orchestrationStatusStateTransitionDirective.getFlowDirective() == OrchestrationStatusValidationDirective.FAIL) { throw new OrchestrationStatusValidationException(String.format(ORCHESTRATION_VALIDATION_FAIL, buildingBlockDetail.getResourceType(), buildingBlockDetail.getTargetAction(), orchestrationStatus)); } execution.setVariable(ORCHESTRATION_STATUS_VALIDATION_RESULT, orchestrationStatusStateTransitionDirective.getFlowDirective()); - } catch (Exception e) { + }catch(BBObjectNotFoundException ex){ + if(execution.getFlowToBeCalled().contains("Unassign")){ + execution.setVariable(ORCHESTRATION_STATUS_VALIDATION_RESULT, OrchestrationStatusValidationDirective.SILENT_SUCCESS); + }else{ + exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, ex); + } + }catch (Exception e) { exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e); } } + + private OrchestrationStatusStateTransitionDirective processPossibleSecondStageofVfModuleCreate(BuildingBlockExecution execution, OrchestrationStatusValidationDirective previousOrchestrationStatusValidationResult, + org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf genericVnf, OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective) { + if (previousOrchestrationStatusValidationResult != null && previousOrchestrationStatusValidationResult.equals(OrchestrationStatusValidationDirective.SILENT_SUCCESS)) { + String multiStageDesign = "false"; + if (genericVnf.getModelInfoGenericVnf() != null) { + multiStageDesign = genericVnf.getModelInfoGenericVnf().getMultiStageDesign(); + } + if (multiStageDesign != null && multiStageDesign.equalsIgnoreCase("true")) { + orchestrationStatusStateTransitionDirective.setFlowDirective(OrchestrationStatusValidationDirective.CONTINUE); + } + } + return orchestrationStatusStateTransitionDirective; + } } 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 24246273e8..8bc499c310 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 @@ -170,6 +170,7 @@ public class WorkflowAction { execution.setVariable("homing", true); execution.setVariable("callHoming", true); execution.setVariable("homingSolution", params.get(HOMINGSOLUTION)); + execution.setVariable("homingService", params.get(HOMINGSOLUTION)); } } } |