diff options
author | PATTANAYAK, SAUMYA SWARUP (sp931a) <sp931a@att.com> | 2020-08-13 12:35:01 -0400 |
---|---|---|
committer | PATTANAYAK, SAUMYA SWARUP (sp931a) <sp931a@att.com> | 2020-08-31 15:06:10 -0400 |
commit | 62c72edd91b2d5485683274298b8249670663519 (patch) | |
tree | f9534a62c76fbdc85dc7fbf86c9a9f71b7863d29 /vid-automation/src/main/java/org | |
parent | bc25167f4ef0aabdcc55d1d286081808e1e47ae9 (diff) |
Pause Upon VF Module Failure
Issue-ID: VID-862
Currently in VID, once a failure is received from SO on the
instantiation of a VF Module, it is assumed that other VF Modules may
continue with the execution without stopping. However, in most of the
cases, it is a good idea to stop further requests to SO if one of the VF
Module instantiation returns an error. This user story, makes sure this
functionality is achieved.
Change-Id: I07c51b81111f805b61c8b3714a65171d7cbaa254
Signed-off-by: PATTANAYAK, SAUMYA SWARUP (sp931a) <sp931a@att.com>
Diffstat (limited to 'vid-automation/src/main/java/org')
-rw-r--r-- | vid-automation/src/main/java/org/onap/vid/api/AsyncInstantiationBase.java | 17 | ||||
-rw-r--r-- | vid-automation/src/main/java/org/onap/vid/api/CreateServiceWithFailedVnf.java | 9 |
2 files changed, 21 insertions, 5 deletions
diff --git a/vid-automation/src/main/java/org/onap/vid/api/AsyncInstantiationBase.java b/vid-automation/src/main/java/org/onap/vid/api/AsyncInstantiationBase.java index f4dd6780a..e5da62adb 100644 --- a/vid-automation/src/main/java/org/onap/vid/api/AsyncInstantiationBase.java +++ b/vid-automation/src/main/java/org/onap/vid/api/AsyncInstantiationBase.java @@ -135,7 +135,8 @@ public class AsyncInstantiationBase extends BaseMsoApiTest { } protected boolean getExpectedRetryEnabled(JobStatus jobStatus) { - return Features.FLAG_1902_RETRY_JOB.isActive() && (jobStatus==JobStatus.FAILED || jobStatus==JobStatus.COMPLETED_WITH_ERRORS); + return Features.FLAG_1902_RETRY_JOB.isActive() && (jobStatus==JobStatus.FAILED || jobStatus==JobStatus.COMPLETED_WITH_ERRORS + || jobStatus==JobStatus.FAILED_AND_PAUSED); } public List<BasePreset> getPresets(List<PresetMSOBaseDelete> presetOnDeleteList, List<PresetMSOBaseCreateInstancePost> presetOnCreateList, List<PresetMSOOrchestrationRequestGet> presetInProgressList) { @@ -203,7 +204,7 @@ public class AsyncInstantiationBase extends BaseMsoApiTest { return ImmutableList.of( vidAuditStatus(jobId, "PENDING", false), vidAuditStatus(jobId, "IN_PROGRESS", false), - vidAuditStatus(jobId, "COMPLETED_WITH_ERRORS", true) + vidAuditStatus(jobId, "COMPLETED_WITH_ERROR", true) ); } @@ -214,7 +215,13 @@ public class AsyncInstantiationBase extends BaseMsoApiTest { vidAuditStatus(jobId, "FAILED", true) ); } - + protected ImmutableList<JobAuditStatus> vidAuditStatusesFailedAndPaused(String jobId) { + return ImmutableList.of( + vidAuditStatus(jobId, "PENDING", false), + vidAuditStatus(jobId, "IN_PROGRESS", false), + vidAuditStatus(jobId, "FAILED_AND_PAUSED", true) + ); + } protected JobAuditStatus vidAuditStatus(String jobId, String jobStatus, boolean isFinal) { return new JobAuditStatus(UUID.fromString(jobId), jobStatus, JobAuditStatus.SourceStatus.VID, null, null, isFinal); } @@ -578,4 +585,8 @@ public class AsyncInstantiationBase extends BaseMsoApiTest { org.junit.Assert.assertEquals("MSO instanceType #" + i + " is not as expected", expectedStatus.getInstanceType(), actualStatus.getInstanceType()); }); } + protected static JobStatus getErrorStatus() { + return Features.FLAG_2008_PAUSE_VFMODULE_INSTANTIATION_FAILURE.isActive() ? + JobStatus.FAILED_AND_PAUSED : JobStatus.COMPLETED_WITH_ERRORS; + } } diff --git a/vid-automation/src/main/java/org/onap/vid/api/CreateServiceWithFailedVnf.java b/vid-automation/src/main/java/org/onap/vid/api/CreateServiceWithFailedVnf.java index 30076a964..a8bcc9f75 100644 --- a/vid-automation/src/main/java/org/onap/vid/api/CreateServiceWithFailedVnf.java +++ b/vid-automation/src/main/java/org/onap/vid/api/CreateServiceWithFailedVnf.java @@ -13,6 +13,7 @@ import org.onap.simulator.presetGenerator.presets.sdc.PresetSDCGetServiceToscaMo import org.onap.vid.model.asyncInstantiation.ServiceInfo; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; +import vid.automation.test.infra.Features; import vid.automation.test.infra.ModelInfo; import vid.automation.test.model.JobStatus; import vid.automation.test.model.ServiceAction; @@ -105,9 +106,13 @@ Legit Preset || deploy 1 Service, 1 VNF which will fail public void firstTimeAssertion() { assertThat(uuids, hasSize(1)); originalJobId = uuids.get(0); + boolean isPauseOnFailureFlagOn = Features.FLAG_2008_PAUSE_VFMODULE_INSTANTIATION_FAILURE.isActive(); - asyncInstantiationBase.assertServiceInfoSpecific1(originalJobId, JobStatus.COMPLETED_WITH_ERRORS, names.get(SERVICE_NAME), "us16807000", firstIds.serviceId, ServiceAction.INSTANTIATE); - asyncInstantiationBase.assertAuditStatuses(originalJobId, asyncInstantiationBase.vidAuditStatusesCompletedWithErrors(originalJobId),null); + asyncInstantiationBase.assertServiceInfoSpecific1(originalJobId, isPauseOnFailureFlagOn ? + JobStatus.FAILED_AND_PAUSED : JobStatus.COMPLETED_WITH_ERRORS, names.get(SERVICE_NAME), "us16807000", firstIds.serviceId, ServiceAction.INSTANTIATE); + asyncInstantiationBase.assertAuditStatuses(originalJobId, isPauseOnFailureFlagOn ? + asyncInstantiationBase.vidAuditStatusesFailedAndPaused(originalJobId) : + asyncInstantiationBase.vidAuditStatusesCompletedWithErrors(originalJobId),null); assertThat(SimulatorApi.retrieveRecordedRequestsPathCounter(), allOf( hasOrLacksOfEntry(createPresets.get(0).getReqPath(), 1L), hasOrLacksOfEntry(createPresets.get(1).getReqPath(), 1L), |