From 64d0ab5ebd9121de878d7932e2469afae74c8a99 Mon Sep 17 00:00:00 2001 From: c00149107 Date: Fri, 13 Oct 2017 10:48:59 +0800 Subject: Correct the workflow for NS Create Correct the workflow for NS Create bpmn Change-Id: I71283c88a3936d1b19b3403f6940823875405c90 Issue-ID:SO-217 Signed-off-by: c00149107 --- .../scripts/DoCreateE2EServiceInstance.groovy | 34 +++++++++++++++++++++- .../DoCreateVFCNetworkServiceInstance.groovy | 6 ++-- 2 files changed, 36 insertions(+), 4 deletions(-) (limited to 'bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp') diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy index 7505eed348..b053b4e7d8 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy @@ -179,7 +179,7 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { execution.setVariable("modelVersion", modelVersion) execution.setVariable("modelUuid", modelUuid) execution.setVariable("modelName", modelName) - + StringBuilder sbParams = new StringBuilder() Map paramsMap = execution.getVariable("serviceInputParams") if (paramsMap != null) @@ -666,4 +666,36 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { utils.log("DEBUG", "======== COMPLETED preInitResourcesOperStatus Process ======== ", isDebugEnabled) } + /** + * prepare resource create request + */ + public void preResourceRequest(execution, resourceName){ + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + String serviceInstanceName = execution.getVariable("serviceInstanceName") + String nsServiceName = nsName + "_" + serviceInstanceName + String nsServiceDescription = execution.getVariable("serviceInstanceDescription") + execution.setVariable("nsServiceName", nsServiceName) + utils.log("DEBUG", "Prepare VFC Request nsServiceName:" + nsServiceName, isDebugEnabled) + execution.setVariable("nsServiceDescription", nsServiceDescription) + utils.log("DEBUG", "Prepare VFC Request nsServiceDescription:" + nsServiceDescription, isDebugEnabled) + String globalSubscriberId = execution.getVariable("globalSubscriberId") + String serviceType = execution.getVariable("serviceType") + String serviceId = execution.getVariable("serviceId") + String operationId = execution.getVariable("operationId") + String incomingRequest = execution.getVariable("bpmnRequest") + Map serviceReq = jsonSlurper.parseText(incomingRequest) + def segmentList = serviceReq.service.parameters.segments + if (segmentList != null) { + segmentList.each { + if(StringUtils.containsIgnoreCase(it.resourceName, nsName)){ + String resourceActualName = it.resourceName + String resourceUUID = it.resourceUUID + String resourceParameters = it.nsParameters + execution.setVariable("resourceName", resourceActualName) + execution.setVariable("resourceUUID", resourceUUID) + execution.setVariable("resourceParameters", resourceParameters) + } + } + } + } } diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy index b346faf4c6..6c0dedfe78 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy @@ -80,7 +80,7 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces utils.log("DEBUG", "serviceId:" + serviceId, isDebugEnabled) String operationId = execution.getVariable("operationId") utils.log("DEBUG", "serviceType:" + serviceType, isDebugEnabled) - String nodeTemplateUUID = execution.getVariable("nodeTemplateUUID") + String nodeTemplateUUID = execution.getVariable("resourceUUID") utils.log("DEBUG", "nodeTemplateUUID:" + nodeTemplateUUID, isDebugEnabled) /* * segmentInformation needed as a object of segment @@ -93,13 +93,13 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces * } * } */ - String siRequest = execution.getVariable("segmentInformation") + String nsParameters = execution.getVariable("resourceParamters") utils.log("DEBUG", "Input Request:" + siRequest, isDebugEnabled) String nsOperationKey = "{\"globalSubscriberId\":\"" + globalSubscriberId + "\",\"serviceType:\"" + serviceType + "\",\"serviceId\":\"" + serviceId + "\",\"operationId\":\"" + operationId +"\",\"nodeTemplateUUID\":\"" + nodeTemplateUUID + "\"}"; execution.setVariable("nsOperationKey", nsOperationKey); - execution.setVariable("nsParameters", jsonUtil.getJsonValue(siRequest, "nsParameters")) + execution.setVariable("nsParameters", nsParameters) } catch (BpmnError e) { -- cgit 1.2.3-korg