aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPATTANAYAK, SAUMYA SWARUP (sp931a) <sp931a@att.com>2020-09-22 17:33:23 -0400
committerPATTANAYAK, SAUMYA SWARUP (sp931a) <sp931a@att.com>2020-09-22 17:33:29 -0400
commit40027d2cbfee31ecfec1c8a4189668f2c46c82ce (patch)
tree7e3a46a64f6a5a240065233272747d308a02a095
parentb2793df9df1b3fde4dab0f7d037f4eff67324c1f (diff)
When VG instantiation fails the root job status should be in final state
Issue-ID: VID-902 Change-Id: Ic40cf857e58e7079be9b23f7ae540399ec8fa227 Signed-off-by: PATTANAYAK, SAUMYA SWARUP (sp931a) <sp931a@att.com>
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/job/command/WatchChildrenJobsBL.kt2
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/job/impl/JobsBrokerServiceInDatabaseImpl.java2
-rw-r--r--vid-automation/src/test/java/org/onap/vid/api/AsyncInstantiationALaCarteApiTest.java65
-rw-r--r--vid-automation/src/test/java/org/onap/vid/api/AsyncInstantiationALaCarteApiTest3.java7
4 files changed, 45 insertions, 31 deletions
diff --git a/vid-app-common/src/main/java/org/onap/vid/job/command/WatchChildrenJobsBL.kt b/vid-app-common/src/main/java/org/onap/vid/job/command/WatchChildrenJobsBL.kt
index 09357e519..97aeb894d 100644
--- a/vid-app-common/src/main/java/org/onap/vid/job/command/WatchChildrenJobsBL.kt
+++ b/vid-app-common/src/main/java/org/onap/vid/job/command/WatchChildrenJobsBL.kt
@@ -81,10 +81,10 @@ constructor(private val dataAccessService: DataAccessService, private val featur
a == FAILED_AND_PAUSED || b == FAILED_AND_PAUSED-> FAILED_AND_PAUSED
a == COMPLETED && b.isFailure -> FAILED_AND_PAUSED
b == COMPLETED && a.isFailure -> FAILED_AND_PAUSED
+ a.isFailure || b.isFailure -> FAILED
!a.isFinal || !b.isFinal -> IN_PROGRESS
a == COMPLETED_AND_PAUSED || b == COMPLETED_AND_PAUSED -> COMPLETED_AND_PAUSED
a == COMPLETED || b == COMPLETED -> COMPLETED
- a.isFailure || b.isFailure -> FAILED
else -> COMPLETED_WITH_NO_ACTION
}
} .orElse(COMPLETED_WITH_NO_ACTION)
diff --git a/vid-app-common/src/main/java/org/onap/vid/job/impl/JobsBrokerServiceInDatabaseImpl.java b/vid-app-common/src/main/java/org/onap/vid/job/impl/JobsBrokerServiceInDatabaseImpl.java
index 7391f41a9..ae991eb8d 100644
--- a/vid-app-common/src/main/java/org/onap/vid/job/impl/JobsBrokerServiceInDatabaseImpl.java
+++ b/vid-app-common/src/main/java/org/onap/vid/job/impl/JobsBrokerServiceInDatabaseImpl.java
@@ -249,7 +249,7 @@ public class JobsBrokerServiceInDatabaseImpl implements JobsBrokerService {
String sql = "and JOB.template_id not in \n" +
"(select TEMPLATE_Id from vid_job where" +
" TEMPLATE_Id IS NOT NULL and (JOB_STATUS IN('FAILED','FAILED_AND_PAUSED') "
- + " AND JOB_TYPE NOT IN('NetworkInstantiation','InstanceGroup','InstanceGroupMember') and DELETED_AT is null)" + // failed but not deleted
+ + " AND JOB_TYPE NOT IN('InstanceGroup','InstanceGroupMember') and DELETED_AT is null)" + // failed but not deleted
" or TAKEN_BY IS NOT NULL)";
return featureManager.isActive(Features.FLAG_2008_PAUSE_VFMODULE_INSTANTIATION_FAILURE) ?
sql : "";
diff --git a/vid-automation/src/test/java/org/onap/vid/api/AsyncInstantiationALaCarteApiTest.java b/vid-automation/src/test/java/org/onap/vid/api/AsyncInstantiationALaCarteApiTest.java
index c032d5fed..1ff5f42d6 100644
--- a/vid-automation/src/test/java/org/onap/vid/api/AsyncInstantiationALaCarteApiTest.java
+++ b/vid-automation/src/test/java/org/onap/vid/api/AsyncInstantiationALaCarteApiTest.java
@@ -303,6 +303,13 @@ public class AsyncInstantiationALaCarteApiTest extends AsyncInstantiationBase {
registerExpectationFromPresets(presets, RegistrationStrategy.CLEAR_THEN_SET);
final List<String> uuids = createBulkOfInstances(false, 1, ImmutableMap.of(), DELETE_TWO_VNF_GROUPS_MEMBER_AND_ADD_ONE_REQUEST);
+ //Temporary sleep, as sometime the simulator behaves unexpected
+ try {
+ Thread.sleep(20000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+
assertThat(uuids, hasSize(1));
final String jobId = uuids.get(0);
@@ -424,35 +431,35 @@ public class AsyncInstantiationALaCarteApiTest extends AsyncInstantiationBase {
if(isAsyncAlacarteVfModuleWithPauseOnFailure) {
return new Object[][] {
- {"none", ImmutableMap.of("vfModules", 3L), emptyMap() , true},
- {"none", ImmutableMap.of("vfModules", 3L), emptyMap() , false},
- {"instance",
- ImmutableMap.of("vnfs", 0L, "networks", 0L, "vfModules", 0L, "volumeGroups", 0L),
- ImmutableMap.of("serviceInstances", 1L, "vnfs", 1L, "networks", 1L, "vfModules", 3L, "volumeGroups", 1L),
- true},
- {"network",
- ImmutableMap.of("vnfs", 1L, "networks", 1L, "vfModules", 3L, "volumeGroups", 1L, "serviceInstances", 1L),
- ImmutableMap.of("networks", 1L),
- true},
- {"vnf0",
- ImmutableMap.of("vfModules", 0L, "volumeGroups", 0L),
- ImmutableMap.of("vnfs", 1L, "vfModules", 3L, "volumeGroups", 1L),
- true},
- {"vfModule0", ImmutableMap.of("vfModules", 1L, "volumeGroups", 0L),
- ImmutableMap.of("vfModules", 3L, "volumeGroups", 1L),
- true},
-// {"volumeGroup",
-// ImmutableMap.of("vnfs", 1L, "networks", 1L, "vfModules", 1L, "volumeGroups", 1L, "serviceInstances", 1L),
-// ImmutableMap.of("vfModules", 1L, "volumeGroups", 1L),
-// true},
- {"vfModule1",
- ImmutableMap.of("vfModules", 2L, "volumeGroups", 1L) ,
- ImmutableMap.of("vfModules", 2L, "volumeGroups", 1L) ,
- true},
- {"vfModule2",
- ImmutableMap.of("vfModules", 3L, "volumeGroups", 1L),
- ImmutableMap.of("vfModules", 1L, "volumeGroups", 0L),
- true }
+ {"none", ImmutableMap.of("vfModules", 3L), emptyMap() , true},
+ {"none", ImmutableMap.of("vfModules", 3L), emptyMap() , false},
+ {"instance",
+ ImmutableMap.of("vnfs", 0L, "networks", 0L, "vfModules", 0L, "volumeGroups", 0L),
+ ImmutableMap.of("serviceInstances", 1L, "vnfs", 1L, "networks", 1L, "vfModules", 3L, "volumeGroups", 1L),
+ true},
+ {"network",
+ ImmutableMap.of("serviceInstances", 1L,"networks", 1L,"vnfs", 0L, "vfModules", 0L, "volumeGroups", 0L ),
+ ImmutableMap.of("networks", 1L, "vnfs", 1L,"vfModules", 3L, "volumeGroups", 1L),
+ true},
+ {"vnf0",
+ ImmutableMap.of("vfModules", 0L, "volumeGroups", 0L),
+ ImmutableMap.of("vnfs", 1L, "vfModules", 3L, "volumeGroups", 1L),
+ true},
+ {"vfModule0", ImmutableMap.of("vfModules", 1L, "volumeGroups", 0L),
+ ImmutableMap.of("vfModules", 3L, "volumeGroups", 1L),
+ true},
+ {"volumeGroup",
+ ImmutableMap.of("vnfs", 1L, "networks", 1L, "vfModules", 1L, "volumeGroups", 1L, "serviceInstances", 1L),
+ ImmutableMap.of("vfModules", 2L, "volumeGroups", 1L),
+ true},
+ {"vfModule1",
+ ImmutableMap.of("vfModules", 2L, "volumeGroups", 1L) ,
+ ImmutableMap.of("vfModules", 2L, "volumeGroups", 1L) ,
+ true},
+ {"vfModule2",
+ ImmutableMap.of("vfModules", 3L, "volumeGroups", 1L),
+ ImmutableMap.of("vfModules", 1L, "volumeGroups", 0L),
+ true }
};
} else if (Features.FLAG_ASYNC_ALACARTE_VFMODULE.isActive()) {
return new Object[][]{
diff --git a/vid-automation/src/test/java/org/onap/vid/api/AsyncInstantiationALaCarteApiTest3.java b/vid-automation/src/test/java/org/onap/vid/api/AsyncInstantiationALaCarteApiTest3.java
index 2e21653d0..b6b90a194 100644
--- a/vid-automation/src/test/java/org/onap/vid/api/AsyncInstantiationALaCarteApiTest3.java
+++ b/vid-automation/src/test/java/org/onap/vid/api/AsyncInstantiationALaCarteApiTest3.java
@@ -234,6 +234,13 @@ public class AsyncInstantiationALaCarteApiTest3 extends AsyncInstantiationBase {
RELATED_VNF2_ACTION, "None_Delete"
), PAYLOAD_TEMPLATE_1_VNF_GROUP_WITH_3_MEMBERS_REQUEST);
+ //Temporary sleep, as sometime the simulator behaves unexpected
+ try {
+ Thread.sleep(20000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+
assertThat(uuids, hasSize(1));
final String jobId = uuids.get(0);