diff options
11 files changed, 3767 insertions, 0 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CustomE2EGetService.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CustomE2EGetService.groovy new file mode 100644 index 0000000000..aece07ee90 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CustomE2EGetService.groovy @@ -0,0 +1,442 @@ +/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.bpmn.common.scripts
+
+import static org.apache.commons.lang3.StringUtils.*
+
+import org.apache.commons.lang3.*
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.runtime.Execution
+import org.openecomp.mso.rest.APIResponse
+import org.springframework.web.util.UriUtils
+
+
+/**
+ * This class supports the GenericGetService Sub Flow.
+ * This Generic sub flow can be used by any flow for accomplishing
+ * the goal of getting a Service-Instance or Service-Subscription (from AAI).
+ * The calling flow must set the GENGS_type variable as "service-instance"
+ * or "service-subscription".
+ *
+ * When using to Get a Service-Instance:
+ * If the global-customer-id and service-type are not provided
+ * this flow executes a query to get the service- Url using the
+ * Service Id or Name (whichever is provided).
+ *
+ * When using to Get a Service-Subscription:
+ * The global-customer-id and service-type must be
+ * provided.
+ *
+ * Upon successful completion of this sub flow the
+ * GENGS_SuccessIndicator will be true and the query response payload
+ * will be set to GENGS_service. An MSOWorkflowException will
+ * be thrown upon unsuccessful completion or if an error occurs
+ * at any time during this sub flow. Please map variables
+ * to the corresponding variable names below.
+ *
+ * Note - If this sub flow receives a Not Found (404) response
+ * from AAI at any time this will be considered an acceptable
+ * successful response however the GENGS_FoundIndicator
+ * will be set to false. This variable will allow the calling flow
+ * to distinguish between the two Success scenarios,
+ * "Success where service- is found" and
+ * "Success where service- is NOT found".
+ *
+ *
+ * Variable Mapping Below:
+ *
+ * In Mapping Variables:
+ * For Allotted-Resource:
+ * @param - GENGS_allottedResourceId
+ * @param - GENGS_type
+ * @param (Optional) - GENGS_serviceInstanceId
+ * @param (Optional) - GENGS_serviceType
+ * @param (Optional) - GENGS_globalCustomerId
+ *
+ * For Service-Instance:
+ * @param - GENGS_serviceInstanceId or @param - GENGS_serviceInstanceName
+ * @param - GENGS_type
+ * @param (Optional) - GENGS_serviceType
+ * @param (Optional) - GENGS_globalCustomerId
+ *
+ * For Service-Subscription:
+ * @param - GENGS_type
+ * @param - GENGS_serviceType
+ * @param - GENGS_globalCustomerId
+ *
+ *
+ * Out Mapping Variables:
+ * @param - GENGS_service
+ * @param - GENGS_FoundIndicator
+ * @param - WorkflowException
+ */
+class CustomE2EGetService extends AbstractServiceTaskProcessor{
+
+ String Prefix = "GENGS_"
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+
+ /**
+ * This method validates the incoming variables and
+ * determines the subsequent event based on which
+ * variables the calling flow provided.
+ *
+ * @param - execution
+ *
+ */
+ public void preProcessRequest(Execution execution) {
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ execution.setVariable("prefix",Prefix)
+ utils.log("DEBUG", " *** STARTED GenericGetService PreProcessRequest Process*** ", isDebugEnabled)
+
+ execution.setVariable("GENGS_obtainObjectsUrl", false)
+ execution.setVariable("GENGS_obtainServiceInstanceUrlByName", false)
+ execution.setVariable("GENGS_SuccessIndicator", false)
+ execution.setVariable("GENGS_FoundIndicator", false)
+ execution.setVariable("GENGS_resourceLink", null)
+ execution.setVariable("GENGS_siResourceLink", null)
+
+ try{
+ // Get Variables
+ String allottedResourceId = execution.getVariable("GENGS_allottedResourceId")
+ String serviceInstanceId = execution.getVariable("GENGS_serviceInstanceId")
+ String serviceInstanceName = execution.getVariable("GENGS_serviceInstanceName")
+ String serviceType = execution.getVariable("GENGS_serviceType")
+ String globalCustomerId = execution.getVariable("GENGS_globalCustomerId")
+ String type = execution.getVariable("GENGS_type")
+
+ if(type != null){
+ utils.log("DEBUG", "Incoming GENGS_type is: " + type, isDebugEnabled)
+ if(type.equalsIgnoreCase("allotted-resource")){
+ if(isBlank(allottedResourceId)){
+ utils.log("DEBUG", "Incoming allottedResourceId is null. Allotted Resource Id is required to Get an allotted-resource.", isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming allottedResourceId is null. Allotted Resource Id is required to Get an allotted-resource.")
+ }else{
+ utils.log("DEBUG", "Incoming Allotted Resource Id is: " + allottedResourceId, isDebugEnabled)
+ if(isBlank(globalCustomerId) || isBlank(serviceType) || isBlank(serviceInstanceId)){
+ execution.setVariable("GENGS_obtainObjectsUrl", true)
+ }else{
+ utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugEnabled)
+ utils.log("DEBUG", "Incoming Service Type is: " + serviceType, isDebugEnabled)
+ utils.log("DEBUG", "Incoming Global Customer Id is: " + globalCustomerId, isDebugEnabled)
+ }
+ }
+ }else if(type.equalsIgnoreCase("service-instance")){
+ if(isBlank(serviceInstanceId) && isBlank(serviceInstanceName)){
+ utils.log("DEBUG", "Incoming serviceInstanceId and serviceInstanceName are null. ServiceInstanceId or ServiceInstanceName is required to Get a service-instance.", isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming serviceInstanceId and serviceInstanceName are null. ServiceInstanceId or ServiceInstanceName is required to Get a service-instance.")
+ }else{
+ utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugEnabled)
+ utils.log("DEBUG", "Incoming Service Instance Name is: " + serviceInstanceName, isDebugEnabled)
+ if(isBlank(globalCustomerId) || isBlank(serviceType)){
+ execution.setVariable("GENGS_obtainObjectsUrl", true)
+ if(isBlank(serviceInstanceId)){
+ execution.setVariable("GENGS_obtainServiceInstanceUrlByName", true)
+ }
+ }else{
+ utils.log("DEBUG", "Incoming Global Customer Id is: " + globalCustomerId, isDebugEnabled)
+ utils.log("DEBUG", "Incoming Service Type is: " + serviceType, isDebugEnabled)
+ }
+ }
+ }else if(type.equalsIgnoreCase("service-subscription")){
+ if(isBlank(serviceType) || isBlank(globalCustomerId)){
+ utils.log("DEBUG", "Incoming ServiceType or GlobalCustomerId is null. These variables are required to Get a service-subscription.", isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming ServiceType or GlobalCustomerId is null. These variables are required to Get a service-subscription.")
+ }else{
+ utils.log("DEBUG", "Incoming Service Type is: " + serviceType, isDebugEnabled)
+ utils.log("DEBUG", "Incoming Global Customer Id is: " + globalCustomerId, isDebugEnabled)
+ }
+ }else{
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Type is Invalid. Please Specify Type as service-instance or service-subscription")
+ }
+ }else{
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Incoming GENGS_type is null. Variable is Required.")
+ }
+
+ }catch(BpmnError b){
+ utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled)
+ throw b
+ }catch(Exception e){
+ utils.log("DEBUG", "Internal Error encountered within GenericGetService PreProcessRequest method!" + e, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in GenericGetService PreProcessRequest")
+
+ }
+ utils.log("DEBUG", "*** COMPLETED GenericGetService PreProcessRequest Process ***", isDebugEnabled)
+ }
+
+ /**
+ * This method obtains the Url to the provided service instance
+ * using the Service Instance Id.
+ *
+ * @param - execution
+ */
+ public void obtainServiceInstanceUrlById(Execution execution){
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ execution.setVariable("prefix",Prefix)
+ utils.log("DEBUG", " *** STARTED GenericGetService ObtainServiceInstanceUrlById Process*** ", isDebugEnabled)
+ try {
+ AaiUtil aaiUriUtil = new AaiUtil(this)
+ String aai_uri = aaiUriUtil.getSearchNodesQueryEndpoint(execution)
+ String aai_endpoint = execution.getVariable("URN_aai_endpoint")
+
+ String type = execution.getVariable("GENGS_type")
+ String path = ""
+ if(type.equalsIgnoreCase("service-instance")){
+ String serviceInstanceId = execution.getVariable("GENGS_serviceInstanceId")
+ utils.log("DEBUG", " Querying Node for Service-Instance URL by using Service-Instance Id: " + serviceInstanceId, isDebugEnabled)
+ path = "${aai_uri}?search-node-type=service-instance&filter=service-instance-id:EQUALS:${serviceInstanceId}"
+ utils.logAudit("Service Instance Node Query Url is: " + path)
+ utils.log("DEBUG", "Service Instance Node Query Url is: " + path, isDebugEnabled)
+ }else if(type.equalsIgnoreCase("allotted-resource")){
+ String allottedResourceId = execution.getVariable("GENGS_allottedResourceId")
+ utils.log("DEBUG", " Querying Node for Service-Instance URL by using Allotted Resource Id: " + allottedResourceId, isDebugEnabled)
+ path = "${aai_uri}?search-node-type=allotted-resource&filter=id:EQUALS:${allottedResourceId}"
+ utils.logAudit("Allotted Resource Node Query Url is: " + path)
+ utils.log("DEBUG", "Allotted Resource Node Query Url is: " + path, isDebugEnabled)
+ }
+
+ //String url = "${aai_endpoint}${path}" host name needs to be removed from property
+ String url = "${path}"
+ execution.setVariable("GENGS_genericQueryPath", url)
+
+ APIResponse response = aaiUriUtil.executeAAIGetCall(execution, url)
+ int responseCode = response.getStatusCode()
+ execution.setVariable("GENGS_genericQueryResponseCode", responseCode)
+ utils.log("DEBUG", " GET Service Instance response code is: " + responseCode, isDebugEnabled)
+ utils.logAudit("GenericGetService AAI GET Response Code: " + responseCode)
+
+ String aaiResponse = response.getResponseBodyAsString()
+ execution.setVariable("GENGS_obtainSIUrlResponseBeforeUnescaping", aaiResponse)
+ utils.log("DEBUG", "GenericGetService AAI Response before unescaping: " + aaiResponse, isDebugEnabled)
+ aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse)
+ execution.setVariable("GENGS_genericQueryResponse", aaiResponse)
+ utils.logAudit("GenericGetService AAI Response: " + aaiResponse)
+ utils.log("DEBUG", "GenericGetService AAI Response: " + aaiResponse, isDebugEnabled)
+
+ //Process Response
+ if(responseCode == 200){
+ utils.log("DEBUG", "Generic Query Received a Good Response Code", isDebugEnabled)
+ execution.setVariable("GENGS_SuccessIndicator", true)
+ if(utils.nodeExists(aaiResponse, "result-data")){
+ utils.log("DEBUG", "Generic Query Response Does Contain Data" , isDebugEnabled)
+ execution.setVariable("GENGS_FoundIndicator", true)
+ String resourceLink = utils.getNodeText1(aaiResponse, "resource-link")
+ execution.setVariable("GENGS_resourceLink", resourceLink)
+ execution.setVariable("GENGS_siResourceLink", resourceLink)
+ }else{
+ utils.log("DEBUG", "Generic Query Response Does NOT Contains Data" , isDebugEnabled)
+ execution.setVariable("WorkflowResponse", " ") //for junits
+ }
+ }else if(responseCode == 404){
+ utils.log("DEBUG", "Generic Query Received a Not Found (404) Response", isDebugEnabled)
+ execution.setVariable("GENGS_SuccessIndicator", true)
+ execution.setVariable("WorkflowResponse", " ") //for junits
+ }else{
+ utils.log("DEBUG", "Generic Query Received a BAD REST Response: \n" + aaiResponse, isDebugEnabled)
+ exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode)
+ throw new BpmnError("MSOWorkflowException")
+ }
+ }catch(BpmnError b){
+ utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled)
+ throw b
+ }catch(Exception e){
+ utils.log("ERROR", " Error encountered within GenericGetService ObtainServiceInstanceUrlById method!" + e, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During ObtainServiceInstanceUrlById")
+ }
+ utils.log("DEBUG", " *** COMPLETED GenericGetService ObtainServiceInstanceUrlById Process*** ", isDebugEnabled)
+ }
+
+ /**
+ * This method obtains the Url to the provided service instance
+ * using the Service Instance Name.
+ *
+ * @param - execution
+ */
+ public void obtainServiceInstanceUrlByName(Execution execution){
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ execution.setVariable("prefix",Prefix)
+ utils.log("DEBUG", " *** STARTED GenericGetService ObtainServiceInstanceUrlByName Process*** ", isDebugEnabled)
+ try {
+ String serviceInstanceName = execution.getVariable("GENGS_serviceInstanceName")
+ utils.log("DEBUG", " Querying Node for Service-Instance URL by using Service-Instance Name " + serviceInstanceName, isDebugEnabled)
+
+ AaiUtil aaiUriUtil = new AaiUtil(this)
+ String aai_uri = aaiUriUtil.getSearchNodesQueryEndpoint(execution)
+ String aai_endpoint = execution.getVariable("URN_aai_endpoint")
+ String path = "${aai_uri}?search-node-type=service-instance&filter=service-instance-name:EQUALS:${serviceInstanceName}"
+
+ //String url = "${aai_endpoint}${path}" host name needs to be removed from property
+ String url = "${path}"
+ execution.setVariable("GENGS_obtainSIUrlPath", url)
+
+ utils.logAudit("GenericGetService AAI Endpoint: " + aai_endpoint)
+ APIResponse response = aaiUriUtil.executeAAIGetCall(execution, url)
+ int responseCode = response.getStatusCode()
+ execution.setVariable("GENGS_obtainSIUrlResponseCode", responseCode)
+ utils.log("DEBUG", " GET Service Instance response code is: " + responseCode, isDebugEnabled)
+ utils.logAudit("GenericGetService AAI Response Code: " + responseCode)
+
+ String aaiResponse = response.getResponseBodyAsString()
+ aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse)
+ execution.setVariable("GENGS_obtainSIUrlResponse", aaiResponse)
+ utils.logAudit("GenericGetService AAI Response: " + aaiResponse)
+ //Process Response
+ if(responseCode == 200){
+ utils.log("DEBUG", " Query for Service Instance Url Received a Good Response Code", isDebugEnabled)
+ execution.setVariable("GENGS_SuccessIndicator", true)
+ if(utils.nodeExists(aaiResponse, "result-data")){
+ utils.log("DEBUG", "Query for Service Instance Url Response Does Contain Data" , isDebugEnabled)
+ execution.setVariable("GENGS_FoundIndicator", true)
+ String resourceLink = utils.getNodeText1(aaiResponse, "resource-link")
+ execution.setVariable("GENGS_resourceLink", resourceLink)
+ execution.setVariable("GENGS_siResourceLink", resourceLink)
+ }else{
+ utils.log("DEBUG", "Query for Service Instance Url Response Does NOT Contains Data" , isDebugEnabled)
+ execution.setVariable("WorkflowResponse", " ") //for junits
+ }
+ }else if(responseCode == 404){
+ utils.log("DEBUG", " Query for Service Instance Received a Not Found (404) Response", isDebugEnabled)
+ execution.setVariable("GENGS_SuccessIndicator", true)
+ execution.setVariable("WorkflowResponse", " ") //for junits
+ }else{
+ utils.log("DEBUG", "Query for Service Instance Received a BAD REST Response: \n" + aaiResponse, isDebugEnabled)
+ exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode)
+ throw new BpmnError("MSOWorkflowException")
+ }
+ }catch(BpmnError b){
+ utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled)
+ throw b
+ }catch(Exception e){
+ utils.log("ERROR", " Error encountered within GenericGetService ObtainServiceInstanceUrlByName method!" + e, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During ObtainServiceInstanceUrlByName")
+ }
+ utils.log("DEBUG", " *** COMPLETED GenericGetService ObtainServiceInstanceUrlByName Process*** ", isDebugEnabled)
+ }
+
+
+ /**
+ * This method executes a GET call to AAI to obtain the
+ * service-instance or service-subscription
+ *
+ * @param - execution
+ */
+ public void getServiceObject(Execution execution){
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ execution.setVariable("prefix",Prefix)
+ utils.log("DEBUG", " *** STARTED GenericGetService GetServiceObject Process*** ", isDebugEnabled)
+ try {
+ String type = execution.getVariable("GENGS_type")
+ AaiUtil aaiUriUtil = new AaiUtil(this)
+ String aai_endpoint = execution.getVariable("URN_aai_endpoint")
+ String serviceEndpoint = ""
+
+ utils.logAudit("GenericGetService getServiceObject AAI Endpoint: " + aai_endpoint)
+ if(type.equalsIgnoreCase("service-instance")){
+ String siResourceLink = execution.getVariable("GENGS_resourceLink")
+ if(isBlank(siResourceLink)){
+ String serviceInstanceId = execution.getVariable("GENGS_serviceInstanceId")
+ utils.log("DEBUG", " Incoming GENGS_serviceInstanceId is: " + serviceInstanceId, isDebugEnabled)
+ String serviceType = execution.getVariable("GENGS_serviceType")
+ utils.log("DEBUG", " Incoming GENGS_serviceType is: " + serviceType, isDebugEnabled)
+ String globalCustomerId = execution.getVariable("GENGS_globalCustomerId")
+ utils.log("DEBUG", "Incoming Global Customer Id is: " + globalCustomerId, isDebugEnabled)
+
+ String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution)
+ logDebug('AAI URI is: ' + aai_uri, isDebugEnabled)
+ serviceEndpoint = "${aai_uri}/" + UriUtils.encode(globalCustomerId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") + "/service-instances/service-instance/" + UriUtils.encode(serviceInstanceId,"UTF-8")
+ }else{
+ utils.log("DEBUG", "Incoming Service Instance Url is: " + siResourceLink, isDebugEnabled)
+ String[] split = siResourceLink.split("/aai/")
+ serviceEndpoint = "/aai/" + split[1]
+ }
+ }else if(type.equalsIgnoreCase("allotted-resource")){
+ String siResourceLink = execution.getVariable("GENGS_resourceLink")
+ if(isBlank(siResourceLink)){
+ String allottedResourceId = execution.getVariable("GENGS_allottedResourceId")
+ utils.log("DEBUG", " Incoming GENGS_allottedResourceId is: " + allottedResourceId, isDebugEnabled)
+ String serviceInstanceId = execution.getVariable("GENGS_serviceInstanceId")
+ utils.log("DEBUG", " Incoming GENGS_serviceInstanceId is: " + serviceInstanceId, isDebugEnabled)
+ String serviceType = execution.getVariable("GENGS_serviceType")
+ utils.log("DEBUG", " Incoming GENGS_serviceType is: " + serviceType, isDebugEnabled)
+ String globalCustomerId = execution.getVariable("GENGS_globalCustomerId")
+ utils.log("DEBUG", "Incoming Global Customer Id is: " + globalCustomerId, isDebugEnabled)
+
+ String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution)
+ logDebug('AAI URI is: ' + aai_uri, isDebugEnabled)
+ serviceEndpoint = "${aai_uri}/" + UriUtils.encode(globalCustomerId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") + "/service-instances/service-instance/" + UriUtils.encode(serviceInstanceId,"UTF-8") + "/allotted-resources/allotted-resource/" + UriUtils.encode(allottedResourceId,"UTF-8")
+ }else{
+ utils.log("DEBUG", "Incoming Allotted-Resource Url is: " + siResourceLink, isDebugEnabled)
+ String[] split = siResourceLink.split("/aai/")
+ serviceEndpoint = "/aai/" + split[1]
+ }
+ }else if(type.equalsIgnoreCase("service-subscription")){
+ String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution)
+ String globalCustomerId = execution.getVariable("GENGS_globalCustomerId")
+ String serviceType = execution.getVariable("GENGS_serviceType")
+ serviceEndpoint = "${aai_uri}/" + UriUtils.encode(globalCustomerId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8")
+ }
+
+ String serviceUrl = "${aai_endpoint}" + serviceEndpoint
+
+ execution.setVariable("GENGS_getServiceUrl", serviceUrl)
+ utils.log("DEBUG", "GET Service AAI Path is: \n" + serviceUrl, isDebugEnabled)
+
+ APIResponse response = aaiUriUtil.executeAAIGetCall(execution, serviceUrl)
+ int responseCode = response.getStatusCode()
+ execution.setVariable("GENGS_getServiceResponseCode", responseCode)
+ utils.log("DEBUG", " GET Service response code is: " + responseCode, isDebugEnabled)
+ utils.logAudit("GenericGetService AAI Response Code: " + responseCode)
+
+ String aaiResponse = response.getResponseBodyAsString()
+ aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse)
+ execution.setVariable("GENGS_getServiceResponse", aaiResponse)
+ utils.logAudit("GenericGetService AAI Response: " + aaiResponse)
+ //Process Response
+ if(responseCode == 200 || responseCode == 202){
+ utils.log("DEBUG", "GET Service Received a Good Response Code", isDebugEnabled)
+ if(utils.nodeExists(aaiResponse, "service-instance") || utils.nodeExists(aaiResponse, "service-subscription")){
+ utils.log("DEBUG", "GET Service Response Contains a service-instance" , isDebugEnabled)
+ execution.setVariable("GENGS_FoundIndicator", true)
+ execution.setVariable("GENGS_service", aaiResponse)
+ execution.setVariable("WorkflowResponse", aaiResponse)
+
+ }else{
+ utils.log("DEBUG", "GET Service Response Does NOT Contain Data" , isDebugEnabled)
+ }
+ }else if(responseCode == 404){
+ utils.log("DEBUG", "GET Service Received a Not Found (404) Response", isDebugEnabled)
+ execution.setVariable("WorkflowResponse", " ") //for junits
+ }
+ else{
+ utils.log("DEBUG", " GET Service Received a Bad Response: \n" + aaiResponse, isDebugEnabled)
+ exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode)
+ throw new BpmnError("MSOWorkflowException")
+ }
+ }catch(BpmnError b){
+ utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled)
+ throw b
+ }catch(Exception e){
+ utils.log("DEBUG", " Error encountered within GenericGetService GetServiceObject method!" + e, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During GenericGetService")
+ }
+ utils.log("DEBUG", " *** COMPLETED GenericGetService GetServiceObject Process*** ", isDebugEnabled)
+ }
+
+}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CustomE2EPutService.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CustomE2EPutService.groovy new file mode 100644 index 0000000000..eaccdc0e27 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CustomE2EPutService.groovy @@ -0,0 +1,280 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.openecomp.mso.bpmn.common.scripts + +import static org.apache.commons.lang3.StringUtils.*; + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.runtime.Execution; +import org.apache.commons.codec.binary.Base64 +import org.apache.commons.lang3.* + +import org.openecomp.mso.bpmn.core.json.JsonUtils +import org.openecomp.mso.bpmn.core.WorkflowException +import org.openecomp.mso.rest.APIResponse; +import org.openecomp.mso.rest.RESTClient +import org.openecomp.mso.rest.RESTConfig + +import java.net.URLEncoder; +import org.springframework.web.util.UriUtils + +/** + * This class supports the GenericPutService Sub Flow. + * This Generic sub flow can be used by any flow for the + * goal of creating a Service Instance or Service-Subscription in AAI. Upon successful completion of + * this sub flow the GENPS_SuccessIndicator will be true. + * The calling flow must set the GENPS_type variable as "service-instance" + * or "service-subscription". + * A MSOWorkflowException will be thrown Upon unsuccessful + * completion or if an error occurs within this flow. + * Please map variables to the corresponding variable names + * below. + * + * + * Incoming Required Variables: + * @param - GENPS_requestId + * @param - GENPS_type - Required field. This will be required field populated as service-instance or service-subscription + * @param - GENPS_globalSubscriberId - Required field + * @param - GENPS_serviceType - Required Field + * @param - GENPS_payload - Required Field This will be the payload that needs to be sent. + * + * @param - GENPS_serviceInstanceId - Conditional Field. Required for service-instance. + * @param - GENPS_allottedResourceId - Conditional Field. Required for allotted-resource. + * @param - GENPS_tunnelXconnectId - Conditional Field. Required for tunnel-xconnect. + * + * @param - GENPS_serviceResourceVersion - Conditional Field. Needs to be provided only in case of update for both service-instance and service subscription. The calling flows + * should check if a service-instance or servic-subscription exists by calling the subflow GenericGetService. if it exists then resourceversion should be + * obtained from aai and sent as an input parameter. + * + * Outgoing Variables: + * @param - GENPS_SuccessIndicator + * @param - WorkflowException + * + * + */ + + +class CustomE2EPutService extends AbstractServiceTaskProcessor{ + + String Prefix = "GENPS_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + + + public void preProcessRequest(Execution execution) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + utils.log("DEBUG", " *** STARTED GenericPutService PreProcessRequest Process*** ", isDebugEnabled) + + execution.setVariable("GENPS_SuccessIndicator", false) + + try{ + // Get Variables + String requestId = execution.getVariable("GENPS_requestId") + utils.log("DEBUG", "Incoming GENPS_requestId is: " + requestId, isDebugEnabled) + + String globalSubscriberId = execution.getVariable("GENPS_globalSubscriberId") + String serviceInstanceId = execution.getVariable("GENPS_serviceInstanceId") + String serviceType = execution.getVariable("GENPS_serviceType") + String allottedResourceId = execution.getVariable("GENPS_allottedResourceId") + String tunnelXconnectId = execution.getVariable("GENPS_tunnelXconnectId") + String type = execution.getVariable("GENPS_type") + + if(type != null){ + utils.log("DEBUG", "Incoming GENPS_type is: " + type, isDebugEnabled) + if(type.equalsIgnoreCase("service-instance")){ + if(isBlank(globalSubscriberId) || isBlank(serviceType) || isBlank(serviceInstanceId)){ + utils.log("DEBUG", "Incoming Required Variable is missing or null!", isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Required Variable is Missing or Null!") + }else{ + utils.log("DEBUG", "Incoming Global Subscriber Id is: " + globalSubscriberId, isDebugEnabled) + utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugEnabled) + utils.log("DEBUG", "Incoming Service Type is: " + serviceType, isDebugEnabled) + } + }else if(type.equalsIgnoreCase("service-subscription")){ + if(isBlank(serviceType) || isBlank(globalSubscriberId)){ + utils.log("DEBUG", "Incoming ServiceType or GlobalSubscriberId is null. These variables are required to create a service-subscription.", isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming ServiceType or GlobalCustomerId is null. These variables are required to Get a service-subscription.") + }else{ + utils.log("DEBUG", "Incoming Service Type is: " + serviceType, isDebugEnabled) + utils.log("DEBUG", "Incoming Global Subscriber Id is: " + globalSubscriberId, isDebugEnabled) + } + }else if(type.equalsIgnoreCase("allotted-resource")){ + if(isBlank(globalSubscriberId) || isBlank(serviceType) || isBlank(serviceInstanceId) || isBlank(allottedResourceId)){ + utils.log("DEBUG", "Incoming Global Subscriber Id is: " + globalSubscriberId, isDebugEnabled) + utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugEnabled) + utils.log("DEBUG", "Incoming Service Type is: " + serviceType, isDebugEnabled) + utils.log("DEBUG", "Incoming Allotted Resource Id is: " + allottedResourceId, isDebugEnabled) + utils.log("DEBUG", "Incoming Required Variable is missing or null!", isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Required Variable is Missing or Null!") + }else{ + utils.log("DEBUG", "Incoming Global Subscriber Id is: " + globalSubscriberId, isDebugEnabled) + utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugEnabled) + utils.log("DEBUG", "Incoming Service Type is: " + serviceType, isDebugEnabled) + utils.log("DEBUG", "Incoming Allotted Resource Id is: " + allottedResourceId, isDebugEnabled) + } + }else if(type.equalsIgnoreCase("tunnel-xconnect")){ + if(isBlank(globalSubscriberId) || isBlank(serviceType) || isBlank(serviceInstanceId) || isBlank(allottedResourceId) || isBlank(tunnelXconnectId)){ + utils.log("DEBUG", "Incoming Global Subscriber Id is: " + globalSubscriberId, isDebugEnabled) + utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugEnabled) + utils.log("DEBUG", "Incoming Service Type is: " + serviceType, isDebugEnabled) + utils.log("DEBUG", "Incoming Allotted Resource Id is: " + allottedResourceId, isDebugEnabled) + utils.log("DEBUG", "Incoming Tunnel Xconnect Id is: " + tunnelXconnectId, isDebugEnabled) + utils.log("DEBUG", "Incoming Required Variable is missing or null!", isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Required Variable is Missing or Null!") + }else{ + utils.log("DEBUG", "Incoming Global Subscriber Id is: " + globalSubscriberId, isDebugEnabled) + utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugEnabled) + utils.log("DEBUG", "Incoming Service Type is: " + serviceType, isDebugEnabled) + utils.log("DEBUG", "Incoming Allotted Resource Id is: " + allottedResourceId, isDebugEnabled) + utils.log("DEBUG", "Incoming Tunnel Xconnect Id is: " + tunnelXconnectId, isDebugEnabled) + } + }else{ + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Type is Invalid. Please Specify Type as service-instance or service-subscription") + } + }else{ + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Incoming GENPS_type is null. Variable is Required.") + } + + }catch(BpmnError b){ + utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled) + throw b + }catch(Exception e){ + utils.log("ERROR", " Error encountered within GenericPutService PreProcessRequest method!" + e, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in GenericPutService PreProcessRequest") + + } + utils.log("DEBUG", "*** COMPLETED GenericPutService PreProcessRequest Process ***", isDebugEnabled) + + } + + + + /** + * This method executes a Put call to AAI for the provided + * service instance. + * + * @param - execution + * + */ + public void putServiceInstance(Execution execution){ + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + utils.log("DEBUG", " *** STARTED GenericPutService PutServiceInstance method*** ", isDebugEnabled) + try { + String type = execution.getVariable("GENPS_type") + + AaiUtil aaiUriUtil = new AaiUtil(this) + String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution) + logDebug('AAI URI is: ' + aai_uri, isDebugEnabled) + String namespace = aaiUriUtil.getNamespaceFromUri(execution, aai_uri) + logDebug('AAI namespace is: ' + namespace, isDebugEnabled) + + String aai_endpoint = execution.getVariable("URN_aai_endpoint") + String serviceAaiPath = "" + String payload = execution.getVariable("GENPS_payload") + execution.setVariable("GENPS_payload", payload) + utils.log("DEBUG", "Incoming GENPS_payload is: " + payload, isDebugEnabled) + utils.logAudit(payload) + + String serviceType = execution.getVariable("GENPS_serviceType") + utils.log("DEBUG", " Incoming GENPS_serviceType is: " + serviceType, isDebugEnabled) + String globalSubscriberId = execution.getVariable("GENPS_globalSubscriberId") + utils.log("DEBUG", "Incoming Global Subscriber Id is: " + globalSubscriberId, isDebugEnabled) + + // This IF clause is if we need to create a new Service Instance + if(type.equalsIgnoreCase("service-instance")){ + + String serviceInstanceId = execution.getVariable("GENPS_serviceInstanceId") + utils.log("DEBUG", " Incoming GENPS_serviceInstanceId is: " + serviceInstanceId, isDebugEnabled) + + // serviceAaiPath = "${aai_endpoint}${aai_uri}/" + URLEncoder.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + URLEncoder.encode(serviceType,"UTF-8") + "/service-instances/service-instance/" + URLEncoder.encode(serviceInstanceId,"UTF-8") + serviceAaiPath = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") + "/service-instances/service-instance/" + UriUtils.encode(serviceInstanceId,"UTF-8") + + }else if(type.equalsIgnoreCase("service-subscription")){ + + // serviceAaiPath = "${aai_endpoint}${aai_uri}/" + URLEncoder.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + URLEncoder.encode(serviceType,"UTF-8") + serviceAaiPath = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") + }else if(type.equalsIgnoreCase("allotted-resource")){ + + String serviceInstanceId = execution.getVariable("GENPS_serviceInstanceId") + utils.log("DEBUG", " Incoming GENPS_serviceInstanceId is: " + serviceInstanceId, isDebugEnabled) + String allottedResourceId = execution.getVariable("GENPS_allottedResourceId") + utils.log("DEBUG", " Incoming GENPS_allottedResourceId is: " + allottedResourceId, isDebugEnabled) + + // serviceAaiPath = "${aai_endpoint}${aai_uri}/" + URLEncoder.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + URLEncoder.encode(serviceType,"UTF-8") + serviceAaiPath = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") + "/service-instances/service-instance/" + UriUtils.encode(serviceInstanceId,"UTF-8") + "/allotted-resources/allotted-resource/" + UriUtils.encode(allottedResourceId,"UTF-8") + }else if(type.equalsIgnoreCase("tunnel-xconnect")){ + + String serviceInstanceId = execution.getVariable("GENPS_serviceInstanceId") + utils.log("DEBUG", " Incoming GENPS_serviceInstanceId is: " + serviceInstanceId, isDebugEnabled) + String allottedResourceId = execution.getVariable("GENPS_allottedResourceId") + utils.log("DEBUG", " Incoming GENPS_allottedResourceId is: " + allottedResourceId, isDebugEnabled) + String tunnelXconnectId = execution.getVariable("GENPS_tunnelXconnectId") + utils.log("DEBUG", " Incoming GENPS_tunnelXconnectId is: " + tunnelXconnectId, isDebugEnabled) + + // serviceAaiPath = "${aai_endpoint}${aai_uri}/" + URLEncoder.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + URLEncoder.encode(serviceType,"UTF-8") + serviceAaiPath = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(globalSubscriberId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") + "/service-instances/service-instance/" + UriUtils.encode(serviceInstanceId,"UTF-8") + "/allotted-resources/allotted-resource/" + UriUtils.encode(allottedResourceId,"UTF-8") + "/tunnel-xconnects/tunnel-xconnect/" + UriUtils.encode(tunnelXconnectId,"UTF-8") + } + + String resourceVersion = execution.getVariable("GENPS_serviceResourceVersion") + utils.log("DEBUG", "Incoming Resource Version is: " + resourceVersion, isDebugEnabled) + if(resourceVersion !=null){ + serviceAaiPath = serviceAaiPath +'?resource-version=' + UriUtils.encode(resourceVersion,"UTF-8") + } + + execution.setVariable("GENPS_putServiceInstanceAaiPath", serviceAaiPath) + utils.log("DEBUG", "PUT Service Instance AAI Path is: " + "\n" + serviceAaiPath, isDebugEnabled) + + APIResponse response = aaiUriUtil.executeAAIPutCall(execution, serviceAaiPath, payload) + int responseCode = response.getStatusCode() + execution.setVariable("GENPS_putServiceInstanceResponseCode", responseCode) + utils.log("DEBUG", " Put Service Instance response code is: " + responseCode, isDebugEnabled) + + String aaiResponse = response.getResponseBodyAsString() + aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse) + execution.setVariable("GENPS_putServiceInstanceResponse", aaiResponse) + + + //Process Response + if(responseCode == 200 || responseCode == 201 || responseCode == 202 ) + //200 OK 201 CREATED 202 ACCEPTED + { + utils.log("DEBUG", "PUT Service Instance Received a Good Response", isDebugEnabled) + execution.setVariable("GENPS_SuccessIndicator", true) + } + + else{ + utils.log("DEBUG", "Put Generic Service Instance Received a Bad Response Code. Response Code is: " + responseCode, isDebugEnabled) + exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode) + throw new BpmnError("MSOWorkflowException") + } + }catch(BpmnError b){ + utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled) + throw b + }catch(Exception e){ + utils.log("ERROR", " Error encountered within GenericPutService PutServiceInstance method!" + e, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During Put Service Instance") + } + utils.log("DEBUG", " *** COMPLETED GenericPutService PutServiceInstance Process*** ", isDebugEnabled) + } + + + +} diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CustomE2EGetService.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CustomE2EGetService.bpmn new file mode 100644 index 0000000000..28ba0363cb --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CustomE2EGetService.bpmn @@ -0,0 +1,321 @@ +<?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="_D5VzAHElEeaJwpcpVN5gXw" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> + <bpmn2:process id="GenericGetService" name="GenericGetService" isExecutable="true"> + <bpmn2:scriptTask id="intialization" name="Initialization" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_2</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* +CustomE2EGetService getService = new CustomE2EGetService() +getService.preProcessRequest(execution) +]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_2" name="" sourceRef="intialization" targetRef="getUrl" /> + <bpmn2:exclusiveGateway id="getUrl" name="Need Object's Url?" default="getUrlNo"> + <bpmn2:incoming>SequenceFlow_2</bpmn2:incoming> + <bpmn2:outgoing>getUrlYes</bpmn2:outgoing> + <bpmn2:outgoing>getUrlNo</bpmn2:outgoing> + </bpmn2:exclusiveGateway> + <bpmn2:sequenceFlow id="getUrlYes" name="Yes" sourceRef="getUrl" targetRef="obtain"> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("GENGS_obtainObjectsUrl" ) == true}]]></bpmn2:conditionExpression> + </bpmn2:sequenceFlow> + <bpmn2:sequenceFlow id="getUrlNo" name="No" sourceRef="getUrl" targetRef="ExclusiveGateway_2" /> + <bpmn2:subProcess id="bpmnExceptionHandlingSubProcess" name="Error Handling Sub Process" triggeredByEvent="true"> + <bpmn2:scriptTask id="processBPMNException" name="Process Error" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_7</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_8</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_8" name="" sourceRef="processBPMNException" targetRef="EndEvent_2" /> + <bpmn2:startEvent id="StartEvent_2"> + <bpmn2:outgoing>SequenceFlow_7</bpmn2:outgoing> + <bpmn2:errorEventDefinition id="ErrorEventDefinition_1" /> + </bpmn2:startEvent> + <bpmn2:sequenceFlow id="SequenceFlow_7" name="" sourceRef="StartEvent_2" targetRef="processBPMNException" /> + <bpmn2:endEvent id="EndEvent_2"> + <bpmn2:incoming>SequenceFlow_8</bpmn2:incoming> + </bpmn2:endEvent> + </bpmn2:subProcess> + <bpmn2:scriptTask id="toggleSuccess" name="Toggle Success Indicator" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_3</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_6</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* +CustomE2EGetService getService = new CustomE2EGetService() +getService.setSuccessIndicator(execution, true) +]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_6" name="" sourceRef="toggleSuccess" targetRef="EndEvent_1" /> + <bpmn2:scriptTask id="getServiceInstance" name="GET Object" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_5</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_3</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* +CustomE2EGetService getService = new CustomE2EGetService() +getService.getServiceObject(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_3" name="" sourceRef="getServiceInstance" targetRef="toggleSuccess" /> + <bpmn2:exclusiveGateway id="ExclusiveGateway_2"> + <bpmn2:incoming>getUrlNo</bpmn2:incoming> + <bpmn2:incoming>foundYes</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_5</bpmn2:outgoing> + </bpmn2:exclusiveGateway> + <bpmn2:sequenceFlow id="SequenceFlow_5" name="" sourceRef="ExclusiveGateway_2" targetRef="getServiceInstance" /> + <bpmn2:scriptTask id="obtainServiceUrlById" name="Node Query Using Id " scriptFormat="groovy"> + <bpmn2:incoming>obtainById</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_4</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* +CustomE2EGetService getService = new CustomE2EGetService() +getService.obtainServiceInstanceUrlById(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_4" name="" sourceRef="obtainServiceUrlById" targetRef="ExclusiveGateway_3" /> + <bpmn2:scriptTask id="obtainServiceUrlByName" name="Node Query Using Name" scriptFormat="groovy"> + <bpmn2:incoming>obtainByName</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_13</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* +CustomE2EGetService getService = new CustomE2EGetService() +getService.obtainServiceInstanceUrlByName(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_13" name="" sourceRef="obtainServiceUrlByName" targetRef="ExclusiveGateway_3" /> + <bpmn2:exclusiveGateway id="obtain" name="Query By?" default="obtainById"> + <bpmn2:incoming>getUrlYes</bpmn2:incoming> + <bpmn2:outgoing>obtainById</bpmn2:outgoing> + <bpmn2:outgoing>obtainByName</bpmn2:outgoing> + </bpmn2:exclusiveGateway> + <bpmn2:sequenceFlow id="obtainById" name="Id" sourceRef="obtain" targetRef="obtainServiceUrlById" /> + <bpmn2:sequenceFlow id="obtainByName" name="Name" sourceRef="obtain" targetRef="obtainServiceUrlByName"> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("GENGS_obtainServiceInstanceUrlByName" ) == true}]]></bpmn2:conditionExpression> + </bpmn2:sequenceFlow> + <bpmn2:exclusiveGateway id="serviceFoundCheck" name="Service Exist?" default="notFound"> + <bpmn2:incoming>SequenceFlow_14</bpmn2:incoming> + <bpmn2:outgoing>foundYes</bpmn2:outgoing> + <bpmn2:outgoing>notFound</bpmn2:outgoing> + </bpmn2:exclusiveGateway> + <bpmn2:sequenceFlow id="foundYes" name="Yes" sourceRef="serviceFoundCheck" targetRef="ExclusiveGateway_2"> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("GENGS_FoundIndicator" ) == true}]]></bpmn2:conditionExpression> + </bpmn2:sequenceFlow> + <bpmn2:sequenceFlow id="notFound" name="No" sourceRef="serviceFoundCheck" targetRef="EndEvent_3" /> + <bpmn2:endEvent id="EndEvent_3"> + <bpmn2:incoming>notFound</bpmn2:incoming> + <bpmn2:terminateEventDefinition id="_TerminateEventDefinition_29" /> + </bpmn2:endEvent> + <bpmn2:exclusiveGateway id="ExclusiveGateway_3"> + <bpmn2:incoming>SequenceFlow_4</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_13</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_14</bpmn2:outgoing> + </bpmn2:exclusiveGateway> + <bpmn2:sequenceFlow id="SequenceFlow_14" name="" sourceRef="ExclusiveGateway_3" targetRef="serviceFoundCheck" /> + <bpmn2:endEvent id="EndEvent_1"> + <bpmn2:incoming>SequenceFlow_6</bpmn2:incoming> + <bpmn2:terminateEventDefinition id="_TerminateEventDefinition_26" /> + </bpmn2:endEvent> + <bpmn2:startEvent id="StartEvent_1"> + <bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing> + </bpmn2:startEvent> + <bpmn2:sequenceFlow id="SequenceFlow_1" name="" sourceRef="StartEvent_1" targetRef="intialization" /> + </bpmn2:process> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="GenericGetService"> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_69" bpmnElement="StartEvent_1"> + <dc:Bounds x="108" y="264" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="126" y="305" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_288" bpmnElement="intialization"> + <dc:Bounds x="228" y="242" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="_BPMNShape_StartEvent_69" targetElement="_BPMNShape_ScriptTask_288"> + <di:waypoint xsi:type="dc:Point" x="144" y="282" /> + <di:waypoint xsi:type="dc:Point" x="228" y="282" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="177" y="282" width="6" height="6" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_227" bpmnElement="getUrl" isMarkerVisible="true"> + <dc:Bounds x="372" y="256" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="420" y="282" width="72" height="24" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_2" bpmnElement="SequenceFlow_2" sourceElement="_BPMNShape_ScriptTask_288" targetElement="_BPMNShape_ExclusiveGateway_227"> + <di:waypoint xsi:type="dc:Point" x="328" y="282" /> + <di:waypoint xsi:type="dc:Point" x="372" y="281" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="350" y="281" width="6" height="6" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_289" bpmnElement="obtainServiceUrlById"> + <dc:Bounds x="528" y="197" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_228" bpmnElement="ExclusiveGateway_2" isMarkerVisible="true"> + <dc:Bounds x="738" y="256" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="763" y="311" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_290" bpmnElement="getServiceInstance"> + <dc:Bounds x="820" y="242" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="getUrlYes" sourceElement="_BPMNShape_ExclusiveGateway_227" targetElement="_BPMNShape_ExclusiveGateway_233"> + <di:waypoint xsi:type="dc:Point" x="397" y="256" /> + <di:waypoint xsi:type="dc:Point" x="397" y="170" /> + <di:waypoint xsi:type="dc:Point" x="446" y="170" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="397" y="213" width="29" height="22" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_4" bpmnElement="SequenceFlow_4" sourceElement="_BPMNShape_ScriptTask_289" targetElement="_BPMNShape_ExclusiveGateway_234"> + <di:waypoint xsi:type="dc:Point" x="628" y="237" /> + <di:waypoint xsi:type="dc:Point" x="671" y="237" /> + <di:waypoint xsi:type="dc:Point" x="671" y="195" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="668" y="221" width="6" height="6" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_5" bpmnElement="SequenceFlow_5" sourceElement="_BPMNShape_ExclusiveGateway_228" targetElement="_BPMNShape_ScriptTask_290"> + <di:waypoint xsi:type="dc:Point" x="788" y="281" /> + <di:waypoint xsi:type="dc:Point" x="820" y="282" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="798" y="281" width="6" height="6" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_6" bpmnElement="getUrlNo" sourceElement="_BPMNShape_ExclusiveGateway_227" targetElement="_BPMNShape_ExclusiveGateway_228"> + <di:waypoint xsi:type="dc:Point" x="397" y="306" /> + <di:waypoint xsi:type="dc:Point" x="397" y="370" /> + <di:waypoint xsi:type="dc:Point" x="763" y="370" /> + <di:waypoint xsi:type="dc:Point" x="763" y="306" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="400" y="324" width="22" height="22" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_291" bpmnElement="toggleSuccess"> + <dc:Bounds x="960" y="242" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_7" bpmnElement="SequenceFlow_3" sourceElement="_BPMNShape_ScriptTask_290" targetElement="_BPMNShape_ScriptTask_291"> + <di:waypoint xsi:type="dc:Point" x="920" y="282" /> + <di:waypoint xsi:type="dc:Point" x="960" y="282" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="937" y="282" width="6" height="6" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_EndEvent_223" bpmnElement="EndEvent_1"> + <dc:Bounds x="1133" y="264" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1151" y="305" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_8" bpmnElement="SequenceFlow_6" sourceElement="_BPMNShape_ScriptTask_291" targetElement="_BPMNShape_EndEvent_223"> + <di:waypoint xsi:type="dc:Point" x="1060" y="282" /> + <di:waypoint xsi:type="dc:Point" x="1133" y="282" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1100" y="282" width="6" height="6" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_SubProcess_25" bpmnElement="bpmnExceptionHandlingSubProcess" isExpanded="true"> + <dc:Bounds x="152" y="468" width="325" height="169" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_70" bpmnElement="StartEvent_2"> + <dc:Bounds x="176" y="535" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="194" y="576" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_EndEvent_224" bpmnElement="EndEvent_2"> + <dc:Bounds x="416" y="535" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="434" y="576" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_292" bpmnElement="processBPMNException"> + <dc:Bounds x="265" y="513" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_9" bpmnElement="SequenceFlow_7" sourceElement="_BPMNShape_StartEvent_70" targetElement="_BPMNShape_ScriptTask_292"> + <di:waypoint xsi:type="dc:Point" x="212" y="553" /> + <di:waypoint xsi:type="dc:Point" x="265" y="553" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="233" y="553" width="6" height="6" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_10" bpmnElement="SequenceFlow_8" sourceElement="_BPMNShape_ScriptTask_292" targetElement="_BPMNShape_EndEvent_224"> + <di:waypoint xsi:type="dc:Point" x="365" y="553" /> + <di:waypoint xsi:type="dc:Point" x="416" y="553" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="385" y="553" width="6" height="6" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_301" bpmnElement="obtainServiceUrlByName"> + <dc:Bounds x="528" y="59" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_233" bpmnElement="obtain" isMarkerVisible="true"> + <dc:Bounds x="446" y="145" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="501" y="164" width="53" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_234" bpmnElement="ExclusiveGateway_3" isMarkerVisible="true"> + <dc:Bounds x="646" y="145" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="671" y="200" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_13" bpmnElement="obtainById" sourceElement="_BPMNShape_ExclusiveGateway_233" targetElement="_BPMNShape_ScriptTask_289"> + <di:waypoint xsi:type="dc:Point" x="471" y="195" /> + <di:waypoint xsi:type="dc:Point" x="471" y="236" /> + <di:waypoint xsi:type="dc:Point" x="528" y="237" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="476" y="207" width="16" height="22" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_14" bpmnElement="obtainByName" sourceElement="_BPMNShape_ExclusiveGateway_233" targetElement="_BPMNShape_ScriptTask_301"> + <di:waypoint xsi:type="dc:Point" x="471" y="145" /> + <di:waypoint xsi:type="dc:Point" x="471" y="99" /> + <di:waypoint xsi:type="dc:Point" x="528" y="99" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="471" y="115" width="40" height="22" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_15" bpmnElement="SequenceFlow_13" sourceElement="_BPMNShape_ScriptTask_301" targetElement="_BPMNShape_ExclusiveGateway_234"> + <di:waypoint xsi:type="dc:Point" x="628" y="99" /> + <di:waypoint xsi:type="dc:Point" x="671" y="99" /> + <di:waypoint xsi:type="dc:Point" x="671" y="145" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="665" y="99" width="6" height="6" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_235" bpmnElement="serviceFoundCheck" isMarkerVisible="true"> + <dc:Bounds x="738" y="145" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="735" y="125" width="59" height="22" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_16" bpmnElement="SequenceFlow_14" sourceElement="_BPMNShape_ExclusiveGateway_234" targetElement="_BPMNShape_ExclusiveGateway_235"> + <di:waypoint xsi:type="dc:Point" x="696" y="170" /> + <di:waypoint xsi:type="dc:Point" x="738" y="170" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="704" y="170" width="6" height="6" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_17" bpmnElement="foundYes" sourceElement="_BPMNShape_ExclusiveGateway_235" targetElement="_BPMNShape_ExclusiveGateway_228"> + <di:waypoint xsi:type="dc:Point" x="763" y="195" /> + <di:waypoint xsi:type="dc:Point" x="763" y="256" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="762" y="205" width="29" height="22" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_18" bpmnElement="notFound" sourceElement="_BPMNShape_ExclusiveGateway_235" targetElement="_BPMNShape_EndEvent_229"> + <di:waypoint xsi:type="dc:Point" x="788" y="170" /> + <di:waypoint xsi:type="dc:Point" x="877" y="171" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="798" y="170" width="22" height="22" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_EndEvent_229" bpmnElement="EndEvent_3"> + <dc:Bounds x="877" y="153" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="895" y="194" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn2:definitions> diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CustomE2EPutService.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CustomE2EPutService.bpmn new file mode 100644 index 0000000000..9d989d2aac --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CustomE2EPutService.bpmn @@ -0,0 +1,201 @@ +<?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="_FatVcHn0EeaH6vX1RRdc_w" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> + <bpmn2:process id="CustomE2EPutService" name="CustomE2EPutService" isExecutable="true"> + <bpmn2:startEvent id="StartEvent_1"> + <bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing> + </bpmn2:startEvent> + <bpmn2:sequenceFlow id="SequenceFlow_1" name="" sourceRef="StartEvent_1" targetRef="Initialization" /> + <bpmn2:endEvent id="EndEvent_1"> + <bpmn2:incoming>SequenceFlow_5</bpmn2:incoming> + <bpmn2:terminateEventDefinition id="TerminateEventDefinition_1" /> + </bpmn2:endEvent> + <bpmn2:scriptTask id="toggleSuccess" name="Toggle Success Indicator" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_4</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_5</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + +def serviceInstance= new CustomE2EPutService() +serviceInstance.setSuccessIndicator(execution, true) + +execution.setVariable("WorkflowResponse", " ") //for junits]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_5" name="" sourceRef="toggleSuccess" targetRef="EndEvent_1" /> + <bpmn2:scriptTask id="putServiceInstance" name="Put Service Instance" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_3</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_4</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + +def serviceInstance= new CustomE2EPutService() +serviceInstance.putServiceInstance(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_4" name="" sourceRef="putServiceInstance" targetRef="toggleSuccess" /> + <bpmn2:scriptTask id="Initialization" name="Initialization" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_3</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* + +def serviceInstance= new CustomE2EPutService() +serviceInstance.preProcessRequest(execution) +]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_3" name="" sourceRef="Initialization" targetRef="putServiceInstance" /> + <bpmn2:subProcess id="bpmnExceptionHandlingSubProcess" name="Error Handling Sub Process" triggeredByEvent="true"> + <bpmn2:startEvent id="StartEvent_2"> + <bpmn2:outgoing>SequenceFlow_6</bpmn2:outgoing> + <bpmn2:errorEventDefinition id="ErrorEventDefinition_1" /> + </bpmn2:startEvent> + <bpmn2:sequenceFlow id="SequenceFlow_6" name="" sourceRef="StartEvent_2" targetRef="processError" /> + <bpmn2:endEvent id="EndEvent_2"> + <bpmn2:incoming>SequenceFlow_7</bpmn2:incoming> + </bpmn2:endEvent> + <bpmn2:scriptTask id="processError" name="Process Error" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_6</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_7</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_7" name="" sourceRef="processError" targetRef="EndEvent_2" /> + </bpmn2:subProcess> + <bpmn2:subProcess id="javaExceptionSubProcess" name="Java Exception Handling Sub Process" triggeredByEvent="true"> + <bpmn2:startEvent id="catchJavaExcep"> + <bpmn2:outgoing>SequenceFlow_9</bpmn2:outgoing> + <bpmn2:errorEventDefinition id="ErrorEventDefinition_2" errorRef="Error_2" /> + </bpmn2:startEvent> + <bpmn2:sequenceFlow id="SequenceFlow_9" name="" sourceRef="catchJavaExcep" targetRef="processJavaError" /> + <bpmn2:scriptTask id="processJavaError" name="Process Java Error" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_9</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_10</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
+
+ExceptionUtil ex = new ExceptionUtil()
+ex.processJavaException(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:endEvent id="EndEvent_3"> + <bpmn2:incoming>SequenceFlow_10</bpmn2:incoming> + <bpmn2:terminateEventDefinition id="TerminateEventDefinition_2" /> + </bpmn2:endEvent> + <bpmn2:sequenceFlow id="SequenceFlow_10" name="" sourceRef="processJavaError" targetRef="EndEvent_3" /> + </bpmn2:subProcess> + </bpmn2:process> + <bpmn2:error id="Error_1" name="MSO Workflow Exception" errorCode="MSOWorkflowException" /> + <bpmn2:error id="Error_2" name="Java Lang Exception" errorCode="java.lang.Exception" /> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="CustomE2EPutService"> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_71" bpmnElement="StartEvent_1"> + <dc:Bounds x="182" y="180" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="200" y="221" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_302" bpmnElement="Initialization"> + <dc:Bounds x="324" y="158" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="_BPMNShape_StartEvent_71" targetElement="_BPMNShape_ScriptTask_302"> + <di:waypoint xsi:type="dc:Point" x="218" y="198" /> + <di:waypoint xsi:type="dc:Point" x="324" y="198" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="250" y="198" width="6" height="6" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_304" bpmnElement="putServiceInstance"> + <dc:Bounds x="528" y="158" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="SequenceFlow_3" sourceElement="_BPMNShape_ScriptTask_302" targetElement="_BPMNShape_ScriptTask_304"> + <di:waypoint xsi:type="dc:Point" x="424" y="198" /> + <di:waypoint xsi:type="dc:Point" x="528" y="198" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="446" y="198" width="6" height="6" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_305" bpmnElement="toggleSuccess"> + <dc:Bounds x="732" y="158" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_4" bpmnElement="SequenceFlow_4" sourceElement="_BPMNShape_ScriptTask_304" targetElement="_BPMNShape_ScriptTask_305"> + <di:waypoint xsi:type="dc:Point" x="628" y="198" /> + <di:waypoint xsi:type="dc:Point" x="732" y="198" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="650" y="198" width="6" height="6" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_EndEvent_230" bpmnElement="EndEvent_1"> + <dc:Bounds x="908" y="180" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="926" y="221" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_5" bpmnElement="SequenceFlow_5" sourceElement="_BPMNShape_ScriptTask_305" targetElement="_BPMNShape_EndEvent_230"> + <di:waypoint xsi:type="dc:Point" x="832" y="198" /> + <di:waypoint xsi:type="dc:Point" x="908" y="198" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="854" y="198" width="6" height="6" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_SubProcess_27" bpmnElement="bpmnExceptionHandlingSubProcess" isExpanded="true"> + <dc:Bounds x="324" y="312" width="418" height="150" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_72" bpmnElement="StartEvent_2"> + <dc:Bounds x="357" y="370" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="375" y="411" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_306" bpmnElement="processError"> + <dc:Bounds x="466" y="348" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_6" bpmnElement="SequenceFlow_6" sourceElement="_BPMNShape_StartEvent_72" targetElement="_BPMNShape_ScriptTask_306"> + <di:waypoint xsi:type="dc:Point" x="393" y="388" /> + <di:waypoint xsi:type="dc:Point" x="466" y="388" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="415" y="388" width="6" height="6" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_EndEvent_231" bpmnElement="EndEvent_2"> + <dc:Bounds x="615" y="370" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="633" y="411" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_7" bpmnElement="SequenceFlow_7" sourceElement="_BPMNShape_ScriptTask_306" targetElement="_BPMNShape_EndEvent_231"> + <di:waypoint xsi:type="dc:Point" x="566" y="388" /> + <di:waypoint xsi:type="dc:Point" x="615" y="388" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="588" y="388" width="6" height="6" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_SubProcess_28" bpmnElement="javaExceptionSubProcess" isExpanded="true"> + <dc:Bounds x="323" y="486" width="419" height="150" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_73" bpmnElement="catchJavaExcep"> + <dc:Bounds x="357" y="538" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="375" y="579" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_308" bpmnElement="processJavaError"> + <dc:Bounds x="465" y="516" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_9" bpmnElement="SequenceFlow_9" sourceElement="_BPMNShape_StartEvent_73" targetElement="_BPMNShape_ScriptTask_308"> + <di:waypoint xsi:type="dc:Point" x="393" y="556" /> + <di:waypoint xsi:type="dc:Point" x="465" y="556" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="415" y="556" width="6" height="6" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_EndEvent_232" bpmnElement="EndEvent_3"> + <dc:Bounds x="615" y="538" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="633" y="579" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_10" bpmnElement="SequenceFlow_10" sourceElement="_BPMNShape_ScriptTask_308" targetElement="_BPMNShape_EndEvent_232"> + <di:waypoint xsi:type="dc:Point" x="565" y="556" /> + <di:waypoint xsi:type="dc:Point" x="615" y="556" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="587" y="556" width="6" height="6" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn2:definitions> diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy new file mode 100644 index 0000000000..f376c44562 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy @@ -0,0 +1,327 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.infrastructure.scripts; + +import static org.apache.commons.lang3.StringUtils.*; +import groovy.xml.XmlUtil +import groovy.json.* +import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil +import org.openecomp.mso.bpmn.common.scripts.VidUtils +import org.openecomp.mso.bpmn.core.WorkflowException +import org.openecomp.mso.bpmn.core.json.JsonUtils +import org.openecomp.mso.rest.APIResponse + +import java.util.UUID; + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.runtime.Execution +import org.apache.commons.lang3.* +import org.apache.commons.codec.binary.Base64; +import org.springframework.web.util.UriUtils + +/** + * This groovy class supports the <class>CreateServiceInstance.bpmn</class> process. + * AlaCarte flow for 1702 ServiceInstance Create + * + */ +public class CreateCustomE2EServiceInstance extends AbstractServiceTaskProcessor { + String Prefix="CRESI_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + VidUtils vidUtils = new VidUtils() + + public void preProcessRequest (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + String msg = "" + utils.log("DEBUG", " *** preProcessRequest() *** ", isDebugEnabled) + + try { + + String siRequest = execution.getVariable("bpmnRequest") + utils.logAudit(siRequest) + + String requestId = execution.getVariable("mso-request-id") + execution.setVariable("msoRequestId", requestId) + utils.log("DEBUG", "Input Request:" + siRequest + " reqId:" + requestId, isDebugEnabled) + + String serviceInstanceId = execution.getVariable("serviceInstanceId") + if (isBlank(serviceInstanceId)) { + serviceInstanceId = UUID.randomUUID().toString() + } + utils.log("DEBUG", "Generated new Service Instance:" + serviceInstanceId, isDebugEnabled) + serviceInstanceId = UriUtils.encode(serviceInstanceId,"UTF-8") + execution.setVariable("serviceInstanceId", serviceInstanceId) + + //parameters + String p_domainHost = jsonUtil.getJsonValue(siRequest, "service.parameters.domainHost") + if (isBlank(p_domainHost)) { + msg = "Input parameters domainHost is null" + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } else { + execution.setVariable("p_domainHost", p_domainHost) + } + + String p_nodeTemplateName = jsonUtil.getJsonValue(siRequest, "service.parameters.nodeTemplateName") + if (isBlank(p_nodeTemplateName)) { + msg = "Input parameters nodeTemplateName is null" + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } else { + execution.setVariable("p_nodeTemplateName", p_nodeTemplateName) + } + + String p_nodeType = jsonUtil.getJsonValue(siRequest, "service.parameters.nodeType") + if (isBlank(p_nodeType)) { + msg = "Input parameters nodeType is null" + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } else { + execution.setVariable("p_nodeType", p_nodeType) + } + + //segments + def jsonSlurper = new JsonSlurper() + //def jsonOutput = new JsonOutput() + + Map reqMap = jsonSlurper.parseText(siRequest) + + def p_segments = reqMap.service?.parameters?.segments + + //List<Segment> segList = [] + //if (p_segments) { + // p_segments.each { + // p_segment -> segList.add(p_segment) + // //p_segment.domainHost + // } + //} + //execution.setVariable("segments", segList) + + //location Constraints + def p_locationConstraints = reqMap.service?.parameters?.nsParameters?.locationConstraints + if(p_locationConstraints){ + //Copy data. no data available now so ignoring + } + + //additionalParamForNs + String p_param1 = jsonUtil.getJsonValue(siRequest, "service.parameters.nsParameters.additionalParamForNs.E2EServcie.param1") + if (isBlank(p_param1)) { + msg = "Input parameters p_param1 is null" + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } else { + execution.setVariable("p_param1", p_param1) + } + + String p_param2 = jsonUtil.getJsonValue(siRequest, "service.parameters.nsParameters.additionalParamForNs.E2EServcie.param2") + if (isBlank(p_param2)) { + msg = "Input parameters p_param2 is null" + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } else { + execution.setVariable("p_param2", p_param2) + } + + //subscriberInfo + String globalSubscriberId = jsonUtil.getJsonValue(siRequest, "requestDetails.subscriberInfo.globalSubscriberId") + if (isBlank(globalSubscriberId)) { + msg = "Input globalSubscriberId' is null" + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } else { + execution.setVariable("globalSubscriberId", globalSubscriberId) + } + + //requestInfo + execution.setVariable("source", jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.source")) + execution.setVariable("serviceInstanceName", jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.instanceName")) + execution.setVariable("disableRollback", jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.suppressRollback")) + String productFamilyId = jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.productFamilyId") + if (isBlank(productFamilyId)) + { + msg = "Input productFamilyId is null" + utils.log("DEBUG", msg, isDebugEnabled) + //exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } else { + execution.setVariable("productFamilyId", productFamilyId) + } + + //modelInfo + String serviceModelInfo = jsonUtil.getJsonValue(siRequest, "requestDetails.modelInfo") + if (isBlank(serviceModelInfo)) { + msg = "Input serviceModelInfo is null" + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } else + { + execution.setVariable("serviceModelInfo", serviceModelInfo) + } + + utils.log("DEBUG", "modelInfo" + serviceModelInfo, isDebugEnabled) + + //requestParameters + String subscriptionServiceType = jsonUtil.getJsonValue(siRequest, "requestDetails.requestParameters.subscriptionServiceType") + if (isBlank(subscriptionServiceType)) { + msg = "Input subscriptionServiceType is null" + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } else { + execution.setVariable("subscriptionServiceType", subscriptionServiceType) + } + + //TODO + //execution.setVariable("serviceInputParams", jsonUtil.getJsonValue(siRequest, "requestDetails.requestParameters.userParams")) + //execution.setVariable("failExists", true) + + } catch (BpmnError e) { + throw e; + } catch (Exception ex){ + msg = "Exception in preProcessRequest " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("DEBUG"," ***** Exit preProcessRequest *****", isDebugEnabled) + } + + public void sendSyncResponse (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG", " *** sendSyncResponse *** ", isDebugEnabled) + + try { + String requestId = execution.getVariable("msoRequestId") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + // RESTResponse for API Handler (APIH) Reply Task + String createServiceRestRequest = """{"service":{"serviceId":"${serviceInstanceId}","operationId":"${requestId}"}}""".trim() + utils.log("DEBUG", " sendSyncResponse to APIH:" + "\n" + createServiceRestRequest, isDebugEnabled) + sendWorkflowResponse(execution, 202, createServiceRestRequest) + execution.setVariable("sentSyncResponse", true) + + } catch (Exception ex) { + String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("DEBUG"," ***** Exit sendSyncResopnse *****", isDebugEnabled) + } + + + public void sendSyncError (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG", " *** sendSyncError *** ", isDebugEnabled) + + try { + String errorMessage = "" + if (execution.getVariable("WorkflowException") instanceof WorkflowException) { + WorkflowException wfe = execution.getVariable("WorkflowException") + errorMessage = wfe.getErrorMessage() + } else { + errorMessage = "Sending Sync Error." + } + + String buildworkflowException = + """<aetgt:WorkflowException xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1">
+ <aetgt:ErrorMessage>${errorMessage}</aetgt:ErrorMessage> + <aetgt:ErrorCode>7000</aetgt:ErrorCode> + </aetgt:WorkflowException>""" + + utils.logAudit(buildworkflowException) + sendWorkflowResponse(execution, 500, buildworkflowException) + + } catch (Exception ex) { + utils.log("DEBUG", " Sending Sync Error Activity Failed. " + "\n" + ex.getMessage(), isDebugEnabled) + } + + } + + public void prepareCompletionRequest (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG", " *** prepareCompletion *** ", isDebugEnabled) + + try { + String requestId = execution.getVariable("msoRequestId") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String source = execution.getVariable("source") + + String msoCompletionRequest = + """<aetgt:MsoCompletionRequest xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1"
+ xmlns:ns="http://org.openecomp/mso/request/types/v1">
+ <request-info xmlns="http://org.openecomp/mso/infra/vnf-request/v1">
+ <request-id>${requestId}</request-id> + <action>CREATE</action> + <source>${source}</source> + </request-info> + <status-message>Service Instance was created successfully.</status-message> + <serviceInstanceId>${serviceInstanceId}</serviceInstanceId> + <mso-bpel-name>CreateGenericALaCarteServiceInstance</mso-bpel-name> + </aetgt:MsoCompletionRequest>""" + + // Format Response + String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest) + + execution.setVariable("completionRequest", xmlMsoCompletionRequest) + utils.log("DEBUG", " Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest, isDebugEnabled) + + } catch (Exception ex) { + String msg = " Exception in prepareCompletion:" + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("DEBUG", "*** Exit prepareCompletionRequest ***", isDebugEnabled) + } + + public void prepareFalloutRequest(Execution execution){ + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG", " *** prepareFalloutRequest *** ", isDebugEnabled) + + try { + WorkflowException wfex = execution.getVariable("WorkflowException") + utils.log("DEBUG", " Input Workflow Exception: " + wfex.toString(), isDebugEnabled) + String requestId = execution.getVariable("msoRequestId") + String source = execution.getVariable("source") + String requestInfo = + """<request-info xmlns="http://org.openecomp/mso/infra/vnf-request/v1">
+ <request-id>${requestId}</request-id> + <action>CREATE</action> + <source>${source}</source> + </request-info>""" + + String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo) + execution.setVariable("falloutRequest", falloutRequest) + } catch (Exception ex) { + utils.log("DEBUG", "Exception prepareFalloutRequest:" + ex.getMessage(), isDebugEnabled) + String errorException = " Bpmn error encountered in CreateGenericALaCarteServiceInstance flow. FalloutHandlerRequest, buildErrorResponse() - " + ex.getMessage() + String requestId = execution.getVariable("msoRequestId") + String falloutRequest = + """<aetgt:FalloutHandlerRequest xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1"
+ xmlns:ns="http://org.openecomp/mso/request/types/v1"
+ xmlns:wfsch="http://org.openecomp/mso/workflow/schema/v1">
+ <request-info xmlns="http://org.openecomp/mso/infra/vnf-request/v1">
+ <request-id>${requestId}</request-id> + <action>CREATE</action> + <source>VID</source> + </request-info> + <aetgt:WorkflowException xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1">
+ <aetgt:ErrorMessage>${errorException}</aetgt:ErrorMessage> + <aetgt:ErrorCode>7000</aetgt:ErrorCode> + </aetgt:WorkflowException> + </aetgt:FalloutHandlerRequest>""" + + execution.setVariable("falloutRequest", falloutRequest) + } + utils.log("DEBUG", "*** Exit prepareFalloutRequest ***", isDebugEnabled) + } +}
\ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateGenericE2EServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateGenericE2EServiceInstance.groovy new file mode 100644 index 0000000000..3302210416 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateGenericE2EServiceInstance.groovy @@ -0,0 +1,160 @@ +/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - SO
+ * ================================================================================
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.bpmn.infrastructure.scripts;
+
+import static org.apache.commons.lang3.StringUtils.*;
+import groovy.xml.XmlUtil
+import groovy.json.*
+import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil
+import org.openecomp.mso.bpmn.common.scripts.VidUtils
+import org.openecomp.mso.bpmn.core.WorkflowException
+import org.openecomp.mso.bpmn.core.json.JsonUtils
+import org.openecomp.mso.rest.APIResponse
+
+import java.util.UUID;
+
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.runtime.Execution
+import org.apache.commons.lang3.*
+import org.apache.commons.codec.binary.Base64;
+import org.springframework.web.util.UriUtils
+
+/**
+ * This groovy class supports the <class>CreateGenericE2EServiceInstance.bpmn</class> process.
+ * flow for E2E ServiceInstance Create
+ */
+public class CreateGenericE2EServiceInstance extends AbstractServiceTaskProcessor {
+
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+
+ JsonUtils jsonUtil = new JsonUtils()
+
+ VidUtils vidUtils = new VidUtils()
+
+ /**
+ * Pre Process the BPMN Flow Request
+ * Inclouds:
+ * Deal with the parameters
+ * generate the service instance id
+ * generate the operation id
+ */
+ public void preProcessRequest (Execution execution) {
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ String msg = ""
+ utils.log("DEBUG", " *** preProcessRequest() *** ", isDebugEnabled)
+ try {
+
+ String siRequest = execution.getVariable("bpmnRequest")
+ utils.logAudit(siRequest)
+
+ String requestId = execution.getVariable("mso-request-id")
+ execution.setVariable("msoRequestId", requestId)
+ utils.log("DEBUG", "Input Request:" + siRequest + " reqId:" + requestId, isDebugEnabled)
+
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+ if (isBlank(serviceInstanceId)) {
+ serviceInstanceId = UUID.randomUUID().toString()
+ }
+ utils.log("DEBUG", "Generated new Service Instance:" + serviceInstanceId, isDebugEnabled)
+ serviceInstanceId = UriUtils.encode(serviceInstanceId,"UTF-8")
+ execution.setVariable("serviceInstanceId", serviceInstanceId)
+
+ String operationId = execution.getVariable("operationId")
+ if (isBlank(operationId)) {
+ operationId = UUID.randomUUID().toString()
+ }
+ utils.log("DEBUG", "Generated new Service Instance Operation:" + operationId, isDebugEnabled)
+ serviceInstanceId = UriUtils.encode(operationId,"UTF-8")
+ execution.setVariable("operationId", operationId)
+ //subscriberInfo, TBD , there is no globalSubscriberId in R1 for E2E Service.
+ //requestInfo TBD , there is no requestDetails for R1 E2E service
+
+ //TBD need to insert operationInfo to RequestDb
+
+ //set service Instance Name
+ execution.setVariable("serviceInstanceName", jsonUtil.getJsonValue(siRequest, "service.name"))
+ execution.setVariable("serviceDescription", jsonUtil.getJsonValue(siRequest, "service.description"))
+ execution.setVariable("templateId", jsonUtil.getJsonValue(siRequest, "service.templateId"))
+
+ //serviceParamters
+ String serviceParamters = jsonUtil.getJsonValue(siRequest, "service.parameters")
+ if (isBlank(serviceParamters)) {
+ msg = "Input service paramters is null"
+ utils.log("DEBUG", msg, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else
+ {
+ execution.setVariable("serviceParamters", serviceParamters)
+ }
+
+ utils.log("DEBUG", "service parameters:" + serviceParamters, isDebugEnabled)
+ } catch (BpmnError e) {
+ throw e;
+ } catch (Exception ex){
+ msg = "Exception in preProcessRequest " + ex.getMessage()
+ utils.log("DEBUG", msg, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ utils.log("DEBUG"," ***** Exit preProcessRequest *****", isDebugEnabled)
+ }
+
+ /**
+ * send the sync response
+ * the response incloudes the instance id and the operation id
+ */
+ public void sendSyncResponse(Execution execution) {
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ utils.log("DEBUG", " *** sendSyncResponse *** ", isDebugEnabled)
+
+ try {
+ String requestId = execution.getVariable("msoRequestId")
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+ String operationId = execution.getVariable("operationId")
+ // RESTResponse for API Handler (APIH) Reply Task
+ String createServiceRestResponse = """{"service":{"serviceId":"${serviceInstanceId}","operationId":"${operationId}"}}""".trim()
+ utils.log("DEBUG", " sendSyncResponse to APIH:" + "\n" + createServiceRestResponse, isDebugEnabled)
+ sendWorkflowResponse(execution, 202, createServiceRestResponse)
+ execution.setVariable("sentSyncResponse", true)
+
+ } catch (Exception ex) {
+ String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage()
+ utils.log("DEBUG", msg, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ utils.log("DEBUG"," ***** Exit sendSyncResopnse *****", isDebugEnabled)
+ }
+
+ public void preCreateRequest(Execution execution) {
+ }
+
+ public void postConfigRequest(Execution execution) {
+ }
+
+ public void preVFCRequest(Execution execution) {
+ }
+
+ public void preAdaptorDataRequest(Execution execution) {
+ }
+
+ public void preSDNCRequest(Execution execution) {
+ }
+}
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy new file mode 100644 index 0000000000..518c30b380 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy @@ -0,0 +1,654 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.openecomp.mso.bpmn.infrastructure.scripts; + +import static org.apache.commons.lang3.StringUtils.*; +import groovy.xml.XmlUtil +import groovy.json.* + +import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition +import org.openecomp.mso.bpmn.core.domain.ServiceInstance +import org.openecomp.mso.bpmn.core.domain.ModelInfo +import org.openecomp.mso.bpmn.core.json.JsonUtils +import org.openecomp.mso.bpmn.common.scripts.AaiUtil +import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil +import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils +import org.openecomp.mso.bpmn.core.RollbackData +import org.openecomp.mso.bpmn.core.WorkflowException +import org.openecomp.mso.rest.APIResponse; +import org.openecomp.mso.rest.RESTClient +import org.openecomp.mso.rest.RESTConfig + +import java.util.UUID; + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.runtime.Execution +import org.json.JSONObject; +import org.apache.commons.lang3.* +import org.apache.commons.codec.binary.Base64; +import org.springframework.web.util.UriUtils; + +/** + * This groovy class supports the <class>DoCreateServiceInstance.bpmn</class> process. + * + * Inputs: + * @param - msoRequestId + * @param - globalSubscriberId + * @param - subscriptionServiceType + * @param - serviceInstanceId + * @param - serviceInstanceName - O + * @param - serviceModelInfo + * @param - productFamilyId + * @param - disableRollback + * @param - failExists - TODO + * @param - serviceInputParams (should contain aic_zone for serviceTypes TRANSPORT,ATM) + * @param - sdncVersion ("1610") + * @param - serviceDecomposition - Decomposition for R1710 + * (if macro provides serviceDecompsition then serviceModelInfo, serviceInstanceId & serviceInstanceName will be ignored) + * + * Outputs: + * @param - rollbackData (localRB->null) + * @param - rolledBack (no localRB->null, localRB F->false, localRB S->true) + * @param - WorkflowException + * @param - serviceInstanceName - (GET from AAI if null in input) + * + */ +public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { + + String Prefix="DCRESI_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + + public void preProcessRequest (Execution execution) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + String msg = "" + utils.log("DEBUG"," ***** preProcessRequest *****", isDebugEnabled) + + try { + String requestId = execution.getVariable("msoRequestId") + execution.setVariable("prefix", Prefix) + + //Inputs + //requestDetails.subscriberInfo. for AAI GET & PUT & SDNC assignToplology + String globalSubscriberId = execution.getVariable("globalSubscriberId") //globalCustomerId + + //requestDetails.requestParameters. for AAI PUT & SDNC assignTopology + String subscriptionServiceType = execution.getVariable("subscriptionServiceType") + + //requestDetails.requestParameters. for SDNC assignTopology + String productFamilyId = execution.getVariable("productFamilyId") //AAI productFamilyId + + if (isBlank(globalSubscriberId)) { + msg = "Input globalSubscriberId is null" + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + + if (isBlank(subscriptionServiceType)) { + msg = "Input subscriptionServiceType is null" + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + + 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("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + execution.setVariable("sdncCallbackUrl", sdncCallbackUrl) + utils.log("DEBUG","SDNC Callback URL: " + sdncCallbackUrl, isDebugEnabled) + + //requestDetails.modelInfo.for AAI PUT servieInstanceData & SDNC assignTopology + String modelInvariantUuid = "" + String modelVersion = "" + String modelUuid = "" + String modelName = "" + String serviceInstanceName = "" + //Generated in parent.for AAI PUT + String serviceInstanceId = "" + String serviceType = "" + String serviceRole = "" + + ServiceDecomposition serviceDecomp = (ServiceDecomposition) execution.getVariable("serviceDecomposition") + if (serviceDecomp != null) + { + serviceType = serviceDecomp.getServiceType() + if (serviceType == null) + { + utils.log("DEBUG", "null serviceType", isDebugEnabled) + serviceType = "" + } + else + { + utils.log("DEBUG", "serviceType:" + serviceType, isDebugEnabled) + } + serviceRole = serviceDecomp.getServiceRole() + if (serviceRole == null) + { + serviceRole = "" + } + + ServiceInstance serviceInstance = serviceDecomp.getServiceInstance() + if (serviceInstance != null) + { + serviceInstanceId = serviceInstance.getInstanceId() + serviceInstanceName = serviceInstance.getInstanceName() + execution.setVariable("serviceInstanceId", serviceInstanceId) + execution.setVariable("serviceInstanceName", serviceInstanceName) + } + + ModelInfo modelInfo = serviceDecomp.getModelInfo() + if (modelInfo != null) + { + modelInvariantUuid = modelInfo.getModelInvariantUuid() + modelVersion = modelInfo.getModelVersion() + modelUuid = modelInfo.getModelUuid() + modelName = modelInfo.getModelName() + } + else + { + msg = "Input serviceModelInfo is null" + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + } + else + { + //requestDetails.requestInfo. for AAI GET/PUT serviceInstanceData & SDNC assignToplology + serviceInstanceName = execution.getVariable("serviceInstanceName") + serviceInstanceId = execution.getVariable("serviceInstanceId") + + String serviceModelInfo = execution.getVariable("serviceModelInfo") + if (isBlank(serviceModelInfo)) { + msg = "Input serviceModelInfo is null" + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + modelInvariantUuid = jsonUtil.getJsonValue(serviceModelInfo, "modelInvariantUuid") + modelVersion = jsonUtil.getJsonValue(serviceModelInfo, "modelVersion") + modelUuid = jsonUtil.getJsonValue(serviceModelInfo, "modelUuid") + modelName = jsonUtil.getJsonValue(serviceModelInfo, "modelName") + //modelCustomizationUuid NA for SI + + } + execution.setVariable("serviceType", serviceType) + execution.setVariable("serviceRole", serviceRole) + + if (serviceInstanceName == null) { + execution.setVariable("serviceInstanceName", "") + serviceInstanceName = "" + } + if (isBlank(serviceInstanceId)){ + msg = "Input serviceInstanceId is null" + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + + if (modelInvariantUuid == null) { + modelInvariantUuid = "" + } + if (modelUuid == null) { + modelUuid = "" + } + if (modelVersion == null) { + modelVersion = "" + } + if (modelName == null) { + modelName = "" + } + + execution.setVariable("modelInvariantUuid", modelInvariantUuid) + execution.setVariable("modelVersion", modelVersion) + execution.setVariable("modelUuid", modelUuid) + execution.setVariable("modelName", modelName) + + StringBuilder sbParams = new StringBuilder() + Map<String, String> paramsMap = execution.getVariable("serviceInputParams") + if (paramsMap != null) + { + sbParams.append("<service-input-parameters>") + for (Map.Entry<String, String> entry : paramsMap.entrySet()) { + String paramsXml + String paramName = entry.getKey() + String paramValue = entry.getValue() + paramsXml = + """ <param> + <name>${paramName}</name> + <value>${paramValue}</value> + </param> + """ + sbParams.append(paramsXml) + } + sbParams.append("</service-input-parameters>") + } + String siParamsXml = sbParams.toString() + if (siParamsXml == null) + siParamsXml = "" + execution.setVariable("siParamsXml", siParamsXml) + + //AAI PUT + String oStatus = execution.getVariable("initialStatus") ?: "" + if ("TRANSPORT".equalsIgnoreCase(serviceType)) + { + oStatus = "Created" + } + + String statusLine = isBlank(oStatus) ? "" : "<orchestration-status>${oStatus}</orchestration-status>" + + AaiUtil aaiUriUtil = new AaiUtil(this) + String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution) + String namespace = aaiUriUtil.getNamespaceFromUri(aai_uri) + String serviceInstanceData = + """<service-instance xmlns=\"${namespace}\"> + <service-instance-name>${serviceInstanceName}</service-instance-name> + <service-type>${serviceType}</service-type> + <service-role>${serviceRole}</service-role> + ${statusLine} + <model-invariant-id>${modelInvariantUuid}</model-invariant-id> + <model-version-id>${modelUuid}</model-version-id> + </service-instance>""".trim() + + execution.setVariable("serviceInstanceData", serviceInstanceData) + utils.logAudit(serviceInstanceData) + utils.log("DEBUG", " 'payload' to create Service Instance in AAI - " + "\n" + serviceInstanceData, isDebugEnabled) + + } catch (BpmnError e) { + throw e; + } catch (Exception ex){ + msg = "Exception in preProcessRequest " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("DEBUG"," ***** Exit preProcessRequest *****", isDebugEnabled) + } + + //TODO: Will be able to replace with call to GenericGetService + public void getAAICustomerById (Execution execution) { + // https://{aaiEP}/aai/v8/business/customers/customer/{globalCustomerId} + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + String msg = "" + try { + + String globalCustomerId = execution.getVariable("globalSubscriberId") //VID to AAI name map + utils.log("DEBUG"," ***** getAAICustomerById ***** globalCustomerId:" + globalCustomerId, isDebugEnabled) + + String aai_endpoint = execution.getVariable("URN_aai_endpoint") + AaiUtil aaiUriUtil = new AaiUtil(this) + String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution) + if (isBlank(aai_endpoint) || isBlank(aai_uri)) + { + msg = "AAI URL is invalid. Endpoint:" + aai_endpoint + aai_uri + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + String getAAICustomerUrl = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(globalCustomerId,"UTF-8") + + utils.logAudit(getAAICustomerUrl) + utils.log("DEBUG", "getAAICustomerById Url:" + getAAICustomerUrl, isDebugEnabled) + APIResponse response = aaiUriUtil.executeAAIGetCall(execution, getAAICustomerUrl) + String returnCode = response.getStatusCode() + String aaiResponseAsString = response.getResponseBodyAsString() + + msg = "getAAICustomerById ResponseCode:" + returnCode + " ResponseString:" + aaiResponseAsString + utils.log("DEBUG",msg, isDebugEnabled) + utils.logAudit(msg) + + if (returnCode=='200') { + // Customer found by ID. FLow to proceed. + utils.log("DEBUG",msg, isDebugEnabled) + + //TODO Deferred + //we might verify that service-subscription with matching name exists + //and throw error if not. If not checked, we will get exception in subsequent step on Create call + //in 1610 we assume both customer & service subscription were pre-created + + } else { + if (returnCode=='404') { + msg = "GlobalCustomerId:" + globalCustomerId + " not found (404) in AAI" + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) + + } else { + if (aaiResponseAsString.contains("RESTFault")) { + utils.log("ERROR", aaiResponseAsString) + WorkflowException workflowException = exceptionUtil.MapAAIExceptionToWorkflowException(aaiResponseAsString, execution) + execution.setVariable("WorkflowException", workflowException) + throw new BpmnError("MSOWorkflowException") + + } else { + // aai all errors + msg = "Error in getAAICustomerById ResponseCode:" + returnCode + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) + } + } + } + + } catch (BpmnError e) { + throw e; + } catch (Exception ex) { + msg = "Exception in getAAICustomerById. " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("DEBUG"," *****Exit getAAICustomerById *****", isDebugEnabled) + + } + + public void postProcessAAIGET(Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG"," ***** postProcessAAIGET ***** ", isDebugEnabled) + String msg = "" + + try { + String serviceInstanceName = execution.getVariable("serviceInstanceName") + boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator") + if(succInAAI != true){ + utils.log("DEBUG","Error getting Service-instance from AAI", + serviceInstanceName, isDebugEnabled) + WorkflowException workflowException = execution.getVariable("WorkflowException") + utils.logAudit("workflowException: " + workflowException) + if(workflowException != null){ + exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage()) + } + else + { + msg = "Failure in postProcessAAIGET GENGS_SuccessIndicator:" + succInAAI + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) + } + } + else + { + boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator") + if(foundInAAI == true){ + utils.log("DEBUG","Found Service-instance in AAI", isDebugEnabled) + msg = "ServiceInstance already exists in AAI:" + serviceInstanceName + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) + } + } + } catch (BpmnError e) { + throw e; + } catch (Exception ex) { + msg = "Exception in DoCreateServiceInstance.postProcessAAIGET. " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("DEBUG"," *** Exit postProcessAAIGET *** ", isDebugEnabled) + } + + public void postProcessAAIPUT(Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG"," ***** postProcessAAIPUT ***** ", isDebugEnabled) + String msg = "" + try { + String serviceInstanceId = execution.getVariable("serviceInstanceId") + boolean succInAAI = execution.getVariable("GENPS_SuccessIndicator") + if(succInAAI != true){ + utils.log("DEBUG","Error putting Service-instance in AAI", + serviceInstanceId, isDebugEnabled) + WorkflowException workflowException = execution.getVariable("WorkflowException") + utils.logAudit("workflowException: " + workflowException) + if(workflowException != null){ + exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage()) + } + } + else + { + //start rollback set up + RollbackData rollbackData = new RollbackData() + def disableRollback = execution.getVariable("disableRollback") + rollbackData.put("SERVICEINSTANCE", "disableRollback", disableRollback.toString()) + rollbackData.put("SERVICEINSTANCE", "rollbackAAI", "true") + rollbackData.put("SERVICEINSTANCE", "serviceInstanceId", serviceInstanceId) + rollbackData.put("SERVICEINSTANCE", "subscriptionServiceType", execution.getVariable("subscriptionServiceType")) + rollbackData.put("SERVICEINSTANCE", "globalSubscriberId", execution.getVariable("globalSubscriberId")) + execution.setVariable("rollbackData", rollbackData) + } + + } catch (BpmnError e) { + throw e; + } catch (Exception ex) { + msg = "Exception in DoCreateServiceInstance.postProcessAAIDEL. " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("DEBUG"," *** Exit postProcessAAIPUT *** ", isDebugEnabled) + } + + public void preProcessSDNCAssignRequest(Execution execution) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + String msg = "" + utils.log("DEBUG"," ***** preProcessSDNCAssignRequest *****", isDebugEnabled) + + try { + def serviceInstanceId = execution.getVariable("serviceInstanceId") + def serviceInstanceName = execution.getVariable("serviceInstanceName") + def callbackURL = execution.getVariable("sdncCallbackUrl") + def requestId = execution.getVariable("msoRequestId") + def serviceId = execution.getVariable("productFamilyId") + def subscriptionServiceType = execution.getVariable("subscriptionServiceType") + def globalSubscriberId = execution.getVariable("globalSubscriberId") //globalCustomerId + def serviceType = execution.getVariable("serviceType") + + def modelInvariantUuid = execution.getVariable("modelInvariantUuid") + def modelVersion = execution.getVariable("modelVersion") + def modelUuid = execution.getVariable("modelUuid") + def modelName = execution.getVariable("modelName") + + def sdncRequestId = UUID.randomUUID().toString() + + def siParamsXml = execution.getVariable("siParamsXml") + + String sdncAssignRequest = + """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.openecomp/mso/request/types/v1" + xmlns:sdncadapterworkflow="http://org.openecomp/mso/workflow/schema/v1" + xmlns:sdncadapter="http://org.openecomp/workflow/sdnc/adapter/schema/v1"> + <sdncadapter:RequestHeader> + <sdncadapter:RequestId>${sdncRequestId}</sdncadapter:RequestId> + <sdncadapter:SvcInstanceId>${serviceInstanceId}</sdncadapter:SvcInstanceId> + <sdncadapter:SvcAction>assign</sdncadapter:SvcAction> + <sdncadapter:SvcOperation>service-topology-operation</sdncadapter:SvcOperation> + <sdncadapter:CallbackUrl>${callbackURL}</sdncadapter:CallbackUrl> + <sdncadapter:MsoAction>${serviceType}</sdncadapter:MsoAction> + </sdncadapter:RequestHeader> + <sdncadapterworkflow:SDNCRequestData> + <request-information> + <request-id>${requestId}</request-id> + <source>MSO</source> + <notification-url/> + <order-number/> + <order-version/> + <request-action>CreateServiceInstance</request-action> + </request-information> + <service-information> + <service-id>${serviceId}</service-id> + <subscription-service-type>${subscriptionServiceType}</subscription-service-type> + <ecomp-model-information> + <model-invariant-uuid>${modelInvariantUuid}</model-invariant-uuid> + <model-uuid>${modelUuid}</model-uuid> + <model-version>${modelVersion}</model-version> + <model-name>${modelName}</model-name> + </ecomp-model-information> + <service-instance-id>${serviceInstanceId}</service-instance-id> + <subscriber-name/> + <global-customer-id>${globalSubscriberId}</global-customer-id> + </service-information> + <service-request-input> + <service-instance-name>${serviceInstanceName}</service-instance-name> + ${siParamsXml} + </service-request-input> + </sdncadapterworkflow:SDNCRequestData> + </sdncadapterworkflow:SDNCAdapterWorkflowRequest>""" + + utils.log("DEBUG","sdncAssignRequest:\n" + sdncAssignRequest, isDebugEnabled) + sdncAssignRequest = utils.formatXml(sdncAssignRequest) + execution.setVariable("sdncAssignRequest", sdncAssignRequest) + utils.logAudit("sdncAssignRequest: " + sdncAssignRequest) + + def sdncRequestId2 = UUID.randomUUID().toString() + String sdncDelete = sdncAssignRequest.replace(">assign<", ">delete<").replace(">CreateServiceInstance<", ">DeleteServiceInstance<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<") + def sdncRequestId3 = UUID.randomUUID().toString() + String sdncDeactivate = sdncDelete.replace(">delete<", ">deactivate<").replace(">${sdncRequestId2}<", ">${sdncRequestId3}<") + def rollbackData = execution.getVariable("rollbackData") + rollbackData.put("SERVICEINSTANCE", "sdncDeactivate", sdncDeactivate) + rollbackData.put("SERVICEINSTANCE", "sdncDelete", sdncDelete) + execution.setVariable("rollbackData", rollbackData) + + utils.log("DEBUG","rollbackData:\n" + rollbackData.toString(), isDebugEnabled) + + } catch (BpmnError e) { + throw e; + } catch(Exception ex) { + msg = "Exception in preProcessSDNCAssignRequest. " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("DEBUG"," *****Exit preProcessSDNCAssignRequest *****", isDebugEnabled) + } + + public void postProcessSDNCAssign (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG"," ***** postProcessSDNCAssign ***** ", isDebugEnabled) + try { + WorkflowException workflowException = execution.getVariable("WorkflowException") + utils.logAudit("workflowException: " + workflowException) + + boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") + + String response = execution.getVariable("sdncAdapterResponse") + utils.logAudit("SDNCResponse: " + response) + + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) + sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) + + if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){ + utils.log("DEBUG","Good response from SDNC Adapter for service-instance topology assign: \n" + response, isDebugEnabled) + + def rollbackData = execution.getVariable("rollbackData") + rollbackData.put("SERVICEINSTANCE", "rollbackSDNC", "true") + execution.setVariable("rollbackData", rollbackData) + + }else{ + utils.log("DEBUG","Bad Response from SDNC Adapter for service-instance assign", isDebugEnabled) + throw new BpmnError("MSOWorkflowException") + } + + } catch (BpmnError e) { + throw e; + } catch(Exception ex) { + msg = "Exception in postProcessSDNCAssign. " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("DEBUG"," *** Exit postProcessSDNCAssign *** ", isDebugEnabled) + } + + public void postProcessAAIGET2(Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG"," ***** postProcessAAIGET2 ***** ", isDebugEnabled) + String msg = "" + + try { + String serviceInstanceName = execution.getVariable("serviceInstanceName") + boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator") + if(succInAAI != true){ + utils.log("DEBUG","Error getting Service-instance from AAI in postProcessAAIGET2", + serviceInstanceName, isDebugEnabled) + WorkflowException workflowException = execution.getVariable("WorkflowException") + utils.logAudit("workflowException: " + workflowException) + if(workflowException != null){ + exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage()) + } + else + { + msg = "Failure in postProcessAAIGET2 GENGS_SuccessIndicator:" + succInAAI + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) + } + } + else + { + boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator") + if(foundInAAI == true){ + String aaiService = execution.getVariable("GENGS_service") + if (!isBlank(aaiService) && (utils.nodeExists(aaiService, "service-instance-name"))) { + execution.setVariable("serviceInstanceName", utils.getNodeText1(aaiService, "service-instance-name")) + utils.log("DEBUG","Found Service-instance in AAI.serviceInstanceName:" + execution.getVariable("serviceInstanceName"), isDebugEnabled) + } + } + } + } catch (BpmnError e) { + throw e; + } catch (Exception ex) { + msg = "Exception in DoCreateServiceInstance.postProcessAAIGET2 " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("DEBUG"," *** Exit postProcessAAIGET2 *** ", isDebugEnabled) + } + + public void preProcessRollback (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG"," ***** preProcessRollback ***** ", isDebugEnabled) + try { + + Object workflowException = execution.getVariable("WorkflowException"); + + if (workflowException instanceof WorkflowException) { + utils.log("DEBUG", "Prev workflowException: " + workflowException.getErrorMessage(), isDebugEnabled) + execution.setVariable("prevWorkflowException", workflowException); + //execution.setVariable("WorkflowException", null); + } + } catch (BpmnError e) { + utils.log("DEBUG", "BPMN Error during preProcessRollback", isDebugEnabled) + } catch(Exception ex) { + String msg = "Exception in preProcessRollback. " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + } + utils.log("DEBUG"," *** Exit preProcessRollback *** ", isDebugEnabled) + } + + public void postProcessRollback (Execution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG"," ***** postProcessRollback ***** ", isDebugEnabled) + String msg = "" + try { + Object workflowException = execution.getVariable("prevWorkflowException"); + if (workflowException instanceof WorkflowException) { + utils.log("DEBUG", "Setting prevException to WorkflowException: ", isDebugEnabled) + execution.setVariable("WorkflowException", workflowException); + } + execution.setVariable("rollbackData", null) + } catch (BpmnError b) { + utils.log("DEBUG", "BPMN Error during postProcessRollback", isDebugEnabled) + throw b; + } catch(Exception ex) { + msg = "Exception in postProcessRollback. " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + } + utils.log("DEBUG"," *** Exit postProcessRollback *** ", isDebugEnabled) + } + +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceRollback.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceRollback.groovy new file mode 100644 index 0000000000..9fa6664820 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceRollback.groovy @@ -0,0 +1,237 @@ +/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.mso.bpmn.infrastructure.scripts
+
+
+import static org.apache.commons.lang3.StringUtils.*;
+import groovy.xml.XmlUtil
+import groovy.json.*
+
+import org.openecomp.mso.bpmn.core.json.JsonUtils
+import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils
+import org.openecomp.mso.bpmn.core.RollbackData
+import org.openecomp.mso.bpmn.core.WorkflowException
+import org.openecomp.mso.rest.APIResponse;
+import org.openecomp.mso.rest.RESTClient
+import org.openecomp.mso.rest.RESTConfig
+
+import java.util.UUID;
+
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.runtime.Execution
+import org.json.JSONObject;
+import org.apache.commons.lang3.*
+import org.apache.commons.codec.binary.Base64;
+import org.springframework.web.util.UriUtils;
+/**
+ * This groovy class supports the <class>DoCreateServiceInstanceRollback.bpmn</class> process.
+ *
+ * Inputs:
+ * @param - msoRequestId
+ * @param - rollbackData with
+ * globalCustomerId
+ * subscriptionServiceType
+ * serviceInstanceId
+ * disableRollback
+ * rollbackAAI
+ * rollbackSDNC
+ * sdncRollbackRequest
+ *
+ *
+ * Outputs:
+ * @param - rollbackError
+ * @param - rolledBack (no localRB->null, localRB F->false, localRB S->true)
+ *
+ */
+public class DoCreateE2EServiceInstanceRollback extends AbstractServiceTaskProcessor{
+
+ String Prefix="DCRESIRB_"
+
+ public void preProcessRequest(Execution execution) {
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ execution.setVariable("prefix",Prefix)
+ String msg = ""
+ utils.log("DEBUG"," ***** preProcessRequest *****", isDebugEnabled)
+ execution.setVariable("rollbackAAI",false)
+ execution.setVariable("rollbackSDNC",false)
+
+ try {
+ def rollbackData = execution.getVariable("rollbackData")
+ utils.log("DEBUG", "RollbackData:" + rollbackData, isDebugEnabled)
+
+ if (rollbackData != null) {
+ if (rollbackData.hasType("SERVICEINSTANCE")) {
+
+ def serviceInstanceId = rollbackData.get("SERVICEINSTANCE", "serviceInstanceId")
+ execution.setVariable("serviceInstanceId", serviceInstanceId)
+
+ def subscriptionServiceType = rollbackData.get("SERVICEINSTANCE", "subscriptionServiceType")
+ execution.setVariable("subscriptionServiceType", subscriptionServiceType)
+
+ def globalSubscriberId = rollbackData.get("SERVICEINSTANCE", "globalSubscriberId")
+ execution.setVariable("globalSubscriberId", globalSubscriberId)
+
+ def rollbackAAI = rollbackData.get("SERVICEINSTANCE", "rollbackAAI")
+ if ("true".equals(rollbackAAI))
+ {
+ execution.setVariable("rollbackAAI",true)
+ }
+
+ def rollbackSDNC = rollbackData.get("SERVICEINSTANCE", "rollbackSDNC")
+ if ("true".equals(rollbackSDNC))
+ {
+ execution.setVariable("rollbackSDNC", true)
+ }
+
+ if (execution.getVariable("rollbackAAI") != true && execution.getVariable("rollbackSDNC") != true)
+ {
+ execution.setVariable("skipRollback", true)
+ }
+
+ def sdncDelete = rollbackData.get("SERVICEINSTANCE", "sdncDelete")
+ execution.setVariable("sdncDelete", sdncDelete)
+ def sdncDeactivate = rollbackData.get("SERVICEINSTANCE", "sdncDeactivate")
+ execution.setVariable("sdncDeactivate", sdncDeactivate)
+ utils.log("DEBUG","sdncDeactivate:\n" + sdncDeactivate, isDebugEnabled)
+ utils.log("DEBUG","sdncDelete:\n" + sdncDelete, isDebugEnabled)
+ }
+ else {
+ execution.setVariable("skipRollback", true)
+ }
+ }
+ else {
+ execution.setVariable("skipRollback", true)
+ }
+ if (execution.getVariable("disableRollback").equals("true" ))
+ {
+ execution.setVariable("skipRollback", true)
+ }
+
+ } catch (BpmnError e) {
+ throw e;
+ } catch (Exception ex){
+ msg = "Exception in Create ServiceInstance Rollback preProcessRequest " + ex.getMessage()
+ utils.log("DEBUG", msg, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ utils.log("DEBUG"," ***** Exit preProcessRequest *****", isDebugEnabled)
+ }
+
+ public void validateSDNCResponse(Execution execution, String response, String method) {
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ utils.log("DEBUG"," ***** validateSDNCResponse ***** ", isDebugEnabled)
+ String msg = ""
+ try {
+ WorkflowException workflowException = execution.getVariable("WorkflowException")
+ boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator")
+ utils.log("DEBUG", "SDNCResponse: " + response, isDebugEnabled)
+ utils.log("DEBUG", "workflowException: " + workflowException, isDebugEnabled)
+
+ SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this)
+ sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator)
+
+ if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){
+ msg = "SDNC Adapter service-instance rollback successful for " + method
+ utils.log("DEBUG", msg, isDebugEnabled)
+ }else{
+ execution.setVariable("rolledBack", false)
+ msg = "Error Response from SDNC Adapter service-instance rollback for " + method
+ execution.setVariable("rollbackError", msg)
+ utils.log("DEBUG", msg, isDebugEnabled)
+ throw new BpmnError("MSOWorkflowException")
+ }
+ } catch (BpmnError e) {
+ throw e;
+ } catch (Exception ex){
+ msg = "Exception in Create ServiceInstance rollback for " + method + " Exception:" + ex.getMessage()
+ utils.log("DEBUG", msg, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ utils.log("DEBUG"," ***** Exit validateSDNCResponse ***** ", isDebugEnabled)
+ }
+
+ public void postProcessRequest(Execution execution) {
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ utils.log("DEBUG"," ***** postProcessRequest ***** ", isDebugEnabled)
+ String msg = ""
+ try {
+ execution.setVariable("rollbackData", null)
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+ boolean rollbackAAI = execution.getVariable("rollbackAAI")
+ boolean rollbackSDNC = execution.getVariable("rollbackSDNC")
+ if (rollbackAAI == true || rollbackSDNC == true)
+ {
+ execution.setVariable("rolledBack", true)
+ }
+ if (rollbackAAI == true)
+ {
+ boolean succInAAI = execution.getVariable("GENDS_SuccessIndicator")
+ if(succInAAI != true){
+ execution.setVariable("rolledBack", false) //both sdnc and aai must be successful to declare rollback Succesful
+ execution.setVariable("rollbackError", "Error deleting service-instance in AAI for rollback")
+ utils.log("DEBUG","Error deleting service-instance in AAI for rollback", + serviceInstanceId, isDebugEnabled)
+ }
+ }
+ utils.log("DEBUG","*** Exit postProcessRequest ***", isDebugEnabled)
+
+ } catch (BpmnError e) {
+ msg = "Exception in Create ServiceInstance Rollback postProcessRequest. " + e.getMessage()
+ utils.log("DEBUG", msg, isDebugEnabled)
+ } catch (Exception ex) {
+ msg = "Exception in Create ServiceInstance Rollback postProcessRequest. " + ex.getMessage()
+ utils.log("DEBUG", msg, isDebugEnabled)
+ }
+
+ }
+
+ public void processRollbackException(Execution execution){
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ utils.log("DEBUG"," ***** processRollbackException ***** ", isDebugEnabled)
+ try{
+ utils.log("DEBUG", "Caught an Exception in DoCreateServiceInstanceRollback", isDebugEnabled)
+ execution.setVariable("rollbackData", null)
+ execution.setVariable("rollbackError", "Caught exception in ServiceInstance Create Rollback")
+ execution.setVariable("WorkflowException", null)
+
+ }catch(BpmnError b){
+ utils.log("DEBUG", "BPMN Error during processRollbackExceptions Method: ", isDebugEnabled)
+ }catch(Exception e){
+ utils.log("DEBUG", "Caught Exception during processRollbackExceptions Method: " + e.getMessage(), isDebugEnabled)
+ }
+
+ utils.log("DEBUG", " Exit processRollbackException", isDebugEnabled)
+ }
+
+ public void processRollbackJavaException(Execution execution){
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ utils.log("DEBUG"," ***** processRollbackJavaException ***** ", isDebugEnabled)
+ try{
+ execution.setVariable("rollbackData", null)
+ execution.setVariable("rollbackError", "Caught Java exception in ServiceInstance Create Rollback")
+ utils.log("DEBUG", "Caught Exception in processRollbackJavaException", isDebugEnabled)
+
+ }catch(Exception e){
+ utils.log("DEBUG", "Caught Exception in processRollbackJavaException " + e.getMessage(), isDebugEnabled)
+ }
+ utils.log("DEBUG", "***** Exit processRollbackJavaException *****", isDebugEnabled)
+ }
+
+}
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateCustomE2EServiceInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateCustomE2EServiceInstance.bpmn new file mode 100644 index 0000000000..63eec4bb3d --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateCustomE2EServiceInstance.bpmn @@ -0,0 +1,335 @@ +<?xml version="1.0" encoding="UTF-8"?> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0"> + <bpmn:process id="Process_1" isExecutable="true"> + <bpmn:startEvent id="StartEvent_00qj6ro" name="Create SI Start Flow"> + <bpmn:outgoing>SequenceFlow_0s2spoq</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:subProcess id="SubProcess_0ka59nc" name="Sub-process for UnexpectedErrors" triggeredByEvent="true"> + <bpmn:scriptTask id="ScriptTask_0u3lw39" name="Handle Unexpected Error" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1dsbjjb</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1yay321</bpmn:outgoing> + <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* +ExceptionUtil ex = new ExceptionUtil() +ex.processJavaException(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:startEvent id="StartEvent_0v1ffn4"> + <bpmn:outgoing>SequenceFlow_1dsbjjb</bpmn:outgoing> + <bpmn:errorEventDefinition /> + </bpmn:startEvent> + <bpmn:endEvent id="EndEvent_0eznq6x"> + <bpmn:incoming>SequenceFlow_1yay321</bpmn:incoming> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_1dsbjjb" name="" sourceRef="StartEvent_0v1ffn4" targetRef="ScriptTask_0u3lw39" /> + <bpmn:sequenceFlow id="SequenceFlow_1yay321" name="" sourceRef="ScriptTask_0u3lw39" targetRef="EndEvent_0eznq6x" /> + </bpmn:subProcess> + <bpmn:callActivity id="CallActivity_0rhljy8" name="Call DoCreateCustomE2EServiceInstance " calledElement="DoCreateCustomE2EServiceInstance"> + <bpmn:extensionElements> + <camunda:out source="WorkflowException" target="WorkflowException" /> + <camunda:in source="msoRequestId" target="msoRequestId" /> + <camunda:out source="rollbackData" target="rollbackData" /> + <camunda:in source="serviceInstanceId" target="serviceInstanceId" /> + <camunda:in source="serviceInstanceName" target="serviceInstanceName" /> + <camunda:in source="serviceModelInfo" target="serviceModelInfo" /> + <camunda:in source="productFamilyId" target="productFamilyId" /> + <camunda:in source="disableRollback" target="disableRollback" /> + <camunda:in source="serviceInputParams" target="serviceInputParams" /> + <camunda:out source="rolledBack" target="rolledBack" /> + <camunda:out source="serviceInstanceName" target="serviceInstanceName" /> + <camunda:in source="failIfExists" target="failIfExists" /> + <camunda:in source="globalSubscriberId" target="globalSubscriberId" /> + <camunda:in source="subscriptionServiceType" target="subscriptionServiceType" /> + <camunda:in sourceExpression="1610" target="sdncVersion" /> + <camunda:in source="initialStatus" target="initialStatus" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_19eilro</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0klbpxx</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:endEvent id="EndEvent_0bpd6c0" name="End"> + <bpmn:incoming>SequenceFlow_0yayvrf</bpmn:incoming> + </bpmn:endEvent> + <bpmn:scriptTask id="ScriptTask_1s09c7d" name="Pre Process Incoming Request" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0s2spoq</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0z4faf9</bpmn:outgoing> + <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def csi= new CreateCustomE2EServiceInstance() +csi.preProcessRequest(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="ScriptTask_0ttvn8r" name="Prepare Completion Request" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_14zu6wr</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0je30si</bpmn:outgoing> + <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def csi = new CreateCustomE2EServiceInstance() +csi.prepareCompletionRequest(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:callActivity id="CallActivity_02fyxz0" name="Call CompleteMsoProcess" calledElement="CompleteMsoProcess"> + <bpmn:extensionElements> + <camunda:in source="completionRequest" target="CompleteMsoProcessRequest" /> + <camunda:in source="mso-request-id" target="mso-request-id" /> + <camunda:in source="mso-service-instance-id" target="mso-service-instance-id" /> + <camunda:out source="CMSO_ResponseCode" target="CMSO_ResponseCode" /> + <camunda:out source="CompleteMsoProcessResponse" target="CompleteMsoProcessResponse" /> + <camunda:out source="CMSO_ErrorResponse" target="CMSO_ErrorResponse" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_0je30si</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0yayvrf</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:subProcess id="SubProcess_0vaws86" name="Sub-process for FalloutHandler and Rollback" triggeredByEvent="true"> + <bpmn:startEvent id="StartEvent_0dug28e"> + <bpmn:outgoing>SequenceFlow_0e1r62n</bpmn:outgoing> + <bpmn:errorEventDefinition /> + </bpmn:startEvent> + <bpmn:endEvent id="EndEvent_03wysuk"> + <bpmn:incoming>SequenceFlow_1ysapam</bpmn:incoming> + </bpmn:endEvent> + <bpmn:scriptTask id="ScriptTask_0u8o9p2" name="Prepare Fallout Request" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0n9pexp</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_01umodj</bpmn:outgoing> + <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def csi = new CreateCustomE2EServiceInstance() +csi.prepareFalloutRequest(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:callActivity id="CallActivity_1ang7q8" name="Call FalloutHandler" calledElement="FalloutHandler"> + <bpmn:extensionElements> + <camunda:in source="falloutRequest" target="FalloutHandlerRequest" /> + <camunda:in source="mso-request-id" target="mso-request-id" /> + <camunda:in source="mso-service-instance-id" target="mso-service-instance-id" /> + <camunda:out source="FH_ResponseCode" target="FH_ResponseCode" /> + <camunda:out source="FalloutHandlerResponse" target="FalloutHandlerResponse" /> + <camunda:out source="FH_ErrorResponse" target="FH_ErrorResponse" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_01umodj</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1ysapam</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:scriptTask id="ScriptTask_1rn6nqi" name="Send Error Response"> + <bpmn:incoming>SequenceFlow_0e1r62n</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0n9pexp</bpmn:outgoing> + <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def csi = new CreateCustomE2EServiceInstance() +csi.sendSyncError(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_0e1r62n" sourceRef="StartEvent_0dug28e" targetRef="ScriptTask_1rn6nqi" /> + <bpmn:sequenceFlow id="SequenceFlow_1ysapam" sourceRef="CallActivity_1ang7q8" targetRef="EndEvent_03wysuk" /> + <bpmn:sequenceFlow id="SequenceFlow_0n9pexp" sourceRef="ScriptTask_1rn6nqi" targetRef="ScriptTask_0u8o9p2" /> + <bpmn:sequenceFlow id="SequenceFlow_01umodj" sourceRef="ScriptTask_0u8o9p2" targetRef="CallActivity_1ang7q8" /> + </bpmn:subProcess> + <bpmn:scriptTask id="ScriptTask_0xupxj9" name="Send Sync Ack Response" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0z4faf9</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_19eilro</bpmn:outgoing> + <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def csi = new CreateCustomE2EServiceInstance() +csi.sendSyncResponse(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:exclusiveGateway id="ExclusiveGateway_0aqn64l" name="Success?"> + <bpmn:incoming>SequenceFlow_0klbpxx</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_14zu6wr</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_1fueo69</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:endEvent id="EndEvent_07uk5iy"> + <bpmn:incoming>SequenceFlow_1fueo69</bpmn:incoming> + <bpmn:errorEventDefinition /> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_0s2spoq" sourceRef="StartEvent_00qj6ro" targetRef="ScriptTask_1s09c7d" /> + <bpmn:sequenceFlow id="SequenceFlow_19eilro" sourceRef="ScriptTask_0xupxj9" targetRef="CallActivity_0rhljy8" /> + <bpmn:sequenceFlow id="SequenceFlow_0klbpxx" sourceRef="CallActivity_0rhljy8" targetRef="ExclusiveGateway_0aqn64l" /> + <bpmn:sequenceFlow id="SequenceFlow_0yayvrf" sourceRef="CallActivity_02fyxz0" targetRef="EndEvent_0bpd6c0" /> + <bpmn:sequenceFlow id="SequenceFlow_0z4faf9" sourceRef="ScriptTask_1s09c7d" targetRef="ScriptTask_0xupxj9" /> + <bpmn:sequenceFlow id="SequenceFlow_14zu6wr" name="yes" sourceRef="ExclusiveGateway_0aqn64l" targetRef="ScriptTask_0ttvn8r"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{execution.getVariable("WorkflowException") == null}]]></bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="SequenceFlow_0je30si" sourceRef="ScriptTask_0ttvn8r" targetRef="CallActivity_02fyxz0" /> + <bpmn:sequenceFlow id="SequenceFlow_1fueo69" name="no" sourceRef="ExclusiveGateway_0aqn64l" targetRef="EndEvent_07uk5iy"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{execution.getVariable("WorkflowException") != null}]]></bpmn:conditionExpression> + </bpmn:sequenceFlow> + </bpmn:process> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1"> + <bpmndi:BPMNShape id="StartEvent_00qj6ro_di" bpmnElement="StartEvent_00qj6ro"> + <dc:Bounds x="235" y="180" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="216" y="221" width="75" height="24" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="SubProcess_0ka59nc_di" bpmnElement="SubProcess_0ka59nc" isExpanded="true"> + <dc:Bounds x="463" y="632" width="394" height="188" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_0rhljy8_di" bpmnElement="CallActivity_0rhljy8"> + <dc:Bounds x="701" y="158" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_0bpd6c0_di" bpmnElement="EndEvent_0bpd6c0"> + <dc:Bounds x="1258" y="286" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1268" y="322" width="22" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1s09c7d_di" bpmnElement="ScriptTask_1s09c7d"> + <dc:Bounds x="353" y="158" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0ttvn8r_di" bpmnElement="ScriptTask_0ttvn8r"> + <dc:Bounds x="1038" y="158" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_02fyxz0_di" bpmnElement="CallActivity_02fyxz0"> + <dc:Bounds x="1226" y="158" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="SubProcess_0vaws86_di" bpmnElement="SubProcess_0vaws86" isExpanded="true"> + <dc:Bounds x="348" y="370" width="679" height="194" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0xupxj9_di" bpmnElement="ScriptTask_0xupxj9"> + <dc:Bounds x="521" y="158" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ExclusiveGateway_0aqn64l_di" bpmnElement="ExclusiveGateway_0aqn64l" isMarkerVisible="true"> + <dc:Bounds x="903" y="173" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="903" y="145" width="50" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_07uk5iy_di" bpmnElement="EndEvent_07uk5iy"> + <dc:Bounds x="910" y="286" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="883" y="322" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0s2spoq_di" bpmnElement="SequenceFlow_0s2spoq"> + <di:waypoint xsi:type="dc:Point" x="271" y="198" /> + <di:waypoint xsi:type="dc:Point" x="353" y="198" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="267" y="183" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_19eilro_di" bpmnElement="SequenceFlow_19eilro"> + <di:waypoint xsi:type="dc:Point" x="621" y="198" /> + <di:waypoint xsi:type="dc:Point" x="701" y="198" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="616" y="183" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0klbpxx_di" bpmnElement="SequenceFlow_0klbpxx"> + <di:waypoint xsi:type="dc:Point" x="801" y="198" /> + <di:waypoint xsi:type="dc:Point" x="903" y="198" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="807" y="183" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0yayvrf_di" bpmnElement="SequenceFlow_0yayvrf"> + <di:waypoint xsi:type="dc:Point" x="1276" y="238" /> + <di:waypoint xsi:type="dc:Point" x="1276" y="286" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1246" y="262" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0z4faf9_di" bpmnElement="SequenceFlow_0z4faf9"> + <di:waypoint xsi:type="dc:Point" x="453" y="198" /> + <di:waypoint xsi:type="dc:Point" x="521" y="198" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="442" y="183" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_14zu6wr_di" bpmnElement="SequenceFlow_14zu6wr"> + <di:waypoint xsi:type="dc:Point" x="953" y="198" /> + <di:waypoint xsi:type="dc:Point" x="990" y="198" /> + <di:waypoint xsi:type="dc:Point" x="990" y="198" /> + <di:waypoint xsi:type="dc:Point" x="1038" y="198" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="987" y="195" width="20" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0je30si_di" bpmnElement="SequenceFlow_0je30si"> + <di:waypoint xsi:type="dc:Point" x="1138" y="198" /> + <di:waypoint xsi:type="dc:Point" x="1226" y="198" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1137" y="183" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1fueo69_di" bpmnElement="SequenceFlow_1fueo69"> + <di:waypoint xsi:type="dc:Point" x="928" y="223" /> + <di:waypoint xsi:type="dc:Point" x="928" y="250" /> + <di:waypoint xsi:type="dc:Point" x="928" y="250" /> + <di:waypoint xsi:type="dc:Point" x="928" y="286" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="901" y="228" width="15" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0u3lw39_di" bpmnElement="ScriptTask_0u3lw39"> + <dc:Bounds x="611" y="687" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="StartEvent_0v1ffn4_di" bpmnElement="StartEvent_0v1ffn4"> + <dc:Bounds x="496" y="709" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="469" y="750" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_0eznq6x_di" bpmnElement="EndEvent_0eznq6x"> + <dc:Bounds x="772" y="709" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="745" y="750" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="StartEvent_0dug28e_di" bpmnElement="StartEvent_0dug28e"> + <dc:Bounds x="363" y="456" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="336" y="497" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_03wysuk_di" bpmnElement="EndEvent_03wysuk"> + <dc:Bounds x="942" y="456" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="915" y="497" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0u8o9p2_di" bpmnElement="ScriptTask_0u8o9p2"> + <dc:Bounds x="621" y="434" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_1ang7q8_di" bpmnElement="CallActivity_1ang7q8"> + <dc:Bounds x="798" y="434" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1rn6nqi_di" bpmnElement="ScriptTask_1rn6nqi"> + <dc:Bounds x="443" y="434" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1dsbjjb_di" bpmnElement="SequenceFlow_1dsbjjb"> + <di:waypoint xsi:type="dc:Point" x="532" y="727" /> + <di:waypoint xsi:type="dc:Point" x="611" y="727" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="529.5" y="727" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1yay321_di" bpmnElement="SequenceFlow_1yay321"> + <di:waypoint xsi:type="dc:Point" x="711" y="727" /> + <di:waypoint xsi:type="dc:Point" x="772" y="727" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="701.5" y="727" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0e1r62n_di" bpmnElement="SequenceFlow_0e1r62n"> + <di:waypoint xsi:type="dc:Point" x="399" y="474" /> + <di:waypoint xsi:type="dc:Point" x="421" y="474" /> + <di:waypoint xsi:type="dc:Point" x="421" y="474" /> + <di:waypoint xsi:type="dc:Point" x="442" y="474" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="391" y="474" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1ysapam_di" bpmnElement="SequenceFlow_1ysapam"> + <di:waypoint xsi:type="dc:Point" x="898" y="474" /> + <di:waypoint xsi:type="dc:Point" x="942" y="474" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="875" y="459" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0n9pexp_di" bpmnElement="SequenceFlow_0n9pexp"> + <di:waypoint xsi:type="dc:Point" x="543" y="474" /> + <di:waypoint xsi:type="dc:Point" x="570" y="474" /> + <di:waypoint xsi:type="dc:Point" x="570" y="474" /> + <di:waypoint xsi:type="dc:Point" x="621" y="474" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="540" y="474" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_01umodj_di" bpmnElement="SequenceFlow_01umodj"> + <di:waypoint xsi:type="dc:Point" x="721" y="474" /> + <di:waypoint xsi:type="dc:Point" x="798" y="474" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="715.5" y="459" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn:definitions> diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn new file mode 100644 index 0000000000..a4532baf63 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn @@ -0,0 +1,431 @@ +<?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.10.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> + <bpmn2:process id="DoCreateServiceInstance" name="DoCreateServiceInstance" isExecutable="true"> + <bpmn2:startEvent id="createSI_startEvent" name="Start Flow"> + <bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing> + </bpmn2:startEvent> + <bpmn2:sequenceFlow id="SequenceFlow_1" name="" sourceRef="createSI_startEvent" targetRef="preProcessRequest_ScriptTask" /> + <bpmn2:scriptTask id="getAAICustomerById_scriptTask" name="Get AAI Customer By globalCustomerId " scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_2</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_3</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def dcsi = new DoCreateE2EServiceInstance() +dcsi.getAAICustomerById(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_3" name="" sourceRef="getAAICustomerById_scriptTask" targetRef="ExclusiveGateway_09wkav2" /> + <bpmn2:scriptTask id="preProcessRequest_ScriptTask" name="PreProcess Incoming Request" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_2</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def dcsi = new DoCreateE2EServiceInstance() +dcsi.preProcessRequest(execution) +]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_4" name="" sourceRef="callCustomE2EGetService" targetRef="ScriptTask_0i8cqdy" /> + <bpmn2:scriptTask id="PreProcessSDNCAssignRequest" name="PreProcess SDNC Assign Request" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_156ih25</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_14</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def dcsi = new DoCreateE2EServiceInstance() +dcsi.preProcessSDNCAssignRequest(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:scriptTask id="PostProcessSDNCAssignRequest" name="Post Process SDNC Assign Request" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_9</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_10</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def dcsi = new DoCreateE2EServiceInstance() +dcsi.postProcessSDNCAssign(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:callActivity id="CallSDNCAdapterServiceTopologyAssign" name="Call SDNC Adapter Service Topology Assign" calledElement="sdncAdapter"> + <bpmn2:extensionElements> + <camunda:in source="sdncAssignRequest" target="sdncAdapterWorkflowRequest" /> + <camunda:in source="msoRequestId" target="mso-request-id" /> + <camunda:in source="serviceInstanceId" target="mso-service-instance-id" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + <camunda:out source="sdncAdapterResponse" target="sdncAdapterResponse" /> + <camunda:out source="SDNCA_SuccessIndicator" target="SDNCA_SuccessIndicator" /> + </bpmn2:extensionElements> + <bpmn2:incoming>SequenceFlow_14</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_9</bpmn2:outgoing> + </bpmn2:callActivity> + <bpmn2:endEvent id="EndEvent_3"> + <bpmn2:incoming>SequenceFlow_01q6pl4</bpmn2:incoming> + </bpmn2:endEvent> + <bpmn2:sequenceFlow id="SequenceFlow_2" name="" sourceRef="preProcessRequest_ScriptTask" targetRef="getAAICustomerById_scriptTask" /> + <bpmn2:sequenceFlow id="SequenceFlow_14" name="" sourceRef="PreProcessSDNCAssignRequest" targetRef="CallSDNCAdapterServiceTopologyAssign" /> + <bpmn2:sequenceFlow id="SequenceFlow_9" name="" sourceRef="CallSDNCAdapterServiceTopologyAssign" targetRef="PostProcessSDNCAssignRequest" /> + <bpmn2:sequenceFlow id="SequenceFlow_10" name="" sourceRef="PostProcessSDNCAssignRequest" targetRef="CallActivity_1707jgc" /> + <bpmn2:callActivity id="callCustomE2EGetService" name="Call Custom E2E Get Service" calledElement="CustomE2EGetService"> + <bpmn2:extensionElements> + <camunda:in source="serviceInstanceName" target="GENGS_serviceInstanceName" /> + <camunda:in source="globalSubscriberId" target="GENGS_globalCustomerId" /> + <camunda:in sourceExpression="service-instance" target="GENGS_type" /> + <camunda:out source="GENGS_FoundIndicator" target="GENGS_FoundIndicator" /> + <camunda:out source="GENGS_SuccessIndicator" target="GENGS_SuccessIndicator" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + </bpmn2:extensionElements> + <bpmn2:incoming>SequenceFlow_11fnnkb</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_4</bpmn2:outgoing> + </bpmn2:callActivity> + <bpmn2:callActivity id="callCustomE2EPutService" name="Call Custom E2E Put Service" calledElement="CustomE2EPutService"> + <bpmn2:extensionElements> + <camunda:in source="globalSubscriberId" target="GENPS_globalSubscriberId" /> + <camunda:in source="serviceInstanceId" target="GENPS_serviceInstanceId" /> + <camunda:in source="subscriptionServiceType" target="GENPS_serviceType" /> + <camunda:in sourceExpression="service-instance" target="GENPS_type" /> + <camunda:in source="serviceInstanceData" target="GENPS_payload" /> + <camunda:out source="GENPS_SuccessIndicator" target="GENPS_SuccessIndicator" /> + <camunda:in source="msoRequestId" target="GENPS_requesId" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + </bpmn2:extensionElements> + <bpmn2:incoming>SequenceFlow_1uw2p9a</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_1w01tqs</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_129ih1g</bpmn2:outgoing> + </bpmn2:callActivity> + <bpmn2:sequenceFlow id="SequenceFlow_129ih1g" sourceRef="callCustomE2EPutService" targetRef="ScriptTask_0q37vn9" /> + <bpmn2:exclusiveGateway id="ExclusiveGateway_09wkav2" name="sdncVersion is 1610 or serviceInstance name is populated?" default="SequenceFlow_1uw2p9a"> + <bpmn2:incoming>SequenceFlow_3</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_11fnnkb</bpmn2:outgoing> + <bpmn2:outgoing>SequenceFlow_1uw2p9a</bpmn2:outgoing> + </bpmn2:exclusiveGateway> + <bpmn2:sequenceFlow id="SequenceFlow_11fnnkb" name="yes" sourceRef="ExclusiveGateway_09wkav2" targetRef="callCustomE2EGetService"> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{(execution.getVariable("serviceInstanceName" ) != null && execution.getVariable("serviceInstanceName" ) != "" ) || execution.getVariable("sdncVersion" ) == "1610" }]]></bpmn2:conditionExpression> + </bpmn2:sequenceFlow> + <bpmn2:sequenceFlow id="SequenceFlow_1uw2p9a" name="no" sourceRef="ExclusiveGateway_09wkav2" targetRef="callCustomE2EPutService" /> + <bpmn2:subProcess id="SubProcess_06d8lk8" name="Sub-process for Application Errors" triggeredByEvent="true"> + <bpmn2:startEvent id="StartEvent_0yljq9y"> + <bpmn2:outgoing>SequenceFlow_0tgrn11</bpmn2:outgoing> + <bpmn2:errorEventDefinition /> + </bpmn2:startEvent> + <bpmn2:endEvent id="EndEvent_117lkk3"> + <bpmn2:incoming>SequenceFlow_1xzgv5k</bpmn2:incoming> + </bpmn2:endEvent> + <bpmn2:callActivity id="CallActivity_1srx6p6" name="Call DoCreateE2EServiceInstanceRollback" calledElement="DoCreateE2EServiceInstanceRollback"> + <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_1lqktwf</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_0eumzpf</bpmn2:outgoing> + </bpmn2:callActivity> + <bpmn2:sequenceFlow id="SequenceFlow_0eumzpf" sourceRef="CallActivity_1srx6p6" targetRef="ScriptTask_1p0vyip" /> + <bpmn2:sequenceFlow id="SequenceFlow_0tgrn11" sourceRef="StartEvent_0yljq9y" targetRef="ScriptTask_0ocetux" /> + <bpmn2:scriptTask id="ScriptTask_0ocetux" name="Pre Process Rollback" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_0tgrn11</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_1lqktwf</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def dcsi = new DoCreateE2EServiceInstance() +dcsi.preProcessRollback(execution) +]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_1lqktwf" sourceRef="ScriptTask_0ocetux" targetRef="CallActivity_1srx6p6" /> + <bpmn2:scriptTask id="ScriptTask_1p0vyip" name="Post Process Rollback" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_0eumzpf</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_1xzgv5k</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def dcsi = new DoCreateE2EServiceInstance() +dcsi.postProcessRollback(execution) +]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_1xzgv5k" sourceRef="ScriptTask_1p0vyip" targetRef="EndEvent_117lkk3" /> + </bpmn2:subProcess> + <bpmn2:exclusiveGateway id="ExclusiveGateway_1nk6aol" name="sdncVersion is 1610?" default="SequenceFlow_156ih25"> + <bpmn2:incoming>SequenceFlow_1dd86x8</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_156ih25</bpmn2:outgoing> + <bpmn2:outgoing>SequenceFlow_00v4npo</bpmn2:outgoing> + </bpmn2:exclusiveGateway> + <bpmn2:sequenceFlow id="SequenceFlow_156ih25" name="no" sourceRef="ExclusiveGateway_1nk6aol" targetRef="PreProcessSDNCAssignRequest" /> + <bpmn2:endEvent id="EndEvent_10659gr"> + <bpmn2:incoming>SequenceFlow_00v4npo</bpmn2:incoming> + </bpmn2:endEvent> + <bpmn2:sequenceFlow id="SequenceFlow_00v4npo" name="yes" sourceRef="ExclusiveGateway_1nk6aol" targetRef="EndEvent_10659gr"> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("sdncVersion" ) == "1610"}]]></bpmn2:conditionExpression> + </bpmn2:sequenceFlow> + <bpmn2:scriptTask id="ScriptTask_0i8cqdy" name="Post Process AAI GET" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_4</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_1w01tqs</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def dcsi = new DoCreateE2EServiceInstance() +dcsi.postProcessAAIGET(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_1w01tqs" sourceRef="ScriptTask_0i8cqdy" targetRef="callCustomE2EPutService" /> + <bpmn2:scriptTask id="ScriptTask_0q37vn9" name="Post Process AAI PUT" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_129ih1g</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_1dd86x8</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def ddsi = new DoCreateE2EServiceInstance() +ddsi.postProcessAAIPUT(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_1dd86x8" sourceRef="ScriptTask_0q37vn9" targetRef="ExclusiveGateway_1nk6aol" /> + <bpmn2:callActivity id="CallActivity_1707jgc" name="Call CustomE2EGetService2" calledElement="CustomE2EGetService"> + <bpmn2:extensionElements> + <camunda:in source="serviceInstanceId" target="GENGS_serviceInstanceId" /> + <camunda:in sourceExpression="service-instance" target="GENGS_type" /> + <camunda:in source="globalSubscriberId" target="GENGS_globalCustomerId" /> + <camunda:in source="subscriptionServiceType" target="GENGS_serviceType" /> + <camunda:out source="GENGS_FoundIndicator" target="GENGS_FoundIndicator" /> + <camunda:out source="GENGS_SuccessIndicator" target="GENGS_SuccessIndicator" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + <camunda:out source="GENGS_service" target="GENGS_service" /> + </bpmn2:extensionElements> + <bpmn2:incoming>SequenceFlow_10</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_0tx5frq</bpmn2:outgoing> + </bpmn2:callActivity> + <bpmn2:sequenceFlow id="SequenceFlow_0tx5frq" sourceRef="CallActivity_1707jgc" targetRef="ScriptTask_1tp0fcx" /> + <bpmn2:sequenceFlow id="SequenceFlow_01q6pl4" sourceRef="ScriptTask_1tp0fcx" targetRef="EndEvent_3" /> + <bpmn2:scriptTask id="ScriptTask_1tp0fcx" name="Post Process AAI GET2" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_0tx5frq</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_01q6pl4</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def dcsi = new DoCreateE2EServiceInstance() +dcsi.postProcessAAIGET2(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + </bpmn2:process> + <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="DoCreateServiceInstance"> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_47" bpmnElement="createSI_startEvent"> + <dc:Bounds x="152" y="79" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="147" y="120" width="48" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_61" bpmnElement="preProcessRequest_ScriptTask"> + <dc:Bounds x="245" y="57" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="_BPMNShape_StartEvent_47" targetElement="_BPMNShape_ScriptTask_61"> + <di:waypoint xsi:type="dc:Point" x="188" y="97" /> + <di:waypoint xsi:type="dc:Point" x="245" y="97" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="217" y="82" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_62" bpmnElement="getAAICustomerById_scriptTask"> + <dc:Bounds x="393" y="57" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_6" bpmnElement="SequenceFlow_3" sourceElement="_BPMNShape_ScriptTask_62"> + <di:waypoint xsi:type="dc:Point" x="493" y="97" /> + <di:waypoint xsi:type="dc:Point" x="565" y="97" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="529" y="82" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_EndEvent_177" bpmnElement="EndEvent_3"> + <dc:Bounds x="1115" y="1165" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1133" y="1206" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_10" bpmnElement="SequenceFlow_4"> + <di:waypoint xsi:type="dc:Point" x="839" y="94" /> + <di:waypoint xsi:type="dc:Point" x="971" y="94" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="905" y="79" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_334" bpmnElement="PreProcessSDNCAssignRequest"> + <dc:Bounds x="972" y="578" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_335" bpmnElement="PostProcessSDNCAssignRequest"> + <dc:Bounds x="972" y="864" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_CallActivity_74" bpmnElement="CallSDNCAdapterServiceTopologyAssign"> + <dc:Bounds x="972" y="721" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="SequenceFlow_2" sourceElement="_BPMNShape_ScriptTask_61" targetElement="_BPMNShape_ScriptTask_62"> + <di:waypoint xsi:type="dc:Point" x="345" y="97" /> + <di:waypoint xsi:type="dc:Point" x="393" y="97" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="369" y="82" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_8" bpmnElement="SequenceFlow_14" sourceElement="_BPMNShape_ScriptTask_334" targetElement="_BPMNShape_CallActivity_74"> + <di:waypoint xsi:type="dc:Point" x="1020" y="658" /> + <di:waypoint xsi:type="dc:Point" x="1020" y="692" /> + <di:waypoint xsi:type="dc:Point" x="1020" y="692" /> + <di:waypoint xsi:type="dc:Point" x="1020" y="715" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1035" y="692" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_11" bpmnElement="SequenceFlow_9" sourceElement="_BPMNShape_CallActivity_74" targetElement="_BPMNShape_ScriptTask_335"> + <di:waypoint xsi:type="dc:Point" x="1022" y="801" /> + <di:waypoint xsi:type="dc:Point" x="1022" y="840" /> + <di:waypoint xsi:type="dc:Point" x="1022" y="840" /> + <di:waypoint xsi:type="dc:Point" x="1022" y="864" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1037" y="840" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_12" bpmnElement="SequenceFlow_10" sourceElement="_BPMNShape_ScriptTask_335"> + <di:waypoint xsi:type="dc:Point" x="1024" y="944" /> + <di:waypoint xsi:type="dc:Point" x="1024" y="994" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1039" y="969" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="CallActivity_1md4kyb_di" bpmnElement="callCustomE2EGetService"> + <dc:Bounds x="739" y="57" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_0khp0qc_di" bpmnElement="callCustomE2EPutService"> + <dc:Bounds x="972" y="206" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_129ih1g_di" bpmnElement="SequenceFlow_129ih1g"> + <di:waypoint xsi:type="dc:Point" x="1023" y="286" /> + <di:waypoint xsi:type="dc:Point" x="1022" y="336" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1023" y="296" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ExclusiveGateway_09wkav2_di" bpmnElement="ExclusiveGateway_09wkav2" isMarkerVisible="true"> + <dc:Bounds x="565" y="72" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="547" y="7" width="81" height="62" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_11fnnkb_di" bpmnElement="SequenceFlow_11fnnkb"> + <di:waypoint xsi:type="dc:Point" x="615" y="97" /> + <di:waypoint xsi:type="dc:Point" x="739" y="97" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="635" y="76" width="18" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1uw2p9a_di" bpmnElement="SequenceFlow_1uw2p9a"> + <di:waypoint xsi:type="dc:Point" x="590" y="122" /> + <di:waypoint xsi:type="dc:Point" x="590" y="246" /> + <di:waypoint xsi:type="dc:Point" x="972" y="246" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="594" y="132.89706349694825" width="12" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="SubProcess_06d8lk8_di" bpmnElement="SubProcess_06d8lk8" isExpanded="true"> + <dc:Bounds x="99" y="531" width="783" height="195" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="StartEvent_0yljq9y_di" bpmnElement="StartEvent_0yljq9y"> + <dc:Bounds x="195" y="608" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="213" y="649" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_117lkk3_di" bpmnElement="EndEvent_117lkk3"> + <dc:Bounds x="828" y="608" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="846" y="649" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_1srx6p6_di" bpmnElement="CallActivity_1srx6p6"> + <dc:Bounds x="493" y="586" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0eumzpf_di" bpmnElement="SequenceFlow_0eumzpf"> + <di:waypoint xsi:type="dc:Point" x="593" y="626" /> + <di:waypoint xsi:type="dc:Point" x="661" y="626" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="627" y="611" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0tgrn11_di" bpmnElement="SequenceFlow_0tgrn11"> + <di:waypoint xsi:type="dc:Point" x="231" y="626" /> + <di:waypoint xsi:type="dc:Point" x="330" y="626" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="281" y="611" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ExclusiveGateway_1nk6aol_di" bpmnElement="ExclusiveGateway_1nk6aol" isMarkerVisible="true"> + <dc:Bounds x="997" y="460" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="903" y="472" width="75" height="24" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_156ih25_di" bpmnElement="SequenceFlow_156ih25"> + <di:waypoint xsi:type="dc:Point" x="1022" y="510" /> + <di:waypoint xsi:type="dc:Point" x="1022" y="545" /> + <di:waypoint xsi:type="dc:Point" x="1022" y="545" /> + <di:waypoint xsi:type="dc:Point" x="1022" y="575" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1039" y="510.8721806797853" width="12" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="EndEvent_10659gr_di" bpmnElement="EndEvent_10659gr"> + <dc:Bounds x="1103" y="467" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1121" y="508" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_00v4npo_di" bpmnElement="SequenceFlow_00v4npo"> + <di:waypoint xsi:type="dc:Point" x="1047" y="485" /> + <di:waypoint xsi:type="dc:Point" x="1103" y="485" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1063" y="461" width="18" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0i8cqdy_di" bpmnElement="ScriptTask_0i8cqdy"> + <dc:Bounds x="971" y="57" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1w01tqs_di" bpmnElement="SequenceFlow_1w01tqs"> + <di:waypoint xsi:type="dc:Point" x="1021" y="137" /> + <di:waypoint xsi:type="dc:Point" x="1021" y="172" /> + <di:waypoint xsi:type="dc:Point" x="1021" y="172" /> + <di:waypoint xsi:type="dc:Point" x="1021" y="206" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1036" y="172" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0q37vn9_di" bpmnElement="ScriptTask_0q37vn9"> + <dc:Bounds x="972" y="336" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1dd86x8_di" bpmnElement="SequenceFlow_1dd86x8"> + <di:waypoint xsi:type="dc:Point" x="1022" y="416" /> + <di:waypoint xsi:type="dc:Point" x="1022" y="460" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1037" y="438" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0ocetux_di" bpmnElement="ScriptTask_0ocetux"> + <dc:Bounds x="330" y="586" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1lqktwf_di" bpmnElement="SequenceFlow_1lqktwf"> + <di:waypoint xsi:type="dc:Point" x="430" y="626" /> + <di:waypoint xsi:type="dc:Point" x="493" y="626" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="462" y="611" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1p0vyip_di" bpmnElement="ScriptTask_1p0vyip"> + <dc:Bounds x="661" y="586" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1xzgv5k_di" bpmnElement="SequenceFlow_1xzgv5k"> + <di:waypoint xsi:type="dc:Point" x="761" y="626" /> + <di:waypoint xsi:type="dc:Point" x="793" y="626" /> + <di:waypoint xsi:type="dc:Point" x="793" y="626" /> + <di:waypoint xsi:type="dc:Point" x="828" y="626" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="808" y="626" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="CallActivity_1707jgc_di" bpmnElement="CallActivity_1707jgc"> + <dc:Bounds x="972" y="994" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0tx5frq_di" bpmnElement="SequenceFlow_0tx5frq"> + <di:waypoint xsi:type="dc:Point" x="1022" y="1074" /> + <di:waypoint xsi:type="dc:Point" x="1022" y="1143" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1037" y="1108.5" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_01q6pl4_di" bpmnElement="SequenceFlow_01q6pl4"> + <di:waypoint xsi:type="dc:Point" x="1072" y="1183" /> + <di:waypoint xsi:type="dc:Point" x="1115" y="1183" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1094" y="1168" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1tp0fcx_di" bpmnElement="ScriptTask_1tp0fcx"> + <dc:Bounds x="972" y="1143" width="100" height="80" /> + </bpmndi:BPMNShape> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn2:definitions> diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateE2EServiceInstanceRollback.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateE2EServiceInstanceRollback.bpmn new file mode 100644 index 0000000000..9e9045c144 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateE2EServiceInstanceRollback.bpmn @@ -0,0 +1,379 @@ +<?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.10.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> + <bpmn2:process id="DoCreateE2EServiceInstanceRollback" name="DoCreateE2EServiceInstanceRollback" isExecutable="true"> + <bpmn2:startEvent id="createSIRollback_startEvent" name="Start Flow"> + <bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing> + </bpmn2:startEvent> + <bpmn2:sequenceFlow id="SequenceFlow_1" name="" sourceRef="createSIRollback_startEvent" targetRef="preProcessRequest_ScriptTask" /> + <bpmn2:scriptTask id="preProcessRequest_ScriptTask" name="PreProcess Incoming Request" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_2</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def rbk = new DoCreateE2EServiceInstanceRollback() +rbk.preProcessRequest(execution) +]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:endEvent id="EndEvent_3"> + <bpmn2:incoming>SequenceFlow_01l4ssl</bpmn2:incoming> + </bpmn2:endEvent> + <bpmn2:subProcess id="UnexpectedError_SubProcess_1" name="Sub-process for Errors" triggeredByEvent="true"> + <bpmn2:startEvent id="StartEvent_1"> + <bpmn2:outgoing>SequenceFlow_8</bpmn2:outgoing> + <bpmn2:errorEventDefinition id="_ErrorEventDefinition_92" /> + </bpmn2:startEvent> + <bpmn2:endEvent id="EndEvent_1"> + <bpmn2:incoming>SequenceFlow_7</bpmn2:incoming> + </bpmn2:endEvent> + <bpmn2:sequenceFlow id="SequenceFlow_8" name="" sourceRef="StartEvent_1" targetRef="ScriptTask_1" /> + <bpmn2:scriptTask id="ScriptTask_1" name="Handle Errors" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_8</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_7</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def rbk= new DoCreateE2EServiceInstanceRollback() +rbk.processRollbackException(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_7" name="" sourceRef="ScriptTask_1" targetRef="EndEvent_1" /> + </bpmn2:subProcess> + <bpmn2:sequenceFlow id="SequenceFlow_2" name="" sourceRef="preProcessRequest_ScriptTask" targetRef="ExclusiveGateway_19tbjgn" /> + <bpmn2:callActivity id="callGenericDeleteService" name="Call AAI GenericDelete Service " calledElement="GenericDeleteService"> + <bpmn2:extensionElements> + <camunda:in source="serviceInstanceId" target="GENDS_serviceInstanceId" /> + <camunda:in source="subscriptionServiceType" target="GENDS_serviceType" /> + <camunda:in source="globalSubscriberId" target="GENDS_globalCustomerId" /> + <camunda:in sourceExpression="service-instance" target="GENDS_type" /> + <camunda:out source="GENDS_FoundIndicator" target="GENDS_FoundIndicator" /> + <camunda:in sourceExpression="""" target="GENGS_serviceType" /> + <camunda:out source="GENDS_SuccessIndicator" target="GENDS_SuccessIndicator" /> + <camunda:out source="WorkflowException" target="WorkflowExecption" /> + </bpmn2:extensionElements> + <bpmn2:incoming>SequenceFlow_1x9eh33</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_05wu9i7</bpmn2:outgoing> + </bpmn2:callActivity> + <bpmn2:exclusiveGateway id="ExclusiveGateway_09wkav2" name="RollbackSDNC?" default="SequenceFlow_1uw2p9a"> + <bpmn2:incoming>SequenceFlow_06aasqh</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_11fnnkb</bpmn2:outgoing> + <bpmn2:outgoing>SequenceFlow_1uw2p9a</bpmn2:outgoing> + </bpmn2:exclusiveGateway> + <bpmn2:sequenceFlow id="SequenceFlow_11fnnkb" name="yes" sourceRef="ExclusiveGateway_09wkav2" targetRef="CallActivity_0ak0ezb"> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("rollbackSDNC" ) == "true"}]]></bpmn2:conditionExpression> + </bpmn2:sequenceFlow> + <bpmn2:sequenceFlow id="SequenceFlow_1uw2p9a" name="no" sourceRef="ExclusiveGateway_09wkav2" targetRef="ExclusiveGateway_0ii31dq" /> + <bpmn2:exclusiveGateway id="ExclusiveGateway_0ii31dq" name="RollBackAAI?" default="SequenceFlow_1n7wade"> + <bpmn2:documentation>rollback AAI</bpmn2:documentation> + <bpmn2:incoming>SequenceFlow_1uw2p9a</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_1njogr1</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_1n7wade</bpmn2:outgoing> + <bpmn2:outgoing>SequenceFlow_1x9eh33</bpmn2:outgoing> + </bpmn2:exclusiveGateway> + <bpmn2:sequenceFlow id="SequenceFlow_1n7wade" name="no" sourceRef="ExclusiveGateway_0ii31dq" targetRef="PostProcess_ScriptTask" /> + <bpmn2:sequenceFlow id="SequenceFlow_05wu9i7" sourceRef="callGenericDeleteService" targetRef="PostProcess_ScriptTask" /> + <bpmn2:sequenceFlow id="SequenceFlow_1x9eh33" name="yes" sourceRef="ExclusiveGateway_0ii31dq" targetRef="callGenericDeleteService"> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("rollbackAAI" ) == "true"}]]></bpmn2:conditionExpression> + </bpmn2:sequenceFlow> + <bpmn2:sequenceFlow id="SequenceFlow_0k28xib" sourceRef="CallActivity_0ak0ezb" targetRef="ScriptTask_1uxr0cx" /> + <bpmn2:callActivity id="CallActivity_0ak0ezb" name="Call SDNC Service Topology Deactivate" calledElement="sdncAdapter"> + <bpmn2:extensionElements> + <camunda:in source="sdncDeactivate" target="sdncAdapterWorkflowRequest" /> + <camunda:in source="msoRequestId" target="mso-request-id" /> + <camunda:in source="serviceInstanceId" target="mso-service-instance-id" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + <camunda:out source="sdncAdapterResponse" target="sdncDeactivateResponse" /> + <camunda:out source="SDNCA_SuccessIndicator" target="SDNCA_SuccessIndicator" /> + </bpmn2:extensionElements> + <bpmn2:incoming>SequenceFlow_11fnnkb</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_0k28xib</bpmn2:outgoing> + </bpmn2:callActivity> + <bpmn2:scriptTask id="ScriptTask_1uxr0cx" name="Post Process SDNC Deactivate" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_0k28xib</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_0khjo7l</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +String response = execution.getVariable("sdncDeactivateResponse") +def rbk= new DoCreateE2EServiceInstanceRollback() +rbk.validateSDNCResponse(execution, response, "deactivate")]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_0khjo7l" sourceRef="ScriptTask_1uxr0cx" targetRef="CallActivity_0ppz9nd" /> + <bpmn2:exclusiveGateway id="ExclusiveGateway_19tbjgn" name="skip Rollback" default="SequenceFlow_06aasqh"> + <bpmn2:incoming>SequenceFlow_2</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_06aasqh</bpmn2:outgoing> + <bpmn2:outgoing>SequenceFlow_1rzlaoy</bpmn2:outgoing> + </bpmn2:exclusiveGateway> + <bpmn2:scriptTask id="PostProcess_ScriptTask" name="Post Process Request" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_05wu9i7</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_1n7wade</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_1rzlaoy</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_01l4ssl</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def rbk = new DoCreateE2EServiceInstanceRollback() +rbk.postProcessRequest(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_01l4ssl" sourceRef="PostProcess_ScriptTask" targetRef="EndEvent_3" /> + <bpmn2:sequenceFlow id="SequenceFlow_06aasqh" name="no" sourceRef="ExclusiveGateway_19tbjgn" targetRef="ExclusiveGateway_09wkav2" /> + <bpmn2:sequenceFlow id="SequenceFlow_1rzlaoy" name="yes" sourceRef="ExclusiveGateway_19tbjgn" targetRef="PostProcess_ScriptTask"> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("skipRollback" ) == true}]]></bpmn2:conditionExpression> + </bpmn2:sequenceFlow> + <bpmn2:subProcess id="SubProcess_11bi8mc" name="Java Exception Handling Sub Process" triggeredByEvent="true"> + <bpmn2:startEvent id="StartEvent_1gxe17c"> + <bpmn2:outgoing>SequenceFlow_1ch4xrf</bpmn2:outgoing> + <bpmn2:errorEventDefinition errorRef="Error_1" /> + </bpmn2:startEvent> + <bpmn2:scriptTask id="ScriptTask_15yddb0" name="Process Java Error" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_1ch4xrf</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_1pjk2ff</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def rbk= new DoCreateE2EServiceInstanceRollback() +rbk.processRollbackJavaException(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:endEvent id="EndEvent_12e3h6k"> + <bpmn2:incoming>SequenceFlow_1pjk2ff</bpmn2:incoming> + <bpmn2:terminateEventDefinition /> + </bpmn2:endEvent> + <bpmn2:sequenceFlow id="SequenceFlow_1ch4xrf" name="" sourceRef="StartEvent_1gxe17c" targetRef="ScriptTask_15yddb0" /> + <bpmn2:sequenceFlow id="SequenceFlow_1pjk2ff" name="" sourceRef="ScriptTask_15yddb0" targetRef="EndEvent_12e3h6k" /> + </bpmn2:subProcess> + <bpmn2:scriptTask id="ScriptTask_1awt1ds" name="Post Process SDNC Delete"> + <bpmn2:incoming>SequenceFlow_006g9e8</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_1njogr1</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +String response = execution.getVariable("sdncDeleteResponse") +def rbk= new DoCreateE2EServiceInstanceRollback() +rbk.validateSDNCResponse(execution, response, "delete")]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:callActivity id="CallActivity_0ppz9nd" name="Call SDNC Service Topology Dekete" calledElement="sdncAdapter"> + <bpmn2:extensionElements> + <camunda:in source="sdncDelete" target="sdncAdapterWorkflowRequest" /> + <camunda:in source="msoRequestId" target="mso-request-id" /> + <camunda:in source="serviceInstanceId" target="mso-service-instance-id" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + <camunda:out source="sdncAdapterResponse" target="sdncDeleteResponse" /> + <camunda:out source="SDNCA_SuccessIndicator" target="SDNCA_SuccessIndicator" /> + </bpmn2:extensionElements> + <bpmn2:incoming>SequenceFlow_0khjo7l</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_006g9e8</bpmn2:outgoing> + </bpmn2:callActivity> + <bpmn2:sequenceFlow id="SequenceFlow_006g9e8" sourceRef="CallActivity_0ppz9nd" targetRef="ScriptTask_1awt1ds" /> + <bpmn2:sequenceFlow id="SequenceFlow_1njogr1" sourceRef="ScriptTask_1awt1ds" targetRef="ExclusiveGateway_0ii31dq" /> + </bpmn2:process> + <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="DoCreateE2EServiceInstanceRollback"> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_47" bpmnElement="createSIRollback_startEvent"> + <dc:Bounds x="151" y="79" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="146" y="120" width="48" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_61" bpmnElement="preProcessRequest_ScriptTask"> + <dc:Bounds x="234" y="57" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="_BPMNShape_StartEvent_47" targetElement="_BPMNShape_ScriptTask_61"> + <di:waypoint xsi:type="dc:Point" x="187" y="97" /> + <di:waypoint xsi:type="dc:Point" x="234" y="97" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="211" y="82" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="_BPMNShape_EndEvent_177" bpmnElement="EndEvent_3"> + <dc:Bounds x="1208" y="350" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1226" y="391" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_SubProcess_27" bpmnElement="UnexpectedError_SubProcess_1" isExpanded="true"> + <dc:Bounds x="508" y="323" width="467" height="193" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_70" bpmnElement="StartEvent_1"> + <dc:Bounds x="576" y="389" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="594" y="430" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_EndEvent_219" bpmnElement="EndEvent_1"> + <dc:Bounds x="869" y="389" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="887" y="430" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_4" bpmnElement="SequenceFlow_8" sourceElement="_BPMNShape_StartEvent_70" targetElement="_BPMNShape_ScriptTask_269"> + <di:waypoint xsi:type="dc:Point" x="612" y="407" /> + <di:waypoint xsi:type="dc:Point" x="680" y="407" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="647" y="392" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="SequenceFlow_2" sourceElement="_BPMNShape_ScriptTask_61"> + <di:waypoint xsi:type="dc:Point" x="334" y="97" /> + <di:waypoint xsi:type="dc:Point" x="366" y="97" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="350" y="82" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="CallActivity_1md4kyb_di" bpmnElement="callGenericDeleteService"> + <dc:Bounds x="1167" y="57" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ExclusiveGateway_09wkav2_di" bpmnElement="ExclusiveGateway_09wkav2" isMarkerVisible="true"> + <dc:Bounds x="448" y="72" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="433" y="129" width="79" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_11fnnkb_di" bpmnElement="SequenceFlow_11fnnkb"> + <di:waypoint xsi:type="dc:Point" x="498" y="97" /> + <di:waypoint xsi:type="dc:Point" x="539" y="97" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="501" y="100" width="18" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1uw2p9a_di" bpmnElement="SequenceFlow_1uw2p9a"> + <di:waypoint xsi:type="dc:Point" x="473" y="72" /> + <di:waypoint xsi:type="dc:Point" x="473" y="-23" /> + <di:waypoint xsi:type="dc:Point" x="1071" y="-23" /> + <di:waypoint xsi:type="dc:Point" x="1071" y="72" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="751" y="-41" width="12" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ExclusiveGateway_0ii31dq_di" bpmnElement="ExclusiveGateway_0ii31dq" isMarkerVisible="true"> + <dc:Bounds x="1046" y="72" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1094" y="104" width="66" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1n7wade_di" bpmnElement="SequenceFlow_1n7wade"> + <di:waypoint xsi:type="dc:Point" x="1071" y="122" /> + <di:waypoint xsi:type="dc:Point" x="1071" y="241" /> + <di:waypoint xsi:type="dc:Point" x="1176" y="241" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1081" y="124.63709677419354" width="12" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_05wu9i7_di" bpmnElement="SequenceFlow_05wu9i7"> + <di:waypoint xsi:type="dc:Point" x="1217" y="137" /> + <di:waypoint xsi:type="dc:Point" x="1217" y="201" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1232" y="169" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1x9eh33_di" bpmnElement="SequenceFlow_1x9eh33"> + <di:waypoint xsi:type="dc:Point" x="1096" y="97" /> + <di:waypoint xsi:type="dc:Point" x="1167" y="97" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1126" y="82" width="18" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0k28xib_di" bpmnElement="SequenceFlow_0k28xib"> + <di:waypoint xsi:type="dc:Point" x="639" y="97" /> + <di:waypoint xsi:type="dc:Point" x="671" y="97" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="655" y="82" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="CallActivity_0ak0ezb_di" bpmnElement="CallActivity_0ak0ezb"> + <dc:Bounds x="539" y="57" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1uxr0cx_di" bpmnElement="ScriptTask_1uxr0cx"> + <dc:Bounds x="671" y="57" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0khjo7l_di" bpmnElement="SequenceFlow_0khjo7l"> + <di:waypoint xsi:type="dc:Point" x="771" y="97" /> + <di:waypoint xsi:type="dc:Point" x="796" y="97" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="784" y="82" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ExclusiveGateway_19tbjgn_di" bpmnElement="ExclusiveGateway_19tbjgn" isMarkerVisible="true"> + <dc:Bounds x="366" y="72" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="358" y="54" width="65" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_269" bpmnElement="ScriptTask_1"> + <dc:Bounds x="680" y="367" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_5" bpmnElement="SequenceFlow_7" sourceElement="_BPMNShape_ScriptTask_269" targetElement="_BPMNShape_EndEvent_219"> + <di:waypoint xsi:type="dc:Point" x="780" y="407" /> + <di:waypoint xsi:type="dc:Point" x="869" y="407" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="825" y="392" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1wk55es_di" bpmnElement="PostProcess_ScriptTask"> + <dc:Bounds x="1176" y="201" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_01l4ssl_di" bpmnElement="SequenceFlow_01l4ssl"> + <di:waypoint xsi:type="dc:Point" x="1226" y="281" /> + <di:waypoint xsi:type="dc:Point" x="1226" y="350" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1241" y="315.5" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_06aasqh_di" bpmnElement="SequenceFlow_06aasqh"> + <di:waypoint xsi:type="dc:Point" x="416" y="97" /> + <di:waypoint xsi:type="dc:Point" x="448" y="97" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="426" y="82" width="12" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1rzlaoy_di" bpmnElement="SequenceFlow_1rzlaoy"> + <di:waypoint xsi:type="dc:Point" x="391" y="122" /> + <di:waypoint xsi:type="dc:Point" x="391" y="268" /> + <di:waypoint xsi:type="dc:Point" x="1176" y="267" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="397" y="195" width="18" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="SubProcess_11bi8mc_di" bpmnElement="SubProcess_11bi8mc" isExpanded="true"> + <dc:Bounds x="325" y="576" width="419" height="150" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="StartEvent_1gxe17c_di" bpmnElement="StartEvent_1gxe17c"> + <dc:Bounds x="360" y="628" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="378" y="669" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_15yddb0_di" bpmnElement="ScriptTask_15yddb0"> + <dc:Bounds x="468" y="606" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_12e3h6k_di" bpmnElement="EndEvent_12e3h6k"> + <dc:Bounds x="618" y="628" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="636" y="669" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1ch4xrf_di" bpmnElement="SequenceFlow_1ch4xrf"> + <di:waypoint xsi:type="dc:Point" x="396" y="646" /> + <di:waypoint xsi:type="dc:Point" x="468" y="646" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="421" y="646" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1pjk2ff_di" bpmnElement="SequenceFlow_1pjk2ff"> + <di:waypoint xsi:type="dc:Point" x="568" y="646" /> + <di:waypoint xsi:type="dc:Point" x="618" y="646" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="593" y="646" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1awt1ds_di" bpmnElement="ScriptTask_1awt1ds"> + <dc:Bounds x="921" y="57" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_0ppz9nd_di" bpmnElement="CallActivity_0ppz9nd"> + <dc:Bounds x="796" y="57" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_006g9e8_di" bpmnElement="SequenceFlow_006g9e8"> + <di:waypoint xsi:type="dc:Point" x="896" y="97" /> + <di:waypoint xsi:type="dc:Point" x="921" y="97" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="909" y="82" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1njogr1_di" bpmnElement="SequenceFlow_1njogr1"> + <di:waypoint xsi:type="dc:Point" x="1021" y="97" /> + <di:waypoint xsi:type="dc:Point" x="1046" y="97" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1034" y="82" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn2:definitions> |