aboutsummaryrefslogtreecommitdiffstats
path: root/vid-automation
diff options
context:
space:
mode:
authorIttay Stern <ittay.stern@att.com>2020-02-10 12:27:15 +0200
committerIttay Stern <ittay.stern@att.com>2020-02-12 10:04:13 +0200
commit9b2482888c7ac3da22ef9eb41ffc5b7ac864f672 (patch)
treec89e63cab2fa1477d6388a509a53d0123bd499a1 /vid-automation
parent947262d4f624ef0a8a9e933fbb5c2636f26f837e (diff)
API tests: support TENANT_AND_REGION_FROM_VNF flag
Input file redux-a-la-carte-no-testapi.json left intact, expectations differ. Issue-ID: VID-758 Change-Id: I3f073517a844bb2f002ff7375b5e3ed836462582 Signed-off-by: Ittay Stern <ittay.stern@att.com>
Diffstat (limited to 'vid-automation')
-rw-r--r--vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateVfModuleALaCarteCypress.java19
-rw-r--r--vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateVfModuleWithVolumeGroupALaCarteCypress.java36
-rw-r--r--vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateVnfALaCarteCypress2.java17
-rw-r--r--vid-automation/src/test/java/org/onap/vid/api/AsyncInstantiationALaCarteApiTest.java28
4 files changed, 79 insertions, 21 deletions
diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateVfModuleALaCarteCypress.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateVfModuleALaCarteCypress.java
index 2a353a38b..762ab6e9a 100644
--- a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateVfModuleALaCarteCypress.java
+++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateVfModuleALaCarteCypress.java
@@ -1,5 +1,7 @@
package org.onap.simulator.presetGenerator.presets.mso;
+import static org.apache.commons.lang3.StringUtils.defaultIfEmpty;
+
import com.google.common.collect.ImmutableMap;
import java.util.Map;
@@ -8,9 +10,17 @@ public class PresetMSOCreateVfModuleALaCarteCypress extends PresetMSOCreateVfMod
protected final Map<Keys, String> names;
public enum Keys {
+ lcpCloudRegionId, tenantId,
modelVersionId, modelName, modelVersion, modelCustomizationId, modelCustomizationName, instanceName, modelInvariantId
}
+ public static Map<Keys, String> lcpCloudRegionIdAndTenantIdNames(String lcpCloudRegionId, String tenantId) {
+ return ImmutableMap.of(
+ Keys.lcpCloudRegionId, lcpCloudRegionId,
+ Keys.tenantId, tenantId
+ );
+ }
+
public static final Map<Keys, String> module0Names = ImmutableMap.<Keys, String>builder()
.put(Keys.instanceName, "mimazepubi")
.put(Keys.modelInvariantId, "b34833bb-6aa9-4ad6-a831-70b06367a091")
@@ -31,9 +41,9 @@ public class PresetMSOCreateVfModuleALaCarteCypress extends PresetMSOCreateVfMod
.put(Keys.modelCustomizationName, "2017488PasqualeVpe..PASQUALE_vPFE_BV..module-2")
.build();
- public PresetMSOCreateVfModuleALaCarteCypress(String overrideRequestId, String serviceInstanceId, String vnfInstanceId, Map<Keys, String> names, String testApi, boolean withTestApi) {
+ public PresetMSOCreateVfModuleALaCarteCypress(String overrideRequestId, String serviceInstanceId, String vnfInstanceId, Map<Keys, String> names, Map<Keys, String> lcpCloudRegionIdAndTenantIdNames, String testApi, boolean withTestApi) {
super(overrideRequestId, DEFAULT_INSTANCE_ID, serviceInstanceId, vnfInstanceId, "vfModule");
- this.names = names;
+ this.names = ImmutableMap.<Keys, String>builder().putAll(names).putAll(lcpCloudRegionIdAndTenantIdNames).build();
this.msoTestApi = testApi;
this.withTestApi = withTestApi;
}
@@ -53,10 +63,9 @@ public class PresetMSOCreateVfModuleALaCarteCypress extends PresetMSOCreateVfMod
" \"modelCustomizationName\":\"" + names.get(Keys.modelCustomizationName) + "\"" +
" }," +
" \"cloudConfiguration\":{" +
- " \"lcpCloudRegionId\":\"hvf6\"," +
+ " \"lcpCloudRegionId\":\"" + defaultIfEmpty(names.get(Keys.lcpCloudRegionId), "hvf6") + "\"," +
addCloudOwnerIfNeeded() +
- " \"tenantId\":\"624eb554b0d147c19ff8885341760481\"" +
-
+ " \"tenantId\":\"" + defaultIfEmpty(names.get(Keys.tenantId), "624eb554b0d147c19ff8885341760481") + "\"" +
" }," +
" \"requestInfo\":{" +
" \"instanceName\":\"" + names.get(Keys.instanceName) + "\"," +
diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateVfModuleWithVolumeGroupALaCarteCypress.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateVfModuleWithVolumeGroupALaCarteCypress.java
index 9d9984a22..ee79e8ceb 100644
--- a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateVfModuleWithVolumeGroupALaCarteCypress.java
+++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateVfModuleWithVolumeGroupALaCarteCypress.java
@@ -5,20 +5,44 @@ public class PresetMSOCreateVfModuleWithVolumeGroupALaCarteCypress extends Prese
private final String vnfInstanceId;
private final String volumeGroupInstanceId;
private final boolean isVolumeGroupPreset;
- private PresetMSOCreateVfModuleWithVolumeGroupALaCarteCypress(Boolean isVolumeGroupPreset, String requestId, String serviceInstanceId, String vnfInstanceId, String volumeGroupInstanceId, String testApi, boolean withTestApi) {
+ private final String lcpCloudRegionId;
+
+ private PresetMSOCreateVfModuleWithVolumeGroupALaCarteCypress(Boolean isVolumeGroupPreset,
+ String requestId,
+ String serviceInstanceId,
+ String vnfInstanceId,
+ String volumeGroupInstanceId,
+ String lcpCloudRegionId,
+ String testApi,
+ boolean withTestApi
+ ) {
super(requestId, isVolumeGroupPreset ? volumeGroupInstanceId : DEFAULT_INSTANCE_ID, testApi, withTestApi);
this.serviceInstanceId = serviceInstanceId;
this.vnfInstanceId = vnfInstanceId;
this.isVolumeGroupPreset = isVolumeGroupPreset;
this.volumeGroupInstanceId = volumeGroupInstanceId;
+ this.lcpCloudRegionId = lcpCloudRegionId;
}
- public static PresetMSOCreateVfModuleWithVolumeGroupALaCarteCypress forVfModule(String requestId, String serviceInstanceId, String vnfInstanceId, String volumeGroupInstanceId, String testApi, boolean withTestApi) {
- return new PresetMSOCreateVfModuleWithVolumeGroupALaCarteCypress(false, requestId, serviceInstanceId, vnfInstanceId, volumeGroupInstanceId, testApi, withTestApi);
+ public static PresetMSOCreateVfModuleWithVolumeGroupALaCarteCypress forVfModule(String requestId,
+ String serviceInstanceId,
+ String vnfInstanceId,
+ String volumeGroupInstanceId,
+ String lcpCloudRegionId,
+ String testApi,
+ boolean withTestApi
+ ) {
+ return new PresetMSOCreateVfModuleWithVolumeGroupALaCarteCypress(false, requestId, serviceInstanceId, vnfInstanceId, volumeGroupInstanceId, lcpCloudRegionId, testApi, withTestApi);
}
- public static PresetMSOCreateVfModuleWithVolumeGroupALaCarteCypress forVolumeGroup(String requestId, String serviceInstanceId, String vnfInstanceId, String testApi, boolean withTestApi) {
- return new PresetMSOCreateVfModuleWithVolumeGroupALaCarteCypress(true, requestId, serviceInstanceId, vnfInstanceId, requestId,testApi, withTestApi);
+ public static PresetMSOCreateVfModuleWithVolumeGroupALaCarteCypress forVolumeGroup(String requestId,
+ String serviceInstanceId,
+ String vnfInstanceId,
+ String lcpCloudRegionId,
+ String testApi,
+ boolean withTestApi
+ ) {
+ return new PresetMSOCreateVfModuleWithVolumeGroupALaCarteCypress(true, requestId, serviceInstanceId, vnfInstanceId, requestId, lcpCloudRegionId, testApi, withTestApi);
}
@Override
@@ -47,7 +71,7 @@ public class PresetMSOCreateVfModuleWithVolumeGroupALaCarteCypress extends Prese
" \"modelCustomizationName\":\"2017488PasqualeVpe..PASQUALE_vRE_BV..module-1\"" +
" }," +
" \"cloudConfiguration\":{" +
- " \"lcpCloudRegionId\":\"my region\"," +
+ " \"lcpCloudRegionId\":\"" + lcpCloudRegionId + "\"," +
addCloudOwnerIfNeeded() +
" \"tenantId\":\"092eb9e8e4b7412e8787dd091bc58e86\"" +
" }," +
diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateVnfALaCarteCypress2.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateVnfALaCarteCypress2.java
index da1c3ffcf..98883ab78 100644
--- a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateVnfALaCarteCypress2.java
+++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateVnfALaCarteCypress2.java
@@ -1,13 +1,26 @@
package org.onap.simulator.presetGenerator.presets.mso;
public class PresetMSOCreateVnfALaCarteCypress2 extends PresetMSOCreateVnfBase {
+
private String vnfInstanceName;
+ private final String lcpCloudRegionId;
+ private final String tenantId;
public PresetMSOCreateVnfALaCarteCypress2(String overrideRequestId, String serviceInstanceId, String responseInstanceId, String vnfInstanceName, String testApi, boolean withTestApi) {
super(overrideRequestId, serviceInstanceId, responseInstanceId);
this.vnfInstanceName = vnfInstanceName;
this.msoTestApi = testApi;
this.withTestApi = withTestApi;
+ lcpCloudRegionId = "just another region";
+ tenantId = "092eb9e8e4b7412e8787dd091bc58e86";
+ }
+
+ public String getLcpCloudRegionId() {
+ return lcpCloudRegionId;
+ }
+
+ public String getTenantId() {
+ return tenantId;
}
@Override
@@ -21,9 +34,9 @@ public class PresetMSOCreateVnfALaCarteCypress2 extends PresetMSOCreateVnfBase {
"\"requestorId\":\"us16807000\"}," +
"\"lineOfBusiness\":{\"lineOfBusinessName\":\"zzz1\"}," +
"\"cloudConfiguration\":" +
- "{\"lcpCloudRegionId\":\"just another region\"," +
+ "{\"lcpCloudRegionId\":\"" + getLcpCloudRegionId() + "\"," +
addCloudOwnerIfNeeded() +
- "\"tenantId\":\"092eb9e8e4b7412e8787dd091bc58e86\"}," +
+ "\"tenantId\":\"" + getTenantId() + "\"}," +
"\"platform\":{\"platformName\":\"xxx1,platform\"}," +
"\"modelInfo\":" +
"{\"modelCustomizationId\":\"1da7b585-5e61-4993-b95e-8e6606c81e45\"," +
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 4d2f06983..20fce4012 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
@@ -41,6 +41,7 @@ import org.onap.simulator.presetGenerator.presets.mso.PresetMSOCreateNetworkALaC
import org.onap.simulator.presetGenerator.presets.mso.PresetMSOCreateServiceInstanceGen2WithNamesAlacarteService;
import org.onap.simulator.presetGenerator.presets.mso.PresetMSOCreateServiceInstanceGen2WithNamesAlacarteServiceCypress;
import org.onap.simulator.presetGenerator.presets.mso.PresetMSOCreateVfModuleALaCarteCypress;
+import org.onap.simulator.presetGenerator.presets.mso.PresetMSOCreateVfModuleALaCarteCypress.Keys;
import org.onap.simulator.presetGenerator.presets.mso.PresetMSOCreateVfModuleWithVolumeGroupALaCarteCypress;
import org.onap.simulator.presetGenerator.presets.mso.PresetMSOCreateVnfALaCarteCypress2;
import org.onap.simulator.presetGenerator.presets.mso.PresetMSOCreateVnfGroup;
@@ -538,10 +539,14 @@ public class AsyncInstantiationALaCarteApiTest extends AsyncInstantiationBase {
String vfModule1RequestId = UUID.randomUUID().toString();
String vfModule2RequestId = UUID.randomUUID().toString();
String volumeGroupRequestId = UUID.randomUUID().toString();
- List<PresetMSOBaseCreateInstancePost> createPresets = ImmutableList.of(
- new PresetMSOCreateServiceInstanceGen2WithNamesAlacarteServiceCypress(names, 0, DEFAULT_REQUEST_ID, Constants.GR_API, withTestApi),
- new PresetMSOCreateVnfALaCarteCypress2(vnfRequestId, DEFAULT_INSTANCE_ID, vnfRequestId, "2017-488_PASQUALE-vPE", Constants.GR_API, withTestApi),
- new PresetMSOCreateNetworkALaCarteCypress(networkRequestId, DEFAULT_INSTANCE_ID, networkRequestId, "ExtVL", Constants.GR_API, withTestApi)
+
+ PresetMSOCreateVnfALaCarteCypress2 vnfPreset =
+ new PresetMSOCreateVnfALaCarteCypress2(vnfRequestId, DEFAULT_INSTANCE_ID, vnfRequestId, "2017-488_PASQUALE-vPE", Constants.GR_API, withTestApi);
+
+ List<PresetMSOBaseCreateInstancePost> createPresets = ImmutableList.of(
+ new PresetMSOCreateServiceInstanceGen2WithNamesAlacarteServiceCypress(names, 0, DEFAULT_REQUEST_ID, Constants.GR_API, withTestApi),
+ vnfPreset,
+ new PresetMSOCreateNetworkALaCarteCypress(networkRequestId, DEFAULT_INSTANCE_ID, networkRequestId, "ExtVL", Constants.GR_API, withTestApi)
);
List<PresetMSOOrchestrationRequestGet> inProgressPresets = ImmutableList.of(
new PresetMSOOrchestrationRequestGet("instance".equals(whatToFail) ? MSO_FAILED_STATUS : COMPLETE),
@@ -554,18 +559,25 @@ public class AsyncInstantiationALaCarteApiTest extends AsyncInstantiationBase {
);
List<BasePreset> presetsWithoutVfModule = getPresets(createPresets, inProgressPresets);
+ String vfModule1CloudRegionId = Features.FLAG_2006_VFMODULE_TAKES_TENANT_AND_REGION_FROM_VNF.isActive() ? vnfPreset.getLcpCloudRegionId() : "my region";
+
+ Map<Keys, String> vfModule0And2LcpCloudRegionIdAndTenantIdNames =
+ PresetMSOCreateVfModuleALaCarteCypress.lcpCloudRegionIdAndTenantIdNames(
+ Features.FLAG_2006_VFMODULE_TAKES_TENANT_AND_REGION_FROM_VNF.isActive() ? vnfPreset.getLcpCloudRegionId() : "hvf6",
+ Features.FLAG_2006_VFMODULE_TAKES_TENANT_AND_REGION_FROM_VNF.isActive() ? vnfPreset.getTenantId() : "624eb554b0d147c19ff8885341760481");
+
ImmutableList<BasePreset> presets = new ImmutableList.Builder<BasePreset>()
.addAll(presetsWithoutVfModule)
.add(new PresetSDCGetServiceToscaModelGet("2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd", "csar-noDynamicFields-ecompNamingFalse-fullModelDetails.zip"))
.add(new PresetSDCGetServiceMetadataGet("2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd", "e49fbd11-e60c-4a8e-b4bf-30fbe8f4fcc0", "csar-noDynamicFields-ecompNamingFalse-fullModelDetails.zip"))
- .add(new PresetMSOCreateVfModuleALaCarteCypress(vfModule0RequestId, DEFAULT_INSTANCE_ID, vnfRequestId, PresetMSOCreateVfModuleALaCarteCypress.module0Names, Constants.GR_API, withTestApi))
- .add(PresetMSOCreateVfModuleWithVolumeGroupALaCarteCypress.forVolumeGroup(volumeGroupRequestId, DEFAULT_INSTANCE_ID, vnfRequestId, Constants.GR_API, withTestApi))
- .add(PresetMSOCreateVfModuleWithVolumeGroupALaCarteCypress.forVfModule(vfModule1RequestId, DEFAULT_INSTANCE_ID, vnfRequestId, volumeGroupRequestId, Constants.GR_API, withTestApi))
+ .add(new PresetMSOCreateVfModuleALaCarteCypress(vfModule0RequestId, DEFAULT_INSTANCE_ID, vnfRequestId, PresetMSOCreateVfModuleALaCarteCypress.module0Names, vfModule0And2LcpCloudRegionIdAndTenantIdNames, Constants.GR_API, withTestApi))
+ .add(PresetMSOCreateVfModuleWithVolumeGroupALaCarteCypress.forVolumeGroup(volumeGroupRequestId, DEFAULT_INSTANCE_ID, vnfRequestId, vfModule1CloudRegionId, Constants.GR_API, withTestApi))
+ .add(PresetMSOCreateVfModuleWithVolumeGroupALaCarteCypress.forVfModule(vfModule1RequestId, DEFAULT_INSTANCE_ID, vnfRequestId, volumeGroupRequestId, vfModule1CloudRegionId, Constants.GR_API, withTestApi))
.add(PresetAAIGetCloudOwnersByCloudRegionId.PRESET_JUST_ANOTHER_REGION_TO_ATT_AIC)
.add(PresetAAIGetCloudOwnersByCloudRegionId.PRESET_MTN6_TO_ATT_AIC)
.add(PresetAAIGetCloudOwnersByCloudRegionId.PRESET_MY_REGION_TO_ATT_AIC)
.add(PresetAAIGetCloudOwnersByCloudRegionId.PRESET_LCP_REGION_TEXT_TO_ATT_AIC)
- .add(new PresetMSOCreateVfModuleALaCarteCypress(vfModule2RequestId, DEFAULT_INSTANCE_ID, vnfRequestId, PresetMSOCreateVfModuleALaCarteCypress.module2Names, Constants.GR_API, withTestApi))
+ .add(new PresetMSOCreateVfModuleALaCarteCypress(vfModule2RequestId, DEFAULT_INSTANCE_ID, vnfRequestId, PresetMSOCreateVfModuleALaCarteCypress.module2Names, vfModule0And2LcpCloudRegionIdAndTenantIdNames, Constants.GR_API, withTestApi))
.build();
registerExpectationFromPresets(