Fix the format of supplementary file and user params for aLaCarte requests 91/100091/8
authorEylon Malin <eylon.malin@intl.att.com>
Wed, 8 Jan 2020 14:03:08 +0000 (16:03 +0200)
committerIttay Stern <ittay.stern@att.com>
Thu, 9 Jan 2020 15:17:46 +0000 (17:17 +0200)
supplementary file shall be in format [{"name": "fieldName", "value" : "xyz"}]
Also this is the format of each param in user params for aLaCarte requests and old macros

Issue-ID: VID-743
Change-Id: I579298ce3f0b789a7a69e6af5a85bfbd50ae9fc0
Signed-off-by: Eylon Malin <eylon.malin@intl.att.com>
18 files changed:
vid-app-common/src/main/java/org/onap/vid/job/command/MsoRequestBuilder.kt
vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/VfModule.java
vid-app-common/src/main/java/org/onap/vid/mso/model/ServiceInstantiationRequestDetails.java
vid-app-common/src/main/java/org/onap/vid/services/UserParamsContainer.kt [new file with mode: 0644]
vid-app-common/src/main/java/org/onap/vid/utils/Logging.java
vid-app-common/src/test/java/org/onap/vid/model/serviceInstantiation/InstantiationModelSerializationTest.java
vid-app-common/src/test/java/org/onap/vid/services/AAITreeNodeBuilderTest.java
vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBaseTest.java
vid-app-common/src/test/java/org/onap/vid/services/MsoRequestBuilderTest.java
vid-app-common/src/test/java/org/onap/vid/services/UserParamsContainerTest.kt [new file with mode: 0644]
vid-app-common/src/test/resources/payload_jsons/vfmodule_instantiation_request.json
vid-app-common/src/test/resources/payload_jsons/vfmodule_instantiation_request_without_instance_name.json
vid-app-common/src/test/resources/payload_jsons/vfmodule_instantiation_request_without_volume_group.json
vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateVfModuleALaCarteE2E.java
vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/mso/PresetMSOCreateVfModuleWithVolumeGroupALaCarteCypress.java
vid-automation/src/main/resources/supplementaryFiles/sample.json
vid-webpack-master/cypress/integration/iFrames/drawingBoard.e2e.ts
vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModuleUpgrade/vfModule.upgrade.popup.service.spec.ts

index e46a24f..063ef6e 100644 (file)
@@ -11,11 +11,12 @@ import org.onap.vid.changeManagement.RequestDetailsWrapper
 import org.onap.vid.model.serviceInstantiation.*
 import org.onap.vid.mso.model.*
 import org.onap.vid.mso.model.BaseResourceInstantiationRequestDetails.*
+import org.onap.vid.mso.model.ServiceInstantiationRequestDetails.UserParamNameAndValue
 import org.onap.vid.mso.rest.SubscriberInfo
 import org.onap.vid.properties.Features
 import org.onap.vid.services.AsyncInstantiationBusinessLogic
 import org.onap.vid.services.CloudOwnerService
-import org.onap.vid.utils.JACKSON_OBJECT_MAPPER
+import org.onap.vid.services.UserParamsContainer
 import org.springframework.beans.factory.annotation.Autowired
 import org.springframework.stereotype.Service
 import org.togglz.core.manager.FeatureManager
@@ -108,7 +109,7 @@ class MsoRequestBuilder
         //cloud configuration
         val cloudConfiguration = generateCloudConfiguration(vfModuleDetails.lcpCloudRegionId, vfModuleDetails.tenantId)
 
-        val userParams = aggregateAllInstanceParams(extractActualInstanceParams(vfModuleDetails.instanceParams), vfModuleDetails.supplementaryParams)
+        val userParams = UserParamsContainer(extractActualInstanceParams(vfModuleDetails.instanceParams), vfModuleDetails.supplementaryParams)
 
         //related instance list
         val relatedInstanceList = generateRelatedInstances(mapOf(serviceInstanceId to serviceModelInfo, vnfInstanceId to vnfModelInfo))
@@ -118,7 +119,7 @@ class MsoRequestBuilder
             relatedInstanceList.add(RelatedInstance(volumeGroupModel, vgInstanceId, vfModuleDetails.volumeGroupInstanceName))
         }
 
-        return RequestDetailsWrapper(VfModuleOrVolumeGroupRequestDetails(vfModuleDetails.modelInfo, cloudConfiguration, requestInfo, relatedInstanceList, requestParameters(userParams)))
+        return RequestDetailsWrapper(VfModuleOrVolumeGroupRequestDetails(vfModuleDetails.modelInfo, cloudConfiguration, requestInfo, relatedInstanceList, requestParameters(userParams.toALaCarte())))
     }
 
     fun generateVfModuleInstantiationRequest(
@@ -153,8 +154,8 @@ class MsoRequestBuilder
     fun generateVolumeGroupInstantiationRequest(vfModuleDetails: VfModule, serviceModelInfo: ModelInfo, serviceInstanceId: String, vnfModelInfo: ModelInfo, vnfInstanceId: String, userId: String, testApi: String?): RequestDetailsWrapper<VolumeGroupRequestDetails> {
         val requestInfo = generateRequestInfo(vfModuleDetails.volumeGroupInstanceName, ResourceType.VOLUME_GROUP, vfModuleDetails.isRollbackOnFailure, null, userId)
         val cloudConfiguration = generateCloudConfiguration(vfModuleDetails.lcpCloudRegionId, vfModuleDetails.tenantId)
-        val userParams = aggregateAllInstanceParams(extractActualInstanceParams(vfModuleDetails.instanceParams), vfModuleDetails.supplementaryParams)
-        val requestParameters = RequestParametersVfModuleOrVolumeGroupInstantiation(userParams, vfModuleDetails.isUsePreload, testApi)
+        val userParams = UserParamsContainer(extractActualInstanceParams(vfModuleDetails.instanceParams), vfModuleDetails.supplementaryParams)
+        val requestParameters = RequestParametersVfModuleOrVolumeGroupInstantiation(userParams.toALaCarte(), vfModuleDetails.isUsePreload, testApi)
         val relatedInstances = generateRelatedInstances(mapOf(serviceInstanceId to serviceModelInfo, vnfInstanceId to vnfModelInfo))
 
         vfModuleDetails.modelInfo.modelType = "volumeGroup"
@@ -283,39 +284,17 @@ class MsoRequestBuilder
     private fun convertVfModuleMapToList(vfModules: Map<String, Map<String, VfModule>>): List<VfModuleMacro> {
         return vfModules.values.stream().flatMap { vfModule ->
             vfModule.values.stream().map { item ->
-                val aggregatedParams = aggregateAllInstanceParams(extractActualInstanceParams(item.instanceParams), item.supplementaryParams)
-                val aggregatedParamsConverted = JACKSON_OBJECT_MAPPER.convertValue(aggregatedParams, List::class.java)
+                val userParams = UserParamsContainer(extractActualInstanceParams(item.instanceParams), item.supplementaryParams)
 
                 VfModuleMacro(
                         item.modelInfo,
                         item.instanceName,
                         item.volumeGroupInstanceName,
-                        aggregatedParamsConverted as List<Map<String, String>>)
+                        userParams.toMacroPost1806())
             }
         }.collect(Collectors.toList<VfModuleMacro>())
     }
 
-    fun aggregateAllInstanceParams(instanceParams: Map<String, String>?, supplementaryParams: Map<String, String>?): List<UserParamMap<String, String>> {
-        var instanceParamsFinal: Map<String, String> = instanceParams ?: emptyMap()
-        val supplementaryParamsFinal: Map<String, String> = supplementaryParams ?: emptyMap()
-
-        if (!(instanceParamsFinal.isEmpty() && supplementaryParamsFinal.isEmpty())) {
-            //remove duplicate keys from instanceParams if exist in supplementaryParams
-            instanceParamsFinal = instanceParamsFinal.entries.stream()
-                    .filter { m -> !supplementaryParamsFinal.containsKey(m.key) }
-                    .collect(Collectors.toMap({ it.key }, { it.value }))
-
-            //aggregate the 2 collections and format them as UserParamMap
-            val aggregatedParams = UserParamMap<String, String>()
-            aggregatedParams.putAll(instanceParamsFinal)
-            aggregatedParams.putAll(supplementaryParamsFinal)
-
-            return mutableListOf(aggregatedParams)
-        }
-
-        return emptyList()
-    }
-
     //Make sure we always get a one Map from InstanceParams
     private fun extractActualInstanceParams(originalInstanceParams: List<MutableMap<String, String>>?): MutableMap<String, String> {
         return if (originalInstanceParams.isNullOrEmpty() || originalInstanceParams[0].isNullOrEmpty()) {
@@ -394,14 +373,14 @@ class MsoRequestBuilder
         }
     }
 
-    private fun generateUserParamList(): List<ServiceInstantiationRequestDetails.UserParamNameAndValue> {
+    private fun generateUserParamList(): List<UserParamNameAndValue> {
         return emptyList()
     }
 
     fun generateMacroServicePre1806InstantiationRequest(payload: ServiceInstantiation, userId: String): RequestDetailsWrapper<ServiceInstantiationRequestDetails> {
         val requestInfo = ServiceInstantiationRequestDetails.RequestInfo(payload.instanceName, payload.productFamilyId, VID_SOURCE, payload.isRollbackOnFailure, userId)
-        val userParams = generateUserParamsNameAndValue(payload.instanceParams)
-        val requestParameters = ServiceInstantiationRequestDetails.RequestParameters(payload.subscriptionServiceType, false, userParams)
+        val userParams = UserParamsContainer(generateSingleMapFromInstanceParams(payload.instanceParams), emptyList())
+        val requestParameters = ServiceInstantiationRequestDetails.RequestParameters(payload.subscriptionServiceType, false, userParams.toMacroPre1806())
         val subscriberInfo = generateSubscriberInfoPre1806(payload)
         val project = if (payload.projectName != null) ServiceInstantiationRequestDetails.Project(payload.projectName) else null
         val owningEntity = ServiceInstantiationRequestDetails.ServiceInstantiationOwningEntity(payload.owningEntityId, payload.owningEntityName)
@@ -419,8 +398,8 @@ class MsoRequestBuilder
                 relatedInstanceList))
     }
 
-    private fun generateUserParamsNameAndValue(instanceParams: List<Map<String, String>>): List<ServiceInstantiationRequestDetails.UserParamNameAndValue> {
-        return instanceParams.getOrElse(0) {emptyMap()}.map{ x-> ServiceInstantiationRequestDetails.UserParamNameAndValue(x.key, x.value)}
+    private fun generateSingleMapFromInstanceParams(instanceParams: List<Map<String, String>>): Map<String, String> {
+        return if (instanceParams.isNullOrEmpty()) emptyMap() else instanceParams[0]
     }
 
     private fun generateSubscriberInfoPre1806(payload: ServiceInstantiation): SubscriberInfo {
index 89e25e6..d04e679 100644 (file)
@@ -33,6 +33,7 @@ import javax.annotation.Nullable;
 import org.onap.vid.job.JobAdapter;
 import org.onap.vid.job.JobType;
 import org.onap.vid.mso.model.ModelInfo;
+import org.onap.vid.mso.model.ServiceInstantiationRequestDetails.UserParamNameAndValue;
 
 /**
  * The Class VfModule.
@@ -42,7 +43,7 @@ public class VfModule extends BaseResource implements JobAdapter.AsyncJobRequest
 
        @JsonInclude(NON_NULL) @JsonProperty("volumeGroupName") private final String volumeGroupInstanceName;
        @JsonInclude(NON_NULL) @JsonProperty("sdncPreLoad") private Boolean usePreload;
-       private Map<String, String> supplementaryParams;
+       private List<UserParamNameAndValue> supplementaryParams;
 
        @JsonInclude(NON_NULL)
        private final Boolean retainVolumeGroups;
@@ -58,7 +59,7 @@ public class VfModule extends BaseResource implements JobAdapter.AsyncJobRequest
                @JsonProperty("legacyRegion") String legacyRegion,
                @JsonProperty("tenantId") String tenantId,
                @JsonProperty("instanceParams") List<Map<String, String>> instanceParams,
-               @JsonProperty("supplementaryFileContent") Map<String, String> supplementaryParams,
+               @JsonProperty("supplementaryFileContent") List<UserParamNameAndValue> supplementaryParams,
                @JsonProperty("rollbackOnFailure") boolean rollbackOnFailure,
                @JsonProperty("sdncPreLoad") @JsonAlias("usePreload") Boolean usePreload,
                @JsonProperty("instanceId") String instanceId,
@@ -86,7 +87,7 @@ public class VfModule extends BaseResource implements JobAdapter.AsyncJobRequest
                return usePreload;
        }
 
-       public Map<String, String> getSupplementaryParams() {
+       public List<UserParamNameAndValue> getSupplementaryParams() {
                return supplementaryParams;
        }
 
index e610d6c..acbf778 100644 (file)
 
 package org.onap.vid.mso.model;
 
+import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_EMPTY;
+import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
 import com.fasterxml.jackson.annotation.JsonInclude;
 import com.fasterxml.jackson.annotation.JsonProperty;
-import org.onap.vid.mso.rest.SubscriberInfo;
-
 import java.util.List;
 import java.util.Map;
-
-import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_EMPTY;
-import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL;
+import java.util.Objects;
+import org.onap.vid.mso.rest.SubscriberInfo;
 
 public class ServiceInstantiationRequestDetails {
 
@@ -122,7 +123,11 @@ public class ServiceInstantiationRequestDetails {
         private final String name;
         private final String value;
 
-        public UserParamNameAndValue(String name, String value) {
+        @JsonCreator
+        public UserParamNameAndValue(
+            @JsonProperty("name") String name,
+            @JsonProperty("value") String value
+        ) {
             this.name = name;
             this.value = value;
         }
@@ -134,6 +139,24 @@ public class ServiceInstantiationRequestDetails {
         public String getValue() {
             return value;
         }
+
+        @Override
+        public boolean equals(Object o) {
+            if (this == o) {
+                return true;
+            }
+            if (!(o instanceof UserParamNameAndValue)) {
+                return false;
+            }
+            UserParamNameAndValue that = (UserParamNameAndValue) o;
+            return Objects.equals(getName(), that.getName()) &&
+                Objects.equals(getValue(), that.getValue());
+        }
+
+        @Override
+        public int hashCode() {
+            return Objects.hash(getName(), getValue());
+        }
     }
 
     public static class HomingSolution implements UserParamTypes {
diff --git a/vid-app-common/src/main/java/org/onap/vid/services/UserParamsContainer.kt b/vid-app-common/src/main/java/org/onap/vid/services/UserParamsContainer.kt
new file mode 100644 (file)
index 0000000..17cf88e
--- /dev/null
@@ -0,0 +1,40 @@
+package org.onap.vid.services
+
+import org.onap.vid.mso.model.ServiceInstantiationRequestDetails.UserParamNameAndValue
+import org.onap.vid.mso.model.UserParamTypes
+
+class UserParamsContainer(instanceParams: Map<String, String>?, supplementaryParams: List<UserParamNameAndValue>?) {
+
+    val params:Map<String, String>
+
+    init {
+        params = aggregateAllInstanceParams(instanceParams, supplementaryParams)
+    }
+
+    private fun aggregateAllInstanceParams(
+            instanceParams: Map<String, String>?,
+            supplementaryParams: List<UserParamNameAndValue>?)
+            : Map<String, String> {
+        val instanceParamsSafe: Map<String, String> = instanceParams ?: emptyMap()
+        val supplementaryParamsSafe: Map<String, String> =
+                supplementaryParams?.associate{ it.name to it.value } ?: emptyMap()
+
+        return instanceParamsSafe.plus(supplementaryParamsSafe)
+    }
+
+    fun toALaCarte(): List<UserParamTypes> = toUserParamNameAndValue()
+
+    fun toMacroPre1806() : List<UserParamTypes> = toUserParamNameAndValue()
+
+    fun toMacroPost1806() : List<Map<String, String>> = toListOfMap()
+
+    private fun toUserParamNameAndValue(): List<UserParamNameAndValue> {
+        return params.map{UserParamNameAndValue(it.key, it.value)}.toList()
+    }
+
+    private fun toListOfMap() : List<Map<String, String>> {
+        return listOf(params)
+    }
+}
+
+
index 43f059d..f9894d1 100644 (file)
@@ -20,6 +20,7 @@
 
 package org.onap.vid.utils;
 
+import static java.util.Collections.emptyMap;
 import static org.apache.commons.lang3.ObjectUtils.defaultIfNull;
 import static org.apache.commons.lang3.exception.ExceptionUtils.getRootCause;
 import static org.apache.commons.lang3.exception.ExceptionUtils.getThrowableList;
@@ -220,7 +221,7 @@ public class Logging {
 
     <T> T withMDCInternal(Map<String, String> copyOfParentMDC, UncheckedThrowingSupplier<T> supplier) {
         try {
-            MDC.setContextMap(copyOfParentMDC);
+            MDC.setContextMap(defaultIfNull(copyOfParentMDC, emptyMap()));
             return supplier.get();
         } finally {
             MDC.clear();
index b5d2816..b7ae769 100644 (file)
@@ -38,6 +38,7 @@ import static org.onap.vid.utils.KotlinUtilsKt.JACKSON_OBJECT_MAPPER;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableMap;
 import java.lang.reflect.InvocationTargetException;
+import java.util.List;
 import java.util.Map;
 import org.apache.commons.beanutils.PropertyUtils;
 import org.onap.vid.model.VidNotions;
@@ -45,6 +46,7 @@ import org.onap.vid.model.VidNotions.InstantiationType;
 import org.onap.vid.model.VidNotions.InstantiationUI;
 import org.onap.vid.model.VidNotions.ModelCategory;
 import org.onap.vid.mso.model.ModelInfo;
+import org.onap.vid.mso.model.ServiceInstantiationRequestDetails.UserParamNameAndValue;
 import org.testng.annotations.Test;
 
 public class InstantiationModelSerializationTest {
@@ -125,10 +127,10 @@ public class InstantiationModelSerializationTest {
     @Test
     public void serializeAndDeserializeVfModule() throws Exception {
 
-        ImmutableMap<String, String> supplementaryParams = ImmutableMap.of(
-            "uno", "1",
-            "dos", "2",
-            "tres", "3"
+        List<UserParamNameAndValue> supplementaryParams = ImmutableList.of(
+            new UserParamNameAndValue("uno", "1"),
+            new UserParamNameAndValue("dos", "2"),
+            new UserParamNameAndValue("tres", "3")
         );
 
         VfModule vfModule = new VfModule(
index 2904183..67d3d4a 100644 (file)
@@ -50,7 +50,10 @@ import java.util.Optional;
 import java.util.concurrent.ConcurrentSkipListSet;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
+import org.apache.commons.lang3.exception.ExceptionUtils;
 import org.apache.commons.lang3.tuple.Pair;
+import org.apache.log4j.LogManager;
+import org.apache.log4j.Logger;
 import org.jetbrains.annotations.NotNull;
 import org.mockito.Mock;
 import org.mockito.stubbing.Answer;
@@ -79,6 +82,7 @@ public class AAITreeNodeBuilderTest {
 
     private ExecutorService executorService;
     private Logging logging = new Logging();
+    private static final Logger logger = LogManager.getLogger(AAITreeNodeBuilderTest.class);
 
     private static final ObjectMapper mapper = new ObjectMapper();
 
@@ -92,7 +96,9 @@ public class AAITreeNodeBuilderTest {
     private void buildNodeAndAssert(JsonNode inputNode, AAITreeNode expectedNode, NodeType nodeType){
         ConcurrentSkipListSet<AAITreeNode> nodesAccumulator = new ConcurrentSkipListSet<>(comparing(AAITreeNode::getUniqueNodeKey));
         when(aaiClientMock.typedAaiRest(Unchecked.toURI("anyUrl"), JsonNode.class, null, HttpMethod.GET, false)).thenReturn(inputNode);
-        AAITreeNode actualNode = aaiTreeNodeBuilder.buildNode(
+        AAITreeNode actualNode;
+        try {
+            actualNode = aaiTreeNodeBuilder.buildNode(
                 nodeType,
                 "anyUrl",
                 null,
@@ -100,7 +106,16 @@ public class AAITreeNodeBuilderTest {
                 nodesAccumulator,
                 executorService,
                 AAI_TREE_PATHS.getSubTree(new AAIServiceTree.AaiRelationship(nodeType))
-        ).get(0);
+            ).get(0);
+        } catch (Throwable e) {
+            //print stack traces for more information in case of failure
+            System.out.println("Failed to build node by aaiTreeNodeBuilder");
+            ExceptionUtils.getThrowableList(e)
+                .stream()
+                .peek(it ->System.err.println(it.getLocalizedMessage()))
+                .forEach(Throwable::printStackTrace);
+            throw e;
+        }
         assertThat(actualNode, jsonEquals(expectedNode).when(IGNORING_ARRAY_ORDER, IGNORING_EXTRA_FIELDS).whenIgnoringPaths("relationshipList","children[0].relationshipList"));
     }
 
index b953500..83130fd 100644 (file)
@@ -22,7 +22,6 @@ package org.onap.vid.services;
 
 import static java.util.Collections.emptyList;
 import static java.util.Collections.emptyMap;
-import static org.hamcrest.MatcherAssert.assertThat;
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.ArgumentMatchers.anyString;
 import static org.mockito.ArgumentMatchers.eq;
@@ -65,6 +64,7 @@ import org.onap.vid.model.serviceInstantiation.VfModule;
 import org.onap.vid.model.serviceInstantiation.Vnf;
 import org.onap.vid.mso.RestObject;
 import org.onap.vid.mso.model.ModelInfo;
+import org.onap.vid.mso.model.ServiceInstantiationRequestDetails.UserParamNameAndValue;
 import org.onap.vid.mso.rest.AsyncRequestStatus;
 import org.onap.vid.mso.rest.RequestStatus;
 import org.onap.vid.properties.Features;
@@ -250,7 +250,7 @@ public class AsyncInstantiationBaseTest extends AbstractTestNGSpringContextTests
     }
 
     protected VfModule createVfModule(String modelName, String modelVersionId, String modelCustomizationId,
-                                    List<Map<String, String>> instanceParams, Map<String, String> supplementaryParams, String instanceName, String volumeGroupInstanceName, boolean isAlacarte) {
+                                    List<Map<String, String>> instanceParams, List<UserParamNameAndValue> supplementaryParams, String instanceName, String volumeGroupInstanceName, boolean isAlacarte) {
         ModelInfo vfModuleInfo = new ModelInfo();
         vfModuleInfo.setModelType("vfModule");
         vfModuleInfo.setModelName(modelName);
@@ -276,7 +276,7 @@ public class AsyncInstantiationBaseTest extends AbstractTestNGSpringContextTests
     }
 
     protected VfModule createVfModuleForReplace(ModelInfo vfModuleModelInfo, String instanceName,
-        String lcpCloudRegionId, String tenantId, Boolean retainAssignments, Boolean retainVolumeGroups, Map<String, String> supplementaryParams) {
+        String lcpCloudRegionId, String tenantId, Boolean retainAssignments, Boolean retainVolumeGroups, List<UserParamNameAndValue> supplementaryParams) {
         return new VfModule( vfModuleModelInfo, instanceName, null, Action.Upgrade.name(), lcpCloudRegionId, null, tenantId,
                 null, supplementaryParams, true, null, null, UUID.randomUUID().toString(), null, null, retainAssignments, retainVolumeGroups, null);
     }
@@ -349,9 +349,9 @@ public class AsyncInstantiationBaseTest extends AbstractTestNGSpringContextTests
         Map<String, Map<String, VfModule>> vfModules = new HashMap<>();
 
         List<Map<String, String>> instanceParams1 = ImmutableList.of((ImmutableMap.of("vmx_int_net_len", "24")));
-        VfModule vfModule1 = createVfModule("201673MowAvpnVpeBvL..AVPN_base_vPE_BV..module-0", VF_MODULE_0_MODEL_VERSION_ID, VF_MODULE_0_MODEL_CUSTOMIZATION_NAME, instanceParams1, new HashMap<>(), (isUserProvidedNaming ? "vmxnjr001_AVPN_base_vPE_BV_base" : null), null, isAlacarte);
+        VfModule vfModule1 = createVfModule("201673MowAvpnVpeBvL..AVPN_base_vPE_BV..module-0", VF_MODULE_0_MODEL_VERSION_ID, VF_MODULE_0_MODEL_CUSTOMIZATION_NAME, instanceParams1, emptyList(), (isUserProvidedNaming ? "vmxnjr001_AVPN_base_vPE_BV_base" : null), null, isAlacarte);
         List<Map<String, String>> instanceParams2 = ImmutableList.of(vfModuleInstanceParamsMap);
-        VfModule vfModule2 = createVfModule("201673MowAvpnVpeBvL..AVPN_vRE_BV..module-1", VF_MODULE_1_MODEL_VERSION_ID, VF_MODULE_1_MODEL_CUSTOMIZATION_NAME, instanceParams2, new HashMap<>(), (isUserProvidedNaming ? "vmxnjr001_AVPN_base_vRE_BV_expansion": null), (isUserProvidedNaming ? "myVgName" : null), isAlacarte);
+        VfModule vfModule2 = createVfModule("201673MowAvpnVpeBvL..AVPN_vRE_BV..module-1", VF_MODULE_1_MODEL_VERSION_ID, VF_MODULE_1_MODEL_CUSTOMIZATION_NAME, instanceParams2, emptyList(), (isUserProvidedNaming ? "vmxnjr001_AVPN_base_vRE_BV_expansion": null), (isUserProvidedNaming ? "myVgName" : null), isAlacarte);
 
         String vfModuleModelName = vfModule1.getModelInfo().getModelName();
         vfModules.put(vfModuleModelName, new LinkedHashMap<>());
index efd9e2b..dea9e09 100644 (file)
 package org.onap.vid.services;
 
 import static com.google.common.collect.Maps.newHashMap;
+import static java.util.Collections.EMPTY_LIST;
+import static java.util.Collections.EMPTY_MAP;
+import static java.util.Collections.emptyList;
+import static java.util.Collections.singletonList;
 import static net.javacrumbs.jsonunit.JsonMatchers.jsonEquals;
 import static net.javacrumbs.jsonunit.JsonMatchers.jsonNodeAbsent;
 import static net.javacrumbs.jsonunit.JsonMatchers.jsonPartEquals;
@@ -41,7 +45,6 @@ import java.lang.reflect.Method;
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -78,7 +81,7 @@ import org.onap.vid.mso.model.ModelInfo;
 import org.onap.vid.mso.model.NetworkInstantiationRequestDetails;
 import org.onap.vid.mso.model.ServiceDeletionRequestDetails;
 import org.onap.vid.mso.model.ServiceInstantiationRequestDetails;
-import org.onap.vid.mso.model.UserParamMap;
+import org.onap.vid.mso.model.ServiceInstantiationRequestDetails.UserParamNameAndValue;
 import org.onap.vid.mso.model.VfModuleMacro;
 import org.onap.vid.mso.model.VfModuleOrVolumeGroupRequestDetails;
 import org.onap.vid.mso.model.VnfInstantiationRequestDetails;
@@ -163,7 +166,7 @@ public class MsoRequestBuilderTest extends AsyncInstantiationBaseTest {
     private void createMacroServiceInfo_WithUserProvidedNamingFalse_ServiceInfoIsAsExpected(boolean withVfmodules, boolean disabledHoming) throws IOException {
 
         ServiceInstantiation serviceInstantiationPayload = generateMockMacroServiceInstantiationPayload(true,
-                createVnfList(vfModuleInstanceParamsMapWithParamsToRemove, Collections.EMPTY_LIST, false),
+                createVnfList(vfModuleInstanceParamsMapWithParamsToRemove, EMPTY_LIST, false),
                 1,
                 false, PROJECT_NAME, true);
         URL resource;
@@ -181,7 +184,7 @@ public class MsoRequestBuilderTest extends AsyncInstantiationBaseTest {
                 msoRequestBuilder.generateMacroServiceInstantiationRequest(null, serviceInstantiationPayload, serviceInstantiationPayload.getInstanceName(), "az2016");
 
         String expected = IOUtils.toString(resource, "UTF-8");
-        MsoOperationalEnvironmentTest.assertThatExpectationIsLikeObject(expected, result);
+        assertThat(result, jsonEquals(expected));
     }
 
     @Test
@@ -233,7 +236,7 @@ public class MsoRequestBuilderTest extends AsyncInstantiationBaseTest {
     }
 
     private ServiceInstantiation generateALaCarteServiceDeletionPayload() {
-        return generateMockAlaCarteServiceDeletionPayload(false, Collections.EMPTY_MAP, Collections.EMPTY_MAP, Collections.EMPTY_MAP, 1, true, PROJECT_NAME, false, "VNF_API", "1234567890");
+        return generateMockAlaCarteServiceDeletionPayload(false, EMPTY_MAP, EMPTY_MAP, EMPTY_MAP, 1, true, PROJECT_NAME, false, "VNF_API", "1234567890");
     }
 
     @Test
@@ -255,7 +258,7 @@ public class MsoRequestBuilderTest extends AsyncInstantiationBaseTest {
     }
 
     private ServiceInstantiation generateServiceDeletionPayload() {
-        return generateMockServiceDeletionPayload(false, Collections.EMPTY_MAP, Collections.EMPTY_MAP, Collections.EMPTY_MAP, 1, true, PROJECT_NAME, false, "VNF_API", "1234567890");
+        return generateMockServiceDeletionPayload(false, EMPTY_MAP, EMPTY_MAP, EMPTY_MAP, 1, true, PROJECT_NAME, false, "VNF_API", "1234567890");
     }
 
     @DataProvider
@@ -301,7 +304,7 @@ public class MsoRequestBuilderTest extends AsyncInstantiationBaseTest {
     public static Object[][] testBuildVnfInstanceParamsDataProvider(Method test) {
         return new Object[][]{
                 {
-                        Collections.EMPTY_LIST,
+                        EMPTY_LIST,
                         ImmutableList.of(
                                 ImmutableList.of(ImmutableMap.of("k1", "v1", "k2", "v2")),
                                 ImmutableList.of(ImmutableMap.of("k3", "v3", "k2", "v2"))
@@ -313,23 +316,23 @@ public class MsoRequestBuilderTest extends AsyncInstantiationBaseTest {
                         ImmutableList.of(
                                 ImmutableList.of(ImmutableMap.of("k1", "v1", "k2", "v2")),
                                 ImmutableList.of(ImmutableMap.of("k3", "v3", "k2", "v2")),
-                                ImmutableList.of(Collections.EMPTY_MAP),
-                                Collections.singletonList(null)
+                                ImmutableList.of(EMPTY_MAP),
+                                singletonList(null)
                         ),
                         ImmutableList.of(ImmutableMap.of("k1", "v1", "k2", "v2", "k3", "v3", "j1", "w1"))
                 },
                 {
-                        Collections.EMPTY_LIST,
+                        EMPTY_LIST,
                         Arrays.asList(null, null),
-                        Collections.EMPTY_LIST //mso is expect to empty list and not list with empty map
+                        EMPTY_LIST //mso is expect to empty list and not list with empty map
                 },
                 {
-                        ImmutableList.of(Collections.EMPTY_MAP),
+                        ImmutableList.of(EMPTY_MAP),
                         ImmutableList.of(
-                                ImmutableList.of(Collections.EMPTY_MAP),
-                                ImmutableList.of(Collections.EMPTY_MAP)
+                                ImmutableList.of(EMPTY_MAP),
+                                ImmutableList.of(EMPTY_MAP)
                         ),
-                        Collections.EMPTY_LIST //mso is expect to empty list and not list with empty map
+                        EMPTY_LIST //mso is expect to empty list and not list with empty map
                 }
         };
     }
@@ -360,8 +363,11 @@ public class MsoRequestBuilderTest extends AsyncInstantiationBaseTest {
         ModelInfo vnfModelInfo = createVnfModelInfo(true);
         List<Map<String, String>> instanceParams = ImmutableList.of(ImmutableMap.of("vmx_int_net_len", "24",
                 "vre_a_volume_size_0", "120"));
-        Map<String, String> supplementaryParams = ImmutableMap.of("vre_a_volume_size_0", "100",
-                "availability_zone_0", "mtpocdv-kvm-az01");
+        List<UserParamNameAndValue> supplementaryParams = ImmutableList.of(
+            new UserParamNameAndValue("vre_a_volume_size_0", "100"),
+            new UserParamNameAndValue("availability_zone_0", "mtpocdv-kvm-az01")
+        );
+
         VfModule vfModule = createVfModule("201673MowAvpnVpeBvL..AVPN_vRE_BV..module-1", "56e2b103-637c-4d1a-adc8-3a7f4a6c3240",
                 "72d9d1cd-f46d-447a-abdb-451d6fb05fa8", instanceParams, supplementaryParams,
                 (isUserProvidedNaming ? "vmxnjr001_AVPN_base_vRE_BV_expansion" : null), "myVgName", true);
@@ -378,26 +384,7 @@ public class MsoRequestBuilderTest extends AsyncInstantiationBaseTest {
         final RequestDetailsWrapper<VfModuleOrVolumeGroupRequestDetails> result = msoRequestBuilder.generateVfModuleInstantiationRequest(
                 vfModule, siModelInfo, serviceInstanceId,
                 vnfModelInfo, vnfInstanceId, volumeGroupInstanceId, "pa0916", "VNF_API");
-        MsoOperationalEnvironmentTest.assertThatExpectationIsLikeObject(expected, result);
-    }
-
-    @DataProvider
-    public static Object[][] expectedAggregatedParams() {
-        return new Object[][]{
-                {ImmutableMap.of("a", "b", "c", "d"), ImmutableMap.of("e", "f", "g", "h"), ImmutableList.of(ImmutableMap.of("c", "d", "a", "b", "e", "f", "g", "h"))},
-                {ImmutableMap.of("a", "b", "c", "g"), ImmutableMap.of("c", "d", "e", "f"), ImmutableList.of(ImmutableMap.of("a", "b", "c", "d", "e", "f"))},
-                {ImmutableMap.of(), ImmutableMap.of("c", "d", "e", "f"), ImmutableList.of(ImmutableMap.of("c", "d", "e", "f"))},
-                {ImmutableMap.of("a", "b", "c", "g"), ImmutableMap.of(), ImmutableList.of(ImmutableMap.of("a", "b", "c", "g"))},
-                {ImmutableMap.of(), ImmutableMap.of(), ImmutableList.of()},
-                {null, ImmutableMap.of(), ImmutableList.of()},
-                {ImmutableMap.of(), null, ImmutableList.of()},
-        };
-    }
-
-    @Test(dataProvider = "expectedAggregatedParams")
-    public void testAggregateInstanceParamsAndSuppFile(Map<String, String> instanceParams, Map<String, String> suppParams, List<UserParamMap<String, String>> expected) {
-        List<UserParamMap<String, String>> aggParams = msoRequestBuilder.aggregateAllInstanceParams(instanceParams, suppParams);
-        assertThat("Aggregated params are not as expected", aggParams, equalTo(expected));
+        assertThat(result, jsonEquals(expected).when(IGNORING_ARRAY_ORDER));
     }
 
     @Test
@@ -406,8 +393,8 @@ public class MsoRequestBuilderTest extends AsyncInstantiationBaseTest {
         VfModule vfModule = createVfModule("201673MowAvpnVpeBvL..AVPN_vRE_BV..module-1",
                 "56e2b103-637c-4d1a-adc8-3a7f4a6c3240",
                 "72d9d1cd-f46d-447a-abdb-451d6fb05fa8",
-                Collections.emptyList(),
-                Collections.emptyMap(),
+                emptyList(),
+                emptyList(),
                 "vmxnjr001_AVPN_base_vRE_BV_expansion",
                 "myVgName",
                 true);
@@ -437,7 +424,7 @@ public class MsoRequestBuilderTest extends AsyncInstantiationBaseTest {
     @Test(dataProvider = "expectedNetworkRequestDetailsParameters")
     public void createNetworkRequestDetails_detailsAreAsExpected(String networkName, String filePath) throws IOException {
 
-        List<NetworkDetails> networkDetails = Collections.singletonList(new NetworkDetails(networkName, "ab153b6e-c364-44c0-bef6-1f2982117f04"));
+        List<NetworkDetails> networkDetails = singletonList(new NetworkDetails(networkName, "ab153b6e-c364-44c0-bef6-1f2982117f04"));
         final List<Network> networksList = new ArrayList<>(createNetworkList(null, networkDetails, true).values());
         ModelInfo siModelInfo = createServiceModelInfo();
         String serviceInstanceId = "aa3514e3-5a33-55df-13ab-12abad84e7aa";
@@ -495,7 +482,7 @@ public class MsoRequestBuilderTest extends AsyncInstantiationBaseTest {
     @Test
     public void checkIfNullProjectNameSentToMso() {
         ServiceInstantiation serviceInstantiationPayload = generateMockMacroServiceInstantiationPayload(true,
-                createVnfList(vfModuleInstanceParamsMapWithParamsToRemove, Collections.EMPTY_LIST, false),
+                createVnfList(vfModuleInstanceParamsMapWithParamsToRemove, EMPTY_LIST, false),
                 1,
                 false, null, false);
         RequestDetailsWrapper<ServiceInstantiationRequestDetails> result =
@@ -503,7 +490,7 @@ public class MsoRequestBuilderTest extends AsyncInstantiationBaseTest {
         JsonNode jsonNode = new ObjectMapper().valueToTree(result.requestDetails);
         Assert.assertTrue(jsonNode.get("project").isNull());
         serviceInstantiationPayload = generateMockMacroServiceInstantiationPayload(true,
-                createVnfList(vfModuleInstanceParamsMapWithParamsToRemove, Collections.EMPTY_LIST, false),
+                createVnfList(vfModuleInstanceParamsMapWithParamsToRemove, EMPTY_LIST, false),
                 1,
                 false, "not null", false);
         result = msoRequestBuilder.generateMacroServiceInstantiationRequest(null, serviceInstantiationPayload, serviceInstantiationPayload.getInstanceName(), "az2016");
@@ -569,7 +556,7 @@ public class MsoRequestBuilderTest extends AsyncInstantiationBaseTest {
                         "    }" +
                         "  }" +
                         "}";
-        VfModule vfModuleDetails = createVfModule("201673MowAvpnVpeBvL..AVPN_base_vPE_BV..module-0", VF_MODULE_0_MODEL_VERSION_ID, VF_MODULE_0_MODEL_CUSTOMIZATION_NAME, null, new HashMap<>(), "vmxnjr001_AVPN_base_vPE_BV_base", null, true);
+        VfModule vfModuleDetails = createVfModule("201673MowAvpnVpeBvL..AVPN_base_vPE_BV..module-0", VF_MODULE_0_MODEL_VERSION_ID, VF_MODULE_0_MODEL_CUSTOMIZATION_NAME, null, emptyList(), "vmxnjr001_AVPN_base_vPE_BV_base", null, true);
         RequestDetailsWrapper<VfModuleOrVolumeGroupRequestDetails> result =
                 msoRequestBuilder.generateDeleteVfModuleRequest(vfModuleDetails, "az2018");
         MsoOperationalEnvironmentTest.assertThatExpectationIsLikeObject(expected, result);
@@ -636,16 +623,25 @@ public class MsoRequestBuilderTest extends AsyncInstantiationBaseTest {
     @Test
     public void generateReplaceVfModuleRequest_whenThereAreSupplementaryParams_thenTheyAreAddToUserParams() {
 
-        String expectedParams = "[{"
-            + "        \"vre_a_volume_size_0\" : \"100\","
-            + "        \"vmx_int_net_len\" : \"24\","
-            + "        \"availability_zone_0\": \"abc\""
-            + "      }]";
-
-        Map<String, String> supplementaryParams = ImmutableMap.of(
-            "vre_a_volume_size_0", "100",
-            "vmx_int_net_len", "24",
-            "availability_zone_0", "abc"
+        String expectedParams = "["
+            + "        {"
+            + "          \"name\": \"vre_a_volume_size_0\","
+            + "          \"value\": \"100\""
+            + "        },"
+            + "        {"
+            + "          \"name\": \"vmx_int_net_len\","
+            + "          \"value\": \"24\""
+            + "        },"
+            + "        {"
+            + "          \"name\": \"availability_zone_0\","
+            + "          \"value\": \"abc\""
+            + "        }"
+            + "     ]";
+
+        List<UserParamNameAndValue> supplementaryParams = ImmutableList.of(
+            new UserParamNameAndValue( "vre_a_volume_size_0", "100"),
+            new UserParamNameAndValue("vmx_int_net_len", "24"),
+            new UserParamNameAndValue("availability_zone_0", "abc")
         );
 
         assertThat(generatedVfModuleReplaceRequest(null, null, supplementaryParams),
@@ -662,7 +658,7 @@ public class MsoRequestBuilderTest extends AsyncInstantiationBaseTest {
     }
 
     private RequestDetailsWrapper<VfModuleOrVolumeGroupRequestDetails> generatedVfModuleReplaceRequest(
-        Boolean retainAssignments, Boolean retainVolumeGroups, Map<String, String> supplementaryParams) {
+        Boolean retainAssignments, Boolean retainVolumeGroups, List<UserParamNameAndValue> supplementaryParams) {
         when(featureManager.isActive(Features.FLAG_1810_CR_ADD_CLOUD_OWNER_TO_MSO_REQUEST)).thenReturn(true);
         when(aaiClient.getCloudOwnerByCloudRegionId("regionOne")).thenReturn("irma-aic");
 
diff --git a/vid-app-common/src/test/java/org/onap/vid/services/UserParamsContainerTest.kt b/vid-app-common/src/test/java/org/onap/vid/services/UserParamsContainerTest.kt
new file mode 100644 (file)
index 0000000..511c4e5
--- /dev/null
@@ -0,0 +1,57 @@
+package org.onap.vid.services
+
+import org.hamcrest.CoreMatchers.equalTo
+import org.hamcrest.MatcherAssert
+import org.onap.vid.mso.model.ServiceInstantiationRequestDetails.UserParamNameAndValue
+import org.testng.annotations.DataProvider
+import org.testng.annotations.Test
+
+class UserParamsContainerTest {
+
+    @DataProvider
+    fun userParamsDataProvider(): Array<Array<Any?>>? {
+        return arrayOf(
+            arrayOf<Any?>(
+                mapOf("a" to "b", "c" to "d"),
+                listOf(UserParamNameAndValue("e", "f"), UserParamNameAndValue("g", "h")),
+                mapOf("c" to "d", "a" to "b", "e" to "f", "g" to "h")
+            ),
+            arrayOf<Any?>(
+                mapOf("a" to "b", "c" to "g"),
+                listOf(UserParamNameAndValue("c", "d") , UserParamNameAndValue("e", "f")),
+                mapOf("c" to "d", "a" to "b", "e" to "f")
+            ),
+            arrayOf<Any?>(
+                emptyMap<String,String>(),
+                listOf(UserParamNameAndValue("c", "d"), UserParamNameAndValue("e", "f")),
+                mapOf("c" to "d", "e" to "f")
+            ),
+            arrayOf<Any?>(
+                mapOf("a" to "b", "c" to "d"),
+                emptyList<UserParamNameAndValue>(),
+                mapOf("a" to "b", "c" to "d")
+            ),
+            arrayOf<Any?>(
+                emptyMap<String,String>(),
+                emptyList<UserParamNameAndValue>(),
+                emptyMap<String,String>()
+            ),
+            arrayOf(
+                null,
+                emptyList<UserParamNameAndValue>(),
+                emptyMap<String,String>()
+            ),
+            arrayOf<Any?>(
+                emptyMap<String,String>(),
+                null,
+                emptyMap<String,String>()
+            )
+        )
+    }
+
+    @Test(dataProvider = "userParamsDataProvider")
+    fun testUserParamsConvertorCtor(instanceParams: Map<String, String>?, suppParams: List<UserParamNameAndValue>?, expected: Map<String, String>) {
+        val aggParams: Map<String, String> = UserParamsContainer(instanceParams, suppParams).params
+        MatcherAssert.assertThat("Aggregated params are not as expected", aggParams, equalTo(expected))
+    }
+}
\ No newline at end of file
index 1bce760..84dcd73 100644 (file)
     ],
     "requestParameters": {
       "usePreload": true,
-      "userParams": [{
-        "vre_a_volume_size_0" : "100",
-        "vmx_int_net_len" : "24",
-        "availability_zone_0": "mtpocdv-kvm-az01"
-      }],
+      "userParams": [
+        {
+          "name": "vre_a_volume_size_0",
+          "value": "100"
+        },
+        {
+          "name": "vmx_int_net_len",
+          "value": "24"
+        },
+        {
+          "name": "availability_zone_0",
+          "value": "mtpocdv-kvm-az01"
+        }
+     ],
       "testApi" : "VNF_API"
     }
   }
index 1c0d2b9..026c16f 100644 (file)
     ],
     "requestParameters": {
       "usePreload": true,
-      "userParams": [{
-        "vre_a_volume_size_0" : "100",
-        "vmx_int_net_len" : "24",
-        "availability_zone_0": "mtpocdv-kvm-az01"
-      }],
+      "userParams": [
+        {
+          "name": "vre_a_volume_size_0",
+          "value": "100"
+        },
+        {
+          "name": "vmx_int_net_len",
+          "value": "24"
+        },
+        {
+          "name": "availability_zone_0",
+          "value": "mtpocdv-kvm-az01"
+        }
+      ],
       "testApi" : "VNF_API"
     }
   }
index 3581a47..1d0b96e 100644 (file)
     ],
     "requestParameters": {
       "usePreload": true,
-      "userParams": [{
-        "vre_a_volume_size_0" : "100",
-        "vmx_int_net_len" : "24",
-        "availability_zone_0": "mtpocdv-kvm-az01"
-      }],
+      "userParams": [
+        {
+          "name": "vre_a_volume_size_0",
+          "value": "100"
+        },
+        {
+          "name": "vmx_int_net_len",
+          "value": "24"
+        },
+        {
+          "name": "availability_zone_0",
+          "value": "mtpocdv-kvm-az01"
+        }
+      ],
       "testApi" : "VNF_API"
     }
   }
index 89744a7..e09f973 100644 (file)
@@ -67,9 +67,12 @@ public class PresetMSOCreateVfModuleALaCarteE2E extends PresetMSOCreateVfModuleB
             + "            }" + addRelatedInstance()
             + "        ],"
             + "        \"requestParameters\": {"
-            + "            \"userParams\": [{"
-            + "                    \"param\": \"ABCD\","
-            + "                    \"vnf_instance_name\": \"sample\""
+            + "               \"userParams\": [{"
+            + "                    \"name\": \"param\","
+            + "                    \"value\": \"ABCD\""
+            + "                }, {"
+            + "                    \"name\": \"vnf_instance_name\","
+            + "                    \"value\": \"sample\""
             + "                }"
             + "            ],"
             + "            \"testApi\": \"VNF_API\""
index 5a0b752..9d9984a 100644 (file)
@@ -93,14 +93,23 @@ public class PresetMSOCreateVfModuleWithVolumeGroupALaCarteCypress extends Prese
                 "    ]," +
                 "    \"requestParameters\":{" +
                addTestApi()+
-                "       \"userParams\":[{" +
-                "          \"2017488_pasqualevpe0_vnf_instance_name\":\"mtnj309me6\"," +
-                "          \"2017488_pasqualevpe0_vnf_config_template_version\":\"17.2\"," +
-                "          \"pasqualevpe0_bandwidth\":\"10\"," +
-                "          \"2017488_pasqualevpe0_AIC_CLLI\":\"ATLMY8GA\"," +
-                "          \"pasqualevpe0_bandwidth_units\":\"Gbps\"" +
-                "        }" +
-                "      ]," +
+                "\"userParams\": [{"
+            + "                    \"name\": \"pasqualevpe0_bandwidth\","
+            + "                    \"value\": \"10\""
+            + "                }, {"
+            + "                    \"name\": \"2017488_pasqualevpe0_vnf_instance_name\","
+            + "                    \"value\": \"mtnj309me6\""
+            + "                }, {"
+            + "                    \"name\": \"2017488_pasqualevpe0_vnf_config_template_version\","
+            + "                    \"value\": \"17.2\""
+            + "                }, {"
+            + "                    \"name\": \"2017488_pasqualevpe0_AIC_CLLI\","
+            + "                    \"value\": \"ATLMY8GA\""
+            + "                }, {"
+            + "                    \"name\": \"pasqualevpe0_bandwidth_units\","
+            + "                    \"value\": \"Gbps\""
+            + "                }"
+            + "            ]," +
                 "      \"usePreload\":true" +
                 "    }" +
                 "  }" +
index c7d245f..68ad69c 100644 (file)
@@ -1,4 +1,10 @@
-{
-  "param": "ABCD",
-  "vnf_instance_name": "sample"
-}
\ No newline at end of file
+[
+  {
+  "name": "param",
+  "value": "ABCD"
+  },
+  {
+    "name": "vnf_instance_name",
+    "value": "sample"
+  }
+]
index cf870b7..8e61baa 100644 (file)
@@ -6762,7 +6762,7 @@ describe('Drawing board', function () {
                       "supplementaryFile_hidden_content": "{\r\n  \"name\": \"a\",\r\n  \"value\": \"32\"\r\n}",
                       "supplementaryFileContent": {
                         "name": "a",
-                          "value": "32"
+                        "value": "32"
                       },
                       "supplementaryFileName": "sample.json",
                       "instanceParams": [
index 2ca992f..3137b25 100644 (file)
@@ -1,10 +1,6 @@
 import {LogService} from "../../../../utils/log/log.service";
 import {NgRedux} from "@angular-redux/store";
-import {
-  ControlGeneratorUtil,
-  SDN_C_PRE_LOAD,
-  SUPPLEMENTARY_FILE
-} from "../../../genericForm/formControlsServices/control.generator.util.service";
+import {ControlGeneratorUtil, SDN_C_PRE_LOAD, SUPPLEMENTARY_FILE} from "../../../genericForm/formControlsServices/control.generator.util.service";
 import {AaiService} from "../../../../services/aaiService/aai.service";
 import {HttpClient} from "@angular/common/http";
 import {GenericFormService} from "../../../genericForm/generic-form.service";
@@ -191,7 +187,7 @@ describe('VFModule popup service', () => {
     };
     form.controls = {
       supplementaryFile_hidden_content : {
-        value: '{"c": "c", "d": 1}'
+        value: '[{"name": "c", "value": "c"}, {"name": "d", "value": "1"}]'
         },
       supplementaryFile_hidden : {
         value: {
@@ -203,7 +199,7 @@ describe('VFModule popup service', () => {
     let expectedMergePayload = {
       a: "value",
       b: "another",
-      supplementaryFileContent: {c: "c", d: 1},
+      supplementaryFileContent: [{"name": "c", "value": "c"}, {"name": "d", "value": "1"}],
       supplementaryFileName: "name"
     };