summaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-infrastructure-common/src/main
diff options
context:
space:
mode:
authorMarcus G K Williams <marcus.williams@intel.com>2018-10-25 07:49:31 -0700
committerMarcus G K Williams <marcus.williams@intel.com>2018-10-29 13:29:13 -0700
commit649c4e85cc991ffe9c13fd3fab4cc3a303faa656 (patch)
tree7122a2cb3f58cdcb2f79fd59fabdb266b4f5c627 /bpmn/so-bpmn-infrastructure-common/src/main
parent6c2c8a66fade016f74b51bdfea3ba04494530b97 (diff)
Fix Error, Check that vimID is present
Issue-ID: SO-1156 Change-Id: I14445f0e6dbed00b37a189f3a7c05923c6d4e5ab Signed-off-by: Marcus G K Williams <marcus.williams@intel.com>
Diffstat (limited to 'bpmn/so-bpmn-infrastructure-common/src/main')
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy63
1 files changed, 46 insertions, 17 deletions
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 beac679691..1a47ef88e2 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
@@ -176,17 +176,30 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
execution.setVariable("subscriberInfo", subscriberInfo)
msoLogger.debug("Incoming subscriberInfo is: " + subscriberInfo)
- // extract cloud configuration, split vid_ID into cloudOwner and cloudRegionId
+ // extract cloud configuration - if underscore "_" is present treat as vimId else it's a cloudRegion
String vimId = jsonUtil.getJsonValue(createVcpeServiceRequest,
"requestDetails.cloudConfiguration.lcpCloudRegionId")
- def cloudRegion = vimId.split("_")
- def cloudOwner = cloudRegion[0].toString()
- def cloudRegionId = cloudRegion[1].toString()
- execution.setVariable("cloudOwner", cloudOwner)
- utils.log("DEBUG","cloudOwner: " + cloudOwner, isDebugEnabled)
- execution.setVariable("cloudRegionId", cloudRegionId)
- utils.log("DEBUG","cloudRegionId: " + cloudRegionId, isDebugEnabled)
-
+ if (vimId.contains("_") && vimId.split("_").length == 2 ) {
+ def cloudRegion = vimId.split("_")
+ def cloudOwner = cloudRegion[0]
+ def cloudRegionId = cloudRegion[1]
+ execution.setVariable("cloudOwner", cloudOwner)
+ msoLogger.debug("cloudOwner: " + cloudOwner)
+ execution.setVariable("cloudRegionId", cloudRegionId)
+ msoLogger.debug("cloudRegionId: " + cloudRegionId)
+ } else {
+ msoLogger.debug("vimId is not present - setting cloudRegion/cloudOwner from request.")
+ String cloudOwner = jsonUtil.getJsonValue(createVcpeServiceRequest,
+ "requestDetails.cloudConfiguration.cloudOwner")
+ if (!cloudOwner?.empty && cloudOwner != "")
+ {
+ execution.setVariable("cloudOwner", cloudOwner)
+ msoLogger.debug("cloudOwner: " + cloudOwner)
+ }
+ def cloudRegionId = vimId
+ execution.setVariable("cloudRegionId", cloudRegionId)
+ msoLogger.debug("cloudRegionId: " + cloudRegionId)
+ }
/*
* Extracting User Parameters from incoming Request and converting into a Map
*/
@@ -592,16 +605,32 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
msoLogger.debug(" vnfModelInfoString :" + vnfModelInfoString)
- // extract cloud configuration
+ // extract cloud configuration - if underscore "_" is present treat as vimId else it's a cloudRegion
String vimId = jsonUtil.getJsonValue(createVcpeServiceRequest,
"requestDetails.cloudConfiguration.lcpCloudRegionId")
- def cloudRegion = vimId.split("_")
- execution.setVariable("cloudOwner", cloudRegion[0])
- msoLogger.debug("cloudOwner: "+ cloudRegion[0])
- execution.setVariable("cloudRegionId", cloudRegion[1])
- msoLogger.debug("cloudRegionId: "+ cloudRegion[1])
- execution.setVariable("lcpCloudRegionId", cloudRegion[1])
- msoLogger.debug("lcpCloudRegionId: "+ cloudRegion[1])
+ if (vimId.contains("_") && vimId.split("_").length == 2 ) {
+ def cloudRegion = vimId.split("_")
+ execution.setVariable("cloudOwner", cloudRegion[0])
+ msoLogger.debug("cloudOwner: " + cloudRegion[0])
+ execution.setVariable("cloudRegionId", cloudRegion[1])
+ msoLogger.debug("cloudRegionId: " + cloudRegion[1])
+ execution.setVariable("lcpCloudRegionId", cloudRegion[1])
+ msoLogger.debug("lcpCloudRegionId: " + cloudRegion[1])
+ } else {
+ msoLogger.debug("vimId is not present - setting cloudRegion/cloudOwner from request.")
+ String cloudOwner = jsonUtil.getJsonValue(createVcpeServiceRequest,
+ "requestDetails.cloudConfiguration.cloudOwner")
+ if (!cloudOwner?.empty && cloudOwner != "")
+ {
+ execution.setVariable("cloudOwner", cloudOwner)
+ msoLogger.debug("cloudOwner: " + cloudOwner)
+ }
+ execution.setVariable("cloudRegionId", vimId)
+ msoLogger.debug("cloudRegionId: " + vimId)
+ execution.setVariable("lcpCloudRegionId", vimId)
+ msoLogger.debug("lcpCloudRegionId: " + vimId)
+ }
+
String tenantId = jsonUtil.getJsonValue(createVcpeServiceRequest,
"requestDetails.cloudConfiguration.tenantId")
execution.setVariable("tenantId", tenantId)