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/DoCreateE2EServiceInstance.groovy108
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy68
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateCustomE2EServiceInstance.bpmn2
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteCustomE2EServiceInstance.bpmn2
4 files changed, 168 insertions, 12 deletions
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 d15be38042..ef2388fe44 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
@@ -32,17 +32,20 @@ import org.openecomp.mso.bpmn.common.scripts.AaiUtil
import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil
import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils
+import org.openecomp.mso.bpmn.common.scripts.CatalogDbUtils;
import org.openecomp.mso.bpmn.core.RollbackData
import org.openecomp.mso.bpmn.core.WorkflowException
import org.openecomp.mso.rest.APIResponse;
import org.openecomp.mso.rest.RESTClient
import org.openecomp.mso.rest.RESTConfig
+import java.util.List;
import java.util.UUID;
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.runtime.Execution
import org.json.JSONObject;
+import org.json.JSONArray;
import org.apache.commons.lang3.*
import org.apache.commons.codec.binary.Base64;
import org.springframework.web.util.UriUtils;
@@ -77,6 +80,7 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
String Prefix="DCRESI_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
+ CatalogDbUtils cutils = new CatalogDbUtils()
public void preProcessRequest (Execution execution) {
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
@@ -402,7 +406,7 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
String serviceInstanceName = execution.getVariable("serviceInstanceName")
String nsServiceName = resourceType + "_" + serviceInstanceName
execution.setVariable("nsServiceName", nsServiceName)
- utils.log("INFO", "Prepare VFC Request nsServiceName:" + nsServiceName, isDebugEnabled)
+ utils.log("INFO", "Prepare Resource Request nsServiceName:" + nsServiceName, isDebugEnabled)
String globalSubscriberId = execution.getVariable("globalSubscriberId")
String serviceType = execution.getVariable("serviceType")
String serviceId = execution.getVariable("serviceInstanceId")
@@ -412,7 +416,7 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
String resourcesStr = jsonUtil.getJsonValue(incomingRequest, "service.parameters.resources")
String nsServiceDescription = jsonUtil.getJsonValue(incomingRequest, "service.description")
execution.setVariable("nsServiceDescription", nsServiceDescription)
- utils.log("INFO", "Prepare VFC Request nsServiceDescription:" + nsServiceDescription, isDebugEnabled)
+ utils.log("INFO", "Prepare Resource Request nsServiceDescription:" + nsServiceDescription, isDebugEnabled)
List<String> resourceList = jsonUtil.StringArrayToList(execution, resourcesStr)
//reset the variables
execution.setVariable("resourceUUID", "")
@@ -427,18 +431,102 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
execution.setVariable("resourceUUID", resourceUUID)
execution.setVariable("resourceInvariantUUID", resourceInvariantUUID)
execution.setVariable("resourceParameters", resourceParameters)
- utils.log("INFO", "Prepare VFC Request resourceType:" + resourceType, isDebugEnabled)
- utils.log("INFO", "Prepare VFC Request resourceUUID:" + resourceUUID, isDebugEnabled)
- utils.log("INFO", "Prepare VFC Request resourceParameters:" + resourceParameters, isDebugEnabled)
+ utils.log("INFO", "Prepare Resource Request resourceType:" + resourceType, isDebugEnabled)
+ utils.log("INFO", "Prepare Resource Request resourceUUID:" + resourceUUID, isDebugEnabled)
+ utils.log("INFO", "Prepare Resource Request resourceParameters:" + resourceParameters, isDebugEnabled)
}
}
- utils.log("INFO", "Prepare VFC Request finished", isDebugEnabled)
+ utils.log("INFO", "Prepare Controller Request finished", isDebugEnabled)
+ }
+ /**
+ * sequence resource. we should analyze resource sequence from service template
+ * Here we make VF first, and then network for E2E service.
+ */
+ public void sequenceResoure(execution){
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ utils.log("INFO", "======== Start sequenceResoure Process ======== ", isDebugEnabled)
+ String serviceModelUUID = execution.getVariable("modelUuid")
+ JSONArray networks = cutils.getAllNetworksByServiceModelUuid(execution, serviceModelUUID)
+ utils.log("DEBUG", "obtained Network list: " + networks, isDebugEnabled)
+ if (networks == null) {
+ utils.log("INFO", "No matching networks in Catalog DB for serviceModelUUID=" + serviceModelUUID, isDebugEnabled)
+ }
+ String incomingRequest = execution.getVariable("uuiRequest")
+ String resourcesStr = jsonUtil.getJsonValue(incomingRequest, "service.parameters.resources")
+ List<String> resourceList = jsonUtil.StringArrayToList(execution, resourcesStr)
+ // Only one match herenetwork
+ List<String> nsResources = new ArrayList<String>()
+ List<String> wanResources = new ArrayList<String>()
+ List<String> resourceSequence = new ArrayList<String>()
+ for(String resource : resourceList){
+ String resourceName = jsonUtil.getJsonValue(resource, "resourceName")
+ String resourceUUID = jsonUtil.getJsonValue(resource, "resourceId")
+ //check is network.
+ boolean isNetwork = false;
+ if(networks != null){
+ for(int i = 0; i < networks.size(); i++){
+ String networkUUID = jsonUtil.getJsonValueForKey(networks.get(i), "modelVersionId")
+ if(StringUtils.equals(resourceUUID, networkUUID)){
+ isNetwork = true
+ break
+ }
+ }
+ }
+ if(isNetwork){
+ wanResources.add(resourceName)
+ }else{
+ nsResources.add(resourceName)
+ }
+ }
+ resourceSequence.addAll(nsResources)
+ resourceSequence.addAll(wanResources)
+ String isContainsWanResource = wanResources.isEmpty() ? "false" : "true"
+ execution.setVariable("isContainsWanResource", isContainsWanResource)
+ execution.setVariable("currentResourceIndex", 0)
+ execution.setVariable("resourceSequence", resourceSequence)
+ utils.log("INFO", "resourceSequence: " + resourceSequence, isDebugEnabled)
+ execution.setVariable("wanResources", wanResources)
+ utils.log("INFO", "======== COMPLETED sequenceResoure Process ======== ", isDebugEnabled)
}
+ public void getCurrentResoure(execution){
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ utils.log("INFO", "======== Start getCurrentResoure Process ======== ", isDebugEnabled)
+ def currentIndex = execution.getVariable("currentResourceIndex")
+ List<String> resourceSequence = execution.getVariable("resourceSequence")
+ List<String> wanResources = execution.getVariable("wanResources")
+ String resourceName = resourceSequence.get(currentIndex)
+ execution.setVariable("resourceType",resourceName)
+ if(wanResources.contains(resourceName)){
+ execution.setVariable("controllerInfo", "SDN-C")
+ }else{
+ execution.setVariable("controllerInfo", "VF-C")
+ }
+ utils.log("INFO", "======== COMPLETED getCurrentResoure Process ======== ", isDebugEnabled)
+ }
+
/**
- * post config request.
+ * sequence resource
*/
- public void postConfigRequest(execution){
- //now do noting
- }
+ public void parseNextResource(execution){
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ utils.log("INFO", "======== Start parseNextResource Process ======== ", isDebugEnabled)
+ def currentIndex = execution.getVariable("currentResourceIndex")
+ def nextIndex = currentIndex + 1
+ execution.setVariable("currentResourceIndex", nextIndex)
+ List<String> resourceSequence = execution.getVariable("resourceSequence")
+ if(nextIndex >= resourceSequence.size()){
+ execution.setVariable("allResourceFinished", "true")
+ }else{
+ execution.setVariable("allResourceFinished", "false")
+ }
+ utils.log("INFO", "======== COMPLETED parseNextResource Process ======== ", isDebugEnabled)
+ }
+
+ /**
+ * post config request.
+ */
+ public void postConfigRequest(execution){
+ //now do noting
+ }
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy
index ecc1488cbc..bf61013c76 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy
+++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy
@@ -35,6 +35,7 @@ import org.openecomp.mso.rest.APIResponse;
import org.openecomp.mso.rest.RESTClient
import org.openecomp.mso.rest.RESTConfig
+import java.util.List;
import java.util.UUID;
import javax.xml.parsers.DocumentBuilder
import javax.xml.parsers.DocumentBuilderFactory
@@ -589,5 +590,72 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess
}
utils.log("INFO", " ======== END preResourceDelete Process ======== ", isDebugEnabled)
}
+
+ public void sequenceResource(execution){
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+
+ utils.log("INFO", " ======== STARTED sequenceResource Process ======== ", isDebugEnabled)
+ List<String> nsResources = new ArrayList<String>()
+ List<String> wanResources = new ArrayList<String>()
+ List<String> resourceSequence = new ArrayList<String>()
+
+ String serviceRelationShip = execution.getVariable("serviceRelationShip")
+
+
+ def jsonSlurper = new JsonSlurper()
+ def jsonOutput = new JsonOutput()
+ List relationShipList = jsonSlurper.parseText(serviceRelationShip)
+
+ if (relationShipList != null) {
+ relationShipList.each {
+ if(StringUtils.containsIgnoreCase(it.resourceType, "overlay") || StringUtils.containsIgnoreCase(it.resourceType, "underlay")){
+ wanResources.add(it.resourceType)
+ }else{
+ nsResources.add(it.resourceType)
+ }
+ }
+ }
+ resourceSequence.addAll(wanResources)
+ resourceSequence.addAll(nsResources)
+ String isContainsWanResource = wanResources.isEmpty() ? "false" : "true"
+ execution.setVariable("isContainsWanResource", isContainsWanResource)
+ execution.setVariable("currentResourceIndex", 0)
+ execution.setVariable("resourceSequence", resourceSequence)
+ utils.log("INFO", "resourceSequence: " + resourceSequence, isDebugEnabled)
+ execution.setVariable("wanResources", wanResources)
+ utils.log("INFO", " ======== END sequenceResource Process ======== ", isDebugEnabled)
+ }
+
+ public void getCurrentResource(execution){
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ utils.log("INFO", "======== Start getCurrentResoure Process ======== ", isDebugEnabled)
+ def currentIndex = execution.getVariable("currentResourceIndex")
+ List<String> resourceSequence = execution.getVariable("resourceSequence")
+ List<String> wanResources = execution.getVariable("wanResources")
+ String resourceName = resourceSequence.get(currentIndex)
+ execution.setVariable("resourceType",resourceName)
+ if(wanResources.contains(resourceName)){
+ execution.setVariable("controllerInfo", "SDN-C")
+ }else{
+ execution.setVariable("controllerInfo", "VF-C")
+ }
+ utils.log("INFO", "======== COMPLETED getCurrentResoure Process ======== ", isDebugEnabled)
+ }
+
+ public void parseNextResource(execution){
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ utils.log("INFO", "======== Start parseNextResource Process ======== ", isDebugEnabled)
+ def currentIndex = execution.getVariable("currentResourceIndex")
+ def nextIndex = currentIndex + 1
+ execution.setVariable("currentResourceIndex", nextIndex)
+ List<String> resourceSequence = execution.getVariable("resourceSequence")
+ if(nextIndex >= resourceSequence.size()){
+ execution.setVariable("allResourceFinished", "true")
+ }else{
+ execution.setVariable("allResourceFinished", "false")
+ }
+ utils.log("INFO", "======== COMPLETED parseNextResource Process ======== ", isDebugEnabled)
+ }
+
}
\ No newline at end of file
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateCustomE2EServiceInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateCustomE2EServiceInstance.bpmn
index 8fc761c0d3..24d5a7b3ad 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateCustomE2EServiceInstance.bpmn
+++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateCustomE2EServiceInstance.bpmn
@@ -22,7 +22,7 @@ ex.processJavaException(execution)]]></bpmn:script>
<bpmn:sequenceFlow id="SequenceFlow_1dsbjjb" name="" sourceRef="StartEvent_0v1ffn4" targetRef="ScriptTask_0u3lw39" />
<bpmn:sequenceFlow id="SequenceFlow_1yay321" name="" sourceRef="ScriptTask_0u3lw39" targetRef="EndEvent_0eznq6x" />
</bpmn:subProcess>
- <bpmn:callActivity id="DoCreateE2EServiceInstance" name="Call DoCreateE2EServiceInstance&#10;" calledElement="DoCreateE2EServiceInstance">
+ <bpmn:callActivity id="DoCreateE2EServiceInstance" name="Call DoCreateE2EServiceInstanceV3&#10;" calledElement="DoCreateE2EServiceInstanceV3">
<bpmn:extensionElements>
<camunda:out source="WorkflowException" target="WorkflowException" />
<camunda:in source="msoRequestId" target="msoRequestId" />
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteCustomE2EServiceInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteCustomE2EServiceInstance.bpmn
index 2983589699..84c370e7fa 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteCustomE2EServiceInstance.bpmn
+++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteCustomE2EServiceInstance.bpmn
@@ -22,7 +22,7 @@ ex.processJavaException(execution)]]></bpmn:script>
<bpmn:sequenceFlow id="SequenceFlow_0guajy5" name="" sourceRef="StartEvent_121296y" targetRef="ScriptTask_1c6ogpt" />
<bpmn:sequenceFlow id="SequenceFlow_0dbt753" name="" sourceRef="ScriptTask_1c6ogpt" targetRef="EndEvent_1dw3dwx" />
</bpmn:subProcess>
- <bpmn:callActivity id="CallActivity_1vyx9hu" name="Call DoCustomDeleteE2EServiceInstance&#10;" calledElement="DoCustomDeleteE2EServiceInstance">
+ <bpmn:callActivity id="CallActivity_1vyx9hu" name="Call DoCustomDeleteE2EServiceInstanceV3&#10;" calledElement="DoCustomDeleteE2EServiceInstanceV3">
<bpmn:extensionElements>
<camunda:out source="WorkflowException" target="WorkflowException" />
<camunda:in source="msoRequestId" target="msoRequestId" />