aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java368
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilderTest.java52
-rw-r--r--bpmn/MSOCommonBPMN/src/test/resources/__files/SERVICE-SO-REQ-INPUT.json109
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy7
4 files changed, 337 insertions, 199 deletions
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 8aab4ec818..18a46dda99 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
@@ -37,6 +37,11 @@ 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.domain.GroupResource;
+import org.onap.so.bpmn.core.domain.Resource;
+import org.onap.so.bpmn.core.domain.ResourceType;
+import org.onap.so.bpmn.core.domain.VnfResource;
+import org.onap.so.bpmn.core.domain.VnfcResource;
import org.onap.so.bpmn.core.json.JsonUtils;
import org.onap.so.client.HttpClient;
import org.onap.so.client.HttpClientFactory;
@@ -87,52 +92,65 @@ public class ResourceRequestBuilder {
*
* @param execution Execution context
*
- * @param serviceUuid The service template uuid
+ * @param currentResource The current Service Resource Object
*
- * @param resourceCustomizationUuid The resource customization uuid
+ * @param uuiServiceParameters the service parameters passed from the API
*
- * @param serviceParameters the service parameters passed from the API
+ * @param currentVFData The object to hold the sequence of execution level for fetching data from UUI inputs
*
* @return the resource instantiate parameters
*
* @since ONAP Beijing Release
*/
@SuppressWarnings("unchecked")
- public static String buildResourceRequestParameters(Execution execution, String serviceUuid,
- String resourceCustomizationUuid, String serviceParameters, Map<String, Object> currentVFData) {
- List<String> resourceList =
- jsonUtil.StringArrayToList(execution, (String) JsonUtils.getJsonValue(serviceParameters, "resources"));
+ public static String buildResourceRequestParameters(Execution execution, Resource currentResource,
+ String uuiServiceParameters, Map<String, Object> currentVFData) {
+ List<String> resourceList = jsonUtil.StringArrayToList(execution,
+ (String) JsonUtils.getJsonValue(uuiServiceParameters, "resources"));
// Get the right location str for resource. default is an empty array.
String locationConstraints = "[]";
String resourceInputsFromUui = "";
- for (String resource : resourceList) {
- String resCusUuid = (String) JsonUtils.getJsonValue(resource, "resourceCustomizationUuid");
- if (resourceCustomizationUuid.equals(resCusUuid)) {
- String resourceParameters = JsonUtils.getJsonValue(resource, "parameters");
- locationConstraints = JsonUtils.getJsonValue(resourceParameters, "locationConstraints");
- resourceInputsFromUui = JsonUtils.getJsonValue(resourceParameters, "requestInputs");
+ if (currentResource.getResourceType() == ResourceType.VNF) {
+ for (String resource : resourceList) {
+ String resCusUuid = (String) JsonUtils.getJsonValue(resource, "resourceCustomizationUuid");
+ if ((null != resCusUuid)
+ && resCusUuid.equals(currentResource.getModelInfo().getModelCustomizationUuid())) {
+ String resourceParameters = JsonUtils.getJsonValue(resource, "parameters");
+ locationConstraints = JsonUtils.getJsonValue(resourceParameters, "locationConstraints");
+ }
}
}
- Map<String, Object> serviceInput = null;
- if (JsonUtils.getJsonValue(serviceParameters, "requestInputs") != null) {
- serviceInput =
- getJsonObject((String) JsonUtils.getJsonValue(serviceParameters, "requestInputs"), Map.class);
- }
- Map<String, Object> resourceInputsFromUuiMap = getJsonObject(resourceInputsFromUui, Map.class);
+ Map<String, Object> uuiRequestInputs = null;
+ if (JsonUtils.getJsonValue(uuiServiceParameters, "requestInputs") != null) {
+ uuiRequestInputs =
+ getJsonObject((String) JsonUtils.getJsonValue(uuiServiceParameters, "requestInputs"), Map.class);
+ }
- if (serviceInput == null) {
- serviceInput = new HashMap();
+ if (uuiRequestInputs == null) {
+ uuiRequestInputs = new HashMap();
+ }
+ String resourceInputStr = null;
+ ResourceLevel resourceLevel = null;
+ switch (currentResource.getResourceType()) {
+ case VNF:
+ resourceInputStr = ((VnfResource) currentResource).getResourceInput();
+ resourceLevel = ResourceLevel.FIRST;
+ break;
+ case GROUP:
+ resourceInputStr = ((GroupResource) currentResource).getVnfcs().get(0).getResourceInput();
+ resourceLevel = ResourceLevel.SECOND;
+ break;
}
- if (resourceInputsFromUuiMap == null) {
- resourceInputsFromUuiMap = new HashMap();
+ Map<String, Object> resourceInputsAfterMerge = new HashMap<>();
+
+ if (StringUtils.isNotEmpty(resourceInputStr) && (null != resourceLevel)) {
+ resourceInputsAfterMerge =
+ getResourceInput(resourceInputStr, uuiRequestInputs, resourceLevel, currentVFData);
}
- Map<String, Object> resourceInputsFromServiceDeclaredLevel =
- buildResouceRequest(serviceUuid, resourceCustomizationUuid, serviceInput, currentVFData);
- resourceInputsFromUuiMap.putAll(resourceInputsFromServiceDeclaredLevel);
- String resourceInputsStr = getJsonString(resourceInputsFromUuiMap);
+ String resourceInputsStr = getJsonString(resourceInputsAfterMerge);
String result = "{\n" + "\"locationConstraints\":" + locationConstraints + ",\n" + "\"requestInputs\":"
+ resourceInputsStr + "\n" + "}";
return result;
@@ -191,9 +209,9 @@ public class ResourceRequestBuilder {
if (modelInfo.get("modelCustomizationUuid").equalsIgnoreCase(resCustomizationUuid)) {
resourceInputMap.put("resourceInput", (String) resource.get("resourceInput"));
String nodeType = ResourceLevel.FIRST.toString();
- if (((String) resource.get("toscaNodeType")).contains(".vf.")) {
+ if (((String) resource.get("resourceType")).equalsIgnoreCase("VNF")) {
nodeType = ResourceLevel.FIRST.toString();
- } else if (((String) resource.get("toscaNodeType")).contains(".vfc.")) {
+ } else if (((String) resource.get("resourceType")).equals("GROUP")) {
nodeType = ResourceLevel.SECOND.toString();
}
resourceInputMap.put("nodeType", nodeType);
@@ -204,178 +222,182 @@ public class ResourceRequestBuilder {
}
// 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> uuiRequestInputs,
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:
+ try {
+ 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 = uuiRequestInputs;
+
+ 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
+ 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++;
+ } else {
firstLevelIndex = 0;
+ }
+ if (lastResourceLevel == ResourceLevel.SECOND) {
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 isSameSecondLevelRequest =
+ resourceInput.values().stream().anyMatch(item -> {
+ JsonElement tree = parser.parse(((String) item).split("\\|")[0]);
+ return tree.isJsonArray() && tree.getAsJsonArray().get(0).getAsString()
+ .equalsIgnoreCase(lastSecondLevelKey);
+ });
+ if (isSameSecondLevelRequest) {
+ secondLevelIndex++;
+ }
+ break;
+ }
+ // get actual parent object to search for second level objects
+ if (null != lastFirstLevelKey) {
+ Object currentObject = uuiRequestInputs.get(lastFirstLevelKey);
+ if ((null != currentObject) && (currentObject instanceof List)) {
+ List currentFirstLevelList = (List) currentObject;
+ if (currentFirstLevelList.size() > firstLevelIndex) {
+ uuiServiceInput =
+ (Map<String, Object>) currentFirstLevelList.get(firstLevelIndex);
+ }
- }
- 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;
+ 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];
-
- 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;
+ // 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];
+
+ 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;
}
- 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));
+ 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;
}
- matchFound = true;
}
}
}
}
- }
- if (!matchFound) {
- if (split.length == 1) { // means value is empty e.g. "a":"key1|"
- value = "";
- } else {
- value = split[1];
+ if (!matchFound) {
+ if (split.length == 1) { // means value is empty e.g. "a":"key1|"
+ value = "";
+ } else {
+ value = split[1];
+ }
}
- }
-
- } else {
- // if not a list type
- if (uuiServiceInput.containsKey(tmpKey)) {
- value = (String) uuiServiceInput.get(tmpKey);
} 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);
}
- 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());
- }
+ // 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;
- return resourceInput;
+ } catch (Exception e) {
+ logger.error("not able to parse and modify service resource input value against UUI ", e);
+ }
+ return new HashMap();
}
private static int getIntValue(Object inputObj, int defaultValue) {
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 adfee796f2..1350a4bcc0 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
@@ -91,7 +91,7 @@ public class ResourceRequestBuilderTest extends BaseTest {
+ "\t\t\"toscaNodeType\" : \"org.openecomp.resource.vf.15968a6e2fe541bfA481\",\n"
+ "\t\t\"nfFunction\" \t: null,\n"
+ "\"resourceInput\":\"{\\\"a\\\":\\\"b\\\"}\","
- + "\t\t\"nfType\" \t\t: null,\n"
+ + "\t\t\"resourceType\" \t\t: \"VNF\",\n"
+ "\t\t\"nfRole\" \t\t: null,\n"
+ "\t\t\"nfNamingCode\" \t: null,\n"
+ "\t\t\"multiStageDesign\" : \"false\",\n" + "\t\t\t\"vfModules\": [\n"
@@ -114,7 +114,7 @@ public class ResourceRequestBuilderTest extends BaseTest {
+ "\t\t\t\"modelInstanceName\" : \"f971106a-248f-4202-9d1f 0\"\n" + "\t\t\t},\n"
+ "\t\t\"toscaNodeType\" : \"org.openecomp.resource.vf.F971106a248f42029d1f\",\n"
+ "\t\t\"nfFunction\" \t: null,\n"
- + "\t\t\"nfType\" \t\t: null,\n"
+ + "\t\t\"resourceType\" \t\t: \"VNF\",\n"
+ "\t\t\"nfRole\" \t\t: null,\n"
+ "\"resourceInput\":\"{\\\"a\\\":\\\"key|default_value\\\"}\","
+ "\t\t\"nfNamingCode\" \t: null,\n"
@@ -185,7 +185,7 @@ public class ResourceRequestBuilderTest extends BaseTest {
+ "\t\t\t\"modelInstanceName\" : \"f971106a-248f-4202-9d1f 0\"\n" + "\t\t\t},\n"
+ "\t\t\"toscaNodeType\" : \"org.openecomp.resource.vf.F971106a248f42029d1f\",\n"
+ "\t\t\"nfFunction\" \t: null,\n"
- + "\t\t\"nfType\" \t\t: null,\n"
+ + "\t\t\"resourceType\" \t\t: \"VNF\",\n"
+ "\t\t\"nfRole\" \t\t: null,\n"
+ "\"resourceInput\":\"{\\\"a\\\":\\\"key|default_value\\\"}\","
+ "\t\t\"nfNamingCode\" \t: null,\n"
@@ -256,7 +256,7 @@ public class ResourceRequestBuilderTest extends BaseTest {
+ "\t\t\t\"modelInstanceName\" : \"f971106a-248f-4202-9d1f 0\"\n" + "\t\t\t},\n"
+ "\t\t\"toscaNodeType\" : \"org.openecomp.resource.vf.F971106a248f42029d1f\",\n"
+ "\t\t\"nfFunction\" \t: null,\n"
- + "\t\t\"nfType\" \t\t: null,\n"
+ + "\t\t\"resourceType\" \t\t: \"VNF\",\n"
+ "\t\t\"nfRole\" \t\t: null,\n"
+ "\"resourceInput\":\"{\\\"a\\\":\\\"value\\\"}\","
+ "\t\t\"nfNamingCode\" \t: null,\n"
@@ -397,7 +397,7 @@ public class ResourceRequestBuilderTest extends BaseTest {
+ "\t\t\"toscaNodeType\" : \"org.openecomp.resource.vf.15968a6e2fe541bfA481\",\n"
+ "\t\t\"nfFunction\" \t: null,\n"
+ "\"resourceInput\":\"{\\\"a\\\":\\\"key1|\\\"}\","
- + "\t\t\"nfType\" \t\t: null,\n"
+ + "\t\t\"resourceType\" \t\t: \"VNF\",\n"
+ "\t\t\"nfRole\" \t\t: null,\n"
+ "\t\t\"nfNamingCode\" \t: null,\n"
+ "\t\t\"multiStageDesign\" : \"false\",\n" + "\t\t\t\"vfModules\": [\n"
@@ -472,19 +472,45 @@ public class ResourceRequestBuilderTest extends BaseTest {
assertEquals("20000", stringObjectMap.get("postcode"));
assertEquals("single_gateway", stringObjectMap.get("type"));
assertEquals("vCPE", stringObjectMap.get("deviceName"));
+ assertEquals("DHCP", stringObjectMap.get("ipMode"));
+
+ // VFC request again
+ stringObjectMap = ResourceRequestBuilder.buildResouceRequest("c3954379-4efe-431c-8258-f84905b158e5",
+ "e776449e-2b10-45c5-9217-2775c88cb1f1", this.userInputMap, currentVFData);
+ assertEquals("Huawei Private Cloud", stringObjectMap.get("address"));
+ assertEquals("20000", stringObjectMap.get("postcode"));
+ assertEquals("single_gateway", stringObjectMap.get("type"));
assertEquals("20.20.20.1", stringObjectMap.get("systemip"));
assertEquals("default_ipv6", stringObjectMap.get("systemipv6"));
+ assertEquals("VNF", stringObjectMap.get("devclass"));
+ // VF level request
+ stringObjectMap = ResourceRequestBuilder.buildResouceRequest("c3954379-4efe-431c-8258-f84905b158e5",
+ "e776449e-2b10-45c5-9217-2775c88ca1c3", this.userInputMap, currentVFData);
+ assertEquals("Huawei Public Cloud", stringObjectMap.get("address"));
+ assertEquals("dsvpn_hub", 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-2775c88cb1a4", 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("Static", stringObjectMap.get("ipMode"));
// 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"));
- */
+ stringObjectMap = ResourceRequestBuilder.buildResouceRequest("c3954379-4efe-431c-8258-f84905b158e5",
+ "e776449e-2b10-45c5-9217-2775c88cb1f5", this.userInputMap, currentVFData);
+ assertEquals("Huawei Public Cloud", stringObjectMap.get("address"));
+ assertEquals("20001", stringObjectMap.get("postcode"));
+ assertEquals("multiple_gateway", stringObjectMap.get("type"));
+ assertEquals("20.20.20.2", stringObjectMap.get("systemip"));
+ assertEquals("default_ipv6", stringObjectMap.get("systemipv6"));
+ assertEquals("PNF", stringObjectMap.get("devclass"));
+
}
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
index 938b45e5a4..4803fca355 100644
--- a/bpmn/MSOCommonBPMN/src/test/resources/__files/SERVICE-SO-REQ-INPUT.json
+++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/SERVICE-SO-REQ-INPUT.json
@@ -25,7 +25,7 @@
"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,
+ "resourceType": "VNF",
"nfRole": null,
"nfNamingCode": null,
"multiStageDesign": "false",
@@ -55,7 +55,7 @@
},
"toscaNodeType": "org.openecomp.resource.vfc.F971106a248f42029d1f",
"nfFunction": null,
- "nfType": null,
+ "resourceType": "GROUP",
"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,
@@ -86,7 +86,7 @@
},
"toscaNodeType": "org.openecomp.resource.vfc.F971106a248f42029d1f",
"nfFunction": null,
- "nfType": null,
+ "resourceType": "GROUP",
"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,
@@ -117,7 +117,7 @@
},
"toscaNodeType": "org.openecomp.resource.vf.F971106a248f42029d1f",
"nfFunction": null,
- "nfType": null,
+ "resourceType": "VNF",
"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,
@@ -148,9 +148,9 @@
},
"toscaNodeType": "org.openecomp.resource.vfc.F971106a248f42029d1f",
"nfFunction": null,
- "nfType": null,
+ "resourceType": "GROUP",
"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\"}",
+ "resourceInput": "{\"address\":\"sdwansite_address|default_address\", \"postcode\":\"sdwansite_postcode|default_postcode\",\"type\":\"sdwansite_type|default_role\",\"deviceName\":\"[sdwansitewan_list,INDEX,deviceName]|default_deviceName\",\"ipMode\":\"[sdwansitewan_list,INDEX,ipMode]|default_ipMode\"}",
"nfNamingCode": null,
"multiStageDesign": "false",
"vfModules": [{
@@ -179,9 +179,9 @@
},
"toscaNodeType": "org.openecomp.resource.vfc.F971106a248f42029d3f",
"nfFunction": null,
- "nfType": null,
+ "resourceType": "GROUP",
"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\"}",
+ "resourceInput": "{\"address\":\"sdwansite_address|default_address\", \"postcode\":\"sdwansite_postcode|default_postcode\",\"type\":\"sdwansite_type|default_role\",\"systemip\":\"[sdwandevice_list,INDEX,systemIp]|default_systemip\", \"systemipv6\":\"[sdwandevice_list,INDEX,systemIpv6]|default_ipv6\", \"devclass\":\"[sdwandevice_list,INDEX,class]|default_class\"}",
"nfNamingCode": null,
"multiStageDesign": "false",
"vfModules": [{
@@ -197,6 +197,99 @@
"initialCount": 1,
"hasVolumeGroup": true
}]
+ },
+
+ {
+ "modelInfo": {
+ "modelName": "f971106a-248f-4202-9d23",
+ "modelUuid": "4fbc08a4-35ed-4a59-9e47-79975e4add83",
+ "modelInvariantUuid": "c669799e-adf1-46ae-8c70-48b326fe89c3",
+ "modelVersion": "1.0",
+ "modelCustomizationUuid": "e776449e-2b10-45c5-9217-2775c88ca1c3",
+ "modelInstanceName": "f971106a-248f-4202-9d23 0"
+ },
+ "toscaNodeType": "org.openecomp.resource.vf.F971106a248f42029d1f",
+ "nfFunction": null,
+ "resourceType": "VNF",
+ "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-9d34",
+ "modelUuid": "4fbc08a4-35ed-4a59-9e47-79975e4add94",
+ "modelInvariantUuid": "c669799e-adf1-46ae-8c70-48b326fe89f4",
+ "modelVersion": "1.0",
+ "modelCustomizationUuid": "e776449e-2b10-45c5-9217-2775c88cb1a4",
+ "modelInstanceName": "f971106a-248f-4202-9d34 0"
+ },
+ "toscaNodeType": "org.openecomp.resource.vfc.F971106a248f42029d1f",
+ "nfFunction": null,
+ "resourceType": "GROUP",
+ "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\",\"ipMode\":\"[sdwansitewan_list,INDEX,ipMode]|default_ipMode\"}",
+ "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-9d55",
+ "modelUuid": "4fbc08a4-35ed-4a59-9e47-79975e4add35",
+ "modelInvariantUuid": "c669799e-adf1-46ae-8c70-48b326fe8395",
+ "modelVersion": "1.0",
+ "modelCustomizationUuid": "e776449e-2b10-45c5-9217-2775c88cb1f5",
+ "modelInstanceName": "f971106a-248f-4202-9d55 0"
+ },
+ "toscaNodeType": "org.openecomp.resource.vfc.F971106a248f42029d3f",
+ "nfFunction": null,
+ "resourceType": "GROUP",
+ "nfRole": null,
+ "resourceInput": "{\"address\":\"sdwansite_address|default_address\", \"postcode\":\"sdwansite_postcode|default_postcode\",\"type\":\"sdwansite_type|default_role\",\"systemip\":\"[sdwandevice_list,INDEX,systemIp]|default_systemip\", \"systemipv6\":\"[sdwandevice_list,INDEX,systemIpv6]|default_ipv6\", \"devclass\":\"[sdwandevice_list,INDEX,class]|default_class\"}",
+ "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
+ }]
}
],
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 e18ad92ef0..ea25904cf3 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
@@ -254,19 +254,16 @@ public class DoCreateResources extends AbstractServiceTaskProcessor{
resourceInput.setResourceModelInfo(currentResource.getModelInfo())
resourceInput.getResourceModelInfo().setModelType(currentResource.getResourceType().toString())
ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
-
resourceInput.setServiceModelInfo(serviceDecomposition.getModelInfo())
- def String resourceCustomizationUuid = currentResource.getModelInfo().getModelCustomizationUuid();
String incomingRequest = execution.getVariable("uuiRequest")
//set the requestInputs from tempalte To Be Done
- String serviceModelUuid = jsonUtil.getJsonValue(incomingRequest,"service.serviceUuid")
- String serviceParameters = jsonUtil.getJsonValue(incomingRequest, "service.parameters")
+ String uuiServiceParameters = jsonUtil.getJsonValue(incomingRequest, "service.parameters")
Map<String, Object> currentVFData = (Map) execution.getVariable("currentVFData");
if (null == currentVFData) {
currentVFData = new HashMap<>();
}
- String resourceParameters = ResourceRequestBuilder.buildResourceRequestParameters(execution, serviceModelUuid, resourceCustomizationUuid, serviceParameters, currentVFData)
+ String resourceParameters = ResourceRequestBuilder.buildResourceRequestParameters(execution, currentResource, uuiServiceParameters, currentVFData)
resourceInput.setResourceParameters(resourceParameters)
resourceInput.setRequestsInputs(incomingRequest)
execution.setVariable("resourceInput", resourceInput.toString())