aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-tasks
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn/so-bpmn-tasks')
-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/workflow/tasks/OrchestrationStatusValidator.java11
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java15
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidatorTest.java50
4 files changed, 69 insertions, 11 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 87c04d7ecc..38261c0f1a 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,7 @@ 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 ALACARTE = "aLaCarte";
private static final String MULTI_STAGE_DESIGN_OFF = "false";
private static final String MULTI_STAGE_DESIGN_ON = "true";
@Autowired
@@ -196,7 +197,8 @@ public class AAIUpdateTasks {
if (vnf.getModelInfoGenericVnf() != null) {
multiStageDesign = vnf.getModelInfoGenericVnf().getMultiStageDesign();
}
- if (multiStageDesign != null && multiStageDesign.equalsIgnoreCase(MULTI_STAGE_DESIGN_ON)) {
+ boolean aLaCarte = (boolean) execution.getVariable(ALACARTE);
+ if (aLaCarte && multiStageDesign != null && multiStageDesign.equalsIgnoreCase(MULTI_STAGE_DESIGN_ON)) {
aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule,vnf,OrchestrationStatus.PENDING_ACTIVATION);
}
else {
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 88ae3746ab..b0063c1da1 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
@@ -45,6 +45,7 @@ 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 ALACARTE = "aLaCarte";
private static final String MULTI_STAGE_DESIGN_OFF = "false";
private static final String MULTI_STAGE_DESIGN_ON = "true";
@@ -62,8 +63,10 @@ public class OrchestrationStatusValidator {
execution.setVariable(ORCHESTRATION_STATUS_VALIDATION_RESULT, null);
- String buildingBlockFlowName = execution.getFlowToBeCalled();
+ boolean aLaCarte = (boolean) execution.getVariable(ALACARTE);
+ String buildingBlockFlowName = execution.getFlowToBeCalled();
+
BuildingBlockDetail buildingBlockDetail = catalogDbClient.getBuildingBlockDetail(buildingBlockFlowName);
if (buildingBlockDetail == null) {
@@ -112,7 +115,7 @@ public class OrchestrationStatusValidator {
}
OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective = catalogDbClient.getOrchestrationStatusStateTransitionDirective(buildingBlockDetail.getResourceType(), orchestrationStatus, buildingBlockDetail.getTargetAction());
- if(ResourceType.VF_MODULE.equals(buildingBlockDetail.getResourceType()) && OrchestrationAction.CREATE.equals(buildingBlockDetail.getTargetAction()) &&
+ if(aLaCarte && 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,
@@ -138,11 +141,11 @@ public class OrchestrationStatusValidator {
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";
+ String multiStageDesign = MULTI_STAGE_DESIGN_OFF;
if (genericVnf.getModelInfoGenericVnf() != null) {
multiStageDesign = genericVnf.getModelInfoGenericVnf().getMultiStageDesign();
}
- if (multiStageDesign != null && multiStageDesign.equalsIgnoreCase("true")) {
+ if (multiStageDesign != null && multiStageDesign.equalsIgnoreCase(MULTI_STAGE_DESIGN_ON)) {
orchestrationStatusStateTransitionDirective.setFlowDirective(OrchestrationStatusValidationDirective.CONTINUE);
}
}
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 560f2a91bf..1a302c29a7 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
@@ -169,6 +169,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest{
@Test
public void updateOrchestrationStatusAssignedOrPendingActivationVfModuleNoMultiStageTest() throws Exception {
+ execution.setVariable("aLaCarte", true);
ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf();
modelInfoGenericVnf.setMultiStageDesign("false");
genericVnf.setModelInfoGenericVnf(modelInfoGenericVnf);
@@ -179,7 +180,20 @@ public class AAIUpdateTasksTest extends BaseTaskTest{
}
@Test
+ public void updateOrchestrationStatusAssignedOrPendingActivationVfModuleMultiStageButNotAlacarteTest() throws Exception {
+ execution.setVariable("aLaCarte", false);
+ ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf();
+ modelInfoGenericVnf.setMultiStageDesign("true");
+ genericVnf.setModelInfoGenericVnf(modelInfoGenericVnf);
+ doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.ASSIGNED);
+ aaiUpdateTasks.updateOrchestrationStatusAssignedOrPendingActivationVfModule(execution);
+ verify(aaiVfModuleResources, times(1)).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.ASSIGNED);
+ assertEquals("", vfModule.getHeatStackId());
+ }
+
+ @Test
public void updateOrchestrationStatusAssignedOrPendingActivationVfModuleWithMultiStageTest() throws Exception {
+ execution.setVariable("aLaCarte", true);
ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf();
modelInfoGenericVnf.setMultiStageDesign("true");
genericVnf.setModelInfoGenericVnf(modelInfoGenericVnf);
@@ -191,6 +205,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest{
@Test
public void updateOrchestrationStatusAssignedOrPendingActivationVfModuleExceptionTest() throws Exception {
+ execution.setVariable("aLaCarte", true);
doThrow(Exception.class).when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.ASSIGNED);
expectedException.expect(BpmnError.class);
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidatorTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidatorTest.java
index fa5081da2f..5ef020d6ed 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidatorTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidatorTest.java
@@ -51,7 +51,7 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
public void test_validateOrchestrationStatus() throws Exception {
String flowToBeCalled = "AssignServiceInstanceBB";
setServiceInstance().setOrchestrationStatus(OrchestrationStatus.PRECREATED);
-
+ execution.setVariable("aLaCarte", true);
execution.setVariable("flowToBeCalled", flowToBeCalled);
BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail();
@@ -91,6 +91,7 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
si.setConfigurations(configurations);
execution.setVariable("flowToBeCalled", flowToBeCalled);
+ execution.setVariable("aLaCarte", true);
BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail();
buildingBlockDetail.setBuildingBlockName("UnassignFabricConfigurationBB");
@@ -188,6 +189,7 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
String flowToBeCalled = "UnassignServiceInstanceBB";
execution.setVariable("flowToBeCalled", flowToBeCalled);
+ execution.setVariable("aLaCarte", true);
BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail();
buildingBlockDetail.setBuildingBlockName("UnassignServiceInstanceBB");
@@ -209,7 +211,7 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
String flowToBeCalled = "CreateVfModuleBB";
execution.setVariable("orchestrationStatusValidationResult", OrchestrationStatusValidationDirective.SILENT_SUCCESS);
-
+ execution.setVariable("aLaCarte", true);
execution.setVariable("flowToBeCalled", flowToBeCalled);
GenericVnf genericVnf = buildGenericVnf();
@@ -246,7 +248,7 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
String flowToBeCalled = "CreateVfModuleBB";
execution.setVariable("orchestrationStatusValidationResult", OrchestrationStatusValidationDirective.CONTINUE);
-
+ execution.setVariable("aLaCarte", true);
execution.setVariable("flowToBeCalled", flowToBeCalled);
GenericVnf genericVnf = buildGenericVnf();
@@ -282,7 +284,7 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
String flowToBeCalled = "CreateVfModuleBB";
execution.setVariable("orchestrationStatusValidationResult", OrchestrationStatusValidationDirective.SILENT_SUCCESS);
-
+ execution.setVariable("aLaCarte", true);
execution.setVariable("flowToBeCalled", flowToBeCalled);
GenericVnf genericVnf = buildGenericVnf();
@@ -318,7 +320,7 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
String flowToBeCalled = "CreateVfModuleBB";
execution.setVariable("orchestrationStatusValidationResult", OrchestrationStatusValidationDirective.SILENT_SUCCESS);
-
+ execution.setVariable("aLaCarte", true);
execution.setVariable("flowToBeCalled", flowToBeCalled);
GenericVnf genericVnf = buildGenericVnf();
@@ -354,7 +356,7 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
String flowToBeCalled = "CreateVfModuleBB";
execution.setVariable("orchestrationStatusValidationResult", OrchestrationStatusValidationDirective.SILENT_SUCCESS);
-
+ execution.setVariable("aLaCarte", true);
execution.setVariable("flowToBeCalled", flowToBeCalled);
GenericVnf genericVnf = buildGenericVnf();
@@ -384,4 +386,40 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
assertEquals(OrchestrationStatusValidationDirective.SILENT_SUCCESS, execution.getVariable("orchestrationStatusValidationResult"));
}
+
+ @Test
+ public void test_validateOrchestrationStatusSecondStageOfMultiStageWrongAlacarteValueVfModule() throws Exception {
+ String flowToBeCalled = "CreateVfModuleBB";
+
+ execution.setVariable("orchestrationStatusValidationResult", OrchestrationStatusValidationDirective.SILENT_SUCCESS);
+ execution.setVariable("aLaCarte", false);
+ execution.setVariable("flowToBeCalled", flowToBeCalled);
+
+ GenericVnf genericVnf = buildGenericVnf();
+ ModelInfoGenericVnf modelInfoGenericVnf = genericVnf.getModelInfoGenericVnf();
+ modelInfoGenericVnf.setMultiStageDesign("true");
+ setGenericVnf().setModelInfoGenericVnf(modelInfoGenericVnf);
+ setVfModule().setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
+
+ BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail();
+ buildingBlockDetail.setBuildingBlockName("CreateVfModuleBB");
+ buildingBlockDetail.setId(1);
+ buildingBlockDetail.setResourceType(ResourceType.VF_MODULE);
+ buildingBlockDetail.setTargetAction(OrchestrationAction.CREATE);
+
+ doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
+
+ OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective = new OrchestrationStatusStateTransitionDirective();
+ orchestrationStatusStateTransitionDirective.setFlowDirective(OrchestrationStatusValidationDirective.SILENT_SUCCESS);
+ orchestrationStatusStateTransitionDirective.setId(1);
+ orchestrationStatusStateTransitionDirective.setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
+ orchestrationStatusStateTransitionDirective.setResourceType(ResourceType.VF_MODULE);
+ orchestrationStatusStateTransitionDirective.setTargetAction(OrchestrationAction.ACTIVATE);
+
+ doReturn(orchestrationStatusStateTransitionDirective).when(catalogDbClient).getOrchestrationStatusStateTransitionDirective(ResourceType.VF_MODULE, OrchestrationStatus.PENDING_ACTIVATION, OrchestrationAction.CREATE);
+
+ orchestrationStatusValidator.validateOrchestrationStatus(execution);
+
+ assertEquals(OrchestrationStatusValidationDirective.SILENT_SUCCESS, execution.getVariable("orchestrationStatusValidationResult"));
+ }
}