aboutsummaryrefslogtreecommitdiffstats
path: root/vid-automation
diff options
context:
space:
mode:
authorSara Weiss <sara.weiss@intl.att.com>2019-11-14 14:23:16 +0200
committerSara Weiss <sara.weiss@intl.att.com>2019-11-14 14:48:15 +0200
commitfa3fe6f8527d23ed79b9c3f503faf9df81a5eb9d (patch)
treea75b9d66f5f7ae0ee1e567f42d47d860143218c3 /vid-automation
parent97c88e288f56d30b7a3a49366b933cfadbaacf4c (diff)
API test ordering for mso vfModules requests
Issue-ID: VID-253 Signed-off-by: Sara Weiss <sara.weiss@intl.att.com> Change-Id: I9a8594eab3f8e4eacaf503c23f04d1db6b101f90
Diffstat (limited to 'vid-automation')
-rw-r--r--vid-automation/src/main/java/vid/automation/test/services/SimulatorApi.java10
-rw-r--r--vid-automation/src/test/java/org/onap/vid/api/AsyncInstantiationALaCarteApiTest.java39
-rw-r--r--vid-automation/src/test/resources/a-la-carte/redux-a-la-carte-no-testapi.json3
3 files changed, 51 insertions, 1 deletions
diff --git a/vid-automation/src/main/java/vid/automation/test/services/SimulatorApi.java b/vid-automation/src/main/java/vid/automation/test/services/SimulatorApi.java
index ff8f209a8..c8ac7ead9 100644
--- a/vid-automation/src/main/java/vid/automation/test/services/SimulatorApi.java
+++ b/vid-automation/src/main/java/vid/automation/test/services/SimulatorApi.java
@@ -56,17 +56,24 @@ public class SimulatorApi {
public List<StringWrapper> values;
}
+ public static class BodyWrapper {
+ public String value;
+ }
+
public static class HttpRequest {
public StringWrapper path;
+ public BodyWrapper body;
public List<RecordedHeaders> headers;
}
public static class RecordedRequests {
public String path;
+ public String body;
public Map<String, List<String>> headers;
- public RecordedRequests(String path, Map<String, List<String>> headers) {
+ public RecordedRequests(String path, String body, Map<String, List<String>> headers) {
this.path = path;
+ this.body = body;
this.headers = headers;
}
@@ -188,6 +195,7 @@ public class SimulatorApi {
List<HttpRequest> rawRequests = retrieveRecordedHttpRequests();
return rawRequests.stream().map(request->new RecordedRequests(
request.path.value,
+ request.body != null && request.body != null ? request.body.value : "",
request.headers.stream().collect(
Collectors.toMap(
x->x.name.value,
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 25b40ed6b..92d3f79c8 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
@@ -1,12 +1,14 @@
package org.onap.vid.api;
import static java.util.Collections.emptyMap;
+import static java.util.stream.Collectors.toList;
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.hasItems;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.allOf;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.containsInAnyOrder;
+import static org.hamcrest.Matchers.containsInRelativeOrder;
import static org.hamcrest.Matchers.matchesPattern;
import static org.hamcrest.collection.IsCollectionWithSize.hasSize;
import static org.onap.simulator.presetGenerator.presets.BasePresets.BaseMSOPreset.DEFAULT_INSTANCE_ID;
@@ -18,12 +20,14 @@ import static vid.automation.test.services.SimulatorApi.retrieveRecordedRequests
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
+
import java.util.ArrayList;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.UUID;
+
import org.onap.simulator.presetGenerator.presets.BasePresets.BaseMSOPreset;
import org.onap.simulator.presetGenerator.presets.BasePresets.BasePreset;
import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetCloudOwnersByCloudRegionId;
@@ -408,6 +412,23 @@ public class AsyncInstantiationALaCarteApiTest extends AsyncInstantiationBase {
}
}
+
+ @Test
+ public void deployServiceAfterDragAndDropVFModule__verifyOrderMsoCalls() {
+ final ImmutableMap<PresetMSOServiceInstanceGen2WithNames.Keys, String> names = ImmutableMap
+ .of(SERVICE_NAME, "serviceInstanceName");
+ String vnfRequestId = UUID.randomUUID().toString();
+ registerPresetsForRetryTest("none", names, vnfRequestId, false);
+
+ final List<String> uuids = createBulkOfInstances(false, 1, names,
+ CREATE_BULK_OF_ALACARTE_NO_TESTAPI_REQUEST_CYPRESS);
+
+ final String jobId = uuids.get(0);
+
+ assertServiceInfoSpecific2(jobId, JobStatus.COMPLETED, names.get(SERVICE_NAME));
+ assertMSOcalledWithOrder();
+ }
+
@Test
public void verifyMetricsLogInAsyncInstantiation() {
@@ -525,6 +546,24 @@ public class AsyncInstantiationALaCarteApiTest extends AsyncInstantiationBase {
));
}
+
+ private void assertMSOcalledWithOrder() {
+
+ List<RecordedRequests> requests = retrieveRecordedRequests();
+
+ String path = "/mso/serviceInstantiation/v7/serviceInstances/.*/vnfs/.*/vfModules";
+ List<String> msoVFModulesRequests =
+ requests.stream().filter(x -> x.path.matches(path)).map(x -> x.body).collect(toList());
+
+ assertThat("request for vfNodule send with position order",
+ msoVFModulesRequests,
+ contains(
+ containsString("2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0"),
+ containsString("2017488PasqualeVpe..PASQUALE_vPFE_BV..module-2"),
+ containsString("2017488PasqualeVpe..PASQUALE_vRE_BV..module-1")
+ ));
+ }
+
private ImmutableList<JobAuditStatus> vidAuditStatusesCompleted(String jobId) {
return ImmutableList.of(
vidAuditStatus(jobId, "PENDING", false),
diff --git a/vid-automation/src/test/resources/a-la-carte/redux-a-la-carte-no-testapi.json b/vid-automation/src/test/resources/a-la-carte/redux-a-la-carte-no-testapi.json
index a6c4dc16f..dfdab76f7 100644
--- a/vid-automation/src/test/resources/a-la-carte/redux-a-la-carte-no-testapi.json
+++ b/vid-automation/src/test/resources/a-la-carte/redux-a-la-carte-no-testapi.json
@@ -13,6 +13,7 @@
"2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0": {
"instanceName": "mimazepubi",
"lcpCloudRegionId": "hvf6",
+ "position": "2",
"tenantId": "624eb554b0d147c19ff8885341760481",
"rollbackOnFailure": "false",
"sdncPreLoad": false,
@@ -37,6 +38,7 @@
"instanceName": "puwesovabe",
"volumeGroupName": "puwesovabe_vol",
"lcpCloudRegionId": "AAIAIC25",
+ "position": "3",
"legacyRegion": "my region",
"tenantId": "092eb9e8e4b7412e8787dd091bc58e86",
"rollbackOnFailure": "true",
@@ -68,6 +70,7 @@
"instanceName": "bnmgtrx",
"volumeGroupName": "",
"lcpCloudRegionId": "hvf6",
+ "position": "1",
"tenantId": "624eb554b0d147c19ff8885341760481",
"rollbackOnFailure": "false",
"sdncPreLoad": false,