diff options
author | Arthur Martella <amartell@research.att.com> | 2017-09-21 16:09:46 -0400 |
---|---|---|
committer | Arthur Martella <amartell@research.att.com> | 2017-09-21 16:09:46 -0400 |
commit | 902ec7ef30248c03096cf03da47e6bcca4372525 (patch) | |
tree | fcb000e29ade08e673d07e85b2358669ceb1e140 /bpmn/MSOCommonBPMN/src/main | |
parent | c894e1dc433d49acd1b5adc4bcd338b1d148e465 (diff) |
Move Homing Building Block into ONAP
Files regarding the Homing building blocks added for use in vCPE flows.
Change-Id: Iae9eb70b81ec7d473e6c4e9c821a9282dc40baa9
Issue-id: SO-138
Signed-off-by: Arthur Martella <amartell@research.att.com>
Diffstat (limited to 'bpmn/MSOCommonBPMN/src/main')
5 files changed, 1073 insertions, 0 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/Homing.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/Homing.groovy new file mode 100755 index 0000000000..dcbb73c7db --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/Homing.groovy @@ -0,0 +1,259 @@ +/*
+ * © 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property.
+ */
+package org.openecomp.mso.bpmn.common.scripts
+
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.runtime.Execution
+
+import org.openecomp.mso.bpmn.common.scripts.AaiUtil
+import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil
+import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils
+import org.openecomp.mso.bpmn.core.domain.InventoryType
+import org.openecomp.mso.bpmn.core.domain.Resource
+import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition
+import org.openecomp.mso.bpmn.core.domain.Subscriber
+import org.openecomp.mso.bpmn.core.json.JsonUtils
+import org.openecomp.mso.rest.APIResponse
+import org.openecomp.mso.rest.RESTClient
+import org.openecomp.mso.rest.RESTConfig
+import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor
+
+import org.json.JSONArray
+import org.json.JSONObject
+
+import static org.openecomp.mso.bpmn.common.scripts.GenericUtils.*;
+
+/**
+ * This class is contains the scripts used
+ * by the Homing Subflow building block. The
+ * subflow attempts to home the provided
+ * resources by calling sniro.
+ *
+ * @author cb645j
+ *
+ */
+class Homing extends AbstractServiceTaskProcessor{
+
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+ JsonUtils jsonUtil = new JsonUtils()
+ SNIROUtils sniroUtils = new SNIROUtils(this)
+
+ /**
+ * This method validates the incoming variables.
+ * The method then prepares the sniro request
+ * and posts it to sniro's rest api.
+ *
+ * @param execution
+ *
+ * @author cb645j
+ */
+ public void callSniro(Execution execution){
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ execution.setVariable("prefix","HOME_")
+ utils.log("DEBUG", "*** Started Homing Call Sniro ***", isDebugEnabled)
+ try{
+ execution.setVariable("rollbackData", null)
+ execution.setVariable("rolledBack", false)
+
+ String requestId = execution.getVariable("msoRequestId")
+ utils.log("DEBUG", "Incoming Request Id is: " + requestId, isDebugEnabled)
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+ utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugEnabled)
+ ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
+ utils.log("DEBUG", "Incoming Service Decomposition is: " + serviceDecomposition, isDebugEnabled)
+ String subscriberInfo = execution.getVariable("subscriberInfo")
+ utils.log("DEBUG", "Incoming Subscriber Information is: " + subscriberInfo, isDebugEnabled)
+
+ if(isBlank(requestId) || isBlank(serviceInstanceId) || isBlank(serviceDecomposition.toString()) || isBlank(subscriberInfo)){
+ exceptionUtil.buildAndThrowWorkflowException(execution, 4000, "A required input variable is missing or null")
+ }else{
+ String subId = jsonUtil.getJsonValue(subscriberInfo, "globalSubscriberId")
+ String subName = jsonUtil.getJsonValue(subscriberInfo, "subscriberName")
+ String subCommonSiteId = ""
+ if(jsonUtil.jsonElementExist(subscriberInfo, "subscriberCommonSiteId")){
+ subCommonSiteId = jsonUtil.getJsonValue(subscriberInfo, "subscriberCommonSiteId")
+ }
+ Subscriber subscriber = new Subscriber(subId, subName, subCommonSiteId)
+
+ String cloudConfiguration = execution.getVariable("cloudConfiguration") // TODO Currently not being used
+ String homingParameters = execution.getVariable("homingParameters") // (aka. request parameters) Should be json format. TODO confirm its json format
+
+ //Authentication
+ def authHeader = ""
+ String basicAuth = execution.getVariable("URN_mso_sniro_auth")
+ String msokey = execution.getVariable("URN_mso_msoKey")
+ String basicAuthValue = utils.encrypt(basicAuth, msokey)
+ if(basicAuthValue != null){
+ utils.log("DEBUG", "Obtained BasicAuth username and password for SNIRO Adapter: " + basicAuthValue, isDebugEnabled)
+ try {
+ authHeader = utils.getBasicAuth(basicAuthValue, msokey)
+ execution.setVariable("BasicAuthHeaderValue",authHeader)
+ } catch (Exception ex) {
+ utils.log("DEBUG", "Unable to encode username and password string: " + ex, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Internal Error - Unable to encode username and password string")
+ }
+ }else{
+ utils.log("DEBUG", "Unable to obtain BasicAuth - BasicAuth value null" , isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Internal Error - BasicAuth value null")
+ }
+
+ //Prepare Callback
+ String timeout = execution.getVariable("timeout")
+ if(isBlank(timeout)){
+ timeout = execution.getVariable("URN_mso_sniro_timeout");
+ if(isBlank(timeout)) {
+ timeout = "PT30M";
+ }
+ }
+ utils.log("DEBUG", "Async Callback Timeout will be: " + timeout, isDebugEnabled)
+
+ execution.setVariable("timeout", timeout);
+ execution.setVariable("correlator", requestId);
+ execution.setVariable("messageType", "SNIROResponse");
+
+ //Build Request & Call Sniro
+ String sniroRequest = sniroUtils.buildRequest(execution, requestId, serviceDecomposition, subscriber, homingParameters)
+ execution.setVariable("sniroRequest", sniroRequest)
+ utils.log("DEBUG", "SNIRO Request is: " + sniroRequest, isDebugEnabled)
+
+ String endpoint = execution.getVariable("URN_mso_service_agnostic_sniro_endpoint")
+ String host = execution.getVariable("URN_mso_service_agnostic_sniro_host")
+ String url = host + endpoint
+ utils.log("DEBUG", "Posting to Sniro Url: " + url, isDebugEnabled)
+
+ logDebug( "URL to be used is: " + url, isDebugEnabled)
+
+ String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey"))
+
+ RESTConfig config = new RESTConfig(url);
+ RESTClient client = new RESTClient(config).addAuthorizationHeader(authHeader).addHeader("Content-Type", "application/json")
+ if (basicAuthCred != null && !"".equals(basicAuthCred)) {
+ client.addAuthorizationHeader(basicAuthCred)
+ }
+ APIResponse response = client.httpPost(sniroRequest)
+
+ int responseCode = response.getStatusCode()
+ execution.setVariable("syncResponseCode", responseCode);
+ logDebug("SNIRO sync response code is: " + responseCode, isDebugEnabled)
+ String syncResponse = response.getResponseBodyAsString()
+ execution.setVariable("syncResponse", syncResponse);
+ logDebug("SNIRO sync response is: " + syncResponse, isDebugEnabled)
+
+ utils.log("DEBUG", "*** Completed Homing Call Sniro ***", isDebugEnabled)
+ }
+ }catch(BpmnError b){
+ throw b
+ }catch(Exception e){
+ utils.log("DEBUG", "Error encountered within Homing CallSniro method: " + e, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in Homing CallSniro: " + e.getMessage())
+ }
+ }
+
+ /**
+ * This method processes the callback response
+ * and the contained homing solution. It sets
+ * homing solution assignment and license
+ * information to the corresponding resources
+ *
+ * @param execution
+ *
+ * @author cb645j
+ */
+ public void processHomingSolution(Execution execution){
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ utils.log("DEBUG", "*** Started Homing Process Homing Solution ***", isDebugEnabled)
+ try{
+ String response = execution.getVariable("asyncCallbackResponse")
+ utils.log("DEBUG", "Sniro Async Callback Response is: " + response, isDebugEnabled)
+ utils.logAudit("Sniro Async Callback Response is: " + response)
+
+ sniroUtils.validateCallbackResponse(execution, response)
+ String placements = jsonUtil.getJsonValue(response, "solutionInfo.placement")
+
+ ServiceDecomposition decomposition = execution.getVariable("serviceDecomposition")
+ utils.log("DEBUG", "Service Decomposition: " + decomposition, isDebugEnabled)
+
+ List<Resource> resourceList = decomposition.getServiceResources()
+ JSONArray arr = new JSONArray(placements)
+ for(int i = 0; i < arr.length(); i++){
+ JSONObject placement = arr.getJSONObject(i)
+ String jsonServiceResourceId = placement.getString("serviceResourceId")
+ for(Resource resource:resourceList){
+ String serviceResourceId = resource.getResourceId()
+ if(serviceResourceId.equalsIgnoreCase(jsonServiceResourceId)){
+ //match
+ String inventoryType = placement.getString("inventoryType")
+ resource.getHomingSolution().setInventoryType(InventoryType.valueOf(inventoryType))
+ resource.getHomingSolution().setCloudRegionId(placement.getString("cloudRegionId"))
+ JSONArray assignmentArr = placement.getJSONArray("assignmentInfo")
+ Map<String, String> assignmentMap = jsonUtil.entryArrayToMap(execution, assignmentArr.toString(), "variableName", "variableValue")
+ resource.getHomingSolution().setCloudOwner(assignmentMap.get("cloudOwner"))
+ resource.getHomingSolution().setAicClli(assignmentMap.get("aicClli"))
+ resource.getHomingSolution().setAicVersion(assignmentMap.get("aicVersion"))
+ if(inventoryType.equalsIgnoreCase("service")){
+ resource.getHomingSolution().setVnfHostname(assignmentMap.get("vnfHostName"));
+ resource.getHomingSolution().setServiceInstanceId(placement.getString("serviceInstanceId"));
+ }
+ }
+ }
+ }
+ if(JsonUtils.jsonElementExist(response, "solutionInfo.licenseInfo")){
+ String licenseInfo = jsonUtil.getJsonValue(response, "solutionInfo.licenseInfo")
+ JSONArray licenseArr = new JSONArray(licenseInfo)
+ for(int l = 0; l < licenseArr.length(); l++){
+ JSONObject license = licenseArr.getJSONObject(l)
+ String jsonServiceResourceId = license.getString("serviceResourceId")
+ for(Resource resource:resourceList){
+ String serviceResourceId = resource.getResourceId()
+ if(serviceResourceId.equalsIgnoreCase(jsonServiceResourceId)){
+ //match
+ String jsonEntitlementPoolList = jsonUtil.getJsonValue(license.toString(), "entitlementPoolList")
+ List<String> entitlementPoolList = jsonUtil.StringArrayToList(execution, jsonEntitlementPoolList)
+ resource.getHomingSolution().setEntitlementPoolList(entitlementPoolList)
+
+ String jsonLicenseKeyGroupList = jsonUtil.getJsonValue(license.toString(), "licenseKeyGroupList")
+ List<String> licenseKeyGroupList = jsonUtil.StringArrayToList(execution, jsonLicenseKeyGroupList)
+ resource.getHomingSolution().setLicenseKeyGroupList(licenseKeyGroupList)
+ }
+ }
+ }
+ }
+ execution.setVariable("serviceDecomposition", decomposition)
+ execution.setVariable("homingSolution", placements) //TODO - can be removed as output variable
+
+ utils.log("DEBUG", "*** Completed Homing Process Homing Solution ***", isDebugEnabled)
+ }catch(BpmnError b){
+ throw b
+ }catch(Exception e){
+ utils.log("DEBUG", "Error encountered within Homing ProcessHomingSolution method: " + e, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in Homing ProcessHomingSolution")
+ }
+ }
+
+ /**
+ * This method logs the start of DHVCreateService
+ * to make debugging easier.
+ *
+ * @param - execution
+ * @author cb645j
+ */
+ public String logStart(Execution execution){
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ String requestId = execution.getVariable("testReqId")
+ if(isBlank(requestId)){
+ requestId = execution.getVariable("msoRequestId")
+ }
+ execution.setVariable("DHVCS_requestId", requestId)
+ utils.log("DEBUG", "***** STARTED Homing Subflow for request: " + requestId + " *****", "true")
+ utils.log("DEBUG", "****** Homing Subflow Global Debug Enabled: " + isDebugEnabled + " *****", "true")
+ utils.logAudit("***** STARTED Homing Subflow for request: " + requestId + " *****")
+ }
+
+
+ /**
+ * Auto-generated method stub
+ */
+ public void preProcessRequest(Execution execution){}
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ReceiveWorkflowMessage.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ReceiveWorkflowMessage.groovy new file mode 100644 index 0000000000..6ad03abec6 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ReceiveWorkflowMessage.groovy @@ -0,0 +1,109 @@ +package org.openecomp.mso.bpmn.common.scripts
+
+import groovy.json.*
+
+import org.apache.commons.lang3.*
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.runtime.Execution
+import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil
+
+
+class ReceiveWorkflowMessage extends AbstractServiceTaskProcessor {
+
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+
+ /**
+ * Process the incoming variables.
+ *
+ * @param execution The flow's execution instance.
+ */
+public void preProcessRequest (Execution execution) {
+ def method = getClass().getSimpleName() + '.preProcessRequest(' +
+ 'execution=' + execution.getId() +
+ ')'
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ logDebug('Entered ' + method, isDebugLogEnabled)
+
+ def prefix="RCVWFMSG_"
+ execution.setVariable("prefix", prefix)
+ setSuccessIndicator(execution, false)
+
+ try {
+
+ // Confirm that timeout value has been provided in 'RCVWFMSG_timeout'.
+ def timeout = execution.getVariable('RCVWFMSG_timeout')
+ logDebug('Timeout value is \'' + timeout + '\'', isDebugLogEnabled)
+ if ((timeout == null) || (timeout.isEmpty())) {
+ String msg = getProcessKey(execution) + ': Missing or empty input variable \'RCVWFMSG_timeout\''
+ logDebug(msg, isDebugLogEnabled)
+ logError(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ }
+
+ // Confirm that message type has been provided in 'RCVWFMSG_messageType'
+ def messageType = execution.getVariable('RCVWFMSG_messageType')
+ logDebug('Message type is \'' + messageType + '\'', isDebugLogEnabled)
+ if ((messageType == null) || (messageType.isEmpty())) {
+ String msg = getProcessKey(execution) + ': Missing or empty input variable \'RCVWFMSG_messageType\''
+ logDebug(msg, isDebugLogEnabled)
+ logError(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ }
+
+ // Confirm that correlator value has been provided in 'RCVWFMSG_correlator'
+ def correlator = execution.getVariable('RCVWFMSG_correlator')
+ logDebug('Correlator value is \'' + correlator + '\'', isDebugLogEnabled)
+ if ((correlator == null) || (correlator.isEmpty())) {
+ String msg = getProcessKey(execution) + ': Missing or empty input variable \'RCVWFMSG_correlator\''
+ logDebug(msg, isDebugLogEnabled)
+ logError(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ }
+ execution.setVariable(messageType + '_CORRELATOR', correlator)
+
+ logDebug('Exited ' + method, isDebugLogEnabled)
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception e) {
+ String msg = 'Caught exception in ' + method + ": " + e
+ logDebug(msg, isDebugLogEnabled)
+ logError(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ }
+ }
+
+ /**
+ * Process a received message.
+ *
+ * @param execution The flow's execution instance.
+ */
+ public void processReceivedMessage(Execution execution){
+ def method = getClass().getSimpleName() + '.processReceivedMessage(' +
+ 'execution=' + execution.getId() +
+ ')'
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ logDebug('Entered ' + method, isDebugLogEnabled)
+
+ String messageType = null;
+ String receivedMessage = null;
+
+ try {
+ messageType = execution.getVariable('RCVWFMSG_messageType')
+ receivedMessage = execution.getVariable(messageType + '_MESSAGE')
+ logDebug(getProcessKey(execution) + ": received message:\n" + receivedMessage, isDebugLogEnabled)
+
+ // The received message is made available to the calling flow in WorkflowResponse
+ execution.setVariable("WorkflowResponse", receivedMessage)
+
+ setSuccessIndicator(execution, true)
+
+ logDebug('Exited ' + method, isDebugLogEnabled)
+ } catch (Exception e) {
+ receivedMessage = receivedMessage == null || String.valueOf(receivedMessage).isEmpty() ? "NONE" : receivedMessage
+ String msg = "Error processing received workflow message: " + receivedMessage
+ logDebug(getProcessKey(execution) + ': ' + msg, isDebugLogEnabled)
+ exceptionUtil.buildWorkflowException(execution, 7020, msg)
+ }
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SNIROUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SNIROUtils.groovy new file mode 100644 index 0000000000..aba2b783e5 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SNIROUtils.groovy @@ -0,0 +1,262 @@ +package org.openecomp.mso.bpmn.common.scripts
+
+import org.camunda.bpm.engine.runtime.Execution
+import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil
+import org.openecomp.mso.bpmn.common.scripts.MsoUtils
+import org.openecomp.mso.bpmn.core.domain.*
+import org.openecomp.mso.bpmn.core.json.JsonUtils
+import org.apache.commons.lang3.StringUtils
+
+import static org.openecomp.mso.bpmn.common.scripts.GenericUtils.*
+
+class SNIROUtils{
+
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+ JsonUtils jsonUtil = new JsonUtils()
+
+ private AbstractServiceTaskProcessor utils
+
+ public MsoUtils msoUtils = new MsoUtils()
+
+ public SNIROUtils(AbstractServiceTaskProcessor taskProcessor) {
+ this.utils = taskProcessor
+ }
+
+ /**
+ * This method builds the service-agnostic
+ * sniro json request to get a homing solution
+ * and license solution
+ *
+ * @param execution
+ * @param requestId
+ * @param decomposition - ServiceDecomposition object
+ * @param subscriber - Subscriber information
+ * @param homingParams - Homing/Request parameters
+ *
+ * @return request - sniro v2 payload
+ *
+ * @author cb645j
+ */
+ public String buildRequest(Execution execution, String requestId, ServiceDecomposition decomposition, Subscriber subscriber, String homingParams){
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ utils.log("DEBUG", "Started Building Sniro Request", isDebugEnabled)
+ def callbackUrl = utils.createWorkflowMessageAdapterCallbackURL(execution, "SNIROResponse", requestId)
+ def transactionId = requestId
+ //ServiceInstance Info
+ ServiceInstance serviceInstance = decomposition.getServiceInstance()
+ def serviceInstanceId
+ if(serviceInstance == null){
+ utils.log("DEBUG", "Unable to obtain Service Instance Id, ServiceInstance Object is null" , isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 400, "Internal Error - Unable to obtain Service Instance Id, ServiceInstance Object is null")
+ }else{
+ serviceInstanceId = serviceInstance.getInstanceId()
+ }
+ //Model Info
+ ModelInfo model = decomposition.getModelInfo()
+ String modelType = model.getModelType()
+ String modelInvariantId = model.getModelInvariantUuid()
+ String modelVersionId = model.getModelUuid()
+ String modelName = model.getModelName()
+ String modelVersion = model.getModelVersion()
+ //Subscriber Info
+ String subscriberId = subscriber.getGlobalId()
+ String subscriberName = subscriber.getName()
+ String commonSiteId = subscriber.getCommonSiteId()
+ //OrderInfo
+ String orderInfo
+ if(!isBlank(homingParams)){
+ orderInfo = homingParams.replaceAll("\"", "\\\\\"").replaceAll("\n", "").replaceAll("\r", "")
+ orderInfo = StringUtils.normalizeSpace(orderInfo)
+ }
+
+ //Demands
+ String placementDemands = ""
+ StringBuilder sb = new StringBuilder()
+ List<Resource> resourceList = decomposition.getServiceAllottedResources()
+ List<VnfResource> vnfResourceList = decomposition.getServiceVnfs()
+
+ // TODO: We should include both alloted resources and service resources in the placementDeamnds- not one or the other.
+ if(resourceList.isEmpty() || resourceList == null){
+ utils.log("DEBUG", "Allotted Resources List is empty - will try to get service VNFs instead.", isDebugEnabled)
+ resourceList = decomposition.getServiceVnfs()
+ }
+
+ if(resourceList.isEmpty() || resourceList == null){
+ utils.log("DEBUG", "Resources List is Empty", isDebugEnabled)
+ }else{
+ for(Resource resource:resourceList){
+ ModelInfo resourceModelInfo = resource.getModelInfo()
+ ResourceInstance resourceInstance = resource.getResourceInstance()
+ def resourceInstanceType = resource.getResourceType()
+ def serviceResourceId = resource.getResourceId() //TODO - resourceId versus instanceId - should be what is put in AAI, whatever we put here will be what is in response, used to correlate
+ def resourceModuleName = resourceModelInfo.getModelInstanceName()
+ def resouceModelCustomizationId = resourceModelInfo.getModelCustomizationUuid()
+ def resouceModelInvariantId = resourceModelInfo.getModelInvariantUuid()
+ def resouceModelName = resourceModelInfo.getModelName()
+ def resouceModelVersion = resourceModelInfo.getModelVersion()
+ def resouceModelVersionId = resourceModelInfo.getModelUuid()
+ def resouceModelType = resourceModelInfo.getModelType()
+ def tenantId = "" //Optional
+ def tenantName = "" //Optional
+
+ String demand =
+ """{
+ "resourceInstanceType": "${resourceInstanceType}",
+ "serviceResourceId": "${serviceResourceId}",
+ "resourceModuleName": "${resourceModuleName}",
+ "resourceModelInfo": {
+ "modelCustomizationId": "${resouceModelCustomizationId}",
+ "modelInvariantId": "${resouceModelInvariantId}",
+ "modelName": "${resouceModelName}",
+ "modelVersion": "${resouceModelVersion}",
+ "modelVersionId": "${resouceModelVersionId}",
+ "modelType": "${resouceModelType}"
+ },
+ "tenantId": "${tenantId}",
+ "tenantName": "${tenantName}"
+ },"""
+
+ placementDemands = sb.append(demand)
+ }
+ placementDemands = placementDemands.substring(0, placementDemands.length() - 1);
+ }
+
+ String licenseDemands = ""
+ sb = new StringBuilder()
+ if(vnfResourceList.isEmpty() || vnfResourceList == null){
+ utils.log("DEBUG", "Vnf Resources List is Empty", isDebugEnabled)
+ }else{
+ for(VnfResource vnfResource:vnfResourceList){
+ ModelInfo vnfResourceModelInfo = vnfResource.getModelInfo()
+ ResourceInstance vnfResourceInstance = vnfResource.getResourceInstance()
+ def resourceInstanceType = vnfResource.getResourceType()
+ def serviceResourceId = vnfResource.getResourceId()
+ def resourceModuleName = vnfResourceModelInfo.getModelInstanceName()
+ def resouceModelCustomizationId = vnfResourceModelInfo.getModelCustomizationUuid()
+ def resouceModelInvariantId = vnfResourceModelInfo.getModelInvariantUuid()
+ def resouceModelName = vnfResourceModelInfo.getModelName()
+ def resouceModelVersion = vnfResourceModelInfo.getModelVersion()
+ def resouceModelVersionId = vnfResourceModelInfo.getModelUuid()
+ def resouceModelType = vnfResourceModelInfo.getModelType()
+
+ String demand =
+ """{
+ "resourceInstanceType": "${resourceInstanceType}",
+ "serviceResourceId": "${serviceResourceId}",
+ "resourceModuleName": "${resourceModuleName}",
+ "resourceModelInfo": {
+ "modelCustomizationId": "${resouceModelCustomizationId}",
+ "modelInvariantId": "${resouceModelInvariantId}",
+ "modelName": "${resouceModelName}",
+ "modelVersion": "${resouceModelVersion}",
+ "modelVersionId": "${resouceModelVersionId}",
+ "modelType": "${resouceModelType}"
+ }
+ },"""
+
+ licenseDemands = sb.append(demand)
+ }
+ licenseDemands = licenseDemands.substring(0, licenseDemands.length() - 1);
+ }
+
+ String request =
+ """{
+ "requestInfo": {
+ "transactionId": "${transactionId}",
+ "requestId": "${requestId}",
+ "callbackUrl": "${callbackUrl}",
+ "sourceId": "mso",
+ "optimizer": [
+ "placement",
+ "license"
+ ],
+ "numSolutions": 1,
+ "timeout": 600
+ },
+ "placementInfo": {
+ "serviceModelInfo": {
+ "modelType": "${modelType}",
+ "modelInvariantId": "${modelInvariantId}",
+ "modelVersionId": "${modelVersionId}",
+ "modelName": "${modelName}",
+ "modelVersion": "${modelVersion}"
+ },
+ "subscriberInfo": {
+ "globalSubscriberId": "${subscriberId}",
+ "subscriberName": "${subscriberName}",
+ "subscriberCommonSiteId": "${commonSiteId}"
+ },
+ "demandInfo": {
+ "placementDemand": [
+ ${placementDemands}
+ ],
+ "licenseDemand": [
+ ${licenseDemands}
+ ]
+ },
+ "policyId": [],
+ "serviceInstanceId": "${serviceInstanceId}",
+ "orderInfo": "{\\\"requestParameters\\\": ${orderInfo}}"
+ }
+ }"""
+
+ utils.log("DEBUG", "Completed Building Sniro Request", isDebugEnabled)
+ return request
+ }
+
+ /**
+ * This method validates the callback response
+ * from Sniro. If the response contains an
+ * exception the method will build and throw
+ * a workflow exception.
+ *
+ * @param execution
+ * @param response - the async callback response from sniro
+ *
+ * @author cb645j
+ */
+ public void validateCallbackResponse(Execution execution, String response){
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ String placements = ""
+ if(isBlank(response)){
+ exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Sniro Async Callback Response is Empty")
+ }else{
+ if(JsonUtils.jsonElementExist(response, "solutionInfo.placement")){
+ placements = jsonUtil.getJsonValue(response, "solutionInfo.placement")
+ if(isBlank(placements) || placements.equalsIgnoreCase("[]")){
+ String statusMessage = jsonUtil.getJsonValue(response, "statusMessage")
+ if(isBlank(statusMessage)){
+ utils.log("DEBUG", "Error Occured in Homing: Sniro Async Callback Response does not contain placement solution.", isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 400, "Sniro Async Callback Response does not contain placement solution.")
+ }else{
+ utils.log("DEBUG", "Error Occured in Homing: " + statusMessage, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 400, statusMessage)
+ }
+ }else{
+ return
+ }
+ }else if(JsonUtils.jsonElementExist(response, "requestError") == true){
+ String errorMessage = ""
+ if(response.contains("policyException")){
+ String text = jsonUtil.getJsonValue(response, "requestError.policyException.text")
+ errorMessage = "Sniro Async Callback Response contains a Request Error Policy Exception: " + text
+ }else if(response.contains("serviceException")){
+ String text = jsonUtil.getJsonValue(response, "requestError.serviceException.text")
+ errorMessage = "Sniro Async Callback Response contains a Request Error Service Exception: " + text
+ }else{
+ errorMessage = "Sniro Async Callback Response contains a Request Error. Unable to determine the Request Error Exception."
+ }
+ utils.log("DEBUG", "Error Occured in Homing: " + errorMessage, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 400, errorMessage)
+
+ }else{
+ utils.log("DEBUG", "Error Occured in Homing: Received an Unknown Async Callback Response from Sniro.", isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Received an Unknown Async Callback Response from Sniro.")
+ }
+ }
+
+ }
+
+
+}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/BuildingBlock/Homing.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/BuildingBlock/Homing.bpmn new file mode 100644 index 0000000000..a432417c21 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/BuildingBlock/Homing.bpmn @@ -0,0 +1,259 @@ +<?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:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="_vwRmIBsREeeIQtzUKIjH4g" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> + <bpmn2:process id="Homing" name="Homing" isExecutable="true"> + <bpmn2:startEvent id="StartEvent_1"> + <bpmn2:outgoing>SequenceFlow_1x9usa6</bpmn2:outgoing> + </bpmn2:startEvent> + <bpmn2:scriptTask id="callSniro" name="Call Sniro" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_1x9usa6</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_10x3ocp</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* +Homing sniro = new Homing() +sniro.callSniro(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_1x9usa6" sourceRef="StartEvent_1" targetRef="callSniro" /> + <bpmn2:subProcess id="bpmnErrorSubprocess" name="Error Handling Subprocess" triggeredByEvent="true"> + <bpmn2:endEvent id="EndEvent_07tjq3v"> + <bpmn2:incoming>SequenceFlow_1rf4vs8</bpmn2:incoming> + <bpmn2:terminateEventDefinition /> + </bpmn2:endEvent> + <bpmn2:startEvent id="StartEvent_1qiitb2"> + <bpmn2:outgoing>SequenceFlow_00nlh7l</bpmn2:outgoing> + <bpmn2:errorEventDefinition /> + </bpmn2:startEvent> + <bpmn2:scriptTask id="processMsoWorkflowException" name="Process Error" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_00nlh7l</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_1rf4vs8</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
+ExceptionUtil ex = new ExceptionUtil()
+ex.processSubflowsBPMNException(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_1rf4vs8" sourceRef="processMsoWorkflowException" targetRef="EndEvent_07tjq3v" /> + <bpmn2:sequenceFlow id="SequenceFlow_00nlh7l" sourceRef="StartEvent_1qiitb2" targetRef="processMsoWorkflowException" /> + </bpmn2:subProcess> + <bpmn2:subProcess id="javaExceptionSubProcess" name="Java Exception Sub Process" triggeredByEvent="true"> + <bpmn2:scriptTask id="processJavaException" name="Process Error" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_0kamg53</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_1o7154s</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
+ExceptionUtil ex = new ExceptionUtil()
+ex.processJavaException(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:startEvent id="StartEvent_1fbpeuw"> + <bpmn2:outgoing>SequenceFlow_0kamg53</bpmn2:outgoing> + <bpmn2:errorEventDefinition errorRef="Error_1lwpypa" /> + </bpmn2:startEvent> + <bpmn2:endEvent id="EndEvent_0jbvnr0"> + <bpmn2:incoming>SequenceFlow_1o7154s</bpmn2:incoming> + <bpmn2:terminateEventDefinition /> + </bpmn2:endEvent> + <bpmn2:sequenceFlow id="SequenceFlow_0kamg53" name="" sourceRef="StartEvent_1fbpeuw" targetRef="processJavaException" /> + <bpmn2:sequenceFlow id="SequenceFlow_1o7154s" name="" sourceRef="processJavaException" targetRef="EndEvent_0jbvnr0" /> + </bpmn2:subProcess> + <bpmn2:scriptTask id="processHomingSolution" name="Process Homing Solutio " scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_043r3j8</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_1h9opg9</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* +Homing homing = new Homing() +homing.processHomingSolution(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:exclusiveGateway id="responseCheck" name="Response Ok?" default="badResponse"> + <bpmn2:incoming>SequenceFlow_10x3ocp</bpmn2:incoming> + <bpmn2:outgoing>badResponse</bpmn2:outgoing> + <bpmn2:outgoing>goodResponse</bpmn2:outgoing> + </bpmn2:exclusiveGateway> + <bpmn2:sequenceFlow id="SequenceFlow_10x3ocp" sourceRef="callSniro" targetRef="responseCheck" /> + <bpmn2:scriptTask id="assignError" name="Assign Error" scriptFormat="groovy"> + <bpmn2:incoming>badResponse</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_0clfkld</bpmn2:outgoing> + <bpmn2:script><![CDATA[int responseCode = execution.getVariable("syncResponseCode")
+
+import org.openecomp.mso.bpmn.common.scripts.*
+ExceptionUtil ex = new ExceptionUtil()
+ex.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from Sniro.")]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="badResponse" name="No" sourceRef="responseCheck" targetRef="assignError" /> + <bpmn2:sequenceFlow id="SequenceFlow_0clfkld" sourceRef="assignError" targetRef="throwMSOWorkflowException" /> + <bpmn2:endEvent id="throwMSOWorkflowException"> + <bpmn2:incoming>SequenceFlow_0clfkld</bpmn2:incoming> + <bpmn2:errorEventDefinition errorRef="Error_10hit0u" /> + </bpmn2:endEvent> + <bpmn2:sequenceFlow id="goodResponse" name="Yes" sourceRef="responseCheck" targetRef="receiveAsyncCallback"> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("syncResponseCode") == 202}]]></bpmn2:conditionExpression> + </bpmn2:sequenceFlow> + <bpmn2:sequenceFlow id="SequenceFlow_043r3j8" sourceRef="receiveAsyncCallback" targetRef="processHomingSolution" /> + <bpmn2:callActivity id="receiveAsyncCallback" name="Receive Async Callback" calledElement="ReceiveWorkflowMessage" camunda:modelerTemplate="receiveWorkflowMessage"> + <bpmn2:extensionElements> + <camunda:in source="true" target="isDebugLogEnabled" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + <camunda:in source="messageType" target="RCVWFMSG_messageType" /> + <camunda:in source="correlator" target="RCVWFMSG_correlator" /> + <camunda:in source="timeout" target="RCVWFMSG_timeout" /> + <camunda:out source="WorkflowResponse" target="asyncCallbackResponse" /> + </bpmn2:extensionElements> + <bpmn2:incoming>goodResponse</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_043r3j8</bpmn2:outgoing> + </bpmn2:callActivity> + <bpmn2:sequenceFlow id="SequenceFlow_1h9opg9" sourceRef="processHomingSolution" targetRef="EndEvent_0n56tas" /> + <bpmn2:endEvent id="EndEvent_0n56tas"> + <bpmn2:incoming>SequenceFlow_1h9opg9</bpmn2:incoming> + <bpmn2:terminateEventDefinition /> + </bpmn2:endEvent> + </bpmn2:process> + <bpmn2:error id="Error_10hit0u" name="MSO Workflow Exception" errorCode="MSOWorkflowException" /> + <bpmn2:error id="Error_1lwpypa" name="Java Lang Exception" errorCode="java.lang.Exception" /> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Homing"> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1"> + <dc:Bounds x="147" y="275" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0qmfpdr_di" bpmnElement="callSniro"> + <dc:Bounds x="286" y="253" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1x9usa6_di" bpmnElement="SequenceFlow_1x9usa6"> + <di:waypoint xsi:type="dc:Point" x="183" y="293" /> + <di:waypoint xsi:type="dc:Point" x="286" y="293" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="235" y="278" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="SubProcess_16p12qo_di" bpmnElement="bpmnErrorSubprocess" isExpanded="true"> + <dc:Bounds x="254" y="496" width="409" height="168" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="SubProcess_12gjiy8_di" bpmnElement="javaExceptionSubProcess" isExpanded="true"> + <dc:Bounds x="284" y="679" width="350" height="159" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_07tjq3v_di" bpmnElement="EndEvent_07tjq3v"> + <dc:Bounds x="579" y="570" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="597" y="611" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="StartEvent_1qiitb2_di" bpmnElement="StartEvent_1qiitb2"> + <dc:Bounds x="299" y="570" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="317" y="611" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_03hs6s9_di" bpmnElement="processMsoWorkflowException"> + <dc:Bounds x="406" y="548" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_19gqykh_di" bpmnElement="processJavaException"> + <dc:Bounds x="410" y="727" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="StartEvent_1fbpeuw_di" bpmnElement="StartEvent_1fbpeuw"> + <dc:Bounds x="318" y="749" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="336" y="790" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_0jbvnr0_di" bpmnElement="EndEvent_0jbvnr0"> + <dc:Bounds x="567" y="749" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="585" y="790" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1rf4vs8_di" bpmnElement="SequenceFlow_1rf4vs8"> + <di:waypoint xsi:type="dc:Point" x="506" y="588" /> + <di:waypoint xsi:type="dc:Point" x="579" y="588" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="543" y="573" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_00nlh7l_di" bpmnElement="SequenceFlow_00nlh7l"> + <di:waypoint xsi:type="dc:Point" x="335" y="588" /> + <di:waypoint xsi:type="dc:Point" x="363" y="588" /> + <di:waypoint xsi:type="dc:Point" x="363" y="588" /> + <di:waypoint xsi:type="dc:Point" x="406" y="588" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="378" y="588" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0kamg53_di" bpmnElement="SequenceFlow_0kamg53"> + <di:waypoint xsi:type="dc:Point" x="354" y="767" /> + <di:waypoint xsi:type="dc:Point" x="410" y="767" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="382" y="752" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1o7154s_di" bpmnElement="SequenceFlow_1o7154s"> + <di:waypoint xsi:type="dc:Point" x="510" y="767" /> + <di:waypoint xsi:type="dc:Point" x="567" y="767" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="539" y="752" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1aapkvq_di" bpmnElement="processHomingSolution"> + <dc:Bounds x="630" y="325" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ExclusiveGateway_03gt5b8_di" bpmnElement="responseCheck" isMarkerVisible="true"> + <dc:Bounds x="419" y="268" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="474" y="287" width="74" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_10x3ocp_di" bpmnElement="SequenceFlow_10x3ocp"> + <di:waypoint xsi:type="dc:Point" x="386" y="293" /> + <di:waypoint xsi:type="dc:Point" x="419" y="293" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="403" y="278" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0ikcqeo_di" bpmnElement="assignError"> + <dc:Bounds x="490" y="176" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1m1c9nu_di" bpmnElement="badResponse"> + <di:waypoint xsi:type="dc:Point" x="444" y="268" /> + <di:waypoint xsi:type="dc:Point" x="444" y="216" /> + <di:waypoint xsi:type="dc:Point" x="490" y="216" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="451" y="226" width="14" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0clfkld_di" bpmnElement="SequenceFlow_0clfkld"> + <di:waypoint xsi:type="dc:Point" x="590" y="216" /> + <di:waypoint xsi:type="dc:Point" x="662" y="216" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="626" y="201" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="EndEvent_13ejfwp_di" bpmnElement="throwMSOWorkflowException"> + <dc:Bounds x="662" y="198" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="680" y="234" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1o3br3u_di" bpmnElement="goodResponse"> + <di:waypoint xsi:type="dc:Point" x="444" y="318" /> + <di:waypoint xsi:type="dc:Point" x="444" y="365" /> + <di:waypoint xsi:type="dc:Point" x="490" y="365" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="447" y="339.5" width="18" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_043r3j8_di" bpmnElement="SequenceFlow_043r3j8"> + <di:waypoint xsi:type="dc:Point" x="590" y="365" /> + <di:waypoint xsi:type="dc:Point" x="630" y="365" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="610" y="350" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="CallActivity_031b5m3_di" bpmnElement="receiveAsyncCallback"> + <dc:Bounds x="490" y="325" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1h9opg9_di" bpmnElement="SequenceFlow_1h9opg9"> + <di:waypoint xsi:type="dc:Point" x="730" y="365" /> + <di:waypoint xsi:type="dc:Point" x="825" y="365" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="778" y="350" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="EndEvent_0ougemc_di" bpmnElement="EndEvent_0n56tas"> + <dc:Bounds x="825" y="347" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="843" y="383" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn2:definitions> diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/ReceiveWorkflowMessage.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/ReceiveWorkflowMessage.bpmn new file mode 100644 index 0000000000..ad857eddcd --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/ReceiveWorkflowMessage.bpmn @@ -0,0 +1,184 @@ +<?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:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_GraPIIyxEeWmdMDkx6Uftw" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> + <bpmn2:process id="ReceiveWorkflowMessage" name="ReceiveWorkflowMessage" isExecutable="true"> + <bpmn2:scriptTask id="ScriptTask_1" name="Pre-Process Request" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_9</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_1ps0nzi</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* +def receiveWorkflowMessage = new ReceiveWorkflowMessage() +receiveWorkflowMessage .preProcessRequest(execution) +]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:startEvent id="StartEvent_1" name="Start"> + <bpmn2:outgoing>SequenceFlow_9</bpmn2:outgoing> + </bpmn2:startEvent> + <bpmn2:sequenceFlow id="SequenceFlow_9" name="" sourceRef="StartEvent_1" targetRef="ScriptTask_1" /> + <bpmn2:scriptTask id="ScriptTask_5" name="Workflow Exception (timeout)" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_27</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_34</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* +def exceptionUtil = new ExceptionUtil() +exceptionUtil.buildWorkflowException(execution, 7010, "Receive Workflow Message Timeout Error")]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_34" name="" sourceRef="ScriptTask_5" targetRef="EndEvent_8" /> + <bpmn2:endEvent id="EndEvent_8"> + <bpmn2:incoming>SequenceFlow_34</bpmn2:incoming> + <bpmn2:errorEventDefinition id="_ErrorEventDefinition_21" errorRef="Error_1" /> + </bpmn2:endEvent> + <bpmn2:scriptTask id="ScriptTask_setSuccess" name="Process Message and Set WorkflowResult" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_44</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* +def receiveWorkflowMessage = new ReceiveWorkflowMessage() +receiveWorkflowMessage.processReceivedMessage(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_1" name="" sourceRef="ScriptTask_setSuccess" targetRef="EndEvent_6" /> + <bpmn2:endEvent id="EndEvent_6" name="End"> + <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming> + </bpmn2:endEvent> + <bpmn2:boundaryEvent id="BoundaryEvent_1" name="Timeout" attachedToRef="SubProcess_2"> + <bpmn2:outgoing>SequenceFlow_27</bpmn2:outgoing> + <bpmn2:timerEventDefinition id="TimerEventDefinition_1"> + <bpmn2:timeDuration xsi:type="bpmn2:tFormalExpression">${RCVWFMSG_timeout}</bpmn2:timeDuration> + </bpmn2:timerEventDefinition> + </bpmn2:boundaryEvent> + <bpmn2:sequenceFlow id="SequenceFlow_27" name="" sourceRef="BoundaryEvent_1" targetRef="ScriptTask_5" /> + <bpmn2:subProcess id="SubProcess_2" name="Wait for Workflow Message"> + <bpmn2:incoming>SequenceFlow_1ps0nzi</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_44</bpmn2:outgoing> + <bpmn2:startEvent id="StartEvent_3"> + <bpmn2:outgoing>SequenceFlow_25</bpmn2:outgoing> + </bpmn2:startEvent> + <bpmn2:sequenceFlow id="SequenceFlow_25" name="" sourceRef="StartEvent_3" targetRef="IntermediateCatchEvent_1" /> + <bpmn2:endEvent id="EndEvent_12"> + <bpmn2:incoming>SequenceFlow_41</bpmn2:incoming> + </bpmn2:endEvent> + <bpmn2:intermediateCatchEvent id="IntermediateCatchEvent_1" name="Catch Workflow Message"> + <bpmn2:incoming>SequenceFlow_25</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_41</bpmn2:outgoing> + <bpmn2:messageEventDefinition id="MessageEventDefinition_1" messageRef="Message_07j47nk" /> + </bpmn2:intermediateCatchEvent> + <bpmn2:sequenceFlow id="SequenceFlow_41" name="" sourceRef="IntermediateCatchEvent_1" targetRef="EndEvent_12" /> + </bpmn2:subProcess> + <bpmn2:sequenceFlow id="SequenceFlow_44" name="" sourceRef="SubProcess_2" targetRef="ScriptTask_setSuccess" /> + <bpmn2:sequenceFlow id="SequenceFlow_1ps0nzi" sourceRef="ScriptTask_1" targetRef="SubProcess_2" /> + </bpmn2:process> + <bpmn2:error id="Error_1" name="MSO Workflow Exception" errorCode="MSOWorkflowException" /> + <bpmn2:message id="Message_1" name="SDNCAResponse" /> + <bpmn2:message id="Message_07j47nk" name="WorkflowMessage" /> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="ReceiveWorkflowMessage"> + <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_56" bpmnElement="ScriptTask_1"> + <dc:Bounds x="242" y="161" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_SubProcess_14" bpmnElement="SubProcess_2" isExpanded="true"> + <dc:Bounds x="461" y="107" width="313" height="189" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_59" bpmnElement="ScriptTask_5"> + <dc:Bounds x="857" y="382" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_BoundaryEvent_24" bpmnElement="BoundaryEvent_1"> + <dc:Bounds x="703" y="278" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="744" y="308" width="39" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_54" bpmnElement="StartEvent_1"> + <dc:Bounds x="129" y="184" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="135" y="225" width="23" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_2" bpmnElement="SequenceFlow_9" sourceElement="_BPMNShape_StartEvent_54" targetElement="_BPMNShape_ScriptTask_56"> + <di:waypoint xsi:type="dc:Point" x="165" y="202" /> + <di:waypoint xsi:type="dc:Point" x="242" y="201" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="204" y="186.5" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_55" bpmnElement="StartEvent_3"> + <dc:Bounds x="493" y="185" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="511" y="226" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_27" bpmnElement="SequenceFlow_25" sourceElement="_BPMNShape_StartEvent_55" targetElement="_BPMNShape_IntermediateCatchEvent_20"> + <di:waypoint xsi:type="dc:Point" x="529" y="203" /> + <di:waypoint xsi:type="dc:Point" x="588" y="203" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="791" y="201" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_29" bpmnElement="SequenceFlow_27" sourceElement="_BPMNShape_BoundaryEvent_24" targetElement="_BPMNShape_ScriptTask_59"> + <di:waypoint xsi:type="dc:Point" x="721" y="314" /> + <di:waypoint xsi:type="dc:Point" x="721" y="422" /> + <di:waypoint xsi:type="dc:Point" x="857" y="422" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="736" y="368" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_EndEvent_158" bpmnElement="EndEvent_6"> + <dc:Bounds x="1022" y="184" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1031" y="225" width="19" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_EndEvent_160" bpmnElement="EndEvent_8"> + <dc:Bounds x="1022" y="404" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1040" y="445" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_36" bpmnElement="SequenceFlow_34" sourceElement="_BPMNShape_ScriptTask_59" targetElement="_BPMNShape_EndEvent_160"> + <di:waypoint xsi:type="dc:Point" x="957" y="422" /> + <di:waypoint xsi:type="dc:Point" x="1022" y="422" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="990" y="407" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_236" bpmnElement="ScriptTask_setSuccess"> + <dc:Bounds x="858" y="160" width="97" height="83" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="_BPMNShape_ScriptTask_236" targetElement="_BPMNShape_EndEvent_158"> + <di:waypoint xsi:type="dc:Point" x="955" y="201" /> + <di:waypoint xsi:type="dc:Point" x="1022" y="202" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="989" y="186.5" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_EndEvent_219" bpmnElement="EndEvent_12"> + <dc:Bounds x="681" y="185" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="699" y="226" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_44" bpmnElement="SequenceFlow_44" sourceElement="_BPMNShape_SubProcess_14" targetElement="_BPMNShape_ScriptTask_236"> + <di:waypoint xsi:type="dc:Point" x="774" y="202" /> + <di:waypoint xsi:type="dc:Point" x="858" y="201" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="816" y="186.5" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1ps0nzi_di" bpmnElement="SequenceFlow_1ps0nzi"> + <di:waypoint xsi:type="dc:Point" x="342" y="201" /> + <di:waypoint xsi:type="dc:Point" x="461" y="201" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="402" y="186" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_IntermediateCatchEvent_20" bpmnElement="IntermediateCatchEvent_1"> + <dc:Bounds x="588" y="185" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="566" y="227" width="80" height="24" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_41" bpmnElement="SequenceFlow_41" sourceElement="_BPMNShape_IntermediateCatchEvent_20"> + <di:waypoint xsi:type="dc:Point" x="624" y="203" /> + <di:waypoint xsi:type="dc:Point" x="681" y="203" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="653" y="188" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn2:definitions>
\ No newline at end of file |