summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapterImpl.java1
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateResources.groovy5
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy283
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy35
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java2
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/dmaap/DmaapClient.java (renamed from bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/implementation/DmaapClient.java)2
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/dmaap/PnfEventReadyConsumer.java49
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java4
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVcpeResCustServiceV2.bpmn4
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoUpdateE2EServiceInstance.bpmn118
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/webapp/WEB-INF/applicationContext.xml1
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java2
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/dmaap/PnfEventReadyConsumerTest.java7
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java10
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java8
-rw-r--r--mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/RequestsDatabaseTest.java5
16 files changed, 261 insertions, 275 deletions
diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapterImpl.java b/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapterImpl.java
index 925086a9d3..3dcf69c815 100644
--- a/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapterImpl.java
+++ b/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapterImpl.java
@@ -311,6 +311,7 @@ public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter {
operStatus.setOperation(operationType);
operStatus.setReason(reason);
operStatus.setProgress(progress);
+ operStatus.setResult(result);
operStatus.setOperationContent(operationContent);
RequestsDatabase.getInstance().updateOperationStatus(operStatus);
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateResources.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateResources.groovy
index d9080b8942..7ccc1b0046 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateResources.groovy
+++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateResources.groovy
@@ -218,7 +218,10 @@ public class DoCreateResources extends AbstractServiceTaskProcessor
String serviceInstanceId = execution.getVariable("serviceInstanceId")
String serviceType = execution.getVariable("serviceType")
ResourceInput resourceInput = execution.getVariable("resourceInput")
- String requestAction = resourceInput.getOperationType()
+
+ // requestAction is action, not opertiontype
+ //String requestAction = resourceInput.getOperationType()
+ String requestAction = "createInstance"
JSONObject resourceRecipe = cutils.getResourceRecipe(execution, resourceInput.getResourceModelInfo().getModelUuid(), requestAction)
String recipeURL = BPMNProperties.getProperty("bpelURL", "http://mso:8080") + resourceRecipe.getString("orchestrationUri")
int recipeTimeOut = resourceRecipe.getInt("recipeTimeout")
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 44e3b73697..9540508075 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
@@ -22,6 +22,7 @@ package org.openecomp.mso.bpmn.infrastructure.scripts;
import static org.apache.commons.lang3.StringUtils.*;
import groovy.xml.XmlUtil
import groovy.json.*
+import groovy.util.XmlParser
import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition
import org.openecomp.mso.bpmn.core.domain.ServiceInstance
@@ -50,11 +51,7 @@ import org.apache.commons.lang3.*
import org.apache.commons.codec.binary.Base64;
import org.springframework.web.util.UriUtils;
-import org.w3c.dom.Document
-import org.w3c.dom.Element
-import org.w3c.dom.Node
-import org.w3c.dom.NodeList
-import org.xml.sax.InputSource
+
/**
* This groovy class supports the <class>DoUpdateE2EServiceInstance.bpmn</class> process.
*
@@ -89,18 +86,12 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor {
JsonUtils jsonUtil = new JsonUtils()
public void preProcessRequest (DelegateExecution execution) {
- //only for dug
- execution.setVariable("isDebugLogEnabled","true")
- execution.setVariable("unit_test", "true")
- execution.setVariable("skipVFC", "true")
-
- def method = getClass().getSimpleName() + '.preProcessRequest(' +'execution=' + execution.getId() +')'
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+
+ def method = getClass().getSimpleName() + '.preProcessRequest(' +'execution=' + execution.getId() +')'
utils.log("INFO","Entered " + method, isDebugEnabled)
String msg = ""
utils.log("INFO"," ***** Enter DoUpdateE2EServiceInstance preProcessRequest *****", isDebugEnabled)
-
- utils.log("INFO"," unit test : " + execution.getVariable("unit_test"), isDebugEnabled)
try {
execution.setVariable("prefix", Prefix)
@@ -139,89 +130,28 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor {
if (productFamilyId == null) {
execution.setVariable("productFamilyId", "")
}
-
- String sdncCallbackUrl = execution.getVariable('URN_mso_workflow_sdncadapter_callback')
- if (isBlank(sdncCallbackUrl)) {
- msg = "URN_mso_workflow_sdncadapter_callback is null"
- utils.log("INFO", msg, isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
- }
- execution.setVariable("sdncCallbackUrl", sdncCallbackUrl)
- utils.log("INFO","SDNC Callback URL: " + sdncCallbackUrl, isDebugEnabled)
- //requestDetails.modelInfo.for AAI PUT servieInstanceData
- //requestDetails.requestInfo. for AAI GET/PUT serviceInstanceData
String serviceInstanceName = execution.getVariable("serviceInstanceName")
- //String serviceInstanceId = execution.getVariable("serviceInstanceId")
String uuiRequest = execution.getVariable("uuiRequest")
utils.log("INFO","uuiRequest: " + uuiRequest, isDebugEnabled)
- String modelInvariantUuid = jsonUtil.getJsonValue(uuiRequest, "service.serviceDefId")
+ String modelInvariantUuid = jsonUtil.getJsonValue(uuiRequest, "service.serviceInvariantUuid")
utils.log("INFO","modelInvariantUuid: " + modelInvariantUuid, isDebugEnabled)
+ execution.setVariable("modelInvariantUuid", modelInvariantUuid)
+ execution.setVariable("model-invariant-id-target", modelInvariantUuid)
- String modelUuid = jsonUtil.getJsonValue(uuiRequest, "service.templateId")
+ String modelUuid = jsonUtil.getJsonValue(uuiRequest, "service.serviceUuid")
utils.log("INFO","modelUuid: " + modelUuid, isDebugEnabled)
+ execution.setVariable("modelUuid", modelUuid)
+ execution.setVariable("model-version-id-target", modelUuid)
String serviceModelName = jsonUtil.getJsonValue(uuiRequest, "service.parameters.templateName")
utils.log("INFO","serviceModelName: " + serviceModelName, isDebugEnabled)
- execution.setVariable("serviceModelName", serviceModelName)
-
- //aai serviceType and Role can be setted as fixed value now.
- String aaiServiceType = serviceType
- String aaiServiceRole = serviceType+"Role"
-
- execution.setVariable("modelInvariantUuid", modelInvariantUuid)
- execution.setVariable("model-invariant-id-target", modelInvariantUuid)
- execution.setVariable("modelUuid", modelUuid)
- execution.setVariable("model-version-id-target", modelUuid)
-
- //AAI PUT
- String oStatus = execution.getVariable("initialStatus") ?: ""
- utils.log("INFO","oStatus: " + oStatus, isDebugEnabled)
- if ("TRANSPORT".equalsIgnoreCase(serviceType))
- {
- oStatus = "Update"
+ if(serviceModelName == null) {
+ serviceModelName = ""
}
-
- String statusLine = isBlank(oStatus) ? "" : "<orchestration-status>${oStatus}</orchestration-status>"
- utils.log("INFO","statusLine: " + statusLine, isDebugEnabled)
- AaiUtil aaiUriUtil = new AaiUtil(this)
- utils.log("INFO","start create aai uri: " + aaiUriUtil, isDebugEnabled)
- String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution)
- utils.log("INFO","aai_uri: " + aai_uri, isDebugEnabled)
- String namespace = aaiUriUtil.getNamespaceFromUri(aai_uri)
- utils.log("INFO","namespace: " + namespace, isDebugEnabled)
- /*
- String serviceInstanceData =
- """<service-instance xmlns=\"${namespace}\">
- <service-instance-id>${serviceInstanceId}</service-instance-id>
- <service-instance-name>${serviceInstanceName}</service-instance-name>
- <service-type>${aaiServiceType}</service-type>
- <service-role>${aaiServiceRole}</service-role>
- ${statusLine}
- <model-invariant-id>${modelInvariantUuid}</model-invariant-id>
- <model-version-id>${modelUuid}</model-version-id>
- </service-instance>""".trim()
- */
- //begin only for test
- String serviceInstanceData =
- """<service-instance xmlns=\"${namespace}\">
- <service-instance-id>${serviceInstanceId}</service-instance-id>
- <service-instance-name>${serviceInstanceName}</service-instance-name>
- <service-type>${aaiServiceType}</service-type>
- <service-role>${aaiServiceRole}</service-role>
- ${statusLine}
- </service-instance>""".trim()
- //end only for test
- execution.setVariable("serviceInstanceData", serviceInstanceData)
- utils.log("INFO","serviceInstanceData: " + serviceInstanceData, isDebugEnabled)
- utils.logAudit(serviceInstanceData)
- utils.log("INFO", " aai_uri " + aai_uri + " namespace:" + namespace, isDebugEnabled)
- utils.log("INFO", " 'payload' to create Service Instance in AAI - " + "\n" + serviceInstanceData, isDebugEnabled)
-
- execution.setVariable("serviceSDNCCreate", "false")
- execution.setVariable("operationStatus", "Waiting deploy resource...")
-
+ execution.setVariable("serviceModelName", serviceModelName)
+
} catch (BpmnError e) {
throw e;
} catch (Exception ex){
@@ -253,101 +183,38 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor {
utils.log("INFO", msg, isDebugEnabled)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
- else
- {
- utils.log("INFO", "SI Data" + siData, isDebugEnabled)
-
- InputSource source = new InputSource(new StringReader(siData));
- DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
- DocumentBuilder docBuilder = docFactory.newDocumentBuilder()
- Document serviceXml = docBuilder.parse(source)
- serviceXml.getDocumentElement().normalize()
-
- // Get Template uuid and version
- if (utils.nodeExists(siData, "model-invariant-id") && utils.nodeExists(siData, "model-version-id") ) {
- utils.log("INFO", "SI Data model-invariant-id and model-version-id exist:", isDebugEnabled)
- def modelInvariantId = serviceXml.getElementsByTagName("model-invariant-id").item(0).getTextContent()
- def modelVersionId = serviceXml.getElementsByTagName("model-version-id").item(0).getTextContent()
-
- // Set Original Template info
- execution.setVariable("model-invariant-id-original", modelInvariantId)
- execution.setVariable("model-version-id-original", modelVersionId)
- }
-
- //Confirm there are no related service instances (vnf/network or volume)
- if (utils.nodeExists(siData, "relationship-list")) {
- utils.log("INFO", "SI Data relationship-list exists:", isDebugEnabled)
-
- //test(siData)
- NodeList nodeList = serviceXml.getElementsByTagName("relationship")
- JSONArray jArray = new JSONArray()
- for (int x = 0; x < nodeList.getLength(); x++) {
- Node node = nodeList.item(x)
- if (node.getNodeType() == Node.ELEMENT_NODE) {
- Element eElement = (Element) node
- def e = eElement.getElementsByTagName("related-to").item(0).getTextContent() //for ns
- if(e.equals("service-instance")){
- def relatedObject = eElement.getElementsByTagName("related-link").item(0).getTextContent()
- utils.log("INFO", "ServiceInstance Related NS :" + relatedObject, isDebugEnabled)
- NodeList dataList = node.getChildNodes()
- if(null != dataList) {
- JSONObject jObj = new JSONObject()
- for (int i = 0; i < dataList.getLength(); i++) {
- Node dNode = dataList.item(i)
- if(dNode.getNodeName() == "relationship-data") {
- Element rDataEle = (Element)dNode
- def eKey = rDataEle.getElementsByTagName("relationship-key").item(0).getTextContent()
- def eValue = rDataEle.getElementsByTagName("relationship-value").item(0).getTextContent()
- if(eKey.equals("service-instance.service-instance-id")){
- jObj.put("resourceInstanceId", eValue)
- }
- }
- else if(dNode.getNodeName() == "related-to-property"){
- Element rDataEle = (Element)dNode
- def eKey = rDataEle.getElementsByTagName("property-key").item(0).getTextContent()
- def eValue = rDataEle.getElementsByTagName("property-value").item(0).getTextContent()
- if(eKey.equals("service-instance.service-instance-name")){
- jObj.put("resourceType", eValue)
- }
- }
- }
- utils.log("INFO", "Relationship related to Resource:" + jObj.toString(), isDebugEnabled)
- jArray.put(jObj)
- }
- //for overlay/underlay
- }else if (e.equals("configuration")){
- def relatedObject = eElement.getElementsByTagName("related-link").item(0).getTextContent()
- utils.log("INFO", "ServiceInstance Related Configuration :" + relatedObject, isDebugEnabled)
- NodeList dataList = node.getChildNodes()
- if(null != dataList) {
- JSONObject jObj = new JSONObject()
- for (int i = 0; i < dataList.getLength(); i++) {
- Node dNode = dataList.item(i)
- if(dNode.getNodeName() == "relationship-data") {
- Element rDataEle = (Element)dNode
- def eKey = rDataEle.getElementsByTagName("relationship-key").item(0).getTextContent()
- def eValue = rDataEle.getElementsByTagName("relationship-value").item(0).getTextContent()
- if(eKey.equals("configuration.configuration-id")){
- jObj.put("resourceInstanceId", eValue)
- }
- }
- else if(dNode.getNodeName() == "related-to-property"){
- Element rDataEle = (Element)dNode
- def eKey = rDataEle.getElementsByTagName("property-key").item(0).getTextContent()
- def eValue = rDataEle.getElementsByTagName("property-value").item(0).getTextContent()
- if(eKey.equals("configuration.configuration-type")){
- jObj.put("resourceType", eValue)
- }
- }
- }
- utils.log("INFO", "Relationship related to Resource:" + jObj.toString(), isDebugEnabled)
- jArray.put(jObj)
- }
- }
- }
- }
- execution.setVariable("serviceRelationShip", jArray.toString())
+
+ utils.log("INFO", "SI Data" + siData, isDebugEnabled)
+
+ // Get Template uuid and version
+ if (utils.nodeExists(siData, "model-invariant-id") && utils.nodeExists(siData, "model-version-id") ) {
+ utils.log("INFO", "SI Data model-invariant-id and model-version-id exist:", isDebugEnabled)
+
+ def modelInvariantId = utils.getNodeText1(siData, "model-invariant-id")
+ def modelVersionId = utils.getNodeText1(siData, "model-version-id")
+
+ // Set Original Template info
+ execution.setVariable("model-invariant-id-original", modelInvariantId)
+ execution.setVariable("model-version-id-original", modelVersionId)
+ }
+
+ //get related service instances (vnf/network or volume) for delete
+ if (utils.nodeExists(siData, "relationship-list")) {
+ utils.log("INFO", "SI Data relationship-list exists:", isDebugEnabled)
+
+ JSONArray jArray = new JSONArray()
+
+ XmlParser xmlParser = new XmlParser()
+ Node root = xmlParser.parseText(siData)
+ def relation_list = utils.getChildNode(root, 'relationship-list')
+ def relationships = utils.getIdenticalChildren(relation_list, 'relationship')
+
+ for (def relation: relationships) {
+ def jObj = getRelationShipData(relation, isDebugEnabled)
+ jArray.put(jObj)
}
+
+ execution.setVariable("serviceRelationShip", jArray.toString())
}
}else{
boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator")
@@ -378,6 +245,42 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor {
utils.log("INFO"," *** Exit postProcessAAIGET *** ", isDebugEnabled)
}
+ private JSONObject getRelationShipData(node, isDebugEnabled){
+ JSONObject jObj = new JSONObject()
+
+ def relation = utils.nodeToString(node)
+ def rt = utils.getNodeText1(relation, "related-to")
+
+ def rl = utils.getNodeText1(relation, "related-link")
+ utils.log("INFO", "ServiceInstance Related NS/Configuration :" + rl, isDebugEnabled)
+
+ def rl_datas = utils.getIdenticalChildren(node, "relationship-data")
+ for(def rl_data : rl_datas) {
+ def eKey = utils.getChildNodeText(rl_data, "relationship-key")
+ def eValue = utils.getChildNodeText(rl_data, "relationship-value")
+
+ if ((rt == "service-instance" && eKey.equals("service-instance.service-instance-id"))
+ //for overlay/underlay
+ || (rt == "configuration" && eKey.equals("configuration.configuration-id"))){
+ jObj.put("resourceInstanceId", eValue)
+ }
+ }
+
+ def rl_props = utils.getIdenticalChildren(node, "related-to-property")
+ for(def rl_prop : rl_props) {
+ def eKey = utils.getChildNodeText(rl_prop, "property-key")
+ def eValue = utils.getChildNodeText(rl_prop, "property-value")
+ if((rt == "service-instance" && eKey.equals("service-instance.service-instance-name"))
+ //for overlay/underlay
+ || (rt == "configuration" && eKey.equals("configuration.configuration-type"))){
+ jObj.put("resourceType", eValue)
+ }
+ }
+
+ utils.log("INFO", "Relationship related to Resource:" + jObj.toString(), isDebugEnabled)
+
+ return jObj
+ }
public void preInitResourcesOperStatus(DelegateExecution execution){
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
@@ -400,7 +303,7 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor {
List<Resource> resourceList = new ArrayList<String>()
List<Resource> addResourceList = execution.getVariable("addResourceList")
- List<Resource> delResourceList = execution.setVariable("delResourceList")
+ List<Resource> delResourceList = execution.getVariable("delResourceList")
resourceList.addAll(addResourceList)
resourceList.addAll(delResourceList)
for(Resource resource : resourceList){
@@ -520,27 +423,39 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor {
public void preProcessForAddResource(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
-
+ utils.log("INFO"," ***** preProcessForAddResource ***** ", isDebugEnabled)
+
+ execution.setVariable("operationType", "create")
+
+ utils.log("INFO"," *** Exit preProcessForAddResource *** ", isDebugEnabled)
}
public void postProcessForAddResource(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
utils.log("INFO"," ***** postProcessForAddResource ***** ", isDebugEnabled)
- ServiceDecomposition serviceDecomposition_Target = execution.getVariable("serviceDecomposition_Target")
- execution.setVariable("serviceDecomposition", serviceDecomposition_Target)
-
+ execution.setVariable("operationType", "update")
+
utils.log("INFO"," *** Exit postProcessForAddResource *** ", isDebugEnabled)
}
public void preProcessForDeleteResource(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ utils.log("INFO"," ***** preProcessForDeleteResource ***** ", isDebugEnabled)
+
+ execution.setVariable("operationType", "delete")
+
+ utils.log("INFO"," *** Exit preProcessForDeleteResource *** ", isDebugEnabled)
}
public void postProcessForDeleteResource(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
-
+ utils.log("INFO"," ***** postProcessForDeleteResource ***** ", isDebugEnabled)
+
+ execution.setVariable("operationType", "update")
+
+ utils.log("INFO"," *** Exit postProcessForDeleteResource *** ", isDebugEnabled)
}
public void preProcessAAIGET2(DelegateExecution execution) {
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy
index 240b8d089b..adea23aa19 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy
+++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy
@@ -109,8 +109,8 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor
utils.log("INFO", "uuiRequest:\n" + uuiRequest, isDebugEnabled)
- //requestParameters
- String serviceType = jsonUtil.getJsonValue(uuiRequest, "service.parameters.serviceType")
+ //serviceType for aai
+ String serviceType = jsonUtil.getJsonValue(uuiRequest, "service.serviceType")
if (isBlank(serviceType)) {
msg = "Input serviceType is null"
utils.log("INFO", msg, isDebugEnabled)
@@ -119,6 +119,29 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor
execution.setVariable("serviceType", serviceType)
}
+ /*
+ * Extracting User Parameters from incoming Request and converting into a Map
+ */
+ def jsonSlurper = new JsonSlurper()
+ def jsonOutput = new JsonOutput()
+
+ Map reqMap = jsonSlurper.parseText(siRequest)
+
+ //InputParams
+ def userParamsList = reqMap.requestDetails?.requestParameters?.userParams
+
+ Map<String, String> inputMap = [:]
+ if (userParamsList) {
+ for (def i=0; i<userParamsList.size(); i++) {
+ def userParams1 = userParamsList.get(i)
+ userParams1.each { param -> inputMap.put(param.key, param.value)}
+ }
+ }
+
+ utils.log("DEBUG", "User Input Parameters map: " + inputMap.toString(), isDebugEnabled)
+ execution.setVariable("serviceInputParams", inputMap)
+ execution.setVariable("uuiRequest", inputMap.get("UUIRequest"))
+
//operationId
String operationId = jsonUtil.getJsonValue(siRequest, "operationId")
if (isBlank(operationId)) {
@@ -147,7 +170,7 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor
utils.log("DEBUG", " ======== STARTED prepareInitServiceOperationStatus Process ======== ", isDebugEnabled)
try{
String serviceId = execution.getVariable("serviceInstanceId")
- String operationId = UUID.randomUUID().toString()
+ String operationId = execution.getVariable("operationId")
String operationType = execution.getVariable("operationType")
String userId = ""
String result = "processing"
@@ -202,9 +225,9 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor
String operationId = execution.getVariable("operationId")
String serviceInstanceId = execution.getVariable("serviceInstanceId")
// RESTResponse for API Handler (APIH) Reply Task
- String updateServiceRestRequest = """{"service":{"serviceId":"${serviceInstanceId}","operationId":"${operationId}"}}""".trim()
- utils.log("INFO", " sendSyncResponse to APIH:" + "\n" + updateServiceRestRequest, isDebugEnabled)
- sendWorkflowResponse(execution, 202, updateServiceRestRequest)
+ String updateServiceResp = """{"operationId":"${operationId}"}""".trim()
+ utils.log("INFO", " sendSyncResponse to APIH:" + "\n" + updateServiceResp, isDebugEnabled)
+ sendWorkflowResponse(execution, 202, updateServiceResp)
execution.setVariable("sentSyncResponse", true)
} catch (Exception ex) {
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java
index 5a8d741a05..edff36fe68 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java
+++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java
@@ -22,7 +22,7 @@ package org.openecomp.mso.bpmn.infrastructure.pnf.delegate;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.JavaDelegate;
-import org.openecomp.mso.bpmn.infrastructure.pnf.implementation.DmaapClient;
+import org.openecomp.mso.bpmn.infrastructure.pnf.dmaap.DmaapClient;
import org.springframework.beans.factory.annotation.Autowired;
public class InformDmaapClient implements JavaDelegate {
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/implementation/DmaapClient.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/dmaap/DmaapClient.java
index 07e8ada21e..c6b6be6842 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/implementation/DmaapClient.java
+++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/dmaap/DmaapClient.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.bpmn.infrastructure.pnf.implementation;
+package org.openecomp.mso.bpmn.infrastructure.pnf.dmaap;
public interface DmaapClient {
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/dmaap/PnfEventReadyConsumer.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/dmaap/PnfEventReadyConsumer.java
index 6871665ba1..8c9903e87a 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/dmaap/PnfEventReadyConsumer.java
+++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/dmaap/PnfEventReadyConsumer.java
@@ -20,6 +20,7 @@
package org.openecomp.mso.bpmn.infrastructure.pnf.dmaap;
+import com.google.common.annotations.VisibleForTesting;
import java.io.IOException;
import java.net.URI;
import java.util.Map;
@@ -34,11 +35,10 @@ import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.util.EntityUtils;
-import org.openecomp.mso.bpmn.infrastructure.pnf.implementation.DmaapClient;
import org.openecomp.mso.jsonpath.JsonPathUtil;
import org.openecomp.mso.logger.MsoLogger;
-public class PnfEventReadyConsumer implements Runnable, DmaapClient {
+public class PnfEventReadyConsumer implements DmaapClient {
private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA);
@@ -54,9 +54,8 @@ public class PnfEventReadyConsumer implements Runnable, DmaapClient {
private Map<String, Runnable> pnfCorrelationIdToThreadMap;
private HttpGet getRequest;
private ScheduledExecutorService executor;
- private int dmaapClientInitialDelayInSeconds;
private int dmaapClientDelayInSeconds;
- private boolean dmaapThreadListenerIsRunning;
+ private volatile boolean dmaapThreadListenerIsRunning;
public PnfEventReadyConsumer() {
httpClient = HttpClientBuilder.create().build();
@@ -68,8 +67,9 @@ public class PnfEventReadyConsumer implements Runnable, DmaapClient {
getRequest = new HttpGet(buildURI());
}
- @Override
- public void run() {
+ //TODO: extract this logic to separate class and test it there to avoid using VisibleForTesting
+ @VisibleForTesting
+ void sendRequest() {
try {
HttpResponse response = httpClient.execute(getRequest);
getCorrelationIdFromResponse(response).ifPresent(this::informAboutPnfReadyIfCorrelationIdFound);
@@ -79,21 +79,23 @@ public class PnfEventReadyConsumer implements Runnable, DmaapClient {
}
@Override
- public void registerForUpdate(String correlationId, Runnable informConsumer) {
+ public synchronized void registerForUpdate(String correlationId, Runnable informConsumer) {
pnfCorrelationIdToThreadMap.put(correlationId, informConsumer);
if (!dmaapThreadListenerIsRunning) {
startDmaapThreadListener();
}
}
- private void startDmaapThreadListener() {
- executor = Executors.newScheduledThreadPool(1);
- executor.scheduleWithFixedDelay(this, dmaapClientInitialDelayInSeconds,
- dmaapClientDelayInSeconds, TimeUnit.SECONDS);
- dmaapThreadListenerIsRunning = true;
+ private synchronized void startDmaapThreadListener() {
+ if (!dmaapThreadListenerIsRunning) {
+ executor = Executors.newScheduledThreadPool(1);
+ executor.scheduleWithFixedDelay(this::sendRequest, 0,
+ dmaapClientDelayInSeconds, TimeUnit.SECONDS);
+ dmaapThreadListenerIsRunning = true;
+ }
}
- private void stopDmaapThreadListener() {
+ private synchronized void stopDmaapThreadListener() {
if (dmaapThreadListenerIsRunning) {
executor.shutdownNow();
dmaapThreadListenerIsRunning = false;
@@ -120,17 +122,14 @@ public class PnfEventReadyConsumer implements Runnable, DmaapClient {
}
- private void informAboutPnfReadyIfCorrelationIdFound(String correlationId) {
- pnfCorrelationIdToThreadMap.keySet().stream().filter(key -> key.equals(correlationId)).findAny()
- .ifPresent(this::informAboutPnfReady);
- }
-
- private void informAboutPnfReady(String correlationId) {
- pnfCorrelationIdToThreadMap.get(correlationId).run();
- pnfCorrelationIdToThreadMap.remove(correlationId);
+ private synchronized void informAboutPnfReadyIfCorrelationIdFound(String correlationId) {
+ Runnable runnable = pnfCorrelationIdToThreadMap.remove(correlationId);
+ if (runnable != null) {
+ runnable.run();
- if (pnfCorrelationIdToThreadMap.isEmpty()) {
- stopDmaapThreadListener();
+ if (pnfCorrelationIdToThreadMap.isEmpty()) {
+ stopDmaapThreadListener();
+ }
}
}
@@ -162,10 +161,6 @@ public class PnfEventReadyConsumer implements Runnable, DmaapClient {
this.consumerGroup = consumerGroup;
}
- public void setDmaapClientInitialDelayInSeconds(int dmaapClientInitialDelayInSeconds) {
- this.dmaapClientInitialDelayInSeconds = dmaapClientInitialDelayInSeconds;
- }
-
public void setDmaapClientDelayInSeconds(int dmaapClientDelayInSeconds) {
this.dmaapClientDelayInSeconds = dmaapClientDelayInSeconds;
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java
index 3a8b6b9036..0aeb0c6310 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java
+++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/AbstractSdncOperationTask.java
@@ -255,7 +255,9 @@ public abstract class AbstractSdncOperationTask extends BaseTask {
serviceId = StringUtils.isBlank(serviceId) ? (String) execution.getVariable("serviceInstanceId") : serviceId;
String operationId = (String) execution.getVariable("operationId");
String resourceTemplateUUID = (String) execution.getVariable("resourceUUID");
- resourceTemplateUUID = StringUtils.isBlank(resourceTemplateUUID) ? (String) execution.getVariable("resourceTemplateId") : resourceTemplateUUID;
+ String resourceTemplateId = (String) execution.getVariable("resourceTemplateId");
+ resourceTemplateId = StringUtils.isBlank(resourceTemplateId) ? "" : resourceTemplateUUID;
+ resourceTemplateUUID = StringUtils.isBlank(resourceTemplateUUID) ? resourceTemplateId : resourceTemplateUUID;
try {
ResourceOperationStatus resourceOperationStatus = getResourceOperationStatus(serviceId, operationId, resourceTemplateUUID);
if (!StringUtils.isBlank(status)) {
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVcpeResCustServiceV2.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVcpeResCustServiceV2.bpmn
index b23d1c6b8f..a3e63fa14e 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVcpeResCustServiceV2.bpmn
+++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVcpeResCustServiceV2.bpmn
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.11.3" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
- <bpmn2:process id="CreateVcpeResCustService" name="CreateVcpeResCustService" isExecutable="true">
+ <bpmn2:process id="CreateVcpeResCustServiceV2" name="CreateVcpeResCustServiceV2" isExecutable="true">
<bpmn2:scriptTask id="sendSyncAckResponse_ScriptTask" name="Send Sync Ack Response" scriptFormat="groovy">
<bpmn2:incoming>SequenceFlow_7</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_3</bpmn2:outgoing>
@@ -592,7 +592,7 @@ CreateVcpeResCustService.validateVnfCreate(execution)]]></bpmn2:script>
<bpmn2:error id="Error_2" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
<bpmn2:error id="Error_1" name="java.lang.Exception" errorCode="java.lang.Exception" />
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
- <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="CreateVcpeResCustService">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="CreateVcpeResCustServiceV2">
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_47" bpmnElement="createVCPE_startEvent">
<dc:Bounds x="87" y="215" width="36" height="36" />
<bpmndi:BPMNLabel>
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoUpdateE2EServiceInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoUpdateE2EServiceInstance.bpmn
index 86b422632f..7735b192dc 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoUpdateE2EServiceInstance.bpmn
+++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoUpdateE2EServiceInstance.bpmn
@@ -30,16 +30,18 @@ csi.preProcessForAddResource(execution)]]></bpmn2:script>
</bpmn2:scriptTask>
<bpmn2:callActivity id="Task_1wyyy33" name="Call DoCreateResources" calledElement="DoCreateResources">
<bpmn2:extensionElements>
- <camunda:in source="nsServiceName" target="nsServiceName" />
- <camunda:in source="nsServiceDescription" target="nsServiceDescription" />
+ <camunda:in source="serviceInstanceName" target="serviceInstanceName" />
+ <camunda:in source="serviceDescription" target="nsServiceDescription" />
+ <camunda:in source="serviceInstanceId" target="serviceInstanceId" />
<camunda:in source="globalSubscriberId" target="globalSubscriberId" />
<camunda:in source="serviceType" target="serviceType" />
- <camunda:in source="serviceId" target="serviceId" />
+ <camunda:in source="msoRequestId" target="msoRequestId" />
<camunda:in source="operationId" target="operationId" />
<camunda:in source="resourceType" target="resourceType" />
- <camunda:in source="resourceUUID" target="resourceUUID" />
- <camunda:in source="resourceParameters" target="resourceParameters" />
+ <camunda:in source="uuiRequest" target="uuiRequest" />
+ <camunda:in source="serviceDecomposition_Target" target="serviceDecomposition" />
<camunda:in source="operationType" target="operationType" />
+ <camunda:in source="addResourceList" target="addResourceList" />
</bpmn2:extensionElements>
<bpmn2:incoming>SequenceFlow_0yztz2p</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_0lblyhi</bpmn2:outgoing>
@@ -71,16 +73,16 @@ csi.preProcessForDeleteResource(execution)]]></bpmn2:script>
</bpmn2:scriptTask>
<bpmn2:callActivity id="CallActivity_0yphqzk" name="Call DoDeleteResources" calledElement="DoDeleteResources">
<bpmn2:extensionElements>
- <camunda:in source="nsServiceName" target="nsServiceName" />
- <camunda:in source="nsServiceDescription" target="nsServiceDescription" />
+ <camunda:in source="serviceInstanceName" target="serviceInstanceName" />
+ <camunda:in source="serviceInstanceId" target="serviceInstanceId" />
<camunda:in source="globalSubscriberId" target="globalSubscriberId" />
<camunda:in source="serviceType" target="serviceType" />
<camunda:in source="serviceId" target="serviceId" />
<camunda:in source="operationId" target="operationId" />
- <camunda:in source="resourceType" target="resourceType" />
- <camunda:in source="resourceUUID" target="resourceUUID" />
- <camunda:in source="resourceParameters" target="resourceParameters" />
+ <camunda:in source="serviceDecomposition_Original" target="serviceDecomposition" />
<camunda:in source="operationType" target="operationType" />
+ <camunda:in source="delResourceList" target="delResourceList" />
+ <camunda:in source="serviceRelationShip" target="serviceRelationShip" />
</bpmn2:extensionElements>
<bpmn2:incoming>SequenceFlow_14rubz2</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_0tm9bw9</bpmn2:outgoing>
@@ -121,6 +123,18 @@ ddsi.preCompareModelVersions(execution)]]></bpmn2:script>
<bpmn2:sequenceFlow id="SequenceFlow_1vtlt1v" sourceRef="IntermediateCatchEvent_0gk8ige" targetRef="ScriptTask_1afvv50" />
<bpmn2:sequenceFlow id="SequenceFlow_0h40pn8" sourceRef="ScriptTask_1afvv50" targetRef="ServiceTask_02u5iza" />
<bpmn2:callActivity id="ServiceTask_02u5iza" name="Call DoCompareModelVersions" calledElement="DoCompareModelVersions">
+ <bpmn2:extensionElements>
+ <camunda:in source="msoRequestId" target="msoRequestId" />
+ <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" />
+ <camunda:in source="model-invariant-id-target" target="model-invariant-id-target" />
+ <camunda:in source="model-version-id-target" target="model-version-id-target" />
+ <camunda:in source="model-invariant-id-original" target="model-invariant-id-original" />
+ <camunda:in source="model-version-id-original" target="model-version-id-original" />
+ <camunda:out source="serviceDecomposition_Target" target="serviceDecomposition_Target" />
+ <camunda:out source="serviceDecomposition_Original" target="serviceDecomposition_Original" />
+ <camunda:out source="addResourceList" target="addResourceList" />
+ <camunda:out source="delResourceList" target="delResourceList" />
+ </bpmn2:extensionElements>
<bpmn2:incoming>SequenceFlow_0h40pn8</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_02d5ibj</bpmn2:outgoing>
</bpmn2:callActivity>
@@ -284,17 +298,6 @@ ddsi.preUpdateServiceOperationStatus(execution)]]></bpmn2:script>
<bpmn2:endEvent id="EndEvent_014jyvb">
<bpmn2:incoming>SequenceFlow_02znk15</bpmn2:incoming>
</bpmn2:endEvent>
- <bpmn2:callActivity id="CallActivity_1lu6rx0" name="Call DoUpdateE2EServiceInstanceRollback" calledElement="DoUpdateE2EServiceInstanceRollback">
- <bpmn2:extensionElements>
- <camunda:in source="msoRequestId" target="mso-request-id" />
- <camunda:in source="rollbackData" target="rollbackData" />
- <camunda:out source="rolledBack" target="rolledBack" />
- <camunda:in source="disableRollback" target="disableRollback" />
- <camunda:out source="rollbackError" target="rollbackErrror" />
- </bpmn2:extensionElements>
- <bpmn2:incoming>SequenceFlow_19ly8h7</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_0jsdqmq</bpmn2:outgoing>
- </bpmn2:callActivity>
<bpmn2:scriptTask id="ScriptTask_1awrp72" name="Pre Process Rollback" scriptFormat="groovy">
<bpmn2:incoming>SequenceFlow_05j3sat</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_19ly8h7</bpmn2:outgoing>
@@ -304,7 +307,7 @@ dcsi.preProcessRollback(execution)
]]></bpmn2:script>
</bpmn2:scriptTask>
<bpmn2:scriptTask id="ScriptTask_0vc9jgo" name="Post Process Rollback" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_0jsdqmq</bpmn2:incoming>
+ <bpmn2:incoming>SequenceFlow_0utvwkh</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_02znk15</bpmn2:outgoing>
<bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
def dcsi = new DoCreateResources()
@@ -313,8 +316,39 @@ dcsi.postProcessRollback(execution)
</bpmn2:scriptTask>
<bpmn2:sequenceFlow id="SequenceFlow_05j3sat" sourceRef="StartEvent_06768u3" targetRef="ScriptTask_1awrp72" />
<bpmn2:sequenceFlow id="SequenceFlow_02znk15" sourceRef="ScriptTask_0vc9jgo" targetRef="EndEvent_014jyvb" />
- <bpmn2:sequenceFlow id="SequenceFlow_19ly8h7" sourceRef="ScriptTask_1awrp72" targetRef="CallActivity_1lu6rx0" />
- <bpmn2:sequenceFlow id="SequenceFlow_0jsdqmq" sourceRef="CallActivity_1lu6rx0" targetRef="ScriptTask_0vc9jgo" />
+ <bpmn2:sequenceFlow id="SequenceFlow_19ly8h7" sourceRef="ScriptTask_1awrp72" targetRef="ScriptTask_1bb9adn" />
+ <bpmn2:serviceTask id="ServiceTask_1kw189j" name="Update Service Oper Status">
+ <bpmn2:extensionElements>
+ <camunda:connector>
+ <camunda:inputOutput>
+ <camunda:inputParameter name="url">${URN_mso_openecomp_adapters_db_endpoint}</camunda:inputParameter>
+ <camunda:inputParameter name="headers">
+ <camunda:map>
+ <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+ <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry>
+ </camunda:map>
+ </camunda:inputParameter>
+ <camunda:inputParameter name="payload">${CVFMI_updateServiceOperStatusRequest}</camunda:inputParameter>
+ <camunda:inputParameter name="method">POST</camunda:inputParameter>
+ <camunda:outputParameter name="CVFMI_dbResponseCode">${statusCode}</camunda:outputParameter>
+ <camunda:outputParameter name="CVFMI_dbResponse">${response}</camunda:outputParameter>
+ </camunda:inputOutput>
+ <camunda:connectorId>http-connector</camunda:connectorId>
+ </camunda:connector>
+ </bpmn2:extensionElements>
+ <bpmn2:incoming>SequenceFlow_1lqzi94</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_0utvwkh</bpmn2:outgoing>
+ </bpmn2:serviceTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_0utvwkh" sourceRef="ServiceTask_1kw189j" targetRef="ScriptTask_0vc9jgo" />
+ <bpmn2:scriptTask id="ScriptTask_1bb9adn" name="Prepare Update Service Oper Status(error)" scriptFormat="groovy">
+ <bpmn2:incoming>SequenceFlow_19ly8h7</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_1lqzi94</bpmn2:outgoing>
+ <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
+execution.setVariable("operationStatus", "error")
+def ddsi = new DoUpdateE2EServiceInstance()
+ddsi.preUpdateServiceOperationStatus(execution)]]></bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_1lqzi94" sourceRef="ScriptTask_1bb9adn" targetRef="ServiceTask_1kw189j" />
</bpmn2:subProcess>
<bpmn2:scriptTask id="ScriptTask_195nptq" name="Pre Process AAI GET 2" scriptFormat="groovy">
<bpmn2:incoming>SequenceFlow_1demy08</bpmn2:incoming>
@@ -700,9 +734,6 @@ dcsi.preProcessAAIPUT(execution)]]></bpmn2:script>
<dc:Bounds x="1554" y="1936" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="CallActivity_1lu6rx0_di" bpmnElement="CallActivity_1lu6rx0">
- <dc:Bounds x="923" y="1873" width="100" height="80" />
- </bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ScriptTask_1awrp72_di" bpmnElement="ScriptTask_1awrp72">
<dc:Bounds x="557" y="1873" width="100" height="80" />
</bpmndi:BPMNShape>
@@ -713,7 +744,7 @@ dcsi.preProcessAAIPUT(execution)]]></bpmn2:script>
<di:waypoint xsi:type="dc:Point" x="302" y="1913" />
<di:waypoint xsi:type="dc:Point" x="557" y="1913" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="385.5" y="1898" width="0" height="12" />
+ <dc:Bounds x="384.5" y="1892" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_02znk15_di" bpmnElement="SequenceFlow_02znk15">
@@ -725,16 +756,9 @@ dcsi.preProcessAAIPUT(execution)]]></bpmn2:script>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_19ly8h7_di" bpmnElement="SequenceFlow_19ly8h7">
<di:waypoint xsi:type="dc:Point" x="657" y="1913" />
- <di:waypoint xsi:type="dc:Point" x="923" y="1913" />
+ <di:waypoint xsi:type="dc:Point" x="786" y="1913" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="745" y="1898" width="0" height="12" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_0jsdqmq_di" bpmnElement="SequenceFlow_0jsdqmq">
- <di:waypoint xsi:type="dc:Point" x="1023" y="1913" />
- <di:waypoint xsi:type="dc:Point" x="1248" y="1913" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="1091.5" y="1898" width="0" height="12" />
+ <dc:Bounds x="676.5" y="1892" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ScriptTask_195nptq_di" bpmnElement="ScriptTask_195nptq">
@@ -781,6 +805,26 @@ dcsi.preProcessAAIPUT(execution)]]></bpmn2:script>
<dc:Bounds x="1331" y="1352" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_1kw189j_di" bpmnElement="ServiceTask_1kw189j">
+ <dc:Bounds x="1005" y="1873" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0utvwkh_di" bpmnElement="SequenceFlow_0utvwkh">
+ <di:waypoint xsi:type="dc:Point" x="1105" y="1913" />
+ <di:waypoint xsi:type="dc:Point" x="1248" y="1913" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1176.5" y="1892" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_1bb9adn_di" bpmnElement="ScriptTask_1bb9adn">
+ <dc:Bounds x="786" y="1873" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1lqzi94_di" bpmnElement="SequenceFlow_1lqzi94">
+ <di:waypoint xsi:type="dc:Point" x="886" y="1913" />
+ <di:waypoint xsi:type="dc:Point" x="1005" y="1913" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="945.5" y="1892" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn2:definitions>
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/webapp/WEB-INF/applicationContext.xml b/bpmn/MSOInfrastructureBPMN/src/main/webapp/WEB-INF/applicationContext.xml
index cbb8266bf7..03fff4f974 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/webapp/WEB-INF/applicationContext.xml
+++ b/bpmn/MSOInfrastructureBPMN/src/main/webapp/WEB-INF/applicationContext.xml
@@ -27,7 +27,6 @@
<property name="dmaapTopicName" value="${eventReadyTopicName}"/>
<property name="consumerGroup" value="${consumerGroup}"/>
<property name="consumerId" value="${consumerId}"/>
- <property name="dmaapClientInitialDelayInSeconds" value="${clientThreadInitialDelayInSeconds}"/>
<property name="dmaapClientDelayInSeconds" value="${clientThreadDelayInSeconds}"/>
</bean>
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java
index 1103597157..55dd3a968f 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java
+++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java
@@ -20,7 +20,7 @@
package org.openecomp.mso.bpmn.infrastructure.pnf.delegate;
-import org.openecomp.mso.bpmn.infrastructure.pnf.implementation.DmaapClient;
+import org.openecomp.mso.bpmn.infrastructure.pnf.dmaap.DmaapClient;
public class DmaapClientTestImpl implements DmaapClient {
private String correlationId;
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/dmaap/PnfEventReadyConsumerTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/dmaap/PnfEventReadyConsumerTest.java
index ef8fa3dd1e..73b8247ebc 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/dmaap/PnfEventReadyConsumerTest.java
+++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/dmaap/PnfEventReadyConsumerTest.java
@@ -76,7 +76,6 @@ public class PnfEventReadyConsumerTest {
testedObject.setDmaapTopicName(EVENT_TOPIC_TEST);
testedObject.setConsumerId(CONSUMER_ID);
testedObject.setConsumerGroup(CONSUMER_GROUP);
- testedObject.setDmaapClientInitialDelayInSeconds(1);
testedObject.setDmaapClientDelayInSeconds(1);
testedObject.init();
httpClientMock = mock(HttpClient.class);
@@ -97,7 +96,7 @@ public class PnfEventReadyConsumerTest {
throws IOException {
when(httpClientMock.execute(any(HttpGet.class))).
thenReturn(createResponse(String.format(JSON_EXAMPLE_WITH_CORRELATION_ID, CORRELATION_ID)));
- testedObject.run();
+ testedObject.sendRequest();
ArgumentCaptor<HttpGet> captor1 = ArgumentCaptor.forClass(HttpGet.class);
verify(httpClientMock).execute(captor1.capture());
assertThat(captor1.getValue().getURI()).hasHost(HOST).hasPort(PORT).hasScheme(PROTOCOL)
@@ -120,7 +119,7 @@ public class PnfEventReadyConsumerTest {
when(httpClientMock.execute(any(HttpGet.class))).
thenReturn(createResponse(
String.format(JSON_EXAMPLE_WITH_CORRELATION_ID, CORRELATION_ID_NOT_FOUND_IN_MAP)));
- testedObject.run();
+ testedObject.sendRequest();
verifyZeroInteractions(threadMockToNotifyCamundaFlow, executorMock);
}
@@ -134,7 +133,7 @@ public class PnfEventReadyConsumerTest {
public void correlationIdIsNotFoundInHttpResponse() throws IOException {
when(httpClientMock.execute(any(HttpGet.class))).
thenReturn(createResponse(JSON_EXAMPLE_WITH_NO_CORRELATION_ID));
- testedObject.run();
+ testedObject.sendRequest();
verifyZeroInteractions(threadMockToNotifyCamundaFlow, executorMock);
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java
index 08fe0f856b..8d3a64340d 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java
@@ -533,7 +533,7 @@ public class E2EServiceInstances {
private Response updateE2EserviceInstances(String requestJSON, Action action,
HashMap<String, String> instanceIdMap, String version) {
- String requestId = instanceIdMap.get("serviceId");
+ String requestId = UUIDChecker.generateUUID(msoLogger);
long startTime = System.currentTimeMillis();
msoLogger.debug("requestId is: " + requestId);
E2EServiceInstanceRequest e2eSir = null;
@@ -627,7 +627,7 @@ public class E2EServiceInstances {
String serviceInstanceType = e2eSir.getService().getServiceType();
- String serviceId = "";
+ String serviceId = instanceIdMap.get("serviceId");
RequestClient requestClient = null;
HttpResponse response = null;
@@ -675,6 +675,7 @@ public class E2EServiceInstances {
msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError,
"Null response from BPMN");
msoLogger.debug(END_OF_THE_TRANSACTION + (String) getBPMNResp.getEntity());
+ this.createOperationStatusRecordForError(action, requestId);
return getBPMNResp;
}
@@ -707,9 +708,8 @@ public class E2EServiceInstances {
if (curStatus != null && curStatus.getResult() != null && curStatus.getResult().equalsIgnoreCase("processing")) {
String chkMessage = "Error: Locked instance - This " + requestScope + " (" + requestId + ") "
- + "now being worked with a status of " + curStatus.getProgress() + " (ServiceName - "
- + curStatus.getServiceName()
- + "). The existing request must finish or be cleaned up before proceeding.";
+ + "now being worked with a status of " + curStatus.getResult()
+ + ". The latest workflow of instance must be finished or cleaned up.";
Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_CONFLICT,
MsoException.ServiceException, chkMessage, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, null);
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java
index f69378ec65..9964b93df4 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/openecomp/mso/requestsdb/RequestsDatabase.java
@@ -643,13 +643,17 @@ public class RequestsDatabase {
msoLogger.debug("Execute query on infra active request table");
OperationStatus operStatus = null;
+ List<Object> list = null;
Session session = sessionFactoryRequestDB.getSessionFactory().openSession();
try {
session.beginTransaction();
- String hql = "FROM OperationStatus WHERE SERVICE_ID = :service_id";
+ String hql = "FROM OperationStatus WHERE SERVICE_ID = :service_id order by OPERATE_AT desc";
Query query = session.createQuery(hql);
query.setParameter("service_id", serviceId);
- operStatus = (OperationStatus)query.uniqueResult();
+ list = query.list();
+ if(list != null && list.size() >= 1) {
+ operStatus = (OperationStatus) list.get(0);
+ }
} finally {
if(session != null && session.isOpen()) {
diff --git a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/RequestsDatabaseTest.java b/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/RequestsDatabaseTest.java
index 005a28ec52..aacdd96420 100644
--- a/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/RequestsDatabaseTest.java
+++ b/mso-api-handlers/mso-requests-db/src/test/java/org/openecomp/mso/requestsdb/RequestsDatabaseTest.java
@@ -33,6 +33,7 @@ import org.junit.runner.RunWith;
import org.openecomp.mso.db.AbstractSessionFactoryManager;
import java.util.Arrays;
+import java.util.List;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
@@ -237,8 +238,8 @@ public class RequestsDatabaseTest {
@Mocked Query query) throws Exception {
new Expectations() {{
sessionFactoryManager.getSessionFactory().openSession(); result = session;
- session.createQuery("FROM OperationStatus WHERE SERVICE_ID = :service_id"); result = query;
- query.uniqueResult(); result = new OperationStatus();
+ session.createQuery("FROM OperationStatus WHERE SERVICE_ID = :service_id order by OPERATE_AT desc"); result = query;
+ List<Object>list = query.list(); result = new OperationStatus();
}};
assertEquals(OperationStatus.class,
requestsDatabase.getOperationStatusByServiceId("123").getClass());