summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcus G K Williams <marcus.williams@intel.com>2018-10-10 16:50:52 -0700
committerMarcus Williams <marcus.williams@intel.com>2018-10-11 17:27:03 +0000
commitcbea6d143050276e024fc710450a028afc7a102f (patch)
tree583c3aa77dcd3344c90f58738b3335c9163ddfa0
parent0bd06bfb5c1d8f2cf963a047ad6b687598ec55bf (diff)
Fix UserInput Exception
This change fixes processing of UserInput in prepareCreateServiceInstance which causes an exception if any user-input is passed into createRequest. Issue-ID: SO-1121 Change-Id: Iae8b158dfb8771d55607e09bdb18471358a2d9cd Signed-off-by: Marcus G K Williams <marcus.williams@intel.com>
-rwxr-xr-xbpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateGenericALaCarteServiceInstance.groovy66
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy9
-rw-r--r--common/pom.xml2
3 files changed, 65 insertions, 12 deletions
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateGenericALaCarteServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateGenericALaCarteServiceInstance.groovy
index 968612301d..9763960bfd 100755
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateGenericALaCarteServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateGenericALaCarteServiceInstance.groovy
@@ -142,12 +142,37 @@ public class CreateGenericALaCarteServiceInstance extends AbstractServiceTaskPro
Map<String, String> inputMap = [:]
if (userParams) {
userParams.each {
- userParam -> inputMap.put(userParam.name, userParam.value.toString())
+ userParam ->
+ if ("Customer_Location".equals(userParam?.name)) {
+ msoLogger.debug("User Input customerLocation: " + userParam.value.toString())
+ Map<String, String> customerMap = [:]
+ userParam.value.each {
+ param ->
+
+ inputMap.put(param.key, param.value)
+ customerMap.put(param.key, param.value)
+ }
+ execution.setVariable("customerLocation", customerMap)
+ }
+ if ("Homing_Solution".equals(userParam?.name)) {
+ msoLogger.debug("User Input Homing_Solution: " + userParam.value.toString())
+ execution.setVariable("homingService", userParam.value)
+ execution.setVariable("callHoming", true)
+ inputMap.put("Homing_Solution", userParam.value)
+ }
+ if (!"Homing_Solution".equals(userParam?.name) && !"Customer_Location".equals(userParam?.name))
+ {
+ msoLogger.debug("User Input Parameter " + userParam.name + ": " + userParam.value.toString())
+ inputMap.put(userParam.name, userParam.value)
+ }
}
}
msoLogger.debug("User Input Parameters map: " + userParams.toString())
- execution.setVariable("serviceInputParams", inputMap)
+ msoLogger.debug("User Input Map: " + inputMap.toString())
+ if (inputMap.toString() != "[:]") {
+ execution.setVariable("serviceInputParams", inputMap)
+ }
//TODO
//execution.setVariable("failExists", true)
@@ -231,7 +256,7 @@ public class CreateGenericALaCarteServiceInstance extends AbstractServiceTaskPro
}
public void processDecomposition(DelegateExecution execution) {
- def isDebugEnabled = execution.getVariable(DebugFlag)
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
msoLogger.trace("Inside processDecomposition() of CreateGenericALaCarteServiceInstance ")
@@ -241,7 +266,6 @@ public class CreateGenericALaCarteServiceInstance extends AbstractServiceTaskPro
// VNFs
List<VnfResource> vnfList = serviceDecomposition.getVnfResources()
- filterVnfs(vnfList)
serviceDecomposition.setVnfResources(vnfList)
execution.setVariable("vnfList", vnfList)
@@ -290,18 +314,44 @@ public class CreateGenericALaCarteServiceInstance extends AbstractServiceTaskPro
def jsonOutput = new JsonOutput()
def siRequest = execution.getVariable("bpmnRequest")
Map reqMap = jsonSlurper.parseText(siRequest)
+
//InputParams
def userParams = reqMap.requestDetails?.requestParameters?.userParams
+
Map<String, String> inputMap = [:]
- if (userParams != null) {
+ if (userParams) {
userParams.each {
- userParam -> inputMap.put(userParam.name, userParam.value)
+ userParam ->
+ if ("Customer_Location".equals(userParam?.name)) {
+ msoLogger.debug("User Input customerLocation: " + userParam.value.toString())
+ Map<String, String> customerMap = [:]
+ userParam.value.each {
+ param ->
+
+ inputMap.put(param.key, param.value)
+ customerMap.put(param.key, param.value)
+ }
+ execution.setVariable("customerLocation", customerMap)
+ }
+ if ("Homing_Solution".equals(userParam?.name)) {
+ msoLogger.debug("User Input Homing_Solution: " + userParam.value.toString())
+ execution.setVariable("homingService", userParam.value)
+ execution.setVariable("callHoming", true)
+ inputMap.put("Homing_Solution", userParam.value)
+ }
+ if (!"Homing_Solution".equals(userParam?.name) && !"Customer_Location".equals(userParam?.name))
+ {
+ msoLogger.debug("User Input Parameter " + userParam.name + ": " + userParam.value.toString())
+ inputMap.put(userParam.name, userParam.value)
+ }
}
}
msoLogger.debug("User Input Parameters map: " + userParams.toString())
- execution.setVariable("serviceInputParams", inputMap)
-
+ msoLogger.debug("User Input Map: " + inputMap.toString())
+ if (inputMap.toString() != "[:]") {
+ execution.setVariable("serviceInputParams", inputMap)
+ }
ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
String serviceInstanceId = execution.getVariable("serviceInstanceId")
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy
index c5f712cafc..beac679691 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy
@@ -202,12 +202,15 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
userParams.each {
userParam ->
if ("Customer_Location".equals(userParam?.name)) {
- execution.setVariable("customerLocation", userParam.value)
- userParam.value.each {
+ Map<String, String> customerMap = [:]
+ userParam.value.each {
param ->
+
inputMap.put(param.key, param.value)
+ customerMap.put(param.key, param.value)
}
- }
+ execution.setVariable("customerLocation", customerMap)
+ }
if ("Homing_Model_Ids".equals(userParam?.name)) {
utils.log("DEBUG", "Homing_Model_Ids: " + userParam.value.toString() + " ---- Type is:" +
userParam.value.getClass() , isDebugEnabled)
diff --git a/common/pom.xml b/common/pom.xml
index 285cd5613d..d8e71b0e44 100644
--- a/common/pom.xml
+++ b/common/pom.xml
@@ -62,7 +62,7 @@
<dependency>
<groupId>org.onap.aai.aai-common</groupId>
<artifactId>aai-schema</artifactId>
- <version>1.3.0-SNAPSHOT</version>
+ <version>1.3.0</version>
</dependency>
<dependency>
<groupId>org.modelmapper</groupId>