aboutsummaryrefslogtreecommitdiffstats
path: root/vid-app-common
diff options
context:
space:
mode:
Diffstat (limited to 'vid-app-common')
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/job/command/MsoRequestBuilder.kt10
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/mso/model/VfModuleOrVolumeGroupRequestDetails.kt12
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/services/MsoRequestBuilderTest.java20
3 files changed, 28 insertions, 14 deletions
diff --git a/vid-app-common/src/main/java/org/onap/vid/job/command/MsoRequestBuilder.kt b/vid-app-common/src/main/java/org/onap/vid/job/command/MsoRequestBuilder.kt
index c3fdcdaeb..c31e69300 100644
--- a/vid-app-common/src/main/java/org/onap/vid/job/command/MsoRequestBuilder.kt
+++ b/vid-app-common/src/main/java/org/onap/vid/job/command/MsoRequestBuilder.kt
@@ -341,11 +341,13 @@ class MsoRequestBuilder
return subscriberInfo
}
- private fun generateCloudConfiguration(lcpCloudRegionId: String?, tenantId: String?): CloudConfiguration {
+ private fun generateCloudConfiguration(lcpCloudRegionId: String?, tenantId: String?): CloudConfiguration? {
+
+ if (lcpCloudRegionId.isNullOrEmpty()) return null
+
val cloudConfiguration = CloudConfiguration(lcpCloudRegionId, tenantId)
- if (lcpCloudRegionId != null) {
- cloudOwnerService.enrichCloudConfigurationWithCloudOwner(cloudConfiguration, lcpCloudRegionId)
- }
+ cloudOwnerService.enrichCloudConfigurationWithCloudOwner(cloudConfiguration, lcpCloudRegionId)
+
return cloudConfiguration
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/model/VfModuleOrVolumeGroupRequestDetails.kt b/vid-app-common/src/main/java/org/onap/vid/mso/model/VfModuleOrVolumeGroupRequestDetails.kt
index bf9e41ad9..51910c45a 100644
--- a/vid-app-common/src/main/java/org/onap/vid/mso/model/VfModuleOrVolumeGroupRequestDetails.kt
+++ b/vid-app-common/src/main/java/org/onap/vid/mso/model/VfModuleOrVolumeGroupRequestDetails.kt
@@ -93,12 +93,12 @@ import java.util.*
*/
-data class VfModuleOrVolumeGroupRequestDetails(
- val modelInfo: ModelInfo,
- val cloudConfiguration: CloudConfiguration,
- val requestInfo: RequestInfo,
- val relatedInstanceList: List<RelatedInstance>?,
- val requestParameters: RequestParametersVfModuleOrVolumeGroup?)
+class VfModuleOrVolumeGroupRequestDetails(
+ modelInfo: ModelInfo,
+ cloudConfiguration: CloudConfiguration?,
+ requestInfo: RequestInfo,
+ relatedInstanceList: List<RelatedInstance>?,
+ requestParameters: RequestParametersVfModuleOrVolumeGroup?)
: BaseResourceInstantiationRequestDetails(modelInfo, cloudConfiguration, requestInfo, relatedInstanceList, requestParameters)
open class RequestParametersVfModuleOrVolumeGroup internal constructor(
diff --git a/vid-app-common/src/test/java/org/onap/vid/services/MsoRequestBuilderTest.java b/vid-app-common/src/test/java/org/onap/vid/services/MsoRequestBuilderTest.java
index 71d38b3f8..ef2a6a5fb 100644
--- a/vid-app-common/src/test/java/org/onap/vid/services/MsoRequestBuilderTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/services/MsoRequestBuilderTest.java
@@ -659,24 +659,36 @@ public class MsoRequestBuilderTest extends AsyncInstantiationBaseTest {
assertThat(generatedVfModuleReplaceRequest(retainAssignments, retainVolumeGroups, null), jsonEquals(expected).when(IGNORING_ARRAY_ORDER));
}
+ @Test
+ public void generateReplaceVfModuleRequestWithoutCloudConfiguration_verifyResultAsExpected() {
+ String expected = TestUtils.readFileAsString("/payload_jsons/vfmodule/replace_vfmodule__payload_to_mso.json");
+ assertThat(generatedVfModuleReplaceRequestWithOrWithoutCloudConfiguration(null, null, null, true), jsonNodeAbsent("requestDetails.cloudConfiguration"));
+ assertThat(generatedVfModuleReplaceRequestWithOrWithoutCloudConfiguration(null, null, null, true), jsonEquals(expected).whenIgnoringPaths("requestDetails.cloudConfiguration").when(IGNORING_ARRAY_ORDER));
+ }
+
private RequestDetailsWrapper<VfModuleOrVolumeGroupRequestDetails> generatedVfModuleReplaceRequest(
Boolean retainAssignments, Boolean retainVolumeGroups, List<UserParamNameAndValue> supplementaryParams) {
+ return generatedVfModuleReplaceRequestWithOrWithoutCloudConfiguration(retainAssignments, retainVolumeGroups, supplementaryParams, false);
+ }
+
+ private RequestDetailsWrapper<VfModuleOrVolumeGroupRequestDetails> generatedVfModuleReplaceRequestWithOrWithoutCloudConfiguration(
+ Boolean retainAssignments, Boolean retainVolumeGroups, List<UserParamNameAndValue> supplementaryParams, Boolean noHomingData) {
when(featureManager.isActive(Features.FLAG_1810_CR_ADD_CLOUD_OWNER_TO_MSO_REQUEST)).thenReturn(true);
when(aaiClient.getCloudOwnerByCloudRegionId("regionOne")).thenReturn("irma-aic");
ModelInfo vfModuleModelInfo = createVfModuleModelInfo("newest-model-name-vfm", "newest-model-version-vfm", "newest-model-uuid-vfm",
"f7a867f2-596b-4f4a-a128-421e825a6190", "newest-model-customization-uuid-vfm","newest-model-customization-name-vfm" );
- VfModule vfModuleDetails = createVfModuleForReplace(vfModuleModelInfo, "replace_module", "regionOne", "0422ffb57ba042c0800a29dc85ca70f8",
- retainAssignments, retainVolumeGroups, supplementaryParams);
+ VfModule vfModuleDetails = createVfModuleForReplace(vfModuleModelInfo, "replace_module", noHomingData? null : "regionOne", noHomingData? null :"0422ffb57ba042c0800a29dc85ca70f8",
+ retainAssignments, retainVolumeGroups, supplementaryParams);
ModelInfo serviceModelInfo = createServiceModelInfo("newest-model-name-service", "newest-model-version-service", "newest-model-uuid-service", "b16a9398-ffa3-4041-b78c-2956b8ad9c7b", null, null );
ModelInfo vnfModelInfo = createVnfModelInfo("newest-model-name-vnf", "newest-model-version-vnf", "newest-model-uuid-vnf", "23122c9b-dd7f-483f-bf0a-e069303db2f7", "newest-model-customization-uuid-vnf", "newest-model-customization-name-vnf" );
return msoRequestBuilder.generateVfModuleReplaceRequest(vfModuleDetails, serviceModelInfo,
- "e9993045-cc96-4f3f-bf9a-71b2a400a956", vnfModelInfo,
- "5c9c2896-1fe6-4055-b7ec-d0a01e5f9bf5", null, "az2016", "GR_API"
+ "e9993045-cc96-4f3f-bf9a-71b2a400a956", vnfModelInfo,
+ "5c9c2896-1fe6-4055-b7ec-d0a01e5f9bf5", null, "az2016", "GR_API"
);
}
}