summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java30
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoCommonUtils.java3
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceLevel.java5
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java228
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilderTest.java116
-rw-r--r--bpmn/MSOCommonBPMN/src/test/resources/__files/SERVICE-SO-REQ-INPUT.json206
-rw-r--r--bpmn/MSOCommonBPMN/src/test/resources/__files/UUI-SO-REQ.json1
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelofE2EServiceInstance.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy7
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java4
10 files changed, 552 insertions, 50 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java
index 0a0f2787da..dd43837c76 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java
@@ -109,6 +109,8 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin {
private static final String DELETE_DEPLOYMENT = "DeleteDeployment";
private static final String TERMINATED = "terminated";
private static final String CANCELLED = "cancelled";
+ private static final String UNINSTALL = "uninstall";
+ private static final String UPLOAD_BLUEPRINT = "UPLOAD_BLUEPRINT";
// Fetch cloud configuration each time (may be cached in CloudConfig class)
@Autowired
@@ -181,11 +183,11 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin {
Map<String, Object> expandedInputs = new HashMap<>(inputs);
String platform = cloudSite.get().getPlatform();
- if (platform == null || platform.equals("") || platform.equalsIgnoreCase("OPENSTACK")) {
+ if (platform == null || platform.isEmpty() || ("OPENSTACK").equalsIgnoreCase(platform)) {
// Create the Cloudify OpenstackConfig with the credentials
OpenstackConfig openstackConfig = getOpenstackConfig(cloudSite.get(), tenantId);
expandedInputs.put("openstack_config", openstackConfig);
- } else if (platform.equalsIgnoreCase("AZURE")) {
+ } else if (("AZURE").equalsIgnoreCase(platform)) {
// Create Cloudify AzureConfig with the credentials
AzureConfig azureConfig = getAzureConfig(cloudSite.get(), tenantId);
expandedInputs.put("azure_config", azureConfig);
@@ -265,7 +267,7 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin {
try {
// Run the uninstall to undo the install
- Execution uninstallWorkflow = executeWorkflow(cloudify, deploymentId, "uninstall", null,
+ Execution uninstallWorkflow = executeWorkflow(cloudify, deploymentId, UNINSTALL, null,
pollForCompletion, deletePollTimeout, deletePollInterval);
if (uninstallWorkflow.getStatus().equals(TERMINATED)) {
@@ -306,7 +308,7 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin {
try {
// Run the uninstall to undo the install.
// Always try to run it, as it should be idempotent
- executeWorkflow(cloudify, deploymentId, "uninstall", null, pollForCompletion, deletePollTimeout,
+ executeWorkflow(cloudify, deploymentId, UNINSTALL, null, pollForCompletion, deletePollTimeout,
deletePollInterval);
// Delete the deployment itself
@@ -402,7 +404,7 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin {
GetExecution queryExecution = cloudify.executions().byId(executionId);
command = "query";
- while (!timedOut && !(status.equals(TERMINATED) || status.equals("failed") || status.equals(CANCELLED))) {
+ while (!timedOut && !(status.equals(TERMINATED) || ("failed").equals(status) || status.equals(CANCELLED))) {
// workflow is still running; check for timeout
if (pollTimeout <= 0) {
logger.debug("workflow {} timed out on deployment {}", execution.getWorkflowId(),
@@ -425,7 +427,7 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin {
// Success!
logger.debug("Workflow '{}' completed successfully on deployment '{}'", workflowId, deploymentId);
return execution;
- } else if (status.equals("failed")) {
+ } else if (("failed").equals(status)) {
// Workflow failed. Log it and return the execution object (don't throw exception here)
logger.error("{} Cloudify workflow failure: {} {} Execute Workflow: Failed: {}",
MessageEnum.RA_CREATE_STACK_ERR, execution.getError(),
@@ -665,7 +667,7 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin {
try {
uninstallWorkflow =
- executeWorkflow(cloudify, deploymentId, "uninstall", null, true, pollTimeout, deletePollInterval);
+ executeWorkflow(cloudify, deploymentId, UNINSTALL, null, true, pollTimeout, deletePollInterval);
if (uninstallWorkflow.getStatus().equals(TERMINATED)) {
// Successful uninstall.
@@ -812,7 +814,7 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin {
try {
// Put the root directory
- String rootDir = blueprintId + ((blueprintId.endsWith("/") ? "" : "/"));
+ String rootDir = blueprintId + (blueprintId.endsWith("/") ? "" : "/");
zipOut.putNextEntry(new ZipEntry(rootDir));
zipOut.closeEntry();
@@ -836,13 +838,13 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin {
Blueprint blueprint = uploadRequest.execute();
logger.debug("Successfully uploaded blueprint {}", blueprint.getId());
} catch (CloudifyResponseException | CloudifyConnectException e) {
- throw cloudifyExceptionToMsoException(e, "UPLOAD_BLUEPRINT");
+ throw cloudifyExceptionToMsoException(e, UPLOAD_BLUEPRINT);
} catch (RuntimeException e) {
// Catch-all
- throw runtimeExceptionToMsoException(e, "UPLOAD_BLUEPRINT");
+ throw runtimeExceptionToMsoException(e, UPLOAD_BLUEPRINT);
} catch (IOException e) {
// for try-with-resources
- throw ioExceptionToMsoException(e, "UPLOAD_BLUEPRINT");
+ throw ioExceptionToMsoException(e, UPLOAD_BLUEPRINT);
}
return true;
@@ -960,14 +962,14 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin {
String type = templateParam.getParamType();
logger.debug("Parameter: {} is of type {}", templateParam.getParamName(), type);
- if (type.equalsIgnoreCase("number")) {
+ if (("number").equalsIgnoreCase(type)) {
try {
return Integer.valueOf(inputValue.toString());
} catch (Exception e) {
logger.debug("Unable to convert {} to an integer!", inputValue);
return null;
}
- } else if (type.equalsIgnoreCase("json")) {
+ } else if (("json").equalsIgnoreCase(type)) {
try {
if (inputValue instanceof String) {
return JSON_MAPPER.readTree(inputValue.toString());
@@ -978,7 +980,7 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin {
logger.debug("Unable to convert {} to a JsonNode!", inputValue);
return null;
}
- } else if (type.equalsIgnoreCase("boolean")) {
+ } else if (("boolean").equalsIgnoreCase(type)) {
return new Boolean(inputValue.toString());
}
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoCommonUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoCommonUtils.java
index c9a548d5f1..79c042b10b 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoCommonUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoCommonUtils.java
@@ -67,9 +67,6 @@ public class MsoCommonUtils {
protected <T> T executeAndRecordOpenstackRequest(OpenStackRequest<T> request) {
- int limit;
-
- long start = System.currentTimeMillis();
String requestType;
if (request.getClass().getEnclosingClass() != null) {
requestType =
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceLevel.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceLevel.java
new file mode 100644
index 0000000000..a3c75dbd41
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceLevel.java
@@ -0,0 +1,5 @@
+package org.onap.so.bpmn.common.resource;
+
+public enum ResourceLevel {
+ FIRST, SECOND
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java
index 0dbf2c2a75..58f775ce0b 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java
@@ -9,9 +9,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -22,6 +22,9 @@
package org.onap.so.bpmn.common.resource;
+import com.google.gson.JsonArray;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonParser;
import java.io.IOException;
import java.lang.reflect.Type;
import java.util.ArrayList;
@@ -31,6 +34,7 @@ import java.util.List;
import java.util.Map;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriBuilder;
+import org.apache.commons.lang.StringUtils;
import org.camunda.bpm.engine.runtime.Execution;
import org.onap.so.bpmn.core.UrnPropertiesReader;
import org.onap.so.bpmn.core.json.JsonUtils;
@@ -82,20 +86,20 @@ public class ResourceRequestBuilder {
* "requestInputs":{K,V} } <br>
*
* @param execution Execution context
- *
+ *
* @param serviceUuid The service template uuid
- *
+ *
* @param resourceCustomizationUuid The resource customization uuid
- *
+ *
* @param serviceParameters the service parameters passed from the API
- *
+ *
* @return the resource instantiate parameters
- *
+ *
* @since ONAP Beijing Release
*/
@SuppressWarnings("unchecked")
public static String buildResourceRequestParameters(Execution execution, String serviceUuid,
- String resourceCustomizationUuid, String serviceParameters) {
+ String resourceCustomizationUuid, String serviceParameters, Map<String, Object> currentVFData) {
List<String> resourceList =
jsonUtil.StringArrayToList(execution, (String) JsonUtils.getJsonValue(serviceParameters, "resources"));
// Get the right location str for resource. default is an empty array.
@@ -126,7 +130,7 @@ public class ResourceRequestBuilder {
}
Map<String, Object> resourceInputsFromServiceDeclaredLevel =
- buildResouceRequest(serviceUuid, resourceCustomizationUuid, serviceInput);
+ buildResouceRequest(serviceUuid, resourceCustomizationUuid, serviceInput, currentVFData);
resourceInputsFromUuiMap.putAll(resourceInputsFromServiceDeclaredLevel);
String resourceInputsStr = getJsonString(resourceInputsFromUuiMap);
String result = "{\n" + "\"locationConstraints\":" + locationConstraints + ",\n" + "\"requestInputs\":"
@@ -136,7 +140,7 @@ public class ResourceRequestBuilder {
@SuppressWarnings("unchecked")
public static Map<String, Object> buildResouceRequest(String serviceUuid, String resourceCustomizationUuid,
- Map<String, Object> serviceInputs) {
+ Map<String, Object> serviceInputs, Map<String, Object> currentVFData) {
try {
Map<String, Object> serviceInstnace = getServiceInstnace(serviceUuid);
// find match of customization uuid in vnf
@@ -144,24 +148,27 @@ public class ResourceRequestBuilder {
(Map<String, Map<String, Object>>) serviceInstnace.get("serviceResources");
List<Map<String, Object>> serviceVnfCust = (List<Map<String, Object>>) serviceResources.get("serviceVnfs");
- String resourceInputStr = getResourceInputStr(serviceVnfCust, resourceCustomizationUuid);
+ Map<String, String> resourceInputData = getResourceInputStr(serviceVnfCust, resourceCustomizationUuid);
// find match in network resource
- if (resourceInputStr == null) {
+ if (resourceInputData.size() == 0) {
List<Map<String, Object>> serviceNetworkCust =
(List<Map<String, Object>>) serviceResources.get("serviceNetworks");
- resourceInputStr = getResourceInputStr(serviceNetworkCust, resourceCustomizationUuid);
+ resourceInputData = getResourceInputStr(serviceNetworkCust, resourceCustomizationUuid);
// find match in AR resource
- if (resourceInputStr == null) {
+ if (resourceInputData == null) {
List<Map<String, Object>> serviceArCust =
(List<Map<String, Object>>) serviceResources.get("serviceAllottedResources");
- resourceInputStr = getResourceInputStr(serviceArCust, resourceCustomizationUuid);
+ resourceInputData = getResourceInputStr(serviceArCust, resourceCustomizationUuid);
}
}
+ String resourceInputStr = resourceInputData.get("resourceInput");
+ ResourceLevel resourceLevel = ResourceLevel.valueOf(resourceInputData.get("nodeType"));
+
if (resourceInputStr != null && !resourceInputStr.isEmpty()) {
- return getResourceInput(resourceInputStr, serviceInputs);
+ return getResourceInput(resourceInputStr, serviceInputs, resourceLevel, currentVFData);
}
} catch (Exception e) {
@@ -170,47 +177,220 @@ public class ResourceRequestBuilder {
return new HashMap();
}
- private static String getResourceInputStr(List<Map<String, Object>> resources, String resCustomizationUuid) {
+ private static Map<String, String> getResourceInputStr(List<Map<String, Object>> resources,
+ String resCustomizationUuid) {
+ Map<String, String> resourceInputMap = new HashMap<>(2);
for (Map<String, Object> resource : resources) {
Map<String, String> modelInfo = (Map<String, String>) resource.get("modelInfo");
if (modelInfo.get("modelCustomizationUuid").equalsIgnoreCase(resCustomizationUuid)) {
- return (String) resource.get("resourceInput");
+ resourceInputMap.put("resourceInput", (String) resource.get("resourceInput"));
+ String nodeType = ResourceLevel.FIRST.toString();
+ if (((String) resource.get("toscaNodeType")).contains(".vf.")) {
+ nodeType = ResourceLevel.FIRST.toString();
+ } else if (((String) resource.get("toscaNodeType")).contains(".vfc.")) {
+ nodeType = ResourceLevel.SECOND.toString();
+ }
+ resourceInputMap.put("nodeType", nodeType);
+ return resourceInputMap;
}
}
return null;
}
// this method combines resource input with service input
- private static Map<String, Object> getResourceInput(String resourceInputStr, Map<String, Object> serviceInputs) {
+ private static Map<String, Object> getResourceInput(String resourceInputStr, Map<String, Object> serviceInputs,
+ ResourceLevel resourceLevel, Map<String, Object> currentVFData) {
Gson gson = new Gson();
Type type = new TypeToken<Map<String, String>>() {}.getType();
Map<String, Object> resourceInput = gson.fromJson(resourceInputStr, type);
+ JsonParser parser = new JsonParser();
+
+ Map<String, Object> uuiServiceInput = serviceInputs;
+
+ int firstLevelIndex = 0;
+ int secondLevelIndex = 0;
+ String firstLevelKey = null;
+ String secondLevelKey = null;
+ boolean levelKeyNameUpdated = false;
+ int indexToPick = 0;
+
+ if (null != currentVFData) {
+ firstLevelIndex = getIntValue(currentVFData.get("currentFirstLevelIndex"), 0);
+ secondLevelIndex = getIntValue(currentVFData.get("currentSecondLevelIndex"), 0);
+ final String lastFirstLevelKey = firstLevelKey = (String) currentVFData.get("currentFirstLevelKey");
+ final String lastSecondLevelKey = secondLevelKey = (String) currentVFData.get("currentSecondLevelKey");
+
+ if (null != currentVFData.get("lastNodeTypeProcessed")) {
+ ResourceLevel lastResourceLevel =
+ ResourceLevel.valueOf(currentVFData.get("lastNodeTypeProcessed").toString());
+ switch (resourceLevel) {
+ case FIRST:
+ // if it is next request for same group then increment first level index
+ switch (lastResourceLevel) {
+ case FIRST:
+ boolean isSameLevelRequest = resourceInput.values().stream().anyMatch(item -> {
+ JsonElement tree = parser.parse(((String) item).split("\\|")[0]);
+ return tree.isJsonArray() && tree.getAsJsonArray().get(0).getAsString()
+ .equalsIgnoreCase(lastFirstLevelKey);
+ });
+ if (isSameLevelRequest) {
+ firstLevelIndex++;
+ }
+ break;
+ case SECOND:
+ firstLevelIndex = 0;
+ secondLevelKey = null;
+ break;
+
+ }
+ indexToPick = firstLevelIndex;
+ break;
+ case SECOND:
+ // if it is next request for same group then increment second level index
+ switch (lastResourceLevel) {
+ case FIRST:
+ secondLevelIndex = 0;
+ break;
+ case SECOND:
+ boolean isSameLevelRequest = resourceInput.values().stream().anyMatch(item -> {
+ JsonElement tree = parser.parse(((String) item).split("\\|")[0]);
+ return tree.isJsonArray() && tree.getAsJsonArray().get(0).getAsString()
+ .equalsIgnoreCase(lastSecondLevelKey);
+ });
+ if (isSameLevelRequest) {
+ secondLevelIndex++;
+ }
+ break;
+ }
+ // get actual parent object to search for second level objects
+ if (null != lastFirstLevelKey) {
+ Object currentObject = serviceInputs.get(lastFirstLevelKey);
+ if ((null != currentObject) && (currentObject instanceof List)) {
+ List currentFirstLevelList = (List) currentObject;
+ if (currentFirstLevelList.size() > firstLevelIndex) {
+ uuiServiceInput = (Map<String, Object>) currentFirstLevelList.get(firstLevelIndex);
+ }
+
+ }
+ }
+ indexToPick = secondLevelIndex;
+ break;
+
+ }
+ }
+
+
+ }
// replace value if key is available in service input
for (String key : resourceInput.keySet()) {
String value = (String) resourceInput.get(key);
if (value.contains("|")) {
+
+ // check which level
+
// node it type of getinput
String[] split = value.split("\\|");
String tmpKey = split[0];
- if (serviceInputs.containsKey(tmpKey)) {
- value = (String) serviceInputs.get(tmpKey);
+
+ JsonElement jsonTree = parser.parse(tmpKey);
+
+ // check if it is a list type
+ if (jsonTree.isJsonArray()) {
+ JsonArray jsonArray = jsonTree.getAsJsonArray();
+ boolean matchFound = false;
+ if (jsonArray.size() == 3) {
+ String keyName = jsonArray.get(0).getAsString();
+ String keyType = jsonArray.get(2).getAsString();
+ if (!levelKeyNameUpdated) {
+ switch (resourceLevel) {
+ case FIRST:
+ firstLevelKey = keyName;
+ break;
+ case SECOND:
+ secondLevelKey = keyName;
+ break;
+ }
+ levelKeyNameUpdated = true;
+ }
+
+ if (uuiServiceInput.containsKey(keyName)) {
+ Object vfcLevelObject = uuiServiceInput.get(keyName);
+ // it will be always list
+ if (vfcLevelObject instanceof List) {
+ List vfcObject = (List) vfcLevelObject;
+ if (vfcObject.size() > indexToPick) {
+ Map<String, Object> vfMap = (Map<String, Object>) vfcObject.get(indexToPick);
+ if (vfMap.containsKey(keyType)) {
+ if (vfMap.get(keyType) instanceof String) {
+ value = (String) vfMap.get(keyType);
+ } else {
+ value = getJsonString(vfMap.get(keyType));
+ }
+ matchFound = true;
+ }
+ }
+ }
+ }
+ }
+
+ if (!matchFound) {
+ if (split.length == 1) { // means value is empty e.g. "a":"key1|"
+ value = "";
+ } else {
+ value = split[1];
+ }
+ }
+
} else {
- if (split.length == 1) { // means value is empty e.g. "a":"key1|"
- value = "";
+
+ // if not a list type
+ if (uuiServiceInput.containsKey(tmpKey)) {
+ value = (String) uuiServiceInput.get(tmpKey);
} else {
- value = split[1];
+ if (split.length == 1) { // means value is empty e.g. "a":"key1|"
+ value = "";
+ } else {
+ value = split[1];
+ }
}
}
+
}
resourceInput.put(key, value);
}
+ // store current processed details into map
+ if (null != currentVFData) {
+ currentVFData.put("currentFirstLevelKey", firstLevelKey);
+ currentVFData.put("currentFirstLevelIndex", firstLevelIndex);
+ currentVFData.put("currentSecondLevelKey", secondLevelKey);
+ currentVFData.put("currentSecondLevelIndex", secondLevelIndex);
+ currentVFData.put("lastNodeTypeProcessed", resourceLevel.toString());
+ }
+
return resourceInput;
}
+ private static int getIntValue(Object inputObj, int defaultValue) {
+ if (null != inputObj) {
+ if (inputObj instanceof Integer) {
+ return ((Integer) inputObj).intValue();
+ }
+ if (StringUtils.isNotEmpty(inputObj.toString())) {
+ try {
+ int val = Integer.parseInt(inputObj.toString());
+ return val;
+ } catch (NumberFormatException e) {
+ logger.warn("Unable to parse to int", e.getMessage());
+ }
+ }
+ }
+ return defaultValue;
+ }
+
public static Map<String, Object> getServiceInstnace(String uuid) throws Exception {
String catalogEndPoint = UrnPropertiesReader.getVariable("mso.catalog.db.endpoint");
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilderTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilderTest.java
index c7c181744f..adfee796f2 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilderTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilderTest.java
@@ -19,19 +19,53 @@
*/
package org.onap.so.bpmn.common.resource;
+import org.junit.Assert;
+import org.junit.Before;
import org.junit.Test;
import org.onap.so.BaseTest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.onap.so.bpmn.mock.FileUtil;
import static com.github.tomakehurst.wiremock.client.WireMock.get;
import static com.github.tomakehurst.wiremock.client.WireMock.ok;
import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
import static org.junit.Assert.assertEquals;
-
+import static org.junit.Assert.assertTrue;
public class ResourceRequestBuilderTest extends BaseTest {
+ private Map<String, Object> userInputMap = null;
+
+ private String serviceInput = null;
+
+ @Before
+ public void initializeMockObjects() {
+
+ if (null == this.userInputMap) {
+ ObjectMapper mapper = new ObjectMapper();
+
+ try {
+ String serviceInputRequest = FileUtil.readResourceFile("__files/UUI-SO-REQ.json");
+ this.userInputMap = mapper.readValue(serviceInputRequest, new TypeReference<Map<String, Object>>() {});
+ } catch (Exception e) {
+ Assert.fail(e.getMessage());
+ }
+ }
+
+ if (null == this.serviceInput) {
+
+ try {
+ this.serviceInput = FileUtil.readResourceFile("__files/SERVICE-SO-REQ-INPUT.json");
+ } catch (Exception e) {
+ Assert.fail(e.getMessage());
+ }
+ }
+
+ }
+
@Test
public void getResourceInputTest() throws Exception {
@@ -102,7 +136,7 @@ public class ResourceRequestBuilderTest extends BaseTest {
HashMap serviceInput = new HashMap();
serviceInput.put("key", "value");
Map<String, Object> stringObjectMap = ResourceRequestBuilder.buildResouceRequest(
- "c3954379-4efe-431c-8258-f84905b158e5", "e776449e-2b10-45c5-9217-2775c88ca1a0", serviceInput);
+ "c3954379-4efe-431c-8258-f84905b158e5", "e776449e-2b10-45c5-9217-2775c88ca1a0", serviceInput, null);
assertEquals(stringObjectMap.get("a"), "value");
}
@@ -173,7 +207,7 @@ public class ResourceRequestBuilderTest extends BaseTest {
HashMap serviceInput = new HashMap();
serviceInput.put("key1", "value");
Map<String, Object> stringObjectMap = ResourceRequestBuilder.buildResouceRequest(
- "c3954379-4efe-431c-8258-f84905b158e5", "e776449e-2b10-45c5-9217-2775c88ca1a0", serviceInput);
+ "c3954379-4efe-431c-8258-f84905b158e5", "e776449e-2b10-45c5-9217-2775c88ca1a0", serviceInput, null);
assertEquals(stringObjectMap.get("a"), "default_value");
}
@@ -244,7 +278,7 @@ public class ResourceRequestBuilderTest extends BaseTest {
HashMap serviceInput = new HashMap();
serviceInput.put("key1", "value");
Map<String, Object> stringObjectMap = ResourceRequestBuilder.buildResouceRequest(
- "c3954379-4efe-431c-8258-f84905b158e5", "e776449e-2b10-45c5-9217-2775c88ca1a0", serviceInput);
+ "c3954379-4efe-431c-8258-f84905b158e5", "e776449e-2b10-45c5-9217-2775c88ca1a0", serviceInput, null);
assertEquals(stringObjectMap.get("a"), "value");
}
@@ -337,7 +371,7 @@ public class ResourceRequestBuilderTest extends BaseTest {
HashMap serviceInput = new HashMap();
serviceInput.put("key1", "value");
Map<String, Object> stringObjectMap = ResourceRequestBuilder.buildResouceRequest(
- "c3954379-4efe-431c-8258-f84905b158e5", "e776449e-2b10-45c5-9217-2775c88ca1a0", serviceInput);
+ "c3954379-4efe-431c-8258-f84905b158e5", "e776449e-2b10-45c5-9217-2775c88ca1a0", serviceInput, null);
assertEquals(0, stringObjectMap.size());
}
@@ -382,8 +416,78 @@ public class ResourceRequestBuilderTest extends BaseTest {
HashMap serviceInput = new HashMap();
serviceInput.put("key2", "value");
Map<String, Object> stringObjectMap = ResourceRequestBuilder.buildResouceRequest(
- "c3954379-4efe-431c-8258-f84905b158e5", "a00404d5-d7eb-4c46-b6b6-9cf2d087e545", serviceInput);
+ "c3954379-4efe-431c-8258-f84905b158e5", "a00404d5-d7eb-4c46-b6b6-9cf2d087e545", serviceInput, null);
assertEquals(stringObjectMap.get("a"), "");
}
+ @Test
+ public void getListResourceInputTest() throws Exception {
+
+
+
+ wireMockServer.stubFor(get(urlEqualTo(
+ "/ecomp/mso/catalog/v2/serviceResources?serviceModelUuid=c3954379-4efe-431c-8258-f84905b158e5"))
+ .willReturn(ok(this.serviceInput)));
+
+ // when(UrnPropertiesReader.getVariable(anyString())).thenReturn("http://localhost:8080");
+
+ // VF level request
+ Map<String, Object> currentVFData = new HashMap<>();
+ Map<String, Object> stringObjectMap =
+ ResourceRequestBuilder.buildResouceRequest("c3954379-4efe-431c-8258-f84905b158e5",
+ "a00404d5-d7eb-4c46-b6b6-9cf2d087e545", this.userInputMap, currentVFData);
+ assertEquals("b", stringObjectMap.get("a"));
+ assertEquals("hub_spoke", stringObjectMap.get("topology"));
+ assertEquals("defaultvpn", stringObjectMap.get("name"));
+ assertTrue(((String) stringObjectMap.get("sitelist")).contains("["));
+
+ // vfc level request
+ stringObjectMap = ResourceRequestBuilder.buildResouceRequest("c3954379-4efe-431c-8258-f84905b158e5",
+ "e776449e-2b10-45c5-9217-2775c88ca1a0", this.userInputMap, currentVFData);
+ assertEquals("", stringObjectMap.get("a"));
+ assertEquals("layer3-port", stringObjectMap.get("portswitch"));
+ assertEquals("192.168.10.1", stringObjectMap.get("ipAddress"));
+ assertEquals("vCPE", stringObjectMap.get("deviceName"));
+
+ // vfc level request
+ stringObjectMap = ResourceRequestBuilder.buildResouceRequest("c3954379-4efe-431c-8258-f84905b158e5",
+ "e776449e-2b10-45c5-9217-2775c88ca1a1", this.userInputMap, currentVFData);
+ assertEquals("", stringObjectMap.get("a"));
+ assertEquals("layer2-port", stringObjectMap.get("portswitch"));
+ assertEquals("192.168.11.1", stringObjectMap.get("ipAddress"));
+ assertEquals("CPE_Beijing", stringObjectMap.get("deviceName"));
+
+ // VF level request
+ stringObjectMap = ResourceRequestBuilder.buildResouceRequest("c3954379-4efe-431c-8258-f84905b158e5",
+ "e776449e-2b10-45c5-9217-2775c88ca1c1", this.userInputMap, currentVFData);
+ assertEquals("Huawei Private Cloud", stringObjectMap.get("address"));
+ assertEquals("dsvpn_hub1", stringObjectMap.get("role"));
+ assertTrue(((String) stringObjectMap.get("wanlist")).contains("["));
+ assertTrue(((String) stringObjectMap.get("devlist")).contains("["));
+
+ // VFC request
+ stringObjectMap = ResourceRequestBuilder.buildResouceRequest("c3954379-4efe-431c-8258-f84905b158e5",
+ "e776449e-2b10-45c5-9217-2775c88cb1a1", this.userInputMap, currentVFData);
+ assertEquals("Huawei Private Cloud", stringObjectMap.get("address"));
+ assertEquals("20000", stringObjectMap.get("postcode"));
+ assertEquals("single_gateway", stringObjectMap.get("type"));
+ assertEquals("vCPE", stringObjectMap.get("deviceName"));
+ assertEquals("20.20.20.1", stringObjectMap.get("systemip"));
+ assertEquals("default_ipv6", stringObjectMap.get("systemipv6"));
+
+
+ // VFC request again
+ /*
+ * stringObjectMap = ResourceRequestBuilder.buildResouceRequest( "c3954379-4efe-431c-8258-f84905b158e5",
+ * "e776449e-2b10-45c5-9217-2775c88cb1f1", this.userInputMap, currentVFData);
+ * assertEquals("Huawei Public Cloud", stringObjectMap.get("address")); assertEquals("20001",
+ * stringObjectMap.get("postcode")); assertEquals("multiple_gateway", stringObjectMap.get("type"));
+ * assertEquals("CPE_Beijing", stringObjectMap.get("deviceName")); assertEquals("20.20.20.2",
+ * stringObjectMap.get("systemip"));
+ */
+
+
+ }
+
+
}
diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/SERVICE-SO-REQ-INPUT.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/SERVICE-SO-REQ-INPUT.json
new file mode 100644
index 0000000000..938b45e5a4
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/SERVICE-SO-REQ-INPUT.json
@@ -0,0 +1,206 @@
+{
+ "serviceResources": {
+ "modelInfo": {
+ "modelName": "demoVFWCL",
+ "modelUuid": "c3954379-4efe-431c-8258-f84905b158e5",
+ "modelInvariantUuid": "0cbff61e-3b0a-4eed-97ce-b1b4faa03493",
+ "modelVersion": "1.0"
+ },
+ "serviceType": "",
+ "serviceRole": "",
+ "environmentContext": null,
+ "resourceOrder": "res1,res2",
+ "workloadContext": "Production",
+ "serviceVnfs": [
+
+ {
+ "modelInfo": {
+ "modelName": "15968a6e-2fe5-41bf-a481",
+ "modelUuid": "808abda3-2023-4105-92d2-e62644b61d53",
+ "modelInvariantUuid": "6e4ffc7c-497e-4a77-970d-af966e642d31",
+ "modelVersion": "1.0",
+ "modelCustomizationUuid": "a00404d5-d7eb-4c46-b6b6-9cf2d087e545",
+ "modelInstanceName": "15968a6e-2fe5-41bf-a481 0"
+ },
+ "toscaNodeType": "org.openecomp.resource.vf.15968a6e2fe541bfA481",
+ "nfFunction": null,
+ "resourceInput": "{\"a\":\"b\",\"topology\":\"[sdwanvpnresource_list,INDEX,sdwanvpn_topology]|default_topo\",\"name\":\"[sdwanvpnresource_list,INDEX,sdwanvpn_name]|default_name\",\"sitelist\":\"[sdwanvpnresource_list,INDEX,sdwansitelan_list]|default_sitelist\"}",
+ "nfType": null,
+ "nfRole": null,
+ "nfNamingCode": null,
+ "multiStageDesign": "false",
+ "vfModules": [{
+ "modelInfo": {
+ "modelName": "15968a6e2fe541bfA481..base_vfw..module-0",
+ "modelUuid": "ec7fadde-1e5a-42f7-8255-cb19e475ff45",
+ "modelInvariantUuid": "61ab8b64-a014-4cf3-8a5a-b5ef388f8819",
+ "modelVersion": "1",
+ "modelCustomizationUuid": "123aff6b-854f-4026-ae1e-cc74a3924576"
+ },
+ "isBase": true,
+ "vfModuleLabel": "base_vfw",
+ "initialCount": 1,
+ "hasVolumeGroup": true
+ }]
+ },
+
+ {
+ "modelInfo": {
+ "modelName": "f971106a-248f-4202-9d1f",
+ "modelUuid": "4fbc08a4-35ed-4a59-9e47-79975e4add7e",
+ "modelInvariantUuid": "c669799e-adf1-46ae-8c70-48b326fe89f3",
+ "modelVersion": "1.0",
+ "modelCustomizationUuid": "e776449e-2b10-45c5-9217-2775c88ca1a0",
+ "modelInstanceName": "f971106a-248f-4202-9d1f 0"
+ },
+ "toscaNodeType": "org.openecomp.resource.vfc.F971106a248f42029d1f",
+ "nfFunction": null,
+ "nfType": null,
+ "nfRole": null,
+ "resourceInput": "{\"a\":\"b|\",\"portswitch\":\"[sdwansitelan_list,INDEX,portSwitch]|default_portswitch\",\"ipAddress\":\"[sdwansitelan_list,INDEX,ipAddress]|default_ipAddress\",\"deviceName\":\"[sdwansitelan_list,INDEX,deviceName]|default_deviceName\"}",
+ "nfNamingCode": null,
+ "multiStageDesign": "false",
+ "vfModules": [{
+ "modelInfo": {
+ "modelName": "F971106a248f42029d1f..base_vpkg..module-0",
+ "modelUuid": "47d5273a-7456-4786-9035-b3911944cc35",
+ "modelInvariantUuid": "0ea3e57e-ac7a-425a-928b-b4aee8806c15",
+ "modelVersion": "1",
+ "modelCustomizationUuid": "9ed9fef6-d3f8-4433-9807-7e23393a16bc"
+ },
+ "isBase": true,
+ "vfModuleLabel": "base_vpkg",
+ "initialCount": 1,
+ "hasVolumeGroup": true
+ }]
+ },
+
+ {
+ "modelInfo": {
+ "modelName": "f971106a-248f-4202-9d1e",
+ "modelUuid": "4fbc08a4-35ed-4a59-9e47-79975e4add7d",
+ "modelInvariantUuid": "c669799e-adf1-46ae-8c70-48b326fe89f2",
+ "modelVersion": "1.0",
+ "modelCustomizationUuid": "e776449e-2b10-45c5-9217-2775c88ca1a1",
+ "modelInstanceName": "f971106a-248f-4202-9d1e 0"
+ },
+ "toscaNodeType": "org.openecomp.resource.vfc.F971106a248f42029d1f",
+ "nfFunction": null,
+ "nfType": null,
+ "nfRole": null,
+ "resourceInput": "{\"a\":\"b|\",\"portswitch\":\"[sdwansitelan_list,INDEX,portSwitch]|default_portswitch\",\"ipAddress\":\"[sdwansitelan_list,INDEX,ipAddress]|default_ipAddress\",\"deviceName\":\"[sdwansitelan_list,INDEX,deviceName]|default_deviceName\"}",
+ "nfNamingCode": null,
+ "multiStageDesign": "false",
+ "vfModules": [{
+ "modelInfo": {
+ "modelName": "F971106a248f42029d1f..base_vpkg..module-0",
+ "modelUuid": "47d5273a-7456-4786-9035-b3911944cc35",
+ "modelInvariantUuid": "0ea3e57e-ac7a-425a-928b-b4aee8806c15",
+ "modelVersion": "1",
+ "modelCustomizationUuid": "9ed9fef6-d3f8-4433-9807-7e23393a16bc"
+ },
+ "isBase": true,
+ "vfModuleLabel": "base_vpkg",
+ "initialCount": 1,
+ "hasVolumeGroup": true
+ }]
+ },
+
+ {
+ "modelInfo": {
+ "modelName": "f971106a-248f-4202-9d2e",
+ "modelUuid": "4fbc08a4-35ed-4a59-9e47-79975e4add8d",
+ "modelInvariantUuid": "c669799e-adf1-46ae-8c70-48b326fe89c2",
+ "modelVersion": "1.0",
+ "modelCustomizationUuid": "e776449e-2b10-45c5-9217-2775c88ca1c1",
+ "modelInstanceName": "f971106a-248f-4202-9d2e 0"
+ },
+ "toscaNodeType": "org.openecomp.resource.vf.F971106a248f42029d1f",
+ "nfFunction": null,
+ "nfType": null,
+ "nfRole": null,
+ "resourceInput": "{\"address\":\"[sdwansiteresource_list,INDEX,sdwansite_address]|default_address\",\"role\":\"[sdwansiteresource_list,INDEX,sdwansite_role]|default_role\",\"wanlist\":\"[sdwansiteresource_list,INDEX,sdwansitewan_list]|default_wanlist\",\"devlist\":\"[sdwansiteresource_list,INDEX,sdwandevice_list]|default_devlist\"}",
+ "nfNamingCode": null,
+ "multiStageDesign": "false",
+ "vfModules": [{
+ "modelInfo": {
+ "modelName": "F971106a248f42029d1f..base_vpkg..module-0",
+ "modelUuid": "47d5273a-7456-4786-9035-b3911944cc35",
+ "modelInvariantUuid": "0ea3e57e-ac7a-425a-928b-b4aee8806c15",
+ "modelVersion": "1",
+ "modelCustomizationUuid": "9ed9fef6-d3f8-4433-9807-7e23393a16bc"
+ },
+ "isBase": true,
+ "vfModuleLabel": "base_vpkg",
+ "initialCount": 1,
+ "hasVolumeGroup": true
+ }]
+ },
+
+ {
+ "modelInfo": {
+ "modelName": "f971106a-248f-4202-9d3e",
+ "modelUuid": "4fbc08a4-35ed-4a59-9e47-79975e4add9d",
+ "modelInvariantUuid": "c669799e-adf1-46ae-8c70-48b326fe89f3",
+ "modelVersion": "1.0",
+ "modelCustomizationUuid": "e776449e-2b10-45c5-9217-2775c88cb1a1",
+ "modelInstanceName": "f971106a-248f-4202-9d3e 0"
+ },
+ "toscaNodeType": "org.openecomp.resource.vfc.F971106a248f42029d1f",
+ "nfFunction": null,
+ "nfType": null,
+ "nfRole": null,
+ "resourceInput": "{\"address\":\"sdwansite_address|default_address\", \"postcode\":\"sdwansite_postcode|default_postcode\",\"type\":\"sdwansite_type|default_role\",\"deviceName\":\"[sdwansitewan_list,INDEX,deviceName]|default_deviceName\",\"systemip\":\"[sdwandevice_list,INDEX,systemIp]|default_systemip\", \"systemipv6\":\"[sdwandevice_list,INDEX,systemIpv6]|default_ipv6\"}",
+ "nfNamingCode": null,
+ "multiStageDesign": "false",
+ "vfModules": [{
+ "modelInfo": {
+ "modelName": "F971106a248f42029d1f..base_vpkg..module-0",
+ "modelUuid": "47d5273a-7456-4786-9035-b3911944cc35",
+ "modelInvariantUuid": "0ea3e57e-ac7a-425a-928b-b4aee8806c15",
+ "modelVersion": "1",
+ "modelCustomizationUuid": "9ed9fef6-d3f8-4433-9807-7e23393a16bc"
+ },
+ "isBase": true,
+ "vfModuleLabel": "base_vpkg",
+ "initialCount": 1,
+ "hasVolumeGroup": true
+ }]
+ },
+
+ {
+ "modelInfo": {
+ "modelName": "f971106a-248f-4202-9d5e",
+ "modelUuid": "4fbc08a4-35ed-4a59-9e47-79975e4add3d",
+ "modelInvariantUuid": "c669799e-adf1-46ae-8c70-48b326fe8393",
+ "modelVersion": "1.0",
+ "modelCustomizationUuid": "e776449e-2b10-45c5-9217-2775c88cb1f1",
+ "modelInstanceName": "f971106a-248f-4202-9d5e 0"
+ },
+ "toscaNodeType": "org.openecomp.resource.vfc.F971106a248f42029d3f",
+ "nfFunction": null,
+ "nfType": null,
+ "nfRole": null,
+ "resourceInput": "{\"address\":\"sdwansite_address|default_address\", \"postcode\":\"sdwansite_postcode|default_postcode\",\"type\":\"sdwansite_type|default_role\",\"deviceName\":\"[sdwansitewan_list,INDEX,deviceName]|default_deviceName\",\"systemip\":\"[sdwandevice_list,INDEX,systemIp]|default_systemip\"}",
+ "nfNamingCode": null,
+ "multiStageDesign": "false",
+ "vfModules": [{
+ "modelInfo": {
+ "modelName": "F971106a248f42029d1f..base_vpkg..module-0",
+ "modelUuid": "47d5273a-7456-4786-9035-b3911944cc35",
+ "modelInvariantUuid": "0ea3e57e-ac7a-425a-928b-b4aee8806c15",
+ "modelVersion": "1",
+ "modelCustomizationUuid": "9ed9fef6-d3f8-4433-9807-7e23393a16bc"
+ },
+ "isBase": true,
+ "vfModuleLabel": "base_vpkg",
+ "initialCount": 1,
+ "hasVolumeGroup": true
+ }]
+ }
+
+ ],
+ "serviceNetworks": [],
+ "serviceAllottedResources": []
+ }
+} \ No newline at end of file
diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/UUI-SO-REQ.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/UUI-SO-REQ.json
new file mode 100644
index 0000000000..e6161862ae
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/UUI-SO-REQ.json
@@ -0,0 +1 @@
+{ "sdwanvpnresource_list":[ { "sdwanvpn_topology":"hub_spoke", "sdwanvpn_name":"defaultvpn", "sdwansitelan_list":[ { "role":"Hub", "portType":"GE", "portSwitch":"layer3-port", "vlanId":"", "ipAddress":"192.168.10.1", "deviceName":"vCPE", "portNumer":"0/0/1" }, { "role":"Hub", "portType":"GE", "portSwitch":"layer2-port", "vlanId":"55", "ipAddress":"192.168.11.1", "deviceName":"CPE_Beijing", "portNumer":"0/0/1" } ] } ], "sdwansiteresource_list":[ { "sdwansite_emails":"chenchuanyu@huawei.com", "sdwansite_address":"Huawei Private Cloud", "sdwansite_description":"DC Site", "sdwansite_role":"dsvpn_hub1", "sdwansite_postcode":"20000", "sdwansite_type":"single_gateway", "sdwansite_latitude":"", "sdwansite_controlPoint":"", "sdwansite_longitude":"", "sdwansitewan_list":[ { "providerIpAddress":"", "portType":"GE", "inputBandwidth":"1000", "ipAddress":"", "name":"10000", "transportNetworkName":"internet", "outputBandwidth":"10000", "deviceName":"vCPE", "portNumber":"0/0/0", "ipMode":"DHCP", "publicIP":"119.3.7.113" } ], "sdwandevice_list":[ { "esn":"XXXXXXX", "vendor":"Huawei", "name":"vCPE", "type":"AR1000V", "version":"1.0", "class":"VNF", "systemIp":"20.20.20.1" } ] }, { "sdwansite_emails":"chenchuanyu@huawei.com", "sdwansite_address":"Huawei Public Cloud", "sdwansite_description":"DC Site", "sdwansite_role":"dsvpn_hub", "sdwansite_postcode":"20001", "sdwansite_type":"multiple_gateway", "sdwansite_latitude":"", "sdwansite_controlPoint":"", "sdwansite_longitude":"", "sdwansitewan_list":[ { "providerIpAddress":"", "portType":"GE", "inputBandwidth":"1000", "ipAddress":"172.18.1.2/24", "name":"10000", "transportNetworkName":"internet", "outputBandwidth":"10000", "deviceName":"CPE_Beijing", "portNumber":"0/0/0", "ipMode":"Static", "publicIP":"" } ], "sdwandevice_list":[ { "esn":"XXXXXXX", "vendor":"Huawei", "name":"CPE_Beijing", "type":"AR161", "version":"1.0", "class":"PNF", "systemIp":"20.20.20.2" } ] } ] } \ No newline at end of file
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelofE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelofE2EServiceInstance.groovy
index 7ad929b1c2..c99c702af0 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelofE2EServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelofE2EServiceInstance.groovy
@@ -184,7 +184,7 @@ public class DoCompareModelofE2EServiceInstance extends AbstractServiceTaskProce
rmodel.setResourceCustomizationUuid(resourceCustomizationUuid)
addedResourceList.add(rmodel)
- Map<String, Object> resourceParameters = ResourceRequestBuilder.buildResouceRequest(serviceModelUuid, resourceCustomizationUuid, null)
+ Map<String, Object> resourceParameters = ResourceRequestBuilder.buildResouceRequest(serviceModelUuid, resourceCustomizationUuid, null, null)
requestInputs.addAll(resourceParameters.keySet())
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy
index 973d8a156c..0240beab9a 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy
@@ -260,11 +260,16 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{
//set the requestInputs from tempalte To Be Done
String serviceModelUuid = jsonUtil.getJsonValue(incomingRequest,"service.serviceUuid")
String serviceParameters = jsonUtil.getJsonValue(incomingRequest, "service.parameters")
- String resourceParameters = ResourceRequestBuilder.buildResourceRequestParameters(execution, serviceModelUuid, resourceCustomizationUuid, serviceParameters)
+ Map<String, Object> currentVFData = (Map) execution.getVariable("currentVFData");
+ if (null == currentVFData) {
+ currentVFData = new HashMap<>();
+ }
+ String resourceParameters = ResourceRequestBuilder.buildResourceRequestParameters(execution, serviceModelUuid, resourceCustomizationUuid, serviceParameters, currentVFData)
resourceInput.setResourceParameters(resourceParameters)
resourceInput.setRequestsInputs(incomingRequest)
execution.setVariable("resourceInput", resourceInput.toString())
execution.setVariable("resourceModelUUID", resourceInput.getResourceModelInfo().getModelUuid())
+ execution.setVariable("currentVFData",currentVFData);
logger.trace("COMPLETED prepareResourceRecipeRequest Process ")
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java
index cce476f4d8..9f8a456002 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java
@@ -140,7 +140,9 @@ public class PnfEventReadyDmaapClient implements DmaapClient {
registerClientResponse(idList.get(0), EntityUtils.toString(response.getEntity(), "UTF-8"));
}
- idList.forEach(this::informAboutPnfReadyIfPnfCorrelationIdFound);
+ if (idList != null) {
+ idList.forEach(this::informAboutPnfReadyIfPnfCorrelationIdFound);
+ }
} catch (IOException e) {
logger.error("Exception caught during sending rest request to dmaap for listening event topic", e);
} finally {