aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-tasks/src/main
diff options
context:
space:
mode:
authorBenjamin, Max (mb388a) <mb388a@us.att.com>2018-10-19 09:32:18 -0400
committerRob Daugherty <rd472p@att.com>2018-10-19 18:55:36 -0400
commit93e96836387ee26cb5f2dbb70adef7db484c7d54 (patch)
tree3ffbf2d9ffdfe4996c123ac5ac3fe3e20322e1a2 /bpmn/so-bpmn-tasks/src/main
parent50fcd6f94104234212d907f8fb968d506d4d6e33 (diff)
bug fixes october 19th
Fixed issue with resource version being added twice. added silent success to orch validation when unassign is not found Removed SNAPSHOT from dependency Fixed failing BBInputSetup tests Updated apih tests to use networkInstanceGroup Updated ModelType enum and fixed compilation issues Change the place where the data for multistage gets set Update treatment of PENDING_ACTIVATION VF_MODULE CREATE entries to SILENT_SUCCESS to support first stage of multistage. Implement second stage of multistage design VF Module Creation Implementation of the first stage of multistage design for VF Module creation. Change-Id: I6d76282d1f37c081355cee72797d8e13da4e3cb0 Issue-ID: SO-1149 Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com> Signed-off-by: Rob Daugherty <rd472p@att.com>
Diffstat (limited to 'bpmn/so-bpmn-tasks/src/main')
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java22
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java38
2 files changed, 58 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;
+ }
}