summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsubhash kumar singh <subhash.kumar.singh@huawei.com>2018-04-17 03:33:44 +0000
committersubhash kumar singh <subhash.kumar.singh@huawei.com>2018-04-17 03:33:44 +0000
commit62aaca24667fe9c614d6a982fe39dc52756d7702 (patch)
tree161d4f0c0a69c27d70ed3a15eef971e8095e2fd0
parentf8aa02a9e9129932805dfc7bc1f5cb3205e9df41 (diff)
Fix resource sequence and variables
Fix resource sequence and variables Change-Id: Ief214443fdaab273d420660abe8e2cec8b6f5da2 Issue-ID: SO-422 Signed-off-by: subhash kumar singh <subhash.kumar.singh@huawei.com>
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy83
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn1
2 files changed, 44 insertions, 40 deletions
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 38dca886b4..8590375ad7 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
@@ -32,6 +32,8 @@ import org.openecomp.mso.bpmn.common.resource.ResourceRequestBuilder
import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.openecomp.mso.bpmn.common.scripts.CatalogDbUtils
import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil
+import org.openecomp.mso.bpmn.core.domain.ModelInfo
+import org.openecomp.mso.bpmn.core.domain.NetworkResource
import org.openecomp.mso.bpmn.core.domain.Resource
import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition
import org.openecomp.mso.bpmn.core.domain.ServiceInstance
@@ -144,42 +146,28 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor {
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
utils.log("INFO", " ======== STARTED sequenceResource Process ======== ", isDebugEnabled)
- List<String> nsResources = new ArrayList<String>()
+ List<Resource> sequencedResourceList = new ArrayList<Resource>()
List<String> wanResources = new ArrayList<String>()
- List<String> resourceSequence = new ArrayList<String>()
// get delete resource list and order list
List<Resource> delResourceList = execution.getVariable("deleteResourceList")
// existing resource list
List<ServiceInstance> existResourceList = execution.getVariable("realNSRessources")
- for(ServiceInstance rc_e : existResourceList){
+ def resourceSequence = BPMNProperties.getResourceSequenceProp()
- String muuid = rc_e.getModelInfo().getModelUuid()
- String mIuuid = rc_e.getModelInfo().getModelInvariantUuid()
- String mCuuid = rc_e.getModelInfo().getModelCustomizationUuid()
- rcType = rc_e.getInstanceName()
+ for (resourceType in resourceSequence) {
+ for (resource in delResourceList) {
+ if (StringUtils.containsIgnoreCase(resource.getModelInfo().getModelName(), resourceType)) {
+ sequencedResourceList.add(resource)
- for(Resource rc_d : delResourceList){
-
- if(rc_d.getModelInfo().getModelUuid() == muuid
- && rc_d.getModelInfo().getModelInvariantUuid() == mIuuid
- && rc_d.getModelInfo().getModelCustomizationUuid() == mCuuid) {
-
- if(StringUtils.containsIgnoreCase(rcType, "overlay")
- || StringUtils.containsIgnoreCase(rcType, "underlay")){
- wanResources.add(rcType)
- }else{
- nsResources.add(rcType)
+ if (resource instanceof NetworkResource) {
+ wanResources.add(resource)
}
-
}
}
-
}
- resourceSequence.addAll(wanResources)
- resourceSequence.addAll(nsResources)
String isContainsWanResource = wanResources.isEmpty() ? "false" : "true"
execution.setVariable("isContainsWanResource", isContainsWanResource)
execution.setVariable("currentResourceIndex", 0)
@@ -198,21 +186,19 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor {
utils.log("INFO", " ======== STARTED preResourceDelete Process ======== ", isDebugEnabled)
- List<ServiceInstance> existResourceList = execution.getVariable("realNSRessources")
+ List<Resource> existResourceList = execution.getVariable("deleteResourceList")
- for(ServiceInstance rc_e : existResourceList){
+ int currentIndex = execution.getVariable("currentResourceIndex")
+ Resource curResource = existResourceList.get(currentIndex);
- if(StringUtils.containsIgnoreCase(rc_e.getInstanceName(), resourceName)) {
-
- String resourceInstanceUUID = rc_e.getInstanceId()
- String resourceTemplateUUID = rc_e.getModelInfo().getModelUuid()
- execution.setVariable("resourceInstanceId", resourceInstanceUUID)
- execution.setVariable("resourceTemplateId", resourceTemplateUUID)
- execution.setVariable("resourceType", resourceName)
- utils.log("INFO", "Delete Resource Info resourceTemplate Id :" + resourceTemplateUUID + " resourceInstanceId: "
- + resourceInstanceUUID + " resourceType: " + resourceName, isDebugEnabled)
- }
- }
+ String resourceInstanceUUID = curResource.getResourceId()
+ String resourceTemplateUUID = curResource.getModelInfo().getModelUuid()
+ execution.setVariable("resourceInstanceId", resourceInstanceUUID)
+ execution.setVariable("resourceUuid", resourceTemplateUUID)
+ execution.setVariable("resourceType", curResource.getModelInfo().getModelName())
+ execution.setVariable("currentResource", curResource)
+ utils.log("INFO", "Delete Resource Info resourceTemplate Id :" + resourceTemplateUUID + " resourceInstanceId: "
+ + resourceInstanceUUID + " resourceType: " + resourceName, isDebugEnabled)
utils.log("INFO", " ======== END preResourceDelete Process ======== ", isDebugEnabled)
}
@@ -221,18 +207,35 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor {
/**
* Execute delete workflow for resource
*/
- public void executeResourceDelete(execution) {
+ public void executeResourceDelete(execution, resourceName) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
utils.log("INFO", "======== Start executeResourceDelete Process ======== ", isDebugEnabled)
String requestId = execution.getVariable("msoRequestId")
String serviceInstanceId = execution.getVariable("serviceInstanceId")
String serviceType = execution.getVariable("serviceType")
- ResourceInput resourceInput = execution.getVariable("resourceInput")
- String requestAction = resourceInput.getOperationType()
- JSONObject resourceRecipe = cutils.getResourceRecipe(execution, resourceInput.getResourceUuid(), requestAction)
+
+ String resourceInstanceId = execution.getVariable("resourceInstanceId")
+ String resourceUuid = execution.getVariable("resourceUuid")
+
+ String requestAction = execution.getVariable("operationType")
+ JSONObject resourceRecipe = cutils.getResourceRecipe(execution, resourceUuid, requestAction)
String recipeUri = resourceRecipe.getString("orchestrationUri")
- String recipeTimeOut = resourceRecipe.getString("recipeTimeout")
+ int recipeTimeout = resourceRecipe.getInt("recipeTimeout")
String recipeParamXsd = resourceRecipe.get("paramXSD")
+
+ Resource currentResource = execution.getVariable("currentResource")
+
+ ResourceInput resourceInput = new ResourceInput();
+ resourceInput.setServiceInstanceId(serviceInstanceId)
+ resourceInput.setResourceInstanceName(currentResource.getResourceInstanceName())
+ resourceInput.setGlobalSubscriberId("globalSubscriberId")
+ ModelInfo modelInfo = new ModelInfo()
+ modelInfo.setModelCustomizationUuid(currentResource.getModelInfo().getModelCustomizationUuid())
+ modelInfo.setModelUuid(currentResource.getModelInfo().getModelCustomizationUuid())
+ modelInfo.setModelInvariantUuid(currentResource.getModelInfo().getModelInvariantUuid())
+ resourceInput.setServiceModelInfo(modelInfo)
+ resourceInput.setServiceType(serviceType)
+
HttpResponse resp = BpmnRestClient.post(recipeUri, requestId, recipeTimeout, requestAction, serviceInstanceId, serviceType, resourceInput.toString(), recipeParamXsd)
utils.log("INFO", " ======== END executeResourceDelete Process ======== ", isDebugEnabled)
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn
index ac8e60778b..20686252bd 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn
+++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn
@@ -164,6 +164,7 @@ dcsi.postDecomposeService(execution)]]></bpmn:script>
<camunda:in source="serviceInputParams" target="serviceInputParams" />
<camunda:in source="deleteResourceList" target="deleteResourceList" />
<camunda:in source="resourceInstanceIDs" target="resourceInstanceIDs" />
+ <camunda:in source="operationType" target="operationType" />
</bpmn:extensionElements>
<bpmn:incoming>SequenceFlow_1j08ko3</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_1cevtpy</bpmn:outgoing>