summaryrefslogtreecommitdiffstats
path: root/bpmn/MSOInfrastructureBPMN/src/main/groovy
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn/MSOInfrastructureBPMN/src/main/groovy')
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy22
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy9
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy22
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy42
4 files changed, 77 insertions, 18 deletions
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy
index f265638423..43b32a4d85 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy
+++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy
@@ -67,7 +67,7 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
try {
//get bpmn inputs from resource request.
- String requestId = execution.getVariable("requestId")
+ String requestId = execution.getVariable("mso-request-id")
String requestAction = execution.getVariable("requestAction")
utils.log("INFO","The requestAction is: " + requestAction, isDebugEnabled)
String recipeParamsFromRequest = execution.getVariable("recipeParams")
@@ -318,4 +318,24 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
utils.log("INFO","response from sdnc, response code :" + responseCode + " response object :" + responseObj, isDebugEnabled)
utils.log("INFO"," ***** Exit prepareSDNCRequest *****", isDebugEnabled)
}
+
+ public void sendSyncResponse (DelegateExecution execution) {
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ utils.log("DEBUG", " *** sendSyncResponse *** ", isDebugEnabled)
+
+ try {
+ String operationStatus = "finished"
+ // RESTResponse for main flow
+ String resourceOperationResp = """{"operationStatus":"${operationStatus}"}""".trim()
+ utils.log("DEBUG", " sendSyncResponse to APIH:" + "\n" + resourceOperationResp, isDebugEnabled)
+ sendWorkflowResponse(execution, 202, resourceOperationResp)
+ execution.setVariable("sentSyncResponse", true)
+
+ } catch (Exception ex) {
+ String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage()
+ utils.log("DEBUG", msg, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ utils.log("DEBUG"," ***** Exit sendSyncResopnse *****", isDebugEnabled)
+ }
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy
index 9f3910beed..5390ee92db 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy
+++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy
@@ -269,7 +269,7 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
utils.log("INFO", " ======== Started Execute AAI Put Process ======== ", isDebugEnabled)
APIResponse apiResponse = null
try{
- String uuid = utils.getRequestID()
+ String uuid = execution.getVariable("mso-request-id");
utils.log("INFO","Generated uuid is: " + uuid, isDebugEnabled)
utils.log("INFO","URL to be used is: " + url, isDebugEnabled)
String userName = execution.getVariable("URN_aai_auth")
@@ -317,12 +317,11 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
utils.log("DEBUG", " *** sendSyncResponse *** ", isDebugEnabled)
try {
- String nsInstanceId = execution.getVariable("nsInstanceId")
String operationStatus = execution.getVariable("operationStatus")
// RESTResponse for main flow
- String createVFCResourceRestRsp = """{"nsInstanceId":"${nsInstanceId}","operationStatus":"${operationStatus}"}""".trim()
- utils.log("DEBUG", " sendSyncResponse to APIH:" + "\n" + createVFCResourceRestRsp, isDebugEnabled)
- sendWorkflowResponse(execution, 202, createVFCResourceRestRsp)
+ String resourceOperationResp = """{"operationStatus":"${operationStatus}"}""".trim()
+ utils.log("DEBUG", " sendSyncResponse to APIH:" + "\n" + resourceOperationResp, isDebugEnabled)
+ sendWorkflowResponse(execution, 202, resourceOperationResp)
execution.setVariable("sentSyncResponse", true)
} catch (Exception ex) {
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy
index 73230c6f21..447fa63baf 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy
+++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy
@@ -67,7 +67,7 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor {
try {
//get bpmn inputs from resource request.
- String requestId = execution.getVariable("requestId")
+ String requestId = execution.getVariable("mso-request-id")
String requestAction = execution.getVariable("requestAction")
utils.log("INFO","The requestAction is: " + requestAction, isDebugEnabled)
String recipeParamsFromRequest = execution.getVariable("recipeParams")
@@ -297,4 +297,24 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor {
utils.log("INFO","response from sdnc, response code :" + responseCode + " response object :" + responseObj, isDebugEnabled)
utils.log("INFO"," ***** Exit prepareSDNCRequest *****", isDebugEnabled)
}
+
+ public void sendSyncResponse (DelegateExecution execution) {
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ utils.log("DEBUG", " *** sendSyncResponse *** ", isDebugEnabled)
+
+ try {
+ String operationStatus = "finished"
+ // RESTResponse for main flow
+ String resourceOperationResp = """{"operationStatus":"${operationStatus}"}""".trim()
+ utils.log("DEBUG", " sendSyncResponse to APIH:" + "\n" + resourceOperationResp, isDebugEnabled)
+ sendWorkflowResponse(execution, 202, resourceOperationResp)
+ execution.setVariable("sentSyncResponse", true)
+
+ } catch (Exception ex) {
+ String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage()
+ utils.log("DEBUG", msg, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ utils.log("DEBUG"," ***** Exit sendSyncResopnse *****", isDebugEnabled)
+ }
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy
index f29db9252f..dff1ecf68e 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy
+++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy
@@ -226,23 +226,43 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor {
utils.log("INFO"," *** Exit postProcessForAddResource *** ", isDebugEnabled)
}
- public void preProcessForDeleteResource(DelegateExecution execution) {
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ public void preProcessForDeleteResource(DelegateExecution execution) {
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
utils.log("INFO"," ***** preProcessForDeleteResource ***** ", isDebugEnabled)
-
+
execution.setVariable("operationType", "delete")
-
- execution.setVariable("hasResourcetoDelete", false)
+
+ def hasResourcetoDelete = false
List<Resource> delResourceList = execution.getVariable("delResourceList")
if(delResourceList != null && !delResourceList.isEmpty()) {
- execution.setVariable("hasResourcetoDelete", true)
- }
-
- execution.setVariable("resourceInstanceIDs", execution.getVariable("serviceRelationShip"))
+ hasResourcetoDelete = true
+ }
+ execution.setVariable("hasResourcetoDelete", hasResourcetoDelete)
+
+ if(hasResourcetoDelete) {
+ def jsonSlurper = new JsonSlurper()
+ String serviceRelationShip = execution.getVariable("serviceRelationShip")
+ List relationShipList = jsonSlurper.parseText(serviceRelationShip)
+
+ //Set the real resource instance id to the decomosed resource list
+ for(Resource resource: delResourceList){
+ //reset the resource instance id , because in the decompose flow ,its a random one.
+ resource.setResourceId("");
+ //match the resource-instance-name and the model name
+ if (relationShipList != null) {
+ relationShipList.each {
+ if(StringUtils.containsIgnoreCase(it.resourceType, resource.getModelInfo().getModelName())){
+ resource.setResourceId(it.resourceInstanceId);
+ }
+ }
+ }
+ }
+ }
- utils.log("INFO"," *** Exit preProcessForDeleteResource *** ", isDebugEnabled)
+ execution.setVariable("deleteResourceList", delResourceList)
- }
+ utils.log("INFO"," *** Exit preProcessForDeleteResource *** ", isDebugEnabled)
+ }
public void postProcessForDeleteResource(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")