diff options
author | Ittay Stern <ittay.stern@att.com> | 2020-02-10 12:27:15 +0200 |
---|---|---|
committer | Ittay Stern <ittay.stern@att.com> | 2020-02-12 10:04:13 +0200 |
commit | 9b2482888c7ac3da22ef9eb41ffc5b7ac864f672 (patch) | |
tree | c89e63cab2fa1477d6388a509a53d0123bd499a1 /vid-automation/src/main/java/org | |
parent | 947262d4f624ef0a8a9e933fbb5c2636f26f837e (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/src/main/java/org')
3 files changed, 59 insertions, 13 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\"," + |