aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/MSOInfrastructureBPMN/src/main/groovy
diff options
context:
space:
mode:
authorsubhash kumar singh <subhash.kumar.singh@huawei.com>2018-04-24 12:47:08 +0000
committersubhash kumar singh <subhash.kumar.singh@huawei.com>2018-04-24 12:47:08 +0000
commitbd78fe1b448e5bd0128ef42f700f5f11acb25092 (patch)
treecb86e346ff61e0d75eb18e41a89d583fe091fe70 /bpmn/MSOInfrastructureBPMN/src/main/groovy
parente230d73d1af3131d0af3323bd9d2e7ab9722cd64 (diff)
Fix SDNC resource deletion for E2E service
Fix SDNC resource deletion for E2E service. Change-Id: I954c39044b4e4384a7941b6b6c5a0cccc57cf9b3 Issue-ID: SO-422 Signed-off-by: subhash kumar singh <subhash.kumar.singh@huawei.com>
Diffstat (limited to 'bpmn/MSOInfrastructureBPMN/src/main/groovy')
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy38
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy4
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy16
3 files changed, 42 insertions, 16 deletions
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 9358537448..72db6f358d 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
@@ -23,6 +23,7 @@ package org.openecomp.mso.bpmn.infrastructure.scripts
import org.json.JSONArray
import org.openecomp.mso.bpmn.common.resource.ResourceRequestBuilder
+import org.openecomp.mso.bpmn.core.domain.ModelInfo
import org.openecomp.mso.bpmn.core.domain.Resource
import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition
import org.openecomp.mso.bpmn.infrastructure.properties.BPMNProperties;
@@ -75,26 +76,39 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor {
String msg = ""
try {
+ ResourceInput resourceInput = new ObjectMapper().readValue(execution.getVariable("resourceInput"), ResourceInput.class)
+
+ ModelInfo resourceModelInfo = resourceInput.getResourceModelInfo()
+ execution.setVariable("resourceInvariantUUID", resourceModelInfo.getModelInvariantUuid())
+ execution.setVariable("modelVersion", resourceModelInfo.getModelVersion())
+ execution.setVariable("resourceUUID", resourceModelInfo.getModelUuid())
+ execution.setVariable("resourceType", resourceModelInfo.getModelType())
+
String serviceInstanceId = execution.getVariable("serviceInstanceId")
String serviceInstanceName = execution.getVariable("serviceInstanceName")
String callbackURL = execution.getVariable("sdncCallbackUrl")
String requestId = execution.getVariable("msoRequestId")
- String serviceId = execution.getVariable("productFamilyId")
- String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
- String globalSubscriberId = execution.getVariable("globalSubscriberId") //globalCustomerId
+ String subscriptionServiceType = execution.getVariable("serviceType")
+ String globalSubscriberId = resourceInput.getGlobalSubscriberId()
String recipeParamsFromRequest = execution.getVariable("recipeParams")
- String serviceModelInfo = execution.getVariable("serviceModelInfo")
+ String serviceId = resourceInput.getServiceInstanceId()
+ ModelInfo serviceModelInfo = resourceInput.getServiceModelInfo()
String modelInvariantUuid = ""
String modelVersion = ""
String modelUuid = ""
String modelName = ""
- if (!isBlank(serviceModelInfo))
+ if (serviceModelInfo != null)
{
- modelInvariantUuid = jsonUtil.getJsonValue(serviceModelInfo, "modelInvariantUuid")
- modelVersion = jsonUtil.getJsonValue(serviceModelInfo, "modelVersion")
- modelUuid = jsonUtil.getJsonValue(serviceModelInfo, "modelUuid")
- modelName = jsonUtil.getJsonValue(serviceModelInfo, "modelName")
+ modelInvariantUuid = serviceModelInfo.getModelInvariantUuid()
+ modelVersion = serviceModelInfo.getModelVersion()
+ modelUuid = serviceModelInfo.getModelUuid()
+ modelName = serviceModelInfo.getModelName()
+
+ execution.setVariable("modelInvariantUuid", serviceModelInfo.getModelInvariantUuid())
+ execution.setVariable("modelVersion", serviceModelInfo.getModelVersion())
+ execution.setVariable("modelUuid", serviceModelInfo.getModelUuid())
+ execution.setVariable("serviceModelName", serviceModelInfo.getModelName())
if (modelInvariantUuid == null) {
modelInvariantUuid = ""
@@ -141,7 +155,6 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor {
operationType = "delete" + operationType + "Instance"
- ResourceInput resourceInput = new ObjectMapper().readValue(execution.getVariable("resourceInput"), ResourceInput.class)
if(StringUtils.containsIgnoreCase(resourceInput.getResourceModelInfo().getModelName(), "overlay")){
//This will be resolved in R3.
sdnc_svcAction ="deactivate"
@@ -194,6 +207,11 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor {
</sdncadapterworkflow:SDNCAdapterWorkflowRequest>"""
sdncDelete = utils.formatXml(sdncDelete)
+
+ // set operation type and resource type is required to form request body
+ execution.setVariable("operationType", "DELETE")
+ execution.setVariable("resourceType", resourceModelInfo.getModelName())
+
//def sdncRequestId2 = UUID.randomUUID().toString()
//String sdncDeactivate = sdncDelete.replace(">delete<", ">deactivate<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<")
execution.setVariable("sdncDelete", sdncDelete)
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy
index ec7370fea3..946c248059 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy
+++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy
@@ -354,6 +354,10 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
utils.log("DEBUG", " ***** Inside processDecomposition() of delete generic e2e service flow ***** ", isDebugEnabled)
try {
ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
+
+ // service model info
+ execution.setVariable("serviceModelInfo", serviceDecomposition.getModelInfo())
+
List<Resource> deleteResourceList = serviceDecomposition.getServiceResources()
String serviceRelationShip = execution.getVariable("serviceRelationShip")
def jsonSlurper = new JsonSlurper()
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy
index 0fcc41c58e..46dd7d6128 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy
+++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy
@@ -202,7 +202,7 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor {
/**
* prepare delete parameters
*/
- public void preResourceDelete(DelegateExecution execution, String resourceName){
+ public void preResourceDelete(DelegateExecution execution){
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
@@ -220,7 +220,7 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor {
execution.setVariable("resourceType", curResource.getModelInfo().getModelName())
execution.setVariable("currentResource", curResource)
utils.log("INFO", "Delete Resource Info resourceTemplate Id :" + resourceTemplateUUID + " resourceInstanceId: "
- + resourceInstanceUUID + " resourceType: " + resourceName, isDebugEnabled)
+ + resourceInstanceUUID, isDebugEnabled)
utils.log("INFO", " ======== END preResourceDelete Process ======== ", isDebugEnabled)
}
@@ -245,12 +245,16 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor {
int recipeTimeout = resourceRecipe.getInt("recipeTimeout")
String recipeParamXsd = resourceRecipe.isNull("paramXSD") ? "" : resourceRecipe.get("paramXSD")
- Resource currentResource = execution.getVariable("currentResource")
-
ResourceInput resourceInput = new ResourceInput();
+
+ ModelInfo serviceModelInfo = execution.getVariable("serviceModelInfo")
+ resourceInput.setServiceModelInfo(serviceModelInfo)
+
+ Resource currentResource = execution.getVariable("currentResource")
resourceInput.setServiceInstanceId(serviceInstanceId)
resourceInput.setResourceInstanceName(currentResource.getResourceInstanceName())
- resourceInput.setGlobalSubscriberId("globalSubscriberId")
+ resourceInput.setGlobalSubscriberId(execution.getVariable("globalSubscriberId"))
+
ModelInfo modelInfo = new ModelInfo()
modelInfo.setModelCustomizationUuid(currentResource.getModelInfo().getModelCustomizationUuid())
modelInfo.setModelUuid(currentResource.getModelInfo().getModelCustomizationUuid())
@@ -264,7 +268,7 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor {
String recipeURL = BPMNProperties.getProperty("bpelURL", "http://mso:8080") + recipeUri
- HttpResponse resp = BpmnRestClient.post(recipeURL, requestId, recipeTimeout, requestAction, serviceInstanceId, serviceType, resourceInput.toString(), recipeParamXsd)
+ HttpResponse resp = BpmnRestClient.post(recipeURL, requestId, recipeTimeout, action, serviceInstanceId, serviceType, resourceInput.toString(), recipeParamXsd)
utils.log("INFO", " ======== END executeResourceDelete Process ======== ", isDebugEnabled)
}