aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/MSOInfrastructureBPMN/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn/MSOInfrastructureBPMN/src/main')
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy8
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy87
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteSDNCNetworkResource.bpmn8
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn1
4 files changed, 55 insertions, 49 deletions
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 b29c4dc101..9456007dc8 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
@@ -70,13 +70,13 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
//deal with nsName and Description
String resourceInput = execution.getVariable("resourceInput")
+ String resourceParameters = jsonUtil.getJsonValue(resourceInput, "resourceParameters")
// get service name
String resourceName = jsonUtil.getJsonValue(resourceInput, "resourceInstanceName")
- String nsServiceName = resourceName.substring(resourceName.indexOf("_") + 1)
- execution.setVariable("nsServiceName", nsServiceName)
+ execution.setVariable("nsServiceName", resourceName)
String nsServiceDescription = execution.getVariable("nsServiceDescription")
- utils.log("INFO", "nsServiceName:" + nsServiceName + " nsServiceDescription:" + nsServiceDescription, isDebugEnabled)
+ utils.log("INFO", "nsServiceName:" + resourceName + " nsServiceDescription:" + nsServiceDescription, isDebugEnabled)
//deal with operation key
String globalSubscriberId = jsonUtil.getJsonValue(resourceInput, "globalSubscriberId")
utils.log("INFO", "globalSubscriberId:" + globalSubscriberId, isDebugEnabled)
@@ -90,7 +90,7 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
String operationId = execution.getVariable("requestId")
utils.log("INFO", "serviceType:" + serviceType, isDebugEnabled)
- String nodeTemplateUUID = jsonUtil.getJsonValue(resourceInput, "resourceModelInfo.modelCustomizationUuid")
+ String nodeTemplateUUID = jsonUtil.getJsonValue(resourceParameters, "requestInputs.nsd0_providing_service_uuid")
utils.log("INFO", "nodeTemplateUUID:" + nodeTemplateUUID, isDebugEnabled)
/*
* segmentInformation needed as a object of segment
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..690738b312 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.reverse()) {
+ 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")
-
- for(ServiceInstance rc_e : existResourceList){
+ List<Resource> existResourceList = execution.getVariable("deleteResourceList")
- if(StringUtils.containsIgnoreCase(rc_e.getInstanceName(), resourceName)) {
+ int currentIndex = execution.getVariable("currentResourceIndex")
+ Resource curResource = existResourceList.get(currentIndex);
- 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,19 +207,38 @@ 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")
- HttpResponse resp = BpmnRestClient.post(recipeUri, requestId, recipeTimeout, requestAction, serviceInstanceId, serviceType, resourceInput.toString(), recipeParamXsd)
+
+ 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)
+
+ String recipeURL = BPMNProperties.getProperty("bpelURL", "http://mso:8080") + recipeUri
+
+ HttpResponse resp = BpmnRestClient.post(recipeURL, requestId, recipeTimeout, requestAction, serviceInstanceId, serviceType, resourceInput.toString(), recipeParamXsd)
utils.log("INFO", " ======== END executeResourceDelete Process ======== ", isDebugEnabled)
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteSDNCNetworkResource.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteSDNCNetworkResource.bpmn
index c730c8e2de..a9e3f5d807 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteSDNCNetworkResource.bpmn
+++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteSDNCNetworkResource.bpmn
@@ -33,14 +33,14 @@ ex.processJavaException(execution)]]></bpmn:script>
</bpmn:subProcess>
<bpmn:sequenceFlow id="SequenceFlow_1twf9nk" sourceRef="Task_1t687g1" targetRef="Task_0i59nr9" />
<bpmn:sequenceFlow id="SequenceFlow_1ba6i0r" sourceRef="Task_1cglzlg" targetRef="EndEvent_1x6k78c" />
- <bpmn:scriptTask id="Task_1t687g1" name="Pre Resource Delete">
+ <bpmn:scriptTask id="Task_1t687g1" name="Pre Resource Delete" scriptFormat="groovy">
<bpmn:incoming>SequenceFlow_01medil</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_1twf9nk</bpmn:outgoing>
<bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
def dsdncr = new DeleteSDNCNetworkResource()
-dsdncr.preProcessSDNCDelete(execution)]]></bpmn:script>
+dsdncr.preProcessRequest(execution)]]></bpmn:script>
</bpmn:scriptTask>
- <bpmn:scriptTask id="Task_1cglzlg" name="Post Resource Delete">
+ <bpmn:scriptTask id="Task_1cglzlg" name="Post Resource Delete" scriptFormat="groovy">
<bpmn:incoming>SequenceFlow_092fygq</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_1ba6i0r</bpmn:outgoing>
<bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
@@ -48,7 +48,7 @@ def dsdncr = new DeleteSDNCNetworkResource()
dsdncr.postProcessSDNCDelete(execution)]]></bpmn:script>
</bpmn:scriptTask>
<bpmn:sequenceFlow id="SequenceFlow_01medil" sourceRef="Task_1d5rrfs" targetRef="Task_1t687g1" />
- <bpmn:scriptTask id="Task_1d5rrfs" name="Set RecipeParam">
+ <bpmn:scriptTask id="Task_1d5rrfs" name="Set RecipeParam" scriptFormat="groovy">
<bpmn:incoming>SequenceFlow_1qo2pln</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_01medil</bpmn:outgoing>
<bpmn:script><![CDATA[String recipeParamXsdDemo="""
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>