aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/MSOCommonBPMN/src/main
diff options
context:
space:
mode:
authorDeterme, Sebastien (sd378r) <sd378r@intl.att.com>2017-05-02 03:53:18 -0700
committerDeterme, Sebastien (sd378r) <sd378r@intl.att.com>2017-05-02 06:59:21 -0700
commit94ee92559b051f2f82ed681f841f4f13016842ed (patch)
tree9760a0ad7da03572ed4c9dc596c4b0f537e64112 /bpmn/MSOCommonBPMN/src/main
parent43bbca64032716730d2e7795b6569d5fdbda9d12 (diff)
[MSO-8] Second step of the rebase for MSO
Second rebase containing additional features for MSO + total reworking of the BPMN structure + Notification flow can now be added at the end of some BPMN flows Change-Id: I7e937c7a0ba1593ca85e164a093f79c7e38b6ce0 Signed-off-by: Determe, Sebastien (sd378r) <sd378r@intl.att.com>
Diffstat (limited to 'bpmn/MSOCommonBPMN/src/main')
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/AaiUtil.groovy1043
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy1684
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CatalogDbUtils.groovy1481
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CompleteMsoProcess.groovy722
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ConfirmVolumeGroupName.groovy316
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy388
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CreateAAIVfModule.groovy1243
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CreateAAIVfModuleVolumeGroup.groovy666
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CreateGenericVNFUtils.groovy124
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/DeleteAAIVfModule.groovy681
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ExceptionUtil.groovy997
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/FalloutHandler.groovy778
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenerateVfModuleName.groovy332
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericDeleteService.groovy611
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericDeleteVnf.groovy552
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericGetService.groovy766
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericGetVnf.groovy543
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericNotificationService.groovy21
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericPutVnf.groovy344
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/MsoUtils.groovy1895
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/NetworkUtils.groovy2936
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/PrepareUpdateAAIVfModule.groovy742
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapter.groovy654
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterRestV1.groovy343
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterUtils.groovy1891
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ServiceTaskProcessor.groovy64
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/TrinityExceptionUtil.groovy382
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/UpdateAAIGenericVnf.groovy663
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/UpdateAAIVfModule.groovy763
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VfModule.groovy174
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VfModuleBase.groovy1607
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VidUtils.groovy1100
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VnfAdapterRestV1.groovy808
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VnfAdapterUtils.groovy164
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/MSOCommonApplication.java118
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/ObjectFactory.java182
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/RequestHeader.java446
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/SDNCAdapterResponse.java102
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/DeleteVnfNotification.java396
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/MsoExceptionCategory.java122
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/MsoRequest.java228
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/QueryVnfNotification.java976
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfStatus.java122
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/CryptoHandler.java114
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/CryptoUtils.java236
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/ICryptoHandler.java54
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/SDNCAdapterCallbackServiceImpl.java534
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowAsyncCommonResource.java72
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowAsyncResource.java582
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowCallbackResponse.java104
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowContext.java192
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowContextHolder.java376
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowMessageResource.java280
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResource.java1234
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResourceApplication.java114
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResponse.java138
-rw-r--r--bpmn/MSOCommonBPMN/src/main/resources/META-INF/persistence.xml74
-rw-r--r--bpmn/MSOCommonBPMN/src/main/resources/processes.xml81
-rw-r--r--bpmn/MSOCommonBPMN/src/main/resources/subprocess/CompleteMsoProcess.bpmn395
-rw-r--r--bpmn/MSOCommonBPMN/src/main/resources/subprocess/ConfirmVolumeGroupTenant.bpmn362
-rw-r--r--bpmn/MSOCommonBPMN/src/main/resources/subprocess/CreateAAIVfModule.bpmn1036
-rw-r--r--bpmn/MSOCommonBPMN/src/main/resources/subprocess/DeleteAAIVfModule.bpmn918
-rw-r--r--bpmn/MSOCommonBPMN/src/main/resources/subprocess/FalloutHandler.bpmn369
-rw-r--r--bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericDeleteService.bpmn599
-rw-r--r--bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericDeleteVnf.bpmn500
-rw-r--r--bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericGetVnf.bpmn396
-rw-r--r--bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericNotificationService.bpmn48
-rw-r--r--bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericPutService.bpmn402
-rw-r--r--bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericPutVnf.bpmn252
-rw-r--r--bpmn/MSOCommonBPMN/src/main/resources/subprocess/SDNCAdapterRestV1.bpmn470
-rw-r--r--bpmn/MSOCommonBPMN/src/main/resources/subprocess/SDNCAdapterV1.bpmn290
-rw-r--r--bpmn/MSOCommonBPMN/src/main/resources/subprocess/VnfAdapterRestV1.bpmn882
-rw-r--r--bpmn/MSOCommonBPMN/src/main/webapp/WEB-INF/jboss-deployment-structure.xml62
-rw-r--r--bpmn/MSOCommonBPMN/src/main/webapp/WEB-INF/jboss-web.xml52
-rw-r--r--bpmn/MSOCommonBPMN/src/main/webapp/WEB-INF/web.xml146
75 files changed, 21802 insertions, 19732 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/AaiUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/AaiUtil.groovy
index 01e25a5741..95a577c946 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/AaiUtil.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/AaiUtil.groovy
@@ -1,483 +1,562 @@
-/*-
- * ============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.common.scripts
-import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.runtime.Execution
-import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor;
-import org.openecomp.mso.rest.APIResponse;
-import org.openecomp.mso.rest.RESTClient
-import org.openecomp.mso.rest.RESTConfig
-
-class AaiUtil {
-
- public MsoUtils utils = new MsoUtils()
- public static final String AAI_NAMESPACE_STRING = 'http://org.openecomp.aai.inventory/'
- public static final String DEFAULT_VERSION_KEY = 'URN_mso_workflow_global_default_aai_version'
-
- private AbstractServiceTaskProcessor taskProcessor
-
- public AaiUtil(AbstractServiceTaskProcessor taskProcessor) {
- this.taskProcessor = taskProcessor
- }
-
- public String getNetworkGenericVnfEndpoint(Execution execution) {
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- String endpoint = execution.getVariable("URN_aai_endpoint")
- def uri = getNetworkGenericVnfUri(execution)
- taskProcessor.logDebug('AaiUtil.getNetworkGenericVnfEndpoint() - AAI endpoint: ' + endpoint + uri, isDebugLogEnabled)
- return endpoint + uri
- }
-
- public String getNetworkGenericVnfUri(Execution execution) {
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- def uri = getUri(execution, 'generic_vnf')
- taskProcessor.logDebug('AaiUtil.getNetworkGenericVnfUri() - AAI URI: ' + uri, isDebugLogEnabled)
- return uri
- }
-
- public String getNetworkVpnBindingUri(Execution execution) {
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- def uri = getUri(execution, 'vpn_binding')
- taskProcessor.logDebug('AaiUtil.getNetworkVpnBindingUri() - AAI URI: ' + uri, isDebugLogEnabled)
- return uri
- }
-
- public String getNetworkPolicyUri(Execution execution) {
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- def uri = getUri(execution, 'network_policy')
- taskProcessor.logDebug('AaiUtil.getNetworkPolicyUri() - AAI URI: ' + uri, isDebugLogEnabled)
- return uri
- }
-
- public String getNetworkTableReferencesUri(Execution execution) {
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- def uri = getUri(execution, 'route_table_reference')
- taskProcessor.logDebug('AaiUtil.getNetworkTableReferencesUri() - AAI URI: ' + uri, isDebugLogEnabled)
- return uri
- }
-
- public String getNetworkVceUri(Execution execution) {
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- def uri = getUri(execution, 'vce')
- taskProcessor.logDebug('AaiUtil.getNetworkVceUri() - AAI URI: ' + uri, isDebugLogEnabled)
- return uri
- }
-
- public String getNetworkL3NetworkUri(Execution execution) {
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- def uri = getUri(execution, 'l3_network')
- taskProcessor.logDebug('AaiUtil.getNetworkL3NetworkUri() - AAI URI: ' + uri, isDebugLogEnabled)
- return uri
- }
-
- public String getBusinessCustomerUri(Execution execution) {
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- def uri = getUri(execution, 'customer')
- taskProcessor.logDebug('AaiUtil.getBusinessCustomerUri() - AAI URI: ' + uri, isDebugLogEnabled)
- return uri
- }
-
- //public String getBusinessCustomerUriv7(Execution execution) {
- // def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- // //def uri = getUri(execution, BUSINESS_CUSTOMERV7)
- // def uri = getUri(execution, 'Customer')
- // taskProcessor.logDebug('AaiUtil.getBusinessCustomerUriv7() - AAI URI: ' + uri, isDebugLogEnabled)
- // return uri
- //}
-
- public String getCloudInfrastructureCloudRegionEndpoint(Execution execution) {
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- String endpoint = execution.getVariable("URN_aai_endpoint")
- def uri = getCloudInfrastructureCloudRegionUri(execution)
- taskProcessor.logDebug('AaiUtil.getCloudInfrastructureCloudRegionEndpoint() - AAI endpoint: ' + endpoint + uri, isDebugLogEnabled)
- return endpoint + uri
- }
-
- public String getCloudInfrastructureCloudRegionUri(Execution execution) {
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- def uri = getUri(execution, 'cloud_region')
- taskProcessor.logDebug('AaiUtil.getCloudInfrastructureCloudRegionUri() - AAI URI: ' + uri, isDebugLogEnabled)
- return uri
- }
-
- public String getCloudInfrastructureVolumeGroupUri(Execution execution) {
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- def uri = getUri(execution, 'volume_group')
- taskProcessor.logDebug('AaiUtil.getCloudInfrastructureVolumeGroupUri() - AAI URI: ' + uri, isDebugLogEnabled)
- return uri
- }
-
- public String getCloudInfrastructureTenantUri(Execution execution) {
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- def uri = getUri(execution, 'tenant')
- taskProcessor.logDebug('AaiUtil.getCloudInfrastructureTenantUri() - AAI URI: ' + uri, isDebugLogEnabled)
- return uri
- }
-
- public String getSearchNodesQueryUri(Execution execution) {
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- def uri = getUri(execution, 'nodes_query')
- taskProcessor.logDebug('AaiUtil.getSearchNodesQueryUri() - AAI URI: ' + uri, isDebugLogEnabled)
- return uri
- }
-
- public String getSearchNodesQueryEndpoint(Execution execution) {
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- String endpoint = execution.getVariable("URN_aai_endpoint")
- def uri = getSearchNodesQueryUri(execution)
- taskProcessor.logDebug('AaiUtil.getSearchNodesQueryEndpoint() - AAI endpoint: ' + endpoint + uri, isDebugLogEnabled)
- return endpoint + uri
- }
-
- public String getSearchGenericQueryUri(Execution execution) {
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- def uri = getUri(execution, 'generic_query')
- taskProcessor.logDebug('AaiUtil.getSearchGenericQueryUri() - AAI URI: ' + uri, isDebugLogEnabled)
- return uri
- }
-
- public String getVersion(Execution execution, resourceName, processKey) {
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
-
- resourceName = resourceName.replaceAll('-', '_')
-
- def versionWithResourceKey = "URN_mso_workflow_default_aai_${resourceName}_version"
- def versionWithProcessKey = "URN_mso_workflow_custom_${processKey}_aai_version"
-
- def version = execution.getVariable(versionWithProcessKey)
- if (version) {
- taskProcessor.logDebug("AaiUtil.getVersion() - using flow specific ${versionWithProcessKey}=${version}", isDebugLogEnabled)
- return version
- }
-
- version = execution.getVariable(versionWithResourceKey)
- if (version) {
- taskProcessor.logDebug("AaiUtil.getVersion() - using resource specific ${versionWithResourceKey}=${version}", isDebugLogEnabled)
- return version
- }
-
- version = execution.getVariable(DEFAULT_VERSION_KEY)
- if (version) {
- taskProcessor.logDebug("AaiUtil.getVersion() - using default version ${DEFAULT_VERSION_KEY}=${version}", isDebugLogEnabled)
- return version
- }
-
- (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, "Internal Error: One of the following should be defined in MSO URN properties file: ${versionWithResourceKey}, ${versionWithProcessKey}, ${DEFAULT_VERSION_KEY}")
- }
-
- public String getUri(Execution execution, resourceName) {
-
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- def processKey = taskProcessor.getMainProcessKey(execution)
-
- resourceName = resourceName.replaceAll('-', '_')
-
- // Check for flow+resource specific first
- def key = "URN_mso_workflow_${processKey}_aai_${resourceName}_uri"
- def uri = execution.getVariable(key)
- if(uri) {
- taskProcessor.logDebug("AaiUtil.getUri() - using flow+resource specific key: ${key}=${uri}", isDebugLogEnabled)
- return uri
- }
-
- // Check for versioned key
- def version = getVersion(execution, resourceName, processKey)
- key = "URN_mso_workflow_default_aai_v${version}_${resourceName}_uri"
- uri = execution.getVariable(key)
-
- if(uri) {
- taskProcessor.logDebug("AaiUtil.getUri() - using versioned URI key: ${key}=${uri}", isDebugLogEnabled)
- return uri
- }
-
- (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, 'Internal Error: AAI URI entry for ' + key + ' not defined in the MSO URN properties file')
- }
-
- public String getNamespaceFromUri(String uri) {
- String namespace = AAI_NAMESPACE_STRING
- if(uri!=null){
- return namespace + uri.substring(uri.indexOf("v"), uri.indexOf("v")+2)
- }else{
- return namespace
- }
- }
-
-
-
- /**
- * This reusable method can be used for making AAI Get Calls. The url should
- * be passed as a parameter along with the execution. The method will
- * return an APIResponse.
- *
- * @param execution
- * @param url
- *
- * @return APIResponse
- */
- public APIResponse executeAAIGetCall(Execution execution, String url){
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
- taskProcessor.logDebug(" ======== STARTED Execute AAI Get Process ======== ", isDebugEnabled)
- try{
- String uuid = UUID.randomUUID()
- taskProcessor.logDebug( "Generated uuid is: " + uuid, isDebugEnabled)
- taskProcessor.logDebug( "URL to be used is: " + url, isDebugEnabled)
-
- String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey"))
-
- RESTConfig config = new RESTConfig(url);
- RESTClient client = new RESTClient(config).addHeader("X-FromAppId", "MSO").addHeader("X-TransactionId", uuid).addHeader("Accept","application/xml");
-
- if (basicAuthCred != null && !"".equals(basicAuthCred)) {
- client.addAuthorizationHeader(basicAuthCred)
- }
-
- APIResponse apiResponse = client.get()
- return apiResponse
-
- }catch(Exception e){
- taskProcessor.logDebug("Exception occured while executing AAI Get Call. Exception is: \n" + e, isDebugEnabled)
- return e
- }
- taskProcessor.logDebug( "======== COMPLETED Execute AAI Get Process ======== ", isDebugEnabled)
- }
-
- /**
- * This reusable method can be used for making AAI httpPut Calls. The url should
- * be passed as a parameter along with the execution and payload. The method will
- * return an APIResponse.
- *
- * @param execution
- * @param url
- * @param payload
- *
- * @return APIResponse
- */
- public APIResponse executeAAIPutCall(Execution execution, String url, String payload){
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
- taskProcessor.logDebug( " ======== Started Execute AAI Put Process ======== ", isDebugEnabled)
- try{
- String uuid = UUID.randomUUID()
- taskProcessor.logDebug( "Generated uuid is: " + uuid, isDebugEnabled)
- taskProcessor.logDebug( "URL to be used is: " + url, isDebugEnabled)
-
- String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey"))
-
- RESTConfig config = new RESTConfig(url);
- RESTClient client = new RESTClient(config).addHeader("X-FromAppId", "MSO").addHeader("X-TransactionId", uuid).addHeader("Content-Type", "application/xml").addHeader("Accept","application/xml");
- if (basicAuthCred != null && !"".equals(basicAuthCred)) {
- client.addAuthorizationHeader(basicAuthCred)
- }
- APIResponse apiResponse = client.httpPut(payload)
-
- return apiResponse
- }catch(Exception e){
- taskProcessor.utils.log("ERROR", "Exception occured while executing AAI Put Call. Exception is: \n" + e, isDebugEnabled)
- return e
- }
- taskProcessor.logDebug( "======== Completed Execute AAI Put Process ======== ", isDebugEnabled)
- }
-
-
- /**
- * This reusable method can be used for making AAI Delete Calls. The url should
- * be passed as a parameter along with the execution. The method will
- * return an APIResponse.
- *
- * @param execution
- * @param url
- *
- * @return APIResponse
- */
- public APIResponse executeAAIDeleteCall(Execution execution, String url){
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
- taskProcessor.logDebug( " ======== Started Execute AAI Delete Process ======== ", isDebugEnabled)
- try{
- String uuid = UUID.randomUUID()
- taskProcessor.logDebug( "Generated uuid is: " + uuid, isDebugEnabled)
- taskProcessor.logDebug( "URL to be used is: " + url, isDebugEnabled)
-
- String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey"))
-
- RESTConfig config = new RESTConfig(url);
- RESTClient client = new RESTClient(config).addHeader("X-FromAppId", "MSO").addHeader("X-TransactionId", uuid).addHeader("Accept","application/xml");
- if (basicAuthCred != null && !"".equals(basicAuthCred)) {
- client.addAuthorizationHeader(basicAuthCred)
- }
- APIResponse apiResponse = client.delete()
-
- return apiResponse
-
- }catch(Exception e){
- taskProcessor.utils.log("ERROR", "Exception occured while executing AAI Delete Call. Exception is: \n" + e, isDebugEnabled)
- return e
- }
- taskProcessor.logDebug( "======== Completed Execute AAI Delete Process ======== ", isDebugEnabled)
- }
-
- /**
- * This reusable method can be used for making AAI Delete Calls. The url should
- * be passed as a parameter along with the execution. The method will
- * return an APIResponse.
- *
- * @param execution
- * @param url
- * @param payload
- *
- * @return APIResponse
- */
- public APIResponse executeAAIDeleteCall(Execution execution, String url, String payload, String authHeader){
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
- taskProcessor.logDebug( " ======== Started Execute AAI Delete Process ======== ", isDebugEnabled)
- try{
- String uuid = UUID.randomUUID()
- taskProcessor.logDebug( "Generated uuid is: " + uuid, isDebugEnabled)
- taskProcessor.logDebug( "URL to be used is: " + url, isDebugEnabled)
-
- String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey"))
- RESTConfig config = new RESTConfig(url);
- RESTClient client = new RESTClient(config).addHeader("X-FromAppId", "MSO").addHeader("X-TransactionId", uuid).addHeader("Accept","application/xml").addAuthorizationHeader(authHeader);
- if (basicAuthCred != null && !"".equals(basicAuthCred)) {
- client.addAuthorizationHeader(basicAuthCred)
- }
-
- APIResponse apiResponse = client.httpDelete(payload)
-
- return apiResponse
-
- }catch(Exception e){
- taskProcessor.utils.log("ERROR", "Exception occured while executing AAI Delete Call. Exception is: \n" + e, isDebugEnabled)
- return e
- }
- taskProcessor.logDebug( "======== Completed Execute AAI Delete Process ======== ", isDebugEnabled)
- }
-
- /**
- * This reusable method can be used for making AAI Post Calls. The url should
- * be passed as a parameter along with the execution. The method will
- * return an APIResponse.
- *
- * @param execution
- * @param url
- * @param payload
- *
- * @return APIResponse
- */
- public APIResponse executeAAIPostCall(Execution execution, String url, String payload){
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
- taskProcessor.logDebug( " ======== Started Execute AAI Post Process ======== ", isDebugEnabled)
- try{
- String uuid = UUID.randomUUID()
- taskProcessor.logDebug( "Generated uuid is: " + uuid, isDebugEnabled)
- taskProcessor.logDebug( "URL to be used is: " + url, isDebugEnabled)
-
- String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey"))
- RESTConfig config = new RESTConfig(url);
- RESTClient client = new RESTClient(config).addHeader("X-FromAppId", "MSO").addHeader("X-TransactionId", uuid).addHeader("Accept","application/xml");
- if (basicAuthCred != null && !"".equals(basicAuthCred)) {
- client.addAuthorizationHeader(basicAuthCred)
- }
- APIResponse apiResponse = client.httpPost(payload)
-
- return apiResponse
-
- }catch(Exception e){
- taskProcessor.utils.log("ERROR", "Exception occured while executing AAI Post Call. Exception is: \n" + e, isDebugEnabled)
- return e
- }
- taskProcessor.logDebug( "======== Completed Execute AAI Post Process ======== ", isDebugEnabled)
- }
-
- /** Utilitty to get the Cloud Region from AAI
- * Returns String cloud region id, (ie, cloud-region-id)
- * @param execution
- * @param url - url for AAI get cloud region
- * @param backend - "PO" - real region, or "SDNC" - v2.5 (fake region).
- */
-
- //TODO: We should refactor this method to return WorkflowException instead of Error. Also to throw MSOWorkflowException which the calling flow will then catch.
-
- public String getAAICloudReqion(Execution execution, String url, String backend, inputCloudRegion){
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
-
- try {
- APIResponse apiResponse = executeAAIGetCall(execution, url)
- String returnCode = apiResponse.getStatusCode()
- String aaiResponseAsString = apiResponse.getResponseBodyAsString()
- taskProcessor.utils.log("DEBUG", "Call AAI Cloud Region Return code: " + returnCode, isDebugEnabled)
- execution.setVariable(execution.getVariable("prefix")+"queryCloudRegionReturnCode", returnCode)
- //taskProcessor.utils.log("DEBUG", "Call AAI Cloud Region Response: " + aaiResponseAsString, isDebugEnabled)
- //execution.setVariable(execution.getVariable("prefix")+"queryCloudRegionResponse", aaiResponseAsString)
- String regionId = ""
- if (returnCode == "200") {
- taskProcessor.utils.log("DEBUG", "Call AAI Cloud Region is Successful.", isDebugEnabled)
- try {
- String regionVersion = taskProcessor.utils.getNodeText(aaiResponseAsString, "cloud-region-version")
- taskProcessor.utils.log("DEBUG", "Cloud Region Version from AAI for " + backend + " is: " + regionVersion, isDebugEnabled)
- if (backend == "PO") {
- regionId = taskProcessor.utils.getNodeText(aaiResponseAsString, "cloud-region-id")
- } else { // backend not "PO"
- if (regionVersion == "2.5" ) {
- regionId = "AAIAIC25"
- } else {
- regionId = taskProcessor.utils.getNodeText(aaiResponseAsString, "cloud-region-id")
- }
- }
-
- taskProcessor.utils.log("DEBUG", "Cloud Region Id from AAI " + backend + " is: " + regionId, isDebugEnabled)
- return regionId
-
- } catch (Exception e) {
- taskProcessor.utils.log("ERROR", "Exception occured while getting the Cloud Reqion. Exception is: \n" + e, isDebugEnabled)
- return "ERROR"
- }
- } else { // not 200
- if (returnCode == "404") {
- if (backend == "PO") {
- regionId = inputCloudRegion
- } else { // backend not "PO"
- regionId = "AAIAIC25"
- }
- taskProcessor.utils.log("DEBUG", "Cloud Region value for code='404' of " + backend + " is: " + regionId, isDebugEnabled)
- return regionId
- } else {
- taskProcessor.utils.log("ERROR", "Call AAI Cloud Region is NOT Successful.", isDebugEnabled)
- return "ERROR"
- }
- }
- }catch(Exception e) {
- taskProcessor.utils.log("ERROR", "Exception occured while getting the Cloud Reqion. Exception is: \n" + e, isDebugEnabled)
- return "ERROR"
- }
- }
-
- /* returns xml Node with service-type of searchValue */
- def searchServiceType(xmlInput, searchValue){
- def fxml= new XmlSlurper().parseText(xmlInput)
- def ret = fxml.'**'.find {it.'service-type' == searchValue}
- return ret
- }
-
- /* returns xml Node with service-instance-id of searchValue */
- def searchServiceInstanceId(xmlInput, searchValue){
- def ret = xmlInput.'**'.find {it.'service-instance-id' == searchValue}
- return ret
- }
+/*-
+ * ============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.common.scripts
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.runtime.Execution
+import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor;
+import org.openecomp.mso.rest.APIResponse;
+import org.openecomp.mso.rest.RESTClient
+import org.openecomp.mso.rest.RESTConfig
+
+class AaiUtil {
+
+ public MsoUtils utils = new MsoUtils()
+ public static final String AAI_NAMESPACE_STRING = 'http://org.openecomp.aai.inventory/'
+ public static final String DEFAULT_VERSION_KEY = 'URN_mso_workflow_global_default_aai_version'
+
+ private AbstractServiceTaskProcessor taskProcessor
+
+ public AaiUtil(AbstractServiceTaskProcessor taskProcessor) {
+ this.taskProcessor = taskProcessor
+ }
+
+ public String getNetworkGenericVnfEndpoint(Execution execution) {
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ String endpoint = execution.getVariable("URN_aai_endpoint")
+ def uri = getNetworkGenericVnfUri(execution)
+ taskProcessor.logDebug('AaiUtil.getNetworkGenericVnfEndpoint() - AAI endpoint: ' + endpoint + uri, isDebugLogEnabled)
+ return endpoint + uri
+ }
+
+ public String getNetworkGenericVnfUri(Execution execution) {
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ def uri = getUri(execution, 'generic_vnf')
+ taskProcessor.logDebug('AaiUtil.getNetworkGenericVnfUri() - AAI URI: ' + uri, isDebugLogEnabled)
+ return uri
+ }
+
+ public String getNetworkVpnBindingUri(Execution execution) {
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ def uri = getUri(execution, 'vpn_binding')
+ taskProcessor.logDebug('AaiUtil.getNetworkVpnBindingUri() - AAI URI: ' + uri, isDebugLogEnabled)
+ return uri
+ }
+
+ public String getNetworkPolicyUri(Execution execution) {
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ def uri = getUri(execution, 'network_policy')
+ taskProcessor.logDebug('AaiUtil.getNetworkPolicyUri() - AAI URI: ' + uri, isDebugLogEnabled)
+ return uri
+ }
+
+ public String getNetworkTableReferencesUri(Execution execution) {
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ def uri = getUri(execution, 'route_table_reference')
+ taskProcessor.logDebug('AaiUtil.getNetworkTableReferencesUri() - AAI URI: ' + uri, isDebugLogEnabled)
+ return uri
+ }
+
+ public String getNetworkVceUri(Execution execution) {
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ def uri = getUri(execution, 'vce')
+ taskProcessor.logDebug('AaiUtil.getNetworkVceUri() - AAI URI: ' + uri, isDebugLogEnabled)
+ return uri
+ }
+
+ public String getNetworkL3NetworkUri(Execution execution) {
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ def uri = getUri(execution, 'l3_network')
+ taskProcessor.logDebug('AaiUtil.getNetworkL3NetworkUri() - AAI URI: ' + uri, isDebugLogEnabled)
+ return uri
+ }
+
+ public String getBusinessCustomerUri(Execution execution) {
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ def uri = getUri(execution, 'customer')
+ taskProcessor.logDebug('AaiUtil.getBusinessCustomerUri() - AAI URI: ' + uri, isDebugLogEnabled)
+ return uri
+ }
+
+ //public String getBusinessCustomerUriv7(Execution execution) {
+ // def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ // //def uri = getUri(execution, BUSINESS_CUSTOMERV7)
+ // def uri = getUri(execution, 'Customer')
+ // taskProcessor.logDebug('AaiUtil.getBusinessCustomerUriv7() - AAI URI: ' + uri, isDebugLogEnabled)
+ // return uri
+ //}
+
+ public String getCloudInfrastructureCloudRegionEndpoint(Execution execution) {
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ String endpoint = execution.getVariable("URN_aai_endpoint")
+ def uri = getCloudInfrastructureCloudRegionUri(execution)
+ taskProcessor.logDebug('AaiUtil.getCloudInfrastructureCloudRegionEndpoint() - AAI endpoint: ' + endpoint + uri, isDebugLogEnabled)
+ return endpoint + uri
+ }
+
+ public String getCloudInfrastructureCloudRegionUri(Execution execution) {
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ def uri = getUri(execution, 'cloud_region')
+ taskProcessor.logDebug('AaiUtil.getCloudInfrastructureCloudRegionUri() - AAI URI: ' + uri, isDebugLogEnabled)
+ return uri
+ }
+
+ public String getCloudInfrastructureTenantUri(Execution execution) {
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ def uri = getUri(execution, 'tenant')
+ taskProcessor.logDebug('AaiUtil.getCloudInfrastructureTenantUri() - AAI URI: ' + uri, isDebugLogEnabled)
+ return uri
+ }
+
+ public String getSearchNodesQueryUri(Execution execution) {
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ def uri = getUri(execution, 'nodes_query')
+ taskProcessor.logDebug('AaiUtil.getSearchNodesQueryUri() - AAI URI: ' + uri, isDebugLogEnabled)
+ return uri
+ }
+
+ public String getSearchNodesQueryEndpoint(Execution execution) {
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ String endpoint = execution.getVariable("URN_aai_endpoint")
+ def uri = getSearchNodesQueryUri(execution)
+ taskProcessor.logDebug('AaiUtil.getSearchNodesQueryEndpoint() - AAI endpoint: ' + endpoint + uri, isDebugLogEnabled)
+ return endpoint + uri
+ }
+
+ public String getSearchGenericQueryUri(Execution execution) {
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ def uri = getUri(execution, 'generic_query')
+ taskProcessor.logDebug('AaiUtil.getSearchGenericQueryUri() - AAI URI: ' + uri, isDebugLogEnabled)
+ return uri
+ }
+
+ public String getVersion(Execution execution, resourceName, processKey) {
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+
+ resourceName = resourceName.replaceAll('-', '_')
+
+ def versionWithResourceKey = "URN_mso_workflow_default_aai_${resourceName}_version"
+ def versionWithProcessKey = "URN_mso_workflow_custom_${processKey}_aai_version"
+
+ def version = execution.getVariable(versionWithProcessKey)
+ if (version) {
+ taskProcessor.logDebug("AaiUtil.getVersion() - using flow specific ${versionWithProcessKey}=${version}", isDebugLogEnabled)
+ return version
+ }
+
+ version = execution.getVariable(versionWithResourceKey)
+ if (version) {
+ taskProcessor.logDebug("AaiUtil.getVersion() - using resource specific ${versionWithResourceKey}=${version}", isDebugLogEnabled)
+ return version
+ }
+
+ version = execution.getVariable(DEFAULT_VERSION_KEY)
+ if (version) {
+ taskProcessor.logDebug("AaiUtil.getVersion() - using default version ${DEFAULT_VERSION_KEY}=${version}", isDebugLogEnabled)
+ return version
+ }
+
+ (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, "Internal Error: One of the following should be defined in MSO URN properties file: ${versionWithResourceKey}, ${versionWithProcessKey}, ${DEFAULT_VERSION_KEY}")
+ }
+
+ public String getUri(Execution execution, resourceName) {
+
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ def processKey = taskProcessor.getMainProcessKey(execution)
+
+ resourceName = resourceName.replaceAll('-', '_')
+
+ // Check for flow+resource specific first
+ def key = "URN_mso_workflow_${processKey}_aai_${resourceName}_uri"
+ def uri = execution.getVariable(key)
+ if(uri) {
+ taskProcessor.logDebug("AaiUtil.getUri() - using flow+resource specific key: ${key}=${uri}", isDebugLogEnabled)
+ return uri
+ }
+
+ // Check for versioned key
+ def version = getVersion(execution, resourceName, processKey)
+ key = "URN_mso_workflow_default_aai_v${version}_${resourceName}_uri"
+ uri = execution.getVariable(key)
+
+ if(uri) {
+ taskProcessor.logDebug("AaiUtil.getUri() - using versioned URI key: ${key}=${uri}", isDebugLogEnabled)
+ return uri
+ }
+
+ (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, 'Internal Error: AAI URI entry for ' + key + ' not defined in the MSO URN properties file')
+ }
+
+ public String getNamespaceFromUri(String uri) {
+ String namespace = AAI_NAMESPACE_STRING
+ if(uri!=null){
+ return namespace + uri.substring(uri.indexOf("v"), uri.indexOf("v")+2)
+ }else{
+ return namespace
+ }
+ }
+
+
+
+ /**
+ * This reusable method can be used for making AAI Get Calls. The url should
+ * be passed as a parameter along with the execution. The method will
+ * return an APIResponse.
+ *
+ * @param execution
+ * @param url
+ *
+ * @return APIResponse
+ */
+ public APIResponse executeAAIGetCall(Execution execution, String url){
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ taskProcessor.logDebug(" ======== STARTED Execute AAI Get Process ======== ", isDebugEnabled)
+ try{
+ String uuid = UUID.randomUUID()
+ taskProcessor.logDebug( "Generated uuid is: " + uuid, isDebugEnabled)
+ taskProcessor.logDebug( "URL to be used is: " + url, isDebugEnabled)
+
+ String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey"))
+
+ RESTConfig config = new RESTConfig(url);
+ RESTClient client = new RESTClient(config).addHeader("X-FromAppId", "MSO").addHeader("X-TransactionId", uuid).addHeader("Accept","application/xml");
+
+ if (basicAuthCred != null && !"".equals(basicAuthCred)) {
+ client.addAuthorizationHeader(basicAuthCred)
+ }
+
+ APIResponse apiResponse = client.get()
+ return apiResponse
+
+ }catch(Exception e){
+ taskProcessor.logDebug("Exception occured while executing AAI Get Call. Exception is: \n" + e, isDebugEnabled)
+ return e
+ }
+ taskProcessor.logDebug( "======== COMPLETED Execute AAI Get Process ======== ", isDebugEnabled)
+ }
+
+ /**
+ * This reusable method can be used for making AAI httpPut Calls. The url should
+ * be passed as a parameter along with the execution and payload. The method will
+ * return an APIResponse.
+ *
+ * @param execution
+ * @param url
+ * @param payload
+ *
+ * @return APIResponse
+ */
+ public APIResponse executeAAIPutCall(Execution execution, String url, String payload){
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ taskProcessor.logDebug( " ======== Started Execute AAI Put Process ======== ", isDebugEnabled)
+ try{
+ String uuid = UUID.randomUUID()
+ taskProcessor.logDebug( "Generated uuid is: " + uuid, isDebugEnabled)
+ taskProcessor.logDebug( "URL to be used is: " + url, isDebugEnabled)
+
+ String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey"))
+
+ RESTConfig config = new RESTConfig(url);
+ RESTClient client = new RESTClient(config).addHeader("X-FromAppId", "MSO").addHeader("X-TransactionId", uuid).addHeader("Content-Type", "application/xml").addHeader("Accept","application/xml");
+ if (basicAuthCred != null && !"".equals(basicAuthCred)) {
+ client.addAuthorizationHeader(basicAuthCred)
+ }
+ APIResponse apiResponse = client.httpPut(payload)
+
+ return apiResponse
+ }catch(Exception e){
+ taskProcessor.utils.log("ERROR", "Exception occured while executing AAI Put Call. Exception is: \n" + e, isDebugEnabled)
+ return e
+ }
+ taskProcessor.logDebug( "======== Completed Execute AAI Put Process ======== ", isDebugEnabled)
+ }
+
+ /**
+ * This reusable method can be used for making AAI httpPatch Calls. The url should
+ * be passed as a parameter along with the execution and payload. The method will
+ * return an APIResponse.
+ *
+ * @param execution
+ * @param url
+ * @param payload
+ *
+ * @return APIResponse
+ */
+ public APIResponse executeAAIPatchCall(Execution execution, String url, String payload){
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ taskProcessor.logDebug( " ======== Started Execute AAI Patch Process ======== ", isDebugEnabled)
+ try{
+ String uuid = UUID.randomUUID()
+ taskProcessor.logDebug( "Generated uuid is: " + uuid, isDebugEnabled)
+
+ taskProcessor.logDebug( "URL to be used is: " + url, isDebugEnabled)
+
+ String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey"))
+
+ RESTConfig config = new RESTConfig(url);
+ RESTClient client = new RESTClient(config).addHeader("X-FromAppId", "MSO").addHeader("X-TransactionId", uuid).addHeader("Content-Type", "application/merge-patch+json").addHeader("Accept","application/json");
+ if (basicAuthCred != null && !"".equals(basicAuthCred)) {
+ client.addAuthorizationHeader(basicAuthCred)
+ }
+ APIResponse apiResponse = client.httpPatch(payload)
+
+ return apiResponse
+ }catch(Exception e){
+ taskProcessor.utils.log("ERROR", "Exception occured while executing AAI Patch Call. Exception is: \n" + e, isDebugEnabled)
+ return e
+ }
+ taskProcessor.logDebug( "======== Completed Execute AAI Patch Process ======== ", isDebugEnabled)
+ }
+
+
+ /**
+ * This reusable method can be used for making AAI Delete Calls. The url should
+ * be passed as a parameter along with the execution. The method will
+ * return an APIResponse.
+ *
+ * @param execution
+ * @param url
+ *
+ * @return APIResponse
+ */
+ public APIResponse executeAAIDeleteCall(Execution execution, String url){
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ taskProcessor.logDebug( " ======== Started Execute AAI Delete Process ======== ", isDebugEnabled)
+ try{
+ String uuid = UUID.randomUUID()
+ taskProcessor.logDebug( "Generated uuid is: " + uuid, isDebugEnabled)
+ taskProcessor.logDebug( "URL to be used is: " + url, isDebugEnabled)
+
+ String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey"))
+
+ RESTConfig config = new RESTConfig(url);
+ RESTClient client = new RESTClient(config).addHeader("X-FromAppId", "MSO").addHeader("X-TransactionId", uuid).addHeader("Accept","application/xml");
+ if (basicAuthCred != null && !"".equals(basicAuthCred)) {
+ client.addAuthorizationHeader(basicAuthCred)
+ }
+ APIResponse apiResponse = client.delete()
+
+ return apiResponse
+
+ }catch(Exception e){
+ taskProcessor.utils.log("ERROR", "Exception occured while executing AAI Delete Call. Exception is: \n" + e, isDebugEnabled)
+ return e
+ }
+ taskProcessor.logDebug( "======== Completed Execute AAI Delete Process ======== ", isDebugEnabled)
+ }
+
+ /**
+ * This reusable method can be used for making AAI Delete Calls. The url should
+ * be passed as a parameter along with the execution. The method will
+ * return an APIResponse.
+ *
+ * @param execution
+ * @param url
+ * @param payload
+ *
+ * @return APIResponse
+ */
+ public APIResponse executeAAIDeleteCall(Execution execution, String url, String payload, String authHeader){
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ taskProcessor.logDebug( " ======== Started Execute AAI Delete Process ======== ", isDebugEnabled)
+ try{
+ String uuid = UUID.randomUUID()
+ taskProcessor.logDebug( "Generated uuid is: " + uuid, isDebugEnabled)
+ taskProcessor.logDebug( "URL to be used is: " + url, isDebugEnabled)
+
+ String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey"))
+ RESTConfig config = new RESTConfig(url);
+ RESTClient client = new RESTClient(config).addHeader("X-FromAppId", "MSO").addHeader("X-TransactionId", uuid).addHeader("Accept","application/xml").addAuthorizationHeader(authHeader);
+ if (basicAuthCred != null && !"".equals(basicAuthCred)) {
+ client.addAuthorizationHeader(basicAuthCred)
+ }
+
+ APIResponse apiResponse = client.httpDelete(payload)
+
+ return apiResponse
+
+ }catch(Exception e){
+ taskProcessor.utils.log("ERROR", "Exception occured while executing AAI Delete Call. Exception is: \n" + e, isDebugEnabled)
+ return e
+ }
+ taskProcessor.logDebug( "======== Completed Execute AAI Delete Process ======== ", isDebugEnabled)
+ }
+
+ /**
+ * This reusable method can be used for making AAI Post Calls. The url should
+ * be passed as a parameter along with the execution. The method will
+ * return an APIResponse.
+ *
+ * @param execution
+ * @param url
+ * @param payload
+ *
+ * @return APIResponse
+ */
+ public APIResponse executeAAIPostCall(Execution execution, String url, String payload){
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ taskProcessor.logDebug( " ======== Started Execute AAI Post Process ======== ", isDebugEnabled)
+ try{
+ String uuid = UUID.randomUUID()
+ taskProcessor.logDebug( "Generated uuid is: " + uuid, isDebugEnabled)
+ taskProcessor.logDebug( "URL to be used is: " + url, isDebugEnabled)
+
+ String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey"))
+ RESTConfig config = new RESTConfig(url);
+ RESTClient client = new RESTClient(config).addHeader("X-FromAppId", "MSO").addHeader("X-TransactionId", uuid).addHeader("Accept","application/xml");
+ if (basicAuthCred != null && !"".equals(basicAuthCred)) {
+ client.addAuthorizationHeader(basicAuthCred)
+ }
+ APIResponse apiResponse = client.httpPost(payload)
+
+ return apiResponse
+
+ }catch(Exception e){
+ taskProcessor.utils.log("ERROR", "Exception occured while executing AAI Post Call. Exception is: \n" + e, isDebugEnabled)
+ return e
+ }
+ taskProcessor.logDebug( "======== Completed Execute AAI Post Process ======== ", isDebugEnabled)
+ }
+
+ /** Utilitty to get the Cloud Region from AAI
+ * Returns String cloud region id, (ie, cloud-region-id)
+ * @param execution
+ * @param url - url for AAI get cloud region
+ * @param backend - "PO" - real region, or "SDNC" - v2.5 (fake region).
+ */
+
+ //TODO: We should refactor this method to return WorkflowException instead of Error. Also to throw MSOWorkflowException which the calling flow will then catch.
+
+ public String getAAICloudReqion(Execution execution, String url, String backend, inputCloudRegion){
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+
+ try {
+ APIResponse apiResponse = executeAAIGetCall(execution, url)
+ String returnCode = apiResponse.getStatusCode()
+ String aaiResponseAsString = apiResponse.getResponseBodyAsString()
+ taskProcessor.utils.log("DEBUG", "Call AAI Cloud Region Return code: " + returnCode, isDebugEnabled)
+ execution.setVariable(execution.getVariable("prefix")+"queryCloudRegionReturnCode", returnCode)
+ //taskProcessor.utils.log("DEBUG", "Call AAI Cloud Region Response: " + aaiResponseAsString, isDebugEnabled)
+ //execution.setVariable(execution.getVariable("prefix")+"queryCloudRegionResponse", aaiResponseAsString)
+ String regionId = ""
+ if (returnCode == "200") {
+ taskProcessor.utils.log("DEBUG", "Call AAI Cloud Region is Successful.", isDebugEnabled)
+ try {
+ String regionVersion = taskProcessor.utils.getNodeText(aaiResponseAsString, "cloud-region-version")
+ taskProcessor.utils.log("DEBUG", "Cloud Region Version from AAI for " + backend + " is: " + regionVersion, isDebugEnabled)
+ if (backend == "PO") {
+ regionId = taskProcessor.utils.getNodeText(aaiResponseAsString, "cloud-region-id")
+ } else { // backend not "PO"
+ if (regionVersion == "2.5" ) {
+ regionId = "AAIAIC25"
+ } else {
+ regionId = taskProcessor.utils.getNodeText(aaiResponseAsString, "cloud-region-id")
+ }
+ }
+
+ taskProcessor.utils.log("DEBUG", "Cloud Region Id from AAI " + backend + " is: " + regionId, isDebugEnabled)
+ return regionId
+
+ } catch (Exception e) {
+ taskProcessor.utils.log("ERROR", "Exception occured while getting the Cloud Reqion. Exception is: \n" + e, isDebugEnabled)
+ return "ERROR"
+ }
+ } else { // not 200
+ if (returnCode == "404") {
+ if (backend == "PO") {
+ regionId = inputCloudRegion
+ } else { // backend not "PO"
+ regionId = "AAIAIC25"
+ }
+ taskProcessor.utils.log("DEBUG", "Cloud Region value for code='404' of " + backend + " is: " + regionId, isDebugEnabled)
+ return regionId
+ } else {
+ taskProcessor.utils.log("ERROR", "Call AAI Cloud Region is NOT Successful.", isDebugEnabled)
+ return "ERROR"
+ }
+ }
+ }catch(Exception e) {
+ taskProcessor.utils.log("ERROR", "Exception occured while getting the Cloud Reqion. Exception is: \n" + e, isDebugEnabled)
+ return "ERROR"
+ }
+ }
+
+ /* returns xml Node with service-type of searchValue */
+ def searchServiceType(xmlInput, searchValue){
+ def fxml= new XmlSlurper().parseText(xmlInput)
+ def ret = fxml.'**'.find {it.'service-type' == searchValue}
+ return ret
+ }
+
+ /* returns xml Node with service-instance-id of searchValue */
+ def searchServiceInstanceId(xmlInput, searchValue){
+ def ret = xmlInput.'**'.find {it.'service-instance-id' == searchValue}
+ return ret
+ }
+
+
+ /**
+ * Get the lowest unused VF Module index from AAI response for a given module type. The criteria for
+ * determining module type is specified by "key" parameter (for example, "persona-model-id"),
+ * the value for filtering is specified in "value" parameter
+ *
+ * @param execution
+ * @param aaiVnfResponse
+ * @param key
+ * @param value
+ *
+ * @return moduleIndex
+ *
+ */
+ public int getLowestUnusedVfModuleIndexFromAAIVnfResponse(Execution execution, String aaiVnfResponse, String key, String value) {
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ if (aaiVnfResponse != null) {
+ String vfModulesText = taskProcessor.utils.getNodeXml(aaiVnfResponse, "vf-modules")
+ if (vfModulesText == null || vfModulesText.isEmpty()) {
+ taskProcessor.utils.log("DEBUG", "There are no VF modules in this VNF yet", isDebugEnabled)
+ return 0
+ }
+ else {
+ def xmlVfModules= new XmlSlurper().parseText(vfModulesText)
+ def vfModules = xmlVfModules.'**'.findAll {it.name() == "vf-module"}
+ int vfModulesSize = 0
+ if (vfModules != null) {
+ vfModulesSize = vfModules.size()
+ }
+ String matchingVfModules = "<vfModules>"
+ for (i in 0..vfModulesSize-1) {
+ def vfModuleXml = groovy.xml.XmlUtil.serialize(vfModules[i])
+ def keyFromAAI = taskProcessor.utils.getNodeText(vfModuleXml, key)
+ if (keyFromAAI != null && keyFromAAI.equals(value)) {
+ matchingVfModules = matchingVfModules + taskProcessor.utils.removeXmlPreamble(vfModuleXml)
+ }
+ }
+ matchingVfModules = matchingVfModules + "</vfModules>"
+ taskProcessor.utils.log("DEBUG", "Matching VF Modules: " + matchingVfModules, isDebugEnabled)
+ String lowestUnusedIndex = taskProcessor.utils.getLowestUnusedIndex(matchingVfModules)
+ return Integer.parseInt(lowestUnusedIndex)
+ }
+ }
+ else {
+ return 0
+ }
+ }
+
} \ No newline at end of file
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy
index 5a23d17da0..d7aa97906c 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy
@@ -1,964 +1,720 @@
-/*-
- * ============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.common.scripts;
-
-import groovy.json.JsonSlurper
-
-import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.runtime.Execution
-import org.camunda.bpm.engine.variable.VariableMap
-import org.camunda.bpm.engine.variable.Variables
-import org.camunda.bpm.engine.variable.Variables.SerializationDataFormats
-import org.camunda.bpm.engine.variable.impl.value.ObjectValueImpl
-import org.openecomp.mso.bpmn.common.workflow.service.WorkflowCallbackResponse
-import org.openecomp.mso.bpmn.common.workflow.service.WorkflowContextHolder
-import org.openecomp.mso.bpmn.core.WorkflowException
-import org.springframework.web.util.UriUtils
-
-public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcessor {
- public MsoUtils utils = new MsoUtils()
-
-
- /**
- * Logs a message at the ERROR level.
- * @param message the message
- */
- public void logError(String message) {
- log('ERROR', message, null, "true")
- }
-
- /**
- * Logs a message at the ERROR level.
- * @param message the message
- * @param cause the cause (stracktrace will be included in the output)
- */
- public void logError(String message, Throwable cause) {
- log('ERROR', message, cause, "true")
- }
-
- /**
- * Logs a message at the WARN level.
- * @param message the message
- */
- public void logWarn(String message) {
- log('WARN', message, null, "true")
- }
-
- /**
- * Logs a message at the WARN level.
- * @param message the message
- * @param cause the cause (stracktrace will be included in the output)
- */
- public void logWarn(String message, Throwable cause) {
- log('WARN', message, cause, "true")
- }
-
- /**
- * Logs a message at the INFO level.
- * @param message the message
- */
- public void logInfo(String message) {
- log('INFO', message, null, "true")
- }
-
- /**
- * Logs a message at the INFO level.
- * @param message the message
- * @param cause the cause (stracktrace will be included in the output)
- */
- public void logInfo(String message, Throwable cause) {
- log('INFO', message, cause, "true")
- }
-
- /**
- * Logs a message at the DEBUG level.
- * @param message the message
- * @param isDebugLogEnabled a flag indicating if DEBUG level is enabled
- */
- public void logDebug(String message, String isDebugLogEnabled) {
- log('DEBUG', message, null, isDebugLogEnabled)
- }
-
- /**
- * Logs a message at the DEBUG level.
- * @param message the message
- * @param cause the cause (stracktrace will be included in the output)
- * @param isDebugLogEnabled a flag indicating if DEBUG level is enabled
- */
- public void logDebug(String message, Throwable cause, String isDebugLogEnabled) {
- log('DEBUG', message, cause, isDebugLogEnabled)
- }
-
- /**
- * Logs a message at the specified level.
- * @param level the level (DEBUG, INFO, WARN, ERROR)
- * @param message the message
- * @param isLevelEnabled a flag indicating if the level is enabled
- * (used only at the DEBUG level)
- */
- public void log(String level, String message, String isLevelEnabled) {
- log(level, message, null, isLevelEnabled)
- }
-
- /**
- * Logs a message at the specified level.
- * @param level the level (DEBUG, INFO, WARN, ERROR)
- * @param message the message
- * @param cause the cause (stracktrace will be included in the output)
- * @param isLevelEnabled a flag indicating if the level is enabled
- * (used only at the DEBUG level)
- */
- public void log(String level, String message, Throwable cause, String isLevelEnabled) {
- if (cause == null) {
- utils.log(level, message, isLevelEnabled);
- } else {
- StringWriter stringWriter = new StringWriter();
- PrintWriter printWriter = new PrintWriter(stringWriter);
- printWriter.println(message);
- cause.printStackTrace(printWriter);
- utils.log(level, stringWriter.toString(), isLevelEnabled);
- printWriter.close();
- }
- }
-
- /**
- * Logs a WorkflowException at the ERROR level with the specified message.
- * @param execution the execution
- */
- public void logWorkflowException(Execution execution, String message) {
- def workflowException = execution.getVariable("WorkflowException")
-
- if (workflowException == null) {
- logError(message);
- } else {
- logError(message + ": " + workflowException)
- }
- }
-
- /**
- * Saves the WorkflowException in the execution to the specified variable,
- * clearing the WorkflowException variable so the workflow can continue
- * processing (perhaps catching another WorkflowException).
- * @param execution the execution
- * @return the name of the destination variable
- */
- public saveWorkflowException(Execution execution, String variable) {
- if (variable == null) {
- throw new NullPointerException();
- }
-
- execution.setVariable(variable, execution.getVariable("WorkflowException"))
- execution.setVariable("WorkflowException", null)
- }
-
- /**
- * Builds a success response from the specified message content and numeric
- * response code. The response code may be an integer or a string representation
- * of an integer. The response is stored in the execution where it may be
- * picked up by the Workflow service.
- * <p>
- * IMPORTANT: the activity that executes this method should have an
- * asynchronous continuation after it to ensure the execution variables
- * are persisted to the database.
- * @param execution the execution
- * @param content the message content
- * @param responseCode the message response code
- */
- @Deprecated
- public void buildResponse(Execution execution, String content, Object responseCode) {
- buildResponse(execution, content, responseCode, true)
- }
-
- /**
- * Builds a standard error response containing the specified error message and
- * numeric response code. The response code may be an integer or a string
- * representation of an integer. The response is stored in the execution where
- * it may be picked up by the Workflow service.
- * <p>
- * IMPORTANT: the activity that executes this method should have an
- * asynchronous continuation after it to ensure the execution variables
- * are persisted to the database.
- * @param execution the execution
- * @param content the message content
- * @param errorCode the message response code
- */
- @Deprecated
- public void buildErrorResponse(Execution execution, String errorMessage, Object errorCode) {
-
- def encErrorMessage = errorMessage.replace("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;")
-
- def content = """
- <aetgt:WorkflowException xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1">
- <aetgt:ErrorMessage>${encErrorMessage}</aetgt:ErrorMessage>
- <aetgt:ErrorCode>${errorCode}</aetgt:ErrorCode>
- </aetgt:WorkflowException>
- """
-
- buildResponse(execution, content, errorCode, false)
- }
-
- // BEGIN LEGACY SUPPORT. TODO: REMOVE THIS CODE
- /**
- * Builds a standard error response containing the specified error message
- * and a numeric response code. The response code is obtained from the
- * prefix+"ResponseCode" execution variable. The response is stored in the
- * execution where it may be picked up by the Workflow service.
- * <p>
- * IMPORTANT: the activity that executes this method should have an
- * asynchronous continuation after it to ensure the execution variables
- * are persisted to the database.
- * <p>
- * This method is deprecated. Methods that accept a response code should
- * be used instead.
- * @param execution the execution
- * @param errorMessage the error message for the error response
- */
- @Deprecated
- public void buildErrorResponse(Execution execution, String errorMessage) {
- buildErrorResponse(execution, errorMessage, null)
- }
- // END LEGACY SUPPORT. TODO: REMOVE THIS CODE
-
- /**
- * Builds a response from the specified message content and numeric response
- * code. The response code may be an integer or a string representation of
- * an integer. The response is stored in the execution where it may be
- * picked up by the Workflow service.
- * <p>
- * IMPORTANT: the activity that executes this method should have an
- * asynchronous continuation after it to ensure the execution variables
- * are persisted to the database.
- * @param execution the execution
- * @param content the message content
- * @param responseCode the message response code
- * @param isSuccess true if this is a success response
- */
- @Deprecated
- protected void buildResponse(Execution execution, String content, Object responseCode,
- boolean isSuccess) {
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
-
- String processKey = getProcessKey(execution);
- logDebug("Building " + processKey + " response", isDebugLogEnabled)
-
- Map<String, Object> responseMap = new HashMap<String, Object>()
-
- if (isSuccess) {
- responseMap.put("Status", "Success")
- } else {
- responseMap.put("Status", "Fail")
- }
-
- // BEGIN LEGACY SUPPORT. TODO: REMOVE THIS CODE
- def prefix = execution.getVariable("prefix")
-
- if (responseCode == null) {
- responseCode = execution.getVariable(prefix+"ResponseCode")
- } else {
- execution.setVariable(prefix+"ResponseCode", String.valueOf(responseCode))
- }
- // END LEGACY SUPPORT. TODO: REMOVE THIS CODE
-
- responseMap.put("ResponseCode", String.valueOf(responseCode))
-
- if (isSuccess) {
- responseMap.put("Status", "Success")
- // TODO: Should deprecate use of processKey+Response variable for the response. Will use "WorkflowResponse" instead
- execution.setVariable("WorkflowResponse", content)
- // BEGIN LEGACY SUPPORT. TODO: REMOVE THIS CODE
- execution.setVariable(processKey+"Response", content)
- execution.setVariable(prefix+"ErrorResponse", null)
- // END LEGACY SUPPORT. TODO: REMOVE THIS CODE
- } else {
- responseMap.put("Status", "Fail")
- // BEGIN LEGACY SUPPORT. TODO: REMOVE THIS CODE
- execution.setVariable(prefix+"ErrorResponse", content)
- execution.setVariable(prefix+"Response", null)
- // END LEGACY SUPPORT. TODO: REMOVE THIS CODE
- }
-
- responseMap.put("Response", content)
-
- logDebug(processKey
- + " ResponseCode=" + responseMap.get("ResponseCode")
- + " Status=" + responseMap.get("Status")
- + " Response=\n" + responseMap.get("Response"),
- isDebugLogEnabled)
-
- execution.setVariable(processKey + "ResponseMap", responseMap)
- }
-
- /**
- * Builds an error response (if one has not already been built) and throws
- * a BpmnError of type "MSOWorkflowException" that can be caught as a
- * boundary event.
- * @param execution the execution
- * @param errorMessage the error message for the error response
- * @param responseCode the message response code
- */
- @Deprecated
- public void workflowException(Execution execution, String errorMessage, Object responseCode) {
- String processKey = getProcessKey(execution);
-
- buildErrorResponse(execution, errorMessage, responseCode)
- throw new BpmnError("MSOWorkflowException")
- }
-
- /**
- * Puts a WorkflowException into the execution
- * @param execution the execution
- * @param errorCode the error code (normally a 4-digit number)
- * @param errorMessage the error message
- */
- @Deprecated
- public void newWorkflowException(Execution execution, int errorCode, String errorMessage) {
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- String processKey = getProcessKey(execution);
- logDebug("Building a " + processKey + " WorkflowException", isDebugLogEnabled)
-
- if (errorCode < 1000) {
- throw new IllegalArgumentException("ErrorCode must be a number greater than 1000");
- }
-
- WorkflowException exception = new WorkflowException(processKey, errorCode, errorMessage);
- execution.setVariable("WorkflowException", exception);
- }
-
- /**
- * Puts a WorkflowException into the execution and throws an MSOWorkflowException event.
- * @param execution the execution
- * @param errorCode the error code (normally a 4-digit number)
- * @param errorMessage the error message
- */
- // TODO: rename this method to be throwWorkflowException
- @Deprecated
- public void createWorkflowException(Execution execution, int errorCode, String errorMessage) {
- newWorkflowException(execution, errorCode, errorMessage)
- throw new BpmnError("MSOWorkflowException", "errorCode:" + errorCode + ", errorMessage:" + errorMessage)
- }
-
- /**
- * Puts a WorkflowException into the execution and throws an MSOWorkflowException event.
- * @param execution the execution
- * @param errorCode the error code (normally a 4-digit number)
- * @param errorMessage the error message
- */
- @Deprecated
- public void commonWorkflowException(Execution execution, int errorCode, String errorMessage) {
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- String processKey = getProcessKey(execution);
- logDebug("Building a " + processKey + " WorkflowException", isDebugLogEnabled)
- logError(errorMessage)
- WorkflowException exception = new WorkflowException(processKey, errorCode, errorMessage);
- execution.setVariable("WorkflowException", exception);
- throw new BpmnError("MSOWorkflowException","errorCode:" + errorCode + ",errorMessage:" + errorMessage)
- }
-
- /**
- * Puts a WorkflowException into the execution and throws an MSOWorkflowException event.
- * @param execution the execution
- * @param errorCode the error code (normally a 4-digit number)
- * @param errorMessage the error message
- */
- @Deprecated
- public void commonWorkflowException(Execution execution, String errorCode, String errorMessage) {
- int intRespCode
- try{
- intRespCode = Integer.parseInt(errorCode)
- }catch (Exception e){
- intRespCode = 400
- }
- commonWorkflowException(execution, intRespCode, errorMessage)
- }
-
-
-
- /**
- * Validates that the request exists and that the mso-request-id variable is set.
- * Additional required variables may be checked by specifying their names.
- * NOTE: services requiring mso-service-instance-id must specify it explicitly!
- * If a problem is found, buildAndThrowWorkflowException builds a WorkflowException
- * and throws an MSOWorkflowException. This method also sets up the log context for
- * the workflow.
- *
- * @param execution the execution
- * @return the validated request
- */
- public String validateRequest(Execution execution, String... requiredVariables) {
- ExceptionUtil exceptionUtil = new ExceptionUtil()
- def method = getClass().getSimpleName() + '.validateRequest(' +
- 'execution=' + execution.getId() +
- ', requredVariables=' + requiredVariables +
- ')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- String processKey = getProcessKey(execution)
- def prefix = execution.getVariable("prefix")
-
- if (prefix == null) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 1002, processKey + " prefix is null")
- }
-
- try {
- def request = execution.getVariable(prefix + 'Request')
-
- if (request == null) {
- request = execution.getVariable(processKey + 'Request')
-
- if (request == null) {
- request = execution.getVariable('bpmnRequest')
- }
-
- setVariable(execution, processKey + 'Request', null)
- setVariable(execution, 'bpmnRequest', null)
- setVariable(execution, prefix + 'Request', request)
- }
-
- if (request == null) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 1002, processKey + " request is null")
- }
-
- // All requests must have a request ID.
- // Some requests (e.g. SDN-MOBILITY) do not have a service instance ID.
-
- String requestId = null
- String serviceInstanceId = null
-
- List<String> allRequiredVariables = new ArrayList<String>()
- allRequiredVariables.add("mso-request-id")
-
- if (requiredVariables != null) {
- for (String variable : requiredVariables) {
- if (!allRequiredVariables.contains(variable)) {
- allRequiredVariables.add(variable)
- }
- }
- }
-
- for (String variable : allRequiredVariables) {
- def value = execution.getVariable(variable)
- if (value == null || ((value instanceof CharSequence) && value.length() == 0)) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 1002, processKey +
- " request was received with no '" + variable + "' variable")
- }
-
- if ("mso-request-id".equals(variable)) {
- requestId = (String) value
- } else if ("mso-service-instance-id".equals(variable)) {
- serviceInstanceId = (String) value
- }
- }
-
- if (serviceInstanceId == null) {
- serviceInstanceId = (String) execution.getVariable("mso-service-instance-id")
- }
-
- utils.logContext(requestId, serviceInstanceId)
- logDebug('Incoming message: ' + System.lineSeparator() + request, isDebugLogEnabled)
- logDebug('Exited ' + method, isDebugLogEnabled)
- return request
- } catch (BpmnError e) {
- throw e
- } catch (Exception e) {
- logError('Caught exception in ' + method, e)
- exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Invalid Message")
- }
- }
-
- /**
- * gets vars stored in a JSON object in prefix+Request and returns as a LazyMap
- * setting log context here too
- * @param execution the execution
- * @return the inputVars
- */
- public Map validateJSONReq(Execution execution) {
- def method = getClass().getSimpleName() + '.validateJSONReq(' +
- 'execution=' + execution.getId() +
- ')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- String processKey = getProcessKey(execution);
- def prefix = execution.getVariable("prefix")
-
- def requestId =getVariable(execution, "mso-request-id")
- def serviceInstanceId = getVariable(execution, "mso-service-instance-id")
- if(requestId!=null && serviceInstanceId!=null){
- utils.logContext(requestId, serviceInstanceId)
- }
-
-
- def request = getVariable(execution, prefix + 'Request')
-
- if (request == null) {
- request = getVariable(execution, processKey + 'Request')
-
- if (request == null) {
- request = getVariable(execution, 'bpmnRequest')
- }
- execution.setVariable(prefix + 'Request', request)
- }
-
- def jsonSlurper = new JsonSlurper()
- def parsed = jsonSlurper.parseText(request)
-
-
- logDebug('Incoming message: ' + System.lineSeparator() + request, isDebugLogEnabled)
- logDebug('Exited ' + method, isDebugLogEnabled)
- return parsed
-
- }
-
-
-
-
- /**
- * Sends a response to the workflow service that invoked the process. This method
- * may only be used by top-level processes that were directly invoked by the
- * asynchronous workflow service.
- * @param execution the execution
- * @param responseCode the response code
- * @param content the message content
- * @throws IllegalArgumentException if the response code is invalid
- * by HTTP standards
- * @throws UnsupportedOperationException if not invoked by an asynchronous,
- * top-level process
- * @throws IllegalStateException if a response has already been sent
- */
- protected void sendWorkflowResponse(Execution execution, Object responseCode, String response) {
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- try {
- String processKey = getProcessKey(execution);
-
- // isAsyncProcess is injected by the workflow service that started the flow
- if (!String.valueOf(execution.getVariable("isAsyncProcess")).equals("true")) {
- throw new UnsupportedOperationException(processKey + ": " +
- "sendWorkflowResponse is valid only in asynchronous workflows");
- }
-
- if (String.valueOf(execution.getVariable(processKey + "WorkflowResponseSent")).equals("true")) {
- logDebug("Sync response has already been sent for " + processKey, isDebugLogEnabled)
- }else{
-
- logDebug("Building " + processKey + " response ", isDebugLogEnabled)
-
- int intResponseCode;
-
- try {
- intResponseCode = Integer.parseInt(String.valueOf(responseCode));
-
- if (intResponseCode < 100 || intResponseCode > 599) {
- throw new NumberFormatException(String.valueOf(responseCode));
- }
- } catch (NumberFormatException e) {
- throw new IllegalArgumentException("Process " + processKey
- + " provided an invalid HTTP response code: " + responseCode);
- }
-
- // Only 2XX responses are considered "Success"
- String status = (intResponseCode >= 200 && intResponseCode <= 299) ?
- "Success" : "Fail";
-
- // TODO: Should deprecate use of processKey+Response variable for the response. Will use "WorkflowResponse" instead
- execution.setVariable(processKey + "ResponseCode", String.valueOf(intResponseCode))
- execution.setVariable(processKey + "Response", response);
- execution.setVariable(processKey + "Status", status);
- execution.setVariable("WorkflowResponse", response)
-
- logDebug("Sending response for " + processKey
- + " ResponseCode=" + intResponseCode
- + " Status=" + status
- + " Response=\n" + response,
- isDebugLogEnabled)
-
- // TODO: ensure that this flow was invoked asynchronously?
-
- WorkflowCallbackResponse callbackResponse = new WorkflowCallbackResponse()
- callbackResponse.setStatusCode(intResponseCode)
- callbackResponse.setMessage(status)
- callbackResponse.setResponse(response)
-
- // TODO: send this data with HTTP POST
-
- WorkflowContextHolder.getInstance().processCallback(
- processKey,
- execution.getProcessInstanceId(),
- execution.getVariable("mso-request-id"),
- callbackResponse)
-
- execution.setVariable(processKey + "WorkflowResponseSent", "true");
- }
-
- } catch (Exception ex) {
- logError("Unable to send workflow response to client ....", ex)
- }
- }
-
- /**
- * Returns true if a workflow response has already been sent.
- * @param execution the execution
- */
- protected boolean isWorkflowResponseSent(Execution execution) {
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- String processKey = getProcessKey(execution);
- return String.valueOf(execution.getVariable(processKey + "WorkflowResponseSent")).equals("true");
- }
-
- /**
- * Returns the process definition key (i.e. the process name) of the
- * current process.
- *
- * @param execution the execution
- */
- public String getProcessKey(Execution execution) {
- def testKey = execution.getVariable("testProcessKey")
- if(testKey!=null){
- return testKey
- }
- return execution.getProcessEngineServices().getRepositoryService()
- .getProcessDefinition(execution.getProcessDefinitionId()).getKey()
- }
-
- /**
- * Returns the process definition key (i.e. the process name) of the
- * top-level process.
- * @param execution the execution
- */
- public String getMainProcessKey(Execution execution) {
- Execution exec = execution
-
- while (true) {
- Execution parent = exec.getSuperExecution()
-
- if (parent == null) {
- parent = exec.getParent()
-
- if (parent == null) {
- break
- }
- }
-
- exec = parent
- }
-
- return execution.getProcessEngineServices().getRepositoryService()
- .getProcessDefinition(exec.getProcessDefinitionId()).getKey()
- }
-
- /**
- * Gets the node for the named element from the given xml. If the element
- * does not exist in the xml or is empty, a WorkflowException is created
- * (and as a result, a MSOWorkflowException event is thrown).
- *
- * @param execution The flow's execution.
- * @param xml Xml to search.
- * @param elementName Name of element to search for.
- * @return The element node, if found in the xml.
- */
- protected String getRequiredNodeXml(Execution execution, String xml, String elementName) {
- def element = utils.getNodeXml(xml, elementName, false)
- if (element.trim().isEmpty()) {
- def msg = 'Required element \'' + elementName + '\' is missing or empty'
- logError(msg)
- createWorkflowException(execution, 2000, msg)
- } else {
- return element
- }
- }
-
- /**
- * Gets the value of the named element from the given xml. If the element
- * does not exist in the xml or is empty, a WorkflowException is created
- * (and as a result, a MSOWorkflowException event is thrown).
- *
- * @param execution The flow's execution.
- * @param xml Xml to search.
- * @param elementName Name of element to whose value to get.
- * @return The value of the element, if found in the xml.
- */
- protected String getRequiredNodeText(Execution execution, String xml, String elementName) {
- def elementText = utils.getNodeText1(xml, elementName)
- if (elementText == null) {
- def msg = 'Required element \'' + elementName + '\' is missing or empty'
- logError(msg)
- createWorkflowException(execution, 2000, msg)
- } else {
- return elementText
- }
- }
-
- /**
- * Get the text for the specified element from the specified xml. If
- * the element does not exist, return an empty string.
- *
- * @param xml Xml from which to get the element's text.
- * @param elementName Name of element whose text to get.
- * @return the element's text or an empty string if the element does not
- * exist in the given xml.
- */
- protected String getNodeTextForce(String xml, String elementName) {
- def nodeText = utils.getNodeText1(xml, elementName)
- return (nodeText == null) ? '' : nodeText
- }
-
- /**
- * Sends the empty, synchronous response back to the API Handler.
- * @param execution the execution
- */
- @Deprecated
- public void sendResponse(Execution execution) {
- def method = getClass().getSimpleName() + '.sendResponse(' +
- 'execution=' + execution.getId() +
- ')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- try {
- buildResponse(execution, "", 200)
- logDebug('Exited ' + method, isDebugLogEnabled)
- } catch (BpmnError e) {
- throw e;
- } catch (Exception e) {
- logError('Caught exception in ' + method, e)
- workflowException(execution, 'Internal Error', 9999) // TODO: what message and error code?
- }
- }
-
- /**
- *Store the variable as typed with java serialization type
- *@param execution
- *@param name
- *@param value
- */
- public void setVariable(Execution execution, String name, Object value) {
- VariableMap variables = Variables.createVariables()
- variables.putValueTyped('payload', Variables.objectValue(value)
- .serializationDataFormat(SerializationDataFormats.JAVA) // tells the engine to use java serialization for persisting the value
- .create())
- execution.setVariable(name,variables)
- }
-
- //TODO not sure how this will look in Cockpit
-
- /**
- * Returns the variable map
- *@param execution
- *@param name
- *@return
- **/
- public String getVariable(Execution execution, String name) {
- def myObj = execution.getVariable(name)
- if(myObj instanceof VariableMap){
- VariableMap serializedObjectMap = (VariableMap) myObj
- ObjectValueImpl payloadObj = serializedObjectMap.getValueTyped('payload')
- return payloadObj.getValue()
- }else{
- return myObj
- }
- }
-
-
- /**
- * Returns true if a value equals one of the provided set. Equality is
- * determined by using the equals method if the value object and the
- * object in the provided set have the same class. Otherwise, the objects
- * are converted to strings and then compared. Nulls are permitted for
- * the value as well as in the provided set
- * Example:
- * <pre>
- * def statusCode = getStatusCode()
- * isOneOf(statusCode, 200, 201, 204)
- * </pre>
- * @param value the value to test
- * @param these a set of permissable values
- * @return true if the value is in the provided set
- */
- public boolean isOneOf(Object value, Object... these) {
- for (Object thisOne : these) {
- if (thisOne == null) {
- if (value == null) {
- return true
- }
- } else {
- if (value != null) {
- if (value.getClass() == thisOne.getClass()) {
- if (value.equals(thisOne)) {
- return true
- }
- } else {
- if (String.valueOf(value).equals(String.valueOf(thisOne))) {
- return true
- }
- }
- }
- }
- }
-
- return false
- }
-
- public void setSuccessIndicator(Execution execution, boolean isSuccess) {
- String prefix = execution.getVariable('prefix')
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
-
- logDebug('Entered SetSuccessIndicator Method', isDebugLogEnabled)
- execution.setVariable(prefix+'SuccessIndicator', isSuccess)
- logDebug('Outgoing SuccessIndicator is: ' + execution.getVariable(prefix+'SuccessIndicator') + '', isDebugLogEnabled)
- }
-
-
- public void sendSyncError(Execution execution) {
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- String requestId = execution.getVariable("mso-request-id")
- logDebug('sendSyncError, requestId: ' + requestId, isDebugEnabled)
- WorkflowException workflowExceptionObj = execution.getVariable("WorkflowException")
- if (workflowExceptionObj != null) {
- String errorMessage = workflowExceptionObj.getErrorMessage()
- def errorCode = workflowExceptionObj.getErrorCode()
- logDebug('sendSyncError, requestId: ' + requestId + ' | errorMessage: ' + errorMessage + ' | errorCode: ' + errorCode, isDebugEnabled)
- sendWorkflowResponse(execution, errorCode, errorMessage)
- }
- }
-
- /**
- * Create a WorkflowException - uses ExceptionUtil to build a WorkflowException
- * @param execution
- * @param errorCode
- * @param errorMessage
- * @param isDebugEnabled
- */
- public void buildWorkflowException(Execution execution, int errorCode, String errorMessage, boolean isDebugEnabled) {
- (new ExceptionUtil()).buildWorkflowException(execution, errorCode, errorMessage)
- }
-
- /**
- * Executes a named groovy script method in the current object
- */
- public void executeMethod(String methodName, Object... args) {
-
- if (args != null && args.size() > 0) {
-
- // First argument of method to call is always the execution object
- Execution execution = (Execution) args[0]
-
- def classAndMethod = getClass().getSimpleName() + '.' + methodName + '(execution=' + execution.getId() + ')'
- def isDebugEnabled = execution.getVariable('isDebugLogEnabled')
-
- logDebug('Entered ' + classAndMethod, isDebugEnabled)
- logDebug('Received parameters: ' + args, isDebugEnabled)
-
- try{
- def methodToCall = this.metaClass.getMetaMethod(methodName, args)
- logDebug('Method to call: ' + methodToCall, isDebugEnabled)
- methodToCall?.invoke(this, args)
- }
- catch(BpmnError bpmnError) {
- logDebug('Rethrowing BpmnError ' + bpmnError.getMessage(), isDebugEnabled)
- throw bpmnError
- }
- catch(Exception e) {
- e.printStackTrace()
- logDebug('Unexpected error encountered - ' + e.getMessage(), isDebugEnabled)
- (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, e.getMessage())
- }
- finally {
- logDebug('Exited ' + classAndMethod, isDebugEnabled)
- }
- }
- }
-
- /**
- *This method determines and adds the appropriate ending to come
- *after a number (-st, -nd, -rd, or -th)
- *
- *@param int n
- *
- *@return String ending - number with suffix
- */
-
- public static String labelMaker(Object n) {
- Integer num
- if(n instanceof String){
- num = Integer.parseInt(n)
- }else{
- num = n
- }
-
- String ending = ""; //the end to be added to the number
- if(num != null){
- if ((num % 10 == 1) && (num != 11)) {
- ending = num + "st";
- } else if ((num % 10 == 2) && (num != 12)) {
- ending = num + "nd";
- } else if ((num % 10 == 3) && (num != 13)) {
- ending = num + "rd";
- } else {
- ending = num + "th";
- }
- }
- return ending
- }
-
- /**
- *
- *This method gets and decodes SDNC Response's "RequestData".
- *
- *@param response - the sdnc response
- *
- *@return data - the response "RequestData" decoded
- *
- */
- public String getRequestDataDecoded(String response){
- String data = utils.getNodeText1(response, "RequestData")
- if(data != null){
- data = data.replaceAll("&lt;", "<")
- data = data.replaceAll("&gt;", ">")
- }
-
- return data
- }
-
-
- /**
- * Constructs a workflow message callback URL for the specified message type and correlator.
- * @param messageType the message type (e.g. SDNCAResponse or VNFAResponse)
- * @param correlator the correlator value (e.g. a request ID)
- */
- public String createCallbackURL(Execution execution, String messageType, String correlator) {
- String endpoint = (String) execution.getVariable('URN_mso_workflow_message_endpoint')
-
- if (endpoint == null || endpoint.isEmpty()) {
- ExceptionUtil exceptionUtil = new ExceptionUtil()
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000,
- 'mso:workflow:message:endpoint URN mapping is not set')
- }
-
- while (endpoint.endsWith('/')) {
- endpoint = endpoint.substring(0, endpoint.length()-1)
- }
-
- return endpoint +
- '/' + UriUtils.encodePathSegment(messageType, 'UTF-8') +
- '/' + UriUtils.encodePathSegment(correlator, 'UTF-8')
- }
-
-}
+/*-
+ * ============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.common.scripts;
+
+import groovy.json.JsonSlurper
+
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.runtime.Execution
+import org.camunda.bpm.engine.variable.VariableMap
+import org.camunda.bpm.engine.variable.Variables
+import org.camunda.bpm.engine.variable.Variables.SerializationDataFormats
+import org.camunda.bpm.engine.variable.impl.value.ObjectValueImpl
+import org.openecomp.mso.bpmn.common.workflow.service.WorkflowCallbackResponse
+import org.openecomp.mso.bpmn.common.workflow.service.WorkflowContextHolder
+import org.openecomp.mso.bpmn.core.WorkflowException
+import org.springframework.web.util.UriUtils
+
+public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcessor {
+ public MsoUtils utils = new MsoUtils()
+
+
+ /**
+ * Logs a message at the ERROR level.
+ * @param message the message
+ */
+ public void logError(String message) {
+ log('ERROR', message, null, "true")
+ }
+
+ /**
+ * Logs a message at the ERROR level.
+ * @param message the message
+ * @param cause the cause (stracktrace will be included in the output)
+ */
+ public void logError(String message, Throwable cause) {
+ log('ERROR', message, cause, "true")
+ }
+
+ /**
+ * Logs a message at the WARN level.
+ * @param message the message
+ */
+ public void logWarn(String message) {
+ log('WARN', message, null, "true")
+ }
+
+ /**
+ * Logs a message at the WARN level.
+ * @param message the message
+ * @param cause the cause (stracktrace will be included in the output)
+ */
+ public void logWarn(String message, Throwable cause) {
+ log('WARN', message, cause, "true")
+ }
+
+ /**
+ * Logs a message at the DEBUG level.
+ * @param message the message
+ * @param isDebugLogEnabled a flag indicating if DEBUG level is enabled
+ */
+ public void logDebug(String message, String isDebugLogEnabled) {
+ log('DEBUG', message, null, isDebugLogEnabled)
+ }
+
+ /**
+ * Logs a message at the DEBUG level.
+ * @param message the message
+ * @param cause the cause (stracktrace will be included in the output)
+ * @param isDebugLogEnabled a flag indicating if DEBUG level is enabled
+ */
+ public void logDebug(String message, Throwable cause, String isDebugLogEnabled) {
+ log('DEBUG', message, cause, isDebugLogEnabled)
+ }
+
+ /**
+ * Logs a message at the specified level.
+ * @param level the level (DEBUG, INFO, WARN, ERROR)
+ * @param message the message
+ * @param isLevelEnabled a flag indicating if the level is enabled
+ * (used only at the DEBUG level)
+ */
+ public void log(String level, String message, String isLevelEnabled) {
+ log(level, message, null, isLevelEnabled)
+ }
+
+ /**
+ * Logs a message at the specified level.
+ * @param level the level (DEBUG, INFO, WARN, ERROR)
+ * @param message the message
+ * @param cause the cause (stracktrace will be included in the output)
+ * @param isLevelEnabled a flag indicating if the level is enabled
+ * (used only at the DEBUG level)
+ */
+ public void log(String level, String message, Throwable cause, String isLevelEnabled) {
+ if (cause == null) {
+ utils.log(level, message, isLevelEnabled);
+ } else {
+ StringWriter stringWriter = new StringWriter();
+ PrintWriter printWriter = new PrintWriter(stringWriter);
+ printWriter.println(message);
+ cause.printStackTrace(printWriter);
+ utils.log(level, stringWriter.toString(), isLevelEnabled);
+ printWriter.close();
+ }
+ }
+
+ /**
+ * Logs a WorkflowException at the ERROR level with the specified message.
+ * @param execution the execution
+ */
+ public void logWorkflowException(Execution execution, String message) {
+ def workflowException = execution.getVariable("WorkflowException")
+
+ if (workflowException == null) {
+ logError(message);
+ } else {
+ logError(message + ": " + workflowException)
+ }
+ }
+
+ /**
+ * Saves the WorkflowException in the execution to the specified variable,
+ * clearing the WorkflowException variable so the workflow can continue
+ * processing (perhaps catching another WorkflowException).
+ * @param execution the execution
+ * @return the name of the destination variable
+ */
+ public saveWorkflowException(Execution execution, String variable) {
+ if (variable == null) {
+ throw new NullPointerException();
+ }
+
+ execution.setVariable(variable, execution.getVariable("WorkflowException"))
+ execution.setVariable("WorkflowException", null)
+ }
+
+
+ /**
+ * Validates that the request exists and that the mso-request-id variable is set.
+ * Additional required variables may be checked by specifying their names.
+ * NOTE: services requiring mso-service-instance-id must specify it explicitly!
+ * If a problem is found, buildAndThrowWorkflowException builds a WorkflowException
+ * and throws an MSOWorkflowException. This method also sets up the log context for
+ * the workflow.
+ *
+ * @param execution the execution
+ * @return the validated request
+ */
+ public String validateRequest(Execution execution, String... requiredVariables) {
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+ def method = getClass().getSimpleName() + '.validateRequest(' +
+ 'execution=' + execution.getId() +
+ ', requredVariables=' + requiredVariables +
+ ')'
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ logDebug('Entered ' + method, isDebugLogEnabled)
+
+ String processKey = getProcessKey(execution)
+ def prefix = execution.getVariable("prefix")
+
+ if (prefix == null) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1002, processKey + " prefix is null")
+ }
+
+ try {
+ def request = execution.getVariable(prefix + 'Request')
+
+ if (request == null) {
+ request = execution.getVariable(processKey + 'Request')
+
+ if (request == null) {
+ request = execution.getVariable('bpmnRequest')
+ }
+
+ setVariable(execution, processKey + 'Request', null)
+ setVariable(execution, 'bpmnRequest', null)
+ setVariable(execution, prefix + 'Request', request)
+ }
+
+ if (request == null) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1002, processKey + " request is null")
+ }
+
+ // All requests must have a request ID.
+ // Some requests (e.g. SDN-MOBILITY) do not have a service instance ID.
+
+ String requestId = null
+ String serviceInstanceId = null
+
+ List<String> allRequiredVariables = new ArrayList<String>()
+ allRequiredVariables.add("mso-request-id")
+
+ if (requiredVariables != null) {
+ for (String variable : requiredVariables) {
+ if (!allRequiredVariables.contains(variable)) {
+ allRequiredVariables.add(variable)
+ }
+ }
+ }
+
+ for (String variable : allRequiredVariables) {
+ def value = execution.getVariable(variable)
+ if (value == null || ((value instanceof CharSequence) && value.length() == 0)) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1002, processKey +
+ " request was received with no '" + variable + "' variable")
+ }
+
+ if ("mso-request-id".equals(variable)) {
+ requestId = (String) value
+ } else if ("mso-service-instance-id".equals(variable)) {
+ serviceInstanceId = (String) value
+ }
+ }
+
+ if (serviceInstanceId == null) {
+ serviceInstanceId = (String) execution.getVariable("mso-service-instance-id")
+ }
+
+ utils.logContext(requestId, serviceInstanceId)
+ logDebug('Incoming message: ' + System.lineSeparator() + request, isDebugLogEnabled)
+ logDebug('Exited ' + method, isDebugLogEnabled)
+ return request
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception e) {
+ logError('Caught exception in ' + method, e)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Invalid Message")
+ }
+ }
+
+ /**
+ * gets vars stored in a JSON object in prefix+Request and returns as a LazyMap
+ * setting log context here too
+ * @param execution the execution
+ * @return the inputVars
+ */
+ public Map validateJSONReq(Execution execution) {
+ def method = getClass().getSimpleName() + '.validateJSONReq(' +
+ 'execution=' + execution.getId() +
+ ')'
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ logDebug('Entered ' + method, isDebugLogEnabled)
+
+ String processKey = getProcessKey(execution);
+ def prefix = execution.getVariable("prefix")
+
+ def requestId =getVariable(execution, "mso-request-id")
+ def serviceInstanceId = getVariable(execution, "mso-service-instance-id")
+ if(requestId!=null && serviceInstanceId!=null){
+ utils.logContext(requestId, serviceInstanceId)
+ }
+
+
+ def request = getVariable(execution, prefix + 'Request')
+
+ if (request == null) {
+ request = getVariable(execution, processKey + 'Request')
+
+ if (request == null) {
+ request = getVariable(execution, 'bpmnRequest')
+ }
+ execution.setVariable(prefix + 'Request', request)
+ }
+
+ def jsonSlurper = new JsonSlurper()
+ def parsed = jsonSlurper.parseText(request)
+
+
+ logDebug('Incoming message: ' + System.lineSeparator() + request, isDebugLogEnabled)
+ logDebug('Exited ' + method, isDebugLogEnabled)
+ return parsed
+
+ }
+
+ /**
+ * Sends a response to the workflow service that invoked the process. This method
+ * may only be used by top-level processes that were directly invoked by the
+ * asynchronous workflow service.
+ * @param execution the execution
+ * @param responseCode the response code
+ * @param content the message content
+ * @throws IllegalArgumentException if the response code is invalid
+ * by HTTP standards
+ * @throws UnsupportedOperationException if not invoked by an asynchronous,
+ * top-level process
+ * @throws IllegalStateException if a response has already been sent
+ */
+ protected void sendWorkflowResponse(Execution execution, Object responseCode, String response) {
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ try {
+ String processKey = getProcessKey(execution);
+
+ // isAsyncProcess is injected by the workflow service that started the flow
+ if (!String.valueOf(execution.getVariable("isAsyncProcess")).equals("true")) {
+ throw new UnsupportedOperationException(processKey + ": " +
+ "sendWorkflowResponse is valid only in asynchronous workflows");
+ }
+
+ if (String.valueOf(execution.getVariable(processKey + "WorkflowResponseSent")).equals("true")) {
+ logDebug("Sync response has already been sent for " + processKey, isDebugLogEnabled)
+ }else{
+
+ logDebug("Building " + processKey + " response ", isDebugLogEnabled)
+
+ int intResponseCode;
+
+ try {
+ intResponseCode = Integer.parseInt(String.valueOf(responseCode));
+
+ if (intResponseCode < 100 || intResponseCode > 599) {
+ throw new NumberFormatException(String.valueOf(responseCode));
+ }
+ } catch (NumberFormatException e) {
+ throw new IllegalArgumentException("Process " + processKey
+ + " provided an invalid HTTP response code: " + responseCode);
+ }
+
+ // Only 2XX responses are considered "Success"
+ String status = (intResponseCode >= 200 && intResponseCode <= 299) ?
+ "Success" : "Fail";
+
+ // TODO: Should deprecate use of processKey+Response variable for the response. Will use "WorkflowResponse" instead
+ execution.setVariable(processKey + "ResponseCode", String.valueOf(intResponseCode))
+ execution.setVariable(processKey + "Response", response);
+ execution.setVariable(processKey + "Status", status);
+ execution.setVariable("WorkflowResponse", response)
+
+ logDebug("Sending response for " + processKey
+ + " ResponseCode=" + intResponseCode
+ + " Status=" + status
+ + " Response=\n" + response,
+ isDebugLogEnabled)
+
+ // TODO: ensure that this flow was invoked asynchronously?
+
+ WorkflowCallbackResponse callbackResponse = new WorkflowCallbackResponse()
+ callbackResponse.setStatusCode(intResponseCode)
+ callbackResponse.setMessage(status)
+ callbackResponse.setResponse(response)
+
+ // TODO: send this data with HTTP POST
+
+ WorkflowContextHolder.getInstance().processCallback(
+ processKey,
+ execution.getProcessInstanceId(),
+ execution.getVariable("mso-request-id"),
+ callbackResponse)
+
+ execution.setVariable(processKey + "WorkflowResponseSent", "true");
+ }
+
+ } catch (Exception ex) {
+ logError("Unable to send workflow response to client ....", ex)
+ }
+ }
+
+ /**
+ * Returns true if a workflow response has already been sent.
+ * @param execution the execution
+ */
+ protected boolean isWorkflowResponseSent(Execution execution) {
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ String processKey = getProcessKey(execution);
+ return String.valueOf(execution.getVariable(processKey + "WorkflowResponseSent")).equals("true");
+ }
+
+ /**
+ * Returns the process definition key (i.e. the process name) of the
+ * current process.
+ *
+ * @param execution the execution
+ */
+ public String getProcessKey(Execution execution) {
+ def testKey = execution.getVariable("testProcessKey")
+ if(testKey!=null){
+ return testKey
+ }
+ return execution.getProcessEngineServices().getRepositoryService()
+ .getProcessDefinition(execution.getProcessDefinitionId()).getKey()
+ }
+
+ /**
+ * Returns the process definition key (i.e. the process name) of the
+ * top-level process.
+ * @param execution the execution
+ */
+ public String getMainProcessKey(Execution execution) {
+ Execution exec = execution
+
+ while (true) {
+ Execution parent = exec.getSuperExecution()
+
+ if (parent == null) {
+ parent = exec.getParent()
+
+ if (parent == null) {
+ break
+ }
+ }
+
+ exec = parent
+ }
+
+ return execution.getProcessEngineServices().getRepositoryService()
+ .getProcessDefinition(exec.getProcessDefinitionId()).getKey()
+ }
+
+ /**
+ * Gets the node for the named element from the given xml. If the element
+ * does not exist in the xml or is empty, a WorkflowException is created
+ * (and as a result, a MSOWorkflowException event is thrown).
+ *
+ * @param execution The flow's execution.
+ * @param xml Xml to search.
+ * @param elementName Name of element to search for.
+ * @return The element node, if found in the xml.
+ */
+ protected String getRequiredNodeXml(Execution execution, String xml, String elementName) {
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+ def element = utils.getNodeXml(xml, elementName, false)
+ if (element.trim().isEmpty()) {
+ def msg = 'Required element \'' + elementName + '\' is missing or empty'
+ logError(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ } else {
+ return element
+ }
+ }
+
+ /**
+ * Gets the value of the named element from the given xml. If the element
+ * does not exist in the xml or is empty, a WorkflowException is created
+ * (and as a result, a MSOWorkflowException event is thrown).
+ *
+ * @param execution The flow's execution.
+ * @param xml Xml to search.
+ * @param elementName Name of element to whose value to get.
+ * @return The non-empty value of the element, if found in the xml.
+ */
+ protected String getRequiredNodeText(Execution execution, String xml, String elementName) {
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+ def elementText = utils.getNodeText1(xml, elementName)
+ if ((elementText == null) || (elementText.isEmpty())) {
+ def msg = 'Required element \'' + elementName + '\' is missing or empty'
+ logError(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ } else {
+ return elementText
+ }
+ }
+
+ /**
+ * Get the text for the specified element from the specified xml. If
+ * the element does not exist, return the specified default value.
+ *
+ * @param xml Xml from which to get the element's text
+ * @param elementName Name of element whose text to get
+ * @param defaultValue the default value
+ * @return the element's text or the default value if the element does not
+ * exist in the given xml
+ */
+ protected String getNodeText(String xml, String elementName, String defaultValue) {
+ def nodeText = utils.getNodeText1(xml, elementName)
+ return (nodeText == null) ? defaultValue : nodeText
+ }
+ /**
+ * Get the text for the specified element from the specified xml. If
+ * the element does not exist, return an empty string.
+ *
+ * @param xml Xml from which to get the element's text.
+ * @param elementName Name of element whose text to get.
+ * @return the element's text or an empty string if the element does not
+ * exist in the given xml.
+ */
+ protected String getNodeTextForce(String xml, String elementName) {
+ return getNodeText(xml, elementName, '');
+ }
+
+ /**
+ *Store the variable as typed with java serialization type
+ *@param execution
+ *@param name
+ *@param value
+ */
+ public void setVariable(Execution execution, String name, Object value) {
+ VariableMap variables = Variables.createVariables()
+ variables.putValueTyped('payload', Variables.objectValue(value)
+ .serializationDataFormat(SerializationDataFormats.JAVA) // tells the engine to use java serialization for persisting the value
+ .create())
+ execution.setVariable(name,variables)
+ }
+
+ //TODO not sure how this will look in Cockpit
+
+ /**
+ * Returns the variable map
+ *@param execution
+ *@param name
+ *@return
+ **/
+ public String getVariable(Execution execution, String name) {
+ def myObj = execution.getVariable(name)
+ if(myObj instanceof VariableMap){
+ VariableMap serializedObjectMap = (VariableMap) myObj
+ ObjectValueImpl payloadObj = serializedObjectMap.getValueTyped('payload')
+ return payloadObj.getValue()
+ }else{
+ return myObj
+ }
+ }
+
+
+ /**
+ * Returns true if a value equals one of the provided set. Equality is
+ * determined by using the equals method if the value object and the
+ * object in the provided set have the same class. Otherwise, the objects
+ * are converted to strings and then compared. Nulls are permitted for
+ * the value as well as in the provided set
+ * Example:
+ * <pre>
+ * def statusCode = getStatusCode()
+ * isOneOf(statusCode, 200, 201, 204)
+ * </pre>
+ * @param value the value to test
+ * @param these a set of permissable values
+ * @return true if the value is in the provided set
+ */
+ public boolean isOneOf(Object value, Object... these) {
+ for (Object thisOne : these) {
+ if (thisOne == null) {
+ if (value == null) {
+ return true
+ }
+ } else {
+ if (value != null) {
+ if (value.getClass() == thisOne.getClass()) {
+ if (value.equals(thisOne)) {
+ return true
+ }
+ } else {
+ if (String.valueOf(value).equals(String.valueOf(thisOne))) {
+ return true
+ }
+ }
+ }
+ }
+ }
+ return false
+ }
+
+ /**
+ * Sets flows success indicator variable.
+ *
+ */
+ public void setSuccessIndicator(Execution execution, boolean isSuccess) {
+ String prefix = execution.getVariable('prefix')
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+
+ logDebug('Entered SetSuccessIndicator Method', isDebugLogEnabled)
+ execution.setVariable(prefix+'SuccessIndicator', isSuccess)
+ logDebug('Outgoing SuccessIndicator is: ' + execution.getVariable(prefix+'SuccessIndicator') + '', isDebugLogEnabled)
+ }
+
+
+ /**
+ * Sends a Error Sync Response
+ *
+ */
+ public void sendSyncError(Execution execution) {
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ String requestId = execution.getVariable("mso-request-id")
+ logDebug('sendSyncError, requestId: ' + requestId, isDebugEnabled)
+ WorkflowException workflowExceptionObj = execution.getVariable("WorkflowException")
+ if (workflowExceptionObj != null) {
+ String errorMessage = workflowExceptionObj.getErrorMessage()
+ def errorCode = workflowExceptionObj.getErrorCode()
+ logDebug('sendSyncError, requestId: ' + requestId + ' | errorMessage: ' + errorMessage + ' | errorCode: ' + errorCode, isDebugEnabled)
+ sendWorkflowResponse(execution, errorCode, errorMessage)
+ }
+ }
+
+ /**
+ * Create a WorkflowException - uses ExceptionUtil to build a WorkflowException
+ * @param execution
+ * @param errorCode
+ * @param errorMessage
+ * @param isDebugEnabled
+ */
+ public void buildWorkflowException(Execution execution, int errorCode, String errorMessage, boolean isDebugEnabled) {
+ (new ExceptionUtil()).buildWorkflowException(execution, errorCode, errorMessage)
+ }
+
+ /**
+ * Executes a named groovy script method in the current object
+ */
+ public void executeMethod(String methodName, Object... args) {
+
+ if (args != null && args.size() > 0) {
+
+ // First argument of method to call is always the execution object
+ Execution execution = (Execution) args[0]
+
+ def classAndMethod = getClass().getSimpleName() + '.' + methodName + '(execution=' + execution.getId() + ')'
+ def isDebugEnabled = execution.getVariable('isDebugLogEnabled')
+
+ logDebug('Entered ' + classAndMethod, isDebugEnabled)
+ logDebug('Received parameters: ' + args, isDebugEnabled)
+
+ try{
+ def methodToCall = this.metaClass.getMetaMethod(methodName, args)
+ logDebug('Method to call: ' + methodToCall, isDebugEnabled)
+ methodToCall?.invoke(this, args)
+ }
+ catch(BpmnError bpmnError) {
+ logDebug('Rethrowing BpmnError ' + bpmnError.getMessage(), isDebugEnabled)
+ throw bpmnError
+ }
+ catch(Exception e) {
+ e.printStackTrace()
+ logDebug('Unexpected error encountered - ' + e.getMessage(), isDebugEnabled)
+ (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, e.getMessage())
+ }
+ finally {
+ logDebug('Exited ' + classAndMethod, isDebugEnabled)
+ }
+ }
+ }
+
+ /**
+ *This method determines and adds the appropriate ending to come
+ *after a number (-st, -nd, -rd, or -th)
+ *
+ *@param int n
+ *
+ *@return String ending - number with suffix
+ */
+ public static String labelMaker(Object n) {
+ Integer num
+ if(n instanceof String){
+ num = Integer.parseInt(n)
+ }else{
+ num = n
+ }
+
+ String ending = ""; //the end to be added to the number
+ if(num != null){
+ if ((num % 10 == 1) && (num != 11)) {
+ ending = num + "st";
+ } else if ((num % 10 == 2) && (num != 12)) {
+ ending = num + "nd";
+ } else if ((num % 10 == 3) && (num != 13)) {
+ ending = num + "rd";
+ } else {
+ ending = num + "th";
+ }
+ }
+ return ending
+ }
+
+ /**
+ *
+ *This method gets and decodes SDNC Response's "RequestData".
+ *
+ *@param response - the sdnc response
+ *
+ *@return data - the response "RequestData" decoded
+ *
+ */
+ public String getRequestDataDecoded(String response){
+ String data = utils.getNodeText1(response, "RequestData")
+ if(data != null){
+ data = data.replaceAll("&lt;", "<")
+ data = data.replaceAll("&gt;", ">")
+ }
+
+ return data
+ }
+
+
+ /**
+ * Constructs a workflow message callback URL for the specified message type and correlator.
+ * @param messageType the message type (e.g. SDNCAResponse or VNFAResponse)
+ * @param correlator the correlator value (e.g. a request ID)
+ */
+ public String createCallbackURL(Execution execution, String messageType, String correlator) {
+ String endpoint = (String) execution.getVariable('URN_mso_workflow_message_endpoint')
+
+ if (endpoint == null || endpoint.isEmpty()) {
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000,
+ 'mso:workflow:message:endpoint URN mapping is not set')
+ }
+
+ while (endpoint.endsWith('/')) {
+ endpoint = endpoint.substring(0, endpoint.length()-1)
+ }
+
+ return endpoint +
+ '/' + UriUtils.encodePathSegment(messageType, 'UTF-8') +
+ '/' + UriUtils.encodePathSegment(correlator, 'UTF-8')
+ }
+} \ No newline at end of file
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CatalogDbUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CatalogDbUtils.groovy
index f74717b510..488535024b 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CatalogDbUtils.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CatalogDbUtils.groovy
@@ -1,550 +1,931 @@
-/*-
- * ============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.common.scripts
-
-import org.json.JSONObject;
-import org.json.JSONArray;
-import org.json.XML;
-import org.springframework.web.util.UriUtils;
-
-import org.openecomp.mso.bpmn.core.json.JsonUtils
-
-
-import groovy.json.JsonBuilder
-import groovy.json.JsonSlurper
-import groovy.util.slurpersupport.GPathResult
-import groovy.xml.QName;
-
-import org.openecomp.mso.logger.MsoLogger;
-import org.openecomp.mso.rest.APIResponse;
-import org.openecomp.mso.rest.RESTClient
-import org.openecomp.mso.rest.RESTConfig
-
-
-/***
- * Utilities for accessing Catalog DB Adapter to retrieve Networks, VNF/VFModules, AllottedResources and complete ServiceResources information
- *
- */
-
-class CatalogDbUtils {
-
- MsoUtils utils = new MsoUtils()
- JsonUtils jsonUtils = new JsonUtils()
- MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
-
- public JSONArray getAllNetworksByServiceModelUuid(String catalogDbEndpoint, String serviceModelUuid) {
- JSONArray networksList = null
- String endPoint = catalogDbEndpoint + "/v1/serviceNetworks?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8")
- try {
- String catalogDbResponse = getResponseFromCatalogDb(endPoint)
-
- if (catalogDbResponse != null) {
- networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks")
- }
-
- }
- catch (Exception e) {
- utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
- }
-
- return networksList
- }
-
- public JSONArray getAllNetworksByServiceModelInvariantUuid(String catalogDbEndpoint, String serviceModelInvariantUuid) {
- JSONArray networksList = null
- String endPoint = catalogDbEndpoint + "/v1/serviceNetworks?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8")
- try {
- String catalogDbResponse = getResponseFromCatalogDb(endPoint)
-
- if (catalogDbResponse != null) {
- networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks")
- }
-
- }
- catch (Exception e) {
- utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
- }
-
- return networksList
- }
-
- public JSONArray getAllNetworksByServiceModelInvariantUuidAndServiceModelVersion(String catalogDbEndpoint, String serviceModelInvariantUuid, String serviceModelVersion) {
- JSONArray networksList = null
- String endPoint = catalogDbEndpoint + "/v1/serviceNetworks?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8")
- try {
- String catalogDbResponse = getResponseFromCatalogDb(endPoint)
-
- if (catalogDbResponse != null) {
- networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks")
- }
-
- }
- catch (Exception e) {
- utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
- }
-
- return networksList
- }
-
- public JSONArray getAllNetworksByNetworkModelCustomizationUuid(String catalogDbEndpoint, String networkModelCustomizationUuid) {
- JSONArray networksList = null
- String endPoint = catalogDbEndpoint + "/v1/serviceNetworks?networkModelCustomizationUuid=" + UriUtils.encode(networkModelCustomizationUuid, "UTF-8")
- try {
- String catalogDbResponse = getResponseFromCatalogDb(endPoint)
-
- if (catalogDbResponse != null) {
- networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks")
- }
-
- }
- catch (Exception e) {
- utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
- }
-
- return networksList
- }
-
- public JSONArray getAllNetworksByNetworkType(String catalogDbEndpoint, String networkType) {
- JSONArray networksList = null
- String endPoint = catalogDbEndpoint + "/v1/serviceNetworks?networkType=" + UriUtils.encode(networkType, "UTF-8")
- try {
- String catalogDbResponse = getResponseFromCatalogDb(endPoint)
-
- if (catalogDbResponse != null) {
- networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks")
- }
-
- }
- catch (Exception e) {
- utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
- }
-
- return networksList
- }
-
-
- public JSONArray getAllVnfsByServiceModelUuid(String catalogDbEndpoint, String serviceModelUuid) {
- JSONArray vnfsList = null
- String endPoint = catalogDbEndpoint + "/v1/serviceVnfs?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8")
- try {
- msoLogger.debug("ENDPOINT: " + endPoint)
- String catalogDbResponse = getResponseFromCatalogDb(endPoint)
-
- if (catalogDbResponse != null) {
- vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs")
- }
-
- }
- catch (Exception e) {
- utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
- }
-
- return vnfsList
- }
-
- public JSONArray getAllVnfsByServiceModelInvariantUuid(String catalogDbEndpoint, String serviceModelInvariantUuid) {
- JSONArray vnfsList = null
- String endPoint = catalogDbEndpoint + "/v1/serviceVnfs?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8")
- try {
- msoLogger.debug("ENDPOINT: " + endPoint)
- String catalogDbResponse = getResponseFromCatalogDb(endPoint)
-
- if (catalogDbResponse != null) {
- vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs")
- }
-
- }
- catch (Exception e) {
- utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
- }
-
- return vnfsList
- }
-
- public JSONArray getAllVnfsByServiceModelInvariantUuidAndServiceModelVersion(String catalogDbEndpoint, String serviceModelInvariantUuid, String serviceModelVersion) {
- JSONArray vnfsList = null
- String endPoint = catalogDbEndpoint + "/v1/serviceVnfs?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8")
- try {
- msoLogger.debug("ENDPOINT: " + endPoint)
- String catalogDbResponse = getResponseFromCatalogDb(endPoint)
-
- if (catalogDbResponse != null) {
- vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs")
- }
-
- }
- catch (Exception e) {
- utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
- }
-
- return vnfsList
- }
-
- public JSONArray getAllVnfsByVnfModelCustomizationUuid(String catalogDbEndpoint, String vnfModelCustomizationUuid) {
- JSONArray vnfsList = null
- String endPoint = catalogDbEndpoint + "/v1/serviceVnfs?vnfModelCustomizationUuid=" + UriUtils.encode(vnfModelCustomizationUuid, "UTF-8")
- try {
- msoLogger.debug("ENDPOINT: " + endPoint)
- String catalogDbResponse = getResponseFromCatalogDb(endPoint)
-
- if (catalogDbResponse != null) {
- vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs")
- }
-
- }
- catch (Exception e) {
- utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
- }
-
- return vnfsList
- }
-
-
- public JSONArray getAllottedResourcesByServiceModelUuid(String catalogDbEndpoint, String serviceModelUuid) {
- JSONArray vnfsList = null
- String endPoint = catalogDbEndpoint + "/v1/ServiceAllottedResources?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8")
- try {
- String catalogDbResponse = getResponseFromCatalogDb(endPoint)
-
- if (catalogDbResponse != null) {
- vnfsList = parseAllottedResourcesJson(catalogDbResponse, "serviceAllottedResources")
- }
-
- }
- catch (Exception e) {
- utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
- }
-
- return vnfsList
- }
-
- public JSONArray getAllottedResourcesByServiceModelInvariantUuid(String catalogDbEndpoint, String serviceModelInvariantUuid) {
- JSONArray vnfsList = null
- String endPoint = catalogDbEndpoint + "/v1/serviceAllottedResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8")
- try {
- String catalogDbResponse = getResponseFromCatalogDb(endPoint)
-
- if (catalogDbResponse != null) {
- vnfsList = parseAllottedResourcesJson(catalogDbResponse, "serviceAllottedResources")
- }
-
- }
- catch (Exception e) {
- utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
- }
-
- return vnfsList
- }
-
- public JSONArray getAllottedResourcesByServiceModelInvariantUuidAndServiceModelVersion(String catalogDbEndpoint, String serviceModelInvariantUuid, String serviceModelVersion) {
- JSONArray vnfsList = null
- String endPoint = catalogDbEndpoint + "/v1/serviceAllottedResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8")
- try {
- String catalogDbResponse = getResponseFromCatalogDb(endPoint)
-
- if (catalogDbResponse != null) {
- vnfsList = parseAllottedResourcesJson(catalogDbResponse, "serviceAllottedResources")
- }
-
- }
- catch (Exception e) {
- utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
- }
-
- return vnfsList
- }
-
- public JSONArray getAllottedResourcesByArModelCustomizationUuid(String catalogDbEndpoint, String arModelCustomizationUuid) {
- JSONArray vnfsList = null
- String endPoint = catalogDbEndpoint + "/v1/serviceAllottedResources?serviceModelCustomizationUuid=" + UriUtils.encode(arModelCustomizationUuid, "UTF-8")
- try {
- String catalogDbResponse = getResponseFromCatalogDb(endPoint)
-
- if (catalogDbResponse != null) {
- vnfsList = parseAllottedResourcesJson(catalogDbResponse, "serviceAllottedResources")
- }
-
- }
- catch (Exception e) {
- utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
- }
-
- return vnfsList
- }
-
- public JSONObject getServiceResourcesByServiceModelInvariantUuid(String catalogDbEndpoint, String serviceModelInvariantUuid) {
- JSONObject resources = null
- String endPoint = catalogDbEndpoint + "/v1/serviceResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8")
- try {
- String catalogDbResponse = getResponseFromCatalogDb(endPoint)
-
- if (catalogDbResponse != null) {
- resources = parseServiceResourcesJson(catalogDbResponse)
- }
-
- }
- catch (Exception e) {
- utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
- }
-
- return resources
- }
-
- public JSONObject getServiceResourcesByServiceModelInvariantUuidAndServiceModelVersion(String catalogDbEndpoint, String serviceModelInvariantUuid, String serviceModelVersion) {
- JSONObject resources = null
- String endPoint = catalogDbEndpoint + "/v1/serviceResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8")
- try {
- String catalogDbResponse = getResponseFromCatalogDb(endPoint)
-
- if (catalogDbResponse != null) {
- resources = parseServiceResourcesJson(catalogDbResponse)
- }
-
- }
- catch (Exception e) {
- utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
- }
-
- return resources
- }
-
-
-
- private JSONArray parseNetworksJson (String catalogDbResponse, String arrayName) {
- JSONArray modelInfos = null
-
- try {
- // Create array of jsons
-
- JSONObject responseJson = new JSONObject(catalogDbResponse)
- JSONArray networks = responseJson.getJSONArray(arrayName)
- modelInfos = new JSONArray()
-
- for (int i = 0; i < networks.length(); i++) {
-
- JSONObject network = networks.getJSONObject(i)
- JSONObject modelInfo = buildModelInfo("network", network)
- JSONObject modelJson = new JSONObject()
- modelJson.put("modelInfo", modelInfo)
- String networkType = jsonUtils.getJsonValueForKey(network, "networkType")
- modelJson.put("networkType", networkType)
- modelInfos.put(modelJson)
- }
-
- String modelInfosString = modelInfos.toString()
- msoLogger.debug("Returning networks JSON: " + modelInfosString)
-
- } catch (Exception e) {
- utils.log("ERROR", "Exception in parsing Catalog DB Response: " + e.message)
- }
-
- return modelInfos
- }
-
- private JSONArray parseVnfsJson (String catalogDbResponse, String arrayName) {
- JSONArray modelInfos = null
-
- try {
- // Create array of jsons
-
- JSONObject responseJson = new JSONObject(catalogDbResponse)
- JSONArray vnfs = responseJson.getJSONArray(arrayName)
- modelInfos = new JSONArray()
-
- for (int i = 0; i < vnfs.length(); i++) {
- JSONObject vnf = vnfs.getJSONObject(i)
-
- msoLogger.debug(vnf.toString(2))
- JSONObject modelInfo = buildModelInfo("vnf", vnf)
- JSONObject modelJson = new JSONObject()
- modelJson.put("modelInfo", modelInfo)
-
- JSONArray vfModules = null
- try {
- vfModules = vnf.getJSONArray("vfModules")
- } catch (Exception e)
- {
- msoLogger.debug("Cannot find VF MODULE ARRAY: " + i + ", exception is " + e.message)
- }
-
- if (vfModules != null) {
- JSONArray vfModuleInfo = new JSONArray()
- for (int j = 0; j < vfModules.length(); j++) {
- JSONObject vfModule = vfModules.getJSONObject(j)
- JSONObject vfModuleModelInfo = buildModelInfo("vfModule", vfModule)
- JSONObject vfModuleModelJson = new JSONObject()
- vfModuleModelJson.put("modelInfo", vfModuleModelInfo)
- String vfModuleType = jsonUtils.getJsonValueForKey(vfModule, "type")
- vfModuleModelJson.put("vfModuleType", vfModuleType)
- Integer isBase = jsonUtils.getJsonIntValueForKey(vfModule, "isBase")
- if (isBase.intValue() == 1) {
- vfModuleModelJson.put("isBase", "true")
- }
- else {
- vfModuleModelJson.put("isBase", "false")
- }
- String vfModuleLabel = jsonUtils.getJsonValueForKey(vfModule, "label")
- vfModuleModelJson.put("vfModuleLabel", vfModuleLabel)
- Integer initialCount = jsonUtils.getJsonIntValueForKey(vfModule, "initialCount")
- vfModuleModelJson.put("initialCount", initialCount.intValue())
- vfModuleInfo.put(vfModuleModelJson)
- }
- modelJson.put("vfModules", vfModuleInfo)
- }
- modelInfos.put(modelJson)
- }
-
- String modelInfosString = modelInfos.toString()
- msoLogger.debug("Returning vnfs JSON: " + modelInfosString)
-
- } catch (Exception e) {
- utils.log("ERROR", "Exception in parsing Catalog DB Response: " + e.message)
- }
-
- return modelInfos
- }
-
- private JSONArray parseAllottedResourcesJson (String catalogDbResponse, String arrayName) {
- JSONArray modelInfos = null
-
- try {
- // Create array of jsons
-
- JSONObject responseJson = new JSONObject(catalogDbResponse)
- JSONArray allottedResources = responseJson.getJSONArray(arrayName)
- modelInfos = new JSONArray()
-
- for (int i = 0; i < allottedResources.length(); i++) {
- JSONObject allottedResource = allottedResources.getJSONObject(i)
- JSONObject modelInfo = buildModelInfo("allottedResource", allottedResource)
- JSONObject modelJson = new JSONObject()
- modelJson.put("modelInfo", modelInfo)
- modelInfos.put(modelJson)
- }
-
- String modelInfosString = modelInfos.toString()
- msoLogger.debug("Returning allottedResources JSON: " + modelInfosString)
-
- } catch (Exception e) {
- utils.log("ERROR", "Exception in parsing Catalog DB Response: " + e.message)
- }
-
- return modelInfos
- }
-
- private JSONObject parseServiceResourcesJson (String catalogDbResponse) {
- JSONObject serviceResources = new JSONObject()
-
- try {
- // Create array of jsons
-
- JSONObject responseJson = new JSONObject(catalogDbResponse)
- JSONObject serviceResourcesRoot = responseJson.getJSONObject("serviceResources")
- JSONArray vnfsArray = parseVnfsJson(serviceResourcesRoot.toString(), "vnfResources")
- serviceResources.put("vnfs", vnfsArray)
- JSONArray networksArray = parseNetworksJson(serviceResourcesRoot.toString(), "networkResourceCustomization")
- serviceResources.put("networks", networksArray)
- JSONArray allottedResourcesArray = parseAllottedResourcesJson(serviceResourcesRoot.toString(), "allottedResourceCustomization")
- serviceResources.put("allottedResources", allottedResourcesArray)
-
- String serviceResourcesString = serviceResources.toString()
- msoLogger.debug("Returning serviceResources JSON: " + serviceResourcesString)
-
- } catch (Exception e) {
- utils.log("ERROR", "Exception in parsing Catalog DB Response: " + e.message)
- }
-
- return serviceResources
- }
-
- private JSONObject buildModelInfo(String modelType, JSONObject modelFromDb) {
- JSONObject modelInfo = null
- try {
- modelInfo = new JSONObject()
- modelInfo.put("modelType", modelType)
- String modelInvariantId = jsonUtils.getJsonValueForKey(modelFromDb, "modelInvariantUuid")
- modelInfo.put("modelInvariantId", modelInvariantId)
- if(modelType.equalsIgnoreCase("allottedResource")){
- String modelInstanceName = jsonUtils.getJsonValueForKey(modelFromDb, "modelInstanceName")
- modelInfo.put("modelInstanceName", modelInstanceName)
- }
- if (!"vfModule".equals(modelType) && !"vnf".equals(modelType)) {
- String modelVersionId = jsonUtils.getJsonValueForKey(modelFromDb, "modelUuid")
- modelInfo.put("modelVersionId", modelVersionId)
- }
- else {
- String modelVersionId = jsonUtils.getJsonValueForKey(modelFromDb, "asdcUuid")
- modelInfo.put("modelVersionId", modelVersionId)
- }
- String modelName = jsonUtils.getJsonValueForKey(modelFromDb, "modelName")
- modelInfo.put("modelName", modelName)
- String modelVersion = jsonUtils.getJsonValueForKey(modelFromDb, "modelVersion")
- modelInfo.put("modelVersion", modelVersion)
- if (!"vfModule".equals(modelType)) {
- String modelCustomizationName = jsonUtils.getJsonValueForKey(modelFromDb, "modelCustomizationName")
- modelInfo.put("modelCustomizationName", modelCustomizationName)
- }
- String modelCustomizationId = jsonUtils.getJsonValueForKey(modelFromDb, "modelCustomizationUuid")
- modelInfo.put("modelCustomizationId", modelCustomizationId)
- JSONObject modelJson = new JSONObject()
- modelJson.put("modelInfo", modelInfo)
- }
- catch (Exception e) {
- utils.log("ERROR", "Exception while parsing model information: " + e.message)
- }
- return modelInfo
- }
-
- private String getResponseFromCatalogDb (String endPoint) {
- try {
- RESTConfig config = new RESTConfig(endPoint);
- def responseData = ''
- def bpmnRequestId = UUID.randomUUID().toString()
- RESTClient client = new RESTClient(config).
- addHeader('X-TransactionId', bpmnRequestId).
- addHeader('X-FromAppId', 'BPMN').
- addHeader('Content-Type', 'application/json').
- addHeader('Accept','application/json');
- msoLogger.debug('sending GET to Catalog DB endpoint' + endPoint)
- APIResponse response = client.httpGet()
-
- responseData = response.getResponseBodyAsString()
- if (responseData != null) {
- msoLogger.debug("Received data from Catalog DB: " + responseData)
- }
-
- msoLogger.debug('Response code:' + response.getStatusCode())
- msoLogger.debug('Response:' + System.lineSeparator() + responseData)
- if (response.getStatusCode() == 200) {
- // parse response as needed
- return responseData
- }
- else {
- return null
- }
- }
- catch (Exception e) {
- msoLogger.debug("ERROR WHILE QUERYING CATALOG DB: " + e.message)
- return null
- }
-
- }
-}
+/*-
+ * ============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.common.scripts
+
+import org.json.JSONObject;
+import org.json.JSONArray;
+import org.json.XML;
+import org.springframework.web.util.UriUtils;
+
+import org.openecomp.mso.bpmn.core.json.JsonUtils
+
+
+import groovy.json.JsonBuilder
+import groovy.json.JsonSlurper
+import groovy.util.slurpersupport.GPathResult
+import groovy.xml.QName;
+
+import org.openecomp.mso.logger.MsoLogger;
+import org.openecomp.mso.rest.APIResponse;
+import org.openecomp.mso.rest.RESTClient
+import org.openecomp.mso.rest.RESTConfig
+
+
+/***
+ * Utilities for accessing Catalog DB Adapter to retrieve Networks, VNF/VFModules, AllottedResources and complete ServiceResources information
+ *
+ */
+
+class CatalogDbUtils {
+
+ MsoUtils utils = new MsoUtils()
+ JsonUtils jsonUtils = new JsonUtils()
+ MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
+ static private String defaultDbAdapterVersion = "v2"
+
+ public JSONArray getAllNetworksByServiceModelUuid(String catalogDbEndpoint, String serviceModelUuid) {
+ JSONArray networksList = null
+ String endPoint = catalogDbEndpoint + "/" + defaultDbAdapterVersion + "/serviceNetworks?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8")
+ try {
+ String catalogDbResponse = getResponseFromCatalogDb(endPoint)
+
+ if (catalogDbResponse != null) {
+ networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", "v1")
+ }
+
+ }
+ catch (Exception e) {
+ utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
+ }
+
+ return networksList
+ }
+
+ public JSONArray getAllNetworksByServiceModelUuid(String catalogDbEndpoint, String serviceModelUuid, String catalogUtilsVersion) {
+ JSONArray networksList = null
+ String endPoint = catalogDbEndpoint + "/" + defaultDbAdapterVersion + "/serviceNetworks?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8")
+ try {
+ String catalogDbResponse = getResponseFromCatalogDb(endPoint)
+
+ if (catalogDbResponse != null) {
+ networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", catalogUtilsVersion)
+
+ }
+
+ }
+ catch (Exception e) {
+ utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
+ }
+
+ return networksList
+ }
+
+ public JSONArray getAllNetworksByServiceModelInvariantUuid(String catalogDbEndpoint, String serviceModelInvariantUuid) {
+ JSONArray networksList = null
+ String endPoint = catalogDbEndpoint + "/" + defaultDbAdapterVersion + "/serviceNetworks?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8")
+ try {
+ String catalogDbResponse = getResponseFromCatalogDb(endPoint)
+
+ if (catalogDbResponse != null) {
+ networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", "v1")
+ }
+
+ }
+ catch (Exception e) {
+ utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
+ }
+
+ return networksList
+ }
+
+ public JSONArray getAllNetworksByServiceModelInvariantUuid(String catalogDbEndpoint, String serviceModelInvariantUuid, String catalogUtilsVersion) {
+ JSONArray networksList = null
+ String endPoint = catalogDbEndpoint + "/" + defaultDbAdapterVersion + "/serviceNetworks?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8")
+
+ try {
+ String catalogDbResponse = getResponseFromCatalogDb(endPoint)
+
+ if (catalogDbResponse != null) {
+ networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", catalogUtilsVersion)
+ }
+
+ }
+ catch (Exception e) {
+ utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
+ }
+
+ return networksList
+ }
+
+ public JSONArray getAllNetworksByServiceModelInvariantUuidAndServiceModelVersion(String catalogDbEndpoint, String serviceModelInvariantUuid, String serviceModelVersion) {
+ JSONArray networksList = null
+ String endPoint = catalogDbEndpoint + "/" + defaultDbAdapterVersion + "/serviceNetworks?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8")
+ try {
+ String catalogDbResponse = getResponseFromCatalogDb(endPoint)
+
+ if (catalogDbResponse != null) {
+ networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", "v1")
+ }
+
+ }
+ catch (Exception e) {
+ utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
+ }
+
+ return networksList
+ }
+
+ public JSONArray getAllNetworksByServiceModelInvariantUuidAndServiceModelVersion(String catalogDbEndpoint, String serviceModelInvariantUuid, String serviceModelVersion, String catalogUtilsVersion) {
+ JSONArray networksList = null
+ String endPoint = catalogDbEndpoint + "/" + defaultDbAdapterVersion + "/serviceNetworks?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8")
+
+ try {
+ String catalogDbResponse = getResponseFromCatalogDb(endPoint)
+
+ if (catalogDbResponse != null) {
+ networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", catalogUtilsVersion)
+ }
+
+ }
+ catch (Exception e) {
+ utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
+ }
+
+ return networksList
+ }
+
+ public JSONArray getAllNetworksByNetworkModelCustomizationUuid(String catalogDbEndpoint, String networkModelCustomizationUuid) {
+ JSONArray networksList = null
+ String endPoint = catalogDbEndpoint + "/" + defaultDbAdapterVersion + "/serviceNetworks?networkModelCustomizationUuid=" + UriUtils.encode(networkModelCustomizationUuid, "UTF-8")
+ try {
+ String catalogDbResponse = getResponseFromCatalogDb(endPoint)
+
+ if (catalogDbResponse != null) {
+ networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", "v1")
+ }
+
+ }
+ catch (Exception e) {
+ utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
+ }
+
+ return networksList
+ }
+
+ public JSONArray getAllNetworksByNetworkModelCustomizationUuid(String catalogDbEndpoint, String networkModelCustomizationUuid, String catalogUtilsVersion) {
+ JSONArray networksList = null
+ String endPoint = catalogDbEndpoint + "/" + defaultDbAdapterVersion + "/serviceNetworks?networkModelCustomizationUuid=" + UriUtils.encode(networkModelCustomizationUuid, "UTF-8")
+
+ try {
+ String catalogDbResponse = getResponseFromCatalogDb(endPoint)
+
+ if (catalogDbResponse != null) {
+ networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", catalogUtilsVersion)
+ }
+
+ }
+ catch (Exception e) {
+ utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
+ }
+
+ return networksList
+ }
+
+ public JSONArray getAllNetworksByNetworkType(String catalogDbEndpoint, String networkType) {
+ JSONArray networksList = null
+ String endPoint = catalogDbEndpoint + "/" + defaultDbAdapterVersion + "/serviceNetworks?networkType=" + UriUtils.encode(networkType, "UTF-8")
+ try {
+ String catalogDbResponse = getResponseFromCatalogDb(endPoint)
+
+ if (catalogDbResponse != null) {
+ networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", "v1")
+ }
+
+ }
+ catch (Exception e) {
+ utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
+ }
+
+ return networksList
+ }
+
+ public JSONArray getAllNetworksByNetworkType(String catalogDbEndpoint, String networkType, String catalogUtilsVersion) {
+ JSONArray networksList = null
+ String endPoint = catalogDbEndpoint + "/" + defaultDbAdapterVersion + "/serviceNetworks?networkType=" + UriUtils.encode(networkType, "UTF-8")
+ try {
+ String catalogDbResponse = getResponseFromCatalogDb(endPoint)
+
+ if (catalogDbResponse != null) {
+ networksList = parseNetworksJson(catalogDbResponse, "serviceNetworks", catalogUtilsVersion)
+
+ }
+
+ }
+ catch (Exception e) {
+ utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
+ }
+
+ return networksList
+ }
+
+
+ public JSONArray getAllVnfsByServiceModelUuid(String catalogDbEndpoint, String serviceModelUuid) {
+ JSONArray vnfsList = null
+ String endPoint = catalogDbEndpoint + "/" + defaultDbAdapterVersion + "/serviceVnfs?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8")
+ try {
+ msoLogger.debug("ENDPOINT: " + endPoint)
+ String catalogDbResponse = getResponseFromCatalogDb(endPoint)
+
+ if (catalogDbResponse != null) {
+ vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs", "v1")
+ }
+
+ }
+ catch (Exception e) {
+ utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
+ }
+
+ return vnfsList
+ }
+
+ public JSONArray getAllVnfsByServiceModelUuid(String catalogDbEndpoint, String serviceModelUuid, String catalogUtilsVersion) {
+ JSONArray vnfsList = null
+ String endPoint = catalogDbEndpoint + "/" + defaultDbAdapterVersion + "/serviceVnfs?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8")
+ try {
+ msoLogger.debug("ENDPOINT: " + endPoint)
+ String catalogDbResponse = getResponseFromCatalogDb(endPoint)
+
+ if (catalogDbResponse != null) {
+ vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs", catalogUtilsVersion)
+
+ }
+
+ }
+ catch (Exception e) {
+ utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
+ }
+
+ return vnfsList
+ }
+
+ public JSONArray getAllVnfsByServiceModelInvariantUuid(String catalogDbEndpoint, String serviceModelInvariantUuid) {
+ JSONArray vnfsList = null
+ String endPoint = catalogDbEndpoint + "/" + defaultDbAdapterVersion + "/serviceVnfs?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8")
+ try {
+ msoLogger.debug("ENDPOINT: " + endPoint)
+ String catalogDbResponse = getResponseFromCatalogDb(endPoint)
+
+ if (catalogDbResponse != null) {
+ vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs", "v1")
+ }
+
+ }
+ catch (Exception e) {
+ utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
+ }
+
+ return vnfsList
+ }
+
+ public JSONArray getAllVnfsByServiceModelInvariantUuid(String catalogDbEndpoint, String serviceModelInvariantUuid, String catalogUtilsVersion) {
+ JSONArray vnfsList = null
+ String endPoint = catalogDbEndpoint + "/" + defaultDbAdapterVersion + "/serviceVnfs?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8")
+ try {
+ msoLogger.debug("ENDPOINT: " + endPoint)
+ String catalogDbResponse = getResponseFromCatalogDb(endPoint)
+
+ if (catalogDbResponse != null) {
+ vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs", catalogUtilsVersion)
+
+ }
+
+ }
+ catch (Exception e) {
+ utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
+ }
+
+ return vnfsList
+ }
+
+ public JSONArray getAllVnfsByServiceModelInvariantUuidAndServiceModelVersion(String catalogDbEndpoint, String serviceModelInvariantUuid, String serviceModelVersion) {
+ JSONArray vnfsList = null
+ String endPoint = catalogDbEndpoint + "/" + defaultDbAdapterVersion + "/serviceVnfs?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8")
+ try {
+ msoLogger.debug("ENDPOINT: " + endPoint)
+ String catalogDbResponse = getResponseFromCatalogDb(endPoint)
+
+ if (catalogDbResponse != null) {
+ vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs", "v1")
+ }
+
+ }
+ catch (Exception e) {
+ utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
+ }
+
+ return vnfsList
+ }
+
+ public JSONArray getAllVnfsByServiceModelInvariantUuidAndServiceModelVersion(String catalogDbEndpoint, String serviceModelInvariantUuid, String serviceModelVersion, String catalogUtilsVersion) {
+ JSONArray vnfsList = null
+ String endPoint = catalogDbEndpoint + "/" + defaultDbAdapterVersion + "/serviceVnfs?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8")
+ try {
+ msoLogger.debug("ENDPOINT: " + endPoint)
+ String catalogDbResponse = getResponseFromCatalogDb(endPoint)
+
+ if (catalogDbResponse != null) {
+ vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs", catalogUtilsVersion)
+
+ }
+
+ }
+ catch (Exception e) {
+ utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
+ }
+
+ return vnfsList
+ }
+
+ public JSONArray getAllVnfsByVnfModelCustomizationUuid(String catalogDbEndpoint, String vnfModelCustomizationUuid) {
+ JSONArray vnfsList = null
+ String endPoint = catalogDbEndpoint + "/" + defaultDbAdapterVersion + "/serviceVnfs?vnfModelCustomizationUuid=" + UriUtils.encode(vnfModelCustomizationUuid, "UTF-8")
+ try {
+ msoLogger.debug("ENDPOINT: " + endPoint)
+ String catalogDbResponse = getResponseFromCatalogDb(endPoint)
+
+ if (catalogDbResponse != null) {
+ vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs", "v1")
+ }
+
+ }
+ catch (Exception e) {
+ utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
+ }
+
+ return vnfsList
+ }
+
+ public JSONArray getAllVnfsByVnfModelCustomizationUuid(String catalogDbEndpoint, String vnfModelCustomizationUuid, String catalogUtilsVersion) {
+ JSONArray vnfsList = null
+ String endPoint = catalogDbEndpoint + "/" + defaultDbAdapterVersion + "/serviceVnfs?vnfModelCustomizationUuid=" + UriUtils.encode(vnfModelCustomizationUuid, "UTF-8")
+ try {
+ msoLogger.debug("ENDPOINT: " + endPoint)
+ String catalogDbResponse = getResponseFromCatalogDb(endPoint)
+
+ if (catalogDbResponse != null) {
+ vnfsList = parseVnfsJson(catalogDbResponse, "serviceVnfs", catalogUtilsVersion)
+
+ }
+
+ }
+ catch (Exception e) {
+ utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
+ }
+
+ return vnfsList
+ }
+
+
+ public JSONArray getAllottedResourcesByServiceModelUuid(String catalogDbEndpoint, String serviceModelUuid) {
+ JSONArray vnfsList = null
+ String endPoint = catalogDbEndpoint + "/" + defaultDbAdapterVersion + "/ServiceAllottedResources?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8")
+ try {
+ String catalogDbResponse = getResponseFromCatalogDb(endPoint)
+
+ if (catalogDbResponse != null) {
+ vnfsList = parseAllottedResourcesJson(catalogDbResponse, "serviceAllottedResources", "v1")
+ }
+
+ }
+ catch (Exception e) {
+ utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
+ }
+
+ return vnfsList
+ }
+
+ public JSONArray getAllottedResourcesByServiceModelUuid(String catalogDbEndpoint, String serviceModelUuid, String catalogUtilsVersion) {
+ JSONArray vnfsList = null
+ String endPoint = catalogDbEndpoint + "/" + defaultDbAdapterVersion + "/ServiceAllottedResources?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8")
+
+ try {
+ String catalogDbResponse = getResponseFromCatalogDb(endPoint)
+
+ if (catalogDbResponse != null) {
+ vnfsList = parseAllottedResourcesJson(catalogDbResponse, "serviceAllottedResources", catalogUtilsVersion)
+ }
+
+ }
+ catch (Exception e) {
+ utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
+ }
+
+ return vnfsList
+ }
+
+ public JSONArray getAllottedResourcesByServiceModelInvariantUuid(String catalogDbEndpoint, String serviceModelInvariantUuid) {
+ JSONArray vnfsList = null
+ String endPoint = catalogDbEndpoint + "/" + defaultDbAdapterVersion + "/serviceAllottedResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8")
+ try {
+ String catalogDbResponse = getResponseFromCatalogDb(endPoint)
+
+ if (catalogDbResponse != null) {
+ vnfsList = parseAllottedResourcesJson(catalogDbResponse, "serviceAllottedResources", "v1")
+ }
+
+ }
+ catch (Exception e) {
+ utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
+ }
+
+ return vnfsList
+ }
+
+ public JSONArray getAllottedResourcesByServiceModelInvariantUuid(String catalogDbEndpoint, String serviceModelInvariantUuid, String catalogUtilsVersion) {
+ JSONArray vnfsList = null
+ String endPoint = catalogDbEndpoint + "/" + defaultDbAdapterVersion + "/serviceAllottedResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8")
+ try {
+ String catalogDbResponse = getResponseFromCatalogDb(endPoint)
+
+ if (catalogDbResponse != null) {
+ vnfsList = parseAllottedResourcesJson(catalogDbResponse, "serviceAllottedResources", catalogUtilsVersion)
+ }
+
+ }
+ catch (Exception e) {
+ utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
+ }
+
+ return vnfsList
+ }
+
+ public JSONArray getAllottedResourcesByServiceModelInvariantUuidAndServiceModelVersion(String catalogDbEndpoint, String serviceModelInvariantUuid, String serviceModelVersion) {
+ JSONArray vnfsList = null
+ String endPoint = catalogDbEndpoint + "/" + defaultDbAdapterVersion + "/serviceAllottedResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8")
+ try {
+ String catalogDbResponse = getResponseFromCatalogDb(endPoint)
+
+ if (catalogDbResponse != null) {
+ vnfsList = parseAllottedResourcesJson(catalogDbResponse, "serviceAllottedResources", "v1")
+ }
+
+ }
+ catch (Exception e) {
+ utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
+ }
+
+ return vnfsList
+ }
+
+ public JSONArray getAllottedResourcesByServiceModelInvariantUuidAndServiceModelVersion(String catalogDbEndpoint, String serviceModelInvariantUuid, String serviceModelVersion, String catalogUtilsVersion) {
+ JSONArray vnfsList = null
+ String endPoint = catalogDbEndpoint + "/" + defaultDbAdapterVersion + "/serviceAllottedResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8")
+
+ try {
+ String catalogDbResponse = getResponseFromCatalogDb(endPoint)
+
+ if (catalogDbResponse != null) {
+ vnfsList = parseAllottedResourcesJson(catalogDbResponse, "serviceAllottedResources", catalogUtilsVersion)
+ }
+
+ }
+ catch (Exception e) {
+ utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
+ }
+
+ return vnfsList
+ }
+
+ public JSONArray getAllottedResourcesByArModelCustomizationUuid(String catalogDbEndpoint, String arModelCustomizationUuid) {
+ JSONArray vnfsList = null
+ String endPoint = catalogDbEndpoint + "/" + defaultDbAdapterVersion + "/serviceAllottedResources?serviceModelCustomizationUuid=" + UriUtils.encode(arModelCustomizationUuid, "UTF-8")
+ try {
+ String catalogDbResponse = getResponseFromCatalogDb(endPoint)
+
+ if (catalogDbResponse != null) {
+ vnfsList = parseAllottedResourcesJson(catalogDbResponse, "serviceAllottedResources", "v1")
+ }
+
+ }
+ catch (Exception e) {
+ utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
+ }
+
+ return vnfsList
+ }
+
+ public JSONArray getAllottedResourcesByArModelCustomizationUuid(String catalogDbEndpoint, String arModelCustomizationUuid, String catalogUtilsVersion) {
+ JSONArray vnfsList = null
+ String endPoint = catalogDbEndpoint + "/" + defaultDbAdapterVersion + "/serviceAllottedResources?serviceModelCustomizationUuid=" + UriUtils.encode(arModelCustomizationUuid, "UTF-8")
+ try {
+ String catalogDbResponse = getResponseFromCatalogDb(endPoint)
+
+ if (catalogDbResponse != null) {
+ vnfsList = parseAllottedResourcesJson(catalogDbResponse, "serviceAllottedResources", catalogUtilsVersion)
+ }
+
+ }
+ catch (Exception e) {
+ utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
+ }
+
+ return vnfsList
+ }
+
+ public JSONObject getServiceResourcesByServiceModelInvariantUuid(String catalogDbEndpoint, String serviceModelInvariantUuid) {
+ JSONObject resources = null
+ String endPoint = catalogDbEndpoint + "/" + defaultDbAdapterVersion + "/serviceResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8")
+
+ try {
+ String catalogDbResponse = getResponseFromCatalogDb(endPoint)
+
+ if (catalogDbResponse != null) {
+ resources = parseServiceResourcesJson(catalogDbResponse, "v1")
+ }
+
+ }
+ catch (Exception e) {
+ utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
+ }
+
+ return resources
+ }
+
+ public JSONObject getServiceResourcesByServiceModelInvariantUuid(String catalogDbEndpoint, String serviceModelInvariantUuid, String catalogUtilsVersion) {
+ JSONObject resources = null
+ String endPoint = catalogDbEndpoint + "/" + defaultDbAdapterVersion + "/serviceResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8")
+ try {
+ String catalogDbResponse = getResponseFromCatalogDb(endPoint)
+
+ if (catalogDbResponse != null) {
+ resources = parseServiceResourcesJson(catalogDbResponse, catalogUtilsVersion)
+ }
+
+ }
+ catch (Exception e) {
+ utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
+ }
+
+ return resources
+ }
+
+
+ public JSONObject getServiceResourcesByServiceModelInvariantUuidAndServiceModelVersion(String catalogDbEndpoint, String serviceModelInvariantUuid, String serviceModelVersion) {
+ JSONObject resources = null
+ String endPoint = catalogDbEndpoint + "/" + defaultDbAdapterVersion + "/serviceResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8")
+ try {
+ String catalogDbResponse = getResponseFromCatalogDb(endPoint)
+
+ if (catalogDbResponse != null) {
+ resources = parseServiceResourcesJson(catalogDbResponse)
+ }
+
+ }
+ catch (Exception e) {
+ utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
+ }
+
+ return resources
+ }
+
+ public JSONObject getServiceResourcesByServiceModelInvariantUuidAndServiceModelVersion(String catalogDbEndpoint, String serviceModelInvariantUuid, String serviceModelVersion, String catalogUtilsVersion) {
+ JSONObject resources = null
+ String endPoint = catalogDbEndpoint + "/" + defaultDbAdapterVersion + "/serviceResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8")
+ try {
+ String catalogDbResponse = getResponseFromCatalogDb(endPoint)
+
+ if (catalogDbResponse != null) {
+ resources = parseServiceResourcesJson(catalogDbResponse, catalogUtilsVersion)
+ }
+
+ }
+ catch (Exception e) {
+ utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
+ }
+
+ return resources
+ }
+
+
+
+ private JSONArray parseNetworksJson (String catalogDbResponse, String arrayName, String catalogUtilsVersion) {
+ JSONArray modelInfos = null
+
+ msoLogger.debug("parseNetworksJson - catalogUtilsVersion is " + catalogUtilsVersion)
+ try {
+ // Create array of jsons
+
+ JSONObject responseJson = new JSONObject(catalogDbResponse)
+ JSONArray networks = responseJson.getJSONArray(arrayName)
+ modelInfos = new JSONArray()
+
+ for (int i = 0; i < networks.length(); i++) {
+
+ JSONObject network = networks.getJSONObject(i)
+ JSONObject modelJson = new JSONObject()
+ JSONObject modelInfo = buildModelInfo("network", network, catalogUtilsVersion)
+ modelJson.put("modelInfo", modelInfo)
+ String networkType = jsonUtils.getJsonValueForKey(network, "networkType")
+ modelJson.put("networkType", networkType)
+
+ switch (catalogUtilsVersion) {
+ case "v1":
+ break
+ default:
+ String toscaNodeType = jsonUtils.getJsonValueForKey(network, "toscaNodeType")
+ modelJson.put("toscaNodeType", toscaNodeType)
+ String networkTechnology = jsonUtils.getJsonValueForKey(network, "networkTechnology")
+ modelJson.put("networkTechnology", networkTechnology)
+ String networkRole = jsonUtils.getJsonValueForKey(network, "networkRole")
+ modelJson.put("networkRole", networkRole)
+ String networkScope = jsonUtils.getJsonValueForKey(network, "networkScope")
+ modelJson.put("networkScope", networkScope)
+ break
+ }
+ modelInfos.put(modelJson)
+ }
+
+ String modelInfosString = modelInfos.toString()
+ msoLogger.debug("Returning networks JSON: " + modelInfosString)
+
+ } catch (Exception e) {
+ utils.log("ERROR", "Exception in parsing Catalog DB Response: " + e.message)
+ }
+
+ return modelInfos
+ }
+
+ private JSONArray parseVnfsJson (String catalogDbResponse, String arrayName, String catalogUtilsVersion) {
+ JSONArray modelInfos = null
+
+ msoLogger.debug("parseVnfsJson - catalogUtilsVersion is " + catalogUtilsVersion)
+
+ try {
+ // Create array of jsons
+
+ JSONObject responseJson = new JSONObject(catalogDbResponse)
+ JSONArray vnfs = responseJson.getJSONArray(arrayName)
+ modelInfos = new JSONArray()
+
+ for (int i = 0; i < vnfs.length(); i++) {
+ JSONObject vnf = vnfs.getJSONObject(i)
+
+ msoLogger.debug(vnf.toString(2))
+ JSONObject modelInfo = buildModelInfo("vnf", vnf, catalogUtilsVersion)
+ JSONObject modelJson = new JSONObject()
+ modelJson.put("modelInfo", modelInfo)
+ switch(catalogUtilsVersion) {
+ case "v1":
+ break
+ default:
+ String toscaNodeType = jsonUtils.getJsonValueForKey(vnf, "toscaNodeType")
+ modelJson.put("toscaNodeType", toscaNodeType)
+ String nfType = jsonUtils.getJsonValueForKey(vnf, "nfType")
+ modelJson.put("nfType", nfType)
+ String nfRole = jsonUtils.getJsonValueForKey(vnf, "nfRole")
+ modelJson.put("nfRole", nfRole)
+ String nfCode = jsonUtils.getJsonValueForKey(vnf, "nfCode")
+ modelJson.put("nfCode", nfCode)
+ break
+ }
+
+ JSONObject vnfJson = vnf.getJSONObject("vnf")
+ JSONArray vfModules = null
+ try {
+ vfModules = vnfJson.getJSONArray("vfModules")
+ } catch (Exception e)
+ {
+ msoLogger.debug("Cannot find VF MODULE ARRAY: " + i + ", exception is " + e.message)
+ }
+
+ if (vfModules != null) {
+ JSONArray vfModuleInfo = new JSONArray()
+ for (int j = 0; j < vfModules.length(); j++) {
+ JSONObject vfModule = vfModules.getJSONObject(j)
+ JSONObject vfModuleModelInfo = buildModelInfo("vfModule", vfModule, catalogUtilsVersion)
+ JSONObject vfModuleModelJson = new JSONObject()
+ vfModuleModelJson.put("modelInfo", vfModuleModelInfo)
+ String vfModuleType = jsonUtils.getJsonValueForKey(vfModule, "type")
+ vfModuleModelJson.put("vfModuleType", vfModuleType)
+ switch(catalogUtilsVersion) {
+ case "v1":
+ Integer isBase = jsonUtils.getJsonIntValueForKey(vfModule, "isBase")
+ if (isBase.intValue() == 1) {
+ vfModuleModelJson.put("isBase", "true")
+ }
+ else {
+ vfModuleModelJson.put("isBase", "false")
+ }
+ break
+ default:
+ boolean isBase = jsonUtils.getJsonBooleanValueForKey(vfModule, "isBase")
+ vfModuleModelJson.put("isBase", isBase)
+ break
+ }
+ String vfModuleLabel = jsonUtils.getJsonValueForKey(vfModule, "label")
+ vfModuleModelJson.put("vfModuleLabel", vfModuleLabel)
+ Integer initialCount = jsonUtils.getJsonIntValueForKey(vfModule, "initialCount")
+ vfModuleModelJson.put("initialCount", initialCount.intValue())
+ vfModuleInfo.put(vfModuleModelJson)
+ }
+ modelJson.put("vfModules", vfModuleInfo)
+ }
+ modelInfos.put(modelJson)
+ }
+
+ String modelInfosString = modelInfos.toString()
+ msoLogger.debug("Returning vnfs JSON: " + modelInfosString)
+
+ } catch (Exception e) {
+ utils.log("ERROR", "Exception in parsing Catalog DB Response: " + e.message)
+ }
+
+ return modelInfos
+ }
+
+ private JSONArray parseAllottedResourcesJson (String catalogDbResponse, String arrayName, String catalogUtilsVersion) {
+ JSONArray modelInfos = null
+
+ msoLogger.debug("parseAllottedResourcesJson - catalogUtilsVersion is " + catalogUtilsVersion)
+
+ try {
+ // Create array of jsons
+
+ JSONObject responseJson = new JSONObject(catalogDbResponse)
+ JSONArray allottedResources = responseJson.getJSONArray(arrayName)
+ modelInfos = new JSONArray()
+
+ for (int i = 0; i < allottedResources.length(); i++) {
+ JSONObject allottedResource = allottedResources.getJSONObject(i)
+ JSONObject modelInfo = buildModelInfo("allottedResource", allottedResource, catalogUtilsVersion)
+ JSONObject modelJson = new JSONObject()
+ modelJson.put("modelInfo", modelInfo)
+ switch(catalogUtilsVersion) {
+ case "v1":
+ break
+ default:
+ String toscaNodeType = jsonUtils.getJsonValueForKey(allottedResource, "toscaNodeType")
+ modelJson.put("toscaNodeType", toscaNodeType)
+ String parentServiceModelUuid = jsonUtils.getJsonValueForKey(allottedResource, "parentServiceModelUuid")
+ modelJson.put("parentServiceModelUuid", parentServiceModelUuid)
+ break
+ }
+
+
+ modelInfos.put(modelJson)
+ }
+
+ String modelInfosString = modelInfos.toString()
+ msoLogger.debug("Returning allottedResources JSON: " + modelInfosString)
+
+ } catch (Exception e) {
+ utils.log("ERROR", "Exception in parsing Catalog DB Response: " + e.message)
+ }
+
+ return modelInfos
+ }
+
+ private JSONObject parseServiceResourcesJson (String catalogDbResponse) {
+ JSONObject serviceResources = new JSONObject()
+ String catalogUtilsVersion = "v1"
+
+ try {
+ // Create array of jsons
+
+ JSONObject responseJson = new JSONObject(catalogDbResponse)
+ JSONObject serviceResourcesRoot = responseJson.getJSONObject("serviceResources")
+ JSONArray vnfsArray = parseVnfsJson(serviceResourcesRoot.toString(), "vnfResources", catalogUtilsVersion)
+ serviceResources.put("vnfs", vnfsArray)
+ JSONArray networksArray = parseNetworksJson(serviceResourcesRoot.toString(), "networkResourceCustomization", catalogUtilsVersion)
+ serviceResources.put("networks", networksArray)
+ JSONArray allottedResourcesArray = parseAllottedResourcesJson(serviceResourcesRoot.toString(), "allottedResourceCustomization", catalogUtilsVersion)
+ serviceResources.put("allottedResources", allottedResourcesArray)
+
+ String serviceResourcesString = serviceResources.toString()
+ msoLogger.debug("Returning serviceResources JSON: " + serviceResourcesString)
+
+ } catch (Exception e) {
+ utils.log("ERROR", "Exception in parsing Catalog DB Response: " + e.message)
+ }
+
+ return serviceResources
+ }
+
+ private JSONObject parseServiceResourcesJson (String catalogDbResponse, String catalogUtilsVersion) {
+ JSONObject serviceResources = new JSONObject()
+ JSONObject serviceResourcesObject = new JSONObject()
+ String serviceResourcesString = ""
+
+ try {
+ // Create array of jsons
+
+ JSONObject responseJson = new JSONObject(catalogDbResponse)
+ JSONObject serviceResourcesRoot = responseJson.getJSONObject("serviceResources")
+ JSONObject modelInfo = buildModelInfo("", serviceResourcesRoot, catalogUtilsVersion)
+ serviceResources.put("modelInfo", modelInfo)
+ JSONArray vnfsArray = parseVnfsJson(serviceResourcesRoot.toString(), "serviceVnfs", catalogUtilsVersion)
+ serviceResources.put("serviceVnfs", vnfsArray)
+ JSONArray networksArray = parseNetworksJson(serviceResourcesRoot.toString(), "serviceNetworks", catalogUtilsVersion)
+ serviceResources.put("serviceNetworks", networksArray)
+ JSONArray allottedResourcesArray = parseAllottedResourcesJson(serviceResourcesRoot.toString(), "serviceAllottedResources", catalogUtilsVersion)
+ serviceResources.put("serviceAllottedResources", allottedResourcesArray)
+ serviceResourcesObject.put("serviceResources", serviceResources)
+
+ serviceResourcesString = serviceResourcesObject.toString()
+ msoLogger.debug("Returning serviceResources JSON: " + serviceResourcesString)
+
+ } catch (Exception e) {
+ utils.log("ERROR", "Exception in parsing Catalog DB Response: " + e.message)
+ }
+
+ return serviceResourcesObject
+ }
+
+ private JSONObject buildModelInfo(String modelType, JSONObject modelFromDb, String catalogUtilsVersion) {
+ JSONObject modelInfo = null
+ try {
+ modelInfo = new JSONObject()
+ modelInfo.put("modelType", modelType)
+ String modelInvariantId = jsonUtils.getJsonValueForKey(modelFromDb, "modelInvariantUuid")
+ modelInfo.put("modelInvariantId", modelInvariantId)
+ if(modelType.equalsIgnoreCase("allottedResource")){
+ String modelInstanceName = jsonUtils.getJsonValueForKey(modelFromDb, "modelInstanceName")
+ modelInfo.put("modelInstanceName", modelInstanceName)
+ }
+ if (!"vfModule".equals(modelType) && !"vnf".equals(modelType)) {
+ String modelVersionId = jsonUtils.getJsonValueForKey(modelFromDb, "modelUuid")
+ modelInfo.put("modelVersionId", modelVersionId)
+ }
+ else {
+ String modelVersionId = jsonUtils.getJsonValueForKey(modelFromDb, "asdcUuid")
+ modelInfo.put("modelVersionId", modelVersionId)
+ }
+ String modelName = jsonUtils.getJsonValueForKey(modelFromDb, "modelName")
+ modelInfo.put("modelName", modelName)
+ String modelVersion = jsonUtils.getJsonValueForKey(modelFromDb, "modelVersion")
+ modelInfo.put("modelVersion", modelVersion)
+ if (!"vfModule".equals(modelType)) {
+ String modelCustomizationName = jsonUtils.getJsonValueForKey(modelFromDb, "modelCustomizationName")
+ modelInfo.put("modelCustomizationName", modelCustomizationName)
+ }
+ String modelCustomizationId = jsonUtils.getJsonValueForKey(modelFromDb, "modelCustomizationUuid")
+ switch (catalogUtilsVersion) {
+ case "v1":
+ modelInfo.put("modelCustomizationId", modelCustomizationId)
+ break
+ default:
+ modelInfo.put("modelCustomizationUuid", modelCustomizationId)
+ break
+ }
+ JSONObject modelJson = new JSONObject()
+ modelJson.put("modelInfo", modelInfo)
+ }
+ catch (Exception e) {
+ utils.log("ERROR", "Exception while parsing model information: " + e.message)
+ }
+ return modelInfo
+ }
+
+ private String getResponseFromCatalogDb (String endPoint) {
+ try {
+ RESTConfig config = new RESTConfig(endPoint);
+ def responseData = ''
+ def bpmnRequestId = UUID.randomUUID().toString()
+ RESTClient client = new RESTClient(config).
+ addHeader('X-TransactionId', bpmnRequestId).
+ addHeader('X-FromAppId', 'BPMN').
+ addHeader('Content-Type', 'application/json').
+ addHeader('Accept','application/json');
+ msoLogger.debug('sending GET to Catalog DB endpoint' + endPoint)
+ APIResponse response = client.httpGet()
+
+ responseData = response.getResponseBodyAsString()
+ if (responseData != null) {
+ msoLogger.debug("Received data from Catalog DB: " + responseData)
+ }
+
+ msoLogger.debug('Response code:' + response.getStatusCode())
+ msoLogger.debug('Response:' + System.lineSeparator() + responseData)
+ if (response.getStatusCode() == 200) {
+ // parse response as needed
+ return responseData
+ }
+ else {
+ return null
+ }
+ }
+ catch (Exception e) {
+ msoLogger.debug("ERROR WHILE QUERYING CATALOG DB: " + e.message)
+ return null
+ }
+
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CompleteMsoProcess.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CompleteMsoProcess.groovy
index e7277b602b..2f9c8d299b 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CompleteMsoProcess.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CompleteMsoProcess.groovy
@@ -1,361 +1,361 @@
-/*-
- * ============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.common.scripts
-
-import org.apache.commons.lang3.*
-import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.runtime.Execution
-
-
-public class CompleteMsoProcess extends AbstractServiceTaskProcessor {
-
- String Prefix="CMSO_"
- ExceptionUtil exceptionUtil = new ExceptionUtil()
-
- // Complete MSO Request processing
- public initializeProcessVariables(Execution execution){
-
- def method = getClass().getSimpleName() + '.initializeProcessVariables(' +'execution=' + execution.getId() +')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
- try {
-
- /* Initialize all the process request variables in this block */
- execution.setVariable("prefix",Prefix)
- execution.setVariable("CMSO_request_id","")
- execution.setVariable("CMSO_notification-url","")
- execution.setVariable("CMSO_mso-bpel-name","")
- execution.setVariable("CMSO_request_action","")
- execution.setVariable("CMSO_notification-url-Ok", false)
- execution.setVariable("CMSO_request_id-Ok", false)
-
- //updateRequest Adapter process variables
- execution.setVariable("CMSO_updateRequestResponse", "")
- execution.setVariable("CMSO_updateRequestResponseCode", "")
- execution.setVariable("CMSO_updateFinalNotifyAckStatusFailedPayload", "")
-
- //Set DB adapter variables here
- execution.setVariable("CMSO_updateDBStatusToSuccessPayload", "")
- execution.setVariable("CMSO_updateInfraRequestDBPayload", "")
- execution.setVariable("CMSO_setUpdateDBstatustoSuccessPayload", "")
-
- //Auth variables
- execution.setVariable("BasicAuthHeaderValue","")
-
- //Response variables
- execution.setVariable("CompletionHandlerResponse","")
- execution.setVariable("CMSO_ErrorResponse", null)
- execution.setVariable("CMSO_ResponseCode", "")
-
- setSuccessIndicator(execution, false)
-
- } catch (BpmnError e) {
- throw e;
- } catch (Exception e) {
- logError('Caught exception in ' + method, e)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method)
- }
-
- }
-
- public void preProcessRequest (Execution execution) {
-
- initializeProcessVariables(execution)
- def method = getClass().getSimpleName() + '.preProcessRequest(' +'execution=' + execution.getId() +')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
-// utils.log("DEBUG", "*** Started CompleteMsoProcess preProcessRequest Method ***", isDebugLogEnabled);
- logDebug('Entered ' + method, isDebugLogEnabled)
- try {
- def xml = execution.getVariable("CompleteMsoProcessRequest")
-
- utils.logAudit("CompleteMsoProcess Request: " + xml)
- utils.log("DEBUG", "Incoming Request is: "+ xml, isDebugLogEnabled)
-
- //mso-bpel-name from the incoming request
- def msoBpelName = utils.getNodeText1(xml,"mso-bpel-name")
- execution.setVariable("CMSO_mso-bpel-name",msoBpelName)
-
- //Check the incoming request type
- //Incoming request can be ACTIVE_REQUESTS (request-information node) or INFRA_ACTIVE_REQUESTS (request-info node)
- if (utils.nodeExists(xml, "request-information")) {
- execution.setVariable("CMSO_request_id-Ok", true) // Incoming request is for ACTIVE_REQUESTS
- }
-
- //Check notification-url for the incoming request type
- //ACTIVE_REQUESTS may have notificationurl node
- //INFRA_ACTIVE_REQUESTS notificationurl node does not exist
- def notificationurl = ""
- if (utils.nodeExists(xml, "notification-url")) {
- notificationurl = utils.getNodeText(xml,"notification-url")
- if(notificationurl != null && !notificationurl.isEmpty()) {
- execution.setVariable("CMSO_notification-url-Ok", true)
- execution.setVariable("CMSO_notification-url",notificationurl)
- }
- }
-
- //Check request_id for the incoming request type
- //For INFRA_ACTIVE_REQUESTS payload request-id IS optional (Not sure why this is option since req id is primary key ... also tried exe through SOAP UI to check if MSO code handles null like auto generated seq not it does not)
- //For ACTIVE_REQUESTS payload request-id is NOT optional
- def request_id = ""
- if (utils.nodeExists(xml, "request-id")) {
- execution.setVariable("CMSO_request_id",utils.getNodeText(xml,"request-id"))
- }
-
-
- // INFRA_ACTIVE_REQUESTS have "action" element ... mandatory
- // ACTIVE_REQUEST have "request-action" ... mandatory
- if (utils.nodeExists(xml, "request-action")) {
- execution.setVariable("CMSO_request_action",utils.getNodeText(xml,"request-action"))
- } else if (utils.nodeExists(xml, "action")) {
- execution.setVariable("CMSO_request_action",utils.getNodeText(xml,"action"))
- }
-
- //Check source for the incoming request type
- //For INFRA_ACTIVE_REQUESTS payload source IS optional
- //For ACTIVE_REQUESTS payload source is NOT optional
- def source = ""
- if (utils.nodeExists(xml, "source")) {
- execution.setVariable("CMSO_source",utils.getNodeText(xml,"source"))
- }
-
- utils.log("DEBUG", "CMSO_notification-url-Ok --> " + execution.getVariable("CMSO_notification-url-Ok"), isDebugLogEnabled)
- utils.log("DEBUG", "CMSO_request_id-Ok --> " + execution.getVariable("CMSO_request_id-Ok"), isDebugLogEnabled)
-
- // set the DHV/Service Instantiation values if specified in the request
- execution.setVariable("CMSO_is_srv_inst_req", String.valueOf("true".equals(utils.getNodeText1(xml, "is-srv-inst-req"))))
- utils.log("DEBUG", "CMSO_is_srv_inst_req --> " + execution.getVariable("CMSO_is_srv_inst_req"), isDebugLogEnabled)
- execution.setVariable("CMSO_is_json_content", String.valueOf("JSON".equals(utils.getNodeText1(xml, "resp-content-type"))))
- utils.log("DEBUG", "CMSO_is_json_content --> " + execution.getVariable("CMSO_is_json_content"), isDebugLogEnabled)
- execution.setVariable("CMSO_service_inst_id", utils.getNodeText1(xml, "service-instance-id"))
- utils.log("DEBUG", "CMSO_service_inst_id --> " + execution.getVariable("CMSO_service_inst_id"), isDebugLogEnabled)
- execution.setVariable("CMSO_start_time", utils.getNodeText1(xml, "start-time"))
- utils.log("DEBUG", "CMSO_start_time --> " + execution.getVariable("CMSO_start_time"), isDebugLogEnabled)
- // this variable is used by the camunda flow to set the Content-Type for the async response
- if (execution.getVariable("CMSO_is_srv_inst_req").equals("true") &&
- execution.getVariable("CMSO_is_json_content").equals("true")) {
- execution.setVariable("CMSO_content_type", "application/json")
- } else {
- execution.setVariable("CMSO_content_type", "text/xml")
- }
-
- logDebug('Exited ' + method, isDebugLogEnabled)
- } catch (BpmnError e) {
- throw e;
- } catch (Exception e) {
- utils.log("DEBUG", "Exception Occured During PreProcessRequest: " + e, isDebugLogEnabled);
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in " + method)
- }
-
-// utils.log("DEBUG", "*** Completed CompleteMsoProcess preProcessRequest Method ***", isDebugLogEnabled);
- }
-
- public void postProcessResponse (Execution execution) {
-
- def method = getClass().getSimpleName() + '.postProcessResponse(' +'execution=' + execution.getId() +')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-// utils.log("DEBUG", "*** Started CompleteMsoProcess PostProcessRequest Method ***", isDebugLogEnabled);
- try {
-
- def msoCompletionResponse = """
- <sdncadapterworkflow:MsoCompletionResponse xmlns:sdncadapterworkflow="http://org.openecomp/mso/workflow/schema/v1">
- <sdncadapterworkflow:out>BPEL ${execution.getVariable("CMSO_mso-bpel-name")} completed</sdncadapterworkflow:out>
- </sdncadapterworkflow:MsoCompletionResponse>
- """.trim()
-
- // Format Response
- def xmlMsoCompletionResponse = utils.formatXML(msoCompletionResponse)
- String buildMsoCompletionResponseAsString = xmlMsoCompletionResponse.drop(38).trim()
- // TODO: Should deprecate use of processKey+Response variable for the response. Will use "WorkflowResponse" instead
- execution.setVariable("WorkflowResponse", buildMsoCompletionResponseAsString)
- utils.logAudit("CompleteMsoProcess Response: " + buildMsoCompletionResponseAsString)
- execution.setVariable("CompleteMsoProcessResponse", buildMsoCompletionResponseAsString)
- execution.setVariable("CMSO_ResponseCode", "200")
-
- setSuccessIndicator(execution, true)
-
- utils.log("DEBUG", "@@ CompleteMsoProcess Response @@ " + "\n" + execution.getVariable("CompleteMsoProcessResponse"), isDebugLogEnabled)
-
- logDebug('Exited ' + method, isDebugLogEnabled)
- } catch (BpmnError e) {
- throw e;
- } catch (Exception e) {
- logError('Caught exception in ' + method, e)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method)
- }
-// utils.log("DEBUG", "*** Completed CompleteMsoProcess PostProcessRequest Method ***", isDebugLogEnabled);
-
- }
-
- public void updateDBStatusToSuccessPayload (Execution execution){
- def method = getClass().getSimpleName() + '.updateDBStatusToSuccessPayload(' +'execution=' + execution.getId() +')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- try {
- // Catalog DB headers Authorization
- String basicAuthValueDB = execution.getVariable("URN_mso_adapters_db_auth")
- utils.log("DEBUG", " Obtained BasicAuth userid password for Catalog DB adapter: " + basicAuthValueDB, isDebugLogEnabled)
-
- def encodedString = utils.getBasicAuth(basicAuthValueDB, execution.getVariable("URN_mso_msoKey"))
- execution.setVariable("BasicAuthHeaderValueDB",encodedString)
- } catch (IOException ex) {
- String dataErrorMessage = " Unable to encode Catalog DB user/password string - " + ex.getMessage()
- utils.log("DEBUG", dataErrorMessage, isDebugLogEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage)
- }
-
- try {
-
- String payload = """
- <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://org.openecomp.mso/requestsdb">
- <soapenv:Header/>
- <soapenv:Body>
- <req:updateStatus>
- <requestId>${execution.getVariable("CMSO_request_id")}</requestId>
- <lastModifiedBy>BPEL</lastModifiedBy>
- <status>COMPLETED</status>
- </req:updateStatus>
- </soapenv:Body>
- </soapenv:Envelope>
- """
- execution.setVariable("CMSO_updateDBStatusToSuccessPayload", payload)
- utils.logAudit("updateDBStatusToSuccessPayload: " + payload)
- logDebug('Exited ' + method, isDebugLogEnabled)
- //println("CMSO_updateDBStatusToSuccessPayload --> " + execution.getVariable("CMSO_updateDBStatusToSuccessPayload"))
-
- } catch (BpmnError e) {
- throw e;
- } catch (Exception e) {
- logError('Caught exception in ' + method, e)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method)
- }
- }
-
- public void setUpdateDBstatustoSuccessPayload (Execution execution){
-
- def method = getClass().getSimpleName() + '.setUpdateDBstatustoSuccessPayload(' +'execution=' + execution.getId() +')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- try {
- String basicAuthValueDB = execution.getVariable("URN_mso_adapters_db_auth")
- utils.log("DEBUG", " Obtained BasicAuth userid password for Catalog DB adapter: " + basicAuthValueDB, isDebugLogEnabled)
-
- def encodedString = utils.getBasicAuth(basicAuthValueDB, execution.getVariable("URN_mso_msoKey"))
- execution.setVariable("BasicAuthHeaderValueDB",encodedString)
- } catch (IOException ex) {
- String dataErrorMessage = " Unable to encode Catalog DB user/password string - " + ex.getMessage()
- utils.log("DEBUG", dataErrorMessage, isDebugLogEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage)
- }
-
- try {
-
- def xml = execution.getVariable("CompleteMsoProcessRequest")
-
- //Get statusMessage if exists
- def statusMessage
- if(utils.nodeExists(xml, "status-message")){
- statusMessage = utils.getNodeText1(xml, "status-message")
- }else{
- statusMessage = "Resource Completed Successfully"
- }
-
- //Get instance Id if exist
- String idXml = ""
- if(utils.nodeExists(xml, "vnfId")){
- idXml = utils.getNodeXml(xml, "vnfId")
- }else if(utils.nodeExists(xml, "networkId")){
- idXml = utils.getNodeXml(xml, "networkId")
- }else if(utils.nodeExists(xml, "serviceInstanceId")){
- idXml = utils.getNodeXml(xml, "serviceInstanceId")
- }else if(utils.nodeExists(xml, "vfModuleId")){
- idXml = utils.getNodeXml(xml, "vfModuleId")
- }else if(utils.nodeExists(xml, "volumeGroupId")){
- idXml = utils.getNodeXml(xml, "volumeGroupId")
- }else{
- idXml = ""
- }
- idXml = utils.removeXmlPreamble(idXml)
- utils.log("DEBUG", "Incoming Instance Id Xml: " + idXml, isDebugLogEnabled)
-
- String payload = """
- <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://org.openecomp.mso/requestsdb">
- <soapenv:Header/>
- <soapenv:Body>
- <req:updateInfraRequest>
- <requestId>${execution.getVariable("CMSO_request_id")}</requestId>
- <lastModifiedBy>${execution.getVariable("CMSO_mso-bpel-name")}</lastModifiedBy>
- <statusMessage>${statusMessage}</statusMessage>
- <requestStatus>COMPLETE</requestStatus>
- <progress>100</progress>
- ${idXml}
- </req:updateInfraRequest>
- </soapenv:Body>
- </soapenv:Envelope>"""
-
- execution.setVariable("CMSO_setUpdateDBstatustoSuccessPayload", payload)
- utils.log("DEBUG", "Outgoing Update Mso Request Payload is: " + payload, isDebugLogEnabled)
- utils.logAudit("setUpdateDBstatustoSuccessPayload: " + payload)
-
- } catch (BpmnError e) {
- throw e;
- } catch (Exception e) {
- logError('Caught exception in ' + method, e)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method)
- }
- logDebug('Exited ' + method, isDebugLogEnabled)
- }
-
- public void buildDataError (Execution execution, String message) {
-
- def method = getClass().getSimpleName() + '.buildDataError(' +'execution=' + execution.getId() +')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
- try {
-
- def msoCompletionResponse = """
- <sdncadapterworkflow:MsoCompletionResponse xmlns:sdncadapterworkflow="http://org.openecomp/mso/workflow/schema/v1">
- <sdncadapterworkflow:out>BPEL ${execution.getVariable("CMSO_mso-bpel-name")} FAILED</sdncadapterworkflow:out>
- </sdncadapterworkflow:MsoCompletionResponse>
- """.trim()
-
- // Format Response
- def xmlMsoCompletionResponse = utils.formatXml(msoCompletionResponse)
- String buildMsoCompletionResponseAsString = xmlMsoCompletionResponse.drop(38).trim()
- utils.logAudit("CompleteMsoProcess Response: " + buildMsoCompletionResponseAsString)
- execution.setVariable("CompleteMsoProcessResponse", buildMsoCompletionResponseAsString)
- utils.log("DEBUG", "@@ CompleteMsoProcess Response @@ " + "\n" + execution.getVariable("CompletionHandlerResponse"), isDebugLogEnabled)
-
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, message)
-
- } catch (BpmnError e) {
- utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugLogEnabled)
- throw e;
- } catch (Exception e) {
- logError('Caught exception in ' + method, e)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method)
- }
-
- }
-
-}
+/*-
+ * ============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.common.scripts
+
+import org.apache.commons.lang3.*
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.runtime.Execution
+
+
+public class CompleteMsoProcess extends AbstractServiceTaskProcessor {
+
+ String Prefix="CMSO_"
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+
+ // Complete MSO Request processing
+ public initializeProcessVariables(Execution execution){
+
+ def method = getClass().getSimpleName() + '.initializeProcessVariables(' +'execution=' + execution.getId() +')'
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ logDebug('Entered ' + method, isDebugLogEnabled)
+ try {
+
+ /* Initialize all the process request variables in this block */
+ execution.setVariable("prefix",Prefix)
+ execution.setVariable("CMSO_request_id","")
+ execution.setVariable("CMSO_notification-url","")
+ execution.setVariable("CMSO_mso-bpel-name","")
+ execution.setVariable("CMSO_request_action","")
+ execution.setVariable("CMSO_notification-url-Ok", false)
+ execution.setVariable("CMSO_request_id-Ok", false)
+
+ //updateRequest Adapter process variables
+ execution.setVariable("CMSO_updateRequestResponse", "")
+ execution.setVariable("CMSO_updateRequestResponseCode", "")
+ execution.setVariable("CMSO_updateFinalNotifyAckStatusFailedPayload", "")
+
+ //Set DB adapter variables here
+ execution.setVariable("CMSO_updateDBStatusToSuccessPayload", "")
+ execution.setVariable("CMSO_updateInfraRequestDBPayload", "")
+ execution.setVariable("CMSO_setUpdateDBstatustoSuccessPayload", "")
+
+ //Auth variables
+ execution.setVariable("BasicAuthHeaderValue","")
+
+ //Response variables
+ execution.setVariable("CompletionHandlerResponse","")
+ execution.setVariable("CMSO_ErrorResponse", null)
+ execution.setVariable("CMSO_ResponseCode", "")
+
+ setSuccessIndicator(execution, false)
+
+ } catch (BpmnError e) {
+ throw e;
+ } catch (Exception e) {
+ logError('Caught exception in ' + method, e)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method)
+ }
+
+ }
+
+ public void preProcessRequest (Execution execution) {
+
+ initializeProcessVariables(execution)
+ def method = getClass().getSimpleName() + '.preProcessRequest(' +'execution=' + execution.getId() +')'
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+// utils.log("DEBUG", "*** Started CompleteMsoProcess preProcessRequest Method ***", isDebugLogEnabled);
+ logDebug('Entered ' + method, isDebugLogEnabled)
+ try {
+ def xml = execution.getVariable("CompleteMsoProcessRequest")
+
+ utils.logAudit("CompleteMsoProcess Request: " + xml)
+ utils.log("DEBUG", "Incoming Request is: "+ xml, isDebugLogEnabled)
+
+ //mso-bpel-name from the incoming request
+ def msoBpelName = utils.getNodeText1(xml,"mso-bpel-name")
+ execution.setVariable("CMSO_mso-bpel-name",msoBpelName)
+
+ //Check the incoming request type
+ //Incoming request can be ACTIVE_REQUESTS (request-information node) or INFRA_ACTIVE_REQUESTS (request-info node)
+ if (utils.nodeExists(xml, "request-information")) {
+ execution.setVariable("CMSO_request_id-Ok", true) // Incoming request is for ACTIVE_REQUESTS
+ }
+
+ //Check notification-url for the incoming request type
+ //ACTIVE_REQUESTS may have notificationurl node
+ //INFRA_ACTIVE_REQUESTS notificationurl node does not exist
+ def notificationurl = ""
+ if (utils.nodeExists(xml, "notification-url")) {
+ notificationurl = utils.getNodeText(xml,"notification-url")
+ if(notificationurl != null && !notificationurl.isEmpty()) {
+ execution.setVariable("CMSO_notification-url-Ok", true)
+ execution.setVariable("CMSO_notification-url",notificationurl)
+ }
+ }
+
+ //Check request_id for the incoming request type
+ //For INFRA_ACTIVE_REQUESTS payload request-id IS optional (Not sure why this is option since req id is primary key ... also tried exe through SOAP UI to check if MSO code handles null like auto generated seq not it does not)
+ //For ACTIVE_REQUESTS payload request-id is NOT optional
+ def request_id = ""
+ if (utils.nodeExists(xml, "request-id")) {
+ execution.setVariable("CMSO_request_id",utils.getNodeText(xml,"request-id"))
+ }
+
+
+ // INFRA_ACTIVE_REQUESTS have "action" element ... mandatory
+ // ACTIVE_REQUEST have "request-action" ... mandatory
+ if (utils.nodeExists(xml, "request-action")) {
+ execution.setVariable("CMSO_request_action",utils.getNodeText(xml,"request-action"))
+ } else if (utils.nodeExists(xml, "action")) {
+ execution.setVariable("CMSO_request_action",utils.getNodeText(xml,"action"))
+ }
+
+ //Check source for the incoming request type
+ //For INFRA_ACTIVE_REQUESTS payload source IS optional
+ //For ACTIVE_REQUESTS payload source is NOT optional
+ def source = ""
+ if (utils.nodeExists(xml, "source")) {
+ execution.setVariable("CMSO_source",utils.getNodeText(xml,"source"))
+ }
+
+ utils.log("DEBUG", "CMSO_notification-url-Ok --> " + execution.getVariable("CMSO_notification-url-Ok"), isDebugLogEnabled)
+ utils.log("DEBUG", "CMSO_request_id-Ok --> " + execution.getVariable("CMSO_request_id-Ok"), isDebugLogEnabled)
+
+ // set the DHV/Service Instantiation values if specified in the request
+ execution.setVariable("CMSO_is_srv_inst_req", String.valueOf("true".equals(utils.getNodeText1(xml, "is-srv-inst-req"))))
+ utils.log("DEBUG", "CMSO_is_srv_inst_req --> " + execution.getVariable("CMSO_is_srv_inst_req"), isDebugLogEnabled)
+ execution.setVariable("CMSO_is_json_content", String.valueOf("JSON".equals(utils.getNodeText1(xml, "resp-content-type"))))
+ utils.log("DEBUG", "CMSO_is_json_content --> " + execution.getVariable("CMSO_is_json_content"), isDebugLogEnabled)
+ execution.setVariable("CMSO_service_inst_id", utils.getNodeText1(xml, "service-instance-id"))
+ utils.log("DEBUG", "CMSO_service_inst_id --> " + execution.getVariable("CMSO_service_inst_id"), isDebugLogEnabled)
+ execution.setVariable("CMSO_start_time", utils.getNodeText1(xml, "start-time"))
+ utils.log("DEBUG", "CMSO_start_time --> " + execution.getVariable("CMSO_start_time"), isDebugLogEnabled)
+ // this variable is used by the camunda flow to set the Content-Type for the async response
+ if (execution.getVariable("CMSO_is_srv_inst_req").equals("true") &&
+ execution.getVariable("CMSO_is_json_content").equals("true")) {
+ execution.setVariable("CMSO_content_type", "application/json")
+ } else {
+ execution.setVariable("CMSO_content_type", "text/xml")
+ }
+
+ logDebug('Exited ' + method, isDebugLogEnabled)
+ } catch (BpmnError e) {
+ throw e;
+ } catch (Exception e) {
+ utils.log("DEBUG", "Exception Occured During PreProcessRequest: " + e, isDebugLogEnabled);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in " + method)
+ }
+
+// utils.log("DEBUG", "*** Completed CompleteMsoProcess preProcessRequest Method ***", isDebugLogEnabled);
+ }
+
+ public void postProcessResponse (Execution execution) {
+
+ def method = getClass().getSimpleName() + '.postProcessResponse(' +'execution=' + execution.getId() +')'
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ logDebug('Entered ' + method, isDebugLogEnabled)
+// utils.log("DEBUG", "*** Started CompleteMsoProcess PostProcessRequest Method ***", isDebugLogEnabled);
+ try {
+
+ def msoCompletionResponse = """
+ <sdncadapterworkflow:MsoCompletionResponse xmlns:sdncadapterworkflow="http://org.openecomp/mso/workflow/schema/v1">
+ <sdncadapterworkflow:out>BPEL ${execution.getVariable("CMSO_mso-bpel-name")} completed</sdncadapterworkflow:out>
+ </sdncadapterworkflow:MsoCompletionResponse>
+ """.trim()
+
+ // Format Response
+ def xmlMsoCompletionResponse = utils.formatXML(msoCompletionResponse)
+ String buildMsoCompletionResponseAsString = xmlMsoCompletionResponse.drop(38).trim()
+ // TODO: Should deprecate use of processKey+Response variable for the response. Will use "WorkflowResponse" instead
+ execution.setVariable("WorkflowResponse", buildMsoCompletionResponseAsString)
+ utils.logAudit("CompleteMsoProcess Response: " + buildMsoCompletionResponseAsString)
+ execution.setVariable("CompleteMsoProcessResponse", buildMsoCompletionResponseAsString)
+ execution.setVariable("CMSO_ResponseCode", "200")
+
+ setSuccessIndicator(execution, true)
+
+ utils.log("DEBUG", "@@ CompleteMsoProcess Response @@ " + "\n" + execution.getVariable("CompleteMsoProcessResponse"), isDebugLogEnabled)
+
+ logDebug('Exited ' + method, isDebugLogEnabled)
+ } catch (BpmnError e) {
+ throw e;
+ } catch (Exception e) {
+ logError('Caught exception in ' + method, e)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method)
+ }
+// utils.log("DEBUG", "*** Completed CompleteMsoProcess PostProcessRequest Method ***", isDebugLogEnabled);
+
+ }
+
+ public void updateDBStatusToSuccessPayload (Execution execution){
+ def method = getClass().getSimpleName() + '.updateDBStatusToSuccessPayload(' +'execution=' + execution.getId() +')'
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ logDebug('Entered ' + method, isDebugLogEnabled)
+
+ try {
+ // Catalog DB headers Authorization
+ String basicAuthValueDB = execution.getVariable("URN_mso_adapters_db_auth")
+ utils.log("DEBUG", " Obtained BasicAuth userid password for Catalog DB adapter: " + basicAuthValueDB, isDebugLogEnabled)
+
+ def encodedString = utils.getBasicAuth(basicAuthValueDB, execution.getVariable("URN_mso_msoKey"))
+ execution.setVariable("BasicAuthHeaderValueDB",encodedString)
+ } catch (IOException ex) {
+ String dataErrorMessage = " Unable to encode Catalog DB user/password string - " + ex.getMessage()
+ utils.log("DEBUG", dataErrorMessage, isDebugLogEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage)
+ }
+
+ try {
+
+ String payload = """
+ <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://org.openecomp.mso/requestsdb">
+ <soapenv:Header/>
+ <soapenv:Body>
+ <req:updateStatus>
+ <requestId>${execution.getVariable("CMSO_request_id")}</requestId>
+ <lastModifiedBy>BPEL</lastModifiedBy>
+ <status>COMPLETED</status>
+ </req:updateStatus>
+ </soapenv:Body>
+ </soapenv:Envelope>
+ """
+ execution.setVariable("CMSO_updateDBStatusToSuccessPayload", payload)
+ utils.logAudit("updateDBStatusToSuccessPayload: " + payload)
+ logDebug('Exited ' + method, isDebugLogEnabled)
+ //println("CMSO_updateDBStatusToSuccessPayload --> " + execution.getVariable("CMSO_updateDBStatusToSuccessPayload"))
+
+ } catch (BpmnError e) {
+ throw e;
+ } catch (Exception e) {
+ logError('Caught exception in ' + method, e)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method)
+ }
+ }
+
+ public void setUpdateDBstatustoSuccessPayload (Execution execution){
+
+ def method = getClass().getSimpleName() + '.setUpdateDBstatustoSuccessPayload(' +'execution=' + execution.getId() +')'
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ logDebug('Entered ' + method, isDebugLogEnabled)
+
+ try {
+ String basicAuthValueDB = execution.getVariable("URN_mso_adapters_db_auth")
+ utils.log("DEBUG", " Obtained BasicAuth userid password for Catalog DB adapter: " + basicAuthValueDB, isDebugLogEnabled)
+
+ def encodedString = utils.getBasicAuth(basicAuthValueDB, execution.getVariable("URN_mso_msoKey"))
+ execution.setVariable("BasicAuthHeaderValueDB",encodedString)
+ } catch (IOException ex) {
+ String dataErrorMessage = " Unable to encode Catalog DB user/password string - " + ex.getMessage()
+ utils.log("DEBUG", dataErrorMessage, isDebugLogEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage)
+ }
+
+ try {
+
+ def xml = execution.getVariable("CompleteMsoProcessRequest")
+
+ //Get statusMessage if exists
+ def statusMessage
+ if(utils.nodeExists(xml, "status-message")){
+ statusMessage = utils.getNodeText1(xml, "status-message")
+ }else{
+ statusMessage = "Resource Completed Successfully"
+ }
+
+ //Get instance Id if exist
+ String idXml = ""
+ if(utils.nodeExists(xml, "vnfId")){
+ idXml = utils.getNodeXml(xml, "vnfId")
+ }else if(utils.nodeExists(xml, "networkId")){
+ idXml = utils.getNodeXml(xml, "networkId")
+ }else if(utils.nodeExists(xml, "serviceInstanceId")){
+ idXml = utils.getNodeXml(xml, "serviceInstanceId")
+ }else if(utils.nodeExists(xml, "vfModuleId")){
+ idXml = utils.getNodeXml(xml, "vfModuleId")
+ }else if(utils.nodeExists(xml, "volumeGroupId")){
+ idXml = utils.getNodeXml(xml, "volumeGroupId")
+ }else{
+ idXml = ""
+ }
+ idXml = utils.removeXmlPreamble(idXml)
+ utils.log("DEBUG", "Incoming Instance Id Xml: " + idXml, isDebugLogEnabled)
+
+ String payload = """
+ <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://org.openecomp.mso/requestsdb">
+ <soapenv:Header/>
+ <soapenv:Body>
+ <req:updateInfraRequest>
+ <requestId>${execution.getVariable("CMSO_request_id")}</requestId>
+ <lastModifiedBy>${execution.getVariable("CMSO_mso-bpel-name")}</lastModifiedBy>
+ <statusMessage>${statusMessage}</statusMessage>
+ <requestStatus>COMPLETE</requestStatus>
+ <progress>100</progress>
+ ${idXml}
+ </req:updateInfraRequest>
+ </soapenv:Body>
+ </soapenv:Envelope>"""
+
+ execution.setVariable("CMSO_setUpdateDBstatustoSuccessPayload", payload)
+ utils.log("DEBUG", "Outgoing Update Mso Request Payload is: " + payload, isDebugLogEnabled)
+ utils.logAudit("setUpdateDBstatustoSuccessPayload: " + payload)
+
+ } catch (BpmnError e) {
+ throw e;
+ } catch (Exception e) {
+ logError('Caught exception in ' + method, e)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method)
+ }
+ logDebug('Exited ' + method, isDebugLogEnabled)
+ }
+
+ public void buildDataError (Execution execution, String message) {
+
+ def method = getClass().getSimpleName() + '.buildDataError(' +'execution=' + execution.getId() +')'
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ logDebug('Entered ' + method, isDebugLogEnabled)
+ try {
+
+ def msoCompletionResponse = """
+ <sdncadapterworkflow:MsoCompletionResponse xmlns:sdncadapterworkflow="http://org.openecomp/mso/workflow/schema/v1">
+ <sdncadapterworkflow:out>BPEL ${execution.getVariable("CMSO_mso-bpel-name")} FAILED</sdncadapterworkflow:out>
+ </sdncadapterworkflow:MsoCompletionResponse>
+ """.trim()
+
+ // Format Response
+ def xmlMsoCompletionResponse = utils.formatXml(msoCompletionResponse)
+ String buildMsoCompletionResponseAsString = xmlMsoCompletionResponse.drop(38).trim()
+ utils.logAudit("CompleteMsoProcess Response: " + buildMsoCompletionResponseAsString)
+ execution.setVariable("CompleteMsoProcessResponse", buildMsoCompletionResponseAsString)
+ utils.log("DEBUG", "@@ CompleteMsoProcess Response @@ " + "\n" + execution.getVariable("CompletionHandlerResponse"), isDebugLogEnabled)
+
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, message)
+
+ } catch (BpmnError e) {
+ utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugLogEnabled)
+ throw e;
+ } catch (Exception e) {
+ logError('Caught exception in ' + method, e)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method)
+ }
+
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ConfirmVolumeGroupName.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ConfirmVolumeGroupName.groovy
index 0a6f251653..ae4a758141 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ConfirmVolumeGroupName.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ConfirmVolumeGroupName.groovy
@@ -1,157 +1,159 @@
-/*-
- * ============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.common.scripts
-import org.camunda.bpm.engine.runtime.Execution
-import org.openecomp.mso.rest.APIResponse
-
-
-public class ConfirmVolumeGroupName extends AbstractServiceTaskProcessor{
-
- def Prefix="CVGN_"
-
- public void initProcessVariables(Execution execution) {
- execution.setVariable("prefix",Prefix)
- execution.setVariable("CVGN_volumeGroupId",null)
- execution.setVariable("CVGN_volumeGroupName",null)
- execution.setVariable("CVGN_aicCloudRegion", null)
- execution.setVariable("CVGN_volumeGroupGetEndpoint",null)
-
- // ConfirmVolumeGroupName workflow response variable placeholders
- execution.setVariable("CVGN_volumeGroupNameMatches", false)
- execution.setVariable("CVGN_queryVolumeGroupResponseCode",null)
- execution.setVariable("CVGN_queryVolumeGroupResponse","")
- execution.setVariable("CVGN_ResponseCode",null)
-// execution.setVariable("CVGN_ErrorResponse","")
- execution.setVariable("RollbackData", null)
- }
-
- // store the incoming data in the flow Execution
- public void preProcessRequest(Execution execution) {
- def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled")
- def volumeGroupId = execution.getVariable("ConfirmVolumeGroupName_volumeGroupId")
- def volumeGroupName= execution.getVariable("ConfirmVolumeGroupName_volumeGroupName")
- def aicCloudRegion = execution.getVariable("ConfirmVolumeGroupName_aicCloudRegion")
-
- initProcessVariables(execution)
- execution.setVariable("CVGN_volumeGroupId", volumeGroupId)
- execution.setVariable("CVGN_volumeGroupName", volumeGroupName)
- execution.setVariable("CVGN_aicCloudRegion", aicCloudRegion)
-
- AaiUtil aaiUriUtil = new AaiUtil(this)
- def aai_uri = aaiUriUtil.getCloudInfrastructureCloudRegionUri(execution)
- logDebug('AAI URI is: ' + aai_uri, isDebugLogEnabled)
- utils.logAudit("AAI URI: " + aai_uri)
- execution.setVariable("CVGN_volumeGroupGetEndpoint","${aai_uri}/${aicCloudRegion}/volume-groups/volume-group/" +
- volumeGroupId)
- }
-
- // send a GET request to AA&I to retrieve the Volume information based on volume-group-id
- // expect a 200 response with the information in the response body or a 404 if the volume group id does not exist
- public void queryAAIForVolumeGroupId(Execution execution) {
- def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled")
- def endPoint = execution.getVariable("URN_aai_endpoint") + execution.getVariable("CVGN_volumeGroupGetEndpoint")
-
- try {
- logDebug("invoking GET call to AAI endpoint :"+System.lineSeparator()+endPoint,isDebugLogEnabled)
- utils.log("DEBUG","queryAAIForVolumeGroupId() endpoint-" + endPoint, isDebugLogEnabled)
- utils.logAudit("ConfirmVolumeGroup sending GET call to AAI Endpoint: " + endPoint)
-
- AaiUtil aaiUtil = new AaiUtil(this)
- APIResponse response = aaiUtil.executeAAIGetCall(execution, endPoint)
- def responseData = response.getResponseBodyAsString()
- def responseStatusCode = response.getStatusCode()
- execution.setVariable("CVGN_queryVolumeGroupResponseCode", responseStatusCode)
- execution.setVariable("CVGN_queryVolumeGroupResponse", responseData)
-
- utils.logAudit("Response code:" + responseStatusCode)
- utils.logAudit("Response:" + responseData)
- logDebug("Response code:" + responseStatusCode, isDebugLogEnabled)
- logDebug("Response:" + System.lineSeparator()+responseData,isDebugLogEnabled)
- } catch (Exception ex) {
- ex.printStackTrace()
- logDebug("Exception occurred while executing AAI GET:" + ex.getMessage(),isDebugLogEnabled)
- execution.setVariable("CVGN_queryVolumeGroupResponseCode", 500)
- execution.setVariable("CVGN_queryVolumeGroupResponse", "AAI GET Failed:" + ex.getMessage())
- }
- }
-
- // process the result from queryAAIVolumeGroupId()
-
- public void checkAAIQueryResult(Execution execution) {
- def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled")
- def result = execution.getVariable("CVGN_queryVolumeGroupResponse")
-
- if (execution.getVariable("CVGN_queryVolumeGroupResponseCode") == 404) {
- logDebug('volumeGroupId does not exist in AAI', isDebugLogEnabled)
- }
- else if (execution.getVariable("CVGN_queryVolumeGroupResponseCode") == 200) {
- logDebug("volumeGroupId exists in AAI", isDebugLogEnabled)
- }
- def xml = execution.getVariable("CVGN_queryVolumeGroupResponse")
- def actualVolumeGroupName = ""
- if (utils.nodeExists(xml, "volume-group-name")) {
- actualVolumeGroupName = utils.getNodeText(xml, "volume-group-name")
- }
- execution.setVariable("CVGN_volumeGroupNameMatches", false)
- def volumeGroupName = execution.getVariable("CVGN_volumeGroupName")
-
- if (volumeGroupName.equals(actualVolumeGroupName)) {
- logDebug('Volume Group Name Matches AAI records', isDebugLogEnabled)
- execution.setVariable("CVGN_volumeGroupNameMatches", true)
- }
- }
-
-
- // generates a WorkflowException if the A&AI query returns a response code other than 200/404
- public void handleAAIQueryFailure(Execution execution) {
- def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled")
-
- logError("Error occurred attempting to query AAI, Response Code " +
- execution.getVariable("CVGN_queryVolumeGroupResponseCode") + ", Error Response " +
- execution.getVariable("CVGN_queryVolumeGroupResponse"))
- //String processKey = getProcessKey(execution);
- //WorkflowException exception = new WorkflowException(processKey, 5000,
- //execution.getVariable("CVGN_queryVolumeGroupResponse"))
- //execution.setVariable("WorkflowException", exception)
- }
-
- // generates a WorkflowException if the volume group name does not match AAI record for this volume group
- public void handleVolumeGroupNameNoMatch(Execution execution) {
- def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled")
-
- def errorNotAssociated = "Error occurred - volume group id " + execution.getVariable("CVGN_volumeGroupId") +
- " is not associated with " + execution.getVariable("CVGN_volumeGroupName")
- logError(errorNotAssociated)
- createWorkflowException(execution, 1002, errorNotAssociated)
- //String processKey = getProcessKey(execution);
- //WorkflowException exception = new WorkflowException(processKey, 1002,
- // errorNotAssociated)
- //execution.setVariable("WorkflowException", exception)
- }
-
- // sends a successful WorkflowResponse
- public void reportSuccess(Execution execution) {
- def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled")
- logDebug("Sending 200 back to the caller", isDebugLogEnabled)
- def responseXML = ""
- execution.setVariable("WorkflowResponse", responseXML)
- }
-}
+/*-
+ * ============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.common.scripts
+import org.camunda.bpm.engine.runtime.Execution
+import org.openecomp.mso.rest.APIResponse
+
+
+public class ConfirmVolumeGroupName extends AbstractServiceTaskProcessor{
+
+ def Prefix="CVGN_"
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+
+ public void initProcessVariables(Execution execution) {
+ execution.setVariable("prefix",Prefix)
+ execution.setVariable("CVGN_volumeGroupId",null)
+ execution.setVariable("CVGN_volumeGroupName",null)
+ execution.setVariable("CVGN_aicCloudRegion", null)
+ execution.setVariable("CVGN_volumeGroupGetEndpoint",null)
+
+ // ConfirmVolumeGroupName workflow response variable placeholders
+ execution.setVariable("CVGN_volumeGroupNameMatches", false)
+ execution.setVariable("CVGN_queryVolumeGroupResponseCode",null)
+ execution.setVariable("CVGN_queryVolumeGroupResponse","")
+ execution.setVariable("CVGN_ResponseCode",null)
+// execution.setVariable("CVGN_ErrorResponse","")
+ execution.setVariable("RollbackData", null)
+ }
+
+ // store the incoming data in the flow Execution
+ public void preProcessRequest(Execution execution) {
+ def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled")
+ def volumeGroupId = execution.getVariable("ConfirmVolumeGroupName_volumeGroupId")
+ def volumeGroupName= execution.getVariable("ConfirmVolumeGroupName_volumeGroupName")
+ def aicCloudRegion = execution.getVariable("ConfirmVolumeGroupName_aicCloudRegion")
+
+ initProcessVariables(execution)
+ execution.setVariable("CVGN_volumeGroupId", volumeGroupId)
+ execution.setVariable("CVGN_volumeGroupName", volumeGroupName)
+ execution.setVariable("CVGN_aicCloudRegion", aicCloudRegion)
+
+ AaiUtil aaiUriUtil = new AaiUtil(this)
+ def aai_uri = aaiUriUtil.getCloudInfrastructureCloudRegionUri(execution)
+ logDebug('AAI URI is: ' + aai_uri, isDebugLogEnabled)
+ utils.logAudit("AAI URI: " + aai_uri)
+ execution.setVariable("CVGN_volumeGroupGetEndpoint","${aai_uri}/${aicCloudRegion}/volume-groups/volume-group/" +
+ volumeGroupId)
+ }
+
+ // send a GET request to AA&I to retrieve the Volume information based on volume-group-id
+ // expect a 200 response with the information in the response body or a 404 if the volume group id does not exist
+ public void queryAAIForVolumeGroupId(Execution execution) {
+ def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled")
+ def endPoint = execution.getVariable("URN_aai_endpoint") + execution.getVariable("CVGN_volumeGroupGetEndpoint")
+
+ try {
+ logDebug("invoking GET call to AAI endpoint :"+System.lineSeparator()+endPoint,isDebugLogEnabled)
+ utils.log("DEBUG","queryAAIForVolumeGroupId() endpoint-" + endPoint, isDebugLogEnabled)
+ utils.logAudit("ConfirmVolumeGroup sending GET call to AAI Endpoint: " + endPoint)
+
+ AaiUtil aaiUtil = new AaiUtil(this)
+ APIResponse response = aaiUtil.executeAAIGetCall(execution, endPoint)
+ def responseData = response.getResponseBodyAsString()
+ def responseStatusCode = response.getStatusCode()
+ execution.setVariable("CVGN_queryVolumeGroupResponseCode", responseStatusCode)
+ execution.setVariable("CVGN_queryVolumeGroupResponse", responseData)
+
+ utils.logAudit("Response code:" + responseStatusCode)
+ utils.logAudit("Response:" + responseData)
+ logDebug("Response code:" + responseStatusCode, isDebugLogEnabled)
+ logDebug("Response:" + System.lineSeparator()+responseData,isDebugLogEnabled)
+ } catch (Exception ex) {
+ // ex.printStackTrace()
+ logDebug("Exception occurred while executing AAI GET:" + ex.getMessage(),isDebugLogEnabled)
+ execution.setVariable("CVGN_queryVolumeGroupResponseCode", 500)
+ execution.setVariable("CVGN_queryVolumeGroupResponse", "AAI GET Failed:" + ex.getMessage())
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, "AAI GET Failed")
+ }
+ }
+
+ // process the result from queryAAIVolumeGroupId()
+
+ public void checkAAIQueryResult(Execution execution) {
+ def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled")
+ def result = execution.getVariable("CVGN_queryVolumeGroupResponse")
+
+ if (execution.getVariable("CVGN_queryVolumeGroupResponseCode") == 404) {
+ logDebug('volumeGroupId does not exist in AAI', isDebugLogEnabled)
+ }
+ else if (execution.getVariable("CVGN_queryVolumeGroupResponseCode") == 200) {
+ logDebug("volumeGroupId exists in AAI", isDebugLogEnabled)
+ }
+ def xml = execution.getVariable("CVGN_queryVolumeGroupResponse")
+ def actualVolumeGroupName = ""
+ if (utils.nodeExists(xml, "volume-group-name")) {
+ actualVolumeGroupName = utils.getNodeText(xml, "volume-group-name")
+ }
+ execution.setVariable("CVGN_volumeGroupNameMatches", false)
+ def volumeGroupName = execution.getVariable("CVGN_volumeGroupName")
+
+ if (volumeGroupName.equals(actualVolumeGroupName)) {
+ logDebug('Volume Group Name Matches AAI records', isDebugLogEnabled)
+ execution.setVariable("CVGN_volumeGroupNameMatches", true)
+ }
+ }
+
+
+ // generates a WorkflowException if the A&AI query returns a response code other than 200/404
+ public void handleAAIQueryFailure(Execution execution) {
+ def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled")
+
+ logError("Error occurred attempting to query AAI, Response Code " +
+ execution.getVariable("CVGN_queryVolumeGroupResponseCode") + ", Error Response " +
+ execution.getVariable("CVGN_queryVolumeGroupResponse"))
+ //String processKey = getProcessKey(execution);
+ //WorkflowException exception = new WorkflowException(processKey, 5000,
+ //execution.getVariable("CVGN_queryVolumeGroupResponse"))
+ //execution.setVariable("WorkflowException", exception)
+ }
+
+ // generates a WorkflowException if the volume group name does not match AAI record for this volume group
+ public void handleVolumeGroupNameNoMatch(Execution execution) {
+ def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled")
+
+ def errorNotAssociated = "Error occurred - volume group id " + execution.getVariable("CVGN_volumeGroupId") +
+ " is not associated with " + execution.getVariable("CVGN_volumeGroupName")
+ logError(errorNotAssociated)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1002, errorNotAssociated)
+ //String processKey = getProcessKey(execution);
+ //WorkflowException exception = new WorkflowException(processKey, 1002,
+ // errorNotAssociated)
+ //execution.setVariable("WorkflowException", exception)
+ }
+
+ // sends a successful WorkflowResponse
+ public void reportSuccess(Execution execution) {
+ def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled")
+ logDebug("Sending 200 back to the caller", isDebugLogEnabled)
+ def responseXML = ""
+ execution.setVariable("WorkflowResponse", responseXML)
+ }
+} \ No newline at end of file
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy
index bca2475a2f..cc26d9fa35 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy
@@ -1,195 +1,193 @@
-/*-
- * ============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.common.scripts
-
-import javax.xml.parsers.DocumentBuilder
-import javax.xml.parsers.DocumentBuilderFactory
-
-import org.apache.commons.lang3.*
-import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.runtime.Execution
-import org.openecomp.mso.bpmn.core.WorkflowException
-import org.openecomp.mso.rest.APIResponse
-import org.w3c.dom.Document
-import org.w3c.dom.Element
-import org.w3c.dom.Node
-import org.w3c.dom.NodeList
-import org.xml.sax.InputSource
-
-
-/**
- * Vnf Module Subflow for confirming the volume group belongs
- * to the tenant
- *
- * @param tenantId
- * @param volumeGroupId
- *
- */
-class ConfirmVolumeGroupTenant extends AbstractServiceTaskProcessor{
-
- String Prefix="CVGT_"
-
- public void preProcessRequest(Execution execution){
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
- execution.setVariable("prefix", Prefix)
- utils.log("DEBUG", " ======== STARTED Confirm Volume Group Tenant Subflow ======== ", isDebugEnabled)
- String processKey = getProcessKey(execution);
- try{
- utils.log("DEBUG", " === Started QueryAAIForVolumeGroup Process === ", isDebugEnabled)
-
- String volumeGroupId = execution.getVariable("volumeGroupId")
- String incomingGroupName = execution.getVariable("volumeGroupName")
- String incomingTenantId = execution.getVariable("tenantId")
- def aicCloudRegion = execution.getVariable("aicCloudRegion")
- String aai = execution.getVariable("URN_aai_endpoint")
-
- AaiUtil aaiUriUtil = new AaiUtil(this)
- def aai_uri = aaiUriUtil.getCloudInfrastructureCloudRegionUri(execution)
- logDebug('AAI URI is: ' + aai_uri, isDebugEnabled)
-
- String path = aai + "${aai_uri}/${aicCloudRegion}/volume-groups/volume-group/" + volumeGroupId
-
- APIResponse queryAAIForVolumeGroupResponse = aaiUriUtil.executeAAIGetCall(execution, path)
-
- def responseCode = queryAAIForVolumeGroupResponse.getStatusCode()
- execution.setVariable("queryVolumeGroupResponseCode", responseCode)
- String response = queryAAIForVolumeGroupResponse.getResponseBodyAsString()
- response = StringEscapeUtils.unescapeXml(response)
-
- utils.logAudit("ConfirmVolumeGroup Response: " + response)
- utils.logAudit("ConfirmVolumeGroup Response Code: " + responseCode)
-
- if(responseCode == 200 && response != null){
- execution.setVariable("queryAAIVolumeGroupResponse", response)
- utils.log("DEBUG", "QueryAAIForVolumeGroup Received a Good REST Response is: \n" + response, isDebugEnabled)
-
- String volumeGroupTenantId = ""
- InputSource source = new InputSource(new StringReader(response));
- DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
- docFactory.setNamespaceAware(true)
- DocumentBuilder docBuilder = docFactory.newDocumentBuilder()
- Document createVCERequestXml = docBuilder.parse(source)
- NodeList nodeList = createVCERequestXml.getElementsByTagNameNS("*", "relationship")
- for (int x = 0; x < nodeList.getLength(); x++) {
- Node node = nodeList.item(x)
- if (node.getNodeType() == Node.ELEMENT_NODE) {
- Element eElement = (Element) node
- String e = eElement.getElementsByTagNameNS("*", "related-to").item(0).getTextContent()
- if(e.equals("tenant")){
- NodeList relationDataList = eElement.getElementsByTagNameNS("*", "relationship-data")
- for (int d = 0; d < relationDataList.getLength(); d++) {
- Node dataNode = relationDataList.item(d)
- if (dataNode.getNodeType() == Node.ELEMENT_NODE) {
- Element dElement = (Element) dataNode
- String key = dElement.getElementsByTagNameNS("*", "relationship-key").item(0).getTextContent()
- if(key.equals("tenant.tenant-id")){
- volumeGroupTenantId = dElement.getElementsByTagNameNS("*", "relationship-value").item(0).getTextContent()
- }
- }
- }
- }
- }
- }
-
- //Determine if Tenant Ids match
- if(incomingTenantId.equals(volumeGroupTenantId)){
- utils.log("DEBUG", "Tenant Ids Match", isDebugEnabled)
- execution.setVariable("tenantIdsMatch", true)
- }else{
- utils.log("DEBUG", "Tenant Ids DO NOT Match", isDebugEnabled)
- execution.setVariable("tenantIdsMatch", false)
- }
-
- //Determine if Volume Group Names match
- String volumeGroupName = utils.getNodeText1(response, "volume-group-name")
- if(incomingGroupName == null || incomingGroupName.length() < 1){
- utils.log("DEBUG", "Incoming Volume Group Name is NOT Provided.", isDebugEnabled)
- execution.setVariable("groupNamesMatch", true)
- }else{
- utils.log("DEBUG", "Incoming Volume Group Name is: " + incomingGroupName, isDebugEnabled)
- if(volumeGroupName.equals(incomingGroupName)){
- utils.log("DEBUG", "Volume Group Names Match.", isDebugEnabled)
- execution.setVariable("groupNamesMatch", true)
- }else{
- utils.log("DEBUG", "Volume Group Names DO NOT Match.", isDebugEnabled)
- execution.setVariable("groupNamesMatch", false)
- }
- }
- }else{
- utils.log("DEBUG", "QueryAAIForVolumeGroup Bad REST Response!", isDebugEnabled)
- WorkflowException exception = new WorkflowException(processKey, 1, "Error Searching AAI for Volume Group. Received a Bad Response.")
- execution.setVariable("WorkflowException", exception)
- throw new BpmnError("MSOWorkflowException")
- }
-
- }catch(Exception e){
- utils.log("ERROR", "Exception Occured Processing queryAAIForVolumeGroup. Exception is:\n" + e, isDebugEnabled)
- throw new BpmnError("MSOWorkflowException")
- }
- utils.log("DEBUG", "=== COMPLETED queryAAIForVolumeGroup Process === ", isDebugEnabled)
- }
-
- public void assignVolumeHeatId(Execution execution){
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
- execution.setVariable("prefix", Prefix)
- try{
- utils.log("DEBUG", " === Started assignVolumeHeatId Process === ", isDebugEnabled)
-
- String response = execution.getVariable("queryAAIVolumeGroupResponse")
- String heatStackId = utils.getNodeText1(response, "heat-stack-id")
- execution.setVariable("volumeHeatStackId", heatStackId)
- execution.setVariable("ConfirmVolumeGroupTenantResponse", heatStackId)
- // TODO: Should deprecate use of processKey+Response variable for the response. Will use "WorkflowResponse" instead
- execution.setVariable("WorkflowResponse", heatStackId)
- utils.log("DEBUG", "Volume Heat Stack Id is: " + heatStackId, isDebugEnabled)
-
- }catch(Exception e){
- utils.log("ERROR", "Exception Occured Processing assignVolumeHeatId. Exception is:\n" + e, isDebugEnabled)
- throw new BpmnError("MSOWorkflowException")
- }
- utils.log("DEBUG", "=== COMPLETED assignVolumeHeatId Process === ", isDebugEnabled)
- utils.log("DEBUG", "======== COMPLETED Confirm Volume Group Tenant Subflow ======== ", isDebugEnabled)
-}
-
- public void assignWorkflowException(Execution execution, String message){
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
- execution.setVariable("prefix", Prefix)
- String processKey = getProcessKey(execution);
- utils.log("DEBUG", " === STARTED Assign Workflow Exception === ", isDebugEnabled)
- try{
- String volumeGroupId = execution.getVariable("volumeGroupId")
- int errorCode = 1
- String errorMessage = "Volume Group " + volumeGroupId + " " + message
-
- WorkflowException exception = new WorkflowException(processKey, errorCode, errorMessage)
- execution.setVariable("WorkflowException", exception)
- execution.setVariable("CVGT_ErrorResponse", "") // Setting for Unit Testing Purposes
-
- }catch(Exception e){
- utils.log("ERROR", "Exception Occured Processing assignWorkflowException. Exception is:\n" + e, isDebugEnabled)
- }
- utils.log("DEBUG", "=== COMPLETED Assign Workflow Exception ==== ", isDebugEnabled)
- }
-
-
-
-}
-
+/*-
+ * ============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.common.scripts
+
+import javax.xml.parsers.DocumentBuilder
+import javax.xml.parsers.DocumentBuilderFactory
+
+import org.apache.commons.lang3.*
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.runtime.Execution
+import org.openecomp.mso.bpmn.core.WorkflowException
+import org.openecomp.mso.rest.APIResponse
+import org.w3c.dom.Document
+import org.w3c.dom.Element
+import org.w3c.dom.Node
+import org.w3c.dom.NodeList
+import org.xml.sax.InputSource
+
+
+/**
+ * Vnf Module Subflow for confirming the volume group belongs
+ * to the tenant
+ *
+ * @param tenantId
+ * @param volumeGroupId
+ *
+ */
+class ConfirmVolumeGroupTenant extends AbstractServiceTaskProcessor{
+
+ String Prefix="CVGT_"
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+
+ public void preProcessRequest(Execution execution){
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ execution.setVariable("prefix", Prefix)
+ utils.log("DEBUG", " ======== STARTED Confirm Volume Group Tenant Subflow ======== ", isDebugEnabled)
+ String processKey = getProcessKey(execution);
+ try{
+ utils.log("DEBUG", " === Started QueryAAIForVolumeGroup Process === ", isDebugEnabled)
+
+ String volumeGroupId = execution.getVariable("volumeGroupId")
+ String incomingGroupName = execution.getVariable("volumeGroupName")
+ String incomingTenantId = execution.getVariable("tenantId")
+ def aicCloudRegion = execution.getVariable("aicCloudRegion")
+ String aai = execution.getVariable("URN_aai_endpoint")
+
+ AaiUtil aaiUriUtil = new AaiUtil(this)
+ def aai_uri = aaiUriUtil.getCloudInfrastructureCloudRegionUri(execution)
+ logDebug('AAI URI is: ' + aai_uri, isDebugEnabled)
+
+ String path = aai + "${aai_uri}/${aicCloudRegion}/volume-groups/volume-group/" + volumeGroupId
+
+ APIResponse queryAAIForVolumeGroupResponse = aaiUriUtil.executeAAIGetCall(execution, path)
+
+ def responseCode = queryAAIForVolumeGroupResponse.getStatusCode()
+ execution.setVariable("queryVolumeGroupResponseCode", responseCode)
+ String response = queryAAIForVolumeGroupResponse.getResponseBodyAsString()
+ response = StringEscapeUtils.unescapeXml(response)
+
+ utils.logAudit("ConfirmVolumeGroup Response: " + response)
+ utils.logAudit("ConfirmVolumeGroup Response Code: " + responseCode)
+
+ if(responseCode == 200 && response != null){
+ execution.setVariable("queryAAIVolumeGroupResponse", response)
+ utils.log("DEBUG", "QueryAAIForVolumeGroup Received a Good REST Response is: \n" + response, isDebugEnabled)
+
+ String volumeGroupTenantId = ""
+ InputSource source = new InputSource(new StringReader(response));
+ DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
+ docFactory.setNamespaceAware(true)
+ DocumentBuilder docBuilder = docFactory.newDocumentBuilder()
+ Document createVCERequestXml = docBuilder.parse(source)
+ NodeList nodeList = createVCERequestXml.getElementsByTagNameNS("*", "relationship")
+ for (int x = 0; x < nodeList.getLength(); x++) {
+ Node node = nodeList.item(x)
+ if (node.getNodeType() == Node.ELEMENT_NODE) {
+ Element eElement = (Element) node
+ String e = eElement.getElementsByTagNameNS("*", "related-to").item(0).getTextContent()
+ if(e.equals("tenant")){
+ NodeList relationDataList = eElement.getElementsByTagNameNS("*", "relationship-data")
+ for (int d = 0; d < relationDataList.getLength(); d++) {
+ Node dataNode = relationDataList.item(d)
+ if (dataNode.getNodeType() == Node.ELEMENT_NODE) {
+ Element dElement = (Element) dataNode
+ String key = dElement.getElementsByTagNameNS("*", "relationship-key").item(0).getTextContent()
+ if(key.equals("tenant.tenant-id")){
+ volumeGroupTenantId = dElement.getElementsByTagNameNS("*", "relationship-value").item(0).getTextContent()
+ }
+ }
+ }
+ }
+ }
+ }
+
+ //Determine if Tenant Ids match
+ if(incomingTenantId.equals(volumeGroupTenantId)){
+ utils.log("DEBUG", "Tenant Ids Match", isDebugEnabled)
+ execution.setVariable("tenantIdsMatch", true)
+ }else{
+ utils.log("DEBUG", "Tenant Ids DO NOT Match", isDebugEnabled)
+ execution.setVariable("tenantIdsMatch", false)
+ }
+
+ //Determine if Volume Group Names match
+ String volumeGroupName = utils.getNodeText1(response, "volume-group-name")
+ if(incomingGroupName == null || incomingGroupName.length() < 1){
+ utils.log("DEBUG", "Incoming Volume Group Name is NOT Provided.", isDebugEnabled)
+ execution.setVariable("groupNamesMatch", true)
+ }else{
+ utils.log("DEBUG", "Incoming Volume Group Name is: " + incomingGroupName, isDebugEnabled)
+ if(volumeGroupName.equals(incomingGroupName)){
+ utils.log("DEBUG", "Volume Group Names Match.", isDebugEnabled)
+ execution.setVariable("groupNamesMatch", true)
+ }else{
+ utils.log("DEBUG", "Volume Group Names DO NOT Match.", isDebugEnabled)
+ execution.setVariable("groupNamesMatch", false)
+ }
+ }
+ }else{
+ utils.log("DEBUG", "QueryAAIForVolumeGroup Bad REST Response!", isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1, "Error Searching AAI for Volume Group. Received a Bad Response.")
+ }
+
+ }catch(BpmnError b){
+ throw b
+ }catch(Exception e){
+ utils.log("ERROR", "Exception Occured Processing queryAAIForVolumeGroup. Exception is:\n" + e, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured in preProcessRequest.")
+ }
+ utils.log("DEBUG", "=== COMPLETED queryAAIForVolumeGroup Process === ", isDebugEnabled)
+ }
+
+ public void assignVolumeHeatId(Execution execution){
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ execution.setVariable("prefix", Prefix)
+ try{
+ utils.log("DEBUG", " === Started assignVolumeHeatId Process === ", isDebugEnabled)
+
+ String response = execution.getVariable("queryAAIVolumeGroupResponse")
+ String heatStackId = utils.getNodeText1(response, "heat-stack-id")
+ execution.setVariable("volumeHeatStackId", heatStackId)
+ execution.setVariable("ConfirmVolumeGroupTenantResponse", heatStackId)
+ // TODO: Should deprecate use of processKey+Response variable for the response. Will use "WorkflowResponse" instead
+ execution.setVariable("WorkflowResponse", heatStackId)
+ utils.log("DEBUG", "Volume Heat Stack Id is: " + heatStackId, isDebugEnabled)
+
+ }catch(Exception e){
+ utils.log("ERROR", "Exception Occured Processing assignVolumeHeatId. Exception is:\n" + e, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured in assignVolumeHeatId.")
+ }
+ utils.log("DEBUG", "=== COMPLETED assignVolumeHeatId Process === ", isDebugEnabled)
+ utils.log("DEBUG", "======== COMPLETED Confirm Volume Group Tenant Subflow ======== ", isDebugEnabled)
+}
+
+ public void assignWorkflowException(Execution execution, String message){
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ execution.setVariable("prefix", Prefix)
+ String processKey = getProcessKey(execution);
+ utils.log("DEBUG", " === STARTED Assign Workflow Exception === ", isDebugEnabled)
+ try{
+ String volumeGroupId = execution.getVariable("volumeGroupId")
+ int errorCode = 1
+ String errorMessage = "Volume Group " + volumeGroupId + " " + message
+
+ exceptionUtil.buildWorkflowException(execution, errorCode, errorMessage)
+ }catch(Exception e){
+ utils.log("ERROR", "Exception Occured Processing assignWorkflowException. Exception is:\n" + e, isDebugEnabled)
+ }
+ utils.log("DEBUG", "=== COMPLETED Assign Workflow Exception ==== ", isDebugEnabled)
+ }
+
+
+
+}
+
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CreateAAIVfModule.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CreateAAIVfModule.groovy
index 39383609c8..986111ccda 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CreateAAIVfModule.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CreateAAIVfModule.groovy
@@ -1,619 +1,624 @@
-/*-
- * ============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.common.scripts
-import org.camunda.bpm.engine.runtime.Execution
-import org.openecomp.mso.bpmn.core.RollbackData
-import org.openecomp.mso.bpmn.core.WorkflowException
-import org.openecomp.mso.rest.APIResponse
-import org.springframework.web.util.UriUtils
-
-
-public class CreateAAIVfModule extends AbstractServiceTaskProcessor{
-
- def Prefix="CAAIVfMod_"
-
- public void initProcessVariables(Execution execution) {
- execution.setVariable("prefix",Prefix)
- execution.setVariable("CAAIVfMod_vnfId",null)
- execution.setVariable("CAAIVfMod_vnfName",null)
- execution.setVariable("CAAIVfMod_vnfType",null)
- execution.setVariable("CAAIVfMod_serviceId",null)
- execution.setVariable("CAAIVfMod_personaId",null)
- execution.setVariable("CAAIVfMod_personaVer",null)
- execution.setVariable("CAAIVfMod_modelCustomizationId",null)
- execution.setVariable("CAAIVfMod_vnfPersonaId",null)
- execution.setVariable("CAAIVfMod_vnfPersonaVer",null)
- execution.setVariable("CAAIVfMod_isBaseVfModule", false)
- execution.setVariable("CAAIVfMod_moduleName",null)
- execution.setVariable("CAAIVfMod_moduleModelName",null)
- execution.setVariable("CAAIVfMod_newGenericVnf",false)
- execution.setVariable("CAAIVfMod_genericVnfGetEndpoint",null)
- execution.setVariable("CAAIVfMod_genericVnfPutEndpoint",null)
- execution.setVariable("CAAIVfMod_aaiNamespace",null)
- execution.setVariable("CAAIVfMod_moduleExists",false)
- execution.setVariable("CAAIVfMod_baseModuleConflict", false)
- execution.setVariable("CAAIVfMod_vnfNameFromAAI", null)
-
-
- // CreateAAIVfModule workflow response variable placeholders
- execution.setVariable("CAAIVfMod_queryGenericVnfResponseCode",null)
- execution.setVariable("CAAIVfMod_queryGenericVnfResponse","")
- execution.setVariable("CAAIVfMod_createGenericVnfResponseCode",null)
- execution.setVariable("CAAIVfMod_createGenericVnfResponse","")
- execution.setVariable("CAAIVfMod_createVfModuleResponseCode",null)
- execution.setVariable("CAAIVfMod_createVfModuleResponse","")
- execution.setVariable("CAAIVfMod_parseModuleResponse","")
- execution.setVariable("CAAIVfMod_deleteGenericVnfResponseCode",null)
- execution.setVariable("CAAIVfMod_deleteGenericVnfResponse","")
- execution.setVariable("CAAIVfMod_deleteVfModuleResponseCode",null)
- execution.setVariable("CAAIVfMod_deleteVfModuleResponse","")
-// execution.setVariable("CAAIVfMod_ResponseCode",null)
-// execution.setVariable("CAAIVfMod_ErrorResponse","")
- execution.setVariable("CreateAAIVfModuleResponse","")
- execution.setVariable("RollbackData", null)
-
- }
-
- // parse the incoming CREATE_VF_MODULE request and store the Generic VNF
- // and VF Module data in the flow Execution
- public void preProcessRequest(Execution execution) {
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- initProcessVariables(execution)
-
- def vnfId = execution.getVariable("vnfId")
- if (vnfId == null || vnfId.isEmpty()) {
- execution.setVariable("CAAIVfMod_newGenericVnf", true)
- execution.setVariable("CAAIVfMod_vnfId","")
- }
- else {
- execution.setVariable("CAAIVfMod_vnfId",vnfId)
- }
-
- def vnfName = execution.getVariable("vnfName")
- execution.setVariable("CAAIVfMod_vnfName", vnfName)
-
- String vnfType = execution.getVariable("vnfType")
- if (vnfType != null && !vnfType.isEmpty()) {
- execution.setVariable("CAAIVfMod_vnfType", vnfType)
- } else {
- execution.setVariable("CAAIVfMod_vnfType","")
- }
-
- execution.setVariable("CAAIVfMod_serviceId", execution.getVariable("serviceId"))
-
- String personaModelId = execution.getVariable("personaModelId")
-
- if (personaModelId != null && !personaModelId.isEmpty()) {
- execution.setVariable("CAAIVfMod_personaId",personaModelId)
- } else {
- execution.setVariable("CAAIVfMod_personaId","")
- }
-
- String personaModelVersion = execution.getVariable("personaModelVersion")
-
- if (personaModelVersion != null && !personaModelVersion.isEmpty()) {
- execution.setVariable("CAAIVfMod_personaVer", personaModelVersion)
- } else {
- execution.setVariable("CAAIVfMod_personaVer","")
- }
-
-
- String modelCustomizationId = execution.getVariable("modelCustomizationId")
-
- if (modelCustomizationId != null && !modelCustomizationId.isEmpty()) {
- execution.setVariable("CAAIVfMod_modelCustomizationId",modelCustomizationId)
- } else {
- execution.setVariable("CAAIVfMod_modelCustomizationId","")
- }
-
- String vnfPersonaModelId = execution.getVariable("vnfPersonaModelId")
-
- if (vnfPersonaModelId != null && !vnfPersonaModelId.isEmpty()) {
- execution.setVariable("CAAIVfMod_vnfPersonaId",vnfPersonaModelId)
- } else {
- execution.setVariable("CAAIVfMod_vnfPersonaId","")
- }
-
- String vnfPersonaModelVersion = execution.getVariable("vnfPersonaModelVersion")
-
- if (vnfPersonaModelVersion != null && !vnfPersonaModelVersion.isEmpty()) {
- execution.setVariable("CAAIVfMod_vnfPersonaVer",vnfPersonaModelVersion)
- } else {
- execution.setVariable("CAAIVfMod_vnfPersonaVer","")
- }
-
- //isBaseVfModule
- Boolean isBaseVfModule = false
- String isBaseVfModuleString = execution.getVariable("isBaseVfModule")
- if (isBaseVfModuleString != null && isBaseVfModuleString.equals("true")) {
- isBaseVfModule = true
- }
- execution.setVariable("CAAIVfMod_isBaseVfModule", isBaseVfModule)
-
- String isVidRequest = execution.getVariable("isVidRequest")
- if (isVidRequest != null && "true".equals(isVidRequest)) {
- logDebug("VID Request received", isDebugEnabled)
- }
-
- execution.setVariable("CAAIVfMod_moduleName",execution.getVariable("vfModuleName"))
- execution.setVariable("CAAIVfMod_moduleModelName",execution.getVariable("vfModuleModelName"))
-
- AaiUtil aaiUriUtil = new AaiUtil(this)
- def aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution)
- logDebug('AAI URI is: ' + aai_uri, isDebugEnabled)
- String aaiNamespace = aaiUriUtil.getNamespaceFromUri(aai_uri)
- logDebug('AAI namespace is: ' + aaiNamespace, isDebugEnabled)
-
- execution.setVariable("CAAIVfMod_aaiNamespace","${aaiNamespace}")
-
- if (vnfId == null || vnfId.isEmpty()) {
- // TBD - assert that the vnfName is not empty
- execution.setVariable("CAAIVfMod_genericVnfGetEndpoint",
- "${aai_uri}/?vnf-name=" +
- UriUtils.encode(vnfName,"UTF-8") + "&depth=1")
- } else {
- execution.setVariable("CAAIVfMod_genericVnfGetEndpoint",
- "${aai_uri}/" + UriUtils.encode(vnfId,"UTF-8") + "?depth=1")
- }
-
- utils.logAudit("CreateAAIVfModule VNF PUT Endpoint: ${aai_uri}/")
- execution.setVariable("CAAIVfMod_genericVnfPutEndpoint","${aai_uri}/")
- }
-
- // send a GET request to AA&I to retrieve the Generic VNF/VF Module information based on a Vnf Name
- // expect a 200 response with the information in the response body or a 404 if the Generic VNF does not exist
- public void queryAAIForGenericVnf(Execution execution) {
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- def endPoint = execution.getVariable("URN_aai_endpoint") + execution.getVariable("CAAIVfMod_genericVnfGetEndpoint")
-
- try {
- utils.log("DEBUG","queryAAIForGenericVnf() endpoint-" + endPoint, isDebugEnabled)
- utils.log("DEBUG", "invoking GET call to AAI endpoint :"+System.lineSeparator()+endPoint,isDebugEnabled)
- utils.logAudit("CreateAAIVfModule sending GET call to AAI Endpoint: " + endPoint)
-
- AaiUtil aaiUtil = new AaiUtil(this)
- APIResponse response = aaiUtil.executeAAIGetCall(execution, endPoint)
- def responseData = response.getResponseBodyAsString()
- def statusCode = response.getStatusCode()
- execution.setVariable("CAAIVfMod_queryGenericVnfResponseCode", statusCode)
- execution.setVariable("CAAIVfMod_queryGenericVnfResponse", responseData)
-
- utils.logAudit("CreateAAIVfModule Response Code: " + statusCode)
- utils.logAudit("CreateAAIVfModule Response data: " + responseData)
- utils.log("DEBUG", "Response code:" + statusCode, isDebugEnabled)
- utils.log("DEBUG", "Response:" + System.lineSeparator()+responseData,isDebugEnabled)
- } catch (Exception ex) {
- ex.printStackTrace()
- utils.log("DEBUG", "Exception occurred while executing AAI GET:" + ex.getMessage(),isDebugEnabled)
- execution.setVariable("CAAIVfMod_queryGenericVnfResponseCode", 500)
- execution.setVariable("CAAIVfMod_queryGenericVnfResponse", "AAI GET Failed:" + ex.getMessage())
- }
- }
-
- // process the result from queryAAIForGenericVnf()
- // note: this method is primarily for logging as the actual decision logic is embedded in the bpmn flow
- public void processAAIGenericVnfQuery(Execution execution) {
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- def result = execution.getVariable("CAAIVfMod_queryGenericVnfResponse")
-
- if (execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") == 404 &&
- execution.getVariable("CAAIVfMod_vnfId").isEmpty()) {
- utils.log("DEBUG", "New Generic VNF requested and it does not already exist", isDebugEnabled)
- } else if (execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") == 200 &&
- !execution.getVariable("CAAIVfMod_vnfId").isEmpty()) {
- utils.log("DEBUG", "Adding module to existing Generic VNF", isDebugEnabled)
- } else if (execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") == 200 &&
- execution.getVariable("CAAIVfMod_vnfId").isEmpty()) {
- utils.log("DEBUG", "Invalid request for new Generic VNF which already exists", isDebugEnabled)
- execution.setVariable("CAAIVfMod_queryGenericVnfResponse",
- "Invalid request for new Generic VNF which already exists, Vnf Name=" +
- execution.getVariable("CAAIVfMod_vnfName"))
- } else { // execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") == 404 &&
- // !execution.getVariable("CAAIVfMod_vnfId").isEmpty())
- utils.log("DEBUG", "Invalid request for Add-on Module requested for non-existant Generic VNF", isDebugEnabled)
- execution.setVariable("CAAIVfMod_createVfModuleResponse",
- "Invalid request for Add-on Module requested for non-existant Generic VNF, VNF Id=" +
- execution.getVariable("CAAIVfMod_vnfId"))
- }
- }
-
- // construct and send a PUT request to A&AI to create a new Generic VNF
- // note: to get here, the vnf-id in the original CREATE_VF_MODULE request was absent or ""
- public void createGenericVnf(Execution execution) {
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- // TBD - is this how we want to generate the Id for the new Generic VNF?
- def newVnfId = UUID.randomUUID().toString()
- def endPoint = execution.getVariable("URN_aai_endpoint") +
- execution.getVariable("CAAIVfMod_genericVnfPutEndpoint") + newVnfId
- // update the flow execution with the new Vnf Id
- execution.setVariable("CAAIVfMod_vnfId",newVnfId)
-
- // AaiUriUtil aaiUriUtil = new AaiUriUtil(this)
- // def aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution)
- // logDebug('AAI URI is: ' + aai_uri, isDebugEnabled)
- // String namespace = aaiUriUtil.getNamespaceFromUri(aai_uri)
- // logDebug('AAI namespace is: ' + namespace, isDebugEnabled)
-
-
- String payload = """<generic-vnf xmlns="${execution.getVariable("CAAIVfMod_aaiNamespace")}">
- <vnf-id>${newVnfId}</vnf-id>
- <vnf-name>${execution.getVariable("CAAIVfMod_vnfName")}</vnf-name>
- <vnf-type>${execution.getVariable("CAAIVfMod_vnfType")}</vnf-type>
- <service-id>${execution.getVariable("CAAIVfMod_serviceId")}</service-id>
- <orchestration-status>active</orchestration-status>
- <persona-model-id>${execution.getVariable("CAAIVfMod_vnfPersonaId")}</persona-model-id>
- <persona-model-version>${execution.getVariable("CAAIVfMod_vnfPersonaVer")}</persona-model-version>
- </generic-vnf>""" as String
- execution.setVariable("CAAIVfMod_createGenericVnfPayload", payload)
-
- try {
- utils.log("DEBUG","createGenericVnf() endpoint-" + endPoint, isDebugEnabled)
- utils.log("DEBUG", "invoking PUT call to AAI with payload:"+System.lineSeparator()+payload,isDebugEnabled)
- utils.logAudit("Sending PUT call to AAI with Endpoint /n" + endPoint + " with payload /n" + payload)
-
- AaiUtil aaiUtil = new AaiUtil(this);
- APIResponse response = aaiUtil.executeAAIPutCall(execution, endPoint, payload);
- def responseData = response.getResponseBodyAsString()
- def responseStatusCode = response.getStatusCode()
- execution.setVariable("CAAIVfMod_createGenericVnfResponseCode", responseStatusCode)
- execution.setVariable("CAAIVfMod_createGenericVnfResponse", responseData)
-
- utils.logAudit("Response Code: " + responseStatusCode)
- utils.logAudit("Response Data: " + responseData)
- utils.log("DEBUG", "Response code:" + responseStatusCode, isDebugEnabled)
- utils.log("DEBUG", "Response:" + System.lineSeparator()+responseData,isDebugEnabled)
- } catch (Exception ex) {
- ex.printStackTrace()
- utils.log("DEBUG", "Exception occurred while executing AAI PUT:" + ex.getMessage(),isDebugEnabled)
- execution.setVariable("CAAIVfMod_createGenericVnfResponseCode", 500)
- execution.setVariable("CAAIVfMod_createGenericVnfResponse", "AAI PUT Failed:" + ex.getMessage())
- }
- }
-
- // construct and send a PUT request to A&AI to create a Base or Add-on VF Module
- public void createVfModule(Execution execution, Boolean isBaseModule) {
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- // TBD - is this how we want to generate the Id for the new (Base) VF Module?
-
- // Generate the new VF Module ID here if it has not been provided by the parent process
- def newModuleId = execution.getVariable('newVfModuleId')
- if (newModuleId == null || newModuleId.isEmpty()) {
- newModuleId = UUID.randomUUID().toString()
- }
- def endPoint = execution.getVariable("URN_aai_endpoint") + execution.getVariable("CAAIVfMod_genericVnfPutEndpoint")
- // need to append the existing Vnf Id or the one generated in createGenericVnf() to the url
- endPoint = endPoint + UriUtils.encode(execution.getVariable("CAAIVfMod_vnfId"), "UTF-8") +
- "/vf-modules/vf-module/" + newModuleId;
-
- // if we get to this point, we may be about to create the Vf Module,
- // add rollback information about the Generic VNF for this base/add-on module
- def rollbackData = execution.getVariable("RollbackData")
- if (rollbackData == null) {
- rollbackData = new RollbackData();
- }
- rollbackData.put("VFMODULE", "vnfId", execution.getVariable("CAAIVfMod_vnfId"))
- rollbackData.put("VFMODULE", "vnfName", execution.getVariable("CAAIVfMod_vnfName"))
- rollbackData.put("VFMODULE", "isBaseModule", isBaseModule.toString())
- execution.setVariable("RollbackData", rollbackData)
- utils.log("DEBUG", "RollbackData:" + rollbackData, isDebugEnabled)
- String payload = """<vf-module xmlns="${execution.getVariable("CAAIVfMod_aaiNamespace")}">
- <vf-module-id>${newModuleId}</vf-module-id>
- <vf-module-name>${execution.getVariable("CAAIVfMod_moduleName")}</vf-module-name>
- <persona-model-id>${execution.getVariable("CAAIVfMod_personaId")}</persona-model-id>
- <persona-model-version>${execution.getVariable("CAAIVfMod_personaVer")}</persona-model-version>
- <persona-model-customization-id>${execution.getVariable("CAAIVfMod_modelCustomizationId")}</persona-model-customization-id>
- <is-base-vf-module>${isBaseModule}</is-base-vf-module>
- <orchestration-status>pending-create</orchestration-status>
- </vf-module>""" as String
- execution.setVariable("CAAIVfMod_createVfModulePayload", payload)
-
- try {
- utils.log("DEBUG","createVfModule() endpoint-" + endPoint, isDebugEnabled)
- utils.log("DEBUG", "invoking PUT call to AAI with payload:"+System.lineSeparator()+payload,isDebugEnabled)
- utils.logAudit("CreateAAIVfModule sending PUT call to AAI with endpoint /n" + endPoint + " with payload /n " + payload)
-
- AaiUtil aaiUtil = new AaiUtil(this)
- APIResponse response = aaiUtil.executeAAIPutCall(execution, endPoint, payload)
- def responseData = response.getResponseBodyAsString()
- def statusCode = response.getStatusCode()
- execution.setVariable("CAAIVfMod_createVfModuleResponseCode", statusCode)
- execution.setVariable("CAAIVfMod_createVfModuleResponse", responseData)
-
- utils.log("DEBUG", "Response code:" + statusCode, isDebugEnabled)
- utils.log("DEBUG", "Response:" + System.lineSeparator()+responseData,isDebugEnabled)
- utils.logAudit("Response Code: " + statusCode)
- utils.logAudit("Response data: " + responseData)
- // the base or add-on VF Module was successfully created,
- // add the module name to the rollback data and the response
- if (isOneOf(statusCode, 200, 201)) {
- rollbackData.put("VFMODULE", "vfModuleId", newModuleId)
- rollbackData.put("VFMODULE", "vfModuleName", execution.getVariable("CAAIVfMod_moduleName"))
- execution.setVariable("RollbackData", rollbackData)
- utils.log("DEBUG", "RollbackData:" + rollbackData, isDebugEnabled)
-
- String responseOut = ""
-
- String isVidRequest = execution.getVariable("isVidRequest")
-
- if (isBaseModule && (isVidRequest == null || "false".equals(isVidRequest))) {
-
- responseOut = """<CreateAAIVfModuleResponse>
- <vnf-id>${execution.getVariable("CAAIVfMod_vnfId")}</vnf-id>
- <vf-module-id>${newModuleId}</vf-module-id>
- </CreateAAIVfModuleResponse>""" as String
- }
- else {
- responseOut = """<CreateAAIVfModuleResponse>
- <vnf-name>${execution.getVariable("CAAIVfMod_vnfNameFromAAI")}</vnf-name>
- <vnf-id>${execution.getVariable("CAAIVfMod_vnfId")}</vnf-id>
- <vf-module-id>${newModuleId}</vf-module-id>
- </CreateAAIVfModuleResponse>""" as String
- }
-
- execution.setVariable("CreateAAIVfModuleResponse", responseOut)
- utils.log("DEBUG", "CreateAAIVfModuleResponse:" + System.lineSeparator()+responseOut,isDebugEnabled)
- utils.logAudit("CreateAAIVfModule Response /n " + responseOut)
- }
- } catch (Exception ex) {
- ex.printStackTrace()
- utils.log("DEBUG", "Exception occurred while executing AAI PUT:" + ex.getMessage(),isDebugEnabled)
- execution.setVariable("CAAIVfMod_createVfModuleResponseCode", 500)
- execution.setVariable("CAAIVfMod_createVfModuleResponse", "AAI PUT Failed:" + ex.getMessage())
- }
- }
-
- // parses the output from the result from queryAAIForGenericVnf() to determine if the vf-module-name
- // requested for an Add-on VF Module does not already exist for the specified Generic VNF
- // also retrieves VNF name from AAI response for existing VNF
- public void parseForAddOnModule(Execution execution) {
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- def xml = execution.getVariable("CAAIVfMod_queryGenericVnfResponse")
- def vnfNameFromAAI = utils.getNodeText1(xml, "vnf-name")
- execution.setVariable("CAAIVfMod_vnfNameFromAAI", vnfNameFromAAI)
- utils.log("DEBUG", "Obtained vnf-name from AAI for existing VNF: " + vnfNameFromAAI)
- def newModuleName = execution.getVariable("CAAIVfMod_moduleName")
- utils.log("DEBUG", "VF Module to be added: " + newModuleName, isDebugEnabled)
- def qryModuleNameList = utils.getMultNodes(xml, "vf-module-name")
- execution.setVariable("CAAIVfMod_moduleExists", false)
- if (qryModuleNameList != null) {
- utils.log("DEBUG", "Existing VF Module List: " + qryModuleNameList, isDebugEnabled)
- for (String qryModuleName : qryModuleNameList) {
- if (newModuleName.equals(qryModuleName)) {
- // a module with the requested name already exists - failure
- utils.log("DEBUG", "VF Module " + qryModuleName + " already exists for Generic VNF " +
- execution.getVariable("CAAIVfMod_vnfNameFromAAI"), isDebugEnabled)
- execution.setVariable("CAAIVfMod_moduleExists", true)
- execution.setVariable("CAAIVfMod_parseModuleResponse",
- "VF Module " + qryModuleName + " already exists for Generic VNF " +
- execution.getVariable("CAAIVfMod_vnfNameFromAAI"))
- break
- }
- }
- }
- if (execution.getVariable("CAAIVfMod_moduleExists") == false) {
- utils.log("DEBUG", "VF Module " + execution.getVariable("CAAIVfMod_moduleName") +
- " does not exist for Generic VNF " + execution.getVariable("CAAIVfMod_vnfNameFromAAI"), isDebugEnabled)
- execution.setVariable("CAAIVfMod_parseModuleResponse",
- "VF Module " + newModuleName + " does not exist for Generic VNF " +
- execution.getVariable("CAAIVfMod_vnfNameFromAAI"))
- }
- }
-
- // parses the output from the result from queryAAIForGenericVnf() to determine if the vf-module-name
- // requested for an Add-on VF Module does not already exist for the specified Generic VNF;
- // also retrieves VNF name from AAI response for existing VNF
- public void parseForBaseModule(Execution execution) {
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- def xml = execution.getVariable("CAAIVfMod_queryGenericVnfResponse")
- def vnfNameFromAAI = utils.getNodeText1(xml, "vnf-name")
- execution.setVariable("CAAIVfMod_vnfNameFromAAI", vnfNameFromAAI)
- utils.log("DEBUG", "Obtained vnf-name from AAI for existing VNF: " + vnfNameFromAAI)
- def newModuleName = execution.getVariable("CAAIVfMod_moduleName")
- utils.log("DEBUG", "VF Module to be added: " + newModuleName, isDebugEnabled)
- def qryModuleNameList = utils.getMultNodes(xml, "vf-module-name")
- execution.setVariable("CAAIVfMod_moduleExists", false)
- if (qryModuleNameList != null) {
- utils.log("DEBUG", "Existing VF Module List: " + qryModuleNameList, isDebugEnabled)
- for (String qryModuleName : qryModuleNameList) {
- if (newModuleName.equals(qryModuleName)) {
- // a module with the requested name already exists - failure
- utils.log("DEBUG", "VF Module " + qryModuleName + " already exists for Generic VNF " +
- execution.getVariable("CAAIVfMod_vnfNameFromAAI"), isDebugEnabled)
- execution.setVariable("CAAIVfMod_baseModuleConflict", true)
- execution.setVariable("CAAIVfMod_parseModuleResponse",
- "VF Module " + qryModuleName + " already exists for Generic VNF " +
- execution.getVariable("CAAIVfMod_vnfNameFromAAI"))
- break
- }
- }
- }
- def isBaseVfModuleList = utils.getMultNodes(xml, "is-base-vf-module")
- if (isBaseVfModuleList != null && !execution.getVariable("CAAIVfMod_baseModuleConflict")) {
-
- for (String baseValue : isBaseVfModuleList) {
- if (baseValue.equals("true")) {
- // a base module already exists in this VNF - failure
- utils.log("DEBUG", "Base VF Module already exists for Generic VNF " +
- execution.getVariable("CAAIVfMod_vnfNameFromAAI"), isDebugEnabled)
- execution.setVariable("CAAIVfMod_baseModuleConflict", true)
- execution.setVariable("CAAIVfMod_parseModuleResponse",
- "Base VF Module already exists for Generic VNF " +
- execution.getVariable("CAAIVfMod_vnfNameFromAAI"))
- break
- }
- }
-
- }
- if (execution.getVariable("CAAIVfMod_moduleExists") == false && execution.getVariable("CAAIVfMod_baseModuleConflict") == false) {
- utils.log("DEBUG", "VF Module " + execution.getVariable("CAAIVfMod_moduleName") +
- " does not exist for Generic VNF " + execution.getVariable("CAAIVfMod_vnfNameFromAAI"), isDebugEnabled)
- execution.setVariable("CAAIVfMod_parseModuleResponse",
- "VF Module " + newModuleName + " does not exist for Generic VNF " +
- execution.getVariable("CAAIVfMod_vnfNameFromAAI"))
- }
- }
-
- // generates a WorkflowException when the A&AI query returns a response code other than 200 or 404
- public void handleAAIQueryFailure(Execution execution) {
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
-
- utils.log("ERROR", "Error occurred attempting to query AAI, Response Code " +
- execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") + ", Error Response " +
- execution.getVariable("CAAIVfMod_queryGenericVnfResponse"), isDebugEnabled)
- String processKey = getProcessKey(execution);
- WorkflowException exception = new WorkflowException(processKey, 5000,
- execution.getVariable("CAAIVfMod_queryGenericVnfResponse"))
- execution.setVariable("WorkflowException", exception)
- }
-
- // generates a WorkflowException if
- // - the A&AI Generic VNF PUT returns a response code other than 200 or 201
- // - the requested Generic VNF already exists but vnf-id == null
- // - the requested Generic VNF does not exist but vnf-id != null
- // - the A&AI VF Module PUT returns a response code other than 200 or 201
- // - the requested VF Module already exists for the Generic VNF
- public void handleCreateVfModuleFailure(Execution execution) {
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
-
- def errorCode
- def errorResponse
- if (execution.getVariable("CAAIVfMod_createGenericVnfResponseCode") != null &&
- !isOneOf(execution.getVariable("CAAIVfMod_createGenericVnfResponseCode"), 200, 201)) {
- utils.log("DEBUG", "Failure creating Generic VNF: " +
- execution.getVariable("CAAIVfMod_createGenericVnfResponse"), isDebugEnabled)
- errorResponse = execution.getVariable("CAAIVfMod_createGenericVnfResponse")
- errorCode = 5000
- } else if (execution.getVariable("CAAIVfMod_queryGenericVnfResponse") != null &&
- execution.getVariable("CAAIVfMod_newGenericVnf") == true) {
- // attempted to create a Generic VNF that already exists but vnf-id == null
- utils.log("DEBUG", execution.getVariable("CAAIVfMod_queryGenericVnfResponse"), isDebugEnabled)
- errorResponse = execution.getVariable("CAAIVfMod_queryGenericVnfResponse")
- errorCode = 1002
- } else if (execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") == 404 &&
- execution.getVariable("CAAIVfMod_newGenericVnf") == false) {
- // attempted to create a Generic VNF where vnf-name does not exist but vnf-id != null
- utils.log("DEBUG", execution.getVariable("CAAIVfMod_queryGenericVnfResponse"), isDebugEnabled)
- errorResponse = execution.getVariable("CAAIVfMod_queryGenericVnfResponse")
- errorCode = 1002
- } else if (execution.getVariable("CAAIVfMod_createVfModuleResponseCode") != null) {
- utils.log("DEBUG", "Failed to add VF Module: " +
- execution.getVariable("CAAIVfMod_createVfModuleResponse"), isDebugEnabled)
- errorResponse = execution.getVariable("CAAIVfMod_createVfModuleResponse")
- errorCode = 5000
- } else if (execution.getVariable("CAAIVfMod_moduleExists") == true) {
- utils.log("DEBUG", "Attempting to add VF Module that already exists: " +
- execution.getVariable("CAAIVfMod_parseModuleResponse"), isDebugEnabled)
- errorResponse = execution.getVariable("CAAIVfMod_parseModuleResponse")
- errorCode = 1002
- } else if (execution.getVariable("CAAIVfMod_baseModuleConflict") == true) {
- utils.log("DEBUG", "Attempting to add Base VF Module to VNF that already has a Base VF Module: " +
- execution.getVariable("CAAIVfMod_parseModuleResponse"), isDebugEnabled)
- errorResponse = execution.getVariable("CAAIVfMod_parseModuleResponse")
- errorCode = 1002
- } else {
- // if the responses get populated corerctly, we should never get here
- errorResponse = "Unknown error occurred during CreateAAIVfModule flow"
- errorCode = 2000
- }
-
- utils.log("ERROR", "Error occurred during CreateAAIVfModule flow: " + errorResponse, isDebugEnabled)
- String processKey = getProcessKey(execution);
- WorkflowException exception = new WorkflowException(processKey, errorCode, errorResponse)
- execution.setVariable("WorkflowException", exception)
- utils.logAudit("Workflow exception occurred in CreateAAIVfModule: " + errorResponse)
- }
-
- /**
- * Performs a rollback.
- * TBD: This method requires additional testing once integrated with the
- * main CreateVfModule flow.
- * @param execution the execution
- */
- public void rollback(Execution execution) {
- def method = getClass().getSimpleName() + ".rollback(" +
- "execution=" + execution.getId() +
- ")"
- def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled")
- logDebug("Entered " + method, isDebugLogEnabled)
-
- try {
- RollbackData rollbackData = (RollbackData) execution.getVariable("RollbackData")
- logDebug("RollbackData:" + rollbackData, isDebugLogEnabled)
-
- AaiUtil aaiUriUtil = new AaiUtil(this)
- def aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution)
- logDebug('AAI URI is: ' + aai_uri, isDebugLogEnabled)
- utils.logAudit("CreateAAIVfModule rollback AAI URI: " + aai_uri)
-
- if (rollbackData != null) {
- if (rollbackData.hasType("VFMODULE")) {
- // use the DeleteAAIVfModule groovy methods for the rollback
- def vnfId = rollbackData.get("VFMODULE", "vnfId")
- def vfModuleId = rollbackData.get("VFMODULE", "vfModuleId")
- def isBaseModule = rollbackData.get("VFMODULE", "isBaseModule")
- execution.setVariable("DAAIVfMod_vnfId", vnfId)
- execution.setVariable("DAAIVfMod_vfModuleId", vfModuleId)
- execution.setVariable("DAAIVfMod_genericVnfEndpoint", "${aai_uri}/" + vnfId)
- execution.setVariable("DAAIVfMod_vfModuleEndpoint", "${aai_uri}/" + vnfId +
- "/vf-modules/vf-module/" + vfModuleId)
- DeleteAAIVfModule dvm = new DeleteAAIVfModule()
- // query A&AI to get the needed information for the delete(s)
- dvm.queryAAIForGenericVnf(execution)
- dvm.parseForVfModule(execution)
-
- // roll back the base or add-on module
- dvm.deleteVfModule(execution)
- def responseCode = execution.getVariable("DAAIVfMod_deleteVfModuleResponseCode")
- def response = execution.getVariable("DAAIVfMod_deleteVfModuleResponseCode")
-
- if (isOneOf(responseCode, 200, 204)) {
- logDebug("Received " + responseCode + " to VF Module rollback request", isDebugLogEnabled)
-// execution.setVariable("RollbackResult", "SUCCESS")
- } else {
- logError("Received " + responseCode + " to VF Module rollback request: " + rollbackData +
- System.lineSeparator() + "Response: " + response)
- }
-
- // a new Generic VNF was created that needs to be rolled back
- if (isBaseModule.equals("true")) {
- dvm.deleteGenericVnf(execution)
- responseCode = execution.getVariable("DAAIVfMod_deleteGenericVnfResponseCode")
- response = execution.getVariable("DAAIVfMod_deleteGenericVnfResponse")
-
- if (isOneOf(responseCode, 200, 204)) {
- logDebug("Received " + responseCode + " to Generic VNF rollback request", isDebugLogEnabled)
- execution.setVariable("RollbackResult", "SUCCESS")
- } else {
- logError("Received " + responseCode + " to Generic VNF rollback request: " + rollbackData +
- System.lineSeparator() + "Response: " + response)
- }
- } else {
- execution.setVariable("RollbackResult", "SUCCESS")
- }
- }
- }
-
- logDebug("Exited " + method, isDebugLogEnabled)
- } catch (Exception e) {
- logError("Caught exception in " + method, e)
- }
- }
-}
+/*-
+ * ============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.common.scripts
+import org.camunda.bpm.engine.runtime.Execution
+import org.openecomp.mso.bpmn.core.RollbackData
+import org.openecomp.mso.bpmn.core.WorkflowException
+import org.openecomp.mso.rest.APIResponse
+import org.springframework.web.util.UriUtils
+
+
+public class CreateAAIVfModule extends AbstractServiceTaskProcessor{
+
+ def Prefix="CAAIVfMod_"
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+ public void initProcessVariables(Execution execution) {
+ execution.setVariable("prefix",Prefix)
+ execution.setVariable("CAAIVfMod_vnfId",null)
+ execution.setVariable("CAAIVfMod_vnfName",null)
+ execution.setVariable("CAAIVfMod_vnfType",null)
+ execution.setVariable("CAAIVfMod_serviceId",null)
+ execution.setVariable("CAAIVfMod_personaId",null)
+ execution.setVariable("CAAIVfMod_personaVer",null)
+ execution.setVariable("CAAIVfMod_modelCustomizationId",null)
+ execution.setVariable("CAAIVfMod_vnfPersonaId",null)
+ execution.setVariable("CAAIVfMod_vnfPersonaVer",null)
+ execution.setVariable("CAAIVfMod_isBaseVfModule", false)
+ execution.setVariable("CAAIVfMod_moduleName",null)
+ execution.setVariable("CAAIVfMod_moduleModelName",null)
+ execution.setVariable("CAAIVfMod_newGenericVnf",false)
+ execution.setVariable("CAAIVfMod_genericVnfGetEndpoint",null)
+ execution.setVariable("CAAIVfMod_genericVnfPutEndpoint",null)
+ execution.setVariable("CAAIVfMod_aaiNamespace",null)
+ execution.setVariable("CAAIVfMod_moduleExists",false)
+ execution.setVariable("CAAIVfMod_baseModuleConflict", false)
+ execution.setVariable("CAAIVfMod_vnfNameFromAAI", null)
+
+
+ // CreateAAIVfModule workflow response variable placeholders
+ execution.setVariable("CAAIVfMod_queryGenericVnfResponseCode",null)
+ execution.setVariable("CAAIVfMod_queryGenericVnfResponse","")
+ execution.setVariable("CAAIVfMod_createGenericVnfResponseCode",null)
+ execution.setVariable("CAAIVfMod_createGenericVnfResponse","")
+ execution.setVariable("CAAIVfMod_createVfModuleResponseCode",null)
+ execution.setVariable("CAAIVfMod_createVfModuleResponse","")
+ execution.setVariable("CAAIVfMod_parseModuleResponse","")
+ execution.setVariable("CAAIVfMod_deleteGenericVnfResponseCode",null)
+ execution.setVariable("CAAIVfMod_deleteGenericVnfResponse","")
+ execution.setVariable("CAAIVfMod_deleteVfModuleResponseCode",null)
+ execution.setVariable("CAAIVfMod_deleteVfModuleResponse","")
+// execution.setVariable("CAAIVfMod_ResponseCode",null)
+// execution.setVariable("CAAIVfMod_ErrorResponse","")
+ execution.setVariable("CreateAAIVfModuleResponse","")
+ execution.setVariable("RollbackData", null)
+
+ }
+
+ // parse the incoming CREATE_VF_MODULE request and store the Generic VNF
+ // and VF Module data in the flow Execution
+ public void preProcessRequest(Execution execution) {
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ initProcessVariables(execution)
+
+ def vnfId = execution.getVariable("vnfId")
+ if (vnfId == null || vnfId.isEmpty()) {
+ execution.setVariable("CAAIVfMod_newGenericVnf", true)
+ execution.setVariable("CAAIVfMod_vnfId","")
+ }
+ else {
+ execution.setVariable("CAAIVfMod_vnfId",vnfId)
+ }
+
+ def vnfName = execution.getVariable("vnfName")
+ execution.setVariable("CAAIVfMod_vnfName", vnfName)
+
+ String vnfType = execution.getVariable("vnfType")
+ if (vnfType != null && !vnfType.isEmpty()) {
+ execution.setVariable("CAAIVfMod_vnfType", vnfType)
+ } else {
+ execution.setVariable("CAAIVfMod_vnfType","")
+ }
+
+ execution.setVariable("CAAIVfMod_serviceId", execution.getVariable("serviceId"))
+
+ String personaModelId = execution.getVariable("personaModelId")
+
+ if (personaModelId != null && !personaModelId.isEmpty()) {
+ execution.setVariable("CAAIVfMod_personaId",personaModelId)
+ } else {
+ execution.setVariable("CAAIVfMod_personaId","")
+ }
+
+ String personaModelVersion = execution.getVariable("personaModelVersion")
+
+ if (personaModelVersion != null && !personaModelVersion.isEmpty()) {
+ execution.setVariable("CAAIVfMod_personaVer", personaModelVersion)
+ } else {
+ execution.setVariable("CAAIVfMod_personaVer","")
+ }
+
+
+ String modelCustomizationId = execution.getVariable("modelCustomizationId")
+
+ if (modelCustomizationId != null && !modelCustomizationId.isEmpty()) {
+ execution.setVariable("CAAIVfMod_modelCustomizationId",modelCustomizationId)
+ } else {
+ execution.setVariable("CAAIVfMod_modelCustomizationId","")
+ }
+
+ String vnfPersonaModelId = execution.getVariable("vnfPersonaModelId")
+
+ if (vnfPersonaModelId != null && !vnfPersonaModelId.isEmpty()) {
+ execution.setVariable("CAAIVfMod_vnfPersonaId",vnfPersonaModelId)
+ } else {
+ execution.setVariable("CAAIVfMod_vnfPersonaId","")
+ }
+
+ String vnfPersonaModelVersion = execution.getVariable("vnfPersonaModelVersion")
+
+ if (vnfPersonaModelVersion != null && !vnfPersonaModelVersion.isEmpty()) {
+ execution.setVariable("CAAIVfMod_vnfPersonaVer",vnfPersonaModelVersion)
+ } else {
+ execution.setVariable("CAAIVfMod_vnfPersonaVer","")
+ }
+
+ //isBaseVfModule
+ Boolean isBaseVfModule = false
+ String isBaseVfModuleString = execution.getVariable("isBaseVfModule")
+ if (isBaseVfModuleString != null && isBaseVfModuleString.equals("true")) {
+ isBaseVfModule = true
+ }
+ execution.setVariable("CAAIVfMod_isBaseVfModule", isBaseVfModule)
+
+ String isVidRequest = execution.getVariable("isVidRequest")
+ if (isVidRequest != null && "true".equals(isVidRequest)) {
+ logDebug("VID Request received", isDebugEnabled)
+ }
+
+ execution.setVariable("CAAIVfMod_moduleName",execution.getVariable("vfModuleName"))
+ execution.setVariable("CAAIVfMod_moduleModelName",execution.getVariable("vfModuleModelName"))
+
+ AaiUtil aaiUriUtil = new AaiUtil(this)
+ def aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution)
+ logDebug('AAI URI is: ' + aai_uri, isDebugEnabled)
+ String aaiNamespace = aaiUriUtil.getNamespaceFromUri(aai_uri)
+ logDebug('AAI namespace is: ' + aaiNamespace, isDebugEnabled)
+
+ execution.setVariable("CAAIVfMod_aaiNamespace","${aaiNamespace}")
+
+ if (vnfId == null || vnfId.isEmpty()) {
+ // TBD - assert that the vnfName is not empty
+ execution.setVariable("CAAIVfMod_genericVnfGetEndpoint",
+ "${aai_uri}/?vnf-name=" +
+ UriUtils.encode(vnfName,"UTF-8") + "&depth=1")
+ } else {
+ execution.setVariable("CAAIVfMod_genericVnfGetEndpoint",
+ "${aai_uri}/" + UriUtils.encode(vnfId,"UTF-8") + "?depth=1")
+ }
+
+ utils.logAudit("CreateAAIVfModule VNF PUT Endpoint: ${aai_uri}/")
+ execution.setVariable("CAAIVfMod_genericVnfPutEndpoint","${aai_uri}/")
+ }
+
+ // send a GET request to AA&I to retrieve the Generic VNF/VF Module information based on a Vnf Name
+ // expect a 200 response with the information in the response body or a 404 if the Generic VNF does not exist
+ public void queryAAIForGenericVnf(Execution execution) {
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ def endPoint = execution.getVariable("URN_aai_endpoint") + execution.getVariable("CAAIVfMod_genericVnfGetEndpoint")
+
+ try {
+ utils.log("DEBUG","queryAAIForGenericVnf() endpoint-" + endPoint, isDebugEnabled)
+ utils.log("DEBUG", "invoking GET call to AAI endpoint :"+System.lineSeparator()+endPoint,isDebugEnabled)
+ utils.logAudit("CreateAAIVfModule sending GET call to AAI Endpoint: " + endPoint)
+
+ AaiUtil aaiUtil = new AaiUtil(this)
+ APIResponse response = aaiUtil.executeAAIGetCall(execution, endPoint)
+ def responseData = response.getResponseBodyAsString()
+ def statusCode = response.getStatusCode()
+ execution.setVariable("CAAIVfMod_queryGenericVnfResponseCode", statusCode)
+ execution.setVariable("CAAIVfMod_queryGenericVnfResponse", responseData)
+
+ utils.logAudit("CreateAAIVfModule Response Code: " + statusCode)
+ utils.logAudit("CreateAAIVfModule Response data: " + responseData)
+ utils.log("DEBUG", "Response code:" + statusCode, isDebugEnabled)
+ utils.log("DEBUG", "Response:" + System.lineSeparator()+responseData,isDebugEnabled)
+ } catch (Exception ex) {
+ utils.log("DEBUG", "Exception occurred while executing AAI GET:" + ex.getMessage(),isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured in queryAAIForGenericVnf.")
+
+ }
+ }
+
+ // process the result from queryAAIForGenericVnf()
+ // note: this method is primarily for logging as the actual decision logic is embedded in the bpmn flow
+ public void processAAIGenericVnfQuery(Execution execution) {
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ def result = execution.getVariable("CAAIVfMod_queryGenericVnfResponse")
+
+ if (execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") == 404 &&
+ execution.getVariable("CAAIVfMod_vnfId").isEmpty()) {
+ utils.log("DEBUG", "New Generic VNF requested and it does not already exist", isDebugEnabled)
+ } else if (execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") == 200 &&
+ !execution.getVariable("CAAIVfMod_vnfId").isEmpty()) {
+ utils.log("DEBUG", "Adding module to existing Generic VNF", isDebugEnabled)
+ } else if (execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") == 200 &&
+ execution.getVariable("CAAIVfMod_vnfId").isEmpty()) {
+ utils.log("DEBUG", "Invalid request for new Generic VNF which already exists", isDebugEnabled)
+ execution.setVariable("CAAIVfMod_queryGenericVnfResponse",
+ "Invalid request for new Generic VNF which already exists, Vnf Name=" +
+ execution.getVariable("CAAIVfMod_vnfName"))
+ } else { // execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") == 404 &&
+ // !execution.getVariable("CAAIVfMod_vnfId").isEmpty())
+ utils.log("DEBUG", "Invalid request for Add-on Module requested for non-existant Generic VNF", isDebugEnabled)
+ execution.setVariable("CAAIVfMod_createVfModuleResponse",
+ "Invalid request for Add-on Module requested for non-existant Generic VNF, VNF Id=" +
+ execution.getVariable("CAAIVfMod_vnfId"))
+ }
+ }
+
+ // construct and send a PUT request to A&AI to create a new Generic VNF
+ // note: to get here, the vnf-id in the original CREATE_VF_MODULE request was absent or ""
+ public void createGenericVnf(Execution execution) {
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ // TBD - is this how we want to generate the Id for the new Generic VNF?
+ def newVnfId = UUID.randomUUID().toString()
+ def endPoint = execution.getVariable("URN_aai_endpoint") +
+ execution.getVariable("CAAIVfMod_genericVnfPutEndpoint") + newVnfId
+ // update the flow execution with the new Vnf Id
+ execution.setVariable("CAAIVfMod_vnfId",newVnfId)
+
+ // AaiUriUtil aaiUriUtil = new AaiUriUtil(this)
+ // def aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution)
+ // logDebug('AAI URI is: ' + aai_uri, isDebugEnabled)
+ // String namespace = aaiUriUtil.getNamespaceFromUri(aai_uri)
+ // logDebug('AAI namespace is: ' + namespace, isDebugEnabled)
+
+
+ String payload = """<generic-vnf xmlns="${execution.getVariable("CAAIVfMod_aaiNamespace")}">
+ <vnf-id>${newVnfId}</vnf-id>
+ <vnf-name>${execution.getVariable("CAAIVfMod_vnfName")}</vnf-name>
+ <vnf-type>${execution.getVariable("CAAIVfMod_vnfType")}</vnf-type>
+ <service-id>${execution.getVariable("CAAIVfMod_serviceId")}</service-id>
+ <orchestration-status>active</orchestration-status>
+ <persona-model-id>${execution.getVariable("CAAIVfMod_vnfPersonaId")}</persona-model-id>
+ <persona-model-version>${execution.getVariable("CAAIVfMod_vnfPersonaVer")}</persona-model-version>
+ </generic-vnf>""" as String
+ execution.setVariable("CAAIVfMod_createGenericVnfPayload", payload)
+
+ try {
+ utils.log("DEBUG","createGenericVnf() endpoint-" + endPoint, isDebugEnabled)
+ utils.log("DEBUG", "invoking PUT call to AAI with payload:"+System.lineSeparator()+payload,isDebugEnabled)
+ utils.logAudit("Sending PUT call to AAI with Endpoint /n" + endPoint + " with payload /n" + payload)
+
+ AaiUtil aaiUtil = new AaiUtil(this);
+ APIResponse response = aaiUtil.executeAAIPutCall(execution, endPoint, payload);
+ def responseData = response.getResponseBodyAsString()
+ def responseStatusCode = response.getStatusCode()
+ execution.setVariable("CAAIVfMod_createGenericVnfResponseCode", responseStatusCode)
+ execution.setVariable("CAAIVfMod_createGenericVnfResponse", responseData)
+
+ utils.logAudit("Response Code: " + responseStatusCode)
+ utils.logAudit("Response Data: " + responseData)
+ utils.log("DEBUG", "Response code:" + responseStatusCode, isDebugEnabled)
+ utils.log("DEBUG", "Response:" + System.lineSeparator()+responseData,isDebugEnabled)
+ } catch (Exception ex) {
+ ex.printStackTrace()
+ utils.log("DEBUG", "Exception occurred while executing AAI PUT:" + ex.getMessage(),isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured in createGenericVnf.")
+ }
+ }
+
+ // construct and send a PUT request to A&AI to create a Base or Add-on VF Module
+ public void createVfModule(Execution execution, Boolean isBaseModule) {
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ // TBD - is this how we want to generate the Id for the new (Base) VF Module?
+
+ // Generate the new VF Module ID here if it has not been provided by the parent process
+ def newModuleId = execution.getVariable('newVfModuleId')
+ if (newModuleId == null || newModuleId.isEmpty()) {
+ newModuleId = UUID.randomUUID().toString()
+ }
+ def endPoint = execution.getVariable("URN_aai_endpoint") + execution.getVariable("CAAIVfMod_genericVnfPutEndpoint")
+ // need to append the existing Vnf Id or the one generated in createGenericVnf() to the url
+ endPoint = endPoint + UriUtils.encode(execution.getVariable("CAAIVfMod_vnfId"), "UTF-8") +
+ "/vf-modules/vf-module/" + newModuleId;
+ int moduleIndex = 0
+ if (!isBaseModule) {
+ def aaiVnfResponse = execution.getVariable("CAAIVfMod_queryGenericVnfResponse")
+ AaiUtil aaiUtil = new AaiUtil(this)
+ def personaModelId = execution.getVariable("CAAIVfMod_personaId")
+ moduleIndex = aaiUtil.getLowestUnusedVfModuleIndexFromAAIVnfResponse(execution, aaiVnfResponse,
+ "persona-model-id", personaModelId)
+ }
+ def moduleIndexString = String.valueOf(moduleIndex)
+
+ // if we get to this point, we may be about to create the Vf Module,
+ // add rollback information about the Generic VNF for this base/add-on module
+ def rollbackData = execution.getVariable("RollbackData")
+ if (rollbackData == null) {
+ rollbackData = new RollbackData();
+ }
+ rollbackData.put("VFMODULE", "vnfId", execution.getVariable("CAAIVfMod_vnfId"))
+ rollbackData.put("VFMODULE", "vnfName", execution.getVariable("CAAIVfMod_vnfName"))
+ rollbackData.put("VFMODULE", "isBaseModule", isBaseModule.toString())
+ execution.setVariable("RollbackData", rollbackData)
+ utils.log("DEBUG", "RollbackData:" + rollbackData, isDebugEnabled)
+ String payload = """<vf-module xmlns="${execution.getVariable("CAAIVfMod_aaiNamespace")}">
+ <vf-module-id>${newModuleId}</vf-module-id>
+ <vf-module-name>${execution.getVariable("CAAIVfMod_moduleName")}</vf-module-name>
+ <persona-model-id>${execution.getVariable("CAAIVfMod_personaId")}</persona-model-id>
+ <persona-model-version>${execution.getVariable("CAAIVfMod_personaVer")}</persona-model-version>
+ <persona-model-customization-id>${execution.getVariable("CAAIVfMod_modelCustomizationId")}</persona-model-customization-id>
+ <is-base-vf-module>${isBaseModule}</is-base-vf-module>
+ <orchestration-status>pending-create</orchestration-status>
+ <module-index>${moduleIndex}</module-index>
+ </vf-module>""" as String
+ execution.setVariable("CAAIVfMod_createVfModulePayload", payload)
+
+ try {
+ utils.log("DEBUG","createVfModule() endpoint-" + endPoint, isDebugEnabled)
+ utils.log("DEBUG", "invoking PUT call to AAI with payload:"+System.lineSeparator()+payload,isDebugEnabled)
+ utils.logAudit("CreateAAIVfModule sending PUT call to AAI with endpoint /n" + endPoint + " with payload /n " + payload)
+
+ AaiUtil aaiUtil = new AaiUtil(this)
+ APIResponse response = aaiUtil.executeAAIPutCall(execution, endPoint, payload)
+ def responseData = response.getResponseBodyAsString()
+ def statusCode = response.getStatusCode()
+ execution.setVariable("CAAIVfMod_createVfModuleResponseCode", statusCode)
+ execution.setVariable("CAAIVfMod_createVfModuleResponse", responseData)
+
+ utils.log("DEBUG", "Response code:" + statusCode, isDebugEnabled)
+ utils.log("DEBUG", "Response:" + System.lineSeparator()+responseData,isDebugEnabled)
+ utils.logAudit("Response Code: " + statusCode)
+ utils.logAudit("Response data: " + responseData)
+ // the base or add-on VF Module was successfully created,
+ // add the module name to the rollback data and the response
+ if (isOneOf(statusCode, 200, 201)) {
+ rollbackData.put("VFMODULE", "vfModuleId", newModuleId)
+ rollbackData.put("VFMODULE", "vfModuleName", execution.getVariable("CAAIVfMod_moduleName"))
+ execution.setVariable("RollbackData", rollbackData)
+ utils.log("DEBUG", "RollbackData:" + rollbackData, isDebugEnabled)
+
+ String responseOut = ""
+
+ String isVidRequest = execution.getVariable("isVidRequest")
+
+ if (isBaseModule && (isVidRequest == null || "false".equals(isVidRequest))) {
+
+ responseOut = """<CreateAAIVfModuleResponse>
+ <vnf-id>${execution.getVariable("CAAIVfMod_vnfId")}</vnf-id>
+ <vf-module-id>${newModuleId}</vf-module-id>
+ <vf-module-index>${moduleIndexString}</vf-module-index>
+ </CreateAAIVfModuleResponse>""" as String
+ }
+ else {
+ responseOut = """<CreateAAIVfModuleResponse>
+ <vnf-name>${execution.getVariable("CAAIVfMod_vnfNameFromAAI")}</vnf-name>
+ <vnf-id>${execution.getVariable("CAAIVfMod_vnfId")}</vnf-id>
+ <vf-module-id>${newModuleId}</vf-module-id>
+ <vf-module-index>${moduleIndexString}</vf-module-index>
+ </CreateAAIVfModuleResponse>""" as String
+ }
+
+ execution.setVariable("CreateAAIVfModuleResponse", responseOut)
+ utils.log("DEBUG", "CreateAAIVfModuleResponse:" + System.lineSeparator()+responseOut,isDebugEnabled)
+ utils.logAudit("CreateAAIVfModule Response /n " + responseOut)
+ }
+ } catch (Exception ex) {
+ utils.log("DEBUG", "Exception occurred while executing AAI PUT:" + ex.getMessage(),isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured in createVfModule.")
+ }
+ }
+
+ // parses the output from the result from queryAAIForGenericVnf() to determine if the vf-module-name
+ // requested for an Add-on VF Module does not already exist for the specified Generic VNF
+ // also retrieves VNF name from AAI response for existing VNF
+ public void parseForAddOnModule(Execution execution) {
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ def xml = execution.getVariable("CAAIVfMod_queryGenericVnfResponse")
+ def vnfNameFromAAI = utils.getNodeText1(xml, "vnf-name")
+ execution.setVariable("CAAIVfMod_vnfNameFromAAI", vnfNameFromAAI)
+ utils.log("DEBUG", "Obtained vnf-name from AAI for existing VNF: " + vnfNameFromAAI)
+ def newModuleName = execution.getVariable("CAAIVfMod_moduleName")
+ utils.log("DEBUG", "VF Module to be added: " + newModuleName, isDebugEnabled)
+ def qryModuleNameList = utils.getMultNodes(xml, "vf-module-name")
+ execution.setVariable("CAAIVfMod_moduleExists", false)
+ if (qryModuleNameList != null) {
+ utils.log("DEBUG", "Existing VF Module List: " + qryModuleNameList, isDebugEnabled)
+ for (String qryModuleName : qryModuleNameList) {
+ if (newModuleName.equals(qryModuleName)) {
+ // a module with the requested name already exists - failure
+ utils.log("DEBUG", "VF Module " + qryModuleName + " already exists for Generic VNF " +
+ execution.getVariable("CAAIVfMod_vnfNameFromAAI"), isDebugEnabled)
+ execution.setVariable("CAAIVfMod_moduleExists", true)
+ execution.setVariable("CAAIVfMod_parseModuleResponse",
+ "VF Module " + qryModuleName + " already exists for Generic VNF " +
+ execution.getVariable("CAAIVfMod_vnfNameFromAAI"))
+ break
+ }
+ }
+ }
+ if (execution.getVariable("CAAIVfMod_moduleExists") == false) {
+ utils.log("DEBUG", "VF Module " + execution.getVariable("CAAIVfMod_moduleName") +
+ " does not exist for Generic VNF " + execution.getVariable("CAAIVfMod_vnfNameFromAAI"), isDebugEnabled)
+ execution.setVariable("CAAIVfMod_parseModuleResponse",
+ "VF Module " + newModuleName + " does not exist for Generic VNF " +
+ execution.getVariable("CAAIVfMod_vnfNameFromAAI"))
+ }
+ }
+
+ // parses the output from the result from queryAAIForGenericVnf() to determine if the vf-module-name
+ // requested for an Add-on VF Module does not already exist for the specified Generic VNF;
+ // also retrieves VNF name from AAI response for existing VNF
+ public void parseForBaseModule(Execution execution) {
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ def xml = execution.getVariable("CAAIVfMod_queryGenericVnfResponse")
+ def vnfNameFromAAI = utils.getNodeText1(xml, "vnf-name")
+ execution.setVariable("CAAIVfMod_vnfNameFromAAI", vnfNameFromAAI)
+ utils.log("DEBUG", "Obtained vnf-name from AAI for existing VNF: " + vnfNameFromAAI)
+ def newModuleName = execution.getVariable("CAAIVfMod_moduleName")
+ utils.log("DEBUG", "VF Module to be added: " + newModuleName, isDebugEnabled)
+ def qryModuleNameList = utils.getMultNodes(xml, "vf-module-name")
+ execution.setVariable("CAAIVfMod_moduleExists", false)
+ if (qryModuleNameList != null) {
+ utils.log("DEBUG", "Existing VF Module List: " + qryModuleNameList, isDebugEnabled)
+ for (String qryModuleName : qryModuleNameList) {
+ if (newModuleName.equals(qryModuleName)) {
+ // a module with the requested name already exists - failure
+ utils.log("DEBUG", "VF Module " + qryModuleName + " already exists for Generic VNF " +
+ execution.getVariable("CAAIVfMod_vnfNameFromAAI"), isDebugEnabled)
+ execution.setVariable("CAAIVfMod_baseModuleConflict", true)
+ execution.setVariable("CAAIVfMod_parseModuleResponse",
+ "VF Module " + qryModuleName + " already exists for Generic VNF " +
+ execution.getVariable("CAAIVfMod_vnfNameFromAAI"))
+ break
+ }
+ }
+ }
+ def isBaseVfModuleList = utils.getMultNodes(xml, "is-base-vf-module")
+ if (isBaseVfModuleList != null && !execution.getVariable("CAAIVfMod_baseModuleConflict")) {
+
+ for (String baseValue : isBaseVfModuleList) {
+ if (baseValue.equals("true")) {
+ // a base module already exists in this VNF - failure
+ utils.log("DEBUG", "Base VF Module already exists for Generic VNF " +
+ execution.getVariable("CAAIVfMod_vnfNameFromAAI"), isDebugEnabled)
+ execution.setVariable("CAAIVfMod_baseModuleConflict", true)
+ execution.setVariable("CAAIVfMod_parseModuleResponse",
+ "Base VF Module already exists for Generic VNF " +
+ execution.getVariable("CAAIVfMod_vnfNameFromAAI"))
+ break
+ }
+ }
+
+ }
+ if (execution.getVariable("CAAIVfMod_moduleExists") == false && execution.getVariable("CAAIVfMod_baseModuleConflict") == false) {
+ utils.log("DEBUG", "VF Module " + execution.getVariable("CAAIVfMod_moduleName") +
+ " does not exist for Generic VNF " + execution.getVariable("CAAIVfMod_vnfNameFromAAI"), isDebugEnabled)
+ execution.setVariable("CAAIVfMod_parseModuleResponse",
+ "VF Module " + newModuleName + " does not exist for Generic VNF " +
+ execution.getVariable("CAAIVfMod_vnfNameFromAAI"))
+ }
+ }
+
+ // generates a WorkflowException when the A&AI query returns a response code other than 200 or 404
+ public void handleAAIQueryFailure(Execution execution) {
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+
+ utils.log("ERROR", "Error occurred attempting to query AAI, Response Code " +
+ execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") + ", Error Response " +
+ execution.getVariable("CAAIVfMod_queryGenericVnfResponse"), isDebugEnabled)
+ int code = execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode")
+ exceptionUtil.buildAndThrowWorkflowException(execution, code, "Error occurred attempting to query AAI")
+
+ }
+
+ // generates a WorkflowException if
+ // - the A&AI Generic VNF PUT returns a response code other than 200 or 201
+ // - the requested Generic VNF already exists but vnf-id == null
+ // - the requested Generic VNF does not exist but vnf-id != null
+ // - the A&AI VF Module PUT returns a response code other than 200 or 201
+ // - the requested VF Module already exists for the Generic VNF
+ public void handleCreateVfModuleFailure(Execution execution) {
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+
+ def errorCode
+ def errorResponse
+ if (execution.getVariable("CAAIVfMod_createGenericVnfResponseCode") != null &&
+ !isOneOf(execution.getVariable("CAAIVfMod_createGenericVnfResponseCode"), 200, 201)) {
+ utils.log("DEBUG", "Failure creating Generic VNF: " +
+ execution.getVariable("CAAIVfMod_createGenericVnfResponse"), isDebugEnabled)
+ errorResponse = execution.getVariable("CAAIVfMod_createGenericVnfResponse")
+ errorCode = 5000
+ } else if (execution.getVariable("CAAIVfMod_queryGenericVnfResponse") != null &&
+ execution.getVariable("CAAIVfMod_newGenericVnf") == true) {
+ // attempted to create a Generic VNF that already exists but vnf-id == null
+ utils.log("DEBUG", execution.getVariable("CAAIVfMod_queryGenericVnfResponse"), isDebugEnabled)
+ errorResponse = execution.getVariable("CAAIVfMod_queryGenericVnfResponse")
+ errorCode = 1002
+ } else if (execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") == 404 &&
+ execution.getVariable("CAAIVfMod_newGenericVnf") == false) {
+ // attempted to create a Generic VNF where vnf-name does not exist but vnf-id != null
+ utils.log("DEBUG", execution.getVariable("CAAIVfMod_queryGenericVnfResponse"), isDebugEnabled)
+ errorResponse = execution.getVariable("CAAIVfMod_queryGenericVnfResponse")
+ errorCode = 1002
+ } else if (execution.getVariable("CAAIVfMod_createVfModuleResponseCode") != null) {
+ utils.log("DEBUG", "Failed to add VF Module: " +
+ execution.getVariable("CAAIVfMod_createVfModuleResponse"), isDebugEnabled)
+ errorResponse = execution.getVariable("CAAIVfMod_createVfModuleResponse")
+ errorCode = 5000
+ } else if (execution.getVariable("CAAIVfMod_moduleExists") == true) {
+ utils.log("DEBUG", "Attempting to add VF Module that already exists: " +
+ execution.getVariable("CAAIVfMod_parseModuleResponse"), isDebugEnabled)
+ errorResponse = execution.getVariable("CAAIVfMod_parseModuleResponse")
+ errorCode = 1002
+ } else if (execution.getVariable("CAAIVfMod_baseModuleConflict") == true) {
+ utils.log("DEBUG", "Attempting to add Base VF Module to VNF that already has a Base VF Module: " +
+ execution.getVariable("CAAIVfMod_parseModuleResponse"), isDebugEnabled)
+ errorResponse = execution.getVariable("CAAIVfMod_parseModuleResponse")
+ errorCode = 1002
+ } else {
+ // if the responses get populated corerctly, we should never get here
+ errorResponse = "Unknown error occurred during CreateAAIVfModule flow"
+ errorCode = 2000
+ }
+
+ utils.log("ERROR", "Error occurred during CreateAAIVfModule flow: " + errorResponse, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, errorCode, errorResponse)
+ utils.logAudit("Workflow exception occurred in CreateAAIVfModule: " + errorResponse)
+ }
+
+ /**
+ * Performs a rollback.
+ * TBD: This method requires additional testing once integrated with the
+ * main CreateVfModule flow.
+ * @param execution the execution
+ */
+ public void rollback(Execution execution) {
+ def method = getClass().getSimpleName() + ".rollback(" +
+ "execution=" + execution.getId() +
+ ")"
+ def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled")
+ logDebug("Entered " + method, isDebugLogEnabled)
+
+ try {
+ RollbackData rollbackData = (RollbackData) execution.getVariable("RollbackData")
+ logDebug("RollbackData:" + rollbackData, isDebugLogEnabled)
+
+ AaiUtil aaiUriUtil = new AaiUtil(this)
+ def aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution)
+ logDebug('AAI URI is: ' + aai_uri, isDebugLogEnabled)
+ utils.logAudit("CreateAAIVfModule rollback AAI URI: " + aai_uri)
+
+ if (rollbackData != null) {
+ if (rollbackData.hasType("VFMODULE")) {
+ // use the DeleteAAIVfModule groovy methods for the rollback
+ def vnfId = rollbackData.get("VFMODULE", "vnfId")
+ def vfModuleId = rollbackData.get("VFMODULE", "vfModuleId")
+ def isBaseModule = rollbackData.get("VFMODULE", "isBaseModule")
+ execution.setVariable("DAAIVfMod_vnfId", vnfId)
+ execution.setVariable("DAAIVfMod_vfModuleId", vfModuleId)
+ execution.setVariable("DAAIVfMod_genericVnfEndpoint", "${aai_uri}/" + vnfId)
+ execution.setVariable("DAAIVfMod_vfModuleEndpoint", "${aai_uri}/" + vnfId +
+ "/vf-modules/vf-module/" + vfModuleId)
+ DeleteAAIVfModule dvm = new DeleteAAIVfModule()
+ // query A&AI to get the needed information for the delete(s)
+ dvm.queryAAIForGenericVnf(execution)
+ dvm.parseForVfModule(execution)
+
+ // roll back the base or add-on module
+ dvm.deleteVfModule(execution)
+ def responseCode = execution.getVariable("DAAIVfMod_deleteVfModuleResponseCode")
+ def response = execution.getVariable("DAAIVfMod_deleteVfModuleResponseCode")
+
+ if (isOneOf(responseCode, 200, 204)) {
+ logDebug("Received " + responseCode + " to VF Module rollback request", isDebugLogEnabled)
+// execution.setVariable("RollbackResult", "SUCCESS")
+ } else {
+ logError("Received " + responseCode + " to VF Module rollback request: " + rollbackData +
+ System.lineSeparator() + "Response: " + response)
+ }
+
+ // a new Generic VNF was created that needs to be rolled back
+ if (isBaseModule.equals("true")) {
+ dvm.deleteGenericVnf(execution)
+ responseCode = execution.getVariable("DAAIVfMod_deleteGenericVnfResponseCode")
+ response = execution.getVariable("DAAIVfMod_deleteGenericVnfResponse")
+
+ if (isOneOf(responseCode, 200, 204)) {
+ logDebug("Received " + responseCode + " to Generic VNF rollback request", isDebugLogEnabled)
+ execution.setVariable("RollbackResult", "SUCCESS")
+ } else {
+ logError("Received " + responseCode + " to Generic VNF rollback request: " + rollbackData +
+ System.lineSeparator() + "Response: " + response)
+ }
+ } else {
+ execution.setVariable("RollbackResult", "SUCCESS")
+ }
+ }
+ }
+
+ logDebug("Exited " + method, isDebugLogEnabled)
+ } catch (Exception e) {
+ logError("Caught exception in " + method, e)
+ }
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CreateAAIVfModuleVolumeGroup.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CreateAAIVfModuleVolumeGroup.groovy
index 03a8596f20..07b98e6231 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CreateAAIVfModuleVolumeGroup.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CreateAAIVfModuleVolumeGroup.groovy
@@ -1,332 +1,334 @@
-/*-
- * ============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.common.scripts
-
-import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.runtime.Execution
-import org.openecomp.mso.rest.APIResponse
-
-
-public class CreateAAIVfModuleVolumeGroup extends AbstractServiceTaskProcessor {
-
- private XmlParser xmlParser = new XmlParser()
-
- /**
- * Initialize the flow's variables.
- *
- * @param execution The flow's execution instance.
- */
- public void initProcessVariables(Execution execution) {
- execution.setVariable('prefix', 'CAAIVfModVG_')
- execution.setVariable('CAAIVfModVG_vnfId', null)
- execution.setVariable('CAAIVfModVG_vfModuleId', null)
- execution.setVariable('CAAIVfModVG_aicCloudRegion', null)
- execution.setVariable('CAAIVfModVG_volumeGroupId', null)
- execution.setVariable('CAAIVfModVG_getVfModuleResponseCode' ,null)
- execution.setVariable('CAAIVfModVG_getVfModuleResponse', '')
- execution.setVariable('CAAIVfModVG_updateVfModuleResponseCode', null)
- execution.setVariable('CAAIVfModVG_updateVfModuleResponse', '')
- }
-
- /**
- * Check for missing elements in the received request.
- *
- * @param execution The flow's execution instance.
- */
- public void preProcessRequest(Execution execution) {
- def method = getClass().getSimpleName() + '.preProcessRequest(' +
- 'execution=' + execution.getId() +
- ')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- try {
- def xml = execution.getVariable('CreateAAIVfModuleVolumeGroupRequest')
- logDebug('Received request xml:\n' + xml, isDebugLogEnabled)
- utils.logAudit("CreateAAIVfModuleVolume Received Request XML: " + xml)
- initProcessVariables(execution)
-
- def vnfId = getRequiredNodeText(execution, xml,'vnf-id')
- execution.setVariable('CAAIVfModVG_vnfId', vnfId)
-
- def vfModuleId = getRequiredNodeText(execution, xml,'vf-module-id')
- execution.setVariable('CAAIVfModVG_vfModuleId', vfModuleId)
-
- def aicCloudRegion = getRequiredNodeText(execution, xml,'aic-cloud-region')
- execution.setVariable('CAAIVfModVG_aicCloudRegion', aicCloudRegion)
-
- def volumeGroupId = getRequiredNodeText(execution, xml,'volume-group-id')
- execution.setVariable('CAAIVfModVG_volumeGroupId', volumeGroupId)
-
- logDebug('Exited ' + method, isDebugLogEnabled)
- } catch (BpmnError e) {
- throw e;
- } catch (Exception e) {
- logError('Caught exception in ' + method, e)
- createWorkflowException(execution, 1002, 'Error in preProcessRequest(): ' + e.getMessage())
- }
- }
-
- /**
- * Using the received vnfId and vfModuleId, query AAI to get the corresponding VF Module.
- * A 200 response is expected with the VF Module in the response body.
- *
- * @param execution The flow's execution instance.
- */
- public void getVfModule(Execution execution) {
- def method = getClass().getSimpleName() + '.getVfModule(' +
- 'execution=' + execution.getId() +
- ')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- try {
- def vnfId = execution.getVariable('CAAIVfModVG_vnfId')
- def vfModuleId = execution.getVariable('CAAIVfModVG_vfModuleId')
-
- // Construct endpoint
- AaiUtil aaiUtil = new AaiUtil(this)
- def aai_uri = aaiUtil.getNetworkGenericVnfUri(execution)
- logDebug('AAI URI is: ' + aai_uri, isDebugLogEnabled)
- String endPoint = execution.getVariable('URN_aai_endpoint') + aai_uri + '/' + URLEncoder.encode(vnfId, "UTF-8") + '/vf-modules/vf-module/' + URLEncoder.encode(vfModuleId, "UTF-8")
-
- try {
- logDebug('sending GET to AAI endpoint \'' + endPoint + '\'', isDebugLogEnabled)
- utils.logAudit("aaiResponse GET TO AAI Endpoint: " + endPoint)
- APIResponse response = aaiUtil.executeAAIGetCall(execution, endPoint)
- def responseData = response.getResponseBodyAsString()
- execution.setVariable('CAAIVfModVG_getVfModuleResponseCode', response.getStatusCode())
- execution.setVariable('CAAIVfModVG_getVfModuleResponse', responseData)
-
- utils.logAudit("CreateAAIVfModule Response Code: " + response.getStatusCode())
- utils.logAudit("CreateAAIVfModule Response: " + response)
- logDebug('Response code:' + response.getStatusCode(), isDebugLogEnabled)
- logDebug('Response:' + System.lineSeparator() + responseData, isDebugLogEnabled)
- } catch (Exception ex) {
- ex.printStackTrace()
- logDebug('Exception occurred while executing AAI GET:' + ex.getMessage(),isDebugLogEnabled)
- execution.setVariable('CAAIVfModVG_getVfModuleResponseCode', 500)
- execution.setVariable('CAAIVfModVG_getVfModuleResponse', 'AAI GET Failed:' + ex.getMessage())
- }
- logDebug('Exited ' + method, isDebugLogEnabled)
- } catch (BpmnError e) {
- throw e;
- } catch (Exception e) {
- logError('Caught exception in ' + method, e)
- createWorkflowException(execution, 1002, 'Error in getVfModule(): ' + e.getMessage())
- }
- }
-
- /**
- * Construct and send a PUT request to AAI to update the VF Module with the
- * created Volume Group relationship.
- *
- * @param execution The flow's execution instance.
- */
- public void updateVfModule(Execution execution) {
- def method = getClass().getSimpleName() + '.updateVfModule(' +
- 'execution=' + execution.getId() +
- ')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- try {
- def vnfId = execution.getVariable('CAAIVfModVG_vnfId')
- def vfModuleId = execution.getVariable('CAAIVfModVG_vfModuleId')
- def vfModule = execution.getVariable('CAAIVfModVG_getVfModuleResponse')
- def origRequest = execution.getVariable('CreateAAIVfModuleVolumeGroupRequest')
- def Node vfModuleNode = xmlParser.parseText(vfModule)
-
- // Confirm resource-version is in retrieved VF Module
- if (utils.getChildNode(vfModuleNode, 'resource-version') == null) {
- def msg = 'Can\'t update VF Module ' + vfModuleId + ' since \'resource-version\' is missing'
- logError(msg)
- throw new Exception(msg)
- }
-
- // Construct payload by creating a Volume Group relationhip and inserting it into the VF Module
- def aicCloudRegion = execution.getVariable('CAAIVfModVG_aicCloudRegion')
- def volumeGroupId = execution.getVariable('CAAIVfModVG_volumeGroupId')
- def Node vgRelationshipNode = createVolumeGroupRelationshipNode(aicCloudRegion, volumeGroupId)
- insertVolumeGroupRelationshipNode(vfModuleNode, vgRelationshipNode)
- def payload = utils.nodeToString(vfModuleNode)
-
- // Construct endpoint
- AaiUtil aaiUtil = new AaiUtil(this)
- def aai_uri = aaiUtil.getNetworkGenericVnfUri(execution)
- logDebug('AAI URI is: ' + aai_uri, isDebugLogEnabled)
- String endPoint = execution.getVariable('URN_aai_endpoint') + aai_uri + '/' + URLEncoder.encode(vnfId, "UTF-8") + '/vf-modules/vf-module/' + URLEncoder.encode(vfModuleId, "UTF-8")
-
- try {
- utils.logAudit("CreateAAIVfModuleVolume Sendind PUT to AAI Endpoint \n " + endPoint + " with payload \n " + payload)
- logDebug('sending PUT to AAI endpoint \'' + endPoint + '\'' + 'with payload \n' + payload, isDebugLogEnabled)
- APIResponse response = aaiUtil.executeAAIPutCall(execution, endPoint, payload)
- def responseData = response.getResponseBodyAsString()
- execution.setVariable('CAAIVfModVG_updateVfModuleResponseCode', response.getStatusCode())
- execution.setVariable('CAAIVfModVG_updateVfModuleResponse', responseData)
-
- utils.logAudit("CreateAAIVfModule Response code: " + response.getStatusCode())
- utils.logAudit("CreateAAIVfModule Response: " + responseData)
- logDebug('Response code:' + response.getStatusCode(), isDebugLogEnabled)
- logDebug('Response:' + System.lineSeparator() + responseData, isDebugLogEnabled)
- } catch (Exception ex) {
- ex.printStackTrace()
- logDebug('Exception occurred while executing AAI PUT:' + ex.getMessage(),isDebugLogEnabled)
- execution.setVariable('CAAIVfModVG_updateVfModuleResponseCode', 500)
- execution.setVariable('CAAIVfModVG_updateVfModuleResponse', 'AAI PUT Failed:' + ex.getMessage())
- }
- logDebug('Exited ' + method, isDebugLogEnabled)
- } catch (BpmnError e) {
- throw e;
- } catch (Exception e) {
- logError('Caught exception in ' + method, e)
- createWorkflowException(execution, 1002, 'Error in updateVfModule(): ' + e.getMessage())
- }
- }
-
- /**
- * Construct a Volume Group relationship Node with the given AIC Cloud Region and
- * Volume Group ID for insertion into a VF Module.
- *
- * @param aicCloudRegion Cloud Region ID to use in the Volume Group relationship
- * @param volumeGroupId Volume Group ID to use in the Volume Group relationship
- * @return a Node representing the new Volume Group relationship
- */
- private Node createVolumeGroupRelationshipNode(String aicCloudRegion, String volumeGroupId) {
-
- def Node relatedTo = new Node(null, 'related-to', 'volume-group')
-
- def Node relationshipKeyCO = new Node(null, 'relationship-key', 'cloud-region.cloud-owner')
- def Node relationshipValueCO = new Node(null, 'relationship-value', 'att-aic')
- def Node relationshipDataCO = new Node(null, 'relationship-data')
- relationshipDataCO.append(relationshipKeyCO)
- relationshipDataCO.append(relationshipValueCO)
-
- def Node relationshipKeyCRI = new Node(null, 'relationship-key', 'cloud-region.cloud-region-id')
- def Node relationshipValueCRI = new Node(null, 'relationship-value', aicCloudRegion)
- def Node relationshipDataCRI = new Node(null, 'relationship-data')
- relationshipDataCRI.append(relationshipKeyCRI)
- relationshipDataCRI.append(relationshipValueCRI)
-
- def Node relationshipKeyVGI = new Node(null, 'relationship-key', 'volume-group.volume-group-id')
- def Node relationshipValueVGI = new Node(null, 'relationship-value', volumeGroupId)
- def Node relationshipDataVGI = new Node(null, 'relationship-data')
- relationshipDataVGI.append(relationshipKeyVGI)
- relationshipDataVGI.append(relationshipValueVGI)
-
- def Node volumeGroupRelationship = new Node(null, 'relationship')
- volumeGroupRelationship.append(relatedTo)
- volumeGroupRelationship.append(relationshipDataCO)
- volumeGroupRelationship.append(relationshipDataCRI)
- volumeGroupRelationship.append(relationshipDataVGI)
-
- return volumeGroupRelationship;
- }
-
- /**
- * Insert the given Volume Group relationship Node into the given VF Module.
- * If the VF Module does NOT contain a relationship list:
- * - Create a relationship list containing the Volume Group relationship and insert it into the VF Module
- * If the VF Module contains a relationship list but not a Volume Group relationship:
- * - Insert the the Volume Group relationship into the relationship lsit
- * If the VF Module contains a relationship list and has a Volume Group relationship:
- * - Replace the existing Volume Group relationship with the new one
- * @param vfModuleNode
- * @param volumeGroupRelationshipNode
- */
- private void insertVolumeGroupRelationshipNode(Node vfModuleNode, Node volumeGroupRelationshipNode) {
- def Node relationshipList = utils.getChildNode(vfModuleNode, 'relationship-list')
- if (relationshipList == null) {
- relationshipList = new Node(null, 'relationship-list')
- relationshipList.append(volumeGroupRelationshipNode)
- vfModuleNode.append(relationshipList)
- } else {
- def Node currVolumeGroupRelationshipNode = getCurrVolumeGroupRelationshipNode(relationshipList)
- if (currVolumeGroupRelationshipNode == null) {
- relationshipList.append(volumeGroupRelationshipNode)
- } else {
- currVolumeGroupRelationshipNode.replaceNode(volumeGroupRelationshipNode)
- }
- }
- }
-
- /**
- * Find and return the value of the Volume Group ID for the specified VF Module. If
- * the value of the Volume Group ID cannot be found for any reason, 'null' is returned.
- *
- * @param vfModuleNode VF Module (as a Node) retrieved from AAI.
- * @return the value of the Volume Group ID for the specified VF Module. If the
- * value of the Volume Group ID cannot be found for any reason, 'null' is returned.
- */
- private Node getCurrVolumeGroupRelationshipNode(Node relationshipList) {
- def Node currVolumeGroupRelationshipNode = null
- def NodeList relationships = utils.getIdenticalChildren(relationshipList, 'relationship')
- for (Node relationshipNode in relationships) {
- def String relatedTo = utils.getChildNodeText(relationshipNode, 'related-to')
- if ((relatedTo != null) && relatedTo.equals('volume-group')) {
- currVolumeGroupRelationshipNode = relationshipNode
- }
- }
- return currVolumeGroupRelationshipNode
- }
-
- /**
- * Generates a WorkflowException if the AAI query returns a response code other than 200.
- *
- * @param execution The flow's execution instance.
- */
- public void handleAAIQueryFailure(Execution execution) {
- def method = getClass().getSimpleName() + '.handleAAIQueryFailure(' +
- 'execution=' + execution.getId() +
- ')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- logError('Error occurred attempting to query AAI, Response Code ' +
- execution.getVariable('CAAIVfModVG_getVfModuleResponseCode') + ', Error Response ' +
- execution.getVariable('CAAIVfModVG_getVfModuleResponse'))
- ExceptionUtil exceptionUtil = new ExceptionUtil()
- exceptionUtil.buildWorkflowException(execution, 5000, execution.getVariable('CAAIVfModVG_getVfModuleResponse'))
-
- logDebug('Exited ' + method, isDebugLogEnabled)
- }
-
- /**
- * Generates a WorkflowException if updating a VF Module in AAI returns a response code other than 200.
- *
- * @param execution The flow's execution instance.
- */
- public void handleUpdateVfModuleFailure(Execution execution) {
- def method = getClass().getSimpleName() + '.handleUpdateVfModuleFailure(' +
- 'execution=' + execution.getId() +
- ')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- logError('Error occurred attempting to update VF Module in AAI, Response Code ' +
- execution.getVariable('CAAIVfModVG_updateVfModuleResponseCode') + ', Error Response ' +
- execution.getVariable('CAAIVfModVG_updateVfModuleResponse'))
- ExceptionUtil exceptionUtil = new ExceptionUtil()
- exceptionUtil.buildWorkflowException(execution, 5000, execution.getVariable('CAAIVfModVG_updateVfModuleResponse'))
-
- logDebug('Exited ' + method, isDebugLogEnabled)
- }
-}
+/*-
+ * ============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.common.scripts
+
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.runtime.Execution
+import org.openecomp.mso.rest.APIResponse
+
+
+public class CreateAAIVfModuleVolumeGroup extends AbstractServiceTaskProcessor {
+
+ private XmlParser xmlParser = new XmlParser()
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+
+ /**
+ * Initialize the flow's variables.
+ *
+ * @param execution The flow's execution instance.
+ */
+ public void initProcessVariables(Execution execution) {
+ execution.setVariable('prefix', 'CAAIVfModVG_')
+ execution.setVariable('CAAIVfModVG_vnfId', null)
+ execution.setVariable('CAAIVfModVG_vfModuleId', null)
+ execution.setVariable('CAAIVfModVG_aicCloudRegion', null)
+ execution.setVariable('CAAIVfModVG_volumeGroupId', null)
+ execution.setVariable('CAAIVfModVG_getVfModuleResponseCode' ,null)
+ execution.setVariable('CAAIVfModVG_getVfModuleResponse', '')
+ execution.setVariable('CAAIVfModVG_updateVfModuleResponseCode', null)
+ execution.setVariable('CAAIVfModVG_updateVfModuleResponse', '')
+ }
+
+ /**
+ * Check for missing elements in the received request.
+ *
+ * @param execution The flow's execution instance.
+ */
+ public void preProcessRequest(Execution execution) {
+ def method = getClass().getSimpleName() + '.preProcessRequest(' +
+ 'execution=' + execution.getId() +
+ ')'
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ logDebug('Entered ' + method, isDebugLogEnabled)
+
+ try {
+ def xml = execution.getVariable('CreateAAIVfModuleVolumeGroupRequest')
+ logDebug('Received request xml:\n' + xml, isDebugLogEnabled)
+ utils.logAudit("CreateAAIVfModuleVolume Received Request XML: " + xml)
+ initProcessVariables(execution)
+
+ def vnfId = getRequiredNodeText(execution, xml,'vnf-id')
+ execution.setVariable('CAAIVfModVG_vnfId', vnfId)
+
+ def vfModuleId = getRequiredNodeText(execution, xml,'vf-module-id')
+ execution.setVariable('CAAIVfModVG_vfModuleId', vfModuleId)
+
+ def aicCloudRegion = getRequiredNodeText(execution, xml,'aic-cloud-region')
+ execution.setVariable('CAAIVfModVG_aicCloudRegion', aicCloudRegion)
+
+ def volumeGroupId = getRequiredNodeText(execution, xml,'volume-group-id')
+ execution.setVariable('CAAIVfModVG_volumeGroupId', volumeGroupId)
+
+ logDebug('Exited ' + method, isDebugLogEnabled)
+ } catch (BpmnError e) {
+ throw e;
+ } catch (Exception e) {
+ logError('Caught exception in ' + method, e)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preProcessRequest(): ' + e.getMessage())
+
+ }
+ }
+
+ /**
+ * Using the received vnfId and vfModuleId, query AAI to get the corresponding VF Module.
+ * A 200 response is expected with the VF Module in the response body.
+ *
+ * @param execution The flow's execution instance.
+ */
+ public void getVfModule(Execution execution) {
+ def method = getClass().getSimpleName() + '.getVfModule(' +
+ 'execution=' + execution.getId() +
+ ')'
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ logDebug('Entered ' + method, isDebugLogEnabled)
+
+ try {
+ def vnfId = execution.getVariable('CAAIVfModVG_vnfId')
+ def vfModuleId = execution.getVariable('CAAIVfModVG_vfModuleId')
+
+ // Construct endpoint
+ AaiUtil aaiUtil = new AaiUtil(this)
+ def aai_uri = aaiUtil.getNetworkGenericVnfUri(execution)
+ logDebug('AAI URI is: ' + aai_uri, isDebugLogEnabled)
+ String endPoint = execution.getVariable('URN_aai_endpoint') + aai_uri + '/' + URLEncoder.encode(vnfId, "UTF-8") + '/vf-modules/vf-module/' + URLEncoder.encode(vfModuleId, "UTF-8")
+
+ try {
+ logDebug('sending GET to AAI endpoint \'' + endPoint + '\'', isDebugLogEnabled)
+ utils.logAudit("aaiResponse GET TO AAI Endpoint: " + endPoint)
+ APIResponse response = aaiUtil.executeAAIGetCall(execution, endPoint)
+ def responseData = response.getResponseBodyAsString()
+ execution.setVariable('CAAIVfModVG_getVfModuleResponseCode', response.getStatusCode())
+ execution.setVariable('CAAIVfModVG_getVfModuleResponse', responseData)
+
+ utils.logAudit("CreateAAIVfModule Response Code: " + response.getStatusCode())
+ utils.logAudit("CreateAAIVfModule Response: " + response)
+ logDebug('Response code:' + response.getStatusCode(), isDebugLogEnabled)
+ logDebug('Response:' + System.lineSeparator() + responseData, isDebugLogEnabled)
+ } catch (Exception ex) {
+ ex.printStackTrace()
+ logDebug('Exception occurred while executing AAI GET:' + ex.getMessage(),isDebugLogEnabled)
+ execution.setVariable('CAAIVfModVG_getVfModuleResponseCode', 500)
+ execution.setVariable('CAAIVfModVG_getVfModuleResponse', 'AAI GET Failed:' + ex.getMessage())
+ }
+ logDebug('Exited ' + method, isDebugLogEnabled)
+ } catch (BpmnError e) {
+ throw e;
+ } catch (Exception e) {
+ logError('Caught exception in ' + method, e)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in getVfModule(): ' + e.getMessage())
+ }
+ }
+
+ /**
+ * Construct and send a PUT request to AAI to update the VF Module with the
+ * created Volume Group relationship.
+ *
+ * @param execution The flow's execution instance.
+ */
+ public void updateVfModule(Execution execution) {
+ def method = getClass().getSimpleName() + '.updateVfModule(' +
+ 'execution=' + execution.getId() +
+ ')'
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ logDebug('Entered ' + method, isDebugLogEnabled)
+
+ try {
+ def vnfId = execution.getVariable('CAAIVfModVG_vnfId')
+ def vfModuleId = execution.getVariable('CAAIVfModVG_vfModuleId')
+ def vfModule = execution.getVariable('CAAIVfModVG_getVfModuleResponse')
+ def origRequest = execution.getVariable('CreateAAIVfModuleVolumeGroupRequest')
+ def Node vfModuleNode = xmlParser.parseText(vfModule)
+
+ // Confirm resource-version is in retrieved VF Module
+ if (utils.getChildNode(vfModuleNode, 'resource-version') == null) {
+ def msg = 'Can\'t update VF Module ' + vfModuleId + ' since \'resource-version\' is missing'
+ logError(msg)
+ throw new Exception(msg)
+ }
+
+ // Construct payload by creating a Volume Group relationhip and inserting it into the VF Module
+ def aicCloudRegion = execution.getVariable('CAAIVfModVG_aicCloudRegion')
+ def volumeGroupId = execution.getVariable('CAAIVfModVG_volumeGroupId')
+ def Node vgRelationshipNode = createVolumeGroupRelationshipNode(aicCloudRegion, volumeGroupId)
+ insertVolumeGroupRelationshipNode(vfModuleNode, vgRelationshipNode)
+ def payload = utils.nodeToString(vfModuleNode)
+
+ // Construct endpoint
+ AaiUtil aaiUtil = new AaiUtil(this)
+ def aai_uri = aaiUtil.getNetworkGenericVnfUri(execution)
+ logDebug('AAI URI is: ' + aai_uri, isDebugLogEnabled)
+ String endPoint = execution.getVariable('URN_aai_endpoint') + aai_uri + '/' + URLEncoder.encode(vnfId, "UTF-8") + '/vf-modules/vf-module/' + URLEncoder.encode(vfModuleId, "UTF-8")
+
+ try {
+ utils.logAudit("CreateAAIVfModuleVolume Sendind PUT to AAI Endpoint \n " + endPoint + " with payload \n " + payload)
+ logDebug('sending PUT to AAI endpoint \'' + endPoint + '\'' + 'with payload \n' + payload, isDebugLogEnabled)
+ APIResponse response = aaiUtil.executeAAIPutCall(execution, endPoint, payload)
+ def responseData = response.getResponseBodyAsString()
+ execution.setVariable('CAAIVfModVG_updateVfModuleResponseCode', response.getStatusCode())
+ execution.setVariable('CAAIVfModVG_updateVfModuleResponse', responseData)
+
+ utils.logAudit("CreateAAIVfModule Response code: " + response.getStatusCode())
+ utils.logAudit("CreateAAIVfModule Response: " + responseData)
+ logDebug('Response code:' + response.getStatusCode(), isDebugLogEnabled)
+ logDebug('Response:' + System.lineSeparator() + responseData, isDebugLogEnabled)
+ } catch (Exception ex) {
+ ex.printStackTrace()
+ logDebug('Exception occurred while executing AAI PUT:' + ex.getMessage(),isDebugLogEnabled)
+ execution.setVariable('CAAIVfModVG_updateVfModuleResponseCode', 500)
+ execution.setVariable('CAAIVfModVG_updateVfModuleResponse', 'AAI PUT Failed:' + ex.getMessage())
+ }
+ logDebug('Exited ' + method, isDebugLogEnabled)
+ } catch (BpmnError e) {
+ throw e;
+ } catch (Exception e) {
+ logError('Caught exception in ' + method, e)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in updateVfModule(): ' + e.getMessage())
+ }
+ }
+
+ /**
+ * Construct a Volume Group relationship Node with the given AIC Cloud Region and
+ * Volume Group ID for insertion into a VF Module.
+ *
+ * @param aicCloudRegion Cloud Region ID to use in the Volume Group relationship
+ * @param volumeGroupId Volume Group ID to use in the Volume Group relationship
+ * @return a Node representing the new Volume Group relationship
+ */
+ private Node createVolumeGroupRelationshipNode(String aicCloudRegion, String volumeGroupId) {
+
+ def Node relatedTo = new Node(null, 'related-to', 'volume-group')
+
+ def Node relationshipKeyCO = new Node(null, 'relationship-key', 'cloud-region.cloud-owner')
+ def Node relationshipValueCO = new Node(null, 'relationship-value', 'att-aic')
+ def Node relationshipDataCO = new Node(null, 'relationship-data')
+ relationshipDataCO.append(relationshipKeyCO)
+ relationshipDataCO.append(relationshipValueCO)
+
+ def Node relationshipKeyCRI = new Node(null, 'relationship-key', 'cloud-region.cloud-region-id')
+ def Node relationshipValueCRI = new Node(null, 'relationship-value', aicCloudRegion)
+ def Node relationshipDataCRI = new Node(null, 'relationship-data')
+ relationshipDataCRI.append(relationshipKeyCRI)
+ relationshipDataCRI.append(relationshipValueCRI)
+
+ def Node relationshipKeyVGI = new Node(null, 'relationship-key', 'volume-group.volume-group-id')
+ def Node relationshipValueVGI = new Node(null, 'relationship-value', volumeGroupId)
+ def Node relationshipDataVGI = new Node(null, 'relationship-data')
+ relationshipDataVGI.append(relationshipKeyVGI)
+ relationshipDataVGI.append(relationshipValueVGI)
+
+ def Node volumeGroupRelationship = new Node(null, 'relationship')
+ volumeGroupRelationship.append(relatedTo)
+ volumeGroupRelationship.append(relationshipDataCO)
+ volumeGroupRelationship.append(relationshipDataCRI)
+ volumeGroupRelationship.append(relationshipDataVGI)
+
+ return volumeGroupRelationship;
+ }
+
+ /**
+ * Insert the given Volume Group relationship Node into the given VF Module.
+ * If the VF Module does NOT contain a relationship list:
+ * - Create a relationship list containing the Volume Group relationship and insert it into the VF Module
+ * If the VF Module contains a relationship list but not a Volume Group relationship:
+ * - Insert the the Volume Group relationship into the relationship lsit
+ * If the VF Module contains a relationship list and has a Volume Group relationship:
+ * - Replace the existing Volume Group relationship with the new one
+ * @param vfModuleNode
+ * @param volumeGroupRelationshipNode
+ */
+ private void insertVolumeGroupRelationshipNode(Node vfModuleNode, Node volumeGroupRelationshipNode) {
+ def Node relationshipList = utils.getChildNode(vfModuleNode, 'relationship-list')
+ if (relationshipList == null) {
+ relationshipList = new Node(null, 'relationship-list')
+ relationshipList.append(volumeGroupRelationshipNode)
+ vfModuleNode.append(relationshipList)
+ } else {
+ def Node currVolumeGroupRelationshipNode = getCurrVolumeGroupRelationshipNode(relationshipList)
+ if (currVolumeGroupRelationshipNode == null) {
+ relationshipList.append(volumeGroupRelationshipNode)
+ } else {
+ currVolumeGroupRelationshipNode.replaceNode(volumeGroupRelationshipNode)
+ }
+ }
+ }
+
+ /**
+ * Find and return the value of the Volume Group ID for the specified VF Module. If
+ * the value of the Volume Group ID cannot be found for any reason, 'null' is returned.
+ *
+ * @param vfModuleNode VF Module (as a Node) retrieved from AAI.
+ * @return the value of the Volume Group ID for the specified VF Module. If the
+ * value of the Volume Group ID cannot be found for any reason, 'null' is returned.
+ */
+ private Node getCurrVolumeGroupRelationshipNode(Node relationshipList) {
+ def Node currVolumeGroupRelationshipNode = null
+ def NodeList relationships = utils.getIdenticalChildren(relationshipList, 'relationship')
+ for (Node relationshipNode in relationships) {
+ def String relatedTo = utils.getChildNodeText(relationshipNode, 'related-to')
+ if ((relatedTo != null) && relatedTo.equals('volume-group')) {
+ currVolumeGroupRelationshipNode = relationshipNode
+ }
+ }
+ return currVolumeGroupRelationshipNode
+ }
+
+ /**
+ * Generates a WorkflowException if the AAI query returns a response code other than 200.
+ *
+ * @param execution The flow's execution instance.
+ */
+ public void handleAAIQueryFailure(Execution execution) {
+ def method = getClass().getSimpleName() + '.handleAAIQueryFailure(' +
+ 'execution=' + execution.getId() +
+ ')'
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ logDebug('Entered ' + method, isDebugLogEnabled)
+
+ logError('Error occurred attempting to query AAI, Response Code ' +
+ execution.getVariable('CAAIVfModVG_getVfModuleResponseCode') + ', Error Response ' +
+ execution.getVariable('CAAIVfModVG_getVfModuleResponse'))
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+ exceptionUtil.buildWorkflowException(execution, 5000, execution.getVariable('CAAIVfModVG_getVfModuleResponse'))
+
+ logDebug('Exited ' + method, isDebugLogEnabled)
+ }
+
+ /**
+ * Generates a WorkflowException if updating a VF Module in AAI returns a response code other than 200.
+ *
+ * @param execution The flow's execution instance.
+ */
+ public void handleUpdateVfModuleFailure(Execution execution) {
+ def method = getClass().getSimpleName() + '.handleUpdateVfModuleFailure(' +
+ 'execution=' + execution.getId() +
+ ')'
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ logDebug('Entered ' + method, isDebugLogEnabled)
+
+ logError('Error occurred attempting to update VF Module in AAI, Response Code ' +
+ execution.getVariable('CAAIVfModVG_updateVfModuleResponseCode') + ', Error Response ' +
+ execution.getVariable('CAAIVfModVG_updateVfModuleResponse'))
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+ exceptionUtil.buildWorkflowException(execution, 5000, execution.getVariable('CAAIVfModVG_updateVfModuleResponse'))
+
+ logDebug('Exited ' + method, isDebugLogEnabled)
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CreateGenericVNFUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CreateGenericVNFUtils.groovy
index ffc706d263..887eb7456d 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CreateGenericVNFUtils.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CreateGenericVNFUtils.groovy
@@ -77,7 +77,7 @@ class CreateGenericVNFUtils{
String uuid = execution.getVariable('testReqId') // for junits
if(uuid==null){
- uuid = execution.getVariable("att-mso-request-id") + "-" + System.currentTimeMillis()
+ uuid = execution.getVariable("mso-request-id") + "-" + System.currentTimeMillis()
}
def callbackURL = execution.getVariable("CRTGVNF_sdncCallbackUrl")
def requestId = execution.getVariable("CRTGVNF_requestId")
@@ -96,9 +96,9 @@ class CreateGenericVNFUtils{
}
String sdncRequest =
- """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://ecomp.att.com/mso/request/types/v1"
- xmlns:sdncadapterworkflow="http://ecomp.att.com/mso/workflow/schema/v1"
- xmlns:sdncadapter="http://domain2.att.com/workflow/sdnc/adapter/schema/v1">
+ """<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>${uuid}</sdncadapter:RequestId>
<sdncadapter:SvcInstanceId>${svcInstId}</sdncadapter:SvcInstanceId>
@@ -155,122 +155,6 @@ ${sdncVNFParamsXml}
}
return params
}
-
- /**
- * Builds a "CompletionHandler" request and stores it in the specified
- * execution variable.
- * @param execution the execution
- */
- public void buildCompletionHandlerRequest(Execution execution, String flowName) {
- def method = getClass().getSimpleName() + '.completionHandlerPrep(' +
- 'execution=' + execution.getId() +
- ')'
- def prefix = execution.getVariable('prefix')
- def resultVar = prefix + "CompletionHandlerRequest"
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- taskProcessor.logDebug('Entered ' + method, isDebugLogEnabled)
-
- try {
- def request = taskProcessor.getVariable(execution, prefix+'Request')
- def requestInformation = taskProcessor.utils.getNodeXml(request, 'request-information', false)
- if (requestInformation == null || requestInformation == ""){
- requestInformation = taskProcessor.utils.getNodeXml(request, 'request-info', false)
- }
-
- String content = """
- <sdncadapterworkflow:MsoCompletionRequest xmlns:sdncadapterworkflow="http://ecomp.att.com/mso/workflow/schema/v1"
- xmlns:reqtype="http://ecomp.att.com/mso/request/types/v1">
- ${requestInformation}
- <sdncadapterworkflow:mso-bpel-name>${flowName}</sdncadapterworkflow:mso-bpel-name>
- </sdncadapterworkflow:MsoCompletionRequest>
- """
-
- content = taskProcessor.utils.removeXmlPreamble(taskProcessor.utils.formatXML(content))
- taskProcessor.logDebug(resultVar + ' = ' + System.lineSeparator() + content, isDebugLogEnabled)
- execution.setVariable(resultVar, content)
-
- taskProcessor.logDebug('Exited ' + method, isDebugLogEnabled)
- } catch (BpmnError e) {
- throw e;
- } catch (Exception e) {
- taskProcessor.logError('Caught exception in ' + method, e)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error Occured during completion handler request")
- }
- }
-
- /**
- * Builds a "FalloutHandler" request and stores it in the specified
- * execution variable.
- * @param execution the execution
- */
- public void buildfalloutHandlerRequest(Execution execution) {
- def method = getClass().getSimpleName() + '.falloutHandlerPrep(' +
- 'execution=' + execution.getId() +
- ')'
- def prefix = execution.getVariable('prefix')
- def resultVar = prefix + "FalloutHandlerRequest"
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- taskProcessor.logDebug('Entered ' + method, isDebugLogEnabled)
- try {
- def request = taskProcessor.getVariable(execution, prefix+'Request')
-
- def requestInformation = ""
- if (request != null){
- requestInformation = taskProcessor.utils.getNodeXml(request, 'request-information', false)
- if (requestInformation == null || requestInformation == ""){
- requestInformation = taskProcessor.utils.getNodeXml(request, 'request-info', false)
- }
- }
- def errorInformation = ""
- def encErrorResponseMsg = ""
- def errorResponseCode = ""
- String content = ""
-
- def WorkflowException workflowException
- def exception = execution.getVariable("WorkflowException")
-
- if (exception instanceof WorkflowException)
- {
- workflowException = execution.getVariable("WorkflowException")
- }
-
- if (workflowException != null){
- errorResponseCode = workflowException.getErrorCode()
- def errorResponseMsg = workflowException.getErrorMessage()
-
- if (errorResponseMsg != null) {
- encErrorResponseMsg = errorResponseMsg.replace("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;")
- }
-
- errorInformation = """<aetgt:WorkflowException xmlns:aetgt="http://ecomp.att.com/mso/workflow/schema/v1">
- <aetgt:ErrorMessage>${encErrorResponseMsg}</aetgt:ErrorMessage>
- <aetgt:ErrorCode>${errorResponseCode}</aetgt:ErrorCode>
- </aetgt:WorkflowException>"""
- }
- else {
- errorInformation = execution.getVariable(prefix+'ErrorResponse')
-
- if (errorInformation == null) errorInformation = ""
- }
-
- content = """
- <wfsch:FalloutHandlerRequest xmlns:wfsch="http://ecomp.att.com/mso/workflow/schema/v1"
- xmlns:reqtype="http://ecomp.att.com/mso/request/types/v1">
- ${requestInformation}
- ${errorInformation}
- </wfsch:FalloutHandlerRequest>
- """
-
- content = taskProcessor.utils.removeXmlPreamble(taskProcessor.utils.formatXML(content))
-
- taskProcessor.logDebug(resultVar + ' = ' + System.lineSeparator() + content, isDebugLogEnabled)
- execution.setVariable(resultVar, content)
- taskProcessor.logDebug('Exited ' + method, isDebugLogEnabled)
- } catch (Exception e) {
- taskProcessor.logError('Caught exception in ' + method, e)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error in buildfalloutHandlerRequest")
- }
- }
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/DeleteAAIVfModule.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/DeleteAAIVfModule.groovy
index ca9a2e0849..72ad1402e1 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/DeleteAAIVfModule.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/DeleteAAIVfModule.groovy
@@ -1,334 +1,349 @@
-/*-
- * ============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.common.scripts
-import org.camunda.bpm.engine.runtime.Execution
-import org.openecomp.mso.bpmn.core.WorkflowException
-import org.openecomp.mso.rest.APIResponse
-
-
-public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{
-
- def Prefix="DAAIVfMod_"
-
- public void initProcessVariables(Execution execution) {
- execution.setVariable("prefix",Prefix)
- execution.setVariable("DAAIVfMod_vnfId",null)
- execution.setVariable("DAAIVfMod_vnfName",null)
- execution.setVariable("DAAIVfMod_genVnfRsrcVer",null)
- execution.setVariable("DAAIVfMod_vfModuleId",null)
- execution.setVariable("DAAIVfMod_vfModRsrcVer",null)
- execution.setVariable("DAAIVfMod_genericVnfEndpoint",null)
- execution.setVariable("DAAIVfMod_vfModuleEndpoint",null)
- execution.setVariable("DAAIVfMod_moduleExists",false)
- execution.setVariable("DAAIVfMod_isBaseModule", false)
- execution.setVariable("DAAIVfMod_isLastModule", false)
-
- // DeleteAAIVfModule workflow response variable placeholders
- execution.setVariable("DAAIVfMod_queryGenericVnfResponseCode",null)
- execution.setVariable("DAAIVfMod_queryGenericVnfResponse","")
- execution.setVariable("DAAIVfMod_parseModuleResponse","")
- execution.setVariable("DAAIVfMod_deleteGenericVnfResponseCode",null)
- execution.setVariable("DAAIVfMod_deleteGenericVnfResponse","")
- execution.setVariable("DAAIVfMod_deleteVfModuleResponseCode",null)
- execution.setVariable("DAAIVfMod_deleteVfModuleResponse","")
-
- }
-
- // parse the incoming DELETE_VF_MODULE request and store the Generic Vnf
- // and Vf Module Ids in the flow Execution
- public void preProcessRequest(Execution execution) {
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- def xml = execution.getVariable("DeleteAAIVfModuleRequest")
- utils.logAudit("DeleteAAIVfModule Request: " + xml)
- utils.log("DEBUG", "input request xml:" + xml, isDebugEnabled)
- initProcessVariables(execution)
- def vnfId = utils.getNodeText(xml,"vnf-id")
- def vfModuleId = utils.getNodeText(xml,"vf-module-id")
- execution.setVariable("DAAIVfMod_vnfId", vnfId)
- execution.setVariable("DAAIVfMod_vfModuleId", vfModuleId)
-
- AaiUtil aaiUriUtil = new AaiUtil(this)
- def aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution)
- logDebug('AAI URI is: ' + aai_uri, isDebugEnabled)
-
- execution.setVariable("DAAIVfMod_genericVnfEndpoint", "${aai_uri}/" + vnfId)
- execution.setVariable("DAAIVfMod_vfModuleEndpoint", "${aai_uri}/" + vnfId +
- "/vf-modules/vf-module/" + vfModuleId)
- }
-
- // send a GET request to AA&I to retrieve the Generic Vnf/Vf Module information based on a Vnf Id
- // expect a 200 response with the information in the response body or a 404 if the Generic Vnf does not exist
- public void queryAAIForGenericVnf(Execution execution) {
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- def delModuleId = execution.getVariable("DAAIVfMod_vfModuleId")
- def endPoint = execution.getVariable("URN_aai_endpoint") + execution.getVariable("DAAIVfMod_genericVnfEndpoint") + "?depth=1"
- utils.logAudit("DeleteAAIVfModule endPoint: " + endPoint)
- def aaiRequestId = UUID.randomUUID().toString()
-
- utils.log("DEBUG","queryAAIForGenericVnf() endpoint-" + endPoint, isDebugEnabled)
- def responseData = ""
- try {
- utils.log("DEBUG", "invoking GET call to AAI endpoint :"+System.lineSeparator()+endPoint,isDebugEnabled)
- utils.logAudit("DeleteAAIVfModule - invoking httpGet to AAI")
-
- AaiUtil aaiUtil = new AaiUtil(this)
- APIResponse response = aaiUtil.executeAAIGetCall(execution, endPoint)
-
- responseData = response.getResponseBodyAsString()
- execution.setVariable("DAAIVfMod_queryGenericVnfResponseCode", response.getStatusCode())
- execution.setVariable("DAAIVfMod_queryGenericVnfResponse", responseData)
- utils.logAudit("AAI Response: " + responseData)
- utils.log("DEBUG", "Response code:" + response.getStatusCode(), isDebugEnabled)
- utils.log("DEBUG", "Response:" + System.lineSeparator()+responseData,isDebugEnabled)
- } catch (Exception ex) {
- ex.printStackTrace()
- utils.log("DEBUG", "Exception occurred while executing AAI GET:" + ex.getMessage(),isDebugEnabled)
- execution.setVariable("DAAIVfMod_queryGenericVnfResponseCode", 500)
- execution.setVariable("DAAIVfMod_queryGenericVnfResponse", "AAI GET Failed:" + ex.getMessage())
- }
- }
-
- // construct and send a DELETE request to A&AI to delete a Generic Vnf
- // note: to get here, all the modules associated with the Generic Vnf must already be deleted
- public void deleteGenericVnf(Execution execution) {
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- def aaiRequestId = UUID.randomUUID().toString()
- def endPoint = execution.getVariable("URN_aai_endpoint") + execution.getVariable("DAAIVfMod_genericVnfEndpoint") +
- "/?resource-version=" + execution.getVariable("DAAIVfMod_genVnfRsrcVer")
- utils.logAudit("AAI endPoint: " + endPoint)
- utils.log("DEBUG","deleteGenericVnf() endpoint-" + endPoint, isDebugEnabled)
- def responseData = ""
- try {
- AaiUtil aaiUtil = new AaiUtil(this)
- APIResponse response = aaiUtil.executeAAIDeleteCall(execution, endPoint)
-
- responseData = response.getResponseBodyAsString()
- execution.setVariable("DAAIVfMod_deleteGenericVnfResponseCode", response.getStatusCode())
- execution.setVariable("DAAIVfMod_deleteGenericVnfResponse", responseData)
- utils.log("DEBUG", "Response code:" + response.getStatusCode(), isDebugEnabled)
- utils.log("DEBUG", "Response:" + System.lineSeparator()+responseData,isDebugEnabled)
- } catch (Exception ex) {
- ex.printStackTrace()
- utils.log("DEBUG", "Exception occurred while executing AAI DELETE:" + ex.getMessage(),isDebugEnabled)
- execution.setVariable("DAAIVfMod_deleteGenericVnfResponseCode", 500)
- execution.setVariable("DAAIVfMod_deleteGenericVnfResponse", "AAI DELETE Failed:" + ex.getMessage())
- }
- }
-
- // construct and send a DELETE request to A&AI to delete the Base or Add-on Vf Module
- public void deleteVfModule(Execution execution) {
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- def endPoint = execution.getVariable("URN_aai_endpoint") + execution.getVariable("DAAIVfMod_vfModuleEndpoint") +
- "/?resource-version=" + execution.getVariable("DAAIVfMod_vfModRsrcVer")
- def aaiRequestId = UUID.randomUUID().toString()
-
- utils.log("DEBUG","deleteVfModule() endpoint-" + endPoint, isDebugEnabled)
- def responseData = ""
- try {
- AaiUtil aaiUtil = new AaiUtil(this)
- APIResponse response = aaiUtil.executeAAIDeleteCall(execution, endPoint)
-
- utils.logAudit("DeleteAAIVfModule - invoking httpDelete to AAI")
-
- responseData = response.getResponseBodyAsString()
- execution.setVariable("DAAIVfMod_deleteVfModuleResponseCode", response.getStatusCode())
- execution.setVariable("DAAIVfMod_deleteVfModuleResponse", responseData)
- utils.logAudit("DeleteAAIVfModule - AAI Response" + responseData)
- utils.log("DEBUG", "Response code:" + response.getStatusCode(), isDebugEnabled)
- utils.log("DEBUG", "Response:" + System.lineSeparator()+responseData,isDebugEnabled)
-
- } catch (Exception ex) {
- ex.printStackTrace()
- utils.log("DEBUG", "Exception occurred while executing AAI PUT:" + ex.getMessage(),isDebugEnabled)
- execution.setVariable("DAAIVfMod_deleteVfModuleResponseCode", 500)
- execution.setVariable("DAAIVfMod_deleteVfModuleResponse", "AAI PUT Failed:" + ex.getMessage())
- }
- }
-
- // parses the output from the result from queryAAIForGenericVnf() to determine if the Vf Module
- // to be deleted exists for the specified Generic Vnf and if it is the Base Module,
- // there are no Add-on Modules present
- public void parseForVfModule(Execution execution) {
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- def xml = execution.getVariable("DAAIVfMod_queryGenericVnfResponse")
- utils.logAudit("DeleteAAIVfModule - queryGenericVnfResponse" + xml)
-
- def delModuleId = execution.getVariable("DAAIVfMod_vfModuleId")
- utils.log("DEBUG", "Vf Module to be deleted: " + delModuleId, isDebugEnabled)
- List <String> qryModuleIdList = utils.getMultNodes(xml, "vf-module-id")
- List <String> qryBaseModuleList = utils.getMultNodes(xml, "is-base-vf-module")
- List <String> qryResourceVerList = utils.getMultNodes(xml, "resource-version")
- execution.setVariable("DAAIVfMod_moduleExists", false)
- execution.setVariable("DAAIVfMod_isBaseModule", false)
- execution.setVariable("DAAIVfMod_isLastModule", false)
- //
- def isBaseVfModule = "false"
- // loop through the Vf Module Ids looking for a match
- if (qryModuleIdList != null && !qryModuleIdList.empty) {
- utils.log("DEBUG", "Existing Vf Module Id List: " + qryModuleIdList, isDebugEnabled)
- utils.log("DEBUG", "Existing Vf Module Resource Version List: " + qryResourceVerList, isDebugEnabled)
- def moduleCntr = 0
- // the Generic Vnf resource-version in the 1st entry in the query response
- execution.setVariable("DAAIVfMod_genVnfRsrcVer", qryResourceVerList[moduleCntr])
- for (String qryModuleId : qryModuleIdList) {
- if (delModuleId.equals(qryModuleId)) {
- // a Vf Module with the requested Id exists
- execution.setVariable("DAAIVfMod_moduleExists", true)
- // find the corresponding value for the is-base-vf-module field
- isBaseVfModule = qryBaseModuleList[moduleCntr]
- // find the corresponding value for the resource-version field
- // note: the Generic Vnf entry also has a resource-version field, so
- // add 1 to the index to get the corresponding Vf Module value
- execution.setVariable("DAAIVfMod_vfModRsrcVer", qryResourceVerList[moduleCntr+1])
- utils.log("DEBUG", "Match found for Vf Module Id " + qryModuleId + " for Generic Vnf Id " +
- execution.getVariable("DAAIVfMod_vnfId") + ", Base Module is " + isBaseVfModule +
- ", Resource Version is " + execution.getVariable("vfModRsrcVer"), isDebugEnabled)
- break
- }
- moduleCntr++
- }
- }
-
- // determine if the module to be deleted is a Base Module and/or the Last Module
- if (execution.getVariable("DAAIVfMod_moduleExists") == true) {
- if (isBaseVfModule.equals("true") && qryModuleIdList.size() != 1) {
- execution.setVariable("DAAIVfMod_parseModuleResponse",
- "Found Vf Module Id " + delModuleId + " for Generic Vnf Id " +
- execution.getVariable("DAAIVfMod_vnfId") + ": is Base Module, not Last Module")
- execution.setVariable("DAAIVfMod_isBaseModule", true)
- } else {
- if (isBaseVfModule.equals("true") && qryModuleIdList.size() == 1) {
- execution.setVariable("DAAIVfMod_parseModuleResponse",
- "Found Vf Module Id " + delModuleId + " for Generic Vnf Id " +
- execution.getVariable("DAAIVfMod_vnfId") + ": is Base Module and Last Module")
- execution.setVariable("DAAIVfMod_isBaseModule", true)
- execution.setVariable("DAAIVfMod_isLastModule", true)
- } else {
- if (qryModuleIdList.size() == 1) {
- execution.setVariable("DAAIVfMod_parseModuleResponse",
- "Found Vf Module Id " + delModuleId + " for Generic Vnf Id " +
- execution.getVariable("DAAIVfMod_vnfId") + ": is Not Base Module, is Last Module")
- execution.setVariable("DAAIVfMod_isLastModule", true)
- } else {
- execution.setVariable("DAAIVfMod_parseModuleResponse",
- "Found Vf Module Id " + delModuleId + " for Generic Vnf Id " +
- execution.getVariable("DAAIVfMod_vnfId") + ": is Not Base Module and Not Last Module")
- }
- }
- }
- utils.log("DEBUG", execution.getVariable("DAAIVfMod_parseModuleResponse"), isDebugEnabled)
- } else { // (execution.getVariable("DAAIVfMod_moduleExists") == false)
- utils.log("DEBUG", "Vf Module Id " + delModuleId + " does not exist for Generic Vnf Id " +
- execution.getVariable("DAAIVfMod_vnfId"), isDebugEnabled)
- execution.setVariable("DAAIVfMod_parseModuleResponse",
- "Vf Module Id " + delModuleId + " does not exist for Generic Vnf Id " +
- execution.getVariable("DAAIVfMod_vnfName"))
- }
- }
-
- // parses the output from the result from queryAAIForGenericVnf() to determine if the Vf Module
- // to be deleted exists for the specified Generic Vnf and if it is the Base Module,
- // there are no Add-on Modules present
- public void parseForResourceVersion(Execution execution) {
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- def xml = execution.getVariable("DAAIVfMod_queryGenericVnfResponse")
- utils.logAudit("DeleteAAIVfModule - queryGenericVnfResponse" + xml)
- String resourceVer = utils.getNodeText1(xml, "resource-version")
- execution.setVariable("DAAIVfMod_genVnfRsrcVer", resourceVer)
- utils.log("DEBUG", "Latest Generic VNF Resource Version: " + resourceVer)
- }
-
-
- // generates a WorkflowException if the A&AI query returns a response code other than 200
- public void handleAAIQueryFailure(Execution execution) {
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
-
- utils.log("ERROR", "Error occurred attempting to query AAI, Response Code " +
- execution.getVariable("DAAIVfMod_queryGenericVnfResponseCode") + ", Error Response " +
- execution.getVariable("DAAIVfMod_queryGenericVnfResponse"), isDebugEnabled)
- def errorCode = 5000
- // set the errorCode to distinguish between a A&AI failure
- // and the Generic Vnf Id not found
- if (execution.getVariable("DAAIVfMod_queryGenericVnfResponseCode") == 404) {
- errorCode = 1002
- }
- String processKey = getProcessKey(execution);
- WorkflowException exception = new WorkflowException(processKey, errorCode,
- execution.getVariable("DAAIVfMod_queryGenericVnfResponse"))
- execution.setVariable("WorkflowException", exception)
- }
-
- // generates a WorkflowException if
- // - the A&AI Vf Module DELETE returns a response code other than 200
- // - the Vf Module is a Base Module that is not the last Vf Module
- // - the Vf Module does not exist for the Generic Vnf
- public void handleDeleteVfModuleFailure(Execution execution) {
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
-
- def errorCode = 2000
- def errorResponse = ""
- if (execution.getVariable("DAAIVfMod_deleteVfModuleResponseCode") != null &&
- execution.getVariable("DAAIVfMod_deleteVfModuleResponseCode") != 200) {
- utils.log("DEBUG", "AAI failure deleting a Vf Module: " +
- execution.getVariable("DAAIVfMod_deleteVfModuleResponse"), isDebugEnabled)
- errorResponse = execution.getVariable("DAAIVfMod_deleteVfModuleResponse")
- utils.logAudit("DeleteAAIVfModule - deleteVfModuleResponse" + errorResponse)
- errorCode = 5000
- } else {
- if (execution.getVariable("DAAIVfMod_isBaseModule", true) == true &&
- execution.getVariable("DAAIVfMod_isLastModule") == false) {
- // attempt to delete a Base Module that is not the last Vf Module
- utils.log("DEBUG", execution.getVariable("DAAIVfMod_parseModuleResponse"), isDebugEnabled)
- errorResponse = execution.getVariable("DAAIVfMod_parseModuleResponse")
- utils.logAudit("DeleteAAIVfModule - parseModuleResponse" + errorResponse)
- errorCode = 1002
- } else {
- // attempt to delete a non-existant Vf Module
- if (execution.getVariable("DAAIVfMod_moduleExists") == false) {
- utils.log("DEBUG", execution.getVariable("DAAIVfMod_parseModuleResponse"), isDebugEnabled)
- errorResponse = execution.getVariable("DAAIVfMod_parseModuleResponse")
- utils.logAudit("DeleteAAIVfModule - parseModuleResponse" + errorResponse)
- errorCode = 1002
- } else {
- // if the responses get populated corerctly, we should never get here
- errorResponse = "Unknown error occurred during DeleteAAIVfModule flow"
- }
- }
- }
-
- utils.log("ERROR", "Error occurred during DeleteAAIVfModule flow: " + errorResponse, isDebugEnabled)
- String processKey = getProcessKey(execution);
- WorkflowException exception = new WorkflowException(processKey, errorCode, errorResponse)
- execution.setVariable("WorkflowException", exception)
- }
-
- // generates a WorkflowException if
- // - the A&AI Generic Vnf DELETE returns a response code other than 200
- public void handleDeleteGenericVnfFailure(Execution execution) {
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- utils.log("ERROR", "AAI error occurred deleting the Generic Vnf: "
- + execution.getVariable("DAAIVfMod_deleteGenericVnfResponse"), isDebugEnabled)
- String processKey = getProcessKey(execution);
- WorkflowException exception = new WorkflowException(processKey, 5000,
- execution.getVariable("DAAIVfMod_deleteGenericVnfResponse"))
- execution.setVariable("WorkflowException", exception)
- }
+/*-
+ * ============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.common.scripts
+import org.camunda.bpm.engine.runtime.Execution
+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;
+
+
+public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{
+
+ def Prefix="DAAIVfMod_"
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+ public void initProcessVariables(Execution execution) {
+ execution.setVariable("prefix",Prefix)
+ execution.setVariable("DAAIVfMod_vnfId",null)
+ execution.setVariable("DAAIVfMod_vnfName",null)
+ execution.setVariable("DAAIVfMod_genVnfRsrcVer",null)
+ execution.setVariable("DAAIVfMod_vfModuleId",null)
+ execution.setVariable("DAAIVfMod_vfModRsrcVer",null)
+ execution.setVariable("DAAIVfMod_genericVnfEndpoint",null)
+ execution.setVariable("DAAIVfMod_vfModuleEndpoint",null)
+ execution.setVariable("DAAIVfMod_moduleExists",false)
+ execution.setVariable("DAAIVfMod_isBaseModule", false)
+ execution.setVariable("DAAIVfMod_isLastModule", false)
+
+ // DeleteAAIVfModule workflow response variable placeholders
+ execution.setVariable("DAAIVfMod_queryGenericVnfResponseCode",null)
+ execution.setVariable("DAAIVfMod_queryGenericVnfResponse","")
+ execution.setVariable("DAAIVfMod_parseModuleResponse","")
+ execution.setVariable("DAAIVfMod_deleteGenericVnfResponseCode",null)
+ execution.setVariable("DAAIVfMod_deleteGenericVnfResponse","")
+ execution.setVariable("DAAIVfMod_deleteVfModuleResponseCode",null)
+ execution.setVariable("DAAIVfMod_deleteVfModuleResponse","")
+
+ }
+
+ // parse the incoming DELETE_VF_MODULE request and store the Generic Vnf
+ // and Vf Module Ids in the flow Execution
+ public void preProcessRequest(Execution execution) {
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ def xml = execution.getVariable("DeleteAAIVfModuleRequest")
+ utils.logAudit("DeleteAAIVfModule Request: " + xml)
+ utils.log("DEBUG", "input request xml:" + xml, isDebugEnabled)
+ initProcessVariables(execution)
+ def vnfId = utils.getNodeText(xml,"vnf-id")
+ def vfModuleId = utils.getNodeText(xml,"vf-module-id")
+ execution.setVariable("DAAIVfMod_vnfId", vnfId)
+ execution.setVariable("DAAIVfMod_vfModuleId", vfModuleId)
+
+ AaiUtil aaiUriUtil = new AaiUtil(this)
+ def aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution)
+ logDebug('AAI URI is: ' + aai_uri, isDebugEnabled)
+
+ execution.setVariable("DAAIVfMod_genericVnfEndpoint", "${aai_uri}/" + vnfId)
+ execution.setVariable("DAAIVfMod_vfModuleEndpoint", "${aai_uri}/" + vnfId +
+ "/vf-modules/vf-module/" + vfModuleId)
+ }
+
+ // send a GET request to AA&I to retrieve the Generic Vnf/Vf Module information based on a Vnf Id
+ // expect a 200 response with the information in the response body or a 404 if the Generic Vnf does not exist
+ public void queryAAIForGenericVnf(Execution execution) {
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ def delModuleId = execution.getVariable("DAAIVfMod_vfModuleId")
+ def endPoint = execution.getVariable("URN_aai_endpoint") + execution.getVariable("DAAIVfMod_genericVnfEndpoint") + "?depth=1"
+ utils.logAudit("DeleteAAIVfModule endPoint: " + endPoint)
+ def aaiRequestId = UUID.randomUUID().toString()
+
+ RESTConfig config = new RESTConfig(endPoint);
+ utils.log("DEBUG","queryAAIForGenericVnf() endpoint-" + endPoint, isDebugEnabled)
+ def responseData = ""
+ try {
+ RESTClient client = new RESTClient(config).addHeader("X-TransactionId", aaiRequestId).addHeader("X-FromAppId", "MSO").
+ addHeader("Accept","application/xml");
+ String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey"))
+
+ if (basicAuthCred != null && !"".equals(basicAuthCred)) {
+ client.addAuthorizationHeader(basicAuthCred)
+ }
+ utils.log("DEBUG", "invoking GET call to AAI endpoint :"+System.lineSeparator()+endPoint,isDebugEnabled)
+ APIResponse response = client.httpGet()
+ utils.logAudit("DeleteAAIVfModule - invoking httpGet to AAI")
+
+ responseData = response.getResponseBodyAsString()
+ execution.setVariable("DAAIVfMod_queryGenericVnfResponseCode", response.getStatusCode())
+ execution.setVariable("DAAIVfMod_queryGenericVnfResponse", responseData)
+ utils.logAudit("AAI Response: " + responseData)
+ utils.log("DEBUG", "Response code:" + response.getStatusCode(), isDebugEnabled)
+ utils.log("DEBUG", "Response:" + System.lineSeparator()+responseData,isDebugEnabled)
+ } catch (Exception ex) {
+ utils.log("DEBUG", "Exception occurred while executing AAI GET:" + ex.getMessage(),isDebugEnabled)
+ execution.setVariable("DAAIVfMod_queryGenericVnfResponse", "AAI GET Failed:" + ex.getMessage())
+ exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured during queryAAIForGenericVnf")
+
+ }
+ }
+
+ // construct and send a DELETE request to A&AI to delete a Generic Vnf
+ // note: to get here, all the modules associated with the Generic Vnf must already be deleted
+ public void deleteGenericVnf(Execution execution) {
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ def aaiRequestId = UUID.randomUUID().toString()
+ def endPoint = execution.getVariable("URN_aai_endpoint") + execution.getVariable("DAAIVfMod_genericVnfEndpoint") +
+ "/?resource-version=" + execution.getVariable("DAAIVfMod_genVnfRsrcVer")
+ utils.logAudit("AAI endPoint: " + endPoint)
+ RESTConfig config = new RESTConfig(endPoint);
+ utils.log("DEBUG","deleteGenericVnf() endpoint-" + endPoint, isDebugEnabled)
+ def responseData = ""
+ try {
+ RESTClient client = new RESTClient(config).addHeader("X-TransactionId", aaiRequestId).addHeader("X-FromAppId", "MSO").
+ addHeader("Accept","application/xml");
+
+ String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey"))
+
+ if (basicAuthCred != null && !"".equals(basicAuthCred)) {
+ client.addAuthorizationHeader(basicAuthCred)
+ }
+ APIResponse response = client.httpDelete()
+
+ responseData = response.getResponseBodyAsString()
+ execution.setVariable("DAAIVfMod_deleteGenericVnfResponseCode", response.getStatusCode())
+ execution.setVariable("DAAIVfMod_deleteGenericVnfResponse", responseData)
+ utils.log("DEBUG", "Response code:" + response.getStatusCode(), isDebugEnabled)
+ utils.log("DEBUG", "Response:" + System.lineSeparator()+responseData,isDebugEnabled)
+ } catch (Exception ex) {
+ ex.printStackTrace()
+ utils.log("DEBUG", "Exception occurred while executing AAI DELETE:" + ex.getMessage(),isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured during deleteGenericVnf")
+ }
+ }
+
+ // construct and send a DELETE request to A&AI to delete the Base or Add-on Vf Module
+ public void deleteVfModule(Execution execution) {
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ def endPoint = execution.getVariable("URN_aai_endpoint") + execution.getVariable("DAAIVfMod_vfModuleEndpoint") +
+ "/?resource-version=" + execution.getVariable("DAAIVfMod_vfModRsrcVer")
+ def aaiRequestId = UUID.randomUUID().toString()
+
+ RESTConfig config = new RESTConfig(endPoint);
+ utils.log("DEBUG","deleteVfModule() endpoint-" + endPoint, isDebugEnabled)
+ def responseData = ""
+ try {
+ RESTClient client = new RESTClient(config).addHeader("X-TransactionId", aaiRequestId).addHeader("X-FromAppId", "MSO").
+ addHeader("Accept","application/xml");
+
+ String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey"))
+
+ if (basicAuthCred != null && !"".equals(basicAuthCred)) {
+ client.addAuthorizationHeader(basicAuthCred)
+ }
+ APIResponse response = client.httpDelete()
+
+ utils.logAudit("DeleteAAIVfModule - invoking httpDelete to AAI")
+
+ responseData = response.getResponseBodyAsString()
+ execution.setVariable("DAAIVfMod_deleteVfModuleResponseCode", response.getStatusCode())
+ execution.setVariable("DAAIVfMod_deleteVfModuleResponse", responseData)
+ utils.logAudit("DeleteAAIVfModule - AAI Response" + responseData)
+ utils.log("DEBUG", "Response code:" + response.getStatusCode(), isDebugEnabled)
+ utils.log("DEBUG", "Response:" + System.lineSeparator()+responseData,isDebugEnabled)
+
+ } catch (Exception ex) {
+ ex.printStackTrace()
+ utils.log("DEBUG", "Exception occurred while executing AAI PUT:" + ex.getMessage(),isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured during deleteVfModule")
+ }
+ }
+
+ // parses the output from the result from queryAAIForGenericVnf() to determine if the Vf Module
+ // to be deleted exists for the specified Generic Vnf and if it is the Base Module,
+ // there are no Add-on Modules present
+ public void parseForVfModule(Execution execution) {
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ def xml = execution.getVariable("DAAIVfMod_queryGenericVnfResponse")
+ utils.logAudit("DeleteAAIVfModule - queryGenericVnfResponse" + xml)
+
+ def delModuleId = execution.getVariable("DAAIVfMod_vfModuleId")
+ utils.log("DEBUG", "Vf Module to be deleted: " + delModuleId, isDebugEnabled)
+ List <String> qryModuleIdList = utils.getMultNodes(xml, "vf-module-id")
+ List <String> qryBaseModuleList = utils.getMultNodes(xml, "is-base-vf-module")
+ List <String> qryResourceVerList = utils.getMultNodes(xml, "resource-version")
+ execution.setVariable("DAAIVfMod_moduleExists", false)
+ execution.setVariable("DAAIVfMod_isBaseModule", false)
+ execution.setVariable("DAAIVfMod_isLastModule", false)
+ //
+ def isBaseVfModule = "false"
+ // loop through the Vf Module Ids looking for a match
+ if (qryModuleIdList != null && !qryModuleIdList.empty) {
+ utils.log("DEBUG", "Existing Vf Module Id List: " + qryModuleIdList, isDebugEnabled)
+ utils.log("DEBUG", "Existing Vf Module Resource Version List: " + qryResourceVerList, isDebugEnabled)
+ def moduleCntr = 0
+ // the Generic Vnf resource-version in the 1st entry in the query response
+ execution.setVariable("DAAIVfMod_genVnfRsrcVer", qryResourceVerList[moduleCntr])
+ for (String qryModuleId : qryModuleIdList) {
+ if (delModuleId.equals(qryModuleId)) {
+ // a Vf Module with the requested Id exists
+ execution.setVariable("DAAIVfMod_moduleExists", true)
+ // find the corresponding value for the is-base-vf-module field
+ isBaseVfModule = qryBaseModuleList[moduleCntr]
+ // find the corresponding value for the resource-version field
+ // note: the Generic Vnf entry also has a resource-version field, so
+ // add 1 to the index to get the corresponding Vf Module value
+ execution.setVariable("DAAIVfMod_vfModRsrcVer", qryResourceVerList[moduleCntr+1])
+ utils.log("DEBUG", "Match found for Vf Module Id " + qryModuleId + " for Generic Vnf Id " +
+ execution.getVariable("DAAIVfMod_vnfId") + ", Base Module is " + isBaseVfModule +
+ ", Resource Version is " + execution.getVariable("vfModRsrcVer"), isDebugEnabled)
+ break
+ }
+ moduleCntr++
+ }
+ }
+
+ // determine if the module to be deleted is a Base Module and/or the Last Module
+ if (execution.getVariable("DAAIVfMod_moduleExists") == true) {
+ if (isBaseVfModule.equals("true") && qryModuleIdList.size() != 1) {
+ execution.setVariable("DAAIVfMod_parseModuleResponse",
+ "Found Vf Module Id " + delModuleId + " for Generic Vnf Id " +
+ execution.getVariable("DAAIVfMod_vnfId") + ": is Base Module, not Last Module")
+ execution.setVariable("DAAIVfMod_isBaseModule", true)
+ } else {
+ if (isBaseVfModule.equals("true") && qryModuleIdList.size() == 1) {
+ execution.setVariable("DAAIVfMod_parseModuleResponse",
+ "Found Vf Module Id " + delModuleId + " for Generic Vnf Id " +
+ execution.getVariable("DAAIVfMod_vnfId") + ": is Base Module and Last Module")
+ execution.setVariable("DAAIVfMod_isBaseModule", true)
+ execution.setVariable("DAAIVfMod_isLastModule", true)
+ } else {
+ if (qryModuleIdList.size() == 1) {
+ execution.setVariable("DAAIVfMod_parseModuleResponse",
+ "Found Vf Module Id " + delModuleId + " for Generic Vnf Id " +
+ execution.getVariable("DAAIVfMod_vnfId") + ": is Not Base Module, is Last Module")
+ execution.setVariable("DAAIVfMod_isLastModule", true)
+ } else {
+ execution.setVariable("DAAIVfMod_parseModuleResponse",
+ "Found Vf Module Id " + delModuleId + " for Generic Vnf Id " +
+ execution.getVariable("DAAIVfMod_vnfId") + ": is Not Base Module and Not Last Module")
+ }
+ }
+ }
+ utils.log("DEBUG", execution.getVariable("DAAIVfMod_parseModuleResponse"), isDebugEnabled)
+ } else { // (execution.getVariable("DAAIVfMod_moduleExists") == false)
+ utils.log("DEBUG", "Vf Module Id " + delModuleId + " does not exist for Generic Vnf Id " +
+ execution.getVariable("DAAIVfMod_vnfId"), isDebugEnabled)
+ execution.setVariable("DAAIVfMod_parseModuleResponse",
+ "Vf Module Id " + delModuleId + " does not exist for Generic Vnf Id " +
+ execution.getVariable("DAAIVfMod_vnfName"))
+ }
+ }
+
+ // parses the output from the result from queryAAIForGenericVnf() to determine if the Vf Module
+ // to be deleted exists for the specified Generic Vnf and if it is the Base Module,
+ // there are no Add-on Modules present
+ public void parseForResourceVersion(Execution execution) {
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ def xml = execution.getVariable("DAAIVfMod_queryGenericVnfResponse")
+ utils.logAudit("DeleteAAIVfModule - queryGenericVnfResponse" + xml)
+ String resourceVer = utils.getNodeText1(xml, "resource-version")
+ execution.setVariable("DAAIVfMod_genVnfRsrcVer", resourceVer)
+ utils.log("DEBUG", "Latest Generic VNF Resource Version: " + resourceVer)
+ }
+
+
+ // generates a WorkflowException if the A&AI query returns a response code other than 200
+ public void handleAAIQueryFailure(Execution execution) {
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+
+ utils.log("ERROR", "Error occurred attempting to query AAI, Response Code " +
+ execution.getVariable("DAAIVfMod_queryGenericVnfResponseCode") + ", Error Response " +
+ execution.getVariable("DAAIVfMod_queryGenericVnfResponse"), isDebugEnabled)
+ def errorCode = 5000
+ // set the errorCode to distinguish between a A&AI failure
+ // and the Generic Vnf Id not found
+ if (execution.getVariable("DAAIVfMod_queryGenericVnfResponseCode") == 404) {
+ errorCode = 1002
+ }
+ exceptionUtil.buildAndThrowWorkflowException(execution, errorCode, execution.getVariable("DAAIVfMod_queryGenericVnfResponse"))
+ }
+
+ // generates a WorkflowException if
+ // - the A&AI Vf Module DELETE returns a response code other than 200
+ // - the Vf Module is a Base Module that is not the last Vf Module
+ // - the Vf Module does not exist for the Generic Vnf
+ public void handleDeleteVfModuleFailure(Execution execution) {
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+
+ def errorCode = 2000
+ def errorResponse = ""
+ if (execution.getVariable("DAAIVfMod_deleteVfModuleResponseCode") != null &&
+ execution.getVariable("DAAIVfMod_deleteVfModuleResponseCode") != 200) {
+ utils.log("DEBUG", "AAI failure deleting a Vf Module: " +
+ execution.getVariable("DAAIVfMod_deleteVfModuleResponse"), isDebugEnabled)
+ errorResponse = execution.getVariable("DAAIVfMod_deleteVfModuleResponse")
+ utils.logAudit("DeleteAAIVfModule - deleteVfModuleResponse" + errorResponse)
+ errorCode = 5000
+ } else {
+ if (execution.getVariable("DAAIVfMod_isBaseModule", true) == true &&
+ execution.getVariable("DAAIVfMod_isLastModule") == false) {
+ // attempt to delete a Base Module that is not the last Vf Module
+ utils.log("DEBUG", execution.getVariable("DAAIVfMod_parseModuleResponse"), isDebugEnabled)
+ errorResponse = execution.getVariable("DAAIVfMod_parseModuleResponse")
+ utils.logAudit("DeleteAAIVfModule - parseModuleResponse" + errorResponse)
+ errorCode = 1002
+ } else {
+ // attempt to delete a non-existant Vf Module
+ if (execution.getVariable("DAAIVfMod_moduleExists") == false) {
+ utils.log("DEBUG", execution.getVariable("DAAIVfMod_parseModuleResponse"), isDebugEnabled)
+ errorResponse = execution.getVariable("DAAIVfMod_parseModuleResponse")
+ utils.logAudit("DeleteAAIVfModule - parseModuleResponse" + errorResponse)
+ errorCode = 1002
+ } else {
+ // if the responses get populated corerctly, we should never get here
+ errorResponse = "Unknown error occurred during DeleteAAIVfModule flow"
+ }
+ }
+ }
+
+ utils.log("ERROR", "Error occurred during DeleteAAIVfModule flow: " + errorResponse, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, errorCode, errorResponse)
+
+ }
+
+ // generates a WorkflowException if
+ // - the A&AI Generic Vnf DELETE returns a response code other than 200
+ public void handleDeleteGenericVnfFailure(Execution execution) {
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ utils.log("ERROR", "AAI error occurred deleting the Generic Vnf: "
+ + execution.getVariable("DAAIVfMod_deleteGenericVnfResponse"), isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 5000, execution.getVariable("DAAIVfMod_deleteGenericVnfResponse"))
+ }
} \ No newline at end of file
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ExceptionUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ExceptionUtil.groovy
index fb68f4efe9..4cc4da49b3 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ExceptionUtil.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ExceptionUtil.groovy
@@ -1,599 +1,398 @@
-/*-
- * ============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.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.bpmn.core.WorkflowException
-
-/**
- * @version 1.0
- */
-class ExceptionUtil extends AbstractServiceTaskProcessor {
-
- /**
- *
- * @Deprecated
- *
- * Instead use <method>MapAAIExceptionToWorkflowException</method>
- *
- * To Be Removed Once Refactoring Main Flow Error Handling Is Complete
- *
- *
- */
- @Deprecated
- String MapAAIExceptionToWorkflowExceptionOld(String response, Execution execution)
- {
- def utils=new MsoUtils()
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- def prefix=execution.getVariable("prefix")
- def errorMsg = execution.getVariable(prefix+"ErrorResponse")
- utils.log("DEBUG","=========== Begin MapAAIExceptionToWorkflowException ===========",isDebugEnabled)
- String text = null
- def variables
- String errorCode = '5000'
- utils.log("DEBUG","response: " + response, isDebugEnabled)
- try {
- //String msg = utils.getNodeXml(response, "Fault")
- variables = utils.getMultNodes(response, "variable")
- text = utils.getNodeText1(response, "text")
- } catch (Exception ex) {
- //Ignore the exception - cases include non xml payload
- utils.log("DEBUG","error mapping error, ignoring: " + ex,isDebugEnabled)
- }
-
- if(text != null) {
- if(variables.size()>=4){
- text = text.replaceFirst("%1", variables[0])
- text = text.replaceFirst("%2", variables[1])
- text = text.replaceFirst("%3", variables[2])
- text = text.replaceFirst("%4", variables[3])
- }
- String modifiedErrorMessage = 'Received error from A&amp;AI (' + text +')'
- utils.log("DEBUG", "ModifiedErrorMessage " + modifiedErrorMessage, isDebugEnabled)
- // let $ModifiedErrorMessage := concat( 'Received error from A',$exceptionaai:ampersand,'AI (' ,functx:replace-multi($ErrorMessage,$from,$Variables ),')')
- String message = """<aetgt:WorkflowException xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1">
- <aetgt:ErrorMessage>$modifiedErrorMessage</aetgt:ErrorMessage>
- <aetgt:ErrorCode>$errorCode</aetgt:ErrorCode>
- </aetgt:WorkflowException>"""
- execution.setVariable(prefix+"ErrorResponse",message)
- utils.log("ERROR","Fault:"+ execution.getVariable(prefix+"ErrorResponse"))
- return message
- } else {
- try {
- errorCode = MapErrorCode(errorMsg)
- String mappedErrorMessage = MapErrorMessage(errorMsg, errorCode)
-
- String message = """<aetgt:WorkflowException xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1">
- <aetgt:ErrorMessage>$mappedErrorMessage</aetgt:ErrorMessage>
- <aetgt:ErrorCode>$errorCode</aetgt:ErrorCode>
- </aetgt:WorkflowException>"""
- utils.log("DEBUG", "mappedErrorMessage " + mappedErrorMessage, isDebugEnabled)
- execution.setVariable(prefix+"ErrorResponse",message)
- utils.log("ERROR","Fault:"+ execution.getVariable(prefix+"ErrorResponse"))
- return message
- } catch(Exception ex) {
- utils.log("DEBUG","error mapping error, return null: " + ex,isDebugEnabled)
- return null
-
- }
- }
- }
-
- /**
- * This error handling method maps an AAI Exception response to a
- * WorkflowException Object. It then sets the WorkflowException Object
- * on the execution as "WorkflowException".
- *
- * This method formats the exception from AAI into the WorkflowException's
- * errorMessage that CCD expects.
- *
- * @param execution the execution
- * @param response the aai exception
- */
- WorkflowException MapAAIExceptionToWorkflowException(String response, Execution execution)
- {
- def utils=new MsoUtils()
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- def prefix=execution.getVariable("prefix")
- def errorMsg = execution.getVariable(prefix+"ErrorResponse")
- utils.log("DEBUG","=========== Begin MapAAIExceptionToWorkflowException ===========",isDebugEnabled)
- String text = null
- def variables
- String errorCode = '5000'
- WorkflowException wfex
- utils.log("DEBUG","response: " + response, isDebugEnabled)
- try {
- //String msg = utils.getNodeXml(response, "Fault")
- variables = utils.getMultNodes(response, "variable")
- text = utils.getNodeText1(response, "text")
- } catch (Exception ex) {
- //Ignore the exception - cases include non xml payload
- utils.log("DEBUG","error mapping error, ignoring: " + ex,isDebugEnabled)
- }
-
- if(text != null) {
- if(variables.size()>=4){
- text = text.replaceFirst("%1", variables[0])
- text = text.replaceFirst("%2", variables[1])
- text = text.replaceFirst("%3", variables[2])
- text = text.replaceFirst("%4", variables[3])
- }
- String modifiedErrorMessage = 'Received error from A&amp;AI (' + text +')'
- utils.log("DEBUG", "ModifiedErrorMessage " + modifiedErrorMessage, isDebugEnabled)
- // let $ModifiedErrorMessage := concat( 'Received error from A',$exceptionaai:ampersand,'AI (' ,functx:replace-multi($ErrorMessage,$from,$Variables ),')')
- buildWorkflowException(execution, 5000, modifiedErrorMessage)
-
- wfex = execution.getVariable("WorkflowException")
- utils.log("ERROR","Fault:"+ wfex)
- return wfex
- } else {
- try {
- errorCode = MapErrorCode(errorMsg)
- String mappedErrorMessage = MapErrorMessage(errorMsg, errorCode)
-
- int errorCodeInt = Integer.parseInt(errorCode)
- buildWorkflowException(execution, errorCodeInt, mappedErrorMessage)
-
- utils.log("DEBUG", "mappedErrorMessage " + mappedErrorMessage, isDebugEnabled)
- wfex = execution.getVariable("WorkflowException")
- utils.log("ERROR","Fault:"+ wfex, isDebugEnabled)
- return wfex
- } catch(Exception ex) {
- utils.log("DEBUG","error mapping error, return null: " + ex, isDebugEnabled)
- return null
-
- }
- }
- }
-
- /**
- * This error handling method maps an AAI Exception response to a
- * WorkflowException Object. It then sets the WorkflowException Object
- * on the execution as "WorkflowException".
- *
- * This method takes the exact exception inside the <Fault> tags from AAI Response
- * and puts it into the WorkflowException's errorMessage.
- *
- * @param execution the execution
- * @param response the aai exception
- */
- WorkflowException MapAAIExceptionToWorkflowExceptionGeneric(Execution execution, String response, int resCode){
- def utils=new MsoUtils()
- def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled")
- utils.log("DEBUG", "Start MapAAIExceptionToWorkflowExceptionGeneric Process", isDebugLogEnabled)
-
- WorkflowException wfex
- try {
- if(utils.nodeExists(response, "Fault")){
- String fault = utils.getNodeXml(response, "Fault")
- fault = utils.removeXmlPreamble(fault)
- fault = fault.replace("<Fault>", "").replace("</Fault>", "")
- fault = fault.replaceAll("\\s+\\s+", "") // Removes extra white spaces
- buildWorkflowException(execution, resCode, fault)
- }else if(utils.nodeExists(response, "RESTFault")){
- String rFault = utils.getNodeXml(response, "RESTFault")
- buildWorkflowException(execution, resCode, rFault)
- }else{
- buildWorkflowException(execution, resCode, "Received a bad response from AAI")
- }
- } catch (Exception ex) {
- utils.log("DEBUG", "Exception Occured during MapAAIExceptionToWorkflowExceptionGeneric: " + ex, isDebugLogEnabled)
- buildWorkflowException(execution, resCode, "Internal Error - Occured in MapAAIExceptionToWorkflowExceptionGeneric")
-
- }
- utils.log("DEBUG", "Outgoing WorkflowException is: " + execution.getVariable("WorkflowException"), isDebugLogEnabled)
- utils.log("DEBUG", "Completed MapAAIExceptionToWorkflowExceptionGeneric Process", isDebugLogEnabled)
- }
-
- /**
- *
- *This method build a WorkflowException using the adapters response.
- *
- *@param String response
- *@param String adapter
- *
- *@return WorkflowException wfex
- */
- WorkflowException MapAdapterExecptionToWorkflowException(String response, Execution execution, String adapter){
- def utils=new MsoUtils()
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- def prefix=execution.getVariable("prefix")
- utils.log("DEBUG","=========== Start MapAdapterExecptionToWorkflowException Process ===========",isDebugEnabled)
-
- String errorCode
- def errorMessage
- WorkflowException wfex
- try {
- errorCode = MapCategoryToErrorCode(utils.getNodeText(response, "category"))
- errorMessage = MapAdapterErrorMessage(utils.getNodeText(response, "message"), errorCode, adapter)
-
- int errorCodeInt = Integer.parseInt(errorCode)
- buildWorkflowException(execution, errorCodeInt, errorMessage)
- }catch (Exception ex) {
- utils.log("DEBUG", "Exception Occured during MapAdapterExecptionToWorkflowException: " + ex, isDebugEnabled)
- buildWorkflowException(execution, 2500, "Internal Error - Occured in MapAdapterExecptionToWorkflowException")
- }
- wfex = execution.getVariable("WorkflowException")
- return wfex
- utils.log("DEBUG","=========== Completed MapAdapterExecptionToWorkflowException Process ===========",isDebugEnabled)
- }
-
-
- /**
- *
- * @Deprecated
- *
- * Instead use <method>buildWorkflowException(Execution execution, int errorCode, String errorMessage)</method> method below
- *
- * To Be Removed Once Refactoring Of Main Flow Error Handling Is Complete
- *
- */
- @Deprecated
- String buildWorkflowExceptionXml(String errorCode, String errorMessage) {
- return """<aetgt:WorkflowException xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1">
- <aetgt:ErrorMessage>${errorMessage}</aetgt:ErrorMessage>
- <aetgt:ErrorCode>${errorCode}</aetgt:ErrorCode>
- </aetgt:WorkflowException>"""
- }
-
- /**
- * This method takes a WorkflowException Object and builds
- * WorkflowException Xml. This method should only be used
- * for the purpose of sending an error response.
- *
- *@param - WorkflowException Object
- *
- *@return - String WorkflowException Xml
- *
- *
- */
- String buildErrorResponseXml(WorkflowException wfex) {
- String xml
- if(wfex != null){
- String mes = wfex.getErrorMessage()
- int code = wfex.getErrorCode()
- xml =
- """<aetgt:WorkflowException xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1">
- <aetgt:ErrorMessage>${mes}</aetgt:ErrorMessage>
- <aetgt:ErrorCode>${code}</aetgt:ErrorCode>
- </aetgt:WorkflowException>"""
-
- }else{
- xml =
- """<aetgt:WorkflowException xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1">
- <aetgt:ErrorMessage>Internal Error</aetgt:ErrorMessage>
- <aetgt:ErrorCode>2500</aetgt:ErrorCode>
- </aetgt:WorkflowException>"""
- }
- return xml
- }
-
- /*
- 5000 Received error from A&AI ($A&AI_ERROR) Asynchronous During orchestration of the recipe, A&AI returned an error. The error returned by A&AI is passed through in $A&AI_ERROR.
- 5010 Could not communicate with A&AI Asynchronous During orchestration of the recipe, a connection with A&AI could not be established.
- 5020 No response from A&AI Asynchronous During orchestration of the recipe, communication was established with A&AI, but no response was received within the configured timeout.
- */
- String MapErrorCode(String errorMessage)
- {
- if(errorMessage==null){
- return '5000'
- }
- errorMessage = errorMessage.toLowerCase();
- if(errorMessage.contains('timed out') || errorMessage.contains('timeout'))
- return '5020'
- else if (errorMessage.contains('connection'))
- return '5010'
- else
- return '5000'
- }
-
- String MapErrorMessage(String errorMessage, String errorCode)
- {
- if(errorMessage == null){
- errorMessage=""
- }
- if( errorCode.equals('5010')) {
- return 'Could not communicate with A&amp;AI'
- } else if (errorCode.equals('5020')) {
- return 'No response from A&amp;AI'
- } else {
- errorMessage = errorMessage.replace("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;")
- return 'Received error from A&amp;AI (' +errorMessage +')'
- }
- }
-
- String MapCategoryToErrorCode(String errorCategory)
- {
- if(errorCategory.equals('OPENSTACK'))
- return '5100'
- else if (errorCategory.equals('IO'))
- return '5110'
- else if (errorCategory.equals('INTERNAL'))
- return '7020'
- else if (errorCategory.equals('USERDATA'))
- return '7020'
- else
- return '7020'
- }
-
-
- String MapAdapterErrorMessage(String errorMessage, String errorCode, String adapter)
- {
- if(errorCode.equals('5100'))
- return 'Received error from Platform Orchestrator: ' + errorMessage
- else if(errorCode.equals('5110'))
- return 'Could not communicate with Platform Orchestrator'
- else
- return 'Received error from ' + adapter + ': ' + errorMessage
- }
-
- String MapSDNCResponseCodeToErrorCode(String sdncResponseCode)
- {
- if (sdncResponseCode == '500') {
- return '5310'
- } else if ( sdncResponseCode == '408') {
- return '5320'
- } else if ( sdncResponseCode == '60010') {
- return '5350'
- } else {
- return '5300'
- }
- }
-
- /**
- * This error handling method builds a WorkflowException Object. It sets it on
- * the execution as "WorkflowException".
- *
- * @param execution the execution
- * @param errorCode the error code
- * @param errorMessage the error message
- */
- public void buildWorkflowException(Execution execution, int errorCode, String errorMessage) {
- MsoUtils utils = new MsoUtils()
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- String processKey = getProcessKey(execution);
- utils.log("DEBUG", "Building a WorkflowException for " + processKey, isDebugLogEnabled)
-
- WorkflowException exception = new WorkflowException(processKey, errorCode, errorMessage);
- execution.setVariable("WorkflowException", exception);
- utils.log("DEBUG", "Outgoing WorkflowException is " + exception, isDebugLogEnabled)
- }
-
- /**
- * This error handling method builds a WorkflowException Object and throws a
- * MSOWorkflowException. It throws a "MSOWorkflowException" BpmnError after
- * setting the WorkflowException Object on the execution as "WorkflowException".
- *
- * @param execution the execution
- * @param errorCode the error code
- * @param errorMessage the error message
- */
- public void buildAndThrowWorkflowException(Execution execution, int errorCode, String errorMessage) {
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- String processKey = getProcessKey(execution);
- utils.log("Building a WorkflowException for Subflow " + processKey, isDebugLogEnabled)
-
- WorkflowException exception = new WorkflowException(processKey, errorCode, errorMessage);
- execution.setVariable("WorkflowException", exception);
- utils.log("DEBUG", "Outgoing WorkflowException is " + exception, isDebugLogEnabled)
- utils.log("DEBUG", "Throwing MSOWorkflowException", isDebugLogEnabled)
- throw new BpmnError("MSOWorkflowException")
- }
-
- /**
- * This method is executed after an MSOWorkflowException is caught by a
- * subflow (during subflows "Error Handling Sub Process").
- * It ensures the WorkflowException variable is populated before ending the
- * subflow and also logs the subflows outgoing WorkflowException Variable.
- *
- * @param - execution
- *
- */
- public void processSubflowsBPMNException(Execution execution){
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- String processKey = getProcessKey(execution)
- try{
- utils.log("DEBUG", "Started ProcessSubflowsBPMNException Method", isDebugEnabled)
- if(execution.getVariable("WorkflowException") == null){
- buildWorkflowException(execution, 2500, "Internal Error - Occured During " + processKey)
- }
-
- utils.log("DEBUG", processKey + " Outgoing WorkflowException is: " + execution.getVariable("WorkflowException"), isDebugEnabled)
- }catch(Exception e){
- utils.log("DEBUG", "Caught Exception during ProcessSubflowsBPMNException Method: " + e, isDebugEnabled)
- }
- utils.log("DEBUG", "Completed ProcessSubflowsBPMNException Method", isDebugEnabled)
- }
-
- /**
- * This method is executed after an MSOWorkflowException is caught by a
- * Mainflow. It builds and returns a FalloutHandler Request. It also
- * verifies the WorkflowException variable is populated.
- *
- * @param - execution
- * @param - requestInfo
- *
- * @return - falloutHandlerRequest
- *
- */
- public String processMainflowsBPMNException(Execution execution, String requestInfo){
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- String processKey = getProcessKey(execution)
- try{
- utils.log("DEBUG", "Started ProcessMainflowBPMNException Method", isDebugEnabled)
- if(execution.getVariable("WorkflowException") == null || isBlank(requestInfo)){
- buildWorkflowException(execution, 2500, "Internal Error - WorkflowException Object and/or RequestInfo is null! " + processKey)
- }
- requestInfo = utils.removeXmlPreamble(requestInfo)
- WorkflowException wfex = execution.getVariable("WorkflowException")
- String errorMessage = wfex.getErrorMessage()
- int errorCode = wfex.getErrorCode()
-
- String falloutHandlerRequest =
- """<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">
- ${requestInfo}
- <aetgt:WorkflowException xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1">
- <aetgt:ErrorMessage>${errorMessage}</aetgt:ErrorMessage>
- <aetgt:ErrorCode>${errorCode}</aetgt:ErrorCode>
- </aetgt:WorkflowException>
- </aetgt:FalloutHandlerRequest>"""
-
- utils.log("DEBUG", processKey + " Outgoing WorkflowException is: " + execution.getVariable("WorkflowException"), isDebugEnabled)
- utils.log("DEBUG", processKey + " Outgoing FalloutHandler Request is: " + falloutHandlerRequest, isDebugEnabled)
-
- return falloutHandlerRequest
-
- }catch(Exception e){
- utils.log("DEBUG", "Caught Exception during ProcessMainflowBPMNException Method: " + e, isDebugEnabled)
- return null
- }
- utils.log("DEBUG", "Completed ProcessMainflowBPMNException Method", isDebugEnabled)
- }
-
- /**
- *
- * This method should only be used by DHV Flows. This method is
- * executed after an MSOWorkflowException is caught by a Mainflow.
- * It builds and returns a FalloutHandler Request. It also
- * verifies the WorkflowException variable is populated.
- *
- * @param - execution
- * @param - requestInfo
- *
- * @return - falloutHandlerRequest
- *
- */
- public String processMainflowsBPMNExceptionDHV(Execution execution, String requestId, def source, def action, def notificationUrl, def serviceInstanceId, def startTime){
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- String processKey = getProcessKey(execution)
- try{
- utils.log("DEBUG", "Started ProcessMainflowBPMNExceptionDHV Method", isDebugEnabled)
-
- def WorkflowException workflowException = execution.getVariable("WorkflowException")
- int errorResponseCode = 0
- def errorResponseMsg = ""
- if(workflowException != null){
- errorResponseCode = workflowException.getErrorCode()
- def errorMsg = workflowException.getErrorMessage()
- if (errorMsg != null) {
- errorResponseMsg = errorMsg.replace("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;")
- }
- }else{
- errorResponseCode = 2500
- errorResponseMsg = "Internal Error occured during " + action + ", unable to retrieve error information."
- }
-
-
- String request =
- """<FalloutHandlerRequest xmlns="http://org.openecomp/mso/workflow/schema/v1">
- <request-information xmlns="http://org.openecomp/mso/request/types/v1">
- <request-id>${requestId}</request-id>
- <request-action>${action}</request-action>
- <source>${source}</source>
- <notification-url>${notificationUrl}</notification-url>
- </request-information>
- <mso-bpel-name>BPMN</mso-bpel-name>
- <is-srv-inst-req>true</is-srv-inst-req>
- <resp-content-type>JSON</resp-content-type>
- <service-instance-id>${serviceInstanceId}</service-instance-id>
- <start-time>${startTime}</start-time>
- <WorkflowException>
- <ErrorMessage>${errorResponseMsg}</ErrorMessage>
- <ErrorCode>${errorResponseCode}</ErrorCode>
- </WorkflowException>
- </FalloutHandlerRequest>"""
-
-
- request = utils.formatXml(request)
- utils.log("DEBUG", processKey + " Outgoing WorkflowException is: " + execution.getVariable("WorkflowException"), isDebugEnabled)
- utils.log("DEBUG", processKey + " Outgoing FalloutHandler Request is: " + request, isDebugEnabled)
-
- return request
-
- }catch(Exception e){
- utils.log("DEBUG", "Caught Exception during ProcessMainflowBPMNException Method: " + e, isDebugEnabled)
- return null
- }
- utils.log("DEBUG", "Completed ProcessMainflowBPMNExceptionDHV Method", isDebugEnabled)
- }
-
- /**
- * This method is executed after an Java Exception is caught.
- * It sets the WorkflowException variable and throws an MSOWorkflowException.
- *
- * @param - execution
- *
- */
- @Deprecated
- public void processSubflowsJavaException(Execution execution){
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- String processKey = getProcessKey(execution)
- try{
- utils.log("DEBUG", "Caught a Java Exception in " + processKey, isDebugEnabled)
- utils.log("DEBUG", "Started processJavaException Method", isDebugEnabled)
- buildAndThrowWorkflowException(execution, 2500, "Catch a Java Lang Exception in " + processKey)
-
- }catch(BpmnError b){
- throw b
- }catch(Exception e){
- utils.log("DEBUG", "Caught Exception during processJavaException Method: " + e, isDebugEnabled)
- buildAndThrowWorkflowException(execution, 2500, "Internal Error - During Process Java Exception")
- }
- utils.log("DEBUG", "Completed processJavaException Method", isDebugEnabled)
- }
-
- /**
- *
- * This method is executed after an Java Exception is caught
- * It sets the WorkflowException variable. The method can be used in either mainflow or subflows.
- *
- * @param - execution
- *
- */
- public void processJavaException(Execution execution){
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- String processKey = getProcessKey(execution)
- try{
- utils.log("DEBUG", "Caught a Java Exception in " + processKey, isDebugEnabled)
- utils.log("DEBUG", "Started processJavaException Method", isDebugEnabled)
- buildWorkflowException(execution, 2500, "Catch a Java Lang Exception in " + processKey)
-
- }catch(BpmnError b){
- throw b
- }catch(Exception e){
- utils.log("DEBUG", "Caught Exception during processJavaException Method: " + e, isDebugEnabled)
- buildWorkflowException(execution, 2500, "Internal Error - During Process Java Exception")
- }
- utils.log("DEBUG", "Completed processJavaException Method", isDebugEnabled)
- }
-
-
- public void preProcessRequest(Execution execution) {
- // TODO Auto-generated method stub
-
- }
-}
+/*-
+ * ============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.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.bpmn.core.WorkflowException
+
+/**
+ * @version 1.0
+ */
+class ExceptionUtil extends AbstractServiceTaskProcessor {
+
+
+ /**
+ * This error handling method maps an AAI Exception response to a
+ * WorkflowException Object. It then sets the WorkflowException Object
+ * on the execution as "WorkflowException".
+ *
+ * This method formats the exception from AAI into the WorkflowException's
+ * errorMessage that CCD expects.
+ *
+ * @param execution the execution
+ * @param response the aai exception
+ */
+ WorkflowException MapAAIExceptionToWorkflowException(String response, Execution execution)
+ {
+ def utils=new MsoUtils()
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ def prefix=execution.getVariable("prefix")
+ def errorMsg = execution.getVariable(prefix+"ErrorResponse")
+ utils.log("DEBUG","=========== Begin MapAAIExceptionToWorkflowException ===========",isDebugEnabled)
+ String text = null
+ def variables
+ String errorCode = '5000'
+ WorkflowException wfex
+ utils.log("DEBUG","response: " + response, isDebugEnabled)
+ try{
+ try {
+ //String msg = utils.getNodeXml(response, "Fault")
+ variables = utils.getMultNodes(response, "variable")
+ text = utils.getNodeText1(response, "text")
+ } catch (Exception ex) {
+ //Ignore the exception - cases include non xml payload
+ utils.log("DEBUG","error mapping error, ignoring: " + ex,isDebugEnabled)
+ }
+
+ if(text != null) {
+ if(variables.size()>=4){
+ text = text.replaceFirst("%1", variables[0])
+ text = text.replaceFirst("%2", variables[1])
+ text = text.replaceFirst("%3", variables[2])
+ text = text.replaceFirst("%4", variables[3])
+ }
+ String modifiedErrorMessage = 'Received error from A&amp;AI (' + text +')'
+ utils.log("DEBUG", "ModifiedErrorMessage " + modifiedErrorMessage, isDebugEnabled)
+ // let $ModifiedErrorMessage := concat( 'Received error from A',$exceptionaai:ampersand,'AI (' ,functx:replace-multi($ErrorMessage,$from,$Variables ),')')
+ buildWorkflowException(execution, 5000, modifiedErrorMessage)
+
+ wfex = execution.getVariable("WorkflowException")
+ utils.log("ERROR","Fault:"+ wfex)
+ return wfex
+ } else {
+ try {
+ errorCode = MapErrorCode(errorMsg)
+ String mappedErrorMessage = MapErrorMessage(errorMsg, errorCode)
+
+ int errorCodeInt = Integer.parseInt(errorCode)
+ buildWorkflowException(execution, errorCodeInt, mappedErrorMessage)
+
+ utils.log("DEBUG", "mappedErrorMessage " + mappedErrorMessage, isDebugEnabled)
+ wfex = execution.getVariable("WorkflowException")
+ utils.log("ERROR","Fault:"+ wfex, isDebugEnabled)
+ return wfex
+ } catch(Exception ex) {
+ utils.log("DEBUG","error mapping error, return null: " + ex, isDebugEnabled)
+ return null
+
+ }
+ }
+ }catch(Exception e){
+ utils.log("DEBUG", "Exception occured during MapAAIExceptionToWorkflowException: " + e, isDebugEnabled)
+ buildWorkflowException(execution, 5000, "Error mapping AAI Response to WorkflowException")
+ }
+ }
+
+ /**
+ * This error handling method maps an AAI Exception response to a
+ * WorkflowException Object. It then sets the WorkflowException Object
+ * on the execution as "WorkflowException".
+ *
+ * This method takes the exact exception inside the <Fault> tags from AAI Response
+ * and puts it into the WorkflowException's errorMessage.
+ *
+ * @param execution the execution
+ * @param response the aai exception
+ */
+ WorkflowException MapAAIExceptionToWorkflowExceptionGeneric(Execution execution, String response, int resCode){
+ def utils=new MsoUtils()
+ def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled")
+ utils.log("DEBUG", "Start MapAAIExceptionToWorkflowExceptionGeneric Process", isDebugLogEnabled)
+
+ WorkflowException wfex
+ try {
+ if(utils.nodeExists(response, "Fault")){
+ String fault = utils.getNodeXml(response, "Fault")
+ fault = utils.removeXmlPreamble(fault)
+ fault = fault.replace("<Fault>", "").replace("</Fault>", "")
+ fault = fault.replaceAll("\\s+\\s+", "") // Removes extra white spaces
+ buildWorkflowException(execution, resCode, fault)
+ }else if(utils.nodeExists(response, "RESTFault")){
+ String rFault = utils.getNodeXml(response, "RESTFault")
+ buildWorkflowException(execution, resCode, rFault)
+ }else{
+ buildWorkflowException(execution, resCode, "Received a bad response from AAI")
+ }
+ } catch (Exception ex) {
+ utils.log("DEBUG", "Exception Occured during MapAAIExceptionToWorkflowExceptionGeneric: " + ex, isDebugLogEnabled)
+ buildWorkflowException(execution, resCode, "Internal Error - Occured in MapAAIExceptionToWorkflowExceptionGeneric")
+
+ }
+ utils.log("DEBUG", "Outgoing WorkflowException is: " + execution.getVariable("WorkflowException"), isDebugLogEnabled)
+ utils.log("DEBUG", "Completed MapAAIExceptionToWorkflowExceptionGeneric Process", isDebugLogEnabled)
+ }
+
+ /**
+ * This method takes a WorkflowException Object and builds
+ * WorkflowException Xml. This method should only be used
+ * for the purpose of sending a sync error response or for
+ * creating a FalloutHandler request.
+ *
+ *@param - WorkflowException Object
+ *
+ *@return - String WorkflowException Xml
+ *
+ *
+ */
+ String buildErrorResponseXml(WorkflowException wfex) {
+ String xml
+ if(wfex != null){
+ String mes = wfex.getErrorMessage()
+ int code = wfex.getErrorCode()
+ xml =
+ """<aetgt:WorkflowException xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1">
+ <aetgt:ErrorMessage>${mes}</aetgt:ErrorMessage>
+ <aetgt:ErrorCode>${code}</aetgt:ErrorCode>
+ </aetgt:WorkflowException>"""
+
+ }else{
+ xml =
+ """<aetgt:WorkflowException xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1">
+ <aetgt:ErrorMessage>Internal Error</aetgt:ErrorMessage>
+ <aetgt:ErrorCode>2500</aetgt:ErrorCode>
+ </aetgt:WorkflowException>"""
+ }
+ return xml
+ }
+
+ /*
+ 5000 Received error from A&AI ($A&AI_ERROR) Asynchronous During orchestration of the recipe, A&AI returned an error. The error returned by A&AI is passed through in $A&AI_ERROR.
+ 5010 Could not communicate with A&AI Asynchronous During orchestration of the recipe, a connection with A&AI could not be established.
+ 5020 No response from A&AI Asynchronous During orchestration of the recipe, communication was established with A&AI, but no response was received within the configured timeout.
+ */
+ /**
+ *
+ * Utility Method for MapAAIExceptionToWorkflowException
+ *
+ *@param - String ErrorMessage
+ *
+ *@return - String ErrorCode
+ *
+ */
+ private String MapErrorCode(String errorMessage)
+ {
+ if(errorMessage==null){
+ return '5000'
+ }
+ errorMessage = errorMessage.toLowerCase();
+ if(errorMessage.contains('timed out') || errorMessage.contains('timeout'))
+ return '5020'
+ else if (errorMessage.contains('connection'))
+ return '5010'
+ else
+ return '5000'
+ }
+
+ /**
+ *
+ * Utility Method for MapAAIExceptionToWorkflowException
+ *
+ *@param - String ErrorMessage
+ *@param - String ErrorCode
+ *
+ *@return - String ErrorMessage
+ *
+ */
+ private String MapErrorMessage(String errorMessage, String errorCode)
+ {
+ if(errorMessage == null){
+ errorMessage=""
+ }
+ if( errorCode.equals('5010')){
+ return 'Could not communicate with A&amp;AI'
+ }else if (errorCode.equals('5020')){
+ return 'No response from A&amp;AI'
+ }else{
+ errorMessage = errorMessage.replace("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;")
+ return 'Received error from A&amp;AI (' +errorMessage +')'
+ }
+ }
+
+ /**
+ *
+ * Utility Method for Mapping SDNC
+ * Adapter Response Codes
+ *
+ *@param - String sdncResponseCode
+ *
+ *@return - String code
+ *
+ */
+ String MapSDNCResponseCodeToErrorCode(String sdncResponseCode)
+ {
+ if (sdncResponseCode == '500') {
+ return '5310'
+ } else if ( sdncResponseCode == '408') {
+ return '5320'
+ } else if ( sdncResponseCode == '60010') {
+ return '5350'
+ } else {
+ return '5300'
+ }
+ }
+
+ /**
+ * This error handling method builds a WorkflowException Object. It sets it on
+ * the execution as "WorkflowException".
+ *
+ * @param execution the execution
+ * @param errorCode the error code
+ * @param errorMessage the error message
+ */
+ public void buildWorkflowException(Execution execution, int errorCode, String errorMessage) {
+ MsoUtils utils = new MsoUtils()
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ String processKey = getProcessKey(execution);
+ utils.log("DEBUG", "Building a WorkflowException for " + processKey, isDebugLogEnabled)
+
+ WorkflowException exception = new WorkflowException(processKey, errorCode, errorMessage);
+ execution.setVariable("WorkflowException", exception);
+ utils.log("DEBUG", "Outgoing WorkflowException is " + exception, isDebugLogEnabled)
+ }
+
+ /**
+ * This error handling method builds a WorkflowException Object and throws a
+ * MSOWorkflowException. It throws a "MSOWorkflowException" BpmnError after
+ * setting the WorkflowException Object on the execution as "WorkflowException".
+ *
+ * @param execution the execution
+ * @param errorCode the error code
+ * @param errorMessage the error message
+ */
+ public void buildAndThrowWorkflowException(Execution execution, int errorCode, String errorMessage) {
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ String processKey = getProcessKey(execution);
+ utils.log("Building a WorkflowException for Subflow " + processKey, isDebugLogEnabled)
+
+ WorkflowException exception = new WorkflowException(processKey, errorCode, errorMessage);
+ execution.setVariable("WorkflowException", exception);
+ utils.log("DEBUG", "Outgoing WorkflowException is " + exception, isDebugLogEnabled)
+ utils.log("DEBUG", "Throwing MSOWorkflowException", isDebugLogEnabled)
+ throw new BpmnError("MSOWorkflowException")
+ }
+
+ /**
+ * This method is executed after an MSOWorkflowException is caught by a
+ * subflow (during subflows "Error Handling Sub Process").
+ * It ensures the WorkflowException variable is populated before ending the
+ * subflow and also logs the subflows outgoing WorkflowException Variable.
+ *
+ * @param - execution
+ *
+ */
+ public void processSubflowsBPMNException(Execution execution){
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ String processKey = getProcessKey(execution)
+ try{
+ utils.log("DEBUG", "Started ProcessSubflowsBPMNException Method", isDebugEnabled)
+ if(execution.getVariable("WorkflowException") == null){
+ buildWorkflowException(execution, 2500, "Internal Error - Occured During " + processKey)
+ }
+
+ utils.log("DEBUG", processKey + " Outgoing WorkflowException is: " + execution.getVariable("WorkflowException"), isDebugEnabled)
+ }catch(Exception e){
+ utils.log("DEBUG", "Caught Exception during ProcessSubflowsBPMNException Method: " + e, isDebugEnabled)
+ }
+ utils.log("DEBUG", "Completed ProcessSubflowsBPMNException Method", isDebugEnabled)
+ }
+
+ /**
+ * This method is executed after an MSOWorkflowException is caught by a
+ * Mainflow. It builds and returns a FalloutHandler Request. It also
+ * verifies the WorkflowException variable is populated.
+ *
+ * @param - execution
+ * @param - requestInfo
+ *
+ * @return - falloutHandlerRequest
+ *
+ */
+ public String processMainflowsBPMNException(Execution execution, String requestInfo){
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ String processKey = getProcessKey(execution)
+ try{
+ utils.log("DEBUG", "Started ProcessMainflowBPMNException Method", isDebugEnabled)
+ if(execution.getVariable("WorkflowException") == null || isBlank(requestInfo)){
+ buildWorkflowException(execution, 2500, "Internal Error - WorkflowException Object and/or RequestInfo is null! " + processKey)
+ }
+ requestInfo = utils.removeXmlPreamble(requestInfo)
+ WorkflowException wfex = execution.getVariable("WorkflowException")
+ String errorMessage = wfex.getErrorMessage()
+ int errorCode = wfex.getErrorCode()
+
+ String falloutHandlerRequest =
+ """<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">
+ ${requestInfo}
+ <aetgt:WorkflowException xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1">
+ <aetgt:ErrorMessage>${errorMessage}</aetgt:ErrorMessage>
+ <aetgt:ErrorCode>${errorCode}</aetgt:ErrorCode>
+ </aetgt:WorkflowException>
+ </aetgt:FalloutHandlerRequest>"""
+
+ utils.log("DEBUG", processKey + " Outgoing WorkflowException is: " + execution.getVariable("WorkflowException"), isDebugEnabled)
+ utils.log("DEBUG", processKey + " Outgoing FalloutHandler Request is: " + falloutHandlerRequest, isDebugEnabled)
+
+ return falloutHandlerRequest
+
+ }catch(Exception e){
+ utils.log("DEBUG", "Caught Exception during ProcessMainflowBPMNException Method: " + e, isDebugEnabled)
+ return null
+ }
+ utils.log("DEBUG", "Completed ProcessMainflowBPMNException Method", isDebugEnabled)
+ }
+
+ /**
+ *
+ * This method is executed after an Java Exception is caught
+ * It sets the WorkflowException variable. The method can be used in either mainflow or subflows.
+ *
+ * @param - execution
+ *
+ */
+ public void processJavaException(Execution execution){
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ String processKey = getProcessKey(execution)
+ try{
+ utils.log("DEBUG", "Caught a Java Exception in " + processKey, isDebugEnabled)
+ utils.log("DEBUG", "Started processJavaException Method", isDebugEnabled)
+ buildWorkflowException(execution, 2500, "Catch a Java Lang Exception in " + processKey)
+
+ }catch(BpmnError b){
+ throw b
+ }catch(Exception e){
+ utils.log("DEBUG", "Caught Exception during processJavaException Method: " + e, isDebugEnabled)
+ buildWorkflowException(execution, 2500, "Internal Error - During Process Java Exception")
+ }
+ utils.log("DEBUG", "Completed processJavaException Method", isDebugEnabled)
+ }
+
+
+ public void preProcessRequest(Execution execution) {
+ // TODO Auto-generated method stub
+
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/FalloutHandler.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/FalloutHandler.groovy
index 62bf7be5ec..282cbb3c69 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/FalloutHandler.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/FalloutHandler.groovy
@@ -1,390 +1,390 @@
-/*-
- * ============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.common.scripts
-
-import java.text.SimpleDateFormat
-
-import org.apache.commons.lang3.*
-import org.camunda.bpm.engine.runtime.Execution
-
-public class FalloutHandler extends AbstractServiceTaskProcessor {
- String Prefix="FH_"
- ExceptionUtil exceptionUtil = new ExceptionUtil()
-
- public initializeProcessVariables(Execution execution){
- def method = getClass().getSimpleName() + '.initializeProcessVariables(' +'execution=' + execution.getId() +')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- try {
- execution.setVariable("prefix",Prefix)
-
- //These variables are form the input Message to the BPMN
- execution.setVariable("FH_request_id","")
- execution.setVariable("FH_request_action","")
- execution.setVariable("FH_notification-url","")
- execution.setVariable("FH_mso-bpel-name","")
- execution.setVariable("FH_ErrorCode", "")
- execution.setVariable("FH_ErrorMessage", "")
-
- execution.setVariable("FH_notification-url-Ok", false)
- execution.setVariable("FH_request_id-Ok", false)
-
- //These variables are for Get Mso Aai Password Adapter
- execution.setVariable("FH_deliveryStatus", true)
-
- //update Response Status to pending ...Adapter variables
- execution.setVariable("FH_updateResponseStatusPayload", null)
- execution.setVariable("FH_updateResponseStatusResponse", null)
-
- //update Request Gamma ...Adapter variables
- execution.setVariable("FH_updateRequestGammaPayload", "")
- execution.setVariable("FH_updateRequestGammaResponse", null)
- execution.setVariable("FH_updateRequestGammaResponseCode", null)
-
- //update Request Infra ...Adapter variables
- execution.setVariable("FH_updateRequestInfraPayload", "")
- execution.setVariable("FH_updateRequestInfraResponse", null)
- execution.setVariable("FH_updateRequestInfraResponseCode", null)
-
- //assign True to success variable
- execution.setVariable("FH_success", true)
-
- //Set notify status to Failed variable
- execution.setVariable("FH_NOTIFY_STATUS", "SUCCESS")
-
- //Set DB update variable
- execution.setVariable("FH_updateRequestPayload", "")
- execution.setVariable("FH_updateRequestResponse", null)
- execution.setVariable("FH_updateRequestResponseCode", null)
-
- //Auth variables
- execution.setVariable("BasicAuthHeaderValue","")
-
- //Parameter list
- execution.setVariable("FH_parameterList", "")
-
- //Response variables
- execution.setVariable("FalloutHandlerResponse","")
- execution.setVariable("FH_ErrorResponse", null)
- execution.setVariable("FH_ResponseCode", "")
-
- } catch (Exception e) {
- logError('Caught exception in ' + method, e)
- // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method)
- }
- }
-
- public void preProcessRequest (Execution execution) {
- def method = getClass().getSimpleName() + '.preProcessRequest(' +'execution=' + execution.getId() +')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- // Initialize flow variables
- initializeProcessVariables(execution)
- setSuccessIndicator(execution, false)
-
- try {
- String basicAuthValueDB = execution.getVariable("URN_mso_adapters_db_auth")
- utils.log("DEBUG", " Obtained BasicAuth userid password for Catalog DB adapter: " + basicAuthValueDB, isDebugLogEnabled)
-
- def encodedString = utils.getBasicAuth(basicAuthValueDB, execution.getVariable("URN_mso_msoKey"))
- execution.setVariable("BasicAuthHeaderValueDB",encodedString)
- } catch (IOException ex) {
- String dataErrorMessage = " Unable to encode Catalog DB user/password string - " + ex.getMessage()
- utils.log("DEBUG", dataErrorMessage, isDebugLogEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage)
- }
-
- try {
- def xml = execution.getVariable("FalloutHandlerRequest")
- utils.log("DEBUG", " XML --> " + xml, isDebugLogEnabled)
- utils.logAudit("FalloutHandler request: " + xml)
-
- //Check the incoming request type
- //Incoming request can be ACTIVE_REQUESTS (request-information node) or INFRA_ACTIVE_REQUESTS (request-info node)
- if (utils.nodeExists(xml, "request-information")) {
- execution.setVariable("FH_request_id-Ok", true) // Incoming request is for ACTIVE_REQUESTS
- }
-
- //Check notification-url for the incoming request type
- //ACTIVE_REQUESTS may have notificationurl node
- //INFRA_ACTIVE_REQUESTS notificationurl node does not exist
- def notificationurl = ""
- if (utils.nodeExists(xml, "notification-url")) {
- notificationurl = utils.getNodeText(xml,"notification-url")
- if(notificationurl != null && !notificationurl.isEmpty()) {
- utils.log("DEBUG", "********** Incoming notification Url is: " + notificationurl,isDebugLogEnabled);
- execution.setVariable("FH_notification-url-Ok", true)
- execution.setVariable("FH_notification-url",notificationurl)
- }
- }
-
- //Check request_id for the incoming request type
- //For INFRA_ACTIVE_REQUESTS payload request-id IS optional (Not sure why this is option since req id is primary key ... also tried exe through SOAP UI to check if MSO code handles null like auto generated seq not it does not)
- //For ACTIVE_REQUESTS payload request-id is NOT optional
- def request_id = ""
- if (utils.nodeExists(xml, "request-id")) {
- execution.setVariable("FH_request_id",utils.getNodeText(xml,"request-id"))
- }
- utils.logAudit("FH_request_id: " + execution.getVariable("FH_request_id"))
-
- // INFRA_ACTIVE_REQUESTS have "action" element ... mandatory
- // ACTIVE_REQUEST have "request-action" ... mandatory
- if (utils.nodeExists(xml, "request-action")) {
- execution.setVariable("FH_request_action",utils.getNodeText(xml,"request-action"))
- } else if (utils.nodeExists(xml, "action")) {
- execution.setVariable("FH_request_action",utils.getNodeText(xml,"action"))
- }
-
-
- //Check source for the incoming request type
- //For INFRA_ACTIVE_REQUESTS payload source IS optional
- //For ACTIVE_REQUESTS payload source is NOT optional
- def source = ""
- if (utils.nodeExists(xml, "source")) {
- execution.setVariable("FH_source",utils.getNodeText(xml,"source"))
- }
-
- //Check if ErrorCode node exists. If yes, initialize it from request xml, if no, it will stay with defaulf value already set in initializeProcessVariables() method above.
- def errorCode = ""
- if (utils.nodeExists(xml, "ErrorCode")) {
- errorCode = utils.getNodeText(xml,"ErrorCode")
- if(errorCode != null && !errorCode.isEmpty()) {
- execution.setVariable("FH_ErrorCode", errorCode)
- }
- }
- utils.logAudit("FH_ErrorCode: " + errorCode)
-
- //Check if ErrorMessage node exists. If yes, initialize it from request xml, if no, it will stay with defaulf value already set in initializeProcessVariables() method above.
- def errorMessage = ""
- if (utils.nodeExists(xml, "ErrorMessage")) {
- errorCode = utils.getNodeText(xml,"ErrorMessage")
- if(errorCode != null && !errorCode.isEmpty()) {
- errorCode = errorCode.replace("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;")
- execution.setVariable("FH_ErrorMessage", errorCode)
- }
- }
-
- //Check for Parameter List
- if (utils.nodeExists(xml, "parameter-list")) {
- def parameterList = utils.getNodeXml(xml, "parameter-list", false)
- execution.setVariable("FH_parameterList", parameterList)
- }
-
- utils.log("DEBUG","FH_notification-url-Ok --> " + execution.getVariable("FH_notification-url-Ok"),isDebugLogEnabled)
- utils.log("DEBUG","FH_request_id-OK --> " + execution.getVariable("FH_request_id-Ok"),isDebugLogEnabled)
-
- // set the DHV/Service Instantiation values if specified in the request
- execution.setVariable("FH_is_srv_inst_req", String.valueOf("true".equals(utils.getNodeText1(xml, "is-srv-inst-req"))))
- utils.log("DEBUG", "FH_is_srv_inst_req --> " + execution.getVariable("FH_is_srv_inst_req"), isDebugLogEnabled)
- execution.setVariable("FH_is_json_content", String.valueOf("JSON".equals(utils.getNodeText1(xml, "resp-content-type"))))
- utils.log("DEBUG", "FH_is_json_content --> " + execution.getVariable("FH_is_json_content"), isDebugLogEnabled)
- execution.setVariable("FH_service_inst_id", utils.getNodeText1(xml, "service-instance-id"))
- utils.log("DEBUG", "FH_service_inst_id --> " + execution.getVariable("FH_service_inst_id"), isDebugLogEnabled)
- execution.setVariable("FH_start_time", utils.getNodeText1(xml, "start-time"))
- utils.log("DEBUG", "FH_start_time --> " + execution.getVariable("FH_start_time"), isDebugLogEnabled)
- // this variable is used by the camunda flow to set the Content-Type for the async response
- if (execution.getVariable("FH_is_srv_inst_req").equals("true") &&
- execution.getVariable("FH_is_json_content").equals("true")) {
- execution.setVariable("FH_content_type", "application/json")
- } else {
- execution.setVariable("FH_content_type", "text/xml")
- }
- } catch (Exception e) {
- logError('Caught exception in ' + method, e)
- // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in" + method)
- }
-
- utils.log("DEBUG","OUTOF --> Initialize Variables Fallout Handler #########",isDebugLogEnabled);
- }
-
- public String updateRequestPayload (Execution execution){
- def method = getClass().getSimpleName() + '.updateRequestPayload(' +'execution=' + execution.getId() +')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- try {
- String payload = """
- <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://org.openecomp.mso/requestsdb">
- <soapenv:Header/>
- <soapenv:Body>
- <req:updateRequest>
- <requestId>${execution.getVariable("FH_request_id")}</requestId>
- <lastModifiedBy>BPEL</lastModifiedBy>
- <finalErrorMessage>${execution.getVariable("FH_ErrorMessage")}</finalErrorMessage>
- <finalErrorCode>${execution.getVariable("FH_ErrorCode")}</finalErrorCode>
- <status>FAILED</status>
- <responseStatus>${execution.getVariable("FH_NOTIFY_STATUS")}</responseStatus>
- </req:updateRequest>
- </soapenv:Body>
- </soapenv:Envelope>
- """
-
- utils.logAudit("updateRequestPayload: " + payload)
- execution.setVariable("FH_updateRequestPayload", payload)
- return execution.getVariable("FH_updateRequestPayload")
- } catch (Exception e) {
- logError('Caught exception in ' + method, e)
- // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method)
- }
- }
-
- public String updateRequestInfraPayload (Execution execution){
- def method = getClass().getSimpleName() + '.updateRequestInfraPayload(' +'execution=' + execution.getId() +')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- try {
- String payload = """
- <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://org.openecomp.mso/requestsdb">
- <soapenv:Header/>
- <soapenv:Body>
- <req:updateInfraRequest>
- <requestId>${execution.getVariable("FH_request_id")}</requestId>
- <lastModifiedBy>BPEL</lastModifiedBy>
- <statusMessage>${execution.getVariable("FH_ErrorMessage")}</statusMessage>
- <requestStatus>FAILED</requestStatus>
- <progress>100</progress>
- </req:updateInfraRequest>
- </soapenv:Body>
- </soapenv:Envelope>
- """
-
- execution.setVariable("FH_updateRequestInfraPayload", payload)
- utils.logAudit("updateRequestInfraPayload: " + payload)
- return execution.getVariable("FH_updateRequestInfraPayload")
- } catch (Exception e) {
- logError('Caught exception in ' + method, e)
- // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method)
- }
- }
-
- public String updateRequestGammaPayload (Execution execution){
- def method = getClass().getSimpleName() + '.updateRequestGammaPayload(' +'execution=' + execution.getId() +')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- try {
- String payload = """
- <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://org.openecomp.mso/requestsdb">
- <soapenv:Header/>
- <soapenv:Body>
- <req:updateRequest>
- <requestId>${execution.getVariable("FH_request_id")}</requestId>
- <lastModifiedBy>BPEL</lastModifiedBy>
- <finalErrorMessage>${execution.getVariable("FH_ErrorMessage")}</finalErrorMessage>
- <finalErrorCode>${execution.getVariable("FH_ErrorCode")}</finalErrorCode>
- <status>FAILED</status>
- </req:updateRequest>
- </soapenv:Body>
- </soapenv:Envelope>
- """
-
- execution.setVariable("FH_updateRequestGammaPayload", payload)
- utils.logAudit("updateRequestGammaPayload: " + payload)
- return execution.getVariable("FH_updateRequestGammaPayload")
- } catch (Exception e) {
- logError('Caught exception in ' + method, e)
- // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method)
- }
- }
-
- public String updateResponseStatusPayload (Execution execution){
- def method = getClass().getSimpleName() + '.updateResponseStatusPayload(' +'execution=' + execution.getId() +')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- try {
- String payload = """
- <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://org.openecomp.mso/requestsdb">
- <soapenv:Header/>
- <soapenv:Body>
- <req:updateResponseStatus>
- <requestId>${execution.getVariable("FH_request_id")}</requestId>
- <lastModifiedBy>BPEL</lastModifiedBy>
- <responseStatus>SENDING_FINAL_NOTIFY</responseStatus>
- </req:updateResponseStatus>
- </soapenv:Body>
- </soapenv:Envelope>
- """
-
- execution.setVariable("FH_updateResponseStatusPayload", payload)
- utils.logAudit("updateResponseStatusPayload: " + payload)
- return execution.getVariable("FH_updateResponseStatusPayload")
- } catch (Exception e) {
- logError('Caught exception in ' + method, e)
- // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method)
- }
- }
-
- public void buildDBWorkflowException(Execution execution, String responseCodeVariable) {
- def method = getClass().getSimpleName() + '.buildDBWorkflowException(' +
- 'execution=' + execution.getId() +
- ', responseCodeVariable=' + responseCodeVariable + ')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- try {
- def responseCode = execution.getVariable(responseCodeVariable)
- // If the HTTP response code was null, it means a connection fault occurred (a java exception)
- def errorMessage = responseCode == null ? "Could not connect to DB Adapter" : "DB Adapter returned ${responseCode} response"
- def errorCode = responseCode == null ? 7000 : 7020
- // exceptionUtil.buildWorkflowException(execution, errorCode, errorMessage)
- } catch (Exception e) {
- logError('Caught exception in ' + method, e)
- // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method)
- }
- }
-
- /**
- * Used to create a workflow response in success and failure cases.
- */
- public void postProcessResponse (Execution execution) {
- def method = getClass().getSimpleName() + '.postProcessResponse(' +'execution=' + execution.getId() +')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- try {
- Boolean success = (Boolean) execution.getVariable("FH_success")
- String out = success ? "Fallout Handler Succeeded" : "Fallout Handler Failed";
-
- def falloutHandlerResponse = """
- <workflow:FalloutHandlerResponse xmlns:workflow="http://org.openecomp/mso/workflow/schema/v1">
- <workflow:out>${out}</workflow:out>
- </workflow:FalloutHandlerResponse>
- """
-
- falloutHandlerResponse = utils.formatXml(falloutHandlerResponse)
- utils.logAudit("FalloutHandler Response: " + falloutHandlerResponse);
-
- execution.setVariable("FalloutHandlerResponse", falloutHandlerResponse)
- execution.setVariable("WorkflowResponse", falloutHandlerResponse)
- execution.setVariable("FH_ResponseCode", success ? "200" : "500")
- setSuccessIndicator(execution, success)
-
- logDebug("FalloutHandlerResponse =\n" + falloutHandlerResponse, isDebugLogEnabled)
- } catch (Exception e) {
- // Do NOT throw WorkflowException!
- logError('Caught exception in ' + method, e)
- }
- }
+/*-
+ * ============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.common.scripts
+
+import java.text.SimpleDateFormat
+
+import org.apache.commons.lang3.*
+import org.camunda.bpm.engine.runtime.Execution
+
+public class FalloutHandler extends AbstractServiceTaskProcessor {
+ String Prefix="FH_"
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+
+ public initializeProcessVariables(Execution execution){
+ def method = getClass().getSimpleName() + '.initializeProcessVariables(' +'execution=' + execution.getId() +')'
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ logDebug('Entered ' + method, isDebugLogEnabled)
+
+ try {
+ execution.setVariable("prefix",Prefix)
+
+ //These variables are form the input Message to the BPMN
+ execution.setVariable("FH_request_id","")
+ execution.setVariable("FH_request_action","")
+ execution.setVariable("FH_notification-url","")
+ execution.setVariable("FH_mso-bpel-name","")
+ execution.setVariable("FH_ErrorCode", "")
+ execution.setVariable("FH_ErrorMessage", "")
+
+ execution.setVariable("FH_notification-url-Ok", false)
+ execution.setVariable("FH_request_id-Ok", false)
+
+ //These variables are for Get Mso Aai Password Adapter
+ execution.setVariable("FH_deliveryStatus", true)
+
+ //update Response Status to pending ...Adapter variables
+ execution.setVariable("FH_updateResponseStatusPayload", null)
+ execution.setVariable("FH_updateResponseStatusResponse", null)
+
+ //update Request Gamma ...Adapter variables
+ execution.setVariable("FH_updateRequestGammaPayload", "")
+ execution.setVariable("FH_updateRequestGammaResponse", null)
+ execution.setVariable("FH_updateRequestGammaResponseCode", null)
+
+ //update Request Infra ...Adapter variables
+ execution.setVariable("FH_updateRequestInfraPayload", "")
+ execution.setVariable("FH_updateRequestInfraResponse", null)
+ execution.setVariable("FH_updateRequestInfraResponseCode", null)
+
+ //assign True to success variable
+ execution.setVariable("FH_success", true)
+
+ //Set notify status to Failed variable
+ execution.setVariable("FH_NOTIFY_STATUS", "SUCCESS")
+
+ //Set DB update variable
+ execution.setVariable("FH_updateRequestPayload", "")
+ execution.setVariable("FH_updateRequestResponse", null)
+ execution.setVariable("FH_updateRequestResponseCode", null)
+
+ //Auth variables
+ execution.setVariable("BasicAuthHeaderValue","")
+
+ //Parameter list
+ execution.setVariable("FH_parameterList", "")
+
+ //Response variables
+ execution.setVariable("FalloutHandlerResponse","")
+ execution.setVariable("FH_ErrorResponse", null)
+ execution.setVariable("FH_ResponseCode", "")
+
+ } catch (Exception e) {
+ logError('Caught exception in ' + method, e)
+ // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method)
+ }
+ }
+
+ public void preProcessRequest (Execution execution) {
+ def method = getClass().getSimpleName() + '.preProcessRequest(' +'execution=' + execution.getId() +')'
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ logDebug('Entered ' + method, isDebugLogEnabled)
+
+ // Initialize flow variables
+ initializeProcessVariables(execution)
+ setSuccessIndicator(execution, false)
+
+ try {
+ String basicAuthValueDB = execution.getVariable("URN_mso_adapters_db_auth")
+ utils.log("DEBUG", " Obtained BasicAuth userid password for Catalog DB adapter: " + basicAuthValueDB, isDebugLogEnabled)
+
+ def encodedString = utils.getBasicAuth(basicAuthValueDB, execution.getVariable("URN_mso_msoKey"))
+ execution.setVariable("BasicAuthHeaderValueDB",encodedString)
+ } catch (IOException ex) {
+ String dataErrorMessage = " Unable to encode Catalog DB user/password string - " + ex.getMessage()
+ utils.log("DEBUG", dataErrorMessage, isDebugLogEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage)
+ }
+
+ try {
+ def xml = execution.getVariable("FalloutHandlerRequest")
+ utils.log("DEBUG", " XML --> " + xml, isDebugLogEnabled)
+ utils.logAudit("FalloutHandler request: " + xml)
+
+ //Check the incoming request type
+ //Incoming request can be ACTIVE_REQUESTS (request-information node) or INFRA_ACTIVE_REQUESTS (request-info node)
+ if (utils.nodeExists(xml, "request-information")) {
+ execution.setVariable("FH_request_id-Ok", true) // Incoming request is for ACTIVE_REQUESTS
+ }
+
+ //Check notification-url for the incoming request type
+ //ACTIVE_REQUESTS may have notificationurl node
+ //INFRA_ACTIVE_REQUESTS notificationurl node does not exist
+ def notificationurl = ""
+ if (utils.nodeExists(xml, "notification-url")) {
+ notificationurl = utils.getNodeText(xml,"notification-url")
+ if(notificationurl != null && !notificationurl.isEmpty()) {
+ utils.log("DEBUG", "********** Incoming notification Url is: " + notificationurl,isDebugLogEnabled);
+ execution.setVariable("FH_notification-url-Ok", true)
+ execution.setVariable("FH_notification-url",notificationurl)
+ }
+ }
+
+ //Check request_id for the incoming request type
+ //For INFRA_ACTIVE_REQUESTS payload request-id IS optional (Not sure why this is option since req id is primary key ... also tried exe through SOAP UI to check if MSO code handles null like auto generated seq not it does not)
+ //For ACTIVE_REQUESTS payload request-id is NOT optional
+ def request_id = ""
+ if (utils.nodeExists(xml, "request-id")) {
+ execution.setVariable("FH_request_id",utils.getNodeText(xml,"request-id"))
+ }
+ utils.logAudit("FH_request_id: " + execution.getVariable("FH_request_id"))
+
+ // INFRA_ACTIVE_REQUESTS have "action" element ... mandatory
+ // ACTIVE_REQUEST have "request-action" ... mandatory
+ if (utils.nodeExists(xml, "request-action")) {
+ execution.setVariable("FH_request_action",utils.getNodeText(xml,"request-action"))
+ } else if (utils.nodeExists(xml, "action")) {
+ execution.setVariable("FH_request_action",utils.getNodeText(xml,"action"))
+ }
+
+
+ //Check source for the incoming request type
+ //For INFRA_ACTIVE_REQUESTS payload source IS optional
+ //For ACTIVE_REQUESTS payload source is NOT optional
+ def source = ""
+ if (utils.nodeExists(xml, "source")) {
+ execution.setVariable("FH_source",utils.getNodeText(xml,"source"))
+ }
+
+ //Check if ErrorCode node exists. If yes, initialize it from request xml, if no, it will stay with defaulf value already set in initializeProcessVariables() method above.
+ def errorCode = ""
+ if (utils.nodeExists(xml, "ErrorCode")) {
+ errorCode = utils.getNodeText(xml,"ErrorCode")
+ if(errorCode != null && !errorCode.isEmpty()) {
+ execution.setVariable("FH_ErrorCode", errorCode)
+ }
+ }
+ utils.logAudit("FH_ErrorCode: " + errorCode)
+
+ //Check if ErrorMessage node exists. If yes, initialize it from request xml, if no, it will stay with defaulf value already set in initializeProcessVariables() method above.
+ def errorMessage = ""
+ if (utils.nodeExists(xml, "ErrorMessage")) {
+ errorCode = utils.getNodeText(xml,"ErrorMessage")
+ if(errorCode != null && !errorCode.isEmpty()) {
+ errorCode = errorCode.replace("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;")
+ execution.setVariable("FH_ErrorMessage", errorCode)
+ }
+ }
+
+ //Check for Parameter List
+ if (utils.nodeExists(xml, "parameter-list")) {
+ def parameterList = utils.getNodeXml(xml, "parameter-list", false)
+ execution.setVariable("FH_parameterList", parameterList)
+ }
+
+ utils.log("DEBUG","FH_notification-url-Ok --> " + execution.getVariable("FH_notification-url-Ok"),isDebugLogEnabled)
+ utils.log("DEBUG","FH_request_id-OK --> " + execution.getVariable("FH_request_id-Ok"),isDebugLogEnabled)
+
+ // set the DHV/Service Instantiation values if specified in the request
+ execution.setVariable("FH_is_srv_inst_req", String.valueOf("true".equals(utils.getNodeText1(xml, "is-srv-inst-req"))))
+ utils.log("DEBUG", "FH_is_srv_inst_req --> " + execution.getVariable("FH_is_srv_inst_req"), isDebugLogEnabled)
+ execution.setVariable("FH_is_json_content", String.valueOf("JSON".equals(utils.getNodeText1(xml, "resp-content-type"))))
+ utils.log("DEBUG", "FH_is_json_content --> " + execution.getVariable("FH_is_json_content"), isDebugLogEnabled)
+ execution.setVariable("FH_service_inst_id", utils.getNodeText1(xml, "service-instance-id"))
+ utils.log("DEBUG", "FH_service_inst_id --> " + execution.getVariable("FH_service_inst_id"), isDebugLogEnabled)
+ execution.setVariable("FH_start_time", utils.getNodeText1(xml, "start-time"))
+ utils.log("DEBUG", "FH_start_time --> " + execution.getVariable("FH_start_time"), isDebugLogEnabled)
+ // this variable is used by the camunda flow to set the Content-Type for the async response
+ if (execution.getVariable("FH_is_srv_inst_req").equals("true") &&
+ execution.getVariable("FH_is_json_content").equals("true")) {
+ execution.setVariable("FH_content_type", "application/json")
+ } else {
+ execution.setVariable("FH_content_type", "text/xml")
+ }
+ } catch (Exception e) {
+ logError('Caught exception in ' + method, e)
+ // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in" + method)
+ }
+
+ utils.log("DEBUG","OUTOF --> Initialize Variables Fallout Handler #########",isDebugLogEnabled);
+ }
+
+ public String updateRequestPayload (Execution execution){
+ def method = getClass().getSimpleName() + '.updateRequestPayload(' +'execution=' + execution.getId() +')'
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ logDebug('Entered ' + method, isDebugLogEnabled)
+
+ try {
+ String payload = """
+ <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://org.openecomp.mso/requestsdb">
+ <soapenv:Header/>
+ <soapenv:Body>
+ <req:updateRequest>
+ <requestId>${execution.getVariable("FH_request_id")}</requestId>
+ <lastModifiedBy>BPEL</lastModifiedBy>
+ <finalErrorMessage>${execution.getVariable("FH_ErrorMessage")}</finalErrorMessage>
+ <finalErrorCode>${execution.getVariable("FH_ErrorCode")}</finalErrorCode>
+ <status>FAILED</status>
+ <responseStatus>${execution.getVariable("FH_NOTIFY_STATUS")}</responseStatus>
+ </req:updateRequest>
+ </soapenv:Body>
+ </soapenv:Envelope>
+ """
+
+ utils.logAudit("updateRequestPayload: " + payload)
+ execution.setVariable("FH_updateRequestPayload", payload)
+ return execution.getVariable("FH_updateRequestPayload")
+ } catch (Exception e) {
+ logError('Caught exception in ' + method, e)
+ // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method)
+ }
+ }
+
+ public String updateRequestInfraPayload (Execution execution){
+ def method = getClass().getSimpleName() + '.updateRequestInfraPayload(' +'execution=' + execution.getId() +')'
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ logDebug('Entered ' + method, isDebugLogEnabled)
+
+ try {
+ String payload = """
+ <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://org.openecomp.mso/requestsdb">
+ <soapenv:Header/>
+ <soapenv:Body>
+ <req:updateInfraRequest>
+ <requestId>${execution.getVariable("FH_request_id")}</requestId>
+ <lastModifiedBy>BPEL</lastModifiedBy>
+ <statusMessage>${execution.getVariable("FH_ErrorMessage")}</statusMessage>
+ <requestStatus>FAILED</requestStatus>
+ <progress>100</progress>
+ </req:updateInfraRequest>
+ </soapenv:Body>
+ </soapenv:Envelope>
+ """
+
+ execution.setVariable("FH_updateRequestInfraPayload", payload)
+ utils.logAudit("updateRequestInfraPayload: " + payload)
+ return execution.getVariable("FH_updateRequestInfraPayload")
+ } catch (Exception e) {
+ logError('Caught exception in ' + method, e)
+ // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method)
+ }
+ }
+
+ public String updateRequestGammaPayload (Execution execution){
+ def method = getClass().getSimpleName() + '.updateRequestGammaPayload(' +'execution=' + execution.getId() +')'
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ logDebug('Entered ' + method, isDebugLogEnabled)
+
+ try {
+ String payload = """
+ <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://org.openecomp.mso/requestsdb">
+ <soapenv:Header/>
+ <soapenv:Body>
+ <req:updateRequest>
+ <requestId>${execution.getVariable("FH_request_id")}</requestId>
+ <lastModifiedBy>BPEL</lastModifiedBy>
+ <finalErrorMessage>${execution.getVariable("FH_ErrorMessage")}</finalErrorMessage>
+ <finalErrorCode>${execution.getVariable("FH_ErrorCode")}</finalErrorCode>
+ <status>FAILED</status>
+ </req:updateRequest>
+ </soapenv:Body>
+ </soapenv:Envelope>
+ """
+
+ execution.setVariable("FH_updateRequestGammaPayload", payload)
+ utils.logAudit("updateRequestGammaPayload: " + payload)
+ return execution.getVariable("FH_updateRequestGammaPayload")
+ } catch (Exception e) {
+ logError('Caught exception in ' + method, e)
+ // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method)
+ }
+ }
+
+ public String updateResponseStatusPayload (Execution execution){
+ def method = getClass().getSimpleName() + '.updateResponseStatusPayload(' +'execution=' + execution.getId() +')'
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ logDebug('Entered ' + method, isDebugLogEnabled)
+
+ try {
+ String payload = """
+ <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://org.openecomp.mso/requestsdb">
+ <soapenv:Header/>
+ <soapenv:Body>
+ <req:updateResponseStatus>
+ <requestId>${execution.getVariable("FH_request_id")}</requestId>
+ <lastModifiedBy>BPEL</lastModifiedBy>
+ <responseStatus>SENDING_FINAL_NOTIFY</responseStatus>
+ </req:updateResponseStatus>
+ </soapenv:Body>
+ </soapenv:Envelope>
+ """
+
+ execution.setVariable("FH_updateResponseStatusPayload", payload)
+ utils.logAudit("updateResponseStatusPayload: " + payload)
+ return execution.getVariable("FH_updateResponseStatusPayload")
+ } catch (Exception e) {
+ logError('Caught exception in ' + method, e)
+ // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method)
+ }
+ }
+
+ public void buildDBWorkflowException(Execution execution, String responseCodeVariable) {
+ def method = getClass().getSimpleName() + '.buildDBWorkflowException(' +
+ 'execution=' + execution.getId() +
+ ', responseCodeVariable=' + responseCodeVariable + ')'
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ logDebug('Entered ' + method, isDebugLogEnabled)
+
+ try {
+ def responseCode = execution.getVariable(responseCodeVariable)
+ // If the HTTP response code was null, it means a connection fault occurred (a java exception)
+ def errorMessage = responseCode == null ? "Could not connect to DB Adapter" : "DB Adapter returned ${responseCode} response"
+ def errorCode = responseCode == null ? 7000 : 7020
+ // exceptionUtil.buildWorkflowException(execution, errorCode, errorMessage)
+ } catch (Exception e) {
+ logError('Caught exception in ' + method, e)
+ // exceptionUtil.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method)
+ }
+ }
+
+ /**
+ * Used to create a workflow response in success and failure cases.
+ */
+ public void postProcessResponse (Execution execution) {
+ def method = getClass().getSimpleName() + '.postProcessResponse(' +'execution=' + execution.getId() +')'
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ logDebug('Entered ' + method, isDebugLogEnabled)
+
+ try {
+ Boolean success = (Boolean) execution.getVariable("FH_success")
+ String out = success ? "Fallout Handler Succeeded" : "Fallout Handler Failed";
+
+ def falloutHandlerResponse = """
+ <workflow:FalloutHandlerResponse xmlns:workflow="http://org.openecomp/mso/workflow/schema/v1">
+ <workflow:out>${out}</workflow:out>
+ </workflow:FalloutHandlerResponse>
+ """
+
+ falloutHandlerResponse = utils.formatXml(falloutHandlerResponse)
+ utils.logAudit("FalloutHandler Response: " + falloutHandlerResponse);
+
+ execution.setVariable("FalloutHandlerResponse", falloutHandlerResponse)
+ execution.setVariable("WorkflowResponse", falloutHandlerResponse)
+ execution.setVariable("FH_ResponseCode", success ? "200" : "500")
+ setSuccessIndicator(execution, success)
+
+ logDebug("FalloutHandlerResponse =\n" + falloutHandlerResponse, isDebugLogEnabled)
+ } catch (Exception e) {
+ // Do NOT throw WorkflowException!
+ logError('Caught exception in ' + method, e)
+ }
+ }
} \ No newline at end of file
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenerateVfModuleName.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenerateVfModuleName.groovy
index 8001931525..fba5cbe1b0 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenerateVfModuleName.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenerateVfModuleName.groovy
@@ -1,166 +1,166 @@
-/*-
- * ============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.common.scripts
-import java.io.Serializable;
-
-import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.runtime.Execution
-import org.springframework.web.util.UriUtils
-
-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
-
-public class GenerateVfModuleName extends AbstractServiceTaskProcessor{
-
- def Prefix="GVFMN_"
- ExceptionUtil exceptionUtil = new ExceptionUtil()
-
-
-
- public void preProcessRequest(Execution execution) {
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
-
- try {
- def vnfId = execution.getVariable("vnfId")
- utils.log("DEBUG", "vnfId is " + vnfId, isDebugEnabled)
- def vnfName = execution.getVariable("vnfName")
- utils.log("DEBUG", "vnfName is " + vnfName, isDebugEnabled)
- def vfModuleLabel = execution.getVariable("vfModuleLabel")
- utils.log("DEBUG", "vfModuleLabel is " + vfModuleLabel, isDebugEnabled)
- def personaModelId = execution.getVariable("personaModelId")
- utils.log("DEBUG", "personaModelId is " + personaModelId, isDebugEnabled)
- execution.setVariable("GVFMN_vfModuleXml", "")
- }catch(BpmnError b){
- throw b
- }catch(Exception e){
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error encountered in initVariables method!")
- }
- }
-
-
- public void queryAAI(Execution execution) {
- def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled")
- def method = getClass().getSimpleName() + '.queryAAI(' +
- 'execution=' + execution.getId() +
- ')'
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- try {
- def vnfId = execution.getVariable('vnfId')
- def personaModelId = execution.getVariable('personaModelId')
-
- AaiUtil aaiUriUtil = new AaiUtil(this)
- String aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution)
- logDebug('AAI URI is: ' + aai_uri, isDebugLogEnabled)
-
- String endPoint = execution.getVariable("URN_aai_endpoint") + "${aai_uri}/" + UriUtils.encode(vnfId, "UTF-8") + "?depth=1"
- utils.logAudit("AAI endPoint: " + endPoint)
-
- try {
- RESTConfig config = new RESTConfig(endPoint);
- def responseData = ''
- def aaiRequestId = UUID.randomUUID().toString()
- RESTClient client = new RESTClient(config).
- addHeader('X-TransactionId', aaiRequestId).
- addHeader('X-FromAppId', 'MSO').
- addHeader('Content-Type', 'application/xml').
- addHeader('Accept','application/xml');
- logDebug('sending GET to AAI endpoint \'' + endPoint + '\'', isDebugLogEnabled)
- APIResponse response = client.httpGet()
- utils.logAudit("GenerateVfModuleName - invoking httpGet() to AAI")
-
- responseData = response.getResponseBodyAsString()
- if (responseData != null) {
- logDebug("Received generic VNF data: " + responseData, isDebugLogEnabled)
-
- }
-
- utils.logAudit("GenerateVfModuleName - queryAAIVfModule Response: " + responseData)
- utils.logAudit("GenerateVfModuleName - queryAAIVfModule ResponseCode: " + response.getStatusCode())
-
- execution.setVariable('GVFMN_queryAAIVfModuleResponseCode', response.getStatusCode())
- execution.setVariable('GVFMN_queryAAIVfModuleResponse', responseData)
- logDebug('Response code:' + response.getStatusCode(), isDebugLogEnabled)
- logDebug('Response:' + System.lineSeparator() + responseData, isDebugLogEnabled)
- if (response.getStatusCode() == 200) {
- // Set the VfModuleXML
- if (responseData != null) {
- String vfModulesText = utils.getNodeXml(responseData, "vf-modules")
- if (vfModulesText == null || vfModulesText.isEmpty()) {
- logDebug("There are no VF modules in this VNF yet", isDebugLogEnabled)
- execution.setVariable("GVFMN_vfModuleXml", null)
- }
- else {
- def xmlVfModules= new XmlSlurper().parseText(vfModulesText)
- def vfModules = xmlVfModules.'**'.findAll {it.name() == "vf-module"}
- int vfModulesSize = 0
- if (vfModules != null) {
- vfModulesSize = vfModules.size()
- }
- String matchingVfModules = "<vfModules>"
- for (i in 0..vfModulesSize-1) {
- def vfModuleXml = groovy.xml.XmlUtil.serialize(vfModules[i])
- def personaModelIdFromAAI = utils.getNodeText(vfModuleXml, "persona-model-id")
- if (personaModelIdFromAAI != null && personaModelIdFromAAI.equals(personaModelId)) {
- matchingVfModules = matchingVfModules + utils.removeXmlPreamble(vfModuleXml)
- }
- }
- matchingVfModules = matchingVfModules + "</vfModules>"
- logDebug("Matching VF Modules: " + matchingVfModules, isDebugLogEnabled)
- execution.setVariable("GVFMN_vfModuleXml", matchingVfModules)
- }
- }
- }
- } catch (Exception ex) {
- ex.printStackTrace()
- logDebug('Exception occurred while executing AAI GET:' + ex.getMessage(),isDebugLogEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'AAI GET Failed:' + ex.getMessage())
- }
- logDebug('Exited ' + method, isDebugLogEnabled)
- } catch (BpmnError e) {
- throw e;
- } catch (Exception e) {
- logError('Caught exception in ' + method, e)
- exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAI(): ' + e.getMessage())
- }
-
- }
-
- public void generateName (Execution execution) {
- def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled")
- def method = getClass().getSimpleName() + '.generateName() ' +
- 'execution=' + execution.getId() +
- ')'
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- String vfModuleXml = execution.getVariable("GVFMN_vfModuleXml")
-
- String moduleIndex = utils.getLowestUnusedIndex(vfModuleXml)
- logDebug("moduleIndex is: " + moduleIndex, isDebugLogEnabled)
- def vnfName = execution.getVariable("vnfName")
- def vfModuleLabel = execution.getVariable("vfModuleLabel")
- def vfModuleName = vnfName + "_" + vfModuleLabel + "_" + moduleIndex
- logDebug("vfModuleName is: " + vfModuleName, isDebugLogEnabled)
- execution.setVariable("vfModuleName", vfModuleName)
- }
-}
+/*-
+ * ============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.common.scripts
+import java.io.Serializable;
+
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.runtime.Execution
+import org.springframework.web.util.UriUtils
+
+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
+
+public class GenerateVfModuleName extends AbstractServiceTaskProcessor{
+
+ def Prefix="GVFMN_"
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+
+
+
+ public void preProcessRequest(Execution execution) {
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+
+ try {
+ def vnfId = execution.getVariable("vnfId")
+ utils.log("DEBUG", "vnfId is " + vnfId, isDebugEnabled)
+ def vnfName = execution.getVariable("vnfName")
+ utils.log("DEBUG", "vnfName is " + vnfName, isDebugEnabled)
+ def vfModuleLabel = execution.getVariable("vfModuleLabel")
+ utils.log("DEBUG", "vfModuleLabel is " + vfModuleLabel, isDebugEnabled)
+ def personaModelId = execution.getVariable("personaModelId")
+ utils.log("DEBUG", "personaModelId is " + personaModelId, isDebugEnabled)
+ execution.setVariable("GVFMN_vfModuleXml", "")
+ }catch(BpmnError b){
+ throw b
+ }catch(Exception e){
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error encountered in initVariables method!")
+ }
+ }
+
+
+ public void queryAAI(Execution execution) {
+ def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled")
+ def method = getClass().getSimpleName() + '.queryAAI(' +
+ 'execution=' + execution.getId() +
+ ')'
+ logDebug('Entered ' + method, isDebugLogEnabled)
+
+ try {
+ def vnfId = execution.getVariable('vnfId')
+ def personaModelId = execution.getVariable('personaModelId')
+
+ AaiUtil aaiUriUtil = new AaiUtil(this)
+ String aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution)
+ logDebug('AAI URI is: ' + aai_uri, isDebugLogEnabled)
+
+ String endPoint = execution.getVariable("URN_aai_endpoint") + "${aai_uri}/" + UriUtils.encode(vnfId, "UTF-8") + "?depth=1"
+ utils.logAudit("AAI endPoint: " + endPoint)
+
+ try {
+ RESTConfig config = new RESTConfig(endPoint);
+ def responseData = ''
+ def aaiRequestId = UUID.randomUUID().toString()
+ RESTClient client = new RESTClient(config).
+ addHeader('X-TransactionId', aaiRequestId).
+ addHeader('X-FromAppId', 'MSO').
+ addHeader('Content-Type', 'application/xml').
+ addHeader('Accept','application/xml');
+ logDebug('sending GET to AAI endpoint \'' + endPoint + '\'', isDebugLogEnabled)
+ APIResponse response = client.httpGet()
+ utils.logAudit("GenerateVfModuleName - invoking httpGet() to AAI")
+
+ responseData = response.getResponseBodyAsString()
+ if (responseData != null) {
+ logDebug("Received generic VNF data: " + responseData, isDebugLogEnabled)
+
+ }
+
+ utils.logAudit("GenerateVfModuleName - queryAAIVfModule Response: " + responseData)
+ utils.logAudit("GenerateVfModuleName - queryAAIVfModule ResponseCode: " + response.getStatusCode())
+
+ execution.setVariable('GVFMN_queryAAIVfModuleResponseCode', response.getStatusCode())
+ execution.setVariable('GVFMN_queryAAIVfModuleResponse', responseData)
+ logDebug('Response code:' + response.getStatusCode(), isDebugLogEnabled)
+ logDebug('Response:' + System.lineSeparator() + responseData, isDebugLogEnabled)
+ if (response.getStatusCode() == 200) {
+ // Set the VfModuleXML
+ if (responseData != null) {
+ String vfModulesText = utils.getNodeXml(responseData, "vf-modules")
+ if (vfModulesText == null || vfModulesText.isEmpty()) {
+ logDebug("There are no VF modules in this VNF yet", isDebugLogEnabled)
+ execution.setVariable("GVFMN_vfModuleXml", null)
+ }
+ else {
+ def xmlVfModules= new XmlSlurper().parseText(vfModulesText)
+ def vfModules = xmlVfModules.'**'.findAll {it.name() == "vf-module"}
+ int vfModulesSize = 0
+ if (vfModules != null) {
+ vfModulesSize = vfModules.size()
+ }
+ String matchingVfModules = "<vfModules>"
+ for (i in 0..vfModulesSize-1) {
+ def vfModuleXml = groovy.xml.XmlUtil.serialize(vfModules[i])
+ def personaModelIdFromAAI = utils.getNodeText(vfModuleXml, "persona-model-id")
+ if (personaModelIdFromAAI != null && personaModelIdFromAAI.equals(personaModelId)) {
+ matchingVfModules = matchingVfModules + utils.removeXmlPreamble(vfModuleXml)
+ }
+ }
+ matchingVfModules = matchingVfModules + "</vfModules>"
+ logDebug("Matching VF Modules: " + matchingVfModules, isDebugLogEnabled)
+ execution.setVariable("GVFMN_vfModuleXml", matchingVfModules)
+ }
+ }
+ }
+ } catch (Exception ex) {
+ ex.printStackTrace()
+ logDebug('Exception occurred while executing AAI GET:' + ex.getMessage(),isDebugLogEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'AAI GET Failed:' + ex.getMessage())
+ }
+ logDebug('Exited ' + method, isDebugLogEnabled)
+ } catch (BpmnError e) {
+ throw e;
+ } catch (Exception e) {
+ logError('Caught exception in ' + method, e)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAI(): ' + e.getMessage())
+ }
+
+ }
+
+ public void generateName (Execution execution) {
+ def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled")
+ def method = getClass().getSimpleName() + '.generateName() ' +
+ 'execution=' + execution.getId() +
+ ')'
+ logDebug('Entered ' + method, isDebugLogEnabled)
+
+ String vfModuleXml = execution.getVariable("GVFMN_vfModuleXml")
+
+ String moduleIndex = utils.getLowestUnusedIndex(vfModuleXml)
+ logDebug("moduleIndex is: " + moduleIndex, isDebugLogEnabled)
+ def vnfName = execution.getVariable("vnfName")
+ def vfModuleLabel = execution.getVariable("vfModuleLabel")
+ def vfModuleName = vnfName + "_" + vfModuleLabel + "_" + moduleIndex
+ logDebug("vfModuleName is: " + vfModuleName, isDebugLogEnabled)
+ execution.setVariable("vfModuleName", vfModuleName)
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericDeleteService.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericDeleteService.groovy
index 2db3d97853..3784ae2249 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericDeleteService.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericDeleteService.groovy
@@ -1,303 +1,308 @@
-/*-
- * ============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.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 GenericDeleteService Sub Flow.
- * This Generic sub flow can be used by any flow for the
- * goal of deleting a Service-Instance or Service-Subscription.
- * The calling flow must set the GENDS_type variable as "service-instance"
- * or "service-subscription".
- *
- * If the resource-version is not provided by the calling flow
- * then this sub flow will query the service-instance or
- * service-subscription, prior to deleting it, in order to
- * obtain this resource version. Upon successful completion of
- * this sub flow the GENDS_SuccessIndicator will be true. A
- * MSOWorkflowException will be thrown if an error occurs within this 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
- * response.
- *
- * Incoming Variables (Service-Instance):
- * @param - GENDS_serviceInstanceId
- * @param - GENDS_serviceType
- * @param - GENDS_globalCustomerId
- * @param - GENDS_type
- * @param (Optional) - GENDS_resourceVersion
- *
- * Incoming Variables (Service-Subscription):
- * @param - GENDS_serviceType
- * @param - GENDS_globalCustomerId
- * @param - GENDS_type
- * @param (Optional) - GENDS_resourceVersion
- *
- *
- * Outgoing Variables:
- * @param - GENDS_SuccessIndicator
- * @param - GENDS_FoundIndicator
- * @param - WorkflowException
- */
-class GenericDeleteService extends AbstractServiceTaskProcessor{
-
- String Prefix = "GENDS_"
- ExceptionUtil exceptionUtil = new ExceptionUtil()
-
- /**
- * This method validates the incoming variables and
- * determines if the resource version was provided
- *
- * @param - execution
- */
- public void preProcessRequest(Execution execution) {
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
- execution.setVariable("prefix",Prefix)
- utils.log("DEBUG", " *** STARTED GenericDeleteService PreProcessRequest Process*** ", isDebugEnabled)
-
- execution.setVariable("GENDS_resourceVersionProvidedFlag", true)
- execution.setVariable("GENDS_SuccessIndicator", false)
- execution.setVariable("GENDS_FoundIndicator", false)
-
- try{
- // Get Variables
- String globalCustomerId = execution.getVariable("GENDS_globalCustomerId")
- String serviceInstanceId = execution.getVariable("GENDS_serviceInstanceId")
- String serviceType = execution.getVariable("GENDS_serviceType")
- String type = execution.getVariable("GENDS_type")
-
- if(type != null){
- utils.log("DEBUG", "Incoming GENDS_type is: " + type, isDebugEnabled)
- if(isBlank(globalCustomerId) || isBlank(serviceType)){
- utils.log("DEBUG", "Incoming Required Variable is null!", isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Required Variable is Missing or Null!")
- }else{
- utils.log("DEBUG", "Incoming Global Customer Id is: " + globalCustomerId, isDebugEnabled)
- utils.log("DEBUG", "Incoming Service Type is: " + serviceType, isDebugEnabled)
- if(type.equalsIgnoreCase("service-instance")){
- if(isBlank(serviceInstanceId)){
- utils.log("DEBUG", "Incoming Required Variable is null!", isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Required Variable is Missing or Null!")
- }else{
- utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugEnabled)
- utils.log("DEBUG", "Preparing Delete Service-Instance Process", isDebugEnabled)
- }
- }else if(type.equalsIgnoreCase("service-subscription")){
- utils.log("DEBUG", "Preparing Delete Service-Subscription Process", isDebugEnabled)
- }else{
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Type is Invalid. Please Specify Type as service-instance or service-subscription")
- }
- }
-
- String resourceVersion = execution.getVariable('GENDS_resourceVersion')
- if(isBlank(resourceVersion)){
- utils.log("DEBUG", "Service Instance Resource Version is NOT Provided", isDebugEnabled)
- execution.setVariable("GENDS_resourceVersionProvidedFlag", false)
- }else{
- utils.log("DEBUG", "Incoming SI Resource Version is: " + resourceVersion, isDebugEnabled)
- }
-
- }else{
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Incoming GENDS_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 GenericDeleteService PreProcessRequest method!" + e, isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in GenericDeleteService PreProcessRequest")
-
- }
- utils.log("DEBUG", "*** COMPLETED GenericDeleteService PreProcessRequest Process ***", isDebugEnabled)
- }
-
- /**
- * This method executes a GET call to AAI for the service instance
- * or service-subscription so that the objects's resource-version
- * can be obtained.
- *
- * @param - execution
- */
- public void getServiceResourceVersion(Execution execution){
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- execution.setVariable("prefix",Prefix)
- utils.log("DEBUG", " *** STARTED GenericDeleteService GetServiceResourceVersion Process*** ", isDebugEnabled)
- try {
- String serviceType = execution.getVariable("GENDS_serviceType")
- utils.log("DEBUG", " Incoming GENDS_serviceType is: " + serviceType, isDebugEnabled)
- String globalCustomerId = execution.getVariable("GENDS_globalCustomerId")
- utils.log("DEBUG", "Incoming Global Customer Id is: " + globalCustomerId, isDebugEnabled)
- String type = execution.getVariable("GENDS_type")
- String serviceEndpoint = ""
-
- if(type.equalsIgnoreCase("service-instance")){
- String serviceInstanceId = execution.getVariable("GENDS_serviceInstanceId")
- utils.log("DEBUG", " Incoming GENDS_serviceInstanceId is: " + serviceInstanceId, isDebugEnabled)
- serviceEndpoint = UriUtils.encode(globalCustomerId,"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")){
- serviceEndpoint = UriUtils.encode(globalCustomerId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8")
- }
-
- String aai_endpoint = execution.getVariable("URN_aai_endpoint")
- AaiUtil aaiUriUtil = new AaiUtil(this)
- String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution)
- logDebug('AAI URI is: ' + aai_uri, isDebugEnabled)
-
- String serviceAaiPath = "${aai_endpoint}${aai_uri}/" + serviceEndpoint
-
- execution.setVariable("GENDS_serviceAaiPath", serviceAaiPath)
- utils.log("DEBUG", "GET Service Instance AAI Path is: " + "\n" + serviceAaiPath, isDebugEnabled)
- utils.logAudit("GenericDeleteService GET AAI Path: " + serviceAaiPath)
-
- APIResponse response = aaiUriUtil.executeAAIGetCall(execution, serviceAaiPath)
- int responseCode = response.getStatusCode()
- execution.setVariable("GENDS_getServiceResponseCode", responseCode)
- utils.log("DEBUG", " GET Service Instance response code is: " + responseCode, isDebugEnabled)
- utils.logAudit("GET Service Instance response code: " + responseCode)
-
- String aaiResponse = response.getResponseBodyAsString()
- aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse)
- execution.setVariable("GENDS_getServiceResponse", aaiResponse)
-
- utils.logAudit("GET Service Instance response : " + aaiResponse)
- //Process Response
- if(responseCode == 200 || responseCode == 202){
- utils.log("DEBUG", "GET Service Received a Good Response: \n" + aaiResponse, isDebugEnabled)
- execution.setVariable("GENDS_SuccessIndicator", true)
- execution.setVariable("GENDS_FoundIndicator", true)
- String resourceVersion = utils.getNodeText1(aaiResponse, "resource-version")
- execution.setVariable("GENDS_resourceVersion", resourceVersion)
- utils.log("DEBUG", type + " Resource Version is: " + resourceVersion, isDebugEnabled)
-
- }else if(responseCode == 404){
- utils.log("DEBUG", "GET Service Received a Not Found (404) Response", isDebugEnabled)
- execution.setVariable("GENDS_SuccessIndicator", true)
- 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 GenericDeleteService GetServiceResourceVersion method!" + e, isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During GetServiceResourceVersion")
- }
- utils.log("DEBUG", " *** COMPLETED GenericDeleteService GetServiceResourceVersion Process*** ", isDebugEnabled)
- }
-
- /**
- * This method executes a DELETE call to AAI for the provided
- * service-instance or service-subscription.
- *
- * @param - execution
- */
- public void deleteServiceObject(Execution execution){
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- execution.setVariable("prefix",Prefix)
- utils.log("DEBUG", " *** STARTED GenericDeleteService DeleteServiceObject Process*** ", isDebugEnabled)
- try {
- AaiUtil aaiUriUtil = new AaiUtil(this)
- String type = execution.getVariable("GENDS_type")
- String serviceAaiPath = execution.getVariable("GENDS_serviceAaiPath")
- String serviceEndpoint = ""
-
- if(isEmpty(serviceAaiPath)){
- String serviceType = execution.getVariable("GENDS_serviceType")
- utils.log("DEBUG", " Incoming GENDS_serviceType is: " + serviceType, isDebugEnabled)
- String globalCustomerId = execution.getVariable("GENDS_globalCustomerId")
- utils.log("DEBUG", "Incoming Global Customer Id is: " + globalCustomerId, isDebugEnabled)
- if(type.equalsIgnoreCase("service-instance")){
- String serviceInstanceId = execution.getVariable("GENDS_serviceInstanceId")
- utils.log("DEBUG", " Incoming GENDS_serviceInstanceId is: " + serviceInstanceId, isDebugEnabled)
- serviceEndpoint = UriUtils.encode(globalCustomerId,"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")){
- serviceEndpoint = UriUtils.encode(globalCustomerId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8")
- }
-
- String aai_endpoint = execution.getVariable("URN_aai_endpoint")
- String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution)
- logDebug('AAI URI is: ' + aai_uri, isDebugEnabled)
-
- serviceAaiPath = "${aai_endpoint}${aai_uri}/" + serviceEndpoint
- }
-
- String resourceVersion = execution.getVariable("GENDS_resourceVersion")
- utils.log("DEBUG", "Incoming Resource Version is: " + resourceVersion, isDebugEnabled)
- if(resourceVersion !=null){
- serviceAaiPath = serviceAaiPath +'?resource-version=' + UriUtils.encode(resourceVersion,"UTF-8")
- }
-
- execution.setVariable("GENDS_deleteServiceAaiPath", serviceAaiPath)
- utils.log("DEBUG", "DELETE Service AAI Path is: " + "\n" + serviceAaiPath, isDebugEnabled)
- utils.logAudit("DELETE Service AAI Path: " + serviceAaiPath)
-
- APIResponse response = aaiUriUtil.executeAAIDeleteCall(execution, serviceAaiPath)
- int responseCode = response.getStatusCode()
- execution.setVariable("GENDS_deleteServiceResponseCode", responseCode)
- utils.log("DEBUG", " DELETE Service response code is: " + responseCode, isDebugEnabled)
- utils.logAudit("DELETE Service Response Code: " + responseCode)
-
- String aaiResponse = response.getResponseBodyAsString()
- aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse)
- execution.setVariable("GENDS_deleteServiceResponse", aaiResponse)
- utils.logAudit("DELETE Service Response: " + aaiResponse)
-
- //Process Response
- if(responseCode == 200 || responseCode == 204){
- utils.log("DEBUG", " DELETE Service Received a Good Response", isDebugEnabled)
- execution.setVariable("GENDS_FoundIndicator", true)
- }else if(responseCode == 404){
- utils.log("DEBUG", " DELETE Service Received a Not Found (404) Response", isDebugEnabled)
- execution.setVariable("GENDS_FoundIndicator", false)
- }else{
- utils.log("DEBUG", "DELETE Service 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("DEBUG", " Error encountered within GenericDeleteService DeleteServiceObject method!" + e, isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During Delete Service Object")
- }
- utils.log("DEBUG", " *** COMPLETED GenericDeleteService DeleteServiceObject Process*** ", isDebugEnabled)
- }
-
-}
+/*-
+ * ============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.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 GenericDeleteService Sub Flow.
+ * This Generic sub flow can be used by any flow for the
+ * goal of deleting a Service-Instance or Service-Subscription.
+ * The calling flow must set the GENDS_type variable as "service-instance"
+ * or "service-subscription".
+ *
+ * If the resource-version is not provided by the calling flow
+ * then this sub flow will query the service-instance or
+ * service-subscription, prior to deleting it, in order to
+ * obtain this resource version. Upon successful completion of
+ * this sub flow the GENDS_SuccessIndicator will be true. A
+ * MSOWorkflowException will be thrown if an error occurs within this 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
+ * response.
+ *
+ *
+ * Variable Mapping Below
+ *
+ * In Mapping Variables:
+ * For Service-Instance:
+ * @param - GENDS_serviceInstanceId
+ * @param - GENDS_serviceType
+ * @param - GENDS_globalCustomerId
+ * @param - GENDS_type
+ * @param (Optional) - GENDS_resourceVersion
+ *
+ * For Service-Subscription:
+ * @param - GENDS_serviceType
+ * @param - GENDS_globalCustomerId
+ * @param - GENDS_type
+ * @param (Optional) - GENDS_resourceVersion
+ *
+ *
+ * Out Mapping Variables:
+ * @param - GENDS_FoundIndicator
+ * @param - WorkflowException
+ *
+ *
+ */
+class GenericDeleteService extends AbstractServiceTaskProcessor{
+
+ String Prefix = "GENDS_"
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+
+ /**
+ * This method validates the incoming variables and
+ * determines if the resource version was provided
+ *
+ * @param - execution
+ */
+ public void preProcessRequest(Execution execution) {
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ execution.setVariable("prefix",Prefix)
+ utils.log("DEBUG", " *** STARTED GenericDeleteService PreProcessRequest Process*** ", isDebugEnabled)
+
+ execution.setVariable("GENDS_resourceVersionProvidedFlag", true)
+ execution.setVariable("GENDS_SuccessIndicator", false)
+ execution.setVariable("GENDS_FoundIndicator", false)
+
+ try{
+ // Get Variables
+ String globalCustomerId = execution.getVariable("GENDS_globalCustomerId")
+ String serviceInstanceId = execution.getVariable("GENDS_serviceInstanceId")
+ String serviceType = execution.getVariable("GENDS_serviceType")
+ String type = execution.getVariable("GENDS_type")
+
+ if(type != null){
+ utils.log("DEBUG", "Incoming GENDS_type is: " + type, isDebugEnabled)
+ if(isBlank(globalCustomerId) || isBlank(serviceType)){
+ utils.log("DEBUG", "Incoming Required Variable is null!", isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Required Variable is Missing or Null!")
+ }else{
+ utils.log("DEBUG", "Incoming Global Customer Id is: " + globalCustomerId, isDebugEnabled)
+ utils.log("DEBUG", "Incoming Service Type is: " + serviceType, isDebugEnabled)
+ if(type.equalsIgnoreCase("service-instance")){
+ if(isBlank(serviceInstanceId)){
+ utils.log("DEBUG", "Incoming Required Variable is null!", isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Required Variable is Missing or Null!")
+ }else{
+ utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugEnabled)
+ utils.log("DEBUG", "Preparing Delete Service-Instance Process", isDebugEnabled)
+ }
+ }else if(type.equalsIgnoreCase("service-subscription")){
+ utils.log("DEBUG", "Preparing Delete Service-Subscription Process", isDebugEnabled)
+ }else{
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Type is Invalid. Please Specify Type as service-instance or service-subscription")
+ }
+ }
+
+ String resourceVersion = execution.getVariable('GENDS_resourceVersion')
+ if(isBlank(resourceVersion)){
+ utils.log("DEBUG", "Service Instance Resource Version is NOT Provided", isDebugEnabled)
+ execution.setVariable("GENDS_resourceVersionProvidedFlag", false)
+ }else{
+ utils.log("DEBUG", "Incoming SI Resource Version is: " + resourceVersion, isDebugEnabled)
+ }
+
+ }else{
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Incoming GENDS_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 GenericDeleteService PreProcessRequest method!" + e, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in GenericDeleteService PreProcessRequest")
+
+ }
+ utils.log("DEBUG", "*** COMPLETED GenericDeleteService PreProcessRequest Process ***", isDebugEnabled)
+ }
+
+ /**
+ * This method executes a GET call to AAI for the service instance
+ * or service-subscription so that the objects's resource-version
+ * can be obtained.
+ *
+ * @param - execution
+ */
+ public void getServiceResourceVersion(Execution execution){
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ execution.setVariable("prefix",Prefix)
+ utils.log("DEBUG", " *** STARTED GenericDeleteService GetServiceResourceVersion Process*** ", isDebugEnabled)
+ try {
+ String serviceType = execution.getVariable("GENDS_serviceType")
+ utils.log("DEBUG", " Incoming GENDS_serviceType is: " + serviceType, isDebugEnabled)
+ String globalCustomerId = execution.getVariable("GENDS_globalCustomerId")
+ utils.log("DEBUG", "Incoming Global Customer Id is: " + globalCustomerId, isDebugEnabled)
+ String type = execution.getVariable("GENDS_type")
+ String serviceEndpoint = ""
+
+ if(type.equalsIgnoreCase("service-instance")){
+ String serviceInstanceId = execution.getVariable("GENDS_serviceInstanceId")
+ utils.log("DEBUG", " Incoming GENDS_serviceInstanceId is: " + serviceInstanceId, isDebugEnabled)
+ serviceEndpoint = UriUtils.encode(globalCustomerId,"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")){
+ serviceEndpoint = UriUtils.encode(globalCustomerId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8")
+ }
+
+ String aai_endpoint = execution.getVariable("URN_aai_endpoint")
+ AaiUtil aaiUriUtil = new AaiUtil(this)
+ String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution)
+ logDebug('AAI URI is: ' + aai_uri, isDebugEnabled)
+
+ String serviceAaiPath = "${aai_endpoint}${aai_uri}/" + serviceEndpoint
+
+ execution.setVariable("GENDS_serviceAaiPath", serviceAaiPath)
+ utils.log("DEBUG", "GET Service Instance AAI Path is: " + "\n" + serviceAaiPath, isDebugEnabled)
+ utils.logAudit("GenericDeleteService GET AAI Path: " + serviceAaiPath)
+
+ APIResponse response = aaiUriUtil.executeAAIGetCall(execution, serviceAaiPath)
+ int responseCode = response.getStatusCode()
+ execution.setVariable("GENDS_getServiceResponseCode", responseCode)
+ utils.log("DEBUG", " GET Service Instance response code is: " + responseCode, isDebugEnabled)
+ utils.logAudit("GET Service Instance response code: " + responseCode)
+
+ String aaiResponse = response.getResponseBodyAsString()
+ aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse)
+ execution.setVariable("GENDS_getServiceResponse", aaiResponse)
+
+ utils.logAudit("GET Service Instance response : " + aaiResponse)
+ //Process Response
+ if(responseCode == 200 || responseCode == 202){
+ utils.log("DEBUG", "GET Service Received a Good Response: \n" + aaiResponse, isDebugEnabled)
+ execution.setVariable("GENDS_SuccessIndicator", true)
+ execution.setVariable("GENDS_FoundIndicator", true)
+ String resourceVersion = utils.getNodeText1(aaiResponse, "resource-version")
+ execution.setVariable("GENDS_resourceVersion", resourceVersion)
+ utils.log("DEBUG", type + " Resource Version is: " + resourceVersion, isDebugEnabled)
+
+ }else if(responseCode == 404){
+ utils.log("DEBUG", "GET Service Received a Not Found (404) Response", isDebugEnabled)
+ execution.setVariable("GENDS_SuccessIndicator", true)
+ 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 GenericDeleteService GetServiceResourceVersion method!" + e, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During GetServiceResourceVersion")
+ }
+ utils.log("DEBUG", " *** COMPLETED GenericDeleteService GetServiceResourceVersion Process*** ", isDebugEnabled)
+ }
+
+ /**
+ * This method executes a DELETE call to AAI for the provided
+ * service-instance or service-subscription.
+ *
+ * @param - execution
+ */
+ public void deleteServiceObject(Execution execution){
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ execution.setVariable("prefix",Prefix)
+ utils.log("DEBUG", " *** STARTED GenericDeleteService DeleteServiceObject Process*** ", isDebugEnabled)
+ try {
+ AaiUtil aaiUriUtil = new AaiUtil(this)
+ String type = execution.getVariable("GENDS_type")
+ String serviceAaiPath = execution.getVariable("GENDS_serviceAaiPath")
+ String serviceEndpoint = ""
+
+ if(isEmpty(serviceAaiPath)){
+ String serviceType = execution.getVariable("GENDS_serviceType")
+ utils.log("DEBUG", " Incoming GENDS_serviceType is: " + serviceType, isDebugEnabled)
+ String globalCustomerId = execution.getVariable("GENDS_globalCustomerId")
+ utils.log("DEBUG", "Incoming Global Customer Id is: " + globalCustomerId, isDebugEnabled)
+ if(type.equalsIgnoreCase("service-instance")){
+ String serviceInstanceId = execution.getVariable("GENDS_serviceInstanceId")
+ utils.log("DEBUG", " Incoming GENDS_serviceInstanceId is: " + serviceInstanceId, isDebugEnabled)
+ serviceEndpoint = UriUtils.encode(globalCustomerId,"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")){
+ serviceEndpoint = UriUtils.encode(globalCustomerId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8")
+ }
+
+ String aai_endpoint = execution.getVariable("URN_aai_endpoint")
+ String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution)
+ logDebug('AAI URI is: ' + aai_uri, isDebugEnabled)
+
+ serviceAaiPath = "${aai_endpoint}${aai_uri}/" + serviceEndpoint
+ }
+
+ String resourceVersion = execution.getVariable("GENDS_resourceVersion")
+ utils.log("DEBUG", "Incoming Resource Version is: " + resourceVersion, isDebugEnabled)
+ if(resourceVersion !=null){
+ serviceAaiPath = serviceAaiPath +'?resource-version=' + UriUtils.encode(resourceVersion,"UTF-8")
+ }
+
+ execution.setVariable("GENDS_deleteServiceAaiPath", serviceAaiPath)
+ utils.log("DEBUG", "DELETE Service AAI Path is: " + "\n" + serviceAaiPath, isDebugEnabled)
+ utils.logAudit("DELETE Service AAI Path: " + serviceAaiPath)
+
+ APIResponse response = aaiUriUtil.executeAAIDeleteCall(execution, serviceAaiPath)
+ int responseCode = response.getStatusCode()
+ execution.setVariable("GENDS_deleteServiceResponseCode", responseCode)
+ utils.log("DEBUG", " DELETE Service response code is: " + responseCode, isDebugEnabled)
+ utils.logAudit("DELETE Service Response Code: " + responseCode)
+
+ String aaiResponse = response.getResponseBodyAsString()
+ aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse)
+ execution.setVariable("GENDS_deleteServiceResponse", aaiResponse)
+ utils.logAudit("DELETE Service Response: " + aaiResponse)
+
+ //Process Response
+ if(responseCode == 200 || responseCode == 204){
+ utils.log("DEBUG", " DELETE Service Received a Good Response", isDebugEnabled)
+ execution.setVariable("GENDS_FoundIndicator", true)
+ }else if(responseCode == 404){
+ utils.log("DEBUG", " DELETE Service Received a Not Found (404) Response", isDebugEnabled)
+ execution.setVariable("GENDS_FoundIndicator", false)
+ }else{
+ utils.log("DEBUG", "DELETE Service 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("DEBUG", " Error encountered within GenericDeleteService DeleteServiceObject method!" + e, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During Delete Service Object")
+ }
+ utils.log("DEBUG", " *** COMPLETED GenericDeleteService DeleteServiceObject Process*** ", isDebugEnabled)
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericDeleteVnf.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericDeleteVnf.groovy
index 979083377e..1bd4383b74 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericDeleteVnf.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericDeleteVnf.groovy
@@ -1,274 +1,278 @@
-/*-
- * ============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.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
-
-
-/**
- * TODO: Support getting vnf type = vpe
- *
- * This class supports the GenericGetVnf Sub Flow.
- * This Generic sub flow can be used by any flow for accomplishing
- * the goal of getting a Vnf Object (from AAI). The flow currently
- * supports the querying of 2 types of Vnfs, generic-vnf and vce. The
- * type must be provided by the calling flow and the type should
- * be mapped to the variable GENDV_type. The type should either be
- * "generic-vnf" or "vce". If the Vnf Id is not provided by the calling
- * flow then this sub flow will execute the query to get the
- * Vnf using the Vnf Name. Therefore, the calling flow must provide
- * either the Vnf Id or Vnf Name.
- *
- * Upon successful completion of this sub flow the
- * GENDV_SuccessIndicator will be true and the query response payload
- * will be set to GENDV_vnf. 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 GENDV_FoundIndicator
- * set to false. This will allow the calling flow to distinguish
- * between the two success scenarios, "Success where Vnf is found"
- * and "Success where Vnf is NOT found".
- *
- *
- * Incoming Variables:
- * @param - GENDV_vnfId
- * @param - GENDV_type
- * @param (Optional) - GENDV_resourceVersion
- *
- *
- * Outgoing Variables:
- * @param - GENDV_vnf
- * @param - GENDV_SuccessIndicator
- * @param - GENDV_FoundIndicator
- * @param - WorkflowException
- */
-class GenericDeleteVnf extends AbstractServiceTaskProcessor{
-
- String Prefix = "GENDV_"
- ExceptionUtil exceptionUtil = new ExceptionUtil()
-
- /**
- * This method validates the incoming variables and
- * determines if the resource version was provided
- *
- * @param - execution
- */
- public void preProcessRequest(Execution execution) {
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
- execution.setVariable("prefix",Prefix)
- utils.log("DEBUG", " *** STARTED GenericDeleteVnf PreProcessRequest Process*** ", isDebugEnabled)
-
- execution.setVariable("GENDV_resourceVersionProvided", true)
- execution.setVariable("GENDV_SuccessIndicator", false)
- execution.setVariable("GENDV_FoundIndicator", false)
-
- try{
- // Get Variables
- String vnfId = execution.getVariable("GENDV_vnfId")
- String type = execution.getVariable("GENDV_type")
-
- if(isBlank(type) || isBlank(vnfId)){
- utils.log("ERROR", "Incoming Required Variable is null!", isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Required Variable is Missing or Null!")
- }else{
- utils.log("DEBUG", "Incoming Vnf Id is: " + vnfId, isDebugEnabled)
-
- String resourceVersion = execution.getVariable("GENDV_resourceVersion")
- if(isBlank(resourceVersion)){
- utils.log("DEBUG", "Vnf Resource Version is NOT Provided", isDebugEnabled)
- execution.setVariable("GENDV_resourceVersionProvided", false)
- }else{
- utils.log("DEBUG", "Incoming Vnf Resource Version is: " + resourceVersion, isDebugEnabled)
- }
- }
- }catch(BpmnError b){
- utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled)
- throw b
- }catch(Exception e){
- utils.log("ERROR", " Error encountered within GenericDeleteVnf PreProcessRequest method!" + e, isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in GenericDeleteVnf PreProcessRequest")
-
- }
- utils.log("DEBUG", "*** COMPLETED GenericDeleteVnf PreProcessRequest Process ***", isDebugEnabled)
- }
-
- /**
- * This method executes a GET call to AAI for the Vnf
- * so that the Vnf's resource-version can be
- * obtained.
- *
- * @param - execution
- */
- public void getVnfResourceVersion(Execution execution){
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- execution.setVariable("prefix",Prefix)
- utils.log("DEBUG", " *** STARTED GenericDeleteVnf GetVnfResourceVersion Process*** ", isDebugEnabled)
- try {
- String vnfId = execution.getVariable("GENDV_vnfId")
- String type = execution.getVariable("GENDV_type")
- utils.log("DEBUG", "Type of Vnf Getting is: " + type, isDebugEnabled)
-
- String aai_endpoint = execution.getVariable("URN_aai_endpoint")
- AaiUtil aaiUriUtil = new AaiUtil(this)
-
- //Determine Type of Vnf Querying For
- def aai_uri = ""
- if(type.equals("generic-vnf")){
- aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution)
- }else if(type.equals("vce")){
- aai_uri = aaiUriUtil.getNetworkVceUri(execution)
- }else{
- utils.log("DEBUG", "Invalid Incoming GENDV_type", isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Invalid Incoming GENDV_type")
- }
-
- String getVnfPath = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(vnfId, "UTF-8")
-
- execution.setVariable("GENDV_getVnfPath", getVnfPath)
- utils.logAudit("Get Vnf Resource Version Url is: " + getVnfPath)
-
- APIResponse response = aaiUriUtil.executeAAIGetCall(execution, getVnfPath)
- int responseCode = response.getStatusCode()
- execution.setVariable("GENDV_getVnfResponseCode", responseCode)
- utils.log("DEBUG", " GET Vnf response code is: " + responseCode, isDebugEnabled)
-
- utils.logAudit("GenericDeleteVnf Get VNF Response Code: " + responseCode)
- String aaiResponse = response.getResponseBodyAsString()
- aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse)
- execution.setVariable("GENDV_getVnfResponse", aaiResponse)
-
- utils.logAudit("GenericDeleteVnf Get VNF Response: " + aaiResponse)
- //Process Response
- if(responseCode == 200 || responseCode == 202){
- utils.log("DEBUG", "GET Vnf Received a Good Response: \n" + aaiResponse, isDebugEnabled)
- execution.setVariable("GENDV_FoundIndicator", true)
- if(utils.nodeExists(aaiResponse, "resource-version")){
- String resourceVersion = utils.getNodeText1(aaiResponse, "resource-version")
- execution.setVariable("GENDV_resourceVersion", resourceVersion)
- utils.log("DEBUG", "SI Resource Version is: " + resourceVersion, isDebugEnabled)
- }else{
- utils.log("DEBUG", "GET Vnf for Resource Version Response Does NOT Contain a resource-version", isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 400, "Unable to obtain Vnf resource-version. GET Vnf Response Does NOT Contain a resource-version")
- }
-
- }else if(responseCode == 404){
- utils.log("DEBUG", "GET Vnf Received a Not Found (404) Response", isDebugEnabled)
- execution.setVariable("GENDV_SuccessIndicator", true)
- execution.setVariable("WorkflowResponse", " ") // for junits
- }
- else{
- utils.log("DEBUG", " GET Vnf 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 GenericDeleteVnf GetVnfResourceVersion method!" + e, isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During GetVnfResourceVersion")
- }
- utils.log("DEBUG", " *** COMPLETED GenericDeleteVnf GetVnfResourceVersion Process*** ", isDebugEnabled)
- }
-
- /**
- * This method executes a DELETE call to AAI for the provided
- * Vnf.
- *
- * @param - execution
- */
- public void deleteVnf(Execution execution){
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- execution.setVariable("prefix",Prefix)
- utils.log("DEBUG", " *** STARTED GenericDeleteVnf DeleteVnf Process*** ", isDebugEnabled)
- try {
- String vnfId = execution.getVariable("GENDV_vnfId")
- String type = execution.getVariable("GENDV_type")
- utils.log("DEBUG", "Type of Vnf Getting is: " + type, isDebugEnabled)
- String resourceVersion = execution.getVariable("GENDV_resourceVersion")
- utils.log("DEBUG", "Incoming Vnf Resource Version is: " + resourceVersion, isDebugEnabled)
-
- String aai_endpoint = execution.getVariable("URN_aai_endpoint")
- AaiUtil aaiUriUtil = new AaiUtil(this)
-
- //Determine Type of Vnf Querying For
- def aai_uri = ""
- if(type.equals("generic-vnf")){
- aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution)
- }else if(type.equals("vce")){
- aai_uri = aaiUriUtil.getNetworkVceUri(execution)
- }else{
- utils.log("DEBUG", "Invalid Incoming GENDV_type", isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Invalid Incoming GENDV_type")
- }
-
- String deleteVnfPath = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(vnfId, "UTF-8") +'?resource-version=' + UriUtils.encode(resourceVersion,"UTF-8")
-
- execution.setVariable("GENDV_deleteVnfPath", deleteVnfPath)
- utils.logAudit("Delete Vnf Url is: " + deleteVnfPath)
-
- APIResponse response = aaiUriUtil.executeAAIDeleteCall(execution, deleteVnfPath)
- int responseCode = response.getStatusCode()
- execution.setVariable("GENDV_deleteVnfResponseCode", responseCode)
- utils.log("DEBUG", " DELETE Vnf response code is: " + responseCode, isDebugEnabled)
-
- utils.logAudit("GenericDeleteVnf Delete VNF Response Code: " + responseCode)
- String aaiResponse = response.getResponseBodyAsString()
- aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse)
- execution.setVariable("GENDV_deleteVnfResponse", aaiResponse)
-
- utils.logAudit("GenericDeleteVnf Delete VNF Response: " + aaiResponse)
- //Process Response
- if(responseCode == 204){
- utils.log("DEBUG", " DELETE Vnf Received a Good Response", isDebugEnabled)
- execution.setVariable("GENDV_FoundIndicator", true)
- }else if(responseCode == 404){
- utils.log("DEBUG", " DELETE Vnf Received a Not Found (404) Response", isDebugEnabled)
- }else if(responseCode == 412){
- utils.log("DEBUG", "DELETE Vnf Received a Resource Version Mismatch Error: \n" + aaiResponse, isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 412, "Delete Vnf Received a resource-version Mismatch Error Response from AAI")
- }else{
- utils.log("DEBUG", "DELETE Vnf 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("DEBUG", " Error encountered within GenericDeleteVnf DeleteVnf method!" + e, isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During Delete Vnf")
- }
- utils.log("DEBUG", " *** COMPLETED GenericDeleteVnf DeleteVnf Process*** ", isDebugEnabled)
- }
-
-
-}
+/*-
+ * ============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.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
+
+
+/**
+ * TODO: Support getting vnf type = vpe
+ *
+ * This class supports the GenericGetVnf Sub Flow.
+ * This Generic sub flow can be used by any flow for accomplishing
+ * the goal of getting a Vnf Object (from AAI). The flow currently
+ * supports the querying of 2 types of Vnfs, generic-vnf and vce. The
+ * type must be provided by the calling flow and the type should
+ * be mapped to the variable GENDV_type. The type should either be
+ * "generic-vnf" or "vce". If the Vnf Id is not provided by the calling
+ * flow then this sub flow will execute the query to get the
+ * Vnf using the Vnf Name. Therefore, the calling flow must provide
+ * either the Vnf Id or Vnf Name.
+ *
+ * Upon successful completion of this sub flow the
+ * GENDV_SuccessIndicator will be true and the query response payload
+ * will be set to GENDV_vnf. 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 GENDV_FoundIndicator
+ * set to false. This will allow the calling flow to distinguish
+ * between the two success scenarios, "Success where Vnf is found"
+ * and "Success where Vnf is NOT found".
+ *
+ *
+ * Variable Mapping Below
+ *
+ * In Mapping Variables:
+ * @param - GENDV_vnfId
+ * @param - GENDV_type
+ * @param (Optional) - GENDV_resourceVersion
+ *
+ *
+ * Out Mapping Variables:
+ * @param - GENDV_vnf
+ * @param - GENDV_SuccessIndicator
+ * @param - GENDV_FoundIndicator
+ * @param - WorkflowException
+ *
+ *
+ */
+class GenericDeleteVnf extends AbstractServiceTaskProcessor{
+
+ String Prefix = "GENDV_"
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+
+ /**
+ * This method validates the incoming variables and
+ * determines if the resource version was provided
+ *
+ * @param - execution
+ */
+ public void preProcessRequest(Execution execution) {
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ execution.setVariable("prefix",Prefix)
+ utils.log("DEBUG", " *** STARTED GenericDeleteVnf PreProcessRequest Process*** ", isDebugEnabled)
+
+ execution.setVariable("GENDV_resourceVersionProvided", true)
+ execution.setVariable("GENDV_SuccessIndicator", false)
+ execution.setVariable("GENDV_FoundIndicator", false)
+
+ try{
+ // Get Variables
+ String vnfId = execution.getVariable("GENDV_vnfId")
+ String type = execution.getVariable("GENDV_type")
+
+ if(isBlank(type) || isBlank(vnfId)){
+ utils.log("ERROR", "Incoming Required Variable is null!", isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Required Variable is Missing or Null!")
+ }else{
+ utils.log("DEBUG", "Incoming Vnf Id is: " + vnfId, isDebugEnabled)
+
+ String resourceVersion = execution.getVariable("GENDV_resourceVersion")
+ if(isBlank(resourceVersion)){
+ utils.log("DEBUG", "Vnf Resource Version is NOT Provided", isDebugEnabled)
+ execution.setVariable("GENDV_resourceVersionProvided", false)
+ }else{
+ utils.log("DEBUG", "Incoming Vnf Resource Version is: " + resourceVersion, isDebugEnabled)
+ }
+ }
+ }catch(BpmnError b){
+ utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled)
+ throw b
+ }catch(Exception e){
+ utils.log("ERROR", " Error encountered within GenericDeleteVnf PreProcessRequest method!" + e, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in GenericDeleteVnf PreProcessRequest")
+
+ }
+ utils.log("DEBUG", "*** COMPLETED GenericDeleteVnf PreProcessRequest Process ***", isDebugEnabled)
+ }
+
+ /**
+ * This method executes a GET call to AAI for the Vnf
+ * so that the Vnf's resource-version can be
+ * obtained.
+ *
+ * @param - execution
+ */
+ public void getVnfResourceVersion(Execution execution){
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ execution.setVariable("prefix",Prefix)
+ utils.log("DEBUG", " *** STARTED GenericDeleteVnf GetVnfResourceVersion Process*** ", isDebugEnabled)
+ try {
+ String vnfId = execution.getVariable("GENDV_vnfId")
+ String type = execution.getVariable("GENDV_type")
+ utils.log("DEBUG", "Type of Vnf Getting is: " + type, isDebugEnabled)
+
+ String aai_endpoint = execution.getVariable("URN_aai_endpoint")
+ AaiUtil aaiUriUtil = new AaiUtil(this)
+
+ //Determine Type of Vnf Querying For
+ def aai_uri = ""
+ if(type.equals("generic-vnf")){
+ aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution)
+ }else if(type.equals("vce")){
+ aai_uri = aaiUriUtil.getNetworkVceUri(execution)
+ }else{
+ utils.log("DEBUG", "Invalid Incoming GENDV_type", isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Invalid Incoming GENDV_type")
+ }
+
+ String getVnfPath = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(vnfId, "UTF-8")
+
+ execution.setVariable("GENDV_getVnfPath", getVnfPath)
+ utils.logAudit("Get Vnf Resource Version Url is: " + getVnfPath)
+
+ APIResponse response = aaiUriUtil.executeAAIGetCall(execution, getVnfPath)
+ int responseCode = response.getStatusCode()
+ execution.setVariable("GENDV_getVnfResponseCode", responseCode)
+ utils.log("DEBUG", " GET Vnf response code is: " + responseCode, isDebugEnabled)
+
+ utils.logAudit("GenericDeleteVnf Get VNF Response Code: " + responseCode)
+ String aaiResponse = response.getResponseBodyAsString()
+ aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse)
+ execution.setVariable("GENDV_getVnfResponse", aaiResponse)
+
+ utils.logAudit("GenericDeleteVnf Get VNF Response: " + aaiResponse)
+ //Process Response
+ if(responseCode == 200 || responseCode == 202){
+ utils.log("DEBUG", "GET Vnf Received a Good Response: \n" + aaiResponse, isDebugEnabled)
+ execution.setVariable("GENDV_FoundIndicator", true)
+ if(utils.nodeExists(aaiResponse, "resource-version")){
+ String resourceVersion = utils.getNodeText1(aaiResponse, "resource-version")
+ execution.setVariable("GENDV_resourceVersion", resourceVersion)
+ utils.log("DEBUG", "SI Resource Version is: " + resourceVersion, isDebugEnabled)
+ }else{
+ utils.log("DEBUG", "GET Vnf for Resource Version Response Does NOT Contain a resource-version", isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 400, "Unable to obtain Vnf resource-version. GET Vnf Response Does NOT Contain a resource-version")
+ }
+
+ }else if(responseCode == 404){
+ utils.log("DEBUG", "GET Vnf Received a Not Found (404) Response", isDebugEnabled)
+ execution.setVariable("GENDV_SuccessIndicator", true)
+ execution.setVariable("WorkflowResponse", " ") // for junits
+ }
+ else{
+ utils.log("DEBUG", " GET Vnf 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 GenericDeleteVnf GetVnfResourceVersion method!" + e, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During GetVnfResourceVersion")
+ }
+ utils.log("DEBUG", " *** COMPLETED GenericDeleteVnf GetVnfResourceVersion Process*** ", isDebugEnabled)
+ }
+
+ /**
+ * This method executes a DELETE call to AAI for the provided
+ * Vnf.
+ *
+ * @param - execution
+ */
+ public void deleteVnf(Execution execution){
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ execution.setVariable("prefix",Prefix)
+ utils.log("DEBUG", " *** STARTED GenericDeleteVnf DeleteVnf Process*** ", isDebugEnabled)
+ try {
+ String vnfId = execution.getVariable("GENDV_vnfId")
+ String type = execution.getVariable("GENDV_type")
+ utils.log("DEBUG", "Type of Vnf Getting is: " + type, isDebugEnabled)
+ String resourceVersion = execution.getVariable("GENDV_resourceVersion")
+ utils.log("DEBUG", "Incoming Vnf Resource Version is: " + resourceVersion, isDebugEnabled)
+
+ String aai_endpoint = execution.getVariable("URN_aai_endpoint")
+ AaiUtil aaiUriUtil = new AaiUtil(this)
+
+ //Determine Type of Vnf Querying For
+ def aai_uri = ""
+ if(type.equals("generic-vnf")){
+ aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution)
+ }else if(type.equals("vce")){
+ aai_uri = aaiUriUtil.getNetworkVceUri(execution)
+ }else{
+ utils.log("DEBUG", "Invalid Incoming GENDV_type", isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Invalid Incoming GENDV_type")
+ }
+
+ String deleteVnfPath = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(vnfId, "UTF-8") +'?resource-version=' + UriUtils.encode(resourceVersion,"UTF-8")
+
+ execution.setVariable("GENDV_deleteVnfPath", deleteVnfPath)
+ utils.logAudit("Delete Vnf Url is: " + deleteVnfPath)
+
+ APIResponse response = aaiUriUtil.executeAAIDeleteCall(execution, deleteVnfPath)
+ int responseCode = response.getStatusCode()
+ execution.setVariable("GENDV_deleteVnfResponseCode", responseCode)
+ utils.log("DEBUG", " DELETE Vnf response code is: " + responseCode, isDebugEnabled)
+
+ utils.logAudit("GenericDeleteVnf Delete VNF Response Code: " + responseCode)
+ String aaiResponse = response.getResponseBodyAsString()
+ aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse)
+ execution.setVariable("GENDV_deleteVnfResponse", aaiResponse)
+
+ utils.logAudit("GenericDeleteVnf Delete VNF Response: " + aaiResponse)
+ //Process Response
+ if(responseCode == 204){
+ utils.log("DEBUG", " DELETE Vnf Received a Good Response", isDebugEnabled)
+ execution.setVariable("GENDV_FoundIndicator", true)
+ }else if(responseCode == 404){
+ utils.log("DEBUG", " DELETE Vnf Received a Not Found (404) Response", isDebugEnabled)
+ }else if(responseCode == 412){
+ utils.log("DEBUG", "DELETE Vnf Received a Resource Version Mismatch Error: \n" + aaiResponse, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 412, "Delete Vnf Received a resource-version Mismatch Error Response from AAI")
+ }else{
+ utils.log("DEBUG", "DELETE Vnf 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("DEBUG", " Error encountered within GenericDeleteVnf DeleteVnf method!" + e, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During Delete Vnf")
+ }
+ utils.log("DEBUG", " *** COMPLETED GenericDeleteVnf DeleteVnf Process*** ", isDebugEnabled)
+ }
+
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericGetService.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericGetService.groovy
index 304f33edcc..70ce1ba5cf 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericGetService.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericGetService.groovy
@@ -1,381 +1,385 @@
-/*-
- * ============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.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".
- *
- *
- * Incoming Variables (Service-Instance):
- * @param - GENGS_serviceInstanceId or @param - GENGS_serviceInstanceName
- * @param - GENGS_type
- * @param (Optional) - GENGS_serviceType
- * @param (Optional) - GENGS_globalCustomerId
- *
- * Incoming Variables (Service-Subscription):
- * @param - GENGS_type
- * @param - GENGS_serviceType
- * @param - GENGS_globalCustomerId
- *
- *
- * Outgoing Variables:
- * @param - GENGS_service
- * @param - GENGS_SuccessIndicator
- * @param - GENGS_FoundIndicator
- * @param - WorkflowException
- */
-class GenericGetService 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_obtainServiceInstanceUrl", false)
- execution.setVariable("GENGS_obtainServiceInstanceUrlByName", false)
- execution.setVariable("GENGS_SuccessIndicator", false)
- execution.setVariable("GENGS_FoundIndicator", false)
- execution.setVariable("GENGS_siResourceLink", null)
-
- try{
- // Get Variables
- 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("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_obtainServiceInstanceUrl", 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 {
- String serviceInstanceId = execution.getVariable("GENGS_serviceInstanceId")
- utils.log("DEBUG", " Querying Node for Service-Instance URL by using Service-Instance Id: " + serviceInstanceId, isDebugEnabled)
-
- AaiUtil aaiUriUtil = new AaiUtil(this)
- String aai_uri = aaiUriUtil.getSearchNodesQueryEndpoint(execution)
- String aai_endpoint = execution.getVariable("URN_aai_endpoint")
-
- utils.logAudit("GenericGetService AAI Endpoint: " + aai_endpoint)
- String path = "${aai_uri}?search-node-type=service-instance&filter=service-instance-id:EQUALS:${serviceInstanceId}"
-
- //String url = "${aai_endpoint}${path}" host name needs to be removed from property
- String url = "${path}"
- execution.setVariable("GENGS_obtainSIUrlPath", url)
-
- 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 GET 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_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 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_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_siResourceLink")
- 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 Resource Link 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)
- }
-
-}
+/*-
+ * ============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.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 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 GenericGetService 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_obtainServiceInstanceUrl", false)
+ execution.setVariable("GENGS_obtainServiceInstanceUrlByName", false)
+ execution.setVariable("GENGS_SuccessIndicator", false)
+ execution.setVariable("GENGS_FoundIndicator", false)
+ execution.setVariable("GENGS_siResourceLink", null)
+
+ try{
+ // Get Variables
+ 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("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_obtainServiceInstanceUrl", 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 {
+ String serviceInstanceId = execution.getVariable("GENGS_serviceInstanceId")
+ utils.log("DEBUG", " Querying Node for Service-Instance URL by using Service-Instance Id: " + serviceInstanceId, isDebugEnabled)
+
+ AaiUtil aaiUriUtil = new AaiUtil(this)
+ String aai_uri = aaiUriUtil.getSearchNodesQueryEndpoint(execution)
+ String aai_endpoint = execution.getVariable("URN_aai_endpoint")
+
+ utils.logAudit("GenericGetService AAI Endpoint: " + aai_endpoint)
+ String path = "${aai_uri}?search-node-type=service-instance&filter=service-instance-id:EQUALS:${serviceInstanceId}"
+
+ //String url = "${aai_endpoint}${path}" host name needs to be removed from property
+ String url = "${path}"
+ execution.setVariable("GENGS_obtainSIUrlPath", url)
+
+ 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 GET 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_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 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_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_siResourceLink")
+ 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 Resource Link 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)
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericGetVnf.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericGetVnf.groovy
index 5f03786180..df9a97c78c 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericGetVnf.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericGetVnf.groovy
@@ -1,270 +1,273 @@
-/*-
- * ============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.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
-
-
-/**
- * TODO: Support getting vnf type = vpe
- *
- * This class supports the GenericGetVnf Sub Flow.
- * This Generic sub flow can be used by any flow for accomplishing
- * the goal of getting a Vnf Object (from AAI). The flow currently
- * supports the querying of 2 types of Vnfs, generic-vnf and vce. The
- * type must be provided by the calling flow and the type should
- * be mapped to the variable GENGV_type. The type should either be
- * "generic-vnf" or "vce". If the Vnf Id is not provided by the calling
- * flow then this sub flow will execute the query to get the
- * Vnf using the Vnf Name. Therefore, the calling flow must provide
- * either the Vnf Id or Vnf Name.
- *
- * Upon successful completion of this sub flow the
- * GENGV_SuccessIndicator will be true and the query response payload
- * will be set to GENGV_vnf. 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 GENGV_FoundIndicator
- * set to false. This will allow the calling flow to distinguish
- * between the two success scenarios, "Success where Vnf is found"
- * and "Success where Vnf is NOT found".
- *
- *
- * Incoming Required Variables:
- * @param - GENGV_vnfId or @param - GENGV_vnfName
- * @param - GENGV_type
- *
- *
- * Outgoing Variables:
- * @param - GENGV_vnf
- * @param - GENGV_SuccessIndicator
- * @param - GENGV_FoundIndicator
- * @param - WorkflowException
- */
-class GenericGetVnf extends AbstractServiceTaskProcessor{
-
- String Prefix = "GENGV_"
- 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 GenericGetVnf PreProcessRequest Process*** ", isDebugEnabled)
-
- execution.setVariable("GENGV_getVnfByName", false)
- execution.setVariable("GENGV_SuccessIndicator", false)
- execution.setVariable("GENGV_FoundIndicator", false)
-
- try{
- // Get Variables
- String vnfId = execution.getVariable("GENGV_vnfId")
- utils.log("DEBUG", "Incoming Vnf Id is: " + vnfId, isDebugEnabled)
- String vnfName = execution.getVariable("GENGV_vnfName")
- utils.log("DEBUG", "Incoming Vnf Name is: " + vnfName, isDebugEnabled)
-
- if(isBlank(vnfId) && isBlank(vnfName)){
- utils.log("DEBUG", "Incoming Vnf Name and Vnf Id are null. At least one is required!", isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Vnf Name and Vnf Id are null. At least one is required.")
- }else{
- if(isBlank(vnfId)){
- execution.setVariable("GENGV_getVnfByName", true)
- }
- }
-
- }catch(BpmnError b){
- utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled)
- throw b
- }catch(Exception e){
- utils.log("DEBUG", " Error encountered within GenericGetVnf PreProcessRequest method!" + e, isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in GenericGetVnf PreProcessRequest")
-
- }
- utils.log("DEBUG", "*** COMPLETED GenericGetVnf PreProcessRequest Process ***", isDebugEnabled)
- }
-
- /**
- * This method executes a GET call to AAI to obtain the
- * Vnf using the Vnf Name
- *
- * @param - execution
- */
- public void getVnfByName(Execution execution){
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- execution.setVariable("prefix",Prefix)
- utils.log("DEBUG", " *** STARTED GenericGetVnf GetVnfByName Process*** ", isDebugEnabled)
- try {
- String vnfName = execution.getVariable("GENGV_vnfName")
- utils.log("DEBUG", "Getting Vnf by Vnf Name: " + vnfName, isDebugEnabled)
- String type = execution.getVariable("GENGV_type")
- utils.log("DEBUG", "Type of Vnf Getting is: " + type, isDebugEnabled)
-
- String aai_endpoint = execution.getVariable("URN_aai_endpoint")
- AaiUtil aaiUriUtil = new AaiUtil(this)
-
- //Determine Type of Vnf Querying For.
- def aai_uri = ""
- if(type.equals("generic-vnf")){
- aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution)
- }else if(type.equals("vce")){
- aai_uri = aaiUriUtil.getNetworkVceUri(execution)
- }else{
- utils.log("DEBUG", "Invalid Incoming GENGV_type", isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Invalid Incoming GENGV_type")
- }
-
- String getVnfPath = "${aai_endpoint}${aai_uri}?vnf-name=" + UriUtils.encode(vnfName, "UTF-8") + "&depth=1"
-
- execution.setVariable("GENGV_getVnfPath", getVnfPath)
- utils.logAudit("Get Vnf Url is: " + getVnfPath)
-
- APIResponse response = aaiUriUtil.executeAAIGetCall(execution, getVnfPath)
- int responseCode = response.getStatusCode()
- execution.setVariable("GENGV_getVnfResponseCode", responseCode)
- utils.log("DEBUG", " GET Vnf response code is: " + responseCode, isDebugEnabled)
-
- String aaiResponse = response.getResponseBodyAsString()
- aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse)
- execution.setVariable("GENGV_getVnfResponse", aaiResponse)
-
- //Process Response
- if(responseCode == 200){
- utils.log("DEBUG", "GET Vnf Received a Good Response", isDebugEnabled)
- if(utils.nodeExists(aaiResponse, type)){
- utils.log("DEBUG", "GET Vnf Response Contains a Vnf", isDebugEnabled)
- execution.setVariable("GENGV_FoundIndicator", true)
- execution.setVariable("GENGV_vnf", aaiResponse)
- execution.setVariable("WorkflowResponse", aaiResponse)
- }else{
- utils.log("DEBUG", "GET Vnf Response Does NOT Contain a Vnf", isDebugEnabled)
- }
-
- }else if(responseCode == 404){
- utils.log("DEBUG", "GET Vnf Received a Not Found (404) Response", isDebugEnabled)
- }else{
- utils.log("DEBUG", "GET Vnf 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("ERROR", " Error encountered within GenericGetVnf GetVnfByName method!" + e, isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During GetVnfByName")
- }
- utils.log("DEBUG", " *** COMPLETED GenericGetVnf GetVnfByName Process*** ", isDebugEnabled)
- }
-
- /**
- * This method executes a GET call to AAI to obtain the
- * Vnf using the Vnf Id
- *
- * @param - execution
- */
- public void getVnfById(Execution execution){
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- execution.setVariable("prefix",Prefix)
- utils.log("DEBUG", " *** STARTED GenericGetVnf GetVnfById Process*** ", isDebugEnabled)
- try {
- String vnfId = execution.getVariable("GENGV_vnfId")
- utils.log("DEBUG", "Getting Vnf by Vnf Id: " + vnfId, isDebugEnabled)
- String type = execution.getVariable("GENGV_type")
- utils.log("DEBUG", "Type of Vnf Getting is: " + type, isDebugEnabled)
-
- String aai_endpoint = execution.getVariable("URN_aai_endpoint")
- AaiUtil aaiUriUtil = new AaiUtil(this)
-
- //Determine Type of Vnf Querying For.
- def aai_uri = ""
- if(type.equals("generic-vnf")){
- aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution)
- }else if(type.equals("vce")){
- aai_uri = aaiUriUtil.getNetworkVceUri(execution)
- }else if(type.equals("vpe")){
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, "GenericGetVnf does not yet support getting type of vnf = vpe")
- }else{
- utils.log("DEBUG", "Invalid Incoming GENGV_type", isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Invalid Incoming GENGV_type")
- }
- utils.log("DEBUG", "Using AAI Uri: " + aai_uri, isDebugEnabled)
-
- String getVnfPath = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(vnfId, "UTF-8") + "?depth=1"
- utils.log("DEBUG", "GET Vnf Endpoint is: " + getVnfPath, isDebugEnabled)
-
- execution.setVariable("GENGV_getVnfPath", getVnfPath)
- utils.logAudit("Get Vnf Url is: " + getVnfPath)
-
- APIResponse response = aaiUriUtil.executeAAIGetCall(execution, getVnfPath)
- int responseCode = response.getStatusCode()
- execution.setVariable("GENGV_getVnfResponseCode", responseCode)
- utils.log("DEBUG", " GET Vnf response code is: " + responseCode, isDebugEnabled)
-
- String aaiResponse = response.getResponseBodyAsString()
- aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse)
- execution.setVariable("GENGV_getVnfResponse", aaiResponse)
-
- //Process Response
- if(responseCode == 200){
- utils.log("DEBUG", "GET Vnf Received a Good Response", isDebugEnabled)
- if(utils.nodeExists(aaiResponse, type)){
- utils.log("DEBUG", "GET Vnf Response Contains a Vnf", isDebugEnabled)
- execution.setVariable("GENGV_FoundIndicator", true)
- execution.setVariable("GENGV_vnf", aaiResponse)
- execution.setVariable("WorkflowResponse", aaiResponse)
- }else{
- utils.log("DEBUG", "GET Vnf Response Does NOT Contain a Vnf", isDebugEnabled)
- }
-
- }else if(responseCode == 404){
- utils.log("DEBUG", "GET Vnf Received a Not Found (404) Response", isDebugEnabled)
- }else{
- utils.log("DEBUG", "GET Vnf 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 GenericGetVnf GetVnfById method!" + e, isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During GetVnfById")
- }
- utils.log("DEBUG", " *** COMPLETED GenericGetVnf GetVnfById Process*** ", isDebugEnabled)
- }
-
-}
+/*-
+ * ============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.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
+
+
+/**
+ * TODO: Support getting vnf type = vpe
+ *
+ * This class supports the GenericGetVnf Sub Flow.
+ * This Generic sub flow can be used by any flow for accomplishing
+ * the goal of getting a Vnf Object (from AAI). The flow currently
+ * supports the querying of 2 types of Vnfs, generic-vnf and vce. The
+ * type must be provided by the calling flow and the type should
+ * be mapped to the variable GENGV_type. The type should either be
+ * "generic-vnf" or "vce". If the Vnf Id is not provided by the calling
+ * flow then this sub flow will execute the query to get the
+ * Vnf using the Vnf Name. Therefore, the calling flow must provide
+ * either the Vnf Id or Vnf Name.
+ *
+ * Upon successful completion of this sub flow the
+ * GENGV_SuccessIndicator will be true and the query response payload
+ * will be set to GENGV_vnf. 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 GENGV_FoundIndicator
+ * set to false. This will allow the calling flow to distinguish
+ * between the two success scenarios, "Success where Vnf is found"
+ * and "Success where Vnf is NOT found".
+ *
+ *
+ * Variable Mapping Below
+ *
+ * In Mapping Variables:
+ * @param - GENGV_vnfId or @param - GENGV_vnfName
+ * @param - GENGV_type
+ *
+ * Out Mapping Variables:
+ * @param - GENGV_vnf
+ * @param - GENGV_SuccessIndicator
+ * @param - GENGV_FoundIndicator
+ * @param - WorkflowException
+ *
+ *
+ */
+class GenericGetVnf extends AbstractServiceTaskProcessor{
+
+ String Prefix = "GENGV_"
+ 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 GenericGetVnf PreProcessRequest Process*** ", isDebugEnabled)
+
+ execution.setVariable("GENGV_getVnfByName", false)
+ execution.setVariable("GENGV_SuccessIndicator", false)
+ execution.setVariable("GENGV_FoundIndicator", false)
+
+ try{
+ // Get Variables
+ String vnfId = execution.getVariable("GENGV_vnfId")
+ utils.log("DEBUG", "Incoming Vnf Id is: " + vnfId, isDebugEnabled)
+ String vnfName = execution.getVariable("GENGV_vnfName")
+ utils.log("DEBUG", "Incoming Vnf Name is: " + vnfName, isDebugEnabled)
+
+ if(isBlank(vnfId) && isBlank(vnfName)){
+ utils.log("DEBUG", "Incoming Vnf Name and Vnf Id are null. At least one is required!", isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Vnf Name and Vnf Id are null. At least one is required.")
+ }else{
+ if(isBlank(vnfId)){
+ execution.setVariable("GENGV_getVnfByName", true)
+ }
+ }
+
+ }catch(BpmnError b){
+ utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled)
+ throw b
+ }catch(Exception e){
+ utils.log("DEBUG", " Error encountered within GenericGetVnf PreProcessRequest method!" + e, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in GenericGetVnf PreProcessRequest")
+
+ }
+ utils.log("DEBUG", "*** COMPLETED GenericGetVnf PreProcessRequest Process ***", isDebugEnabled)
+ }
+
+ /**
+ * This method executes a GET call to AAI to obtain the
+ * Vnf using the Vnf Name
+ *
+ * @param - execution
+ */
+ public void getVnfByName(Execution execution){
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ execution.setVariable("prefix",Prefix)
+ utils.log("DEBUG", " *** STARTED GenericGetVnf GetVnfByName Process*** ", isDebugEnabled)
+ try {
+ String vnfName = execution.getVariable("GENGV_vnfName")
+ utils.log("DEBUG", "Getting Vnf by Vnf Name: " + vnfName, isDebugEnabled)
+ String type = execution.getVariable("GENGV_type")
+ utils.log("DEBUG", "Type of Vnf Getting is: " + type, isDebugEnabled)
+
+ String aai_endpoint = execution.getVariable("URN_aai_endpoint")
+ AaiUtil aaiUriUtil = new AaiUtil(this)
+
+ //Determine Type of Vnf Querying For.
+ def aai_uri = ""
+ if(type.equals("generic-vnf")){
+ aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution)
+ }else if(type.equals("vce")){
+ aai_uri = aaiUriUtil.getNetworkVceUri(execution)
+ }else{
+ utils.log("DEBUG", "Invalid Incoming GENGV_type", isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Invalid Incoming GENGV_type")
+ }
+
+ String getVnfPath = "${aai_endpoint}${aai_uri}?vnf-name=" + UriUtils.encode(vnfName, "UTF-8") + "&depth=1"
+
+ execution.setVariable("GENGV_getVnfPath", getVnfPath)
+ utils.logAudit("Get Vnf Url is: " + getVnfPath)
+
+ APIResponse response = aaiUriUtil.executeAAIGetCall(execution, getVnfPath)
+ int responseCode = response.getStatusCode()
+ execution.setVariable("GENGV_getVnfResponseCode", responseCode)
+ utils.log("DEBUG", " GET Vnf response code is: " + responseCode, isDebugEnabled)
+
+ String aaiResponse = response.getResponseBodyAsString()
+ aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse)
+ execution.setVariable("GENGV_getVnfResponse", aaiResponse)
+
+ //Process Response
+ if(responseCode == 200){
+ utils.log("DEBUG", "GET Vnf Received a Good Response", isDebugEnabled)
+ if(utils.nodeExists(aaiResponse, type)){
+ utils.log("DEBUG", "GET Vnf Response Contains a Vnf", isDebugEnabled)
+ execution.setVariable("GENGV_FoundIndicator", true)
+ execution.setVariable("GENGV_vnf", aaiResponse)
+ execution.setVariable("WorkflowResponse", aaiResponse)
+ }else{
+ utils.log("DEBUG", "GET Vnf Response Does NOT Contain a Vnf", isDebugEnabled)
+ }
+
+ }else if(responseCode == 404){
+ utils.log("DEBUG", "GET Vnf Received a Not Found (404) Response", isDebugEnabled)
+ }else{
+ utils.log("DEBUG", "GET Vnf 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("ERROR", " Error encountered within GenericGetVnf GetVnfByName method!" + e, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During GetVnfByName")
+ }
+ utils.log("DEBUG", " *** COMPLETED GenericGetVnf GetVnfByName Process*** ", isDebugEnabled)
+ }
+
+ /**
+ * This method executes a GET call to AAI to obtain the
+ * Vnf using the Vnf Id
+ *
+ * @param - execution
+ */
+ public void getVnfById(Execution execution){
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ execution.setVariable("prefix",Prefix)
+ utils.log("DEBUG", " *** STARTED GenericGetVnf GetVnfById Process*** ", isDebugEnabled)
+ try {
+ String vnfId = execution.getVariable("GENGV_vnfId")
+ utils.log("DEBUG", "Getting Vnf by Vnf Id: " + vnfId, isDebugEnabled)
+ String type = execution.getVariable("GENGV_type")
+ utils.log("DEBUG", "Type of Vnf Getting is: " + type, isDebugEnabled)
+
+ String aai_endpoint = execution.getVariable("URN_aai_endpoint")
+ AaiUtil aaiUriUtil = new AaiUtil(this)
+
+ //Determine Type of Vnf Querying For.
+ def aai_uri = ""
+ if(type.equals("generic-vnf")){
+ aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution)
+ }else if(type.equals("vce")){
+ aai_uri = aaiUriUtil.getNetworkVceUri(execution)
+ }else if(type.equals("vpe")){
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, "GenericGetVnf does not yet support getting type of vnf = vpe")
+ }else{
+ utils.log("DEBUG", "Invalid Incoming GENGV_type", isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Invalid Incoming GENGV_type")
+ }
+ utils.log("DEBUG", "Using AAI Uri: " + aai_uri, isDebugEnabled)
+
+ String getVnfPath = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(vnfId, "UTF-8") + "?depth=1"
+ utils.log("DEBUG", "GET Vnf Endpoint is: " + getVnfPath, isDebugEnabled)
+
+ execution.setVariable("GENGV_getVnfPath", getVnfPath)
+ utils.logAudit("Get Vnf Url is: " + getVnfPath)
+
+ APIResponse response = aaiUriUtil.executeAAIGetCall(execution, getVnfPath)
+ int responseCode = response.getStatusCode()
+ execution.setVariable("GENGV_getVnfResponseCode", responseCode)
+ utils.log("DEBUG", " GET Vnf response code is: " + responseCode, isDebugEnabled)
+
+ String aaiResponse = response.getResponseBodyAsString()
+ aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse)
+ execution.setVariable("GENGV_getVnfResponse", aaiResponse)
+
+ //Process Response
+ if(responseCode == 200){
+ utils.log("DEBUG", "GET Vnf Received a Good Response", isDebugEnabled)
+ if(utils.nodeExists(aaiResponse, type)){
+ utils.log("DEBUG", "GET Vnf Response Contains a Vnf", isDebugEnabled)
+ execution.setVariable("GENGV_FoundIndicator", true)
+ execution.setVariable("GENGV_vnf", aaiResponse)
+ execution.setVariable("WorkflowResponse", aaiResponse)
+ }else{
+ utils.log("DEBUG", "GET Vnf Response Does NOT Contain a Vnf", isDebugEnabled)
+ }
+
+ }else if(responseCode == 404){
+ utils.log("DEBUG", "GET Vnf Received a Not Found (404) Response", isDebugEnabled)
+ }else{
+ utils.log("DEBUG", "GET Vnf 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 GenericGetVnf GetVnfById method!" + e, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During GetVnfById")
+ }
+ utils.log("DEBUG", " *** COMPLETED GenericGetVnf GetVnfById Process*** ", isDebugEnabled)
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericNotificationService.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericNotificationService.groovy
new file mode 100644
index 0000000000..62d476d294
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericNotificationService.groovy
@@ -0,0 +1,21 @@
+package org.openecomp.mso.bpmn.common.scripts
+
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.runtime.Execution
+import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil
+import org.openecomp.mso.bpmn.core.WorkflowException
+import org.openecomp.mso.bpmn.core.json.JsonUtils
+import java.text.SimpleDateFormat
+
+public class GenericNotificationService extends AbstractServiceTaskProcessor {
+
+
+
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+
+ public void preProcessRequest (Execution execution) {
+
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericPutVnf.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericPutVnf.groovy
index 9a7aa5ab9f..207830aea0 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericPutVnf.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericPutVnf.groovy
@@ -1,172 +1,172 @@
-/*-
- * ============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.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
-
-/**
- * TODO: Support Putting vnf type = vpe and vce
- *
- * This class supports the GenericPutVnf Sub Flow.
- * This Generic sub flow can be used by any flow for accomplishing
- * the goal of Creating/Updating(PUT) a Vnf Object (in AAI). The flow
- * supports the Creating/Updating of 3 types of Vnfs (generic-vnf, vce, and vpe).
- * The "type" must be provided by the calling flow and this type should
- * be mapped to the variable GENPV_type. The type should either be
- * "generic-vnf", "vce", or "vpe". In addition, the Vnf Id and
- * payload should be provided.
- *
- * Upon successful completion of this sub flow the
- * GENPV_SuccessIndicator. An MSOWorkflowException will
- * be thrown if an error occurs at any time during this
- * sub flow. Please map input variables to the corresponding
- * variable names below.
- *
- *
- * Incoming Required Variables:
- * @param - GENPV_vnfId
- * @param - GENPV_vnfPayload
- * @param - GENPV_type
- *
- *
- * Outgoing Variables:
- * @param - GENPV_SuccessIndicator
- * @param - WorkflowException
- */
-class GenericPutVnf extends AbstractServiceTaskProcessor{
-
- String Prefix = "GENPV_"
- ExceptionUtil exceptionUtil = new ExceptionUtil()
-
- /**
- * This method validates the incoming variables and
- * generates a Vnf Id if one is not provided.
- *
- * @param - execution
- */
- public void preProcessRequest(Execution execution) {
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
- execution.setVariable("prefix",Prefix)
- utils.log("DEBUG", " *** STARTED GenericPutVnf PreProcessRequest Process*** ", isDebugEnabled)
-
- execution.setVariable("GENPV_SuccessIndicator", false)
- execution.setVariable("GENPV_FoundIndicator", false)
-
- try{
- // Get Variables
- String payload = execution.getVariable("GENPV_vnfPayload")
- utils.log("DEBUG", "Incoming Vnf Payload is: " + payload, isDebugEnabled)
- String type = execution.getVariable("GENPV_type")
- utils.log("DEBUG", "Incoming Type of Vnf is: " + type, isDebugEnabled)
-
- if(isBlank(payload) || isBlank(type)){
- utils.log("ERROR", "Incoming Vnf Payload and/or Type is null. These Variables are required!", isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Vnf Payload and/or Type is null. These Variables are required!")
- }else{
- String vnfId = execution.getVariable("GENPV_vnfId")
- if(isBlank(vnfId)){
- vnfId = UUID.randomUUID().toString()
- utils.log("DEBUG", "Generated Vnf Id is: " + vnfId, isDebugEnabled)
- execution.setVariable("GENPV_vnfId", vnfId)
- }else{
- utils.log("DEBUG", "Incoming Vnf Id is: " + vnfId, isDebugEnabled)
- }
- }
- }catch(BpmnError b){
- utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled)
- throw b
- }catch(Exception e){
- utils.log("ERROR", " Error encountered within GenericPutVnf PreProcessRequest method!" + e, isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in GenericPutVnf PreProcessRequest")
-
- }
- utils.log("DEBUG", "*** COMPLETED GenericPutVnf PreProcessRequest Process ***", isDebugEnabled)
- }
-
- /**
- * This method executes a Put call to AAI to create
- * or update a Vnf Object using the provided payload
- *
- * @param - execution
- */
- public void putVnf(Execution execution){
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- execution.setVariable("prefix",Prefix)
- utils.log("DEBUG", " *** STARTED GenericPutVnf PutVnf Process*** ", isDebugEnabled)
- try {
- String vnfId = execution.getVariable("GENPV_vnfId")
- String payload = execution.getVariable("GENPV_vnfPayload")
- String type = execution.getVariable("GENPV_type")
-
- AaiUtil aaiUtil = new AaiUtil(this)
- def aai_uri = ""
- if(type.equals("generic-vnf")){
- aai_uri = aaiUtil.getNetworkGenericVnfUri(execution)
- }else if(type.equals("vce")){
- aai_uri = aaiUtil.getNetworkVceUri(execution)
- }else if(type.equals("vpe")){
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, "GenericPutVnf does not yet support getting type of vnf = vpe")
- }else{
- utils.log("DEBUG", "Invalid Incoming GENGV_type", isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Invalid Incoming GENPV_type")
- }
- utils.log("DEBUG", "Using AAI Uri: " + aai_uri, isDebugEnabled)
-
- String path = "${aai_uri}/" + UriUtils.encode(vnfId, "UTF-8")
- utils.log("DEBUG", "PUT Vnf Endpoint is: " + path, isDebugEnabled)
-
- String putVnfAAIPath = execution.getVariable("URN_aai_endpoint") + path
- execution.setVariable("GENPV_putVnfAAIPath", putVnfAAIPath)
- utils.logAudit("PUT Vnf Url is: " + putVnfAAIPath)
-
- APIResponse apiResponse = aaiUtil.executeAAIPutCall(execution, putVnfAAIPath, payload)
- int responseCode = apiResponse.getStatusCode()
- execution.setVariable("GENPV_putVnfResponseCode", responseCode)
- utils.logAudit("AAI Response Code: " + responseCode)
- String aaiResponse = apiResponse.getResponseBodyAsString()
- aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse)
- execution.setVariable("GENPV_putVnfResponse", aaiResponse)
- utils.logAudit("AAI Response: " + aaiResponse)
-
- if(responseCode == 200 || responseCode == 201){
- utils.log("DEBUG", "PUT Vnf Received a Good Response Code.", isDebugEnabled)
- }else{
- utils.log("DEBUG", "PUT Vnf 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 GenericPutVnf PutVnf method!" + e, isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During PutVnf")
- }
- utils.log("DEBUG", " *** COMPLETED GenericPutVnf PutVnf Process*** ", isDebugEnabled)
- }
-
-}
+/*-
+ * ============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.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
+
+/**
+ * TODO: Support Putting vnf type = vpe and vce
+ *
+ * This class supports the GenericPutVnf Sub Flow.
+ * This Generic sub flow can be used by any flow for accomplishing
+ * the goal of Creating/Updating(PUT) a Vnf Object (in AAI). The flow
+ * supports the Creating/Updating of 3 types of Vnfs (generic-vnf, vce, and vpe).
+ * The "type" must be provided by the calling flow and this type should
+ * be mapped to the variable GENPV_type. The type should either be
+ * "generic-vnf", "vce", or "vpe". In addition, the Vnf Id and
+ * payload should be provided.
+ *
+ * Upon successful completion of this sub flow the
+ * GENPV_SuccessIndicator. An MSOWorkflowException will
+ * be thrown if an error occurs at any time during this
+ * sub flow. Please map input variables to the corresponding
+ * variable names below.
+ *
+ *
+ * Incoming Required Variables:
+ * @param - GENPV_vnfId
+ * @param - GENPV_vnfPayload
+ * @param - GENPV_type
+ *
+ *
+ * Outgoing Variables:
+ * @param - GENPV_SuccessIndicator
+ * @param - WorkflowException
+ */
+class GenericPutVnf extends AbstractServiceTaskProcessor{
+
+ String Prefix = "GENPV_"
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+
+ /**
+ * This method validates the incoming variables and
+ * generates a Vnf Id if one is not provided.
+ *
+ * @param - execution
+ */
+ public void preProcessRequest(Execution execution) {
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ execution.setVariable("prefix",Prefix)
+ utils.log("DEBUG", " *** STARTED GenericPutVnf PreProcessRequest Process*** ", isDebugEnabled)
+
+ execution.setVariable("GENPV_SuccessIndicator", false)
+ execution.setVariable("GENPV_FoundIndicator", false)
+
+ try{
+ // Get Variables
+ String payload = execution.getVariable("GENPV_vnfPayload")
+ utils.log("DEBUG", "Incoming Vnf Payload is: " + payload, isDebugEnabled)
+ String type = execution.getVariable("GENPV_type")
+ utils.log("DEBUG", "Incoming Type of Vnf is: " + type, isDebugEnabled)
+
+ if(isBlank(payload) || isBlank(type)){
+ utils.log("ERROR", "Incoming Vnf Payload and/or Type is null. These Variables are required!", isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming Vnf Payload and/or Type is null. These Variables are required!")
+ }else{
+ String vnfId = execution.getVariable("GENPV_vnfId")
+ if(isBlank(vnfId)){
+ vnfId = UUID.randomUUID().toString()
+ utils.log("DEBUG", "Generated Vnf Id is: " + vnfId, isDebugEnabled)
+ execution.setVariable("GENPV_vnfId", vnfId)
+ }else{
+ utils.log("DEBUG", "Incoming Vnf Id is: " + vnfId, isDebugEnabled)
+ }
+ }
+ }catch(BpmnError b){
+ utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled)
+ throw b
+ }catch(Exception e){
+ utils.log("ERROR", " Error encountered within GenericPutVnf PreProcessRequest method!" + e, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in GenericPutVnf PreProcessRequest")
+
+ }
+ utils.log("DEBUG", "*** COMPLETED GenericPutVnf PreProcessRequest Process ***", isDebugEnabled)
+ }
+
+ /**
+ * This method executes a Put call to AAI to create
+ * or update a Vnf Object using the provided payload
+ *
+ * @param - execution
+ */
+ public void putVnf(Execution execution){
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ execution.setVariable("prefix",Prefix)
+ utils.log("DEBUG", " *** STARTED GenericPutVnf PutVnf Process*** ", isDebugEnabled)
+ try {
+ String vnfId = execution.getVariable("GENPV_vnfId")
+ String payload = execution.getVariable("GENPV_vnfPayload")
+ String type = execution.getVariable("GENPV_type")
+
+ AaiUtil aaiUtil = new AaiUtil(this)
+ def aai_uri = ""
+ if(type.equals("generic-vnf")){
+ aai_uri = aaiUtil.getNetworkGenericVnfUri(execution)
+ }else if(type.equals("vce")){
+ aai_uri = aaiUtil.getNetworkVceUri(execution)
+ }else if(type.equals("vpe")){
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, "GenericPutVnf does not yet support getting type of vnf = vpe")
+ }else{
+ utils.log("DEBUG", "Invalid Incoming GENGV_type", isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Invalid Incoming GENPV_type")
+ }
+ utils.log("DEBUG", "Using AAI Uri: " + aai_uri, isDebugEnabled)
+
+ String path = "${aai_uri}/" + UriUtils.encode(vnfId, "UTF-8")
+ utils.log("DEBUG", "PUT Vnf Endpoint is: " + path, isDebugEnabled)
+
+ String putVnfAAIPath = execution.getVariable("URN_aai_endpoint") + path
+ execution.setVariable("GENPV_putVnfAAIPath", putVnfAAIPath)
+ utils.logAudit("PUT Vnf Url is: " + putVnfAAIPath)
+
+ APIResponse apiResponse = aaiUtil.executeAAIPutCall(execution, putVnfAAIPath, payload)
+ int responseCode = apiResponse.getStatusCode()
+ execution.setVariable("GENPV_putVnfResponseCode", responseCode)
+ utils.logAudit("AAI Response Code: " + responseCode)
+ String aaiResponse = apiResponse.getResponseBodyAsString()
+ aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse)
+ execution.setVariable("GENPV_putVnfResponse", aaiResponse)
+ utils.logAudit("AAI Response: " + aaiResponse)
+
+ if(responseCode == 200 || responseCode == 201){
+ utils.log("DEBUG", "PUT Vnf Received a Good Response Code.", isDebugEnabled)
+ }else{
+ utils.log("DEBUG", "PUT Vnf 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 GenericPutVnf PutVnf method!" + e, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During PutVnf")
+ }
+ utils.log("DEBUG", " *** COMPLETED GenericPutVnf PutVnf Process*** ", isDebugEnabled)
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/MsoUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/MsoUtils.groovy
index 6796fb1a95..a0256d33e9 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/MsoUtils.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/MsoUtils.groovy
@@ -1,944 +1,951 @@
-/*-
- * ============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.common.scripts
-
-import groovy.xml.XmlUtil
-
-import java.text.SimpleDateFormat
-
-import org.apache.commons.codec.binary.Base64
-import org.openecomp.mso.bpmn.core.BPMNLogger
-import org.openecomp.mso.bpmn.core.xml.XmlTool
-import org.openecomp.mso.logger.MessageEnum
-import org.openecomp.mso.logger.MsoLogger
-import org.openecomp.mso.utils.CryptoUtils
-import org.w3c.dom.Element
-
-class MsoUtils {
- def initializeEndPoints(execution){
- // use this placeholder to initialize end points, if called independently, this need to be set
- execution.setVariable("AAIEndPoint","http://localhost:28080/SoapUIMocks")
- }
- def getNodeText(xmlInput,element){
- def rtn=null
- if(xmlInput!=null){
- def xml= new XmlSlurper().parseText(xmlInput)
- rtn= xml.'**'.find{node->node.name()==element}.text()
- }
- return rtn
- }
- def getMultNodes(xmlInput, element){
- def nodes=null
- if(xmlInput!=null){
- def xml= new XmlSlurper().parseText(xmlInput)
- nodes = xml.'**'.findAll{ node-> node.name() == element }*.text()
- }
- return nodes
- }
- def getNodeText1(xmlInput,element){
- def rtn=null
- if(xmlInput!=null){
- def xml= new XmlSlurper().parseText(xmlInput)
- rtn= xml.'**'.find{node->node.name()==element}
- if (rtn != null){
- rtn=rtn.text()
- }
- }
- return rtn
- }
- def getNodeXml(xmlInput,element){
- return getNodeXml(xmlInput, element, true)
- }
- def getNodeXml(xmlInput,element,incPreamble){
- def fxml= new XmlSlurper().parseText(xmlInput)
- def nodeToSerialize = fxml.'**'.find {it.name() == element}
- if(nodeToSerialize==null){
- return ""
- }
- def nodeAsText = XmlUtil.serialize(nodeToSerialize)
- if (!incPreamble) {
- nodeAsText = removeXmlPreamble(nodeAsText)
- }
- return nodeAsText
- }
- def nodeExists(xmlInput,element){
- try {
- def fxml= new XmlSlurper().parseText(xmlInput)
- def nodeToSerialize = fxml.'**'.find {it.name() == element}
- return nodeToSerialize!=null
- } catch(Exception e) {
- return false
- }
- }
-
-
- /***** Utilities when using XmlParser *****/
-
- /**
- * Convert a Node into a String by deserializing it and formatting it.
- *
- * @param node Node to be converted.
- * @return the Node as a String.
- */
- def String nodeToString(Node node) {
- def String nodeAsString = groovy.xml.XmlUtil.serialize(node)
- nodeAsString = removeXmlPreamble(nodeAsString)
- return formatXml(nodeAsString)
- }
-
- /**
- * Get the specified child Node of the specified parent. If there are
- * multiple children of the same name, only the first one is returned.
- * If there are no children with the specified name, 'null' is returned.
- *
- * @param parent Parent Node in which to find a child.
- * @param childNodeName Name of the child Node to get.
- * @return the (first) child Node with the specified name or 'null'
- * if a child Node with the specified name does not exist.
- */
- def Node getChildNode(Node parent, String childNodeName) {
- def NodeList nodeList = getIdenticalChildren(parent, childNodeName)
- if (nodeList.size() == 0) {
- return null
- } else {
- return nodeList.get(0)
- }
- }
-
- /**
- * Get the textual value of the specified child Node of the specified parent.
- * If there are no children with the specified name, 'null' is returned.
- *
- * @param parent Parent Node in which to find a child.
- * @param childNodeName Name of the child Node whose value to get.
- * @return the textual value of child Node with the specified name or 'null'
- * if a child Node with the specified name does not exist.
- */
- def String getChildNodeText(Node parent, String childNodeName) {
- def Node childNode = getChildNode(parent, childNodeName)
- if (childNode == null) {
- return null
- } else {
- return childNode.text()
- }
- }
-
- /**
- * Get all of the child nodes from the specified parent that have the
- * specified name. The returned NodeList could be empty.
- *
- * @param parent Parent Node in which to find children.
- * @param childNodeName Name of the children to get.
- * @return a NodeList of all the children from the parent with the specified
- * name. The list could be empty.
- */
- def NodeList getIdenticalChildren(Node parent, String childNodeName) {
- return (NodeList) parent.get(childNodeName)
- }
-
- /***** End of Utilities when using XmlParser *****/
-
-
- /** these are covered under the common function above**/
- def getSubscriberName(xmlInput,element){
- def rtn=null
- if(xmlInput!=null){
- def xml= new XmlSlurper().parseText(xmlInput)
- rtn= xml.'**'.find{node->node.name()==element}.text()
- }
- return rtn
- }
- def getTenantInformation(xmlInput,element){
- def xml= new XmlSlurper().parseText(xmlInput)
- def nodeToSerialize = xml.'**'.find {it.name() == 'service-information'}
- def nodeAsText = XmlUtil.serialize(nodeToSerialize)
- return nodeAsText
- }
- def getServiceInstanceId(xmlInput,element){
- def xml= new XmlSlurper().parseText(xmlInput)
- return ( xml.'**'.find{node->node.name()==element}.text() )
- }
- //for aai tenant url
- def searchResourceLink(xmlInput, resourceType){
- def fxml= new XmlSlurper().parseText(xmlInput)
- def element = fxml.'**'.find {it.'resource-type' == resourceType}
- return (element == null) ? null : element.'resource-link'.text()
- }
-
- def searchMetaData(xmlInput, searchName, searchValue){
- def fxml= new XmlSlurper().parseText(xmlInput)
- def ret = fxml.'**'.find {it.metaname.text() == searchName && it.metaval.text() == searchValue}
- if(ret != null){
- return ret.parent().parent()
- }
- return ret
- }
-
- def searchMetaDataNode(fxml, searchName, searchValue){
- def ret = fxml.'**'.find {it.metaname.text() == searchName && it.metaval.text() == searchValue}
- if(ret != null){
- return ret.parent().parent()
- }
- return ret
- }
-
- // for Trinity L3 add/delete bonding
- def getPBGFList(isDebugLogEnabled, xmlInput){
- xmlInput = xmlInput.replaceAll("&amp;", "&")
- xmlInput = xmlInput.replaceAll("&lt;", "<")
- xmlInput = xmlInput.replaceAll("&gt;", ">")
- log("DEBUG", "getPBGFList: xmlInput " + xmlInput,isDebugLogEnabled)
- ArrayList myNodes = new ArrayList()
- if(nodeExists(xmlInput,"nbnc-response-information")){
- def respInfo=getNodeXml(xmlInput,"nbnc-response-information", false)
- if(respInfo!=null){
- def fxml= new XmlSlurper().parseText(respInfo)
- fxml.'virtual-datacenter-list'.each { vdc ->
- //we only want to add two BGF per VDC, BGF1 and BGF2
- def routerList = vdc.'router-list'.first()
- routerList.each{ myList ->
- def physNodes = myList.'**'.findAll {it.'border-element-tangibility'.text() =~ /PHYSICAL/}
- def nodeToAdd
- physNodes.each{
- if(nodeToAdd==null){
- nodeToAdd = it
- }else{
- def beid = nodeToAdd.'border-element-id'.text() +
- " " + nodeToAdd.'border-element-type'.text() +
- " and " +
- it.'border-element-id'.text() +
- " " + it.'border-element-type'.text()
- def mytag = nodeToAdd.'border-element-id'
- mytag[0].replaceBody(beid)
- }
- }
- def mytag = nodeToAdd.'vlan-id'
- def ind = mytag.text().indexOf('.')
- if(ind >= 0){
- def vlan = mytag.text().substring(0,ind)
- mytag[0].replaceBody(vlan)
- }
- myNodes.add(XmlUtil.serialize(nodeToAdd))
- }
-
- }
- }
-
- return myNodes
- }else{
- return null
- }
- }
-
- def getPBGFList(xmlInput){
- getPBGFList("false", xmlInput)
- }
-
- def String decodeXML(xml) {
- def String decodedXml = xml.replaceAll("&amp;", "&")
- decodedXml = decodedXml.replaceAll("&lt;", "<")
- decodedXml = decodedXml.replaceAll("&gt;", ">")
- }
-
- def getMetaVal(node, name){
- try{
- return node.'**'.find {it.metaname.text() == name}.metaval.text()
- }catch(Exception e){
- return null
- }
- }
- def getRelationshipVal(node, name){
- try{
- return node.'**'.find {it.'relationship-key'.text() == name}.'relationship-value'.text()
- }catch(Exception e){
- return null
- }
- }
-
-
- def log(logmode,logtxt,isDebugLogEnabled="false"){
- MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
- if ("INFO"==logmode) {
- msoLogger.info(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, logtxt);
- } else if ("WARN"==logmode) {
- msoLogger.warn (MessageEnum.BPMN_GENERAL_WARNING, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, logtxt);
- } else if ("ERROR"==logmode) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, logtxt);
-
- } else {
- BPMNLogger.debug(isDebugLogEnabled, logtxt);
- }
- }
-
- def logContext(requestId, serviceInstanceId){
- MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
- msoLogger.setLogContext(requestId, serviceInstanceId);
- }
-
- def logMetrics(elapsedTime, logtxt){
- MsoLogger metricsLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
-
- metricsLogger.recordMetricEvent (elapsedTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- logtxt, "BPMN", MsoLogger.getServiceName(), null);
- }
-
- def logAudit(logtxt){
- MsoLogger auditLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
- long startTime = System.currentTimeMillis();
-
- auditLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, logtxt);
- }
-
- // headers: header - name-value
- def getHeaderNameValue(xmlInput, nameAttribute){
- def rtn=null
- if(xmlInput!=null){
- def xml= new XmlSlurper().parseText(xmlInput)
- rtn= xml.'**'.find {header->header.'@name'.text() == nameAttribute}.'@value'
- }
- return rtn
- }
-
- /**
- * Gets the children of the specified element.
- */
- public String getChildNodes(xmlInput, element) {
- def xml= new XmlSlurper().parseText(xmlInput)
- def thisElement = xml.'**'.find {it.name() == element}
- StringBuilder out = new StringBuilder()
- if (thisElement != null) {
- thisElement.children().each() {
- String nodeAsText = removeXmlPreamble(XmlUtil.serialize(it))
- if (out.length() > 0) {
- out.append(System.lineSeparator())
- }
- out.append(nodeAsText)
- }
- }
- return out.toString();
- }
-
- /**
- * Encodes a value so it can be used inside an XML text element.
- * @param s the string to encode
- * @return the encoded string
- */
- public String xmlEncode(Object value) {
- return XmlTool.encode(value)
- }
-
- /**
- * Encodes a value so it can be used inside an XML attribute.
- * @param s the string to encode
- * @return the encoded string
- */
- public String xmlEncodeAttr(Object value) {
- return XmlTool.encodeAttr(value)
- }
-
- /**
- * Decodes XML entities in a string value
- * @param value a value with embedded XML entities
- * @return the decoded string
- */
- public String xmlDecode(Object value) {
- return XmlTool.decode(value)
- }
-
- /**
- * Removes the preamble, if present, from an XML document.
- * Also, for historical reasons, this also trims leading and trailing
- * whitespace from the resulting document. TODO: remove the trimming
- * and fix unit tests that depend on EXACT xml format.
- * @param xml the XML document
- * @return a possibly modified document
- */
- public String removeXmlPreamble(def xml) {
- if (xml == null) {
- return null
- }
-
- return XmlTool.removePreamble(xml).trim()
- }
-
- /**
- * Removes namespaces and namespace declarations from an XML document.
- * @param xml the XML document
- * @return a possibly modified document
- */
- public String removeXmlNamespaces(def xml) {
- return XmlTool.removeNamespaces(xml);
- }
-
- /**
- * Use formatXml instead. Note: this method inserts an XML preamble.
- */
- @Deprecated
- def formatXML(xmlInput) {
- def parseXml = null
- def formatXml = null
- if (xmlInput !=null) {
- parseXml = new XmlParser().parseText(xmlInput)
- formatXml = XmlUtil.serialize(parseXml)
- }
- }
-
- /**
- * Reformats an XML document. The result will not contain an XML preamble
- * or a trailing newline.
- * @param xml the XML document
- * @return a reformatted document
- */
- public String formatXml(def xml) {
- return XmlTool.normalize(xml);
- }
-
- // build single elements
- def buildElements(xmlInput, elementList, parentName) {
- String var = ""
- def xmlBuild = ""
- if (parentName != "") {
- xmlBuild += "<tns2:"+parentName+">"
- }
- if (xmlInput != null) {
- for (element in elementList) {
- def xml= new XmlSlurper().parseText(xmlInput)
- var = xml.'**'.find {it.name() == element}
- if (var != null) {
- xmlBuild += "<tns2:"+element+">"+var.toString()+"</tns2:"+element+">"
- }
- }
- }
- if (parentName != "") {
- xmlBuild += "</tns2:"+parentName+">"
- }
- return xmlBuild
- }
-
- // build the Unbounded elements
- def buildElementsUnbounded(xmlInput, elementList, parentName) {
- def varParents = ""
- def var = ""
- def xmlBuildUnbounded = ""
- if (xmlInput != null) {
- def xml= new XmlSlurper().parseText(xmlInput)
- varParents = xml.'**'.findAll {it.name() == parentName}
- //println " Unbounded ${parentName} - varParent.Size() - " + varParents.size()
- for (i in 0..varParents.size()-1) {
- if (parentName != "") {
- xmlBuildUnbounded += "<tns2:"+parentName+">"
- }
- for (element in elementList) {
- var = varParents[i].'*'.find {it.name() == element}
- if (var != null) {
- xmlBuildUnbounded += "<tns2:"+element+">"+var.toString()+"</tns2:"+element+">"
- //println " i = " + i + ", element: " + element + " = " + var.toString()
- }
- }
- if (parentName != "") {
- xmlBuildUnbounded += "</tns2:"+parentName+">"
- }
- }
- }
- return xmlBuildUnbounded
- }
-
- // Build l2-homing-information
- def buildL2HomingInformation(xmlInput) {
- def elementsL2HomingList = ["evc-name", "topology", "preferred-aic-clli"]
- def rebuildL2Home = ''
- if (xmlInput != null) {
- rebuildL2Home = buildElements(xmlInput, elementsL2HomingList, "l2-homing-information")
- }
- return rebuildL2Home
- }
-
- // Build internet-evc-access-information
- def buildInternetEvcAccessInformation(xmlInput) {
- def elementsInternetEvcAccessInformationList = ["internet-evc-speed-value", "internet-evc-speed-units", "ip-version"]
- def rebuildInternetEvcAccess = ''
- if (xmlInput != null) {
- rebuildInternetEvcAccess = buildElements(xmlInput, elementsInternetEvcAccessInformationList, "internet-evc-access-information")
- }
- return rebuildInternetEvcAccess
- }
-
- // Build ucpe-vms-service-information
- def buildUcpeVmsServiceInformation(xmlInput) {
- def rebuildUcpeVmsServiceInformation = ''
- if (xmlInput != null) {
- def ucpeVmsServiceInformation = getNodeXml(xmlInput, "ucpe-vms-service-information").drop(38).trim()
- rebuildUcpeVmsServiceInformation = "<tns2:ucpe-vms-service-information>"
- // transport-service-information
- rebuildUcpeVmsServiceInformation += "<tns2:transport-service-information>"
- def transportServiceInformation = getNodeXml(ucpeVmsServiceInformation, "transport-service-information").drop(38).trim()
- def elementsTransportServiceInformationList = ["transport-service-type"]
- rebuildUcpeVmsServiceInformation += buildElements(transportServiceInformation, elementsTransportServiceInformationList, "")
- try { // optional
- def accessCircuitInfoList = ["access-circuit-id", "dual-mode"]
- rebuildUcpeVmsServiceInformation += buildElementsUnbounded(transportServiceInformation, accessCircuitInfoList, "access-circuit-info")
- } catch (Exception e) {
- log("ERROR", " Optional - Exception ACCESS-CIRCUIT-INFO - 'access-circuit-info' ")
- }
- rebuildUcpeVmsServiceInformation += "</tns2:transport-service-information>"
- // ucpe-information
- def elementsUcpeInformationList = ["ucpe-host-name", "ucpe-activation-code", "out-of-band-management-modem" ]
- rebuildUcpeVmsServiceInformation += buildElements(ucpeVmsServiceInformation, elementsUcpeInformationList, "ucpe-information")
- // vnf-list
- rebuildUcpeVmsServiceInformation += "<tns2:vnf-list>"
- def vnfListList = ["vnf-instance-id", "vnf-sequence-number", "vnf-type", "vnf-vendor", "vnf-model", "vnf-id", "prov-status", "operational-state", "orchestration-status", "equipment-role" ]
- rebuildUcpeVmsServiceInformation += buildElementsUnbounded(ucpeVmsServiceInformation, vnfListList, "vnf-information")
- rebuildUcpeVmsServiceInformation += "</tns2:vnf-list>"
- rebuildUcpeVmsServiceInformation += "</tns2:ucpe-vms-service-information>"
- }
- log("DEBUG", " rebuildUcpeVmsServiceInformation - " + rebuildUcpeVmsServiceInformation)
- return rebuildUcpeVmsServiceInformation
- }
-
- // Build internet-service-change-details
- def buildInternetServiceChangeDetails(xmlInput) {
- def rebuildInternetServiceChangeDetails = ""
- if (xmlInput != null) {
- try { // optional
- def internetServiceChangeDetails = getNodeXml(xmlInput, "internet-service-change-details").drop(38).trim()
- rebuildInternetServiceChangeDetails = "<tns:internet-service-change-details>"
- rebuildInternetServiceChangeDetails += buildElements(internetServiceChangeDetails, ["internet-evc-speed-value"], "")
- rebuildInternetServiceChangeDetails += buildElements(internetServiceChangeDetails, ["internet-evc-speed-units"], "")
- try { // optional
- def tProvidedV4LanPublicPrefixesChangesList = ["request-index", "v4-next-hop-address", "v4-lan-public-prefix", "v4-lan-public-prefix-length"]
- rebuildInternetServiceChangeDetails += buildElementsUnbounded(internetServiceChangeDetails, tProvidedV4LanPublicPrefixesChangesList, "t-provided-v4-lan-public-prefixes")
- } catch (Exception e) {
- log("ERROR"," Optional - Exception in INTERNET-SERVICE-CHANGE-DETAILS 't-provided-v4-lan-public-prefixes ")
- }
- try { // optional
- def tProvidedV6LanPublicPrefixesChangesList = ["request-index", "v6-next-hop-address", "v6-lan-public-prefix", "v6-lan-public-prefix-length"]
- rebuildInternetServiceChangeDetails += buildElementsUnbounded(internetServiceChangeDetails, tProvidedV6LanPublicPrefixesChangesList, "t-provided-v6-lan-public-prefixes")
- } catch (Exception e) {
- log("ERROR"," Optional - Exception INTERNET-SERVICE-CHANGE-DETAILS 't-provided-v6-lan-public-prefixes ")
- }
- rebuildInternetServiceChangeDetails += "</tns:internet-service-change-details>"
- } catch (Exception e) {
- log("ERROR", " Optional - Exception INTERNET-SERVICE-CHANGE-DETAILS 'internet-service-change-details' ")
- }
- }
- return rebuildInternetServiceChangeDetails
- }
-
- // Build vr-lan
- def buildVrLan(xmlInput) {
-
- def rebuildVrLan = ''
- if (xmlInput != null) {
-
- rebuildVrLan = "<tns2:vr-lan>"
- def vrLan = getNodeXml(xmlInput, "vr-lan").drop(38).trim()
- rebuildVrLan += buildElements(vrLan, ["routing-protocol"], "")
-
- // vr-lan-interface
- def rebuildVrLanInterface = "<tns2:vr-lan-interface>"
- def vrLanInterface = getNodeXml(vrLan, "vr-lan-interface").drop(38).trim()
- rebuildVrLanInterface += buildVrLanInterfacePartial(vrLanInterface)
-
- // dhcp
- def dhcp = getNodeXml(vrLan, "dhcp").drop(38).trim()
- def rebuildDhcp = buildDhcp(dhcp)
- rebuildVrLanInterface += rebuildDhcp
-
- // pat
- def pat = getNodeXml(vrLan, "pat").drop(38).trim()
- def rebuildPat = buildPat(pat)
- rebuildVrLanInterface += rebuildPat
-
- // nat
- def rebuildNat = ""
- try { // optional
- def nat = getNodeXml(vrLan, "nat").drop(38).trim()
- rebuildNat = buildNat(nat)
- } catch (Exception e) {
- log("ERROR", " Optional - Exception 'nat' ")
- }
- rebuildVrLanInterface += rebuildNat
-
- // firewall-lite
- def firewallLite = getNodeXml(vrLan, "firewall-lite").drop(38).trim()
- def rebuildFirewallLite = buildFirewallLite(firewallLite)
- rebuildVrLanInterface += rebuildFirewallLite
-
- // static-routes
- def rebuildStaticRoutes = ""
- try { // optional
- def staticRoutes = getNodeXml(vrLan, "static-routes").drop(38).trim()
- rebuildStaticRoutes = buildStaticRoutes(staticRoutes)
- } catch (Exception e) {
- log("ERROR", " Optional - Exception 'static-routes' ")
- }
- rebuildVrLanInterface += rebuildStaticRoutes
-
- rebuildVrLan += rebuildVrLanInterface
- rebuildVrLan += "</tns2:vr-lan-interface>"
- rebuildVrLan += "</tns2:vr-lan>"
-
- }
- log("DEBUG", " rebuildVrLan - " + rebuildVrLan)
- return rebuildVrLan
- }
-
- // Build vr-lan-interface
- def buildVrLanInterfacePartial(xmlInput) {
- def rebuildingVrLanInterface = ''
- if (xmlInput != null) {
- def vrLanInterfaceList = ["vr-designation", "v4-vr-lan-prefix", "v4-vr-lan-address", "v4-vr-lan-prefix-length", "v6-vr-lan-prefix", "v6-vr-lan-address", "v6-vr-lan-prefix-length", "v4-vce-loopback-address", "v6-vce-wan-address"]
- rebuildingVrLanInterface += buildElements(xmlInput, vrLanInterfaceList, "")
- rebuildingVrLanInterface += "<tns2:v4-public-lan-prefixes>"
- try { // optional
- def tProvidedV4LanPublicPrefixes = getNodeXml(xmlInput, "v4-public-lan-prefixes").drop(38).trim()
- def tProvidedV4LanPublicPrefixesList = ["request-index", "v4-next-hop-address", "v4-lan-public-prefix", "v4-lan-public-prefix-length" ]
- rebuildingVrLanInterface += buildElementsUnbounded(xmlInput, tProvidedV4LanPublicPrefixesList, "t-provided-v4-lan-public-prefixes")
- } catch (Exception ex) {
- log("ERROR", " Optional - Exception VR-LAN INTERFACE 'v4-public-lan-prefixes' ")
- }
- rebuildingVrLanInterface += "</tns2:v4-public-lan-prefixes>"
- rebuildingVrLanInterface += "<tns2:v6-public-lan-prefixes>"
- try { // optional
- def tProvidedV6LanPublicPrefixes = getNodeXml(xmlInput, "v6-public-lan-prefixes").drop(38).trim()
- def tProvidedV6LanPublicPrefixesList = ["request-index", "v6-next-hop-address", "v6-lan-public-prefix", "v6-lan-public-prefix-length" ]
- rebuildingVrLanInterface += buildElementsUnbounded(xmlInput, tProvidedV6LanPublicPrefixesList, "t-provided-v6-lan-public-prefixes")
- } catch (Exception e) {
- log("ERROR", " Optional - Exception VR-LAN INTERFACE 'v6-public-lan-prefixes' ")
- }
- rebuildingVrLanInterface += "</tns2:v6-public-lan-prefixes>"
- }
- log("DEBUG", " rebuildingVrLanInterface - " + rebuildingVrLanInterface)
- return rebuildingVrLanInterface
- }
-
- // Build dhcp
- def buildDhcp(xmlInput) {
- def rebuildingDhcp = ''
- if (xmlInput != null) {
- def dhcpData = new XmlSlurper().parseText(xmlInput)
- rebuildingDhcp = "<tns2:dhcp>"
- def dhcpList1 = ["v4-dhcp-server-enabled", "v6-dhcp-server-enabled", "use-v4-default-pool", "v4-dhcp-default-pool-prefix", "v4-dhcp-default-pool-prefix-length"]
- rebuildingDhcp += buildElements(xmlInput, dhcpList1, "")
- try { // optional
- def excludedV4DhcpAddressesFromDefaultPoolList = ["excluded-v4-address"]
- rebuildingDhcp += buildElementsUnbounded(xmlInput, excludedV4DhcpAddressesFromDefaultPoolList, "excluded-v4-dhcp-addresses-from-default-pool")
- } catch (Exception e) {
- log("ERROR", " Optional - Exception DHCP 'excluded-v4-dhcp-addresses-from-default-pool' ")
- }
- try { // optional
- def v4DhcpPools = dhcpData.'**'.findAll {it.name() == "v4-dhcp-pools"}
- def v4DhcpPoolsSize = v4DhcpPools.size()
- // println " v4DhcpPoolsSize = " + v4DhcpPools.size()
- for (i in 0..v4DhcpPoolsSize-1) {
- def v4DhcpPool = v4DhcpPools[i]
- def v4DhcpPoolXml = XmlUtil.serialize(v4DhcpPool)
- rebuildingDhcp += "<tns2:v4-dhcp-pools>"
- def v4DhcpPoolsList1 = ["v4-dhcp-pool-prefix", "v4-dhcp-pool-prefix-length" ]
- rebuildingDhcp += buildElements(v4DhcpPoolXml, v4DhcpPoolsList1, "")
- try { // optional
- def excludedV4AddressesList = ["excluded-v4-address"]
- rebuildingDhcp += buildElementsUnbounded(v4DhcpPoolXml, excludedV4AddressesList, "excluded-v4-addresses")
- } catch (Exception e) {
- log("ERROR", " Optional - Exception DHCP 'excluded-v4-addresses' ")
- }
- def v4DhcpPoolsList2 = ["v4-dhcp-relay-gateway-address", "v4-dhcp-relay-next-hop-address"]
- rebuildingDhcp += buildElements(v4DhcpPoolXml, v4DhcpPoolsList2, "")
- rebuildingDhcp += "</tns2:v4-dhcp-pools>"
- }
- } catch (Exception e) {
- log("ERROR"," Optional - Exception DHCP 'v4-dhcp-pools' ")
- }
- def dhcpList2 = ["use-v6-default-pool", "v6-dhcp-default-pool-prefix", "v6-dhcp-default-pool-prefix-length"]
- rebuildingDhcp += buildElements(xmlInput, dhcpList2, "")
- try { // optional
- def excludedV6DhcpAddressesFromDdefaultPoolList = ["excluded-v6-address"]
- rebuildingDhcp += buildElementsUnbounded(xmlInput, excludedV6DhcpAddressesFromDdefaultPoolList, "excluded-v6-dhcp-addresses-from-default-pool")
- } catch (Exception e) {
- log("ERROR", " Optional - Exception DHCP 'excluded-v6-dhcp-addresses-from-default-pool' ")
- }
- try { // optional
- def v6DhcpPools = dhcpData.'**'.findAll {it.name() == "v6-dhcp-pools"}
- def v6DhcpPoolsSize = v6DhcpPools.size()
- //println " v6DhcpPoolsSize = " + v6DhcpPools.size()
- for (i in 0..v6DhcpPoolsSize-1) {
- def v6DhcpPool = v6DhcpPools[i]
- def v6DhcpPoolXml = XmlUtil.serialize(v6DhcpPool)
- rebuildingDhcp += "<tns2:v6-dhcp-pools>"
- def v6DhcpPoolsList1 = ["v6-dhcp-pool-prefix", "v6-dhcp-pool-prefix-length"]
- rebuildingDhcp += buildElements(v6DhcpPoolXml, v6DhcpPoolsList1, "")
- try { // optional
- def excludedV6AddressesList = ["excluded-v6-address"]
- rebuildingDhcp += buildElementsUnbounded(v6DhcpPoolXml, excludedV6AddressesList, "excluded-v6-addresses")
- } catch (Exception e) {
- log("ERROR", " Optional - Exception DHCP 'excluded-v6-addresses' ")
- }
- def v6DhcpPoolsList2 = ["v6-dhcp-relay-gateway-address", "v6-dhcp-relay-next-hop-address"]
- rebuildingDhcp += buildElements(v6DhcpPoolXml, v6DhcpPoolsList2, "")
- rebuildingDhcp += "</tns2:v6-dhcp-pools>"
- }
- } catch (Exception e) {
- log("ERROR", " Optional - Exception DHCP 'v6-dhcp-pools' ")
- }
- rebuildingDhcp += "</tns2:dhcp>"
- }
- log("DEBUG", " rebuildingDhcp - " + rebuildingDhcp)
- return rebuildingDhcp
- }
-
- // Build pat
- def buildPat(xmlInput) {
- def rebuildingPat = ''
- if (xmlInput != null) {
- rebuildingPat = "<tns2:pat>"
- def patList = ["v4-pat-enabled", "use-v4-default-pool", "v4-pat-default-pool-prefix", "v4-pat-default-pool-prefix-length"]
- rebuildingPat += buildElements(xmlInput, patList, "")
- try { // optional
- def v4PatPools = getNodeXml(xmlInput, "v4-pat-pools").drop(38).trim()
- def v4PatPoolsList = ["v4-pat-pool-prefix", "v4-pat-pool-prefix-length", "v4-pat-pool-next-hop-address"]
- rebuildingPat += buildElementsUnbounded(xmlInput, v4PatPoolsList, "v4-pat-pools")
- } catch (Exception e) {
- log("ERROR", " Optional - Exception 'v4-pat-pool-next-hop-address' ")
- }
- rebuildingPat += "</tns2:pat>"
- }
- log("DEBUG", " rebuildingPat - " + rebuildingPat)
- return rebuildingPat
- }
-
- // Build nat
- def buildNat(xmlInput) {
- def rebuildingNat = ''
- if (xmlInput != null) {
- rebuildingNat = "<tns2:nat>"
- rebuildingNat += buildElements(xmlInput, ["v4-nat-enabled"], "")
- try { // optional
- def v4NatMappingEntries = getNodeXml(xmlInput, "v4-nat-mapping-entries").drop(38).trim()
- def v4NatMappingEntriesList = ["v4-nat-internal", "v4-nat-next-hop-address", "v4-nat-external"]
- rebuildingNat += buildElementsUnbounded(xmlInput, v4NatMappingEntriesList, "v4-nat-mapping-entries")
- } catch (Exception e) {
- log("ERROR", " Optional - Exception 'v4-nat-external' ")
- }
- rebuildingNat += "</tns2:nat>"
- }
- log("DEBUG", " rebuildingNat - " + rebuildingNat)
- return rebuildingNat
- }
-
- // Build firewall-lite
- def buildFirewallLite(xmlInput) {
- def rebuildingFirewallLite = ''
-
- if (xmlInput != null) {
-
- def firewallLiteData = new XmlSlurper().parseText(xmlInput)
- rebuildingFirewallLite = "<tns2:firewall-lite>"
- def firewallLiteList = ["stateful-firewall-lite-v4-enabled", "stateful-firewall-lite-v6-enabled"]
- rebuildingFirewallLite += buildElements(xmlInput, firewallLiteList, "")
-
- try { // optional
- def v4FirewallPacketFilters = firewallLiteData.'**'.findAll {it.name() == "v4-firewall-packet-filters"}
- def v4FirewallPacketFiltersSize = v4FirewallPacketFilters.size()
- //println " v4FirewallPacketFiltersSize = " + v4FirewallPacketFilters.size()
- for (i in 0..v4FirewallPacketFiltersSize-1) {
- def v4FirewallPacketFilter = v4FirewallPacketFilters[i]
- def v4FirewallPacketFilterXml = XmlUtil.serialize(v4FirewallPacketFilter)
- rebuildingFirewallLite += "<tns2:v4-firewall-packet-filters>"
- def v4FirewallPacketFiltersList = ["v4-firewall-prefix", "v4-firewall-prefix-length", "allow-icmp-ping"]
- rebuildingFirewallLite += buildElements(v4FirewallPacketFilterXml, v4FirewallPacketFiltersList, "")
- try { // optional
- def udpPortsList = ["port-number"]
- rebuildingFirewallLite += buildElementsUnbounded(v4FirewallPacketFilterXml, udpPortsList, "udp-ports")
- } catch (Exception e) {
- log("ERROR", " Optional - Exception FIREWALL-LITE v4 'udp-ports' ")
- }
- try { // optional
- def tcpPortsList = ["port-number"]
- rebuildingFirewallLite += buildElementsUnbounded(v4FirewallPacketFilterXml, tcpPortsList, "tcp-ports")
- } catch (Exception e) {
- log("ERROR", " Optional - Exception FIREWALL-LITE v4 'tcp-ports' ")
- }
- rebuildingFirewallLite += "</tns2:v4-firewall-packet-filters>"
- }
- } catch (Exception e) {
- log("ERROR", " Optional - Exception FIREWALL-LITE 'v4-firewall-packet-filters' ")
- }
-
- try { // optional
- def v6FirewallPacketFilters = firewallLiteData.'**'.findAll {it.name() == "v6-firewall-packet-filters"}
- def v6FirewallPacketFiltersSize = v6FirewallPacketFilters.size()
- //println " v6FirewallPacketFiltersSize = " + v6FirewallPacketFilters.size()
- for (i in 0..v6FirewallPacketFiltersSize-1) {
- def v6FirewallPacketFilter = v6FirewallPacketFilters[i]
- def v6FirewallPacketFilterXml = XmlUtil.serialize(v6FirewallPacketFilter)
- rebuildingFirewallLite += "<tns2:v6-firewall-packet-filters>"
- def v6FirewallPacketFiltersList = ["v6-firewall-prefix", "v6-firewall-prefix-length", "allow-icmp-ping"]
- rebuildingFirewallLite += buildElements(v6FirewallPacketFilterXml, v6FirewallPacketFiltersList, "")
- try { // optional
- def udpPortsList = ["port-number"]
- rebuildingFirewallLite += buildElementsUnbounded(v6FirewallPacketFilterXml, udpPortsList, "udp-ports")
- } catch (Exception e) {
- log("ERROR", " Optional - Exception FIREWALL-LITE v6 'udp-ports' ")
- }
- try { // optional
- def tcpPortsList = ["port-number"]
- rebuildingFirewallLite += buildElementsUnbounded(v6FirewallPacketFilterXml, tcpPortsList, "tcp-ports")
- } catch (Exception e) {
- log("ERROR", " Optional - Exception FIREWALL-LITE v6 'tcp-ports' ")
- }
- rebuildingFirewallLite += "</tns2:v6-firewall-packet-filters>"
- }
- } catch (Exception e) {
- log("ERROR", " Optional - Exception FIREWALL-LITE 'v6-firewall-packet-filters' ")
- }
- rebuildingFirewallLite+= "</tns2:firewall-lite>"
- }
- log("DEBUG", " rebuildingFirewallLite - " + rebuildingFirewallLite)
- return rebuildingFirewallLite
- }
-
- def buildStaticRoutes(xmlInput) {
- def rebuildingStaticRoutes = ''
- if (xmlInput != null) {
- rebuildingStaticRoutes = "<tns2:static-routes>"
- def v4StaticRouteslist = ["v4-static-route-prefix","v4-static-route-prefix-length", "v4-next-hop-address"]
- rebuildingStaticRoutes += buildElementsUnbounded(xmlInput, v4StaticRouteslist, "v4-static-routes")
- def v6StaticRouteslist = ["v6-static-route-prefix","v6-static-route-prefix-length", "v6-next-hop-address"]
- rebuildingStaticRoutes += buildElementsUnbounded(xmlInput, v6StaticRouteslist, "v6-static-routes")
- rebuildingStaticRoutes += "</tns2:static-routes>"
- }
- log("DEBUG", " rebuildingStaticRoutes - " + rebuildingStaticRoutes)
- return rebuildingStaticRoutes
- }
-
- public String generateCurrentTimeInUtc(){
- final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
- sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
- final String utcTime = sdf.format(new Date());
- return utcTime;
- }
-
- public String generateCurrentTimeInGMT(){
- final SimpleDateFormat sdf = new SimpleDateFormat("E, d MMM yyyy h:m:s z");
- sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
- final String utcTime = sdf.format(new Date());
- return utcTime;
- }
-
-
- /**
- * @param encryptedAuth: encrypted credentials from urn properties
- * @param msoKey: key to use to decrypt from urn properties
- * @return base 64 encoded basic auth credentials
- */
- def getBasicAuth(encryptedAuth, msoKey){
- try {
- def auth = decrypt(encryptedAuth, msoKey)
- byte[] encoded = Base64.encodeBase64(auth.getBytes())
- String encodedString = new String(encoded)
- encodedString = "Basic " + encodedString
- return encodedString
- } catch (Exception ex) {
- log("ERROR", "Unable to encode basic auth")
- throw ex
- }
- }
-
- def encrypt(toEncrypt, msokey){
- try {
- String result = CryptoUtils.encrypt(toEncrypt, msokey);
- return result
- }
- catch (Exception e) {
- log("ERROR", "Failed to encrypt credentials")
- }
- }
-
- def decrypt(toDecrypt, msokey){
- try {
- String result = CryptoUtils.decrypt(toDecrypt, msokey);
- return result
- }
- catch (Exception e) {
- log("ERROR", "Failed to decrypt credentials")
- throw e
- }
- }
-
- /**
- * Return URL with qualified host name (if any) or urn mapping
- * @param String url from urn mapping
- * @return String url with qualified host name
- */
- public String getQualifiedHostNameForCallback(String urnCallbackUrl) {
- def callbackUrlToUse = urnCallbackUrl
- try{
- //swap host name with qualified host name from the jboss properties
- def qualifiedHostName = System.getProperty("jboss.qualified.host.name")
- if(qualifiedHostName!=null){
- log("DEBUG", "qualifiedHostName:\n" + qualifiedHostName)
- callbackUrlToUse = callbackUrlToUse.replaceAll("(http://)(.*)(:28080*)", {orig, first, torepl, last -> "${first}${qualifiedHostName}${last}"})
- }
- }catch(Exception e){
- log("DEBUG", "unable to grab qualified host name, using what's in urn properties for callbackurl. Exception was: " + e.printStackTrace())
- }
- return callbackUrlToUse
-
- }
-
- /**
- * Retrieves text context of the element if the element exists, returns empty string otherwise
- * @param com.sun.org.apache.xerces.internal.dom.DeferredElementNSImpl element to parse
- * param String tagName tagName
- * @return String text content of the element
- */
- public String getElementText(Element element, String tagName) {
- String text = ""
- org.w3c.dom.NodeList nodeList = element.getElementsByTagNameNS("*", tagName)
- if (nodeList != null && nodeList.length > 0) {
- text = nodeList.item(0).getTextContent()
- }
- return text
- }
-
- /**
- *
- * Find the lowest unused module-index value in a given xml
- */
- public String getLowestUnusedIndex(String xml) {
- if (xml == null || xml.isEmpty()) {
- return "0"
- }
- def moduleIndexList = getMultNodes(xml, "module-index")
- if (moduleIndexList == null || moduleIndexList.size() == 0) {
- return "0"
- }
- def sortedModuleIndexList = moduleIndexList.sort { a, b -> a.compareTo b }
-
- for (i in 0..sortedModuleIndexList.size()-1) {
- if (Integer.parseInt(sortedModuleIndexList[i]) != i) {
- return i.toString()
- }
- }
- return sortedModuleIndexList.size().toString()
- }
-
-}
+/*-
+ * ============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.common.scripts
+
+import groovy.xml.XmlUtil
+
+import java.text.SimpleDateFormat
+
+import org.apache.commons.codec.binary.Base64
+import org.openecomp.mso.bpmn.core.BPMNLogger
+import org.openecomp.mso.bpmn.core.xml.XmlTool
+import org.openecomp.mso.logger.MessageEnum
+import org.openecomp.mso.logger.MsoLogger
+import org.openecomp.mso.utils.CryptoUtils
+import org.w3c.dom.Element
+
+class MsoUtils {
+ def initializeEndPoints(execution){
+ // use this placeholder to initialize end points, if called independently, this need to be set
+ execution.setVariable("AAIEndPoint","http://localhost:28080/SoapUIMocks")
+ }
+
+ /**
+ * Use getNodeText1 Instead!
+ */
+ @Deprecated
+ def getNodeText(xmlInput,element){
+ def rtn=null
+ if(xmlInput!=null){
+ def xml= new XmlSlurper().parseText(xmlInput)
+ rtn= xml.'**'.find{node->node.name()==element}.text()
+ }
+ return rtn
+ }
+ def getMultNodes(xmlInput, element){
+ def nodes=null
+ if(xmlInput!=null){
+ def xml= new XmlSlurper().parseText(xmlInput)
+ nodes = xml.'**'.findAll{ node-> node.name() == element }*.text()
+ }
+ return nodes
+ }
+ def getNodeText1(xmlInput,element){
+ def rtn=null
+ if(xmlInput!=null){
+ def xml= new XmlSlurper().parseText(xmlInput)
+ rtn= xml.'**'.find{node->node.name()==element}
+ if (rtn != null){
+ rtn=rtn.text()
+ }
+ }
+ return rtn
+ }
+ def getNodeXml(xmlInput,element){
+ return getNodeXml(xmlInput, element, true)
+ }
+ def getNodeXml(xmlInput,element,incPreamble){
+ def fxml= new XmlSlurper().parseText(xmlInput)
+ def nodeToSerialize = fxml.'**'.find {it.name() == element}
+ if(nodeToSerialize==null){
+ return ""
+ }
+ def nodeAsText = XmlUtil.serialize(nodeToSerialize)
+ if (!incPreamble) {
+ nodeAsText = removeXmlPreamble(nodeAsText)
+ }
+ return nodeAsText
+ }
+ def nodeExists(xmlInput,element){
+ try {
+ def fxml= new XmlSlurper().parseText(xmlInput)
+ def nodeToSerialize = fxml.'**'.find {it.name() == element}
+ return nodeToSerialize!=null
+ } catch(Exception e) {
+ return false
+ }
+ }
+
+
+ /***** Utilities when using XmlParser *****/
+
+ /**
+ * Convert a Node into a String by deserializing it and formatting it.
+ *
+ * @param node Node to be converted.
+ * @return the Node as a String.
+ */
+ def String nodeToString(Node node) {
+ def String nodeAsString = groovy.xml.XmlUtil.serialize(node)
+ nodeAsString = removeXmlPreamble(nodeAsString)
+ return formatXml(nodeAsString)
+ }
+
+ /**
+ * Get the specified child Node of the specified parent. If there are
+ * multiple children of the same name, only the first one is returned.
+ * If there are no children with the specified name, 'null' is returned.
+ *
+ * @param parent Parent Node in which to find a child.
+ * @param childNodeName Name of the child Node to get.
+ * @return the (first) child Node with the specified name or 'null'
+ * if a child Node with the specified name does not exist.
+ */
+ def Node getChildNode(Node parent, String childNodeName) {
+ def NodeList nodeList = getIdenticalChildren(parent, childNodeName)
+ if (nodeList.size() == 0) {
+ return null
+ } else {
+ return nodeList.get(0)
+ }
+ }
+
+ /**
+ * Get the textual value of the specified child Node of the specified parent.
+ * If there are no children with the specified name, 'null' is returned.
+ *
+ * @param parent Parent Node in which to find a child.
+ * @param childNodeName Name of the child Node whose value to get.
+ * @return the textual value of child Node with the specified name or 'null'
+ * if a child Node with the specified name does not exist.
+ */
+ def String getChildNodeText(Node parent, String childNodeName) {
+ def Node childNode = getChildNode(parent, childNodeName)
+ if (childNode == null) {
+ return null
+ } else {
+ return childNode.text()
+ }
+ }
+
+ /**
+ * Get all of the child nodes from the specified parent that have the
+ * specified name. The returned NodeList could be empty.
+ *
+ * @param parent Parent Node in which to find children.
+ * @param childNodeName Name of the children to get.
+ * @return a NodeList of all the children from the parent with the specified
+ * name. The list could be empty.
+ */
+ def NodeList getIdenticalChildren(Node parent, String childNodeName) {
+ return (NodeList) parent.get(childNodeName)
+ }
+
+ /***** End of Utilities when using XmlParser *****/
+
+
+ /** these are covered under the common function above**/
+ def getSubscriberName(xmlInput,element){
+ def rtn=null
+ if(xmlInput!=null){
+ def xml= new XmlSlurper().parseText(xmlInput)
+ rtn= xml.'**'.find{node->node.name()==element}.text()
+ }
+ return rtn
+ }
+ def getTenantInformation(xmlInput,element){
+ def xml= new XmlSlurper().parseText(xmlInput)
+ def nodeToSerialize = xml.'**'.find {it.name() == 'service-information'}
+ def nodeAsText = XmlUtil.serialize(nodeToSerialize)
+ return nodeAsText
+ }
+ def getServiceInstanceId(xmlInput,element){
+ def xml= new XmlSlurper().parseText(xmlInput)
+ return ( xml.'**'.find{node->node.name()==element}.text() )
+ }
+ //for aai tenant url
+ def searchResourceLink(xmlInput, resourceType){
+ def fxml= new XmlSlurper().parseText(xmlInput)
+ def element = fxml.'**'.find {it.'resource-type' == resourceType}
+ return (element == null) ? null : element.'resource-link'.text()
+ }
+
+ def searchMetaData(xmlInput, searchName, searchValue){
+ def fxml= new XmlSlurper().parseText(xmlInput)
+ def ret = fxml.'**'.find {it.metaname.text() == searchName && it.metaval.text() == searchValue}
+ if(ret != null){
+ return ret.parent().parent()
+ }
+ return ret
+ }
+
+ def searchMetaDataNode(fxml, searchName, searchValue){
+ def ret = fxml.'**'.find {it.metaname.text() == searchName && it.metaval.text() == searchValue}
+ if(ret != null){
+ return ret.parent().parent()
+ }
+ return ret
+ }
+
+ // for Trinity L3 add/delete bonding
+ def getPBGFList(isDebugLogEnabled, xmlInput){
+ xmlInput = xmlInput.replaceAll("&amp;", "&")
+ xmlInput = xmlInput.replaceAll("&lt;", "<")
+ xmlInput = xmlInput.replaceAll("&gt;", ">")
+ log("DEBUG", "getPBGFList: xmlInput " + xmlInput,isDebugLogEnabled)
+ ArrayList myNodes = new ArrayList()
+ if(nodeExists(xmlInput,"nbnc-response-information")){
+ def respInfo=getNodeXml(xmlInput,"nbnc-response-information", false)
+ if(respInfo!=null){
+ def fxml= new XmlSlurper().parseText(respInfo)
+ fxml.'virtual-datacenter-list'.each { vdc ->
+ //we only want to add two BGF per VDC, BGF1 and BGF2
+ def routerList = vdc.'router-list'.first()
+ routerList.each{ myList ->
+ def physNodes = myList.'**'.findAll {it.'border-element-tangibility'.text() =~ /PHYSICAL/}
+ def nodeToAdd
+ physNodes.each{
+ if(nodeToAdd==null){
+ nodeToAdd = it
+ }else{
+ def beid = nodeToAdd.'border-element-id'.text() +
+ " " + nodeToAdd.'border-element-type'.text() +
+ " and " +
+ it.'border-element-id'.text() +
+ " " + it.'border-element-type'.text()
+ def mytag = nodeToAdd.'border-element-id'
+ mytag[0].replaceBody(beid)
+ }
+ }
+ def mytag = nodeToAdd.'vlan-id'
+ def ind = mytag.text().indexOf('.')
+ if(ind >= 0){
+ def vlan = mytag.text().substring(0,ind)
+ mytag[0].replaceBody(vlan)
+ }
+ myNodes.add(XmlUtil.serialize(nodeToAdd))
+ }
+
+ }
+ }
+
+ return myNodes
+ }else{
+ return null
+ }
+ }
+
+ def getPBGFList(xmlInput){
+ getPBGFList("false", xmlInput)
+ }
+
+ def String decodeXML(xml) {
+ def String decodedXml = xml.replaceAll("&amp;", "&")
+ decodedXml = decodedXml.replaceAll("&lt;", "<")
+ decodedXml = decodedXml.replaceAll("&gt;", ">")
+ }
+
+ def getMetaVal(node, name){
+ try{
+ return node.'**'.find {it.metaname.text() == name}.metaval.text()
+ }catch(Exception e){
+ return null
+ }
+ }
+ def getRelationshipVal(node, name){
+ try{
+ return node.'**'.find {it.'relationship-key'.text() == name}.'relationship-value'.text()
+ }catch(Exception e){
+ return null
+ }
+ }
+
+
+ def log(logmode,logtxt,isDebugLogEnabled="false"){
+ MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
+ if ("INFO"==logmode) {
+ msoLogger.info(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, logtxt);
+ } else if ("WARN"==logmode) {
+ // to see the warning text displayed in the log entry, the text must also be passed as arg0 (2nd argument) to invoke the correct MsoLogger warn() method
+ msoLogger.warn (MessageEnum.BPMN_GENERAL_WARNING, logtxt, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, logtxt);
+ } else if ("ERROR"==logmode) {
+ // to see the error text displayed in the log entry, the text must also be passed as arg0 (2nd argument) to invoke the correct MsoLogger error() method
+ msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, logtxt, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, logtxt);
+
+ } else {
+ BPMNLogger.debug(isDebugLogEnabled, logtxt);
+ }
+ }
+
+ def logContext(requestId, serviceInstanceId){
+ MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
+ msoLogger.setLogContext(requestId, serviceInstanceId);
+ }
+
+ def logMetrics(elapsedTime, logtxt){
+ MsoLogger metricsLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
+
+ metricsLogger.recordMetricEvent (elapsedTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
+ logtxt, "BPMN", MsoLogger.getServiceName(), null);
+ }
+
+ def logAudit(logtxt){
+ MsoLogger auditLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
+ long startTime = System.currentTimeMillis();
+
+ auditLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, logtxt);
+ }
+
+ // headers: header - name-value
+ def getHeaderNameValue(xmlInput, nameAttribute){
+ def rtn=null
+ if(xmlInput!=null){
+ def xml= new XmlSlurper().parseText(xmlInput)
+ rtn= xml.'**'.find {header->header.'@name'.text() == nameAttribute}.'@value'
+ }
+ return rtn
+ }
+
+ /**
+ * Gets the children of the specified element.
+ */
+ public String getChildNodes(xmlInput, element) {
+ def xml= new XmlSlurper().parseText(xmlInput)
+ def thisElement = xml.'**'.find {it.name() == element}
+ StringBuilder out = new StringBuilder()
+ if (thisElement != null) {
+ thisElement.children().each() {
+ String nodeAsText = removeXmlPreamble(XmlUtil.serialize(it))
+ if (out.length() > 0) {
+ out.append(System.lineSeparator())
+ }
+ out.append(nodeAsText)
+ }
+ }
+ return out.toString();
+ }
+
+ /**
+ * Encodes a value so it can be used inside an XML text element.
+ * @param s the string to encode
+ * @return the encoded string
+ */
+ public String xmlEncode(Object value) {
+ return XmlTool.encode(value)
+ }
+
+ /**
+ * Encodes a value so it can be used inside an XML attribute.
+ * @param s the string to encode
+ * @return the encoded string
+ */
+ public String xmlEncodeAttr(Object value) {
+ return XmlTool.encodeAttr(value)
+ }
+
+ /**
+ * Decodes XML entities in a string value
+ * @param value a value with embedded XML entities
+ * @return the decoded string
+ */
+ public String xmlDecode(Object value) {
+ return XmlTool.decode(value)
+ }
+
+ /**
+ * Removes the preamble, if present, from an XML document.
+ * Also, for historical reasons, this also trims leading and trailing
+ * whitespace from the resulting document. TODO: remove the trimming
+ * and fix unit tests that depend on EXACT xml format.
+ * @param xml the XML document
+ * @return a possibly modified document
+ */
+ public String removeXmlPreamble(def xml) {
+ if (xml == null) {
+ return null
+ }
+
+ return XmlTool.removePreamble(xml).trim()
+ }
+
+ /**
+ * Removes namespaces and namespace declarations from an XML document.
+ * @param xml the XML document
+ * @return a possibly modified document
+ */
+ public String removeXmlNamespaces(def xml) {
+ return XmlTool.removeNamespaces(xml);
+ }
+
+ /**
+ * Use formatXml instead. Note: this method inserts an XML preamble.
+ */
+ @Deprecated
+ def formatXML(xmlInput) {
+ def parseXml = null
+ def formatXml = null
+ if (xmlInput !=null) {
+ parseXml = new XmlParser().parseText(xmlInput)
+ formatXml = XmlUtil.serialize(parseXml)
+ }
+ }
+
+ /**
+ * Reformats an XML document. The result will not contain an XML preamble
+ * or a trailing newline.
+ * @param xml the XML document
+ * @return a reformatted document
+ */
+ public String formatXml(def xml) {
+ return XmlTool.normalize(xml);
+ }
+
+ // build single elements
+ def buildElements(xmlInput, elementList, parentName) {
+ String var = ""
+ def xmlBuild = ""
+ if (parentName != "") {
+ xmlBuild += "<tns2:"+parentName+">"
+ }
+ if (xmlInput != null) {
+ for (element in elementList) {
+ def xml= new XmlSlurper().parseText(xmlInput)
+ var = xml.'**'.find {it.name() == element}
+ if (var != null) {
+ xmlBuild += "<tns2:"+element+">"+var.toString()+"</tns2:"+element+">"
+ }
+ }
+ }
+ if (parentName != "") {
+ xmlBuild += "</tns2:"+parentName+">"
+ }
+ return xmlBuild
+ }
+
+ // build the Unbounded elements
+ def buildElementsUnbounded(xmlInput, elementList, parentName) {
+ def varParents = ""
+ def var = ""
+ def xmlBuildUnbounded = ""
+ if (xmlInput != null) {
+ def xml= new XmlSlurper().parseText(xmlInput)
+ varParents = xml.'**'.findAll {it.name() == parentName}
+ //println " Unbounded ${parentName} - varParent.Size() - " + varParents.size()
+ for (i in 0..varParents.size()-1) {
+ if (parentName != "") {
+ xmlBuildUnbounded += "<tns2:"+parentName+">"
+ }
+ for (element in elementList) {
+ var = varParents[i].'*'.find {it.name() == element}
+ if (var != null) {
+ xmlBuildUnbounded += "<tns2:"+element+">"+var.toString()+"</tns2:"+element+">"
+ //println " i = " + i + ", element: " + element + " = " + var.toString()
+ }
+ }
+ if (parentName != "") {
+ xmlBuildUnbounded += "</tns2:"+parentName+">"
+ }
+ }
+ }
+ return xmlBuildUnbounded
+ }
+
+ // Build l2-homing-information
+ def buildL2HomingInformation(xmlInput) {
+ def elementsL2HomingList = ["evc-name", "topology", "preferred-aic-clli"]
+ def rebuildL2Home = ''
+ if (xmlInput != null) {
+ rebuildL2Home = buildElements(xmlInput, elementsL2HomingList, "l2-homing-information")
+ }
+ return rebuildL2Home
+ }
+
+ // Build internet-evc-access-information
+ def buildInternetEvcAccessInformation(xmlInput) {
+ def elementsInternetEvcAccessInformationList = ["internet-evc-speed-value", "internet-evc-speed-units", "ip-version"]
+ def rebuildInternetEvcAccess = ''
+ if (xmlInput != null) {
+ rebuildInternetEvcAccess = buildElements(xmlInput, elementsInternetEvcAccessInformationList, "internet-evc-access-information")
+ }
+ return rebuildInternetEvcAccess
+ }
+
+ // Build ucpe-vms-service-information
+ def buildUcpeVmsServiceInformation(xmlInput) {
+ def rebuildUcpeVmsServiceInformation = ''
+ if (xmlInput != null) {
+ def ucpeVmsServiceInformation = getNodeXml(xmlInput, "ucpe-vms-service-information").drop(38).trim()
+ rebuildUcpeVmsServiceInformation = "<tns2:ucpe-vms-service-information>"
+ // transport-service-information
+ rebuildUcpeVmsServiceInformation += "<tns2:transport-service-information>"
+ def transportServiceInformation = getNodeXml(ucpeVmsServiceInformation, "transport-service-information").drop(38).trim()
+ def elementsTransportServiceInformationList = ["transport-service-type"]
+ rebuildUcpeVmsServiceInformation += buildElements(transportServiceInformation, elementsTransportServiceInformationList, "")
+ try { // optional
+ def accessCircuitInfoList = ["access-circuit-id", "dual-mode"]
+ rebuildUcpeVmsServiceInformation += buildElementsUnbounded(transportServiceInformation, accessCircuitInfoList, "access-circuit-info")
+ } catch (Exception e) {
+ log("ERROR", " Optional - Exception ACCESS-CIRCUIT-INFO - 'access-circuit-info' ")
+ }
+ rebuildUcpeVmsServiceInformation += "</tns2:transport-service-information>"
+ // ucpe-information
+ def elementsUcpeInformationList = ["ucpe-host-name", "ucpe-activation-code", "out-of-band-management-modem" ]
+ rebuildUcpeVmsServiceInformation += buildElements(ucpeVmsServiceInformation, elementsUcpeInformationList, "ucpe-information")
+ // vnf-list
+ rebuildUcpeVmsServiceInformation += "<tns2:vnf-list>"
+ def vnfListList = ["vnf-instance-id", "vnf-sequence-number", "vnf-type", "vnf-vendor", "vnf-model", "vnf-id", "prov-status", "operational-state", "orchestration-status", "equipment-role" ]
+ rebuildUcpeVmsServiceInformation += buildElementsUnbounded(ucpeVmsServiceInformation, vnfListList, "vnf-information")
+ rebuildUcpeVmsServiceInformation += "</tns2:vnf-list>"
+ rebuildUcpeVmsServiceInformation += "</tns2:ucpe-vms-service-information>"
+ }
+ log("DEBUG", " rebuildUcpeVmsServiceInformation - " + rebuildUcpeVmsServiceInformation)
+ return rebuildUcpeVmsServiceInformation
+ }
+
+ // Build internet-service-change-details
+ def buildInternetServiceChangeDetails(xmlInput) {
+ def rebuildInternetServiceChangeDetails = ""
+ if (xmlInput != null) {
+ try { // optional
+ def internetServiceChangeDetails = getNodeXml(xmlInput, "internet-service-change-details").drop(38).trim()
+ rebuildInternetServiceChangeDetails = "<tns:internet-service-change-details>"
+ rebuildInternetServiceChangeDetails += buildElements(internetServiceChangeDetails, ["internet-evc-speed-value"], "")
+ rebuildInternetServiceChangeDetails += buildElements(internetServiceChangeDetails, ["internet-evc-speed-units"], "")
+ try { // optional
+ def tProvidedV4LanPublicPrefixesChangesList = ["request-index", "v4-next-hop-address", "v4-lan-public-prefix", "v4-lan-public-prefix-length"]
+ rebuildInternetServiceChangeDetails += buildElementsUnbounded(internetServiceChangeDetails, tProvidedV4LanPublicPrefixesChangesList, "t-provided-v4-lan-public-prefixes")
+ } catch (Exception e) {
+ log("ERROR"," Optional - Exception in INTERNET-SERVICE-CHANGE-DETAILS 't-provided-v4-lan-public-prefixes ")
+ }
+ try { // optional
+ def tProvidedV6LanPublicPrefixesChangesList = ["request-index", "v6-next-hop-address", "v6-lan-public-prefix", "v6-lan-public-prefix-length"]
+ rebuildInternetServiceChangeDetails += buildElementsUnbounded(internetServiceChangeDetails, tProvidedV6LanPublicPrefixesChangesList, "t-provided-v6-lan-public-prefixes")
+ } catch (Exception e) {
+ log("ERROR"," Optional - Exception INTERNET-SERVICE-CHANGE-DETAILS 't-provided-v6-lan-public-prefixes ")
+ }
+ rebuildInternetServiceChangeDetails += "</tns:internet-service-change-details>"
+ } catch (Exception e) {
+ log("ERROR", " Optional - Exception INTERNET-SERVICE-CHANGE-DETAILS 'internet-service-change-details' ")
+ }
+ }
+ return rebuildInternetServiceChangeDetails
+ }
+
+ // Build vr-lan
+ def buildVrLan(xmlInput) {
+
+ def rebuildVrLan = ''
+ if (xmlInput != null) {
+
+ rebuildVrLan = "<tns2:vr-lan>"
+ def vrLan = getNodeXml(xmlInput, "vr-lan").drop(38).trim()
+ rebuildVrLan += buildElements(vrLan, ["routing-protocol"], "")
+
+ // vr-lan-interface
+ def rebuildVrLanInterface = "<tns2:vr-lan-interface>"
+ def vrLanInterface = getNodeXml(vrLan, "vr-lan-interface").drop(38).trim()
+ rebuildVrLanInterface += buildVrLanInterfacePartial(vrLanInterface)
+
+ // dhcp
+ def dhcp = getNodeXml(vrLan, "dhcp").drop(38).trim()
+ def rebuildDhcp = buildDhcp(dhcp)
+ rebuildVrLanInterface += rebuildDhcp
+
+ // pat
+ def pat = getNodeXml(vrLan, "pat").drop(38).trim()
+ def rebuildPat = buildPat(pat)
+ rebuildVrLanInterface += rebuildPat
+
+ // nat
+ def rebuildNat = ""
+ try { // optional
+ def nat = getNodeXml(vrLan, "nat").drop(38).trim()
+ rebuildNat = buildNat(nat)
+ } catch (Exception e) {
+ log("ERROR", " Optional - Exception 'nat' ")
+ }
+ rebuildVrLanInterface += rebuildNat
+
+ // firewall-lite
+ def firewallLite = getNodeXml(vrLan, "firewall-lite").drop(38).trim()
+ def rebuildFirewallLite = buildFirewallLite(firewallLite)
+ rebuildVrLanInterface += rebuildFirewallLite
+
+ // static-routes
+ def rebuildStaticRoutes = ""
+ try { // optional
+ def staticRoutes = getNodeXml(vrLan, "static-routes").drop(38).trim()
+ rebuildStaticRoutes = buildStaticRoutes(staticRoutes)
+ } catch (Exception e) {
+ log("ERROR", " Optional - Exception 'static-routes' ")
+ }
+ rebuildVrLanInterface += rebuildStaticRoutes
+
+ rebuildVrLan += rebuildVrLanInterface
+ rebuildVrLan += "</tns2:vr-lan-interface>"
+ rebuildVrLan += "</tns2:vr-lan>"
+
+ }
+ log("DEBUG", " rebuildVrLan - " + rebuildVrLan)
+ return rebuildVrLan
+ }
+
+ // Build vr-lan-interface
+ def buildVrLanInterfacePartial(xmlInput) {
+ def rebuildingVrLanInterface = ''
+ if (xmlInput != null) {
+ def vrLanInterfaceList = ["vr-designation", "v4-vr-lan-prefix", "v4-vr-lan-address", "v4-vr-lan-prefix-length", "v6-vr-lan-prefix", "v6-vr-lan-address", "v6-vr-lan-prefix-length", "v4-vce-loopback-address", "v6-vce-wan-address"]
+ rebuildingVrLanInterface += buildElements(xmlInput, vrLanInterfaceList, "")
+ rebuildingVrLanInterface += "<tns2:v4-public-lan-prefixes>"
+ try { // optional
+ def tProvidedV4LanPublicPrefixes = getNodeXml(xmlInput, "v4-public-lan-prefixes").drop(38).trim()
+ def tProvidedV4LanPublicPrefixesList = ["request-index", "v4-next-hop-address", "v4-lan-public-prefix", "v4-lan-public-prefix-length" ]
+ rebuildingVrLanInterface += buildElementsUnbounded(xmlInput, tProvidedV4LanPublicPrefixesList, "t-provided-v4-lan-public-prefixes")
+ } catch (Exception ex) {
+ log("ERROR", " Optional - Exception VR-LAN INTERFACE 'v4-public-lan-prefixes' ")
+ }
+ rebuildingVrLanInterface += "</tns2:v4-public-lan-prefixes>"
+ rebuildingVrLanInterface += "<tns2:v6-public-lan-prefixes>"
+ try { // optional
+ def tProvidedV6LanPublicPrefixes = getNodeXml(xmlInput, "v6-public-lan-prefixes").drop(38).trim()
+ def tProvidedV6LanPublicPrefixesList = ["request-index", "v6-next-hop-address", "v6-lan-public-prefix", "v6-lan-public-prefix-length" ]
+ rebuildingVrLanInterface += buildElementsUnbounded(xmlInput, tProvidedV6LanPublicPrefixesList, "t-provided-v6-lan-public-prefixes")
+ } catch (Exception e) {
+ log("ERROR", " Optional - Exception VR-LAN INTERFACE 'v6-public-lan-prefixes' ")
+ }
+ rebuildingVrLanInterface += "</tns2:v6-public-lan-prefixes>"
+ }
+ log("DEBUG", " rebuildingVrLanInterface - " + rebuildingVrLanInterface)
+ return rebuildingVrLanInterface
+ }
+
+ // Build dhcp
+ def buildDhcp(xmlInput) {
+ def rebuildingDhcp = ''
+ if (xmlInput != null) {
+ def dhcpData = new XmlSlurper().parseText(xmlInput)
+ rebuildingDhcp = "<tns2:dhcp>"
+ def dhcpList1 = ["v4-dhcp-server-enabled", "v6-dhcp-server-enabled", "use-v4-default-pool", "v4-dhcp-default-pool-prefix", "v4-dhcp-default-pool-prefix-length"]
+ rebuildingDhcp += buildElements(xmlInput, dhcpList1, "")
+ try { // optional
+ def excludedV4DhcpAddressesFromDefaultPoolList = ["excluded-v4-address"]
+ rebuildingDhcp += buildElementsUnbounded(xmlInput, excludedV4DhcpAddressesFromDefaultPoolList, "excluded-v4-dhcp-addresses-from-default-pool")
+ } catch (Exception e) {
+ log("ERROR", " Optional - Exception DHCP 'excluded-v4-dhcp-addresses-from-default-pool' ")
+ }
+ try { // optional
+ def v4DhcpPools = dhcpData.'**'.findAll {it.name() == "v4-dhcp-pools"}
+ def v4DhcpPoolsSize = v4DhcpPools.size()
+ // println " v4DhcpPoolsSize = " + v4DhcpPools.size()
+ for (i in 0..v4DhcpPoolsSize-1) {
+ def v4DhcpPool = v4DhcpPools[i]
+ def v4DhcpPoolXml = XmlUtil.serialize(v4DhcpPool)
+ rebuildingDhcp += "<tns2:v4-dhcp-pools>"
+ def v4DhcpPoolsList1 = ["v4-dhcp-pool-prefix", "v4-dhcp-pool-prefix-length" ]
+ rebuildingDhcp += buildElements(v4DhcpPoolXml, v4DhcpPoolsList1, "")
+ try { // optional
+ def excludedV4AddressesList = ["excluded-v4-address"]
+ rebuildingDhcp += buildElementsUnbounded(v4DhcpPoolXml, excludedV4AddressesList, "excluded-v4-addresses")
+ } catch (Exception e) {
+ log("ERROR", " Optional - Exception DHCP 'excluded-v4-addresses' ")
+ }
+ def v4DhcpPoolsList2 = ["v4-dhcp-relay-gateway-address", "v4-dhcp-relay-next-hop-address"]
+ rebuildingDhcp += buildElements(v4DhcpPoolXml, v4DhcpPoolsList2, "")
+ rebuildingDhcp += "</tns2:v4-dhcp-pools>"
+ }
+ } catch (Exception e) {
+ log("ERROR"," Optional - Exception DHCP 'v4-dhcp-pools' ")
+ }
+ def dhcpList2 = ["use-v6-default-pool", "v6-dhcp-default-pool-prefix", "v6-dhcp-default-pool-prefix-length"]
+ rebuildingDhcp += buildElements(xmlInput, dhcpList2, "")
+ try { // optional
+ def excludedV6DhcpAddressesFromDdefaultPoolList = ["excluded-v6-address"]
+ rebuildingDhcp += buildElementsUnbounded(xmlInput, excludedV6DhcpAddressesFromDdefaultPoolList, "excluded-v6-dhcp-addresses-from-default-pool")
+ } catch (Exception e) {
+ log("ERROR", " Optional - Exception DHCP 'excluded-v6-dhcp-addresses-from-default-pool' ")
+ }
+ try { // optional
+ def v6DhcpPools = dhcpData.'**'.findAll {it.name() == "v6-dhcp-pools"}
+ def v6DhcpPoolsSize = v6DhcpPools.size()
+ //println " v6DhcpPoolsSize = " + v6DhcpPools.size()
+ for (i in 0..v6DhcpPoolsSize-1) {
+ def v6DhcpPool = v6DhcpPools[i]
+ def v6DhcpPoolXml = XmlUtil.serialize(v6DhcpPool)
+ rebuildingDhcp += "<tns2:v6-dhcp-pools>"
+ def v6DhcpPoolsList1 = ["v6-dhcp-pool-prefix", "v6-dhcp-pool-prefix-length"]
+ rebuildingDhcp += buildElements(v6DhcpPoolXml, v6DhcpPoolsList1, "")
+ try { // optional
+ def excludedV6AddressesList = ["excluded-v6-address"]
+ rebuildingDhcp += buildElementsUnbounded(v6DhcpPoolXml, excludedV6AddressesList, "excluded-v6-addresses")
+ } catch (Exception e) {
+ log("ERROR", " Optional - Exception DHCP 'excluded-v6-addresses' ")
+ }
+ def v6DhcpPoolsList2 = ["v6-dhcp-relay-gateway-address", "v6-dhcp-relay-next-hop-address"]
+ rebuildingDhcp += buildElements(v6DhcpPoolXml, v6DhcpPoolsList2, "")
+ rebuildingDhcp += "</tns2:v6-dhcp-pools>"
+ }
+ } catch (Exception e) {
+ log("ERROR", " Optional - Exception DHCP 'v6-dhcp-pools' ")
+ }
+ rebuildingDhcp += "</tns2:dhcp>"
+ }
+ log("DEBUG", " rebuildingDhcp - " + rebuildingDhcp)
+ return rebuildingDhcp
+ }
+
+ // Build pat
+ def buildPat(xmlInput) {
+ def rebuildingPat = ''
+ if (xmlInput != null) {
+ rebuildingPat = "<tns2:pat>"
+ def patList = ["v4-pat-enabled", "use-v4-default-pool", "v4-pat-default-pool-prefix", "v4-pat-default-pool-prefix-length"]
+ rebuildingPat += buildElements(xmlInput, patList, "")
+ try { // optional
+ def v4PatPools = getNodeXml(xmlInput, "v4-pat-pools").drop(38).trim()
+ def v4PatPoolsList = ["v4-pat-pool-prefix", "v4-pat-pool-prefix-length", "v4-pat-pool-next-hop-address"]
+ rebuildingPat += buildElementsUnbounded(xmlInput, v4PatPoolsList, "v4-pat-pools")
+ } catch (Exception e) {
+ log("ERROR", " Optional - Exception 'v4-pat-pool-next-hop-address' ")
+ }
+ rebuildingPat += "</tns2:pat>"
+ }
+ log("DEBUG", " rebuildingPat - " + rebuildingPat)
+ return rebuildingPat
+ }
+
+ // Build nat
+ def buildNat(xmlInput) {
+ def rebuildingNat = ''
+ if (xmlInput != null) {
+ rebuildingNat = "<tns2:nat>"
+ rebuildingNat += buildElements(xmlInput, ["v4-nat-enabled"], "")
+ try { // optional
+ def v4NatMappingEntries = getNodeXml(xmlInput, "v4-nat-mapping-entries").drop(38).trim()
+ def v4NatMappingEntriesList = ["v4-nat-internal", "v4-nat-next-hop-address", "v4-nat-external"]
+ rebuildingNat += buildElementsUnbounded(xmlInput, v4NatMappingEntriesList, "v4-nat-mapping-entries")
+ } catch (Exception e) {
+ log("ERROR", " Optional - Exception 'v4-nat-external' ")
+ }
+ rebuildingNat += "</tns2:nat>"
+ }
+ log("DEBUG", " rebuildingNat - " + rebuildingNat)
+ return rebuildingNat
+ }
+
+ // Build firewall-lite
+ def buildFirewallLite(xmlInput) {
+ def rebuildingFirewallLite = ''
+
+ if (xmlInput != null) {
+
+ def firewallLiteData = new XmlSlurper().parseText(xmlInput)
+ rebuildingFirewallLite = "<tns2:firewall-lite>"
+ def firewallLiteList = ["stateful-firewall-lite-v4-enabled", "stateful-firewall-lite-v6-enabled"]
+ rebuildingFirewallLite += buildElements(xmlInput, firewallLiteList, "")
+
+ try { // optional
+ def v4FirewallPacketFilters = firewallLiteData.'**'.findAll {it.name() == "v4-firewall-packet-filters"}
+ def v4FirewallPacketFiltersSize = v4FirewallPacketFilters.size()
+ //println " v4FirewallPacketFiltersSize = " + v4FirewallPacketFilters.size()
+ for (i in 0..v4FirewallPacketFiltersSize-1) {
+ def v4FirewallPacketFilter = v4FirewallPacketFilters[i]
+ def v4FirewallPacketFilterXml = XmlUtil.serialize(v4FirewallPacketFilter)
+ rebuildingFirewallLite += "<tns2:v4-firewall-packet-filters>"
+ def v4FirewallPacketFiltersList = ["v4-firewall-prefix", "v4-firewall-prefix-length", "allow-icmp-ping"]
+ rebuildingFirewallLite += buildElements(v4FirewallPacketFilterXml, v4FirewallPacketFiltersList, "")
+ try { // optional
+ def udpPortsList = ["port-number"]
+ rebuildingFirewallLite += buildElementsUnbounded(v4FirewallPacketFilterXml, udpPortsList, "udp-ports")
+ } catch (Exception e) {
+ log("ERROR", " Optional - Exception FIREWALL-LITE v4 'udp-ports' ")
+ }
+ try { // optional
+ def tcpPortsList = ["port-number"]
+ rebuildingFirewallLite += buildElementsUnbounded(v4FirewallPacketFilterXml, tcpPortsList, "tcp-ports")
+ } catch (Exception e) {
+ log("ERROR", " Optional - Exception FIREWALL-LITE v4 'tcp-ports' ")
+ }
+ rebuildingFirewallLite += "</tns2:v4-firewall-packet-filters>"
+ }
+ } catch (Exception e) {
+ log("ERROR", " Optional - Exception FIREWALL-LITE 'v4-firewall-packet-filters' ")
+ }
+
+ try { // optional
+ def v6FirewallPacketFilters = firewallLiteData.'**'.findAll {it.name() == "v6-firewall-packet-filters"}
+ def v6FirewallPacketFiltersSize = v6FirewallPacketFilters.size()
+ //println " v6FirewallPacketFiltersSize = " + v6FirewallPacketFilters.size()
+ for (i in 0..v6FirewallPacketFiltersSize-1) {
+ def v6FirewallPacketFilter = v6FirewallPacketFilters[i]
+ def v6FirewallPacketFilterXml = XmlUtil.serialize(v6FirewallPacketFilter)
+ rebuildingFirewallLite += "<tns2:v6-firewall-packet-filters>"
+ def v6FirewallPacketFiltersList = ["v6-firewall-prefix", "v6-firewall-prefix-length", "allow-icmp-ping"]
+ rebuildingFirewallLite += buildElements(v6FirewallPacketFilterXml, v6FirewallPacketFiltersList, "")
+ try { // optional
+ def udpPortsList = ["port-number"]
+ rebuildingFirewallLite += buildElementsUnbounded(v6FirewallPacketFilterXml, udpPortsList, "udp-ports")
+ } catch (Exception e) {
+ log("ERROR", " Optional - Exception FIREWALL-LITE v6 'udp-ports' ")
+ }
+ try { // optional
+ def tcpPortsList = ["port-number"]
+ rebuildingFirewallLite += buildElementsUnbounded(v6FirewallPacketFilterXml, tcpPortsList, "tcp-ports")
+ } catch (Exception e) {
+ log("ERROR", " Optional - Exception FIREWALL-LITE v6 'tcp-ports' ")
+ }
+ rebuildingFirewallLite += "</tns2:v6-firewall-packet-filters>"
+ }
+ } catch (Exception e) {
+ log("ERROR", " Optional - Exception FIREWALL-LITE 'v6-firewall-packet-filters' ")
+ }
+ rebuildingFirewallLite+= "</tns2:firewall-lite>"
+ }
+ log("DEBUG", " rebuildingFirewallLite - " + rebuildingFirewallLite)
+ return rebuildingFirewallLite
+ }
+
+ def buildStaticRoutes(xmlInput) {
+ def rebuildingStaticRoutes = ''
+ if (xmlInput != null) {
+ rebuildingStaticRoutes = "<tns2:static-routes>"
+ def v4StaticRouteslist = ["v4-static-route-prefix","v4-static-route-prefix-length", "v4-next-hop-address"]
+ rebuildingStaticRoutes += buildElementsUnbounded(xmlInput, v4StaticRouteslist, "v4-static-routes")
+ def v6StaticRouteslist = ["v6-static-route-prefix","v6-static-route-prefix-length", "v6-next-hop-address"]
+ rebuildingStaticRoutes += buildElementsUnbounded(xmlInput, v6StaticRouteslist, "v6-static-routes")
+ rebuildingStaticRoutes += "</tns2:static-routes>"
+ }
+ log("DEBUG", " rebuildingStaticRoutes - " + rebuildingStaticRoutes)
+ return rebuildingStaticRoutes
+ }
+
+ public String generateCurrentTimeInUtc(){
+ final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
+ sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
+ final String utcTime = sdf.format(new Date());
+ return utcTime;
+ }
+
+ public String generateCurrentTimeInGMT(){
+ final SimpleDateFormat sdf = new SimpleDateFormat("E, d MMM yyyy h:m:s z");
+ sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
+ final String utcTime = sdf.format(new Date());
+ return utcTime;
+ }
+
+
+ /**
+ * @param encryptedAuth: encrypted credentials from urn properties
+ * @param msoKey: key to use to decrypt from urn properties
+ * @return base 64 encoded basic auth credentials
+ */
+ def getBasicAuth(encryptedAuth, msoKey){
+ try {
+ def auth = decrypt(encryptedAuth, msoKey)
+ byte[] encoded = Base64.encodeBase64(auth.getBytes())
+ String encodedString = new String(encoded)
+ encodedString = "Basic " + encodedString
+ return encodedString
+ } catch (Exception ex) {
+ log("ERROR", "Unable to encode basic auth")
+ throw ex
+ }
+ }
+
+ def encrypt(toEncrypt, msokey){
+ try {
+ String result = CryptoUtils.encrypt(toEncrypt, msokey);
+ return result
+ }
+ catch (Exception e) {
+ log("ERROR", "Failed to encrypt credentials")
+ }
+ }
+
+ def decrypt(toDecrypt, msokey){
+ try {
+ String result = CryptoUtils.decrypt(toDecrypt, msokey);
+ return result
+ }
+ catch (Exception e) {
+ log("ERROR", "Failed to decrypt credentials")
+ throw e
+ }
+ }
+
+ /**
+ * Return URL with qualified host name (if any) or urn mapping
+ * @param String url from urn mapping
+ * @return String url with qualified host name
+ */
+ public String getQualifiedHostNameForCallback(String urnCallbackUrl) {
+ def callbackUrlToUse = urnCallbackUrl
+ try{
+ //swap host name with qualified host name from the jboss properties
+ def qualifiedHostName = System.getProperty("jboss.qualified.host.name")
+ if(qualifiedHostName!=null){
+ log("DEBUG", "qualifiedHostName:\n" + qualifiedHostName)
+ callbackUrlToUse = callbackUrlToUse.replaceAll("(http://)(.*)(:28080*)", {orig, first, torepl, last -> "${first}${qualifiedHostName}${last}"})
+ }
+ }catch(Exception e){
+ log("DEBUG", "unable to grab qualified host name, using what's in urn properties for callbackurl. Exception was: " + e.printStackTrace())
+ }
+ return callbackUrlToUse
+
+ }
+
+ /**
+ * Retrieves text context of the element if the element exists, returns empty string otherwise
+ * @param com.sun.org.apache.xerces.internal.dom.DeferredElementNSImpl element to parse
+ * param String tagName tagName
+ * @return String text content of the element
+ */
+ public String getElementText(Element element, String tagName) {
+ String text = ""
+ org.w3c.dom.NodeList nodeList = element.getElementsByTagNameNS("*", tagName)
+ if (nodeList != null && nodeList.length > 0) {
+ text = nodeList.item(0).getTextContent()
+ }
+ return text
+ }
+
+ /**
+ *
+ * Find the lowest unused module-index value in a given xml
+ */
+ public String getLowestUnusedIndex(String xml) {
+ if (xml == null || xml.isEmpty()) {
+ return "0"
+ }
+ def moduleIndexList = getMultNodes(xml, "module-index")
+ if (moduleIndexList == null || moduleIndexList.size() == 0) {
+ return "0"
+ }
+ def sortedModuleIndexList = moduleIndexList.sort { a, b -> a.compareTo b }
+
+ for (i in 0..sortedModuleIndexList.size()-1) {
+ if (Integer.parseInt(sortedModuleIndexList[i]) != i) {
+ return i.toString()
+ }
+ }
+ return sortedModuleIndexList.size().toString()
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/NetworkUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/NetworkUtils.groovy
index c9e243dd54..3ff2863d54 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/NetworkUtils.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/NetworkUtils.groovy
@@ -1,1445 +1,1491 @@
-/*-
- * ============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.common.scripts;
-
-import org.apache.commons.lang3.*
-
-import groovy.xml.XmlUtil
-
-import javax.xml.parsers.DocumentBuilder
-import javax.xml.parsers.DocumentBuilderFactory
-import javax.xml.transform.Transformer
-import javax.xml.transform.TransformerFactory
-import javax.xml.transform.TransformerException
-import javax.xml.transform.dom.DOMSource
-import javax.xml.transform.stream.StreamResult
-
-import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.runtime.Execution
-import org.w3c.dom.Document
-import org.w3c.dom.Element
-
-import org.w3c.dom.NamedNodeMap
-import org.w3c.dom.Node
-import org.w3c.dom.NodeList;
-import org.xml.sax.InputSource
-
-import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.runtime.Execution
-import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor;
-import org.w3c.dom.Document
-import org.w3c.dom.Element
-import org.w3c.dom.NamedNodeMap
-import org.w3c.dom.Node
-import org.w3c.dom.NodeList;
-import org.xml.sax.InputSource
-
-
-/**
- * This groovy class supports the any Network processes that need the methods defined here.
- */
-class NetworkUtils {
-
- public MsoUtils utils = new MsoUtils()
- private AbstractServiceTaskProcessor taskProcessor
-
- public NetworkUtils(AbstractServiceTaskProcessor taskProcessor) {
- this.taskProcessor = taskProcessor
- }
-
- /**
- * This method returns the string for Network request
- * V2 for Contrail 3.x will populate cloud-region data in same cloudSiteId filed
- * Network adapter will handle it properly
- * @param requestId either 'request-id' or 'openecomp-mso-request-id'
- * @param requestInput the request in the process
- * @param queryIdResponse the response of REST AAI query by Id
- * @param routeCollection the collection
- * @param policyFqdns the policy
- * @param tableCollection the collection
- * @param cloudRegionId the cloud-region-region
- * @return String request
- */
- def CreateNetworkRequestV2(execution, requestId, messageId, requestInput, queryIdResponse, routeCollection, policyFqdns, tableCollection, cloudRegionId, backoutOnFailure, source) {
- String createNetworkRequest = null
- if(requestInput!=null && queryIdResponse!=null) {
- String serviceInstanceId = ""
- String sharedValue = ""
- String externalValue = ""
-
- if (source == "VID") {
- sharedValue = utils.getNodeText1(queryIdResponse, "is-shared-network") != null ? utils.getNodeText1(queryIdResponse, "is-shared-network") : "false"
- externalValue = utils.getNodeText1(queryIdResponse, "is-external-network") != null ? utils.getNodeText1(queryIdResponse, "is-external-network") : "false"
- serviceInstanceId = utils.getNodeText1(requestInput, "service-instance-id")
-
- } else { // source = 'PORTAL'
- sharedValue = getParameterValue(requestInput, "shared")
- externalValue = getParameterValue(requestInput, "external")
- serviceInstanceId = utils.getNodeText1(requestInput, "service-instance-id") != null ? utils.getNodeText1(requestInput, "service-instance-id") : ""
- }
-
- String networkParams = ""
- if (utils.nodeExists(requestInput, "network-params")) {
- String netParams = utils.getNodeXml(requestInput, "network-params", false).replace("tag0:","").replace(":tag0","")
- networkParams = buildParams(netParams)
- }
-
- String failIfExists = "false"
- // requestInput
- String cloudRegion = cloudRegionId
- String tenantId = utils.getNodeText1(requestInput, "tenant-id")
- String networkType = ""
- if (utils.nodeExists(requestInput, "networkModelInfo")) {
- String networkModelInfo = utils.getNodeXml(requestInput, "networkModelInfo", false).replace("tag0:","").replace(":tag0","")
- networkType = utils.getNodeText1(networkModelInfo, "modelName")
- } else {
- networkType = utils.getNodeText1(queryIdResponse, "network-type")
- }
-
- // queryIdResponse
- String networkName = utils.getNodeText1(queryIdResponse, "network-name")
- String networkId = utils.getNodeText1(queryIdResponse, "network-id")
- String networkTechnology = utils.getNodeText1(queryIdResponse, "network-technology")
-
- // contrailNetwork - networkTechnology = 'Contrail' vs. 'AIC_SR_IOV')
- String contrailNetwork = ""
- if (networkTechnology.contains('Contrail') || networkTechnology.contains('contrail') || networkTechnology.contains('CONTRAIL')) {
- contrailNetwork = """<contrailNetwork>
- <shared>${sharedValue}</shared>
- <external>${externalValue}</external>
- ${routeCollection}
- ${policyFqdns}
- ${tableCollection}
- </contrailNetwork>"""
- networkTechnology = "CONTRAIL" // replace
- }
-
- // rebuild subnets
- String subnets = ""
- if (utils.nodeExists(queryIdResponse, "subnets")) {
- def subnetsGroup = utils.getNodeXml(queryIdResponse, "subnets", false)
- subnets = buildSubnets(subnetsGroup)
- }
-
- String physicalNetworkName = ""
- physicalNetworkName = utils.getNodeText1(queryIdResponse, "physical-network-name")
-
- String vlansCollection = buildVlans(queryIdResponse)
-
- String notificationUrl = "" //TODO - is this coming from URN? What variable/value to use?
- //String notificationUrl = execution.getVariable("URN_?????") //TODO - is this coming from URN? What variable/value to use?
-
- createNetworkRequest = """
- <createNetworkRequest>
- <cloudSiteId>${cloudRegion}</cloudSiteId>
- <tenantId>${tenantId}</tenantId>
- <networkId>${networkId}</networkId>
- <networkName>${networkName}</networkName>
- <networkType>${networkType}</networkType>
- <networkTechnology>${networkTechnology}</networkTechnology>
- <providerVlanNetwork>
- <physicalNetworkName>${physicalNetworkName}</physicalNetworkName >
- ${vlansCollection}
- </providerVlanNetwork>
- ${contrailNetwork}
- ${subnets}
- <skipAAI>true</skipAAI>
- <backout>${backoutOnFailure}</backout>
- <failIfExists>${failIfExists}</failIfExists>
- ${networkParams}
- <msoRequest>
- <requestId>${requestId}</requestId>
- <serviceInstanceId>${serviceInstanceId}</serviceInstanceId>
- </msoRequest>
- <messageId>${messageId}</messageId>
- <notificationUrl>${notificationUrl}</notificationUrl>
- </createNetworkRequest>
- """.trim()
- }
- return createNetworkRequest
-
- }
-
- /**
- * This method returns the string for Network request
- * V2 for Contrail 3.x will populate cloud-region data in same cloudSiteId filed
- * Network adapter will handle it properly
- * @param requestId either 'request-id' or 'openecomp-mso-request-id'
- * @param requestInput the request in the process
- * @param queryIdResponse the response of REST AAI query by Id
- * @param routeCollection the collection
- * @param policyFqdns the policy
- * @param cloudRegionId the cloud-region-region
- * @return String request
- */
- def UpdateNetworkRequestV2(execution, requestId, messageId, requestInput, queryIdResponse, routeCollection, policyFqdns, tableCollection, cloudRegionId, backoutOnFailure, source) {
- String updateNetworkRequest = null
- if(requestInput!=null && queryIdResponse!=null) {
- String serviceInstanceId = ""
- String sharedValue = ""
- String externalValue = ""
-
- if (source == "VID") {
- sharedValue = utils.getNodeText1(queryIdResponse, "is-shared-network") != null ? utils.getNodeText1(queryIdResponse, "is-shared-network") : "false"
- externalValue = utils.getNodeText1(queryIdResponse, "is-external-network") != null ? utils.getNodeText1(queryIdResponse, "is-external-network") : "false"
- serviceInstanceId = utils.getNodeText1(requestInput, "service-instance-id")
-
- } else { // source = 'PORTAL'
- sharedValue = getParameterValue(requestInput, "shared")
- externalValue = getParameterValue(requestInput, "external")
- serviceInstanceId = utils.getNodeText1(requestInput, "service-instance-id") != null ? utils.getNodeText1(requestInput, "service-instance-id") : ""
- }
-
- String failIfExists = "false"
- // requestInput
- String cloudRegion = cloudRegionId
- String tenantId = utils.getNodeText1(requestInput, "tenant-id")
-
- // queryIdResponse
- String networkName = utils.getNodeText1(queryIdResponse, "network-name")
- String networkId = utils.getNodeText1(queryIdResponse, "network-id")
- String networkType = utils.getNodeText1(queryIdResponse, "network-type")
-
- // rebuild subnets
- String subnets = ""
- if (utils.nodeExists(queryIdResponse, "subnets")) {
- def subnetsGroup = utils.getNodeXml(queryIdResponse, "subnets", false)
- subnets = buildSubnets(subnetsGroup)
- }
-
- String networkParams = ""
- if (utils.nodeExists(requestInput, "network-params")) {
- String netParams = utils.getNodeXml(requestInput, "network-params", false).replace("tag0:","").replace(":tag0","")
- networkParams = buildParams(netParams)
- }
-
- String networkStackId = utils.getNodeText1(queryIdResponse, "heat-stack-id")
- if (networkStackId == 'null' || networkStackId == "" || networkStackId == null) {
- networkStackId = "force_update"
- }
-
- String physicalNetworkName = utils.getNodeText1(queryIdResponse, "physical-network-name")
- String vlansCollection = buildVlans(queryIdResponse)
-
- updateNetworkRequest =
- """<updateNetworkRequest>
- <cloudSiteId>${cloudRegion}</cloudSiteId>
- <tenantId>${tenantId}</tenantId>
- <networkId>${networkId}</networkId>
- <networkStackId>${networkStackId}</networkStackId>
- <networkName>${networkName}</networkName>
- <networkType>${networkType}</networkType>
- <networkTypeVersion/>
- <networkTechnology>CONTRAIL</networkTechnology>
- <providerVlanNetwork>
- <physicalNetworkName>${physicalNetworkName}</physicalNetworkName>
- ${vlansCollection}
- </providerVlanNetwork>
- <contrailNetwork>
- <shared>${sharedValue}</shared>
- <external>${externalValue}</external>
- ${routeCollection}
- ${policyFqdns}
- ${tableCollection}
- </contrailNetwork>
- ${subnets}
- <skipAAI>true</skipAAI>
- <backout>${backoutOnFailure}</backout>
- <failIfExists>${failIfExists}</failIfExists>
- ${networkParams}
-
- <msoRequest>
- <requestId>${requestId}</requestId>
- <serviceInstanceId>${serviceInstanceId}</serviceInstanceId>
- </msoRequest>
- <messageId>${messageId}</messageId>
- <notificationUrl></notificationUrl>
- </updateNetworkRequest>""".trim()
-
- }
- return updateNetworkRequest
-
- }
-
- /**
- * This method returns the string for Create Volume Request payload
- * @param groupId the volume-group-id
- * @param volumeName the volume-group-name
- * @param vnfType the vnf-type
- * @param tenantId the value of relationship-key 'tenant.tenant-id'
- * @return String request payload
- */
- def String CreateNetworkVolumeRequest(groupId, volumeName, vnfType, tenantId) {
-
- String requestPayload =
- """<volume-group xmlns="http://org.openecomp.mso/v6">
- <volume-group-id>${groupId}</volume-group-id>
- <volume-group-name>${volumeName}</volume-group-name>
- <heat-stack-id></heat-stack-id>
- <vnf-type>${vnfType}</vnf-type>
- <orchestration-status>Pending</orchestration-status>
- <relationship-list>
- <relationship>
- <related-to>tenant</related-to>
- <relationship-data>
- <relationship-key>tenant.tenant-id</relationship-key>
- <relationship-value>${tenantId}</relationship-value>
- </relationship-data>
- </relationship>
- </relationship-list>
- </volume-group>"""
-
- return requestPayload
- }
-
- def String createCloudRegionVolumeRequest(groupId, volumeName, vnfType, tenantId, cloudRegion, namespace, modelCustomizationId) {
-
- String requestPayload =
- """<volume-group xmlns="${namespace}">
- <volume-group-id>${groupId}</volume-group-id>
- <volume-group-name>${volumeName}</volume-group-name>
- <heat-stack-id></heat-stack-id>
- <vnf-type>${vnfType}</vnf-type>
- <orchestration-status>Pending</orchestration-status>
- <vf-module-persona-model-customization-id>${modelCustomizationId}</vf-module-persona-model-customization-id>
- <relationship-list>
- <relationship>
- <related-to>tenant</related-to>
- <relationship-data>
- <relationship-key>tenant.tenant-id</relationship-key>
- <relationship-value>${tenantId}</relationship-value>
- </relationship-data>
- <relationship-data>
- <relationship-key>cloud-region.cloud-owner</relationship-key>
- <relationship-value>openecomp-aic</relationship-value>
- </relationship-data>
- <relationship-data>
- <relationship-key>cloud-region.cloud-region-id</relationship-key>
- <relationship-value>${cloudRegion}</relationship-value>
- </relationship-data>
- </relationship>
- </relationship-list>
- </volume-group>"""
-
- return requestPayload
- }
-
- def String createCloudRegionVolumeRequest(groupId, volumeName, vnfType, vnfId, tenantId, cloudRegion, namespace, modelCustomizationId) {
-
- String requestPayload =
- """<volume-group xmlns="${namespace}">
- <volume-group-id>${groupId}</volume-group-id>
- <volume-group-name>${volumeName}</volume-group-name>
- <heat-stack-id></heat-stack-id>
- <vnf-type>${vnfType}</vnf-type>
- <orchestration-status>Pending</orchestration-status>
- <vf-module-persona-model-customization-id>${modelCustomizationId}</vf-module-persona-model-customization-id>
- <relationship-list>
- <relationship>
- <related-to>generic-vnf</related-to>
- <relationship-data>
- <relationship-key>generic-vnf.vnf-id</relationship-key>
- <relationship-value>${vnfId}</relationship-value>
- </relationship-data>
- </relationship>
- <relationship>
- <related-to>tenant</related-to>
- <relationship-data>
- <relationship-key>tenant.tenant-id</relationship-key>
- <relationship-value>${tenantId}</relationship-value>
- </relationship-data>
- <relationship-data>
- <relationship-key>cloud-region.cloud-owner</relationship-key>
- <relationship-value>openecomp-aic</relationship-value>
- </relationship-data>
- <relationship-data>
- <relationship-key>cloud-region.cloud-region-id</relationship-key>
- <relationship-value>${cloudRegion}</relationship-value>
- </relationship-data>
- </relationship>
- </relationship-list>
- </volume-group>"""
-
- return requestPayload
- }
-
-
- /**
- * This method returns the string for Update Volume Request payload
- * @param requeryAAIVolGrpNameResponse the response of query volume group name (in AAI)
- * @param heatStackId the value of heat stack id
- * @return String request payload
- */
- def String updateCloudRegionVolumeRequest(requeryAAIVolGrpNameResponse, heatStackId, namespace, modelCustomizationId) {
- String requestPayload = ""
- if (requeryAAIVolGrpNameResponse != null) {
- def groupId = utils.getNodeText(requeryAAIVolGrpNameResponse, "volume-group-id")
- def volumeName = utils.getNodeText(requeryAAIVolGrpNameResponse, "volume-group-name")
- def vnfType = utils.getNodeText(requeryAAIVolGrpNameResponse, "vnf-type")
- def resourceVersion = utils.getNodeText(requeryAAIVolGrpNameResponse, "resource-version")
- def relationshipList = ""
- if (utils.nodeExists(requeryAAIVolGrpNameResponse, "relationship")) {
- relationshipList = rebuildRelationship(requeryAAIVolGrpNameResponse)
- }
-
- requestPayload =
- """<volume-group xmlns="${namespace}">
- <volume-group-id>${groupId}</volume-group-id>
- <volume-group-name>${volumeName}</volume-group-name>
- <heat-stack-id>${heatStackId}</heat-stack-id>
- <vnf-type>${vnfType}</vnf-type>
- <orchestration-status>Active</orchestration-status>
- <resource-version>${resourceVersion}</resource-version>
- <vf-module-persona-model-customization-id>${modelCustomizationId}</vf-module-persona-model-customization-id>
- ${relationshipList}
- </volume-group>"""
- }
-
- return requestPayload
- }
-
-
- /**
- * This method returns the string for Update Volume Request payload
- * @param requeryAAIVolGrpNameResponse the response of query volume group name (in AAI)
- * @param heatStackId the value of heat stack id
- * @return String request payload
- */
- def String UpdateNetworkVolumeRequest(requeryAAIVolGrpNameResponse, heatStackId) {
- String requestPayload = ""
- if (requeryAAIVolGrpNameResponse != null) {
- def groupId = utils.getNodeText(requeryAAIVolGrpNameResponse, "volume-group-id")
- def volumeName = utils.getNodeText(requeryAAIVolGrpNameResponse, "volume-group-name")
- def vnfType = utils.getNodeText(requeryAAIVolGrpNameResponse, "vnf-type")
- def resourceVersion = utils.getNodeText(requeryAAIVolGrpNameResponse, "resource-version")
- def relationshipList = ""
- if (utils.nodeExists(requeryAAIVolGrpNameResponse, "relationship")) {
- relationshipList = rebuildRelationship(requeryAAIVolGrpNameResponse)
- }
-
- requestPayload =
- """<volume-group xmlns="http://org.openecomp.mso/v6">
- <volume-group-id>${groupId}</volume-group-id>
- <volume-group-name>${volumeName}</volume-group-name>
- <heat-stack-id>${heatStackId}</heat-stack-id>
- <vnf-type>${vnfType}</vnf-type>
- <orchestration-status>Active</orchestration-status>
- <resource-version>${resourceVersion}</resource-version>
- ${relationshipList}
- </volume-group>"""
- }
-
- return requestPayload
- }
-
- /**
- * This method returns the string for Create Contrail Network payload
- * @param requeryIdAAIResponse the response from AAI query by id
- * @param createNetworkResponse the response of create network
- * @return String contrailNetworkCreatedUpdate
- */
- def ContrailNetworkCreatedUpdate(requeryIdAAIResponse, createNetworkResponse, schemaVersion) {
-
- String contrailNetworkCreatedUpdate = ""
- if(requeryIdAAIResponse!=null && createNetworkResponse!=null) {
-
- def l3Network = utils.getNodeXml(requeryIdAAIResponse, "l3-network", false).replace("tag0:","").replace(":tag0","")
- def createNetworkContrailResponse = ""
- if (utils.nodeExists(createNetworkResponse, 'createNetworkResponse')) {
- createNetworkContrailResponse = utils.getNodeXml(createNetworkResponse, "createNetworkResponse", false).replace("tag0:","").replace(":tag0","")
- } else {
- createNetworkContrailResponse = utils.getNodeXml(createNetworkResponse, "updateNetworkContrailResponse", false).replace("tag0:","").replace(":tag0","")
- }
-
- // rebuild network
- def networkList = ["network-id", "network-name", "network-type", "network-role", "network-technology", "neutron-network-id", "is-bound-to-vpn", "service-id", "network-role-instance", "resource-version", "resource-model-uuid", "orchestration-status", "heat-stack-id", "mso-catalog-key", "contrail-network-fqdn",
- "physical-network-name", "is-provider-network", "is-shared-network", "is-external-network"]
- String rebuildNetworkElements = buildNetworkElements(l3Network, createNetworkContrailResponse, networkList)
-
- // rebuild 'subnets'
- def rebuildSubnetList = ""
- if (utils.nodeExists(requeryIdAAIResponse, 'subnet')) {
- rebuildSubnetList = buildSubnets(requeryIdAAIResponse, createNetworkResponse)
- }
-
- // rebuild 'segmentation-assignments'
- def rebuildSegmentationAssignments = ""
- if (utils.nodeExists(requeryIdAAIResponse, 'segmentation-assignments')) {
- List elementList = ["segmentation-id"]
- rebuildSegmentationAssignments = buildXMLElements(requeryIdAAIResponse, "", "segmentation-assignments", elementList)
- }
-
- // rebuild 'ctag-assignments' / rebuildCtagAssignments
- def rebuildCtagAssignmentsList = ""
- if (utils.nodeExists(requeryIdAAIResponse, 'ctag-assignment')) {
- rebuildCtagAssignmentsList = rebuildCtagAssignments(requeryIdAAIResponse)
- }
-
- // rebuild 'relationship'
- def relationshipList = ""
- if (utils.nodeExists(requeryIdAAIResponse, 'relationship-list')) {
- String rootRelationshipData = getFirstNodeXml(requeryIdAAIResponse, "relationship-list").drop(38).trim().replace("tag0:","").replace(":tag0","")
- if (utils.nodeExists(rootRelationshipData, 'relationship')) {
- relationshipList = rebuildRelationship(rootRelationshipData)
- }
- }
-
- //Check for optional contrail network fqdn within CreateNetworkResponse
- String contrailNetworkFQDN
- if(utils.nodeExists(createNetworkResponse, "contrail-network-fqdn")){
- contrailNetworkFQDN = utils.getNodeXml(createNetworkResponse, "contrail-network-fqdn")
- contrailNetworkFQDN = utils.removeXmlNamespaces(contrailNetworkFQDN)
- contrailNetworkFQDN = utils.removeXmlPreamble(contrailNetworkFQDN)
- }else{
- contrailNetworkFQDN = ""
- }
-
- contrailNetworkCreatedUpdate =
- """<l3-network xmlns="${schemaVersion}">
- ${rebuildNetworkElements}
- ${rebuildSubnetList}
- ${rebuildSegmentationAssignments}
- ${rebuildCtagAssignmentsList}
- ${relationshipList}
- ${contrailNetworkFQDN}
- </l3-network>""".trim()
-
- }
- return contrailNetworkCreatedUpdate
- }
-
-
-
- /**
- * This method returns the value for the name paramName.
- * Ex: <network-params>
- * <param name="shared">1</param>
- * <param name="external">0</external>
- * </network-params>
- *
- * @param xmlInput the XML document
- * @param paramName the param name (ex: 'shared')
- * @return a param value for 'shared' (ex: '1')
- */
- def getParameterValue(xmlInput, paramName) {
- def rtn=""
- if(xmlInput!=null){
- def xml= new XmlSlurper().parseText(xmlInput)
- rtn= xml.'**'.find {param->param.'@name'.text() == paramName}
- }
- if (rtn==null) {
- return ""
- } else {
- return rtn
- }
- }
-
- /**
- * This method returns the name of param if found/match with paramName.
- * Ex: <network-params>
- * <param name="shared">1</param>
- * <param name="external">0</external>
- * </network-params>
- *
- * @param xmlInput the XML document
- * @param paramName the param name (ex: 'shared', )
- * @return a param name for 'shared' (ex: 'shared' if found)
- */
- def getParameterName(xmlInput, paramName) {
- def rtn=""
- if(xmlInput!=null){
- def xml= new XmlSlurper().parseText(xmlInput)
- try {
- rtn= xml.'**'.find {param->param.'@name' == paramName}.'@name'
- } catch (Exception ex) {
- rtn=""
- }
- }
- if (rtn==null || rtn=="") {
- return ""
- } else {
- return rtn
- }
- }
-
- /**
- * This method returns the networkParams xml string.
- * Ex: input:
- * <network-params>
- * <param name="shared">1</param>
- * <param name="external">0</external>
- * </network-params>
- *
- * Sample result:
- * <networkParams>
- * <shared>1</shared>
- * <external>0</external>
- * </networkParams>
- *
- */
-
- def buildParams(networkParams) {
- def build = ""
- def netParams = new XmlParser().parseText(networkParams)
- try {
- def paramsList = netParams.'**'.findAll {param->param.'@name'}.'@name'
- if (paramsList.size() > 0) {
- build += "<networkParams>"
- for (i in 0..paramsList.size()-1) {
- def name = netParams.'**'.find {param->param.'@name' == paramsList[i]}.'@name'
- def value= netParams.'**'.find {param->param.'@name' == paramsList[i]}.text()
- build += "<${name}>${value}</${name}>"
- }
- build += "</networkParams>"
- }
-
- } catch (Exception ex) {
- println ' buildParams error - ' + ex.getMessage()
- build = ""
- }
- return build
- }
-
- def getVlans(xmlInput) {
- def rtn = ""
- if (xmlInput!=null) {
- def vlansList = getListWithElements(xmlInput, 'vlans')
- def vlansListSize = vlansList.size()
- if (vlansListSize > 0) {
- for (i in 0..vlansListSize-1) {
- rtn += '<vlans>'+vlansList[i]+'</vlans>'
- }
- }
- }
- return rtn
-
-
- }
-
- /**
- * This method returns the uri value for the vpn bindings.
- * Return the a list of value of vpn binding in the <related-link> string.
- * Ex.
- * <relationship-list>
- * <relationship>
- * <related-to>vpn-binding</related-to>
- * <related-link>https://aai-app-e2e.test.openecomp.com:8443/aai/v6/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/</related-link>
- * <relationship-data>
- * <relationship-key>vpn-binding.vpn-id</relationship-key>
- * <relationship-value>85f015d0-2e32-4c30-96d2-87a1a27f8017</relationship-value>
- * </relationship-data>
- * </relationship>
- * <relationship>
- * <related-to>vpn-binding</related-to>
- * <related-link>https://aai-ext1.test.openecomp.com:8443/aai/v6/network/vpn-bindings/vpn-binding/24a4b507-853a-4a38-99aa-05fcc54be24d/</related-link>
- * <relationship-data>
- * <relationship-key>vpn-binding.vpn-id</relationship-key>
- * <relationship-value>24a4b507-853a-4a38-99aa-05fcc54be24d</relationship-value>
- * </relationship-data>
- * <related-to-property>
- * <property-key>vpn-binding.vpn-name</property-key>
- * <property-value>oam_protected_net_6_MTN5_msotest1</property-value>
- * </related-to-property>
- * </relationship>
- * @param xmlInput the XML document
- * @return a list of vpn binding values
- * ex: ['aai/v6/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/', 'aai/v6/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/']
- *
- **/
- def getVnfBindingObject(xmlInput) {
- //def rtn = null
- List rtn = []
- if (xmlInput!=null) {
- def relationshipList = getListWithElements(xmlInput, 'relationship')
- def relationshipListSize = relationshipList.size()
- if (relationshipListSize > 0) {
- for (i in 0..relationshipListSize-1) {
- def relationshipXml = XmlUtil.serialize(relationshipList[i])
- if (utils.getNodeText(relationshipXml, 'related-to') == "vpn-binding") {
- def relatedLink = utils.getNodeText(relationshipXml, 'related-link')
- if (relatedLink != null || relatedLink != "") {
- rtn.add(relatedLink.substring(relatedLink.indexOf("/aai/"), relatedLink.length()))
- }
- }
- }
- }
- }
- return rtn
- }
- /**
- * similar to VNF bindings method
- * @param xmlInput the XML document
- * @return a list of network policy values
- * ex: ['aai/v$/network/network-policies/network-policy/cee6d136-e378-4678-a024-2cd15f0ee0cg', 'aai/v$/network/network-policies/network-policy/cee6d136-e378-4678-a024-2cd15f0ee0cg']
- *
- **/
- def getNetworkPolicyObject(xmlInput) {
- //def rtn = null
- List rtn = []
- if (xmlInput!=null) {
- def relationshipList = getListWithElements(xmlInput, 'relationship')
- def relationshipListSize = relationshipList.size()
- if (relationshipListSize > 0) {
- for (i in 0..relationshipListSize-1) {
- def relationshipXml = XmlUtil.serialize(relationshipList[i])
- if (utils.getNodeText(relationshipXml, 'related-to') == "network-policy") {
- def relatedLink = utils.getNodeText(relationshipXml, 'related-link')
- if (relatedLink != null || relatedLink != "") {
- rtn.add(relatedLink.substring(relatedLink.indexOf("/aai/"), relatedLink.length()))
- }
- }
- }
- }
- }
- return rtn
- }
-
- /**
- * similar to network policymethod
- * @param xmlInput the XML document
- * @return a list of network policy values
- * ex: ['aai/v$/network/route-table-references/route-table-reference/refFQDN1', 'aai/v$/network/route-table-references/route-table-reference/refFQDN2']
- *
- **/
- def getNetworkTableRefObject(xmlInput) {
- //def rtn = null
- List rtn = []
- if (xmlInput!=null) {
- def relationshipList = getListWithElements(xmlInput, 'relationship')
- def relationshipListSize = relationshipList.size()
- if (relationshipListSize > 0) {
- for (i in 0..relationshipListSize-1) {
- def relationshipXml = XmlUtil.serialize(relationshipList[i])
- if (utils.getNodeText(relationshipXml, 'related-to') == "route-table-reference") {
- def relatedLink = utils.getNodeText1(relationshipXml, 'related-link')
- if (relatedLink != null || relatedLink != "") {
- rtn.add(relatedLink.substring(relatedLink.indexOf("/aai/"), relatedLink.length()))
- }
- }
- }
- }
- }
- return rtn
- }
-
- /**
- * similar to network policymethod
- * @param xmlInput the XML document
- * @return a list of IDs for related VNF instances
- *
- **/
- def getRelatedVnfIdList(xmlInput) {
- //def rtn = null
- List rtn = []
- if (xmlInput!=null) {
- def relationshipList = getListWithElements(xmlInput, 'relationship')
- def relationshipListSize = relationshipList.size()
- if (relationshipListSize > 0) {
- for (i in 0..relationshipListSize-1) {
- def relationshipXml = XmlUtil.serialize(relationshipList[i])
- if (utils.getNodeText(relationshipXml, 'related-to') == "generic-vnf") {
- def relatedLink = utils.getNodeText1(relationshipXml, 'related-link')
- if (relatedLink != null || relatedLink != "") {
- rtn.add(relatedLink.substring(relatedLink.indexOf("/generic-vnf/")+13, relatedLink.length()))
- }
- }
- }
- }
- }
- return rtn
- }
-
- /**
- * similar to network policymethod
- * @param xmlInput the XML document
- * @return a list of IDs for related Network instances
- *
- **/
- def getRelatedNetworkIdList(xmlInput) {
- //def rtn = null
- List rtn = []
- if (xmlInput!=null) {
- def relationshipList = getListWithElements(xmlInput, 'relationship')
- def relationshipListSize = relationshipList.size()
- if (relationshipListSize > 0) {
- for (i in 0..relationshipListSize-1) {
- def relationshipXml = XmlUtil.serialize(relationshipList[i])
- if (utils.getNodeText(relationshipXml, 'related-to') == "l3-network") {
- def relatedLink = utils.getNodeText1(relationshipXml, 'related-link')
- if (relatedLink != null || relatedLink != "") {
- rtn.add(relatedLink.substring(relatedLink.indexOf("/l3-network/")+12, relatedLink.length()))
- }
- }
- }
- }
- }
- return rtn
- }
-
- def isVfRelationshipExist(xmlInput) {
- Boolean rtn = false
- if (xmlInput!=null) {
- def relationshipList = getListWithElements(xmlInput, 'relationship')
- def relationshipListSize = relationshipList.size()
- if (relationshipListSize > 0) {
- for (i in 0..relationshipListSize-1) {
- def relationshipXml = XmlUtil.serialize(relationshipList[i])
- if (utils.getNodeText(relationshipXml, 'related-to') == "vf-module") {
- rtn = true
- }
- }
- }
- }
- return rtn
-
- }
-
- def getCloudRegion(xmlInput) {
- String lcpCloudRegion = ""
- if (xmlInput!=null) {
- def relationshipList = getListWithElements(xmlInput, 'relationship')
- def relationshipListSize = relationshipList.size()
- if (relationshipListSize > 0) {
- for (i in 0..relationshipListSize-1) {
- def relationshipXml = XmlUtil.serialize(relationshipList[i])
- if (utils.getNodeText(relationshipXml, 'related-to') == "cloud-region") {
- def relatedLink = utils.getNodeText1(relationshipXml, 'related-link')
- if (relatedLink != null || relatedLink != "") {
- lcpCloudRegion = relatedLink.substring(relatedLink.indexOf("/openecomp-aic/")+9, relatedLink.length())
- if (lcpCloudRegion.contains('/')) {
- lcpCloudRegion = relatedLink.substring(relatedLink.indexOf("/openecomp-aic/")+9, relatedLink.length()-1)
- }
- }
- }
- }
- }
- }
- return lcpCloudRegion
- }
-
- def getTenantId(xmlInput) {
- String tenantId = ""
- if (xmlInput!=null) {
- def relationshipList = getListWithElements(xmlInput, 'relationship')
- def relationshipListSize = relationshipList.size()
- if (relationshipListSize > 0) {
- for (i in 0..relationshipListSize-1) {
- def relationshipXml = XmlUtil.serialize(relationshipList[i])
- if (utils.getNodeText(relationshipXml, 'related-to') == "tenant") {
- def relatedLink = utils.getNodeText1(relationshipXml, 'related-link')
- if (relatedLink != null || relatedLink != "") {
- tenantId = relatedLink.substring(relatedLink.indexOf("/tenant/")+8, relatedLink.length())
- if (tenantId.contains('/')) {
- tenantId = relatedLink.substring(relatedLink.indexOf("/tenant/")+8, relatedLink.length()-1)
- }
- }
- }
- }
- }
- }
- return tenantId
- }
-
- def isInstanceValueMatch(linkResource, globalSubscriberId, serviceType) {
- Boolean rtn = false
- try {
- String globalSubscriberIdLink = linkResource.substring(linkResource.indexOf("/customer/")+10, linkResource.indexOf("/service-subscriptions"))
- String serviceTypeLink = linkResource.substring(linkResource.indexOf("/service-subscription/")+22, linkResource.indexOf("/service-instances"))
- if (globalSubscriberIdLink == globalSubscriberId) {
- rtn = true
- } else {
- if (serviceTypeLink == serviceType) {
- rtn = true
- }
- }
-
- } catch (Exception ex) {
- println 'Exception - ' + ex.getMessage()
- return false
- }
- return rtn
- }
-
- def getListWithElements(xmlInput, groupName) {
- def rtn = ""
- if (xmlInput != null) {
- def relationshipData = new XmlSlurper().parseText(xmlInput)
- rtn = relationshipData.'**'.findAll {it.name() == groupName}
- }
- return rtn
-
- }
-
- // build network single elements
- def buildNetworkElements(l3Network, createNetworkContrailResponse, networkList) {
- def replaceNetworkId = ""
- def replaceNeutronNetworkId = ""
- def replaceContrailNetworkFqdn = ""
- if (l3Network != null && createNetworkContrailResponse != null) {
- if (utils.nodeExists(l3Network, 'heat-stack-id')) {
- replaceNetworkId = utils.getNodeText(l3Network, 'heat-stack-id')
- } else {
- if (utils.nodeExists(createNetworkContrailResponse, 'networkStackId')) {
- replaceNetworkId = utils.getNodeText(createNetworkContrailResponse, 'networkStackId')
- }
- }
- if (utils.nodeExists(l3Network, 'neutron-network-id')) {
- replaceNeutronNetworkId = utils.getNodeText(l3Network, 'neutron-network-id')
- } else {
- if (utils.nodeExists(createNetworkContrailResponse, 'neutronNetworkId')) {
- replaceNeutronNetworkId = utils.getNodeText(createNetworkContrailResponse, 'neutronNetworkId')
- }
- }
- if (utils.nodeExists(l3Network, 'contrail-network-fqdn')) {
- replaceContrailNetworkFqdn = utils.getNodeText(l3Network, 'contrail-network-fqdn')
- } else {
- if (utils.nodeExists(createNetworkContrailResponse, 'networkFqdn')) {
- replaceContrailNetworkFqdn = utils.getNodeText(createNetworkContrailResponse, 'networkFqdn')
- }
- }
- }
-
- String var = ""
- def xmlNetwork = ""
- if (l3Network != null) {
- for (element in networkList) {
- def xml= new XmlSlurper().parseText(l3Network)
- var = xml.'**'.find {it.name() == element}
- if (var == null) {
- if (element=="orchestration-status") {
- xmlNetwork += "<"+element+">"+"active"+"</"+element+">"
- }
- if (element=="heat-stack-id") {
- if (replaceNetworkId != "") {
- xmlNetwork += "<"+element+">"+replaceNetworkId+"</"+element+">"
- }
- }
- if (element=="neutron-network-id") {
- if (replaceNeutronNetworkId != "") {
- xmlNetwork += "<"+element+">"+replaceNeutronNetworkId+"</"+element+">"
- }
- }
- if (element=="contrail-network-fqdn") {
- if (replaceContrailNetworkFqdn != "") {
- xmlNetwork += "<"+element+">"+replaceContrailNetworkFqdn+"</"+element+">"
- }
- }
-
- } else {
- if (element=="orchestration-status") {
- xmlNetwork += "<"+element+">"+"active"+"</"+element+">"
- } else {
- xmlNetwork += "<"+element+">"+var.toString()+"</"+element+">"
- }
- }
-
- }
- }
- return xmlNetwork
- }
-
- def buildSubnets(requeryIdAAIResponse, createNetworkResponse) {
- def rebuildingSubnets = ""
- if (requeryIdAAIResponse != null && utils.nodeExists(requeryIdAAIResponse, 'subnets')) {
- def subnetIdMapValue = ""
- def subnetsGroup = utils.getNodeXml(requeryIdAAIResponse, "subnets", false)
- def subnetsData = new XmlSlurper().parseText(subnetsGroup)
- rebuildingSubnets += "<subnets>"
- try {
- def subnets = subnetsData.'**'.findAll {it.name() == "subnet"}
- def subnetsSize = subnets.size()
- for (i in 0..subnetsSize-1) {
- def subnet = subnets[i]
- def subnetXml = XmlUtil.serialize(subnet)
- def subnetList = ["subnet-id", "neutron-subnet-id", "gateway-address", "network-start-address", "cidr-mask", "ip-version", "orchestration-status", "dhcp-enabled", "dhcp-start", "dhcp-end", "resource-version", "subnet-name"]
- rebuildingSubnets += buildSubNetworkElements(subnetXml, createNetworkResponse, subnetList, "subnet")
- }
- if (utils.nodeExists(subnetsData, 'relationship')) {
- rebuildingSubnets = rebuildRelationship(requeryIdAAIResponse)
- }
-
- } catch (Exception ex) {
- // error
- } finally {
- rebuildingSubnets += "</subnets>"
- }
- }
- return rebuildingSubnets
- }
-
- def buildSubnets(queryIdResponse) {
- def rebuildingSubnets = ""
- def subnetsData = new XmlSlurper().parseText(queryIdResponse)
- //rebuildingSubnets += "<subnets>"
- try {
- def subnets = subnetsData.'**'.findAll {it.name() == "subnet"}
- def subnetsSize = subnets.size()
- for (i in 0..subnetsSize-1) {
- def subnet = subnets[i]
- def subnetXml = XmlUtil.serialize(subnet)
- def subnetList = ["dhcp-start", "dhcp-end", "network-start-address", "cidr-mask", "dhcp-enabled", "gateway-address", "ip-version", "subnet-id", "subnet-name"]
- rebuildingSubnets += buildSubNetworkElements(subnetXml, subnetList, "subnets")
- //rebuildingSubnets += buildSubNetworkElements(subnetXml, subnetList, "")
- }
- } catch (Exception ex) {
- //
- } finally {
- //rebuildingSubnets += "</subnets>"
- }
- return rebuildingSubnets
- }
-
-
- // build subnet sub-network single elements
- def buildSubNetworkElements(subnetXml, createNetworkResponse, elementList, parentName) {
- String var = ""
- def xmlBuild = ""
- if (parentName != "") {
- xmlBuild += "<"+parentName+">"
- }
- if (subnetXml != null) {
- for (element in elementList) {
- def xml= new XmlSlurper().parseText(subnetXml)
- var = xml.'**'.find {it.name() == element}
- if (var != null) {
- if (element=="orchestration-status") {
- xmlBuild += "<"+element+">"+"active"+"</"+element+">"
- } else { // "subnet-id", "neutron-subnet-id"
- if (element=="subnet-id") {
- if (utils.nodeExists(createNetworkResponse, "subnetMap")) {
- xmlBuild += "<"+element+">"+var.toString()+"</"+element+">"
- String neutronSubnetId = extractNeutSubId(createNetworkResponse, var.toString())
- xmlBuild += "<neutron-subnet-id>"+neutronSubnetId+"</neutron-subnet-id>"
- }
- } else {
- if (element=="neutron-subnet-id") {
- // skip
- } else {
- xmlBuild += "<"+element+">"+var.toString()+"</"+element+">"
- }
- }
- }
- }
- }
-
- }
- if (parentName != "") {
- xmlBuild += "</"+parentName+">"
- }
- return xmlBuild
- }
-
- // build subnet sub-network single elements
- def buildSubNetworkElements(subnetXml, elementList, parentName) {
- def var = ""
- def xmlBuild = ""
- if (parentName != "") {
- xmlBuild += "<"+parentName+">"
- }
- if (subnetXml != null) {
- def networkStartAddress = ""
- for (element in elementList) {
- def xml= new XmlSlurper().parseText(subnetXml)
- var = xml.'**'.find {it.name() == element}
- if (element == "dhcp-start") {
- xmlBuild += "<allocationPools>"
- if (var.toString() == 'null') {
- xmlBuild += "<start>"+""+"</start>"
- } else {
- xmlBuild += "<start>"+var.toString()+"</start>"
- }
- }
- if (element == "dhcp-end") {
- if (var.toString() == 'null') {
- xmlBuild += "<end>"+""+"</end>"
- } else {
- xmlBuild += "<end>"+var.toString()+"</end>"
- }
- xmlBuild += "</allocationPools>"
- }
- if (element == "network-start-address" || element == "cidr-mask") {
- if (element == "network-start-address") {
- networkStartAddress = var.toString()
- }
- if (element == "cidr-mask") {
- xmlBuild += "<cidr>"+networkStartAddress+"/"+var.toString()+"</cidr>"
- }
- }
- if (element == "dhcp-enabled") {
- xmlBuild += "<enableDHCP>"+var.toString()+"</enableDHCP>"
- }
- if (element == "gateway-address") {
- xmlBuild += "<gatewayIp>"+var.toString()+"</gatewayIp>"
- }
- if (element == "ip-version") {
- xmlBuild += "<ipVersion>"+var.toString()+"</ipVersion>"
- }
- if (element == "subnet-id") {
- xmlBuild += "<subnetId>"+var.toString()+"</subnetId>"
- }
- if ((element == "subnet-name") && (var != null)) {
- xmlBuild += "<subnetName>"+var.toString()+"</subnetName>"
- }
- }
- }
- if (parentName != "") {
- xmlBuild += "</"+parentName+">"
- }
- return xmlBuild
- }
-
- // rebuild ctag-assignments
- def rebuildCtagAssignments(xmlInput) {
- def rebuildingCtagAssignments = ""
- if (xmlInput!=null) {
- def ctagAssignmentsData = new XmlSlurper().parseText(xmlInput)
- rebuildingCtagAssignments += "<ctag-assignments>"
- def ctagAssignments = ctagAssignmentsData.'**'.findAll {it.name() == "ctag-assignment"}
- def ctagAssignmentsSize = ctagAssignments.size()
- for (i in 0..ctagAssignmentsSize-1) {
- def ctagAssignment = ctagAssignments[i]
- def ctagAssignmentXml = XmlUtil.serialize(ctagAssignment)
- rebuildingCtagAssignments += "<ctag-assignment>"
- List elementList = ["vlan-id-inner", "resource-version"]
- rebuildingCtagAssignments += buildXMLElements(ctagAssignmentXml, "" , "", elementList)
- if (utils.nodeExists(ctagAssignmentXml, 'relationship')) {
- rebuildingCtagAssignments += rebuildRelationship(ctagAssignmentXml)
- }
- rebuildingCtagAssignments += "</ctag-assignment>"
- }
- rebuildingCtagAssignments += "</ctag-assignments>"
- }
- return rebuildingCtagAssignments
- }
-
- // rebuild 'relationship-list'
- def rebuildRelationship(xmlInput) {
- def rebuildingSubnets = ""
- if (xmlInput!=null) {
- def subnetsData = new XmlSlurper().parseText(xmlInput)
- rebuildingSubnets += "<relationship-list>"
- def relationships = subnetsData.'**'.findAll {it.name() == "relationship"}
- def relationshipsSize = relationships.size()
- for (i in 0..relationshipsSize-1) {
- def relationship = relationships[i]
- def relationshipXml = XmlUtil.serialize(relationship)
- rebuildingSubnets += "<relationship>"
- def relationshipList = ["related-to", "related-link"]
- rebuildingSubnets += buildSubNetworkElements(relationshipXml, "", relationshipList, "")
- if (utils.nodeExists(relationshipXml, 'relationship-data')) {
- def relationshipDataXmlData = new XmlSlurper().parseText(relationshipXml)
- def relationshipsData = relationshipDataXmlData.'**'.findAll {it.name() == "relationship-data"}
- def relationshipsDataSize = relationshipsData.size()
- for (j in 0..relationshipsDataSize-1) {
- def relationshipData = relationshipsData[j]
- def relationshipDataXml = XmlUtil.serialize(relationshipData)
- def relationshipDataList = ["relationship-key", "relationship-value"]
- rebuildingSubnets += buildXMLElements(relationshipDataXml, "", "relationship-data", relationshipDataList)
- }
- }
- if (utils.nodeExists(relationshipXml, 'related-to-property')) {
- def relationshipDataXmlData = new XmlSlurper().parseText(relationshipXml)
- def relationshipsData = relationshipDataXmlData.'**'.findAll {it.name() == "related-to-property"}
- def relationshipsDataSize = relationshipsData.size()
- for (j in 0..relationshipsDataSize-1) {
- def relationshipData = relationshipsData[j]
- def relationshipDataXml = XmlUtil.serialize(relationshipData)
- def relationshipDataList = ["property-key", "property-value"]
- rebuildingSubnets += buildXMLElements(relationshipDataXml, "", "related-to-property", relationshipDataList)
- }
- }
-
- rebuildingSubnets += "</relationship>"
- }
- rebuildingSubnets += "</relationship-list>"
- }
- return rebuildingSubnets
- }
-
- def buildVlans(queryIdResponse) {
- def rebuildingSubnets = "<vlans>"
- def subnetsData = new XmlSlurper().parseText(queryIdResponse)
-
- try {
- def subnets = subnetsData.'**'.findAll {it.name() == "segmentation-assignments"}
- def subnetsSize = subnets.size()
- for (i in 0..subnetsSize-1) {
- def subnet = subnets[i]
- def subnetXml = XmlUtil.serialize(subnet)
-
- String vlan = utils.getNodeText1(subnetXml, "segmentation-id")
- if (i>0){
- rebuildingSubnets += ","
- }
- rebuildingSubnets += vlan
- }
- } catch (Exception ex) {
- //
- } finally {
- //rebuildingSubnets += "</subnets>"
- rebuildingSubnets += "</vlans>"
- }
- return rebuildingSubnets
- }
-
- /* Utility code to rebuild xml/elements in a list:
- * rebuild xml with 1) unbounded groups of elements; or
- * 2) one group of elements; or
- * 3) just one or more elements (in a list as argument)
- * @param xmlInput the XML document
- * @param parentName the parent name (ex: 'inputs')
- * @param childrenName the chilrendName (ex: 'entry' as unbounded/occurs>1)
- * @param elementList the element list of children (ex: 'key', 'value')
- * @return a string of rebuild xml
- *
- * Ex 1: xmlInput:
- * <ws:inputs>
- * <ws:entry>
- * <ws:key>name</ws:key>
- * <ws:value>Edward</ws:value>
- * </ws:entry>
- * <ws:entry>
- * <ws:key>age</ws:key>
- * <ws:value>30</ws:value>
- * </ws:entry>
- * <ws:entry>
- * <ws:key>age</ws:key>
- * <ws:value>30</ws:value>
- * </ws:entry>
- * <ws:/inputs>
- * Usage:
- * List elementList = ["key", "value"]
- * String rebuild = buildXMLElements(xmlInput, "inputs", "entry", elementList)
- *
- * Ex 2: xmlInput // no parent tag
- * <ws:sdnc-request-header>
- * <ws:svc-request-id>fec8ec88-151a-45c9-ad60-8233e0fc8ff2</ws:svc-request-id>
- * <ws:svc-notification-url>https://msojra.mtsnj.aic.cip.openecomp.com:8443/adapters/rest/SDNCNotify</ws:svc-notification-url>
- * <ws:svc-action>assign</ws:svc-action>
- * </ws:sdnc-request-header>
- * Usage:
- * List elementList = ["svc-request-id", "svc-notification-url", "svc-action"]
- * String rebuild = buildXMLElements(xmlInput, "" , "sdnc-request-header", elementList) // no parent tag
- *
- * Ex 3: xmlInput // elements one after another (with no parent & children tag)
- * <ws:test-id>myTestid</ws:test-id>
- * <ws:test-user>myUser</ws:test-user>
- * Usage:
- * List elementList = ["test-id", "test-user"]
- * String rebuild = buildXMLElements(xmlInput, "" , "", elementList)
- *
- */
- def buildXMLElements(xmlInput, parentName, childrenName, elementList) {
- def varChildren = ""
- def var = ""
- def xmlBuildUnbounded = ""
- if (parentName!="") {xmlBuildUnbounded += "<"+parentName+">" +'\n'}
- if (xmlInput != null) {
- def xml= new XmlSlurper().parseText(xmlInput)
- if (childrenName!="") {
- varChildren = xml.'**'.findAll {it.name() == childrenName}
- for (i in 0..varChildren.size()-1) {
- xmlBuildUnbounded += "<"+childrenName+">" +'\n'
- for (element in elementList) {
- var = varChildren[i].'*'.find {it.name() == element}
- if (var != null) {
- xmlBuildUnbounded += "<"+element+">"+var.toString()+"</"+element+">" +'\n'
- }
- }
- xmlBuildUnbounded += "</"+childrenName+">" +'\n'
- }
- } else {
- for (element in elementList) {
- var = xml.'*'.find {it.name() == element}
- if (var != null) {
- xmlBuildUnbounded += "<"+element+">"+var.toString()+"</"+element+">" +'\n'
- }
- }
- }
-
- }
- if (parentName!="") {xmlBuildUnbounded += "</"+parentName+">" +'\n'}
- return xmlBuildUnbounded
- }
-
- def getFirstNodeXml(xmlInput, element){
- def nodeAsText = ""
- def nodeToSerialize = ""
- if (xmlInput != null) {
- def fxml= new XmlSlurper().parseText(xmlInput)
- if (utils.nodeExists(xmlInput, "payload")) {
- nodeToSerialize = fxml.'payload'.'l3-network'.'*'.find {it.name() == element}
- if (nodeToSerialize!=null) {
- nodeAsText = XmlUtil.serialize(nodeToSerialize)
- } else {
- nodeAsText = ""
- }
-
- } else {
- nodeToSerialize = fxml.'*'.find {it.name() == element}
- if (nodeToSerialize!=null) {
- nodeAsText = XmlUtil.serialize(nodeToSerialize)
- } else {
- nodeAsText = ""
- }
-
- }
- }
- return nodeAsText
-
- }
-
-//TODO: This method still needs to be tested before using.
- /**
- *
- * This method is similar to the gennetwork:ContrailNetworUpdateCompletedObject
- * BPEL method. It extracts all of the required subnet information
- * for each subnet listed with an orch status equal to the one provided
- * and puts the corresponding infomation with the appropriate node for
- * updating aai. The method sets the orch status for each subnet to active
- *
- * @param subnetsXml the entire subnets xml
- * @param requestInput the request in the process
- * @param queryIdResponse the response of REST AAI query by Id
- * @param queryVpnBindingResponse the response of REST AAI query by vpn binding
- * @param routeCollection the collection of vpnBinding's 'global-route-target'
- * @return String request
- */
- public String networkUpdateSubnetInfo(String subnetsXml, String networkResponseXml){
-
- String subnets = ""
- StringBuilder sb = new StringBuilder()
- InputSource source = new InputSource(new StringReader(subnetsXml));
- DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
- docFactory.setNamespaceAware(true)
- DocumentBuilder docBuilder = docFactory.newDocumentBuilder()
- Document xml = docBuilder.parse(source)
- NodeList nodeList = xml.getElementsByTagNameNS("*", "subnet")
- for (int x = 0; x < nodeList.getLength(); x++) {
- Node node = nodeList.item(x)
- String subnet = ""
- if (node.getNodeType() == Node.ELEMENT_NODE) {
- Element eElement = (Element) node
- String subnetOrchStatus = eElement.getElementsByTagNameNS("*", "orchestration-status").item(0).getTextContent()
- if(subnetOrchStatus.equals("pending-create")){
-
- String subnetId = eElement.getElementsByTagNameNS("*", "subnet-id").item(0).getTextContent()
- def netAddress = eElement.getElementsByTagNameNS("*", "network-start-address").item(0).getTextContent()
- def mask = eElement.getElementsByTagNameNS("*", "cidr-mask").item(0).getTextContent()
- def dhcpEnabledSubnet = eElement.getElementsByTagNameNS("*", "dhcp-enabled").item(0).getTextContent()
- def gatewayAddress = eElement.getElementsByTagNameNS("*", "gateway-address").item(0).getTextContent()
- def ipVersion = eElement.getElementsByTagNameNS("*", "ip-version").item(0).getTextContent()
- def relationshipList = eElement.getElementsByTagNameNS("*", "relationship-list").item(0).getTextContent() //TODO: test this
- String neutronSubnetId = extractNeutSubId(networkResponseXml, subnetId)
- subnet =
- """<subnet>
- <subnetId>${subnetId}</subnetId>
- <neutron-subnet-id>${neutronSubnetId}</neutron-subnet-id>
- <gateway-address>${gatewayAddress}</gateway-address>
- <network-start-address>${netAddress}</network-start-address>
- <cidr-mask>${mask}</cidr-mask>
- <ip-Version>${ipVersion}</ip-Version>
- <orchestration-status>active</orchestration-status>
- <dhcp-enabled>${dhcpEnabledSubnet}</dhcp-enabled>
- <relationship-list>${relationshipList}</relationship-list>
- </subnet>"""
-
- }else if(subnetOrchStatus.equals("pending-delete")){
- StringWriter writer = new StringWriter()
- Transformer transformer = TransformerFactory.newInstance().newTransformer()
- transformer.transform(new DOMSource(node), new StreamResult(writer))
- subnet = writer.toString()
-
- }else{
- subnet = ""
- }
- }
- subnets = sb.append(subnet)
- }
-
- subnets = utils.removeXmlPreamble(subnets)
-
- String subnetsList =
- """<subnets>
- ${subnets}
- </subnets>"""
-
- return subnetsList
- }
-
-
- /**
- *
- * This method extracts the "value" node text for the the given subnet Id.
- *
- * @param String inputSource - xml that contains the subnet id key and value
- * @param String subnetId - for which you want the value of
-
- * @return String value - node text of node named value associated with the given subnet id
- */
- public String extractNeutSubId(String inputSource, String subnetId){
-
- String value = ""
- InputSource source = new InputSource(new StringReader(inputSource));
- DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
- docFactory.setNamespaceAware(true)
- DocumentBuilder docBuilder = docFactory.newDocumentBuilder()
- Document xml = docBuilder.parse(source)
- NodeList nodeList = xml.getElementsByTagNameNS("*", "entry")
- for (int x = 0; x < nodeList.getLength(); x++) {
- Node node = nodeList.item(x)
- String subnet = ""
- if (node.getNodeType() == Node.ELEMENT_NODE) {
- Element eElement = (Element) node
- String key = eElement.getElementsByTagNameNS("*", "key").item(0).getTextContent()
- if(key.equals(subnetId)){
- value = eElement.getElementsByTagNameNS("*", "value").item(0).getTextContent()
- }
- }
- }
- return value
- }
-
- public boolean isRollbackEnabled (Execution execution, String payloadXml) {
-
- def rollbackEnabled = false
- def rollbackValueSet = false
- if (utils.nodeExists(payloadXml, "backout-on-failure")) {
- String backoutValue = utils.getNodeText1(payloadXml, "backout-on-failure")
- if (backoutValue != null && !backoutValue.isEmpty()) {
- if (backoutValue.equalsIgnoreCase("false")) {
- rollbackEnabled = false
- }
- else {
- rollbackEnabled = true
- }
- rollbackValueSet = true;
- }
- }
-
- if (!rollbackValueSet) {
- if (execution.getVariable("URN_mso_rollback") != null) {
- rollbackEnabled = execution.getVariable("URN_mso_rollback").toBoolean()
- }
- }
- return rollbackEnabled
- }
-}
+/*-
+ * ============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.common.scripts;
+
+import org.apache.commons.lang3.*
+
+import groovy.xml.XmlUtil
+
+import javax.xml.parsers.DocumentBuilder
+import javax.xml.parsers.DocumentBuilderFactory
+import javax.xml.transform.Transformer
+import javax.xml.transform.TransformerFactory
+import javax.xml.transform.TransformerException
+import javax.xml.transform.dom.DOMSource
+import javax.xml.transform.stream.StreamResult
+
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.runtime.Execution
+import org.w3c.dom.Document
+import org.w3c.dom.Element
+
+import org.w3c.dom.NamedNodeMap
+import org.w3c.dom.Node
+import org.w3c.dom.NodeList;
+import org.xml.sax.InputSource
+
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.runtime.Execution
+import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor;
+import org.w3c.dom.Document
+import org.w3c.dom.Element
+import org.w3c.dom.NamedNodeMap
+import org.w3c.dom.Node
+import org.w3c.dom.NodeList;
+import org.xml.sax.InputSource
+
+
+/**
+ * This groovy class supports the any Network processes that need the methods defined here.
+ */
+class NetworkUtils {
+
+ public MsoUtils utils = new MsoUtils()
+ private AbstractServiceTaskProcessor taskProcessor
+
+ public NetworkUtils(AbstractServiceTaskProcessor taskProcessor) {
+ this.taskProcessor = taskProcessor
+ }
+
+ /**
+ * This method returns the string for Network request
+ * V2 for Contrail 3.x will populate cloud-region data in same cloudSiteId filed
+ * Network adapter will handle it properly
+ * @param requestId either 'request-id' or 'mso-request-id'
+ * @param requestInput the request in the process
+ * @param queryIdResponse the response of REST AAI query by Id
+ * @param routeCollection the collection
+ * @param policyFqdns the policy
+ * @param tableCollection the collection
+ * @param cloudRegionId the cloud-region-region
+ * @return String request
+ */
+ def CreateNetworkRequestV2(execution, requestId, messageId, requestInput, queryIdResponse, routeCollection, policyFqdns, tableCollection, cloudRegionId, backoutOnFailure, source) {
+ String createNetworkRequest = null
+ if(requestInput!=null && queryIdResponse!=null) {
+ String serviceInstanceId = ""
+ String sharedValue = ""
+ String externalValue = ""
+
+ if (source == "VID") {
+ sharedValue = utils.getNodeText1(queryIdResponse, "is-shared-network") != null ? utils.getNodeText1(queryIdResponse, "is-shared-network") : "false"
+ externalValue = utils.getNodeText1(queryIdResponse, "is-external-network") != null ? utils.getNodeText1(queryIdResponse, "is-external-network") : "false"
+ serviceInstanceId = utils.getNodeText1(requestInput, "service-instance-id")
+
+ } else { // source = 'PORTAL'
+ sharedValue = getParameterValue(requestInput, "shared")
+ externalValue = getParameterValue(requestInput, "external")
+ serviceInstanceId = utils.getNodeText1(requestInput, "service-instance-id") != null ? utils.getNodeText1(requestInput, "service-instance-id") : ""
+ }
+
+ String networkParams = ""
+ if (utils.nodeExists(requestInput, "network-params")) {
+ String netParams = utils.getNodeXml(requestInput, "network-params", false).replace("tag0:","").replace(":tag0","")
+ networkParams = buildParams(netParams)
+ }
+
+ String failIfExists = "false"
+ // requestInput
+ String cloudRegion = cloudRegionId
+ String tenantId = utils.getNodeText1(requestInput, "tenant-id")
+ String networkType = ""
+ if (utils.nodeExists(requestInput, "networkModelInfo")) {
+ String networkModelInfo = utils.getNodeXml(requestInput, "networkModelInfo", false).replace("tag0:","").replace(":tag0","")
+ networkType = utils.getNodeText1(networkModelInfo, "modelName")
+ } else {
+ networkType = utils.getNodeText1(queryIdResponse, "network-type")
+ }
+
+ // queryIdResponse
+ String networkName = utils.getNodeText1(queryIdResponse, "network-name")
+ String networkId = utils.getNodeText1(queryIdResponse, "network-id")
+ String networkTechnology = utils.getNodeText1(queryIdResponse, "network-technology")
+
+ // contrailNetwork - networkTechnology = 'Contrail' vs. 'AIC_SR_IOV')
+ String contrailNetwork = ""
+ if (networkTechnology.contains('Contrail') || networkTechnology.contains('contrail') || networkTechnology.contains('CONTRAIL')) {
+ contrailNetwork = """<contrailNetwork>
+ <shared>${sharedValue}</shared>
+ <external>${externalValue}</external>
+ ${routeCollection}
+ ${policyFqdns}
+ ${tableCollection}
+ </contrailNetwork>"""
+ networkTechnology = "CONTRAIL" // replace
+ }
+
+ // rebuild subnets
+ String subnets = ""
+ if (utils.nodeExists(queryIdResponse, "subnets")) {
+ def subnetsGroup = utils.getNodeXml(queryIdResponse, "subnets", false)
+ subnets = buildSubnets(subnetsGroup)
+ }
+
+ String physicalNetworkName = ""
+ physicalNetworkName = utils.getNodeText1(queryIdResponse, "physical-network-name")
+
+ String vlansCollection = buildVlans(queryIdResponse)
+
+ String notificationUrl = "" //TODO - is this coming from URN? What variable/value to use?
+ //String notificationUrl = execution.getVariable("URN_?????") //TODO - is this coming from URN? What variable/value to use?
+
+ createNetworkRequest = """
+ <createNetworkRequest>
+ <cloudSiteId>${cloudRegion}</cloudSiteId>
+ <tenantId>${tenantId}</tenantId>
+ <networkId>${networkId}</networkId>
+ <networkName>${networkName}</networkName>
+ <networkType>${networkType}</networkType>
+ <modelCustomizationUuid>${modelCustomizationUuid}</modelCustomizationUuid>
+ <networkTechnology>${networkTechnology}</networkTechnology>
+ <providerVlanNetwork>
+ <physicalNetworkName>${physicalNetworkName}</physicalNetworkName >
+ ${vlansCollection}
+ </providerVlanNetwork>
+ ${contrailNetwork}
+ ${subnets}
+ <skipAAI>true</skipAAI>
+ <backout>${backoutOnFailure}</backout>
+ <failIfExists>${failIfExists}</failIfExists>
+ ${networkParams}
+ <msoRequest>
+ <requestId>${requestId}</requestId>
+ <serviceInstanceId>${serviceInstanceId}</serviceInstanceId>
+ </msoRequest>
+ <messageId>${messageId}</messageId>
+ <notificationUrl>${notificationUrl}</notificationUrl>
+ </createNetworkRequest>
+ """.trim()
+ }
+ return createNetworkRequest
+
+ }
+
+ /**
+ * This method returns the string for Network request
+ * V2 for Contrail 3.x will populate cloud-region data in same cloudSiteId filed
+ * Network adapter will handle it properly
+ * @param requestId either 'request-id' or 'mso-request-id'
+ * @param requestInput the request in the process
+ * @param queryIdResponse the response of REST AAI query by Id
+ * @param routeCollection the collection
+ * @param policyFqdns the policy
+ * @param cloudRegionId the cloud-region-region
+ * @return String request
+ */
+ def UpdateNetworkRequestV2(execution, requestId, messageId, requestInput, queryIdResponse, routeCollection, policyFqdns, tableCollection, cloudRegionId, backoutOnFailure, source) {
+ String updateNetworkRequest = null
+ if(requestInput!=null && queryIdResponse!=null) {
+ String serviceInstanceId = ""
+ String sharedValue = ""
+ String externalValue = ""
+
+ if (source == "VID") {
+ sharedValue = utils.getNodeText1(queryIdResponse, "is-shared-network") != null ? utils.getNodeText1(queryIdResponse, "is-shared-network") : "false"
+ externalValue = utils.getNodeText1(queryIdResponse, "is-external-network") != null ? utils.getNodeText1(queryIdResponse, "is-external-network") : "false"
+ serviceInstanceId = utils.getNodeText1(requestInput, "service-instance-id")
+
+ } else { // source = 'PORTAL'
+ sharedValue = getParameterValue(requestInput, "shared")
+ externalValue = getParameterValue(requestInput, "external")
+ serviceInstanceId = utils.getNodeText1(requestInput, "service-instance-id") != null ? utils.getNodeText1(requestInput, "service-instance-id") : ""
+ }
+
+ String failIfExists = "false"
+ // requestInput
+ String cloudRegion = cloudRegionId
+ String tenantId = utils.getNodeText1(requestInput, "tenant-id")
+
+ // queryIdResponse
+ String networkName = utils.getNodeText1(queryIdResponse, "network-name")
+ String networkId = utils.getNodeText1(queryIdResponse, "network-id")
+
+ String networkType = ""
+ String modelCustomizationUuid = ""
+ if (utils.nodeExists(requestInput, "networkModelInfo")) {
+ String networkModelInfo = utils.getNodeXml(requestInput, "networkModelInfo", false).replace("tag0:","").replace(":tag0","")
+ networkType = utils.getNodeText1(networkModelInfo, "modelName")
+ modelCustomizationUuid = utils.getNodeText1(networkModelInfo, "modelCustomizationUuid")
+ } else {
+ networkType = utils.getNodeText1(queryIdResponse, "network-type")
+ }
+
+
+ // rebuild subnets
+ String subnets = ""
+ if (utils.nodeExists(queryIdResponse, "subnets")) {
+ def subnetsGroup = utils.getNodeXml(queryIdResponse, "subnets", false)
+ subnets = buildSubnets(subnetsGroup)
+ }
+
+ String networkParams = ""
+ if (utils.nodeExists(requestInput, "network-params")) {
+ String netParams = utils.getNodeXml(requestInput, "network-params", false).replace("tag0:","").replace(":tag0","")
+ networkParams = buildParams(netParams)
+ }
+
+ String networkStackId = utils.getNodeText1(queryIdResponse, "heat-stack-id")
+ if (networkStackId == 'null' || networkStackId == "" || networkStackId == null) {
+ networkStackId = "force_update"
+ }
+
+ String physicalNetworkName = utils.getNodeText1(queryIdResponse, "physical-network-name")
+ String vlansCollection = buildVlans(queryIdResponse)
+
+ updateNetworkRequest =
+ """<updateNetworkRequest>
+ <cloudSiteId>${cloudRegion}</cloudSiteId>
+ <tenantId>${tenantId}</tenantId>
+ <networkId>${networkId}</networkId>
+ <networkStackId>${networkStackId}</networkStackId>
+ <networkName>${networkName}</networkName>
+ <networkType>${networkType}</networkType>
+ <modelCustomizationUuid>${modelCustomizationUuid}</modelCustomizationUuid>
+ <networkTypeVersion/>
+ <networkTechnology>CONTRAIL</networkTechnology>
+ <providerVlanNetwork>
+ <physicalNetworkName>${physicalNetworkName}</physicalNetworkName>
+ ${vlansCollection}
+ </providerVlanNetwork>
+ <contrailNetwork>
+ <shared>${sharedValue}</shared>
+ <external>${externalValue}</external>
+ ${routeCollection}
+ ${policyFqdns}
+ ${tableCollection}
+ </contrailNetwork>
+ ${subnets}
+ <skipAAI>true</skipAAI>
+ <backout>${backoutOnFailure}</backout>
+ <failIfExists>${failIfExists}</failIfExists>
+ ${networkParams}
+
+ <msoRequest>
+ <requestId>${requestId}</requestId>
+ <serviceInstanceId>${serviceInstanceId}</serviceInstanceId>
+ </msoRequest>
+ <messageId>${messageId}</messageId>
+ <notificationUrl></notificationUrl>
+ </updateNetworkRequest>""".trim()
+
+ }
+ return updateNetworkRequest
+
+ }
+
+ /**
+ * This method returns the string for Create Volume Request payload
+ * @param groupId the volume-group-id
+ * @param volumeName the volume-group-name
+ * @param vnfType the vnf-type
+ * @param tenantId the value of relationship-key 'tenant.tenant-id'
+ * @return String request payload
+ */
+ def String CreateNetworkVolumeRequest(groupId, volumeName, vnfType, tenantId) {
+
+ String requestPayload =
+ """<volume-group xmlns="http://org.openecomp.mso/v6">
+ <volume-group-id>${groupId}</volume-group-id>
+ <volume-group-name>${volumeName}</volume-group-name>
+ <heat-stack-id></heat-stack-id>
+ <vnf-type>${vnfType}</vnf-type>
+ <orchestration-status>Pending</orchestration-status>
+ <relationship-list>
+ <relationship>
+ <related-to>tenant</related-to>
+ <relationship-data>
+ <relationship-key>tenant.tenant-id</relationship-key>
+ <relationship-value>${tenantId}</relationship-value>
+ </relationship-data>
+ </relationship>
+ </relationship-list>
+ </volume-group>"""
+
+ return requestPayload
+ }
+
+ def String createCloudRegionVolumeRequest(groupId, volumeName, vnfType, tenantId, cloudRegion, namespace, modelCustomizationId) {
+
+ String requestPayload =
+ """<volume-group xmlns="${namespace}">
+ <volume-group-id>${groupId}</volume-group-id>
+ <volume-group-name>${volumeName}</volume-group-name>
+ <heat-stack-id></heat-stack-id>
+ <vnf-type>${vnfType}</vnf-type>
+ <orchestration-status>Pending</orchestration-status>
+ <vf-module-persona-model-customization-id>${modelCustomizationId}</vf-module-persona-model-customization-id>
+ <relationship-list>
+ <relationship>
+ <related-to>tenant</related-to>
+ <relationship-data>
+ <relationship-key>tenant.tenant-id</relationship-key>
+ <relationship-value>${tenantId}</relationship-value>
+ </relationship-data>
+ <relationship-data>
+ <relationship-key>cloud-region.cloud-owner</relationship-key>
+ <relationship-value>att-aic</relationship-value>
+ </relationship-data>
+ <relationship-data>
+ <relationship-key>cloud-region.cloud-region-id</relationship-key>
+ <relationship-value>${cloudRegion}</relationship-value>
+ </relationship-data>
+ </relationship>
+ </relationship-list>
+ </volume-group>"""
+
+ return requestPayload
+ }
+
+ def String createCloudRegionVolumeRequest(groupId, volumeName, vnfType, vnfId, tenantId, cloudRegion, namespace, modelCustomizationId) {
+
+ String requestPayload =
+ """<volume-group xmlns="${namespace}">
+ <volume-group-id>${groupId}</volume-group-id>
+ <volume-group-name>${volumeName}</volume-group-name>
+ <heat-stack-id></heat-stack-id>
+ <vnf-type>${vnfType}</vnf-type>
+ <orchestration-status>Pending</orchestration-status>
+ <vf-module-persona-model-customization-id>${modelCustomizationId}</vf-module-persona-model-customization-id>
+ <relationship-list>
+ <relationship>
+ <related-to>generic-vnf</related-to>
+ <relationship-data>
+ <relationship-key>generic-vnf.vnf-id</relationship-key>
+ <relationship-value>${vnfId}</relationship-value>
+ </relationship-data>
+ </relationship>
+ <relationship>
+ <related-to>tenant</related-to>
+ <relationship-data>
+ <relationship-key>tenant.tenant-id</relationship-key>
+ <relationship-value>${tenantId}</relationship-value>
+ </relationship-data>
+ <relationship-data>
+ <relationship-key>cloud-region.cloud-owner</relationship-key>
+ <relationship-value>att-aic</relationship-value>
+ </relationship-data>
+ <relationship-data>
+ <relationship-key>cloud-region.cloud-region-id</relationship-key>
+ <relationship-value>${cloudRegion}</relationship-value>
+ </relationship-data>
+ </relationship>
+ </relationship-list>
+ </volume-group>"""
+
+ return requestPayload
+ }
+
+
+ /**
+ * This method returns the string for Update Volume Request payload
+ * @param requeryAAIVolGrpNameResponse the response of query volume group name (in AAI)
+ * @param heatStackId the value of heat stack id
+ * @return String request payload
+ */
+ def String updateCloudRegionVolumeRequest(requeryAAIVolGrpNameResponse, heatStackId, namespace, modelCustomizationId) {
+ String requestPayload = ""
+ if (requeryAAIVolGrpNameResponse != null) {
+ def groupId = utils.getNodeText(requeryAAIVolGrpNameResponse, "volume-group-id")
+ def volumeName = utils.getNodeText(requeryAAIVolGrpNameResponse, "volume-group-name")
+ def vnfType = utils.getNodeText(requeryAAIVolGrpNameResponse, "vnf-type")
+ def resourceVersion = utils.getNodeText(requeryAAIVolGrpNameResponse, "resource-version")
+ def relationshipList = ""
+ if (utils.nodeExists(requeryAAIVolGrpNameResponse, "relationship")) {
+ relationshipList = rebuildRelationship(requeryAAIVolGrpNameResponse)
+ }
+
+ requestPayload =
+ """<volume-group xmlns="${namespace}">
+ <volume-group-id>${groupId}</volume-group-id>
+ <volume-group-name>${volumeName}</volume-group-name>
+ <heat-stack-id>${heatStackId}</heat-stack-id>
+ <vnf-type>${vnfType}</vnf-type>
+ <orchestration-status>Active</orchestration-status>
+ <resource-version>${resourceVersion}</resource-version>
+ <vf-module-persona-model-customization-id>${modelCustomizationId}</vf-module-persona-model-customization-id>
+ ${relationshipList}
+ </volume-group>"""
+ }
+
+ return requestPayload
+ }
+
+
+ /**
+ * This method returns the string for Update Volume Request payload
+ * @param requeryAAIVolGrpNameResponse the response of query volume group name (in AAI)
+ * @param heatStackId the value of heat stack id
+ * @return String request payload
+ */
+ def String UpdateNetworkVolumeRequest(requeryAAIVolGrpNameResponse, heatStackId) {
+ String requestPayload = ""
+ if (requeryAAIVolGrpNameResponse != null) {
+ def groupId = utils.getNodeText(requeryAAIVolGrpNameResponse, "volume-group-id")
+ def volumeName = utils.getNodeText(requeryAAIVolGrpNameResponse, "volume-group-name")
+ def vnfType = utils.getNodeText(requeryAAIVolGrpNameResponse, "vnf-type")
+ def resourceVersion = utils.getNodeText(requeryAAIVolGrpNameResponse, "resource-version")
+ def relationshipList = ""
+ if (utils.nodeExists(requeryAAIVolGrpNameResponse, "relationship")) {
+ relationshipList = rebuildRelationship(requeryAAIVolGrpNameResponse)
+ }
+
+ requestPayload =
+ """<volume-group xmlns="http://org.openecomp.mso/v6">
+ <volume-group-id>${groupId}</volume-group-id>
+ <volume-group-name>${volumeName}</volume-group-name>
+ <heat-stack-id>${heatStackId}</heat-stack-id>
+ <vnf-type>${vnfType}</vnf-type>
+ <orchestration-status>Active</orchestration-status>
+ <resource-version>${resourceVersion}</resource-version>
+ ${relationshipList}
+ </volume-group>"""
+ }
+
+ return requestPayload
+ }
+
+ /**
+ * This method returns the string for Create Contrail Network payload
+ * @param requeryIdAAIResponse the response from AAI query by id
+ * @param createNetworkResponse the response of create network
+ * @return String contrailNetworkCreatedUpdate
+ */
+ def ContrailNetworkCreatedUpdate(requeryIdAAIResponse, createNetworkResponse, schemaVersion) {
+
+ String contrailNetworkCreatedUpdate = ""
+ if(requeryIdAAIResponse!=null && createNetworkResponse!=null) {
+
+ def l3Network = utils.getNodeXml(requeryIdAAIResponse, "l3-network", false).replace("tag0:","").replace(":tag0","")
+ def createNetworkContrailResponse = ""
+ if (utils.nodeExists(createNetworkResponse, 'createNetworkResponse')) {
+ createNetworkContrailResponse = utils.getNodeXml(createNetworkResponse, "createNetworkResponse", false).replace("tag0:","").replace(":tag0","")
+ } else {
+ createNetworkContrailResponse = utils.getNodeXml(createNetworkResponse, "updateNetworkContrailResponse", false).replace("tag0:","").replace(":tag0","")
+ }
+
+ // rebuild network
+ def networkList = ["network-id", "network-name", "network-type", "network-role", "network-technology", "neutron-network-id", "is-bound-to-vpn", "service-id", "network-role-instance", "resource-version", "resource-model-uuid", "orchestration-status", "heat-stack-id", "mso-catalog-key", "contrail-network-fqdn",
+ "physical-network-name", "is-provider-network", "is-shared-network", "is-external-network"]
+ String rebuildNetworkElements = buildNetworkElements(l3Network, createNetworkContrailResponse, networkList)
+
+ // rebuild 'subnets'
+ def rebuildSubnetList = ""
+ if (utils.nodeExists(requeryIdAAIResponse, 'subnet')) {
+ rebuildSubnetList = buildSubnets(requeryIdAAIResponse, createNetworkResponse)
+ }
+
+ // rebuild 'segmentation-assignments'
+ def rebuildSegmentationAssignments = ""
+ if (utils.nodeExists(requeryIdAAIResponse, 'segmentation-assignments')) {
+ List elementList = ["segmentation-id"]
+ rebuildSegmentationAssignments = buildXMLElements(requeryIdAAIResponse, "", "segmentation-assignments", elementList)
+ }
+
+ // rebuild 'ctag-assignments' / rebuildCtagAssignments
+ def rebuildCtagAssignmentsList = ""
+ if (utils.nodeExists(requeryIdAAIResponse, 'ctag-assignment')) {
+ rebuildCtagAssignmentsList = rebuildCtagAssignments(requeryIdAAIResponse)
+ }
+
+ // rebuild 'relationship'
+ def relationshipList = ""
+ if (utils.nodeExists(requeryIdAAIResponse, 'relationship-list')) {
+ String rootRelationshipData = getFirstNodeXml(requeryIdAAIResponse, "relationship-list").drop(38).trim().replace("tag0:","").replace(":tag0","")
+ if (utils.nodeExists(rootRelationshipData, 'relationship')) {
+ relationshipList = rebuildRelationship(rootRelationshipData)
+ }
+ }
+
+ //Check for optional contrail network fqdn within CreateNetworkResponse
+ String contrailNetworkFQDN
+ if(utils.nodeExists(createNetworkResponse, "contrail-network-fqdn")){
+ contrailNetworkFQDN = utils.getNodeXml(createNetworkResponse, "contrail-network-fqdn")
+ contrailNetworkFQDN = utils.removeXmlNamespaces(contrailNetworkFQDN)
+ contrailNetworkFQDN = utils.removeXmlPreamble(contrailNetworkFQDN)
+ }else{
+ contrailNetworkFQDN = ""
+ }
+
+ contrailNetworkCreatedUpdate =
+ """<l3-network xmlns="${schemaVersion}">
+ ${rebuildNetworkElements}
+ ${rebuildSubnetList}
+ ${rebuildSegmentationAssignments}
+ ${rebuildCtagAssignmentsList}
+ ${relationshipList}
+ ${contrailNetworkFQDN}
+ </l3-network>""".trim()
+
+ }
+ return contrailNetworkCreatedUpdate
+ }
+
+
+
+ /**
+ * This method returns the value for the name paramName.
+ * Ex: <network-params>
+ * <param name="shared">1</param>
+ * <param name="external">0</external>
+ * </network-params>
+ *
+ * @param xmlInput the XML document
+ * @param paramName the param name (ex: 'shared')
+ * @return a param value for 'shared' (ex: '1')
+ */
+ def getParameterValue(xmlInput, paramName) {
+ def rtn=""
+ if(xmlInput!=null){
+ def xml= new XmlSlurper().parseText(xmlInput)
+ rtn= xml.'**'.find {param->param.'@name'.text() == paramName}
+ }
+ if (rtn==null) {
+ return ""
+ } else {
+ return rtn
+ }
+ }
+
+ /**
+ * This method returns the name of param if found/match with paramName.
+ * Ex: <network-params>
+ * <param name="shared">1</param>
+ * <param name="external">0</external>
+ * </network-params>
+ *
+ * @param xmlInput the XML document
+ * @param paramName the param name (ex: 'shared', )
+ * @return a param name for 'shared' (ex: 'shared' if found)
+ */
+ def getParameterName(xmlInput, paramName) {
+ def rtn=""
+ if(xmlInput!=null){
+ def xml= new XmlSlurper().parseText(xmlInput)
+ try {
+ rtn= xml.'**'.find {param->param.'@name' == paramName}.'@name'
+ } catch (Exception ex) {
+ rtn=""
+ }
+ }
+ if (rtn==null || rtn=="") {
+ return ""
+ } else {
+ return rtn
+ }
+ }
+
+ /**
+ * This method returns the networkParams xml string.
+ * Ex: input:
+ * <network-params>
+ * <param name="shared">1</param>
+ * <param name="external">0</external>
+ * </network-params>
+ *
+ * Sample result:
+ * <networkParams>
+ * <shared>1</shared>
+ * <external>0</external>
+ * </networkParams>
+ *
+ */
+
+ def buildParams(networkParams) {
+ def build = ""
+ def netParams = new XmlParser().parseText(networkParams)
+ try {
+ def paramsList = netParams.'**'.findAll {param->param.'@name'}.'@name'
+ if (paramsList.size() > 0) {
+ build += "<networkParams>"
+ for (i in 0..paramsList.size()-1) {
+ def name = netParams.'**'.find {param->param.'@name' == paramsList[i]}.'@name'
+ def value= netParams.'**'.find {param->param.'@name' == paramsList[i]}.text()
+ build += "<${name}>${value}</${name}>"
+ }
+ build += "</networkParams>"
+ }
+
+ } catch (Exception ex) {
+ println ' buildParams error - ' + ex.getMessage()
+ build = ""
+ }
+ return build
+ }
+
+ def getVlans(xmlInput) {
+ def rtn = ""
+ if (xmlInput!=null) {
+ def vlansList = getListWithElements(xmlInput, 'vlans')
+ def vlansListSize = vlansList.size()
+ if (vlansListSize > 0) {
+ for (i in 0..vlansListSize-1) {
+ rtn += '<vlans>'+vlansList[i]+'</vlans>'
+ }
+ }
+ }
+ return rtn
+
+
+ }
+
+ /**
+ * This method returns the uri value for the vpn bindings.
+ * Return the a list of value of vpn binding in the <related-link> string.
+ * Ex.
+ * <relationship-list>
+ * <relationship>
+ * <related-to>vpn-binding</related-to>
+ * <related-link>https://aai-app-e2e.test.openecomp.com:8443/aai/v6/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/</related-link>
+ * <relationship-data>
+ * <relationship-key>vpn-binding.vpn-id</relationship-key>
+ * <relationship-value>85f015d0-2e32-4c30-96d2-87a1a27f8017</relationship-value>
+ * </relationship-data>
+ * </relationship>
+ * <relationship>
+ * <related-to>vpn-binding</related-to>
+ * <related-link>https://aai-ext1.test.openecomp.com:8443/aai/v6/network/vpn-bindings/vpn-binding/24a4b507-853a-4a38-99aa-05fcc54be24d/</related-link>
+ * <relationship-data>
+ * <relationship-key>vpn-binding.vpn-id</relationship-key>
+ * <relationship-value>24a4b507-853a-4a38-99aa-05fcc54be24d</relationship-value>
+ * </relationship-data>
+ * <related-to-property>
+ * <property-key>vpn-binding.vpn-name</property-key>
+ * <property-value>oam_protected_net_6_MTN5_msotest1</property-value>
+ * </related-to-property>
+ * </relationship>
+ * @param xmlInput the XML document
+ * @return a list of vpn binding values
+ * ex: ['aai/v6/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/', 'aai/v6/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/']
+ *
+ **/
+ def getVnfBindingObject(xmlInput) {
+ //def rtn = null
+ List rtn = []
+ if (xmlInput!=null) {
+ def relationshipList = getListWithElements(xmlInput, 'relationship')
+ def relationshipListSize = relationshipList.size()
+ if (relationshipListSize > 0) {
+ for (i in 0..relationshipListSize-1) {
+ def relationshipXml = XmlUtil.serialize(relationshipList[i])
+ if (utils.getNodeText(relationshipXml, 'related-to') == "vpn-binding") {
+ def relatedLink = utils.getNodeText(relationshipXml, 'related-link')
+ if (relatedLink != null || relatedLink != "") {
+ rtn.add(relatedLink.substring(relatedLink.indexOf("/aai/"), relatedLink.length()))
+ }
+ }
+ }
+ }
+ }
+ return rtn
+ }
+ /**
+ * similar to VNF bindings method
+ * @param xmlInput the XML document
+ * @return a list of network policy values
+ * ex: ['aai/v$/network/network-policies/network-policy/cee6d136-e378-4678-a024-2cd15f0ee0cg', 'aai/v$/network/network-policies/network-policy/cee6d136-e378-4678-a024-2cd15f0ee0cg']
+ *
+ **/
+ def getNetworkPolicyObject(xmlInput) {
+ //def rtn = null
+ List rtn = []
+ if (xmlInput!=null) {
+ def relationshipList = getListWithElements(xmlInput, 'relationship')
+ def relationshipListSize = relationshipList.size()
+ if (relationshipListSize > 0) {
+ for (i in 0..relationshipListSize-1) {
+ def relationshipXml = XmlUtil.serialize(relationshipList[i])
+ if (utils.getNodeText(relationshipXml, 'related-to') == "network-policy") {
+ def relatedLink = utils.getNodeText(relationshipXml, 'related-link')
+ if (relatedLink != null || relatedLink != "") {
+ rtn.add(relatedLink.substring(relatedLink.indexOf("/aai/"), relatedLink.length()))
+ }
+ }
+ }
+ }
+ }
+ return rtn
+ }
+
+ /**
+ * similar to network policymethod
+ * @param xmlInput the XML document
+ * @return a list of network policy values
+ * ex: ['aai/v$/network/route-table-references/route-table-reference/refFQDN1', 'aai/v$/network/route-table-references/route-table-reference/refFQDN2']
+ *
+ **/
+ def getNetworkTableRefObject(xmlInput) {
+ //def rtn = null
+ List rtn = []
+ if (xmlInput!=null) {
+ def relationshipList = getListWithElements(xmlInput, 'relationship')
+ def relationshipListSize = relationshipList.size()
+ if (relationshipListSize > 0) {
+ for (i in 0..relationshipListSize-1) {
+ def relationshipXml = XmlUtil.serialize(relationshipList[i])
+ if (utils.getNodeText(relationshipXml, 'related-to') == "route-table-reference") {
+ def relatedLink = utils.getNodeText1(relationshipXml, 'related-link')
+ if (relatedLink != null || relatedLink != "") {
+ rtn.add(relatedLink.substring(relatedLink.indexOf("/aai/"), relatedLink.length()))
+ }
+ }
+ }
+ }
+ }
+ return rtn
+ }
+
+ /**
+ * similar to network policymethod
+ * @param xmlInput the XML document
+ * @return a list of IDs for related VNF instances
+ *
+ **/
+ def getRelatedVnfIdList(xmlInput) {
+ //def rtn = null
+ List rtn = []
+ if (xmlInput!=null) {
+ def relationshipList = getListWithElements(xmlInput, 'relationship')
+ def relationshipListSize = relationshipList.size()
+ if (relationshipListSize > 0) {
+ for (i in 0..relationshipListSize-1) {
+ def relationshipXml = XmlUtil.serialize(relationshipList[i])
+ if (utils.getNodeText(relationshipXml, 'related-to') == "generic-vnf") {
+ def relatedLink = utils.getNodeText1(relationshipXml, 'related-link')
+ if (relatedLink != null || relatedLink != "") {
+ if (relatedLink.substring(relatedLink.indexOf("/generic-vnf/")+13, relatedLink.length()).contains('/')) {
+ rtn.add(relatedLink.substring(relatedLink.indexOf("/generic-vnf/")+13, relatedLink.length()-1))
+ } else {
+ rtn.add(relatedLink.substring(relatedLink.indexOf("/generic-vnf/")+13, relatedLink.length()))
+ }
+
+ }
+ }
+ }
+ }
+ }
+ return rtn
+ }
+
+ /**
+ * similar to network policymethod
+ * @param xmlInput the XML document
+ * @return a list of IDs for related Network instances
+ *
+ **/
+ def getRelatedNetworkIdList(xmlInput) {
+ //def rtn = null
+ List rtn = []
+ if (xmlInput!=null) {
+ def relationshipList = getListWithElements(xmlInput, 'relationship')
+ def relationshipListSize = relationshipList.size()
+ if (relationshipListSize > 0) {
+ for (i in 0..relationshipListSize-1) {
+ def relationshipXml = XmlUtil.serialize(relationshipList[i])
+ if (utils.getNodeText(relationshipXml, 'related-to') == "l3-network") {
+ def relatedLink = utils.getNodeText1(relationshipXml, 'related-link')
+ if (relatedLink != null || relatedLink != "") {
+ if (relatedLink.substring(relatedLink.indexOf("/l3-network/")+12, relatedLink.length()).contains('/')) {
+ rtn.add(relatedLink.substring(relatedLink.indexOf("/l3-network/")+12, relatedLink.length()-1))
+ } else {
+ rtn.add(relatedLink.substring(relatedLink.indexOf("/l3-network/")+12, relatedLink.length()))
+ }
+
+ }
+ }
+ }
+ }
+ }
+ return rtn
+ }
+
+ def isVfRelationshipExist(xmlInput) {
+ Boolean rtn = false
+ if (xmlInput!=null) {
+ def relationshipList = getListWithElements(xmlInput, 'relationship')
+ def relationshipListSize = relationshipList.size()
+ if (relationshipListSize > 0) {
+ for (i in 0..relationshipListSize-1) {
+ def relationshipXml = XmlUtil.serialize(relationshipList[i])
+ if (utils.getNodeText(relationshipXml, 'related-to') == "vf-module") {
+ rtn = true
+ }
+ }
+ }
+ }
+ return rtn
+
+ }
+
+ def getCloudRegion(xmlInput) {
+ String lcpCloudRegion = ""
+ if (xmlInput!=null) {
+ def relationshipList = getListWithElements(xmlInput, 'relationship')
+ def relationshipListSize = relationshipList.size()
+ if (relationshipListSize > 0) {
+ for (i in 0..relationshipListSize-1) {
+ def relationshipXml = XmlUtil.serialize(relationshipList[i])
+ if (utils.getNodeText(relationshipXml, 'related-to') == "cloud-region") {
+ def relatedLink = utils.getNodeText1(relationshipXml, 'related-link')
+ if (relatedLink != null || relatedLink != "") {
+ lcpCloudRegion = relatedLink.substring(relatedLink.indexOf("/att-aic/")+9, relatedLink.length())
+ if (lcpCloudRegion.contains('/')) {
+ lcpCloudRegion = relatedLink.substring(relatedLink.indexOf("/att-aic/")+9, relatedLink.length()-1)
+ }
+ }
+ }
+ }
+ }
+ }
+ return lcpCloudRegion
+ }
+
+ def getTenantId(xmlInput) {
+ String tenantId = ""
+ if (xmlInput!=null) {
+ def relationshipList = getListWithElements(xmlInput, 'relationship')
+ def relationshipListSize = relationshipList.size()
+ if (relationshipListSize > 0) {
+ for (i in 0..relationshipListSize-1) {
+ def relationshipXml = XmlUtil.serialize(relationshipList[i])
+ if (utils.getNodeText(relationshipXml, 'related-to') == "tenant") {
+ def relatedLink = utils.getNodeText1(relationshipXml, 'related-link')
+ if (relatedLink != null || relatedLink != "") {
+ tenantId = relatedLink.substring(relatedLink.indexOf("/tenant/")+8, relatedLink.length())
+ if (tenantId.contains('/')) {
+ tenantId = relatedLink.substring(relatedLink.indexOf("/tenant/")+8, relatedLink.length()-1)
+ }
+ }
+ }
+ }
+ }
+ }
+ return tenantId
+ }
+
+ def isInstanceValueMatch(linkResource, globalSubscriberId, serviceType) {
+ Boolean rtn = false
+ try {
+ String globalSubscriberIdLink = linkResource.substring(linkResource.indexOf("/customer/")+10, linkResource.indexOf("/service-subscriptions"))
+ String serviceTypeLink = linkResource.substring(linkResource.indexOf("/service-subscription/")+22, linkResource.indexOf("/service-instances"))
+ if (globalSubscriberIdLink == globalSubscriberId) {
+ rtn = true
+ } else {
+ if (serviceTypeLink == serviceType) {
+ rtn = true
+ }
+ }
+
+ } catch (Exception ex) {
+ println 'Exception - ' + ex.getMessage()
+ return false
+ }
+ return rtn
+ }
+
+ def getListWithElements(xmlInput, groupName) {
+ def rtn = ""
+ if (xmlInput != null) {
+ def relationshipData = new XmlSlurper().parseText(xmlInput)
+ rtn = relationshipData.'**'.findAll {it.name() == groupName}
+ }
+ return rtn
+
+ }
+
+ // build network single elements
+ def buildNetworkElements(l3Network, createNetworkContrailResponse, networkList) {
+ def replaceNetworkId = ""
+ def replaceNeutronNetworkId = ""
+ def replaceContrailNetworkFqdn = ""
+ if (l3Network != null && createNetworkContrailResponse != null) {
+ if (utils.nodeExists(l3Network, 'heat-stack-id')) {
+ replaceNetworkId = utils.getNodeText(l3Network, 'heat-stack-id')
+ } else {
+ if (utils.nodeExists(createNetworkContrailResponse, 'networkStackId')) {
+ replaceNetworkId = utils.getNodeText(createNetworkContrailResponse, 'networkStackId')
+ }
+ }
+ if (utils.nodeExists(l3Network, 'neutron-network-id')) {
+ replaceNeutronNetworkId = utils.getNodeText(l3Network, 'neutron-network-id')
+ } else {
+ if (utils.nodeExists(createNetworkContrailResponse, 'neutronNetworkId')) {
+ replaceNeutronNetworkId = utils.getNodeText(createNetworkContrailResponse, 'neutronNetworkId')
+ }
+ }
+ if (utils.nodeExists(l3Network, 'contrail-network-fqdn')) {
+ replaceContrailNetworkFqdn = utils.getNodeText(l3Network, 'contrail-network-fqdn')
+ } else {
+ if (utils.nodeExists(createNetworkContrailResponse, 'networkFqdn')) {
+ replaceContrailNetworkFqdn = utils.getNodeText(createNetworkContrailResponse, 'networkFqdn')
+ }
+ }
+ }
+
+ String var = ""
+ def xmlNetwork = ""
+ if (l3Network != null) {
+ for (element in networkList) {
+ def xml= new XmlSlurper().parseText(l3Network)
+ var = xml.'**'.find {it.name() == element}
+ if (var == null) {
+ if (element=="orchestration-status") {
+ if (var.toString() == 'pending-create' || var.toString() == 'PendingCreate') {
+ xmlNetwork += "<"+element+">"+"Created"+"</"+element+">"
+ } else { //pending-update or PendingUpdate
+ xmlNetwork += "<"+element+">"+"Active"+"</"+element+">"
+ }
+ }
+
+ if (element=="heat-stack-id") {
+ if (replaceNetworkId != "") {
+ xmlNetwork += "<"+element+">"+replaceNetworkId+"</"+element+">"
+ }
+ }
+ if (element=="neutron-network-id") {
+ if (replaceNeutronNetworkId != "") {
+ xmlNetwork += "<"+element+">"+replaceNeutronNetworkId+"</"+element+">"
+ }
+ }
+ if (element=="contrail-network-fqdn") {
+ if (replaceContrailNetworkFqdn != "") {
+ xmlNetwork += "<"+element+">"+replaceContrailNetworkFqdn+"</"+element+">"
+ }
+ }
+
+ } else {
+ if (element=="orchestration-status") {
+ if (element=="orchestration-status") {
+ if (var.toString() == 'pending-create' || var.toString() == 'PendingCreate') {
+ xmlNetwork += "<"+element+">"+"Created"+"</"+element+">"
+ } else { //pending-update or PendingUpdate
+ xmlNetwork += "<"+element+">"+"Active"+"</"+element+">"
+ }
+ }
+ } else {
+ xmlNetwork += "<"+element+">"+var.toString()+"</"+element+">"
+ }
+ }
+ }
+
+ }
+ return xmlNetwork
+ }
+
+ def buildSubnets(requeryIdAAIResponse, createNetworkResponse) {
+ def rebuildingSubnets = ""
+ if (requeryIdAAIResponse != null && utils.nodeExists(requeryIdAAIResponse, 'subnets')) {
+ def subnetIdMapValue = ""
+ def subnetsGroup = utils.getNodeXml(requeryIdAAIResponse, "subnets", false)
+ def subnetsData = new XmlSlurper().parseText(subnetsGroup)
+ rebuildingSubnets += "<subnets>"
+ try {
+ def subnets = subnetsData.'**'.findAll {it.name() == "subnet"}
+ def subnetsSize = subnets.size()
+ for (i in 0..subnetsSize-1) {
+ def subnet = subnets[i]
+ def subnetXml = XmlUtil.serialize(subnet)
+ def orchestrationStatus = utils.getNodeText1(subnetXml, "orchestration-status")
+ if (orchestrationStatus == "PendingDelete" || orchestrationStatus == "pending-delete") {
+ // skip, do not include in processing, remove!!!
+ } else {
+ def subnetList = ["subnet-id", "neutron-subnet-id", "gateway-address", "network-start-address", "cidr-mask", "ip-version", "orchestration-status", "dhcp-enabled", "dhcp-start", "dhcp-end", "resource-version", "subnet-name"]
+ rebuildingSubnets += buildSubNetworkElements(subnetXml, createNetworkResponse, subnetList, "subnet")
+ }
+ }
+ if (utils.nodeExists(subnetsData, 'relationship')) {
+ rebuildingSubnets = rebuildRelationship(requeryIdAAIResponse)
+ }
+
+ } catch (Exception ex) {
+ // error
+ } finally {
+ rebuildingSubnets += "</subnets>"
+ }
+ }
+ return rebuildingSubnets
+ }
+
+ def buildSubnets(queryIdResponse) {
+ def rebuildingSubnets = ""
+ def subnetsData = new XmlSlurper().parseText(queryIdResponse)
+ //rebuildingSubnets += "<subnets>"
+ try {
+ def subnets = subnetsData.'**'.findAll {it.name() == "subnet"}
+ def subnetsSize = subnets.size()
+ for (i in 0..subnetsSize-1) {
+ def subnet = subnets[i]
+ def subnetXml = XmlUtil.serialize(subnet)
+ def orchestrationStatus = utils.getNodeText1(subnetXml, "orchestration-status")
+ if (orchestrationStatus == "pending-delete" || orchestrationStatus == "PendingDelete") {
+ // skip, do not include in processing, remove!!!
+ } else {
+ def subnetList = ["dhcp-start", "dhcp-end", "network-start-address", "cidr-mask", "dhcp-enabled", "gateway-address", "ip-version", "subnet-id", "subnet-name"]
+ rebuildingSubnets += buildSubNetworkElements(subnetXml, subnetList, "subnets")
+ //rebuildingSubnets += buildSubNetworkElements(subnetXml, subnetList, "")
+ } }
+ } catch (Exception ex) {
+ //
+ } finally {
+ //rebuildingSubnets += "</subnets>"
+ }
+ return rebuildingSubnets
+ }
+
+
+ // build subnet sub-network single elements
+ def buildSubNetworkElements(subnetXml, createNetworkResponse, elementList, parentName) {
+ String var = ""
+ def xmlBuild = ""
+ if (parentName != "") {
+ xmlBuild += "<"+parentName+">"
+ }
+ if (subnetXml != null) {
+ for (element in elementList) {
+ def xml= new XmlSlurper().parseText(subnetXml)
+ var = xml.'**'.find {it.name() == element}
+ if (var != null) {
+ if (element=="orchestration-status") {
+ if(var.toString() == 'pending-create' || var.toString() == 'PendingCreate') {
+ xmlBuild += "<"+element+">"+"Created"+"</"+element+">"
+ } else { // pending-update or PendingUpdate'
+ xmlBuild += "<"+element+">"+"Active"+"</"+element+">"
+ }
+ } else { // "subnet-id", "neutron-subnet-id"
+ if (element=="subnet-id") {
+ if (utils.nodeExists(createNetworkResponse, "subnetMap")) {
+ xmlBuild += "<"+element+">"+var.toString()+"</"+element+">"
+ String neutronSubnetId = extractNeutSubId(createNetworkResponse, var.toString())
+ xmlBuild += "<neutron-subnet-id>"+neutronSubnetId+"</neutron-subnet-id>"
+ }
+ } else {
+ if (element=="neutron-subnet-id") {
+ // skip
+ } else {
+ xmlBuild += "<"+element+">"+var.toString()+"</"+element+">"
+ }
+ }
+ }
+ }
+ }
+
+ }
+ if (parentName != "") {
+ xmlBuild += "</"+parentName+">"
+ }
+ return xmlBuild
+ }
+
+ // build subnet sub-network single elements
+ def buildSubNetworkElements(subnetXml, elementList, parentName) {
+ def var = ""
+ def xmlBuild = ""
+ if (parentName != "") {
+ xmlBuild += "<"+parentName+">"
+ }
+ if (subnetXml != null) {
+ def networkStartAddress = ""
+ for (element in elementList) {
+ def xml= new XmlSlurper().parseText(subnetXml)
+ var = xml.'**'.find {it.name() == element}
+ if (element == "dhcp-start") {
+ xmlBuild += "<allocationPools>"
+ if (var.toString() == 'null') {
+ xmlBuild += "<start>"+""+"</start>"
+ } else {
+ xmlBuild += "<start>"+var.toString()+"</start>"
+ }
+ }
+ if (element == "dhcp-end") {
+ if (var.toString() == 'null') {
+ xmlBuild += "<end>"+""+"</end>"
+ } else {
+ xmlBuild += "<end>"+var.toString()+"</end>"
+ }
+ xmlBuild += "</allocationPools>"
+ }
+ if (element == "network-start-address" || element == "cidr-mask") {
+ if (element == "network-start-address") {
+ networkStartAddress = var.toString()
+ }
+ if (element == "cidr-mask") {
+ xmlBuild += "<cidr>"+networkStartAddress+"/"+var.toString()+"</cidr>"
+ }
+ }
+ if (element == "dhcp-enabled") {
+ xmlBuild += "<enableDHCP>"+var.toString()+"</enableDHCP>"
+ }
+ if (element == "gateway-address") {
+ xmlBuild += "<gatewayIp>"+var.toString()+"</gatewayIp>"
+ }
+ if (element == "ip-version") {
+ xmlBuild += "<ipVersion>"+var.toString()+"</ipVersion>"
+ }
+ if (element == "subnet-id") {
+ xmlBuild += "<subnetId>"+var.toString()+"</subnetId>"
+ }
+ if ((element == "subnet-name") && (var != null)) {
+ xmlBuild += "<subnetName>"+var.toString()+"</subnetName>"
+ }
+ }
+ }
+ if (parentName != "") {
+ xmlBuild += "</"+parentName+">"
+ }
+ return xmlBuild
+ }
+
+ // rebuild ctag-assignments
+ def rebuildCtagAssignments(xmlInput) {
+ def rebuildingCtagAssignments = ""
+ if (xmlInput!=null) {
+ def ctagAssignmentsData = new XmlSlurper().parseText(xmlInput)
+ rebuildingCtagAssignments += "<ctag-assignments>"
+ def ctagAssignments = ctagAssignmentsData.'**'.findAll {it.name() == "ctag-assignment"}
+ def ctagAssignmentsSize = ctagAssignments.size()
+ for (i in 0..ctagAssignmentsSize-1) {
+ def ctagAssignment = ctagAssignments[i]
+ def ctagAssignmentXml = XmlUtil.serialize(ctagAssignment)
+ rebuildingCtagAssignments += "<ctag-assignment>"
+ List elementList = ["vlan-id-inner", "resource-version"]
+ rebuildingCtagAssignments += buildXMLElements(ctagAssignmentXml, "" , "", elementList)
+ if (utils.nodeExists(ctagAssignmentXml, 'relationship')) {
+ rebuildingCtagAssignments += rebuildRelationship(ctagAssignmentXml)
+ }
+ rebuildingCtagAssignments += "</ctag-assignment>"
+ }
+ rebuildingCtagAssignments += "</ctag-assignments>"
+ }
+ return rebuildingCtagAssignments
+ }
+
+ // rebuild 'relationship-list'
+ def rebuildRelationship(xmlInput) {
+ def rebuildingSubnets = ""
+ if (xmlInput!=null) {
+ def subnetsData = new XmlSlurper().parseText(xmlInput)
+ rebuildingSubnets += "<relationship-list>"
+ def relationships = subnetsData.'**'.findAll {it.name() == "relationship"}
+ def relationshipsSize = relationships.size()
+ for (i in 0..relationshipsSize-1) {
+ def relationship = relationships[i]
+ def relationshipXml = XmlUtil.serialize(relationship)
+ rebuildingSubnets += "<relationship>"
+ def relationshipList = ["related-to", "related-link"]
+ rebuildingSubnets += buildSubNetworkElements(relationshipXml, "", relationshipList, "")
+ if (utils.nodeExists(relationshipXml, 'relationship-data')) {
+ def relationshipDataXmlData = new XmlSlurper().parseText(relationshipXml)
+ def relationshipsData = relationshipDataXmlData.'**'.findAll {it.name() == "relationship-data"}
+ def relationshipsDataSize = relationshipsData.size()
+ for (j in 0..relationshipsDataSize-1) {
+ def relationshipData = relationshipsData[j]
+ def relationshipDataXml = XmlUtil.serialize(relationshipData)
+ def relationshipDataList = ["relationship-key", "relationship-value"]
+ rebuildingSubnets += buildXMLElements(relationshipDataXml, "", "relationship-data", relationshipDataList)
+ }
+ }
+ if (utils.nodeExists(relationshipXml, 'related-to-property')) {
+ def relationshipDataXmlData = new XmlSlurper().parseText(relationshipXml)
+ def relationshipsData = relationshipDataXmlData.'**'.findAll {it.name() == "related-to-property"}
+ def relationshipsDataSize = relationshipsData.size()
+ for (j in 0..relationshipsDataSize-1) {
+ def relationshipData = relationshipsData[j]
+ def relationshipDataXml = XmlUtil.serialize(relationshipData)
+ def relationshipDataList = ["property-key", "property-value"]
+ rebuildingSubnets += buildXMLElements(relationshipDataXml, "", "related-to-property", relationshipDataList)
+ }
+ }
+
+ rebuildingSubnets += "</relationship>"
+ }
+ rebuildingSubnets += "</relationship-list>"
+ }
+ return rebuildingSubnets
+ }
+
+ def buildVlans(queryIdResponse) {
+ def rebuildingSubnets = "<vlans>"
+ def subnetsData = new XmlSlurper().parseText(queryIdResponse)
+
+ try {
+ def subnets = subnetsData.'**'.findAll {it.name() == "segmentation-assignments"}
+ def subnetsSize = subnets.size()
+ for (i in 0..subnetsSize-1) {
+ def subnet = subnets[i]
+ def subnetXml = XmlUtil.serialize(subnet)
+
+ String vlan = utils.getNodeText1(subnetXml, "segmentation-id")
+ if (i>0){
+ rebuildingSubnets += ","
+ }
+ rebuildingSubnets += vlan
+ }
+ } catch (Exception ex) {
+ //
+ } finally {
+ //rebuildingSubnets += "</subnets>"
+ rebuildingSubnets += "</vlans>"
+ }
+ return rebuildingSubnets
+ }
+
+ /* Utility code to rebuild xml/elements in a list:
+ * rebuild xml with 1) unbounded groups of elements; or
+ * 2) one group of elements; or
+ * 3) just one or more elements (in a list as argument)
+ * @param xmlInput the XML document
+ * @param parentName the parent name (ex: 'inputs')
+ * @param childrenName the chilrendName (ex: 'entry' as unbounded/occurs>1)
+ * @param elementList the element list of children (ex: 'key', 'value')
+ * @return a string of rebuild xml
+ *
+ * Ex 1: xmlInput:
+ * <ws:inputs>
+ * <ws:entry>
+ * <ws:key>name</ws:key>
+ * <ws:value>Edward</ws:value>
+ * </ws:entry>
+ * <ws:entry>
+ * <ws:key>age</ws:key>
+ * <ws:value>30</ws:value>
+ * </ws:entry>
+ * <ws:entry>
+ * <ws:key>age</ws:key>
+ * <ws:value>30</ws:value>
+ * </ws:entry>
+ * <ws:/inputs>
+ * Usage:
+ * List elementList = ["key", "value"]
+ * String rebuild = buildXMLElements(xmlInput, "inputs", "entry", elementList)
+ *
+ * Ex 2: xmlInput // no parent tag
+ * <ws:sdnc-request-header>
+ * <ws:svc-request-id>fec8ec88-151a-45c9-ad60-8233e0fc8ff2</ws:svc-request-id>
+ * <ws:svc-notification-url>https://msojra.mtsnj.aic.cip.openecomp.com:8443/adapters/rest/SDNCNotify</ws:svc-notification-url>
+ * <ws:svc-action>assign</ws:svc-action>
+ * </ws:sdnc-request-header>
+ * Usage:
+ * List elementList = ["svc-request-id", "svc-notification-url", "svc-action"]
+ * String rebuild = buildXMLElements(xmlInput, "" , "sdnc-request-header", elementList) // no parent tag
+ *
+ * Ex 3: xmlInput // elements one after another (with no parent & children tag)
+ * <ws:test-id>myTestid</ws:test-id>
+ * <ws:test-user>myUser</ws:test-user>
+ * Usage:
+ * List elementList = ["test-id", "test-user"]
+ * String rebuild = buildXMLElements(xmlInput, "" , "", elementList)
+ *
+ */
+ def buildXMLElements(xmlInput, parentName, childrenName, elementList) {
+ def varChildren = ""
+ def var = ""
+ def xmlBuildUnbounded = ""
+ if (parentName!="") {xmlBuildUnbounded += "<"+parentName+">" +'\n'}
+ if (xmlInput != null) {
+ def xml= new XmlSlurper().parseText(xmlInput)
+ if (childrenName!="") {
+ varChildren = xml.'**'.findAll {it.name() == childrenName}
+ for (i in 0..varChildren.size()-1) {
+ xmlBuildUnbounded += "<"+childrenName+">" +'\n'
+ for (element in elementList) {
+ var = varChildren[i].'*'.find {it.name() == element}
+ if (var != null) {
+ xmlBuildUnbounded += "<"+element+">"+var.toString()+"</"+element+">" +'\n'
+ }
+ }
+ xmlBuildUnbounded += "</"+childrenName+">" +'\n'
+ }
+ } else {
+ for (element in elementList) {
+ var = xml.'*'.find {it.name() == element}
+ if (var != null) {
+ xmlBuildUnbounded += "<"+element+">"+var.toString()+"</"+element+">" +'\n'
+ }
+ }
+ }
+
+ }
+ if (parentName!="") {xmlBuildUnbounded += "</"+parentName+">" +'\n'}
+ return xmlBuildUnbounded
+ }
+
+ def getFirstNodeXml(xmlInput, element){
+ def nodeAsText = ""
+ def nodeToSerialize = ""
+ if (xmlInput != null) {
+ def fxml= new XmlSlurper().parseText(xmlInput)
+ if (utils.nodeExists(xmlInput, "payload")) {
+ nodeToSerialize = fxml.'payload'.'l3-network'.'*'.find {it.name() == element}
+ if (nodeToSerialize!=null) {
+ nodeAsText = XmlUtil.serialize(nodeToSerialize)
+ } else {
+ nodeAsText = ""
+ }
+
+ } else {
+ nodeToSerialize = fxml.'*'.find {it.name() == element}
+ if (nodeToSerialize!=null) {
+ nodeAsText = XmlUtil.serialize(nodeToSerialize)
+ } else {
+ nodeAsText = ""
+ }
+
+ }
+ }
+ return nodeAsText
+
+ }
+
+//TODO: This method still needs to be tested before using.
+ /**
+ *
+ * This method is similar to the gennetwork:ContrailNetworUpdateCompletedObject
+ * BPEL method. It extracts all of the required subnet information
+ * for each subnet listed with an orch status equal to the one provided
+ * and puts the corresponding infomation with the appropriate node for
+ * updating aai. The method sets the orch status for each subnet to active
+ *
+ * @param subnetsXml the entire subnets xml
+ * @param requestInput the request in the process
+ * @param queryIdResponse the response of REST AAI query by Id
+ * @param queryVpnBindingResponse the response of REST AAI query by vpn binding
+ * @param routeCollection the collection of vpnBinding's 'global-route-target'
+ * @return String request
+ */
+ public String networkUpdateSubnetInfo(String subnetsXml, String networkResponseXml){
+
+ String subnets = ""
+ StringBuilder sb = new StringBuilder()
+ InputSource source = new InputSource(new StringReader(subnetsXml));
+ DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
+ docFactory.setNamespaceAware(true)
+ DocumentBuilder docBuilder = docFactory.newDocumentBuilder()
+ Document xml = docBuilder.parse(source)
+ NodeList nodeList = xml.getElementsByTagNameNS("*", "subnet")
+ for (int x = 0; x < nodeList.getLength(); x++) {
+ Node node = nodeList.item(x)
+ String subnet = ""
+ if (node.getNodeType() == Node.ELEMENT_NODE) {
+ Element eElement = (Element) node
+ String subnetOrchStatus = eElement.getElementsByTagNameNS("*", "orchestration-status").item(0).getTextContent()
+ if(subnetOrchStatus.equals("pending-create")){
+
+ String subnetId = eElement.getElementsByTagNameNS("*", "subnet-id").item(0).getTextContent()
+ def netAddress = eElement.getElementsByTagNameNS("*", "network-start-address").item(0).getTextContent()
+ def mask = eElement.getElementsByTagNameNS("*", "cidr-mask").item(0).getTextContent()
+ def dhcpEnabledSubnet = eElement.getElementsByTagNameNS("*", "dhcp-enabled").item(0).getTextContent()
+ def gatewayAddress = eElement.getElementsByTagNameNS("*", "gateway-address").item(0).getTextContent()
+ def ipVersion = eElement.getElementsByTagNameNS("*", "ip-version").item(0).getTextContent()
+ def relationshipList = eElement.getElementsByTagNameNS("*", "relationship-list").item(0).getTextContent() //TODO: test this
+ String neutronSubnetId = extractNeutSubId(networkResponseXml, subnetId)
+ subnet =
+ """<subnet>
+ <subnetId>${subnetId}</subnetId>
+ <neutron-subnet-id>${neutronSubnetId}</neutron-subnet-id>
+ <gateway-address>${gatewayAddress}</gateway-address>
+ <network-start-address>${netAddress}</network-start-address>
+ <cidr-mask>${mask}</cidr-mask>
+ <ip-Version>${ipVersion}</ip-Version>
+ <orchestration-status>active</orchestration-status>
+ <dhcp-enabled>${dhcpEnabledSubnet}</dhcp-enabled>
+ <relationship-list>${relationshipList}</relationship-list>
+ </subnet>"""
+
+ }else if(subnetOrchStatus.equals("pending-delete")){
+ StringWriter writer = new StringWriter()
+ Transformer transformer = TransformerFactory.newInstance().newTransformer()
+ transformer.transform(new DOMSource(node), new StreamResult(writer))
+ subnet = writer.toString()
+
+ }else{
+ subnet = ""
+ }
+ }
+ subnets = sb.append(subnet)
+ }
+
+ subnets = utils.removeXmlPreamble(subnets)
+
+ String subnetsList =
+ """<subnets>
+ ${subnets}
+ </subnets>"""
+
+ return subnetsList
+ }
+
+
+ /**
+ *
+ * This method extracts the "value" node text for the the given subnet Id.
+ *
+ * @param String inputSource - xml that contains the subnet id key and value
+ * @param String subnetId - for which you want the value of
+
+ * @return String value - node text of node named value associated with the given subnet id
+ */
+ public String extractNeutSubId(String inputSource, String subnetId){
+
+ String value = ""
+ InputSource source = new InputSource(new StringReader(inputSource));
+ DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
+ docFactory.setNamespaceAware(true)
+ DocumentBuilder docBuilder = docFactory.newDocumentBuilder()
+ Document xml = docBuilder.parse(source)
+ NodeList nodeList = xml.getElementsByTagNameNS("*", "entry")
+ for (int x = 0; x < nodeList.getLength(); x++) {
+ Node node = nodeList.item(x)
+ String subnet = ""
+ if (node.getNodeType() == Node.ELEMENT_NODE) {
+ Element eElement = (Element) node
+ String key = eElement.getElementsByTagNameNS("*", "key").item(0).getTextContent()
+ if(key.equals(subnetId)){
+ value = eElement.getElementsByTagNameNS("*", "value").item(0).getTextContent()
+ }
+ }
+ }
+ return value
+ }
+
+ public boolean isRollbackEnabled (Execution execution, String payloadXml) {
+
+ def rollbackEnabled = false
+ def rollbackValueSet = false
+ if (utils.nodeExists(payloadXml, "backout-on-failure")) {
+ String backoutValue = utils.getNodeText1(payloadXml, "backout-on-failure")
+ if (backoutValue != null && !backoutValue.isEmpty()) {
+ if (backoutValue.equalsIgnoreCase("false")) {
+ rollbackEnabled = false
+ }
+ else {
+ rollbackEnabled = true
+ }
+ rollbackValueSet = true;
+ }
+ }
+
+ if (!rollbackValueSet) {
+ if (execution.getVariable("URN_mso_rollback") != null) {
+ rollbackEnabled = execution.getVariable("URN_mso_rollback").toBoolean()
+ }
+ }
+ return rollbackEnabled
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/PrepareUpdateAAIVfModule.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/PrepareUpdateAAIVfModule.groovy
index e64fda6356..f30692c409 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/PrepareUpdateAAIVfModule.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/PrepareUpdateAAIVfModule.groovy
@@ -1,368 +1,374 @@
-/*-
- * ============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.common.scripts
-
-import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.runtime.Execution
-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 org.springframework.web.util.UriUtils
-
-public class PrepareUpdateAAIVfModule extends VfModuleBase {
-
- /**
- * Initialize the flow's variables.
- *
- * @param execution The flow's execution instance.
- */
- public void initProcessVariables(Execution execution) {
- execution.setVariable('prefix', 'PUAAIVfMod_')
- execution.setVariable('PUAAIVfMod_vnfId', null)
- execution.setVariable('PUAAIVfMod_vfModuleId', null)
- execution.setVariable('PUAAIVfMod_vnfName', null)
- execution.setVariable('PUAAIVfMod_orchestrationStatus', null)
- execution.setVariable('PUAAIVfMod_vfModule', null)
- execution.setVariable('PUAAIVfMod_vfModuleOK', false)
- execution.setVariable('PUAAIVfMod_vfModuleValidationError', null)
- execution.setVariable('PUAAIVfMod_getVnfResponseCode' ,null)
- execution.setVariable('PUAAIVfMod_getVnfResponse', '')
- execution.setVariable('PUAAIVfMod_updateVfModuleResponseCode', null)
- execution.setVariable('PUAAIVfMod_updateVfModuleResponse', '')
- execution.setVariable('PUAAIVfMod_outVfModule', null)
- }
-
- /**
- * Check for missing elements in the received request.
- *
- * @param execution The flow's execution instance.
- */
- public void preProcessRequest(Execution execution) {
- def method = getClass().getSimpleName() + '.preProcessRequest(' +
- 'execution=' + execution.getId() +
- ')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- try {
- def xml = execution.getVariable('PrepareUpdateAAIVfModuleRequest')
- logDebug('Received request xml:\n' + xml, isDebugLogEnabled)
- utils.logAudit("PrepareUpdateAAIVfModule Request : " + xml)
-
- initProcessVariables(execution)
-
- def vnfId = getRequiredNodeText(execution, xml,'vnf-id')
- execution.setVariable('PUAAIVfMod_vnfId', vnfId)
-
- def vfModuleId = getRequiredNodeText(execution, xml,'vf-module-id')
- execution.setVariable('PUAAIVfMod_vfModuleId', vfModuleId)
-
- def orchestrationStatus = getRequiredNodeText(execution, xml,'orchestration-status')
- execution.setVariable('PUAAIVfMod_orchestrationStatus', orchestrationStatus)
-
- logDebug('Exited ' + method, isDebugLogEnabled)
- } catch (BpmnError e) {
- throw e;
- } catch (Exception e) {
- logError('Caught exception in ' + method, e)
- createWorkflowException(execution, 1002, 'Error in preProcessRequest(): ' + e.getMessage())
- }
- }
-
- /**
- * Using the received vnfId, query AAI to get the corresponding Generic VNF.
- * A 200 response is expected with the Generic VNF in the response body.
- *
- * @param execution The flow's execution instance.
- */
- public void getGenericVnf(Execution execution) {
- def method = getClass().getSimpleName() + '.getGenericVnf(' +
- 'execution=' + execution.getId() +
- ')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- try {
- def vnfId = execution.getVariable('PUAAIVfMod_vnfId')
-
- AaiUtil aaiUriUtil = new AaiUtil(this)
- def aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution)
- logDebug('AAI URI is: ' + aai_uri, isDebugLogEnabled)
-
- String endPoint = execution.getVariable("URN_aai_endpoint") + "${aai_uri}/" + UriUtils.encode(vnfId, "UTF-8") + "?depth=1"
-
- utils.logAudit("PrepareUpdateAAIVfModule: AAI endPoint : " + endPoint)
- String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey"))
- try {
- RESTConfig config = new RESTConfig(endPoint);
- def responseData = ''
- def aaiRequestId = UUID.randomUUID().toString()
- RESTClient client = new RESTClient(config).
- addHeader('X-TransactionId', aaiRequestId).
- addHeader('X-FromAppId', 'MSO').
- addHeader('Content-Type', 'application/xml').
- addHeader('Accept','application/xml');
- if (basicAuthCred != null && !"".equals(basicAuthCred)) {
- client.addAuthorizationHeader(basicAuthCred)
- }
- logDebug('sending GET to AAI endpoint \'' + endPoint + '\'', isDebugLogEnabled)
- APIResponse response = client.httpGet()
- utils.logAudit("PrepareUpdateAAIVfModule: - invoking httpGet to AAI")
-
- responseData = response.getResponseBodyAsString()
- execution.setVariable('PUAAIVfMod_getVnfResponseCode', response.getStatusCode())
- execution.setVariable('PUAAIVfMod_getVnfResponse', responseData)
-
- utils.logAudit("PrepareUpdateAAIVfModule: AAI Response : " + responseData)
- utils.logAudit("PrepareUpdateAAIVfModule: AAI ResponseCode : " + response.getStatusCode())
-
- logDebug('Response code:' + response.getStatusCode(), isDebugLogEnabled)
- logDebug('Response:' + System.lineSeparator() + responseData, isDebugLogEnabled)
- } catch (Exception ex) {
- ex.printStackTrace()
- logDebug('Exception occurred while executing AAI GET:' + ex.getMessage(), isDebugLogEnabled)
- execution.setVariable('PUAAIVfMod_getVnfResponseCode', 500)
- execution.setVariable('PUAAIVfMod_getVnfResponse', 'AAI GET Failed:' + ex.getMessage())
- }
- logDebug('Exited ' + method, isDebugLogEnabled)
- } catch (BpmnError e) {
- throw e;
- } catch (Exception e) {
- logError('Caught exception in ' + method, e)
- createWorkflowException(execution, 1002, 'Error in getGenericVnf(): ' + e.getMessage())
- }
- }
-
- /**
- * Validate the VF Module. That is, confirm that a VF Module with the input VF Module ID
- * exists in the retrieved Generic VNF. Then, check to make sure that if that VF Module
- * is the base VF Module and it's not the only VF Module for this Generic VNF, that we're not
- * attempting to delete it.
- *
- * @param execution The flow's execution instance.
- */
- public void validateVfModule(Execution execution) {
- def method = getClass().getSimpleName() + '.validateVfModule(' +
- 'execution=' + execution.getId() +
- ')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- try {
- def genericVnf = execution.getVariable('PUAAIVfMod_getVnfResponse')
- def vnfId = execution.getVariable('PUAAIVfMod_vnfId')
- def vfModuleId = execution.getVariable('PUAAIVfMod_vfModuleId')
- def vnfName = getNodeTextForce(genericVnf, 'vnf-name')
- execution.setVariable('PUAAIVfMod_vnfName', vnfName)
- def VfModule vfModule = findVfModule(genericVnf, vfModuleId)
- if (vfModule == null) {
- def String msg = 'VF Module \'' + vfModuleId + '\' does not exist in Generic VNF \'' + vnfId + '\''
- execution.setVariable('PUAAIVfMod_vfModuleValidationError', msg)
- execution.setVariable('PUAAIVfMod_vfModuleOK', false)
- } else {
- def orchestrationStatus = execution.getVariable('PUAAIVfMod_orchestrationStatus')
- if (isDebugLogEnabled) {
- logDebug('VF Module \'' + vfModuleId + '\': isBaseVfModule=' + vfModule.isBaseVfModule() +
- ', isOnlyVfModule=' + vfModule.isOnlyVfModule() + ', new orchestration-status=' + orchestrationStatus,
- isDebugLogEnabled)
- }
- if (vfModule.isBaseVfModule() && !vfModule.isOnlyVfModule() && orchestrationStatus.equals('pending-delete')) {
- def String msg = 'Orchestration status for VF Module \'' + vfModuleId +
- '\' cannot be set to \'pending-delete\' since it is the base VF Module and it\'s not the only VF Module in Generic VNF \'' + vnfId + '\''
- execution.setVariable('PUAAIVfMod_vfModuleValidationError', msg)
- execution.setVariable('PUAAIVfMod_vfModuleOK', false)
- } else {
- execution.setVariable('PUAAIVfMod_vfModule', vfModule)
- execution.setVariable('PUAAIVfMod_vfModuleOK', true)
- }
- }
-
- logDebug('Exited ' + method, isDebugLogEnabled)
- } catch (BpmnError e) {
- throw e;
- } catch (Exception e) {
- logError('Caught exception in ' + method, e)
- createWorkflowException(execution, 1002, 'Error in validateVfModule(): ' + e.getMessage())
- }
- }
-
- /**
- * Construct and send a PUT request to AAI to update the VF Module.
- *
- * @param execution The flow's execution instance.
- */
- public void updateVfModule(Execution execution) {
- def method = getClass().getSimpleName() + '.updateVfModule(' +
- 'execution=' + execution.getId() +
- ')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- try {
- // Construct payload
- def VfModule vfModule = (VfModule) execution.getVariable('PUAAIVfMod_vfModule')
- def Node newVfModuleNode = vfModule.getNode().clone()
- def orchestrationStatus = execution.getVariable('PUAAIVfMod_orchestrationStatus')
- def Node orchestrationStatusNode = utils.getChildNode(newVfModuleNode, 'orchestration-status')
- if (orchestrationStatusNode == null) {
- // Node doesn't exist, this should never happen, right?
- new Node(newVfModuleNode, 'orchestration-status', orchestrationStatus)
- } else {
- // Node already exists, just give it a new value
- orchestrationStatusNode.setValue(orchestrationStatus)
- }
- def VfModule newVfModule = new VfModule(newVfModuleNode, vfModule.isOnlyVfModule())
- def payload = utils.nodeToString(newVfModuleNode)
-
- utils.logAudit("VfModule payload : " + payload)
-
- // Construct endpoint
- def vnfId = execution.getVariable('PUAAIVfMod_vnfId')
- def vfModuleId = execution.getVariable('PUAAIVfMod_vfModuleId')
-
-
- AaiUtil aaiUriUtil = new AaiUtil(this)
- def aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution)
- logDebug('AAI URI is: ' + aai_uri, isDebugLogEnabled)
-
- String endPoint = execution.getVariable("URN_aai_endpoint") + "${aai_uri}/" + UriUtils.encode(vnfId, "UTF-8") + "/vf-modules/vf-module/" + UriUtils.encode(vfModuleId, "UTF-8")
- utils.logAudit("PrepareUpdateAAIVfModule: AAI endPoint : " + endPoint)
- String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey"))
- try {
- RESTConfig config = new RESTConfig(endPoint);
- def responseData = ''
- def aaiRequestId = UUID.randomUUID().toString()
- RESTClient client = new RESTClient(config).
- addHeader('X-TransactionId', aaiRequestId).
- addHeader('X-FromAppId', 'MSO').
- addHeader('Content-Type', 'application/xml').
- addHeader('Accept','application/xml');
- if (basicAuthCred != null && !"".equals(basicAuthCred)) {
- client.addAuthorizationHeader(basicAuthCred)
- }
- logDebug('sending PUT to AAI endpoint \'' + endPoint + '\'' + 'with payload \n' + payload, isDebugLogEnabled)
- APIResponse response = client.httpPut(payload)
- utils.logAudit("PrepareUpdateAAIVfModule: - invoking httpPut to AAI")
-
- responseData = response.getResponseBodyAsString()
- execution.setVariable('PUAAIVfMod_updateVfModuleResponseCode', response.getStatusCode())
- execution.setVariable('PUAAIVfMod_updateVfModuleResponse', responseData)
- logDebug('Response code:' + response.getStatusCode(), isDebugLogEnabled)
- logDebug('Response:' + System.lineSeparator() + responseData, isDebugLogEnabled)
- utils.logAudit("PrepareUpdateAAIVfModule: AAI Response : " + responseData)
- utils.logAudit("PrepareUpdateAAIVfModule: AAI ResponseCode : " + response.getStatusCode())
-
- // Set the output for this flow. The updated VfModule is an output, the generic VNF name, and for
- // backward compatibilty, the heat-stack-id is an output
- execution.setVariable('PUAAIVfMod_outVfModule', newVfModule)
- def vnfName = execution.getVariable('PUAAIVfMod_vnfName')
- logDebug('Output PUAAIVfMod_vnfName set to ' + vnfName, isDebugLogEnabled)
- // TODO: Should deprecate use of processKey+Response variable for the response. Will use "WorkflowResponse" instead
- execution.setVariable('WorkflowResponse', newVfModule)
- logDebug('Output PUAAIVfMod_outVfModule set for VF Module Id \'' + newVfModule.getElementText('vf-module-id') + '\'', isDebugLogEnabled)
- def heatStackId = newVfModule.getElementText('heat-stack-id')
- execution.setVariable('PUAAIVfMod_heatStackId', heatStackId)
- logDebug('Output PUAAIVfMod_heatStackId set to \'' + heatStackId + '\'', isDebugLogEnabled)
- } catch (Exception ex) {
- ex.printStackTrace()
- logDebug('Exception occurred while executing AAI PUT:' + ex.getMessage(), isDebugLogEnabled)
- execution.setVariable('PUAAIVfMod_updateVfModuleResponseCode', 500)
- execution.setVariable('PUAAIVfMod_updateVfModuleResponse', 'AAI PUT Failed:' + ex.getMessage())
- }
- logDebug('Exited ' + method, isDebugLogEnabled)
- } catch (BpmnError e) {
- throw e;
- } catch (Exception e) {
- logError('Caught exception in ' + method, e)
- createWorkflowException(execution, 1002, 'Error in updateVfModule(): ' + e.getMessage())
- }
- }
-
- /**
- * Generates a WorkflowException if the AAI query returns a response code other than 200.
- *
- * @param execution The flow's execution instance.
- */
- public void handleVnfNotFound(Execution execution) {
- def method = getClass().getSimpleName() + '.handleVnfNotFound(' +
- 'execution=' + execution.getId() +
- ')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- logError('Error occurred attempting to query AAI, Response Code ' +
- execution.getVariable('PUAAIVfMod_getVnfResponseCode') + ', Error Response ' +
- execution.getVariable('PUAAIVfMod_getVnfResponse'))
- String processKey = getProcessKey(execution);
- WorkflowException exception = new WorkflowException(processKey, 5000,
- execution.getVariable('PUAAIVfMod_getVnfResponse'))
- execution.setVariable('WorkflowException', exception)
-
- logDebug('Exited ' + method, isDebugLogEnabled)
- }
-
- /**
- * Generates a WorkflowException if the VF Module does not pass validation.
- *
- * @param execution The flow's execution instance.
- */
- public void handleVfModuleValidationError(Execution execution) {
- def method = getClass().getSimpleName() + '.handleVfModuleValidationError(' +
- 'execution=' + execution.getId() +
- ')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- def String errorMsg = 'VF Module validation error: ' + execution.getVariable('PUAAIVfMod_vfModuleValidationError')
- logError(errorMsg)
- utils.logAudit("PrepareUpdateAAIVfModule: Error Message : " + errorMsg)
-
- String processKey = getProcessKey(execution);
- WorkflowException exception = new WorkflowException(processKey, 5000, errorMsg)
- execution.setVariable('WorkflowException', exception)
-
- logDebug('Exited ' + method, isDebugLogEnabled)
- }
-
- /**
- * Generates a WorkflowException if updating a VF Module in AAI returns a response code other than 200.
- *
- * @param execution The flow's execution instance.
- */
- public void handleUpdateVfModuleFailure(Execution execution) {
- def method = getClass().getSimpleName() + '.handleUpdateVfModuleFailure(' +
- 'execution=' + execution.getId() +
- ')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- logError('Error occurred attempting to update VF Module in AAI, Response Code ' +
- execution.getVariable('PUAAIVfMod_updateVfModuleResponseCode') + ', Error Response ' +
- execution.getVariable('PUAAIVfMod_updateVfModuleResponse'))
- String processKey = getProcessKey(execution);
- WorkflowException exception = new WorkflowException(processKey, 5000,
- execution.getVariable('PUAAIVfMod_updateVfModuleResponse'))
- execution.setVariable('WorkflowException', exception)
-
- logDebug('Exited ' + method, isDebugLogEnabled)
- }
-}
+/*-
+ * ============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.common.scripts
+
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.runtime.Execution
+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 org.springframework.web.util.UriUtils
+
+public class PrepareUpdateAAIVfModule extends VfModuleBase {
+
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+ /**
+ * Initialize the flow's variables.
+ *
+ * @param execution The flow's execution instance.
+ */
+ public void initProcessVariables(Execution execution) {
+ execution.setVariable('prefix', 'PUAAIVfMod_')
+ execution.setVariable('PUAAIVfMod_vnfId', null)
+ execution.setVariable('PUAAIVfMod_vfModuleId', null)
+ execution.setVariable('PUAAIVfMod_vnfName', null)
+ execution.setVariable('PUAAIVfMod_orchestrationStatus', null)
+ execution.setVariable('PUAAIVfMod_vfModule', null)
+ execution.setVariable('PUAAIVfMod_vfModuleOK', false)
+ execution.setVariable('PUAAIVfMod_vfModuleValidationError', null)
+ execution.setVariable('PUAAIVfMod_getVnfResponseCode' ,null)
+ execution.setVariable('PUAAIVfMod_getVnfResponse', '')
+ execution.setVariable('PUAAIVfMod_updateVfModuleResponseCode', null)
+ execution.setVariable('PUAAIVfMod_updateVfModuleResponse', '')
+ execution.setVariable('PUAAIVfMod_outVfModule', null)
+ }
+
+ /**
+ * Check for missing elements in the received request.
+ *
+ * @param execution The flow's execution instance.
+ */
+ public void preProcessRequest(Execution execution) {
+ def method = getClass().getSimpleName() + '.preProcessRequest(' +
+ 'execution=' + execution.getId() +
+ ')'
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ logDebug('Entered ' + method, isDebugLogEnabled)
+
+ try {
+ def xml = execution.getVariable('PrepareUpdateAAIVfModuleRequest')
+ logDebug('Received request xml:\n' + xml, isDebugLogEnabled)
+ utils.logAudit("PrepareUpdateAAIVfModule Request : " + xml)
+
+ initProcessVariables(execution)
+
+ def vnfId = getRequiredNodeText(execution, xml,'vnf-id')
+ execution.setVariable('PUAAIVfMod_vnfId', vnfId)
+
+ def vfModuleId = getRequiredNodeText(execution, xml,'vf-module-id')
+ execution.setVariable('PUAAIVfMod_vfModuleId', vfModuleId)
+
+ def orchestrationStatus = getRequiredNodeText(execution, xml,'orchestration-status')
+ execution.setVariable('PUAAIVfMod_orchestrationStatus', orchestrationStatus)
+
+ logDebug('Exited ' + method, isDebugLogEnabled)
+ } catch (BpmnError e) {
+ throw e;
+ } catch (Exception e) {
+ logError('Caught exception in ' + method, e)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preProcessRequest(): ' + e.getMessage())
+ }
+ }
+
+ /**
+ * Using the received vnfId, query AAI to get the corresponding Generic VNF.
+ * A 200 response is expected with the Generic VNF in the response body.
+ *
+ * @param execution The flow's execution instance.
+ */
+ public void getGenericVnf(Execution execution) {
+ def method = getClass().getSimpleName() + '.getGenericVnf(' +
+ 'execution=' + execution.getId() +
+ ')'
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ logDebug('Entered ' + method, isDebugLogEnabled)
+
+ try {
+ def vnfId = execution.getVariable('PUAAIVfMod_vnfId')
+
+ AaiUtil aaiUriUtil = new AaiUtil(this)
+ def aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution)
+ logDebug('AAI URI is: ' + aai_uri, isDebugLogEnabled)
+
+ String endPoint = execution.getVariable("URN_aai_endpoint") + "${aai_uri}/" + UriUtils.encode(vnfId, "UTF-8") + "?depth=1"
+
+ utils.logAudit("PrepareUpdateAAIVfModule: AAI endPoint : " + endPoint)
+ String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey"))
+ try {
+ RESTConfig config = new RESTConfig(endPoint);
+ def responseData = ''
+ def aaiRequestId = UUID.randomUUID().toString()
+ RESTClient client = new RESTClient(config).
+ addHeader('X-TransactionId', aaiRequestId).
+ addHeader('X-FromAppId', 'MSO').
+ addHeader('Content-Type', 'application/xml').
+ addHeader('Accept','application/xml');
+ if (basicAuthCred != null && !"".equals(basicAuthCred)) {
+ client.addAuthorizationHeader(basicAuthCred)
+ }
+ logDebug('sending GET to AAI endpoint \'' + endPoint + '\'', isDebugLogEnabled)
+ APIResponse response = client.httpGet()
+ utils.logAudit("PrepareUpdateAAIVfModule: - invoking httpGet to AAI")
+
+ responseData = response.getResponseBodyAsString()
+ execution.setVariable('PUAAIVfMod_getVnfResponseCode', response.getStatusCode())
+ execution.setVariable('PUAAIVfMod_getVnfResponse', responseData)
+
+ utils.logAudit("PrepareUpdateAAIVfModule: AAI Response : " + responseData)
+ utils.logAudit("PrepareUpdateAAIVfModule: AAI ResponseCode : " + response.getStatusCode())
+
+ logDebug('Response code:' + response.getStatusCode(), isDebugLogEnabled)
+ logDebug('Response:' + System.lineSeparator() + responseData, isDebugLogEnabled)
+ } catch (Exception ex) {
+ ex.printStackTrace()
+ logDebug('Exception occurred while executing AAI GET:' + ex.getMessage(), isDebugLogEnabled)
+ execution.setVariable('PUAAIVfMod_getVnfResponseCode', 500)
+ execution.setVariable('PUAAIVfMod_getVnfResponse', 'AAI GET Failed:' + ex.getMessage())
+ }
+ logDebug('Exited ' + method, isDebugLogEnabled)
+ } catch (BpmnError e) {
+ throw e;
+ } catch (Exception e) {
+ logError('Caught exception in ' + method, e)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in getGenericVnf(): ' + e.getMessage())
+ }
+ }
+
+ /**
+ * Validate the VF Module. That is, confirm that a VF Module with the input VF Module ID
+ * exists in the retrieved Generic VNF. Then, check to make sure that if that VF Module
+ * is the base VF Module and it's not the only VF Module for this Generic VNF, that we're not
+ * attempting to delete it.
+ *
+ * @param execution The flow's execution instance.
+ */
+ public void validateVfModule(Execution execution) {
+ def method = getClass().getSimpleName() + '.validateVfModule(' +
+ 'execution=' + execution.getId() +
+ ')'
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ logDebug('Entered ' + method, isDebugLogEnabled)
+
+ try {
+ def genericVnf = execution.getVariable('PUAAIVfMod_getVnfResponse')
+ def vnfId = execution.getVariable('PUAAIVfMod_vnfId')
+ def vfModuleId = execution.getVariable('PUAAIVfMod_vfModuleId')
+ def vnfName = getNodeTextForce(genericVnf, 'vnf-name')
+ execution.setVariable('PUAAIVfMod_vnfName', vnfName)
+ def VfModule vfModule = findVfModule(genericVnf, vfModuleId)
+ if (vfModule == null) {
+ def String msg = 'VF Module \'' + vfModuleId + '\' does not exist in Generic VNF \'' + vnfId + '\''
+ execution.setVariable('PUAAIVfMod_vfModuleValidationError', msg)
+ execution.setVariable('PUAAIVfMod_vfModuleOK', false)
+ } else {
+ def orchestrationStatus = execution.getVariable('PUAAIVfMod_orchestrationStatus')
+ if (isDebugLogEnabled) {
+ logDebug('VF Module \'' + vfModuleId + '\': isBaseVfModule=' + vfModule.isBaseVfModule() +
+ ', isOnlyVfModule=' + vfModule.isOnlyVfModule() + ', new orchestration-status=' + orchestrationStatus,
+ isDebugLogEnabled)
+ }
+ if (vfModule.isBaseVfModule() && !vfModule.isOnlyVfModule() && orchestrationStatus.equals('pending-delete')) {
+ def String msg = 'Orchestration status for VF Module \'' + vfModuleId +
+ '\' cannot be set to \'pending-delete\' since it is the base VF Module and it\'s not the only VF Module in Generic VNF \'' + vnfId + '\''
+ execution.setVariable('PUAAIVfMod_vfModuleValidationError', msg)
+ execution.setVariable('PUAAIVfMod_vfModuleOK', false)
+ } else {
+ execution.setVariable('PUAAIVfMod_vfModule', vfModule)
+ execution.setVariable('PUAAIVfMod_vfModuleOK', true)
+ }
+ }
+
+ logDebug('Exited ' + method, isDebugLogEnabled)
+ } catch (BpmnError e) {
+ throw e;
+ } catch (Exception e) {
+ logError('Caught exception in ' + method, e)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in validateVfModule(): ' + e.getMessage())
+ }
+ }
+
+ /**
+ * Construct and send a PATCH request to AAI to update the VF Module.
+ *
+ * @param execution The flow's execution instance.
+ */
+ public void updateVfModule(Execution execution) {
+ def method = getClass().getSimpleName() + '.updateVfModule(' +
+ 'execution=' + execution.getId() +
+ ')'
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ logDebug('Entered ' + method, isDebugLogEnabled)
+
+ try {
+ // Construct payload
+ def VfModule vfModule = (VfModule) execution.getVariable('PUAAIVfMod_vfModule')
+ def Node newVfModuleNode = vfModule.getNode().clone()
+ def orchestrationStatus = execution.getVariable('PUAAIVfMod_orchestrationStatus')
+ def Node orchestrationStatusNode = utils.getChildNode(newVfModuleNode, 'orchestration-status')
+ if (orchestrationStatusNode == null) {
+ // Node doesn't exist, this should never happen, right?
+ new Node(newVfModuleNode, 'orchestration-status', orchestrationStatus)
+ } else {
+ // Node already exists, just give it a new value
+ orchestrationStatusNode.setValue(orchestrationStatus)
+ }
+ def VfModule newVfModule = new VfModule(newVfModuleNode, vfModule.isOnlyVfModule())
+ //def payload = utils.nodeToString(newVfModuleNode)
+
+ // Construct endpoint
+ def vnfId = execution.getVariable('PUAAIVfMod_vnfId')
+ def vfModuleId = execution.getVariable('PUAAIVfMod_vfModuleId')
+
+ def payload = """{
+ "vf-module-id": "${vfModuleId}",
+ "orchestration-status": "${orchestrationStatus}"
+ }"""
+
+ utils.logAudit("VfModule payload : " + payload)
+
+ AaiUtil aaiUriUtil = new AaiUtil(this)
+ def aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution)
+ logDebug('AAI URI is: ' + aai_uri, isDebugLogEnabled)
+
+ String endPoint = execution.getVariable("URN_aai_endpoint") + "${aai_uri}/" + UriUtils.encode(vnfId, "UTF-8") + "/vf-modules/vf-module/" + UriUtils.encode(vfModuleId, "UTF-8")
+ utils.logAudit("PrepareUpdateAAIVfModule: AAI endPoint : " + endPoint)
+ String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey"))
+ try {
+ RESTConfig config = new RESTConfig(endPoint);
+ def responseData = ''
+ def aaiRequestId = UUID.randomUUID().toString()
+ RESTClient client = new RESTClient(config).
+ addHeader('X-TransactionId', aaiRequestId).
+ addHeader('X-FromAppId', 'MSO').
+ addHeader('Content-Type', 'application/merge-patch+json').
+ addHeader('Accept','application/json');
+ if (basicAuthCred != null && !"".equals(basicAuthCred)) {
+ client.addAuthorizationHeader(basicAuthCred)
+ }
+ logDebug('sending PATCH to AAI endpoint \'' + endPoint + '\'' + 'with payload \n' + payload, isDebugLogEnabled)
+ APIResponse response = client.httpPatch(payload)
+ utils.logAudit("PrepareUpdateAAIVfModule: - invoking httpPatch to AAI")
+ utils.logAudit("PrepareUpdateAAIVfModule: - invoking httpPatch to AAI")
+
+ responseData = response.getResponseBodyAsString()
+ execution.setVariable('PUAAIVfMod_updateVfModuleResponseCode', response.getStatusCode())
+ execution.setVariable('PUAAIVfMod_updateVfModuleResponse', responseData)
+ logDebug('Response code:' + response.getStatusCode(), isDebugLogEnabled)
+ logDebug('Response:' + System.lineSeparator() + responseData, isDebugLogEnabled)
+ utils.logAudit("PrepareUpdateAAIVfModule: AAI Response : " + responseData)
+ utils.logAudit("PrepareUpdateAAIVfModule: AAI ResponseCode : " + response.getStatusCode())
+
+ // Set the output for this flow. The updated VfModule is an output, the generic VNF name, and for
+ // backward compatibilty, the heat-stack-id is an output
+ execution.setVariable('PUAAIVfMod_outVfModule', newVfModule)
+ def vnfName = execution.getVariable('PUAAIVfMod_vnfName')
+ logDebug('Output PUAAIVfMod_vnfName set to ' + vnfName, isDebugLogEnabled)
+ // TODO: Should deprecate use of processKey+Response variable for the response. Will use "WorkflowResponse" instead
+ execution.setVariable('WorkflowResponse', newVfModule)
+ logDebug('Output PUAAIVfMod_outVfModule set for VF Module Id \'' + newVfModule.getElementText('vf-module-id') + '\'', isDebugLogEnabled)
+ def heatStackId = newVfModule.getElementText('heat-stack-id')
+ execution.setVariable('PUAAIVfMod_heatStackId', heatStackId)
+ logDebug('Output PUAAIVfMod_heatStackId set to \'' + heatStackId + '\'', isDebugLogEnabled)
+ } catch (Exception ex) {
+ ex.printStackTrace()
+ logDebug('Exception occurred while executing AAI PUT:' + ex.getMessage(), isDebugLogEnabled)
+ execution.setVariable('PUAAIVfMod_updateVfModuleResponseCode', 500)
+ execution.setVariable('PUAAIVfMod_updateVfModuleResponse', 'AAI PATCH Failed:' + ex.getMessage())
+ }
+ logDebug('Exited ' + method, isDebugLogEnabled)
+ } catch (BpmnError e) {
+ throw e;
+ } catch (Exception e) {
+ logError('Caught exception in ' + method, e)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in updateVfModule(): ' + e.getMessage())
+ }
+ }
+
+ /**
+ * Generates a WorkflowException if the AAI query returns a response code other than 200.
+ *
+ * @param execution The flow's execution instance.
+ */
+ public void handleVnfNotFound(Execution execution) {
+ def method = getClass().getSimpleName() + '.handleVnfNotFound(' +
+ 'execution=' + execution.getId() +
+ ')'
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ logDebug('Entered ' + method, isDebugLogEnabled)
+
+ logError('Error occurred attempting to query AAI, Response Code ' +
+ execution.getVariable('PUAAIVfMod_getVnfResponseCode') + ', Error Response ' +
+ execution.getVariable('PUAAIVfMod_getVnfResponse'))
+ String processKey = getProcessKey(execution);
+ WorkflowException exception = new WorkflowException(processKey, 5000,
+ execution.getVariable('PUAAIVfMod_getVnfResponse'))
+ execution.setVariable('WorkflowException', exception)
+
+ logDebug('Exited ' + method, isDebugLogEnabled)
+ }
+
+ /**
+ * Generates a WorkflowException if the VF Module does not pass validation.
+ *
+ * @param execution The flow's execution instance.
+ */
+ public void handleVfModuleValidationError(Execution execution) {
+ def method = getClass().getSimpleName() + '.handleVfModuleValidationError(' +
+ 'execution=' + execution.getId() +
+ ')'
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ logDebug('Entered ' + method, isDebugLogEnabled)
+
+ def String errorMsg = 'VF Module validation error: ' + execution.getVariable('PUAAIVfMod_vfModuleValidationError')
+ logError(errorMsg)
+ utils.logAudit("PrepareUpdateAAIVfModule: Error Message : " + errorMsg)
+
+ String processKey = getProcessKey(execution);
+ WorkflowException exception = new WorkflowException(processKey, 5000, errorMsg)
+ execution.setVariable('WorkflowException', exception)
+
+ logDebug('Exited ' + method, isDebugLogEnabled)
+ }
+
+ /**
+ * Generates a WorkflowException if updating a VF Module in AAI returns a response code other than 200.
+ *
+ * @param execution The flow's execution instance.
+ */
+ public void handleUpdateVfModuleFailure(Execution execution) {
+ def method = getClass().getSimpleName() + '.handleUpdateVfModuleFailure(' +
+ 'execution=' + execution.getId() +
+ ')'
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ logDebug('Entered ' + method, isDebugLogEnabled)
+
+ logError('Error occurred attempting to update VF Module in AAI, Response Code ' +
+ execution.getVariable('PUAAIVfMod_updateVfModuleResponseCode') + ', Error Response ' +
+ execution.getVariable('PUAAIVfMod_updateVfModuleResponse'))
+ String processKey = getProcessKey(execution);
+ WorkflowException exception = new WorkflowException(processKey, 5000,
+ execution.getVariable('PUAAIVfMod_updateVfModuleResponse'))
+ execution.setVariable('WorkflowException', exception)
+
+ logDebug('Exited ' + method, isDebugLogEnabled)
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapter.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapter.groovy
index d83f46e85f..0f05a6b82c 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapter.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapter.groovy
@@ -1,326 +1,334 @@
-/*-
- * ============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.common.scripts;
-
-import java.text.SimpleDateFormat
-
-import org.camunda.bpm.engine.runtime.Execution
-import org.openecomp.mso.bpmn.core.WorkflowException
-
-
-// SDNC Adapter Request/Response processing
-
-public class SDNCAdapter extends AbstractServiceTaskProcessor {
-
- def Prefix="SDNCA_"
- ExceptionUtil exceptionUtil = new ExceptionUtil()
-
- // Script Task: Process SDNC Workflow Request
- // Params: Workflow Execution
- // Assume: Received SDNCAdapterWorkflowRequest is in variable 'sdncAdapterWorkflowRequest'
- // Put created SDNCAdapterRequest in variable 'sdncAdapterRequest'
- public void preProcessRequest (Execution execution) {
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- try{
-
- utils.log("DEBUG", "=========== Begin PreProcess SDNCAdapterRequestScript ===========", isDebugEnabled)
- utils.log("DEBUG", "Incoming sdncAdapterWorkflowRequest:\n" + execution.getVariable("sdncAdapterWorkflowRequest"), isDebugEnabled)
-
- // Initialize some variables used throughout the flow
- execution.setVariable("prefix", Prefix)
- execution.setVariable("sdncAdapterResponse", "")
- execution.setVariable("asynchronousResponseTimeout", false)
- execution.setVariable("continueListening", false)
- execution.setVariable("SDNCA_SuccessIndicator", false)
-
- // Authorization Info
- String basicAuthValue = execution.getVariable("URN_mso_adapters_po_auth")
- utils.log("DEBUG", "Obtained BasicAuth userid password for sdnc adapter:" + basicAuthValue, isDebugEnabled)
- try {
- def encodedString = utils.getBasicAuth(basicAuthValue, execution.getVariable("URN_mso_msoKey"))
- execution.setVariable("BasicAuthHeaderValue",encodedString)
- } catch (IOException ex) {
- utils.log("ERROR", "Unable to encode username password string")
- }
-
- // TODO Use variables instead of passing xml request - Huh?
-
- // Get original RequestHeader
- def sdncwfreq= execution.getVariable("sdncAdapterWorkflowRequest")
- def requestHeader = utils.getNodeXml(sdncwfreq, "RequestHeader")
- requestHeader = requestHeader.replace("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n", "")
- utils.log("DEBUG", "RequestHeader:\n" + requestHeader, isDebugEnabled)
-
- // Set Callback URL to use from URN Mapping or jBoss Property
- def origCallbackUrl = utils.getNodeText(requestHeader, "CallbackUrl")
- def callbackUrlToUse = execution.getVariable("URN_mso_workflow_sdncadapter_callback")
- MsoUtils msoUtil = new MsoUtils()
- def useQualifiedHostName = execution.getVariable("URN_mso_use_qualified_host")
- if((useQualifiedHostName!=null) && (useQualifiedHostName.equals("true"))){
- callbackUrlToUse = msoUtil.getQualifiedHostNameForCallback(callbackUrlToUse)
- }
- utils.log("DEBUG", "Callback URL to use:\n" + callbackUrlToUse, isDebugEnabled)
- requestHeader = requestHeader.replace(origCallbackUrl, callbackUrlToUse)
-
- // Get parameters from request header
- def sdnca_svcInstanceId = utils.getNodeText1(requestHeader, "SvcInstanceId") // optional
- utils.log("DEBUG", "SvcInstanceId: " + sdnca_svcInstanceId, isDebugEnabled)
- def sdnca_msoAction = utils.getNodeText1(requestHeader, "MsoAction") // optional
- utils.log("DEBUG", "MsoAction: " + sdnca_msoAction, isDebugEnabled)
- def sdnca_svcAction = utils.getNodeText(requestHeader, "SvcAction")
- utils.log("DEBUG", "SvcAction: " + sdnca_svcAction, isDebugEnabled)
- def sdnca_svcOperation = utils.getNodeText(requestHeader, "SvcOperation")
- utils.log("DEBUG", "SvcOperation: " + sdnca_svcOperation, isDebugEnabled)
- def sdncRequestData = utils.getChildNodes(sdncwfreq, "SDNCRequestData")
- sdncRequestData = sdncRequestData.replace("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n", "")
- sdncRequestData = sdncRequestData.replaceAll('tag0:', '').replaceAll(':tag0', '')
- utils.log("DEBUG", "SDNCRequestData:\n" + sdncRequestData, isDebugEnabled)
- def sdnca_serviceType = ""
- if (utils.nodeExists(sdncwfreq, "service-type")) {
- sdnca_serviceType = utils.getNodeText(sdncwfreq, "service-type")
- }
- utils.log("DEBUG", "service-type: " + sdnca_serviceType, isDebugEnabled)
- def serviceConfigActivate = false
- def source = ''
- if ((sdnca_svcAction == 'activate') && (sdnca_svcOperation == 'service-configuration-operation') && (sdnca_serviceType == 'uCPE-VMS')) {
- serviceConfigActivate = true
- if (utils.nodeExists(sdncwfreq, 'source')) {
- source = utils.getNodeText(sdncwfreq, 'source')
- }
- }
- execution.setVariable("serviceConfigActivate", serviceConfigActivate)
- utils.log("DEBUG", "serviceConfigActivate: " + serviceConfigActivate, isDebugEnabled)
- execution.setVariable("source", source)
- utils.log("DEBUG", "source: " + source, isDebugEnabled)
-
- //calling process should pass a generated uuid if sending multiple sdnc requests
- def requestId = utils.getNodeText(requestHeader, "RequestId")
- execution.setVariable(Prefix + "requestId", requestId)
-
- // Prepare SDNC Request to the SDNC Adapter
- String sdncAdapterRequest = """
- <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
- <SOAP-ENV:Body>
- <aetgt:SDNCAdapterRequest xmlns:aetgt="http://org.openecomp/workflow/sdnc/adapter/schema/v1" xmlns:sdncadaptersc="http://org.openecomp/workflow/sdnc/adapter/schema/v1">
- <sdncadapter:RequestHeader xmlns:sdncadapter="http://org.openecomp/workflow/sdnc/adapter/schema/v1">
- <sdncadapter:RequestId>${requestId}</sdncadapter:RequestId>"""
-
- if (sdnca_svcInstanceId != null) {
- sdncAdapterRequest += """
- <sdncadapter:SvcInstanceId>${sdnca_svcInstanceId}</sdncadapter:SvcInstanceId>"""
- }
-
- sdncAdapterRequest += """
- <sdncadapter:SvcAction>${sdnca_svcAction}</sdncadapter:SvcAction>
- <sdncadapter:SvcOperation>${sdnca_svcOperation}</sdncadapter:SvcOperation>
- <sdncadapter:CallbackUrl>${callbackUrlToUse}</sdncadapter:CallbackUrl>"""
-
- if (sdnca_msoAction != null) {
- sdncAdapterRequest += """
- <sdncadapter:MsoAction>${sdnca_msoAction}</sdncadapter:MsoAction>"""
- }
-
- sdncAdapterRequest += """
- </sdncadapter:RequestHeader>
- <sdncadaptersc:RequestData>${sdncRequestData}</sdncadaptersc:RequestData></aetgt:SDNCAdapterRequest></SOAP-ENV:Body></SOAP-ENV:Envelope>"""
-
- utils.logAudit("Outgoing SDNCAdapterRequest:\n" + sdncAdapterRequest)
- execution.setVariable("sdncAdapterRequest", sdncAdapterRequest)
-
+/*-
+ * ============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.common.scripts;
+
+import java.text.SimpleDateFormat
+
+import org.camunda.bpm.engine.runtime.Execution
+import org.openecomp.mso.bpmn.core.WorkflowException
+
+
+// SDNC Adapter Request/Response processing
+
+public class SDNCAdapter extends AbstractServiceTaskProcessor {
+
+ def Prefix="SDNCA_"
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+
+ // Script Task: Process SDNC Workflow Request
+ // Params: Workflow Execution
+ // Assume: Received SDNCAdapterWorkflowRequest is in variable 'sdncAdapterWorkflowRequest'
+ // Put created SDNCAdapterRequest in variable 'sdncAdapterRequest'
+ public void preProcessRequest (Execution execution) {
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ try{
+
+ utils.log("DEBUG", "=========== Begin PreProcess SDNCAdapterRequestScript ===========", isDebugEnabled)
+ utils.log("DEBUG", "Incoming sdncAdapterWorkflowRequest:\n" + execution.getVariable("sdncAdapterWorkflowRequest"), isDebugEnabled)
+
+ // Initialize some variables used throughout the flow
+ execution.setVariable("prefix", Prefix)
+ execution.setVariable("sdncAdapterResponse", "")
+ execution.setVariable("asynchronousResponseTimeout", false)
+ execution.setVariable("continueListening", false)
+ execution.setVariable("SDNCA_SuccessIndicator", false)
+
+ // Authorization Info
+ String basicAuthValue = execution.getVariable("URN_mso_adapters_po_auth")
+ utils.log("DEBUG", "Obtained BasicAuth userid password for sdnc adapter:" + basicAuthValue, isDebugEnabled)
+ try {
+ def encodedString = utils.getBasicAuth(basicAuthValue, execution.getVariable("URN_mso_msoKey"))
+ execution.setVariable("BasicAuthHeaderValue",encodedString)
+ } catch (IOException ex) {
+ utils.log("ERROR", "Unable to encode username password string")
+ }
+
+ // TODO Use variables instead of passing xml request - Huh?
+
+ // Get original RequestHeader
+ def sdncwfreq= execution.getVariable("sdncAdapterWorkflowRequest")
+ def requestHeader = utils.getNodeXml(sdncwfreq, "RequestHeader")
+ requestHeader = requestHeader.replace("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n", "")
+ utils.log("DEBUG", "RequestHeader:\n" + requestHeader, isDebugEnabled)
+
+ // Set Callback URL to use from URN Mapping or jBoss Property
+ def origCallbackUrl = utils.getNodeText(requestHeader, "CallbackUrl")
+ def callbackUrlToUse = execution.getVariable("URN_mso_workflow_sdncadapter_callback")
+ MsoUtils msoUtil = new MsoUtils()
+ def useQualifiedHostName = execution.getVariable("URN_mso_use_qualified_host")
+ if((useQualifiedHostName!=null) && (useQualifiedHostName.equals("true"))){
+ callbackUrlToUse = msoUtil.getQualifiedHostNameForCallback(callbackUrlToUse)
+ }
+ utils.log("DEBUG", "Callback URL to use:\n" + callbackUrlToUse, isDebugEnabled)
+ requestHeader = requestHeader.replace(origCallbackUrl, callbackUrlToUse)
+
+ // Get parameters from request header
+ def sdnca_svcInstanceId = utils.getNodeText1(requestHeader, "SvcInstanceId") // optional
+ utils.log("DEBUG", "SvcInstanceId: " + sdnca_svcInstanceId, isDebugEnabled)
+ def sdnca_msoAction = utils.getNodeText1(requestHeader, "MsoAction") // optional
+ utils.log("DEBUG", "MsoAction: " + sdnca_msoAction, isDebugEnabled)
+ def sdnca_svcAction = utils.getNodeText(requestHeader, "SvcAction")
+ utils.log("DEBUG", "SvcAction: " + sdnca_svcAction, isDebugEnabled)
+ def sdnca_svcOperation = utils.getNodeText(requestHeader, "SvcOperation")
+ utils.log("DEBUG", "SvcOperation: " + sdnca_svcOperation, isDebugEnabled)
+ def sdncRequestData = utils.getChildNodes(sdncwfreq, "SDNCRequestData")
+ sdncRequestData = sdncRequestData.replace("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n", "")
+ sdncRequestData = sdncRequestData.replaceAll('tag0:', '').replaceAll(':tag0', '')
+ utils.log("DEBUG", "SDNCRequestData:\n" + sdncRequestData, isDebugEnabled)
+ def sdnca_serviceType = ""
+ if (utils.nodeExists(sdncwfreq, "service-type")) {
+ sdnca_serviceType = utils.getNodeText(sdncwfreq, "service-type")
+ }
+ utils.log("DEBUG", "service-type: " + sdnca_serviceType, isDebugEnabled)
+ def serviceConfigActivate = false
+ def source = ''
+ if ((sdnca_svcAction == 'activate') && (sdnca_svcOperation == 'service-configuration-operation') && (sdnca_serviceType == 'uCPE-VMS')) {
+ serviceConfigActivate = true
+ if (utils.nodeExists(sdncwfreq, 'source')) {
+ source = utils.getNodeText(sdncwfreq, 'source')
+ }
+ }
+ execution.setVariable("serviceConfigActivate", serviceConfigActivate)
+ utils.log("DEBUG", "serviceConfigActivate: " + serviceConfigActivate, isDebugEnabled)
+ execution.setVariable("source", source)
+ utils.log("DEBUG", "source: " + source, isDebugEnabled)
+
+ //calling process should pass a generated uuid if sending multiple sdnc requests
+ def requestId = utils.getNodeText(requestHeader, "RequestId")
+ execution.setVariable(Prefix + "requestId", requestId)
+
+ // Prepare SDNC Request to the SDNC Adapter
+ String sdncAdapterRequest = """
+ <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
+ <SOAP-ENV:Body>
+ <aetgt:SDNCAdapterRequest xmlns:aetgt="http://org.openecomp/workflow/sdnc/adapter/schema/v1" xmlns:sdncadaptersc="http://org.openecomp/workflow/sdnc/adapter/schema/v1">
+ <sdncadapter:RequestHeader xmlns:sdncadapter="http://org.openecomp/workflow/sdnc/adapter/schema/v1">
+ <sdncadapter:RequestId>${requestId}</sdncadapter:RequestId>"""
+
+ if (sdnca_svcInstanceId != null) {
+ sdncAdapterRequest += """
+ <sdncadapter:SvcInstanceId>${sdnca_svcInstanceId}</sdncadapter:SvcInstanceId>"""
+ }
+
+ sdncAdapterRequest += """
+ <sdncadapter:SvcAction>${sdnca_svcAction}</sdncadapter:SvcAction>
+ <sdncadapter:SvcOperation>${sdnca_svcOperation}</sdncadapter:SvcOperation>
+ <sdncadapter:CallbackUrl>${callbackUrlToUse}</sdncadapter:CallbackUrl>"""
+
+ if (sdnca_msoAction != null) {
+ sdncAdapterRequest += """
+ <sdncadapter:MsoAction>${sdnca_msoAction}</sdncadapter:MsoAction>"""
+ }
+
+ sdncAdapterRequest += """
+ </sdncadapter:RequestHeader>
+ <sdncadaptersc:RequestData>${sdncRequestData}</sdncadaptersc:RequestData></aetgt:SDNCAdapterRequest></SOAP-ENV:Body></SOAP-ENV:Envelope>"""
+
+ utils.logAudit("Outgoing SDNCAdapterRequest:\n" + sdncAdapterRequest)
+ execution.setVariable("sdncAdapterRequest", sdncAdapterRequest)
+
utils.log("DEBUG", execution.getVariable("sdncAdapterRequest"), isDebugEnabled)
utils.log("DEBUG", execution.getVariable("URN_mso_adapters_sdnc_endpoint"), isDebugEnabled)
- }catch(Exception e){
- utils.log("DEBUG", 'Internal Error occured during PreProcess Method: ' + e, isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 9999, 'Internal Error occured during PreProcess Method') // TODO: what message and error code?
- }
- utils.log("DEBUG","=========== End pre Process SDNCRequestScript ===========", isDebugEnabled)
- }
-
- public void postProcessResponse (Execution execution) {
-
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- try{
- utils.log("DEBUG","=========== Begin POSTProcess SDNCAdapter ===========", isDebugEnabled)
- utils.log("DEBUG","Incoming sdncAdapterCallbackRequest:\n" + execution.getVariable("sdncAdapterCallbackRequest"), isDebugEnabled)
-
- // Check the sdnccallback request and get the responsecode
- def sdnccallbackreq = execution.getVariable("sdncAdapterCallbackRequest")
- def callbackRequestData = ""
- def callbackHeader = ""
- utils.logAudit("SDNCAdapterCallback Request :" + sdnccallbackreq)
-
- if(sdnccallbackreq != null){
- callbackHeader = utils.getNodeXml(sdnccallbackreq, "CallbackHeader")
- callbackRequestData = utils.getNodeXml(sdnccallbackreq, "RequestData")
-
- callbackHeader = callbackHeader.replace("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n", "")
- utils.log("DEBUG","SDNCCallbackHeader is:\n" + callbackHeader, isDebugEnabled)
-
- callbackRequestData = callbackRequestData.replace("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n", "")
- utils.log("DEBUG","DECODED SDNCCallback RequestData is:\n" + callbackRequestData, isDebugEnabled)
-
- String sdncAdapterWorkflowResponse ="""
+ }catch(Exception e){
+ utils.log("DEBUG", 'Internal Error occured during PreProcess Method: ' + e, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 9999, 'Internal Error occured during PreProcess Method') // TODO: what message and error code?
+ }
+ utils.log("DEBUG","=========== End pre Process SDNCRequestScript ===========", isDebugEnabled)
+ }
+
+ public void postProcessResponse (Execution execution) {
+
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ try{
+ utils.log("DEBUG","=========== Begin POSTProcess SDNCAdapter ===========", isDebugEnabled)
+ utils.log("DEBUG","Incoming sdncAdapterCallbackRequest:\n" + execution.getVariable("sdncAdapterCallbackRequest"), isDebugEnabled)
+
+ // Check the sdnccallback request and get the responsecode
+ def sdnccallbackreq = execution.getVariable("sdncAdapterCallbackRequest")
+ def callbackRequestData = ""
+ def callbackHeader = ""
+ utils.logAudit("SDNCAdapterCallback Request :" + sdnccallbackreq)
+
+ if(sdnccallbackreq != null){
+ callbackHeader = utils.getNodeXml(sdnccallbackreq, "CallbackHeader")
+ callbackRequestData = utils.getNodeXml(sdnccallbackreq, "RequestData")
+
+ callbackHeader = callbackHeader.replace("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n", "")
+ utils.log("DEBUG","SDNCCallbackHeader is:\n" + callbackHeader, isDebugEnabled)
+
+ callbackRequestData = callbackRequestData.replace("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n", "")
+ utils.log("DEBUG","DECODED SDNCCallback RequestData is:\n" + callbackRequestData, isDebugEnabled)
+
+ String sdncAdapterWorkflowResponse ="""
<sdncadapterworkflow:SDNCAdapterWorkflowResponse xmlns:sdncadapterworkflow="http://org.openecomp/mso/workflow/schema/v1">
- <sdncadapterworkflow:response-data>
- ${callbackHeader}
- ${callbackRequestData}
- </sdncadapterworkflow:response-data>
- </sdncadapterworkflow:SDNCAdapterWorkflowResponse>"""
-
-
- utils.log("DEBUG","Outgoing sdncAdapterWorkflowResponse:\n" + sdncAdapterWorkflowResponse, isDebugEnabled)
- sdncAdapterWorkflowResponse = utils.formatXml(sdncAdapterWorkflowResponse)
- utils.logAudit("sdncAdapterWorkflowResponse :" + sdncAdapterWorkflowResponse)
- execution.setVariable("sdncAdapterResponse", sdncAdapterWorkflowResponse)
- // TODO: Should deprecate use of processKey+Response variable for the response. Will use "WorkflowResponse" instead
- execution.setVariable("WorkflowResponse", sdncAdapterWorkflowResponse)
-
- // Check final indicator to determine if we are to continue listening or not
- def String enhancedCallbackRequestData = callbackRequestData.replaceAll("&amp;", "&")
- enhancedCallbackRequestData = enhancedCallbackRequestData.replaceAll("&lt;", "<")
- enhancedCallbackRequestData = enhancedCallbackRequestData.replaceAll("&gt;", ">")
- // replace the data with '&' (ex: subscriber-name= 'FOUR SEASONS HEATING & COOLING'
- enhancedCallbackRequestData = enhancedCallbackRequestData.replace("&", "&amp;")
- utils.log("DEBUG","EnhancedCallbackRequestData:\n" + enhancedCallbackRequestData, isDebugEnabled)
- execution.setVariable("enhancedCallbackRequestData", enhancedCallbackRequestData)
- def continueListening = false
- if (utils.nodeExists(enhancedCallbackRequestData, "ack-final-indicator")) {
- if (utils.getNodeText(enhancedCallbackRequestData, "ack-final-indicator") == 'N') {
- continueListening = true
- }
- }
- execution.setVariable("continueListening", continueListening)
- utils.log("DEBUG", "Continue Listening: " + continueListening, isDebugEnabled)
- }else{
- // Timed out waiting for asynchronous message, build error response
- exceptionUtil.buildWorkflowException(execution, 500, "SDNC Callback Timeout Error")
- execution.setVariable("asynchronousResponseTimeout", true)
- utils.log("DEBUG", "Timed out waiting for asynchronous message", isDebugEnabled)
- }
- }catch(Exception e){
- utils.log("DEBUG", 'Internal Error occured during PostProcess Method: ' + e, isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 9999, 'Internal Error occured during PostProcess Method') // TODO: what message and error code?
- }
- utils.log("DEBUG","=========== End POSTProcess SDNCAdapter ===========", isDebugEnabled)
- }
-
- public void callbackResponsecheck(Execution execution){
-
- def sdnccallbackreq=execution.getVariable("sdncAdapterCallbackRequest")
- utils.logAudit("sdncAdapterCallbackRequest :" + sdnccallbackreq)
- if (sdnccallbackreq==null){
- execution.setVariable("callbackResponseReceived",false);
- }else{
- execution.setVariable("callbackResponseReceived",true);
- }
- }
-
- public void resetCallbackRequest(Execution execution) {
-
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
-
- utils.log("DEBUG","=========== Begin Reset Callback Info SDNCAdapter ===========", isDebugEnabled)
-
- // Clear sdncAdapterCallbackRequest variable
- execution.removeVariable("sdncAdapterCallbackRequest")
-
- // Determine and set SDNC Timeout Value
- def enhancedCallbackRequestData = execution.getVariable("enhancedCallbackRequestData")
- utils.logAudit("sdncAdapter - enhancedCallbackRequestData :" + enhancedCallbackRequestData)
- def interim = false
- if (enhancedCallbackRequestData != null) {
- if (utils.nodeExists(enhancedCallbackRequestData, "ack-final-indicator")) {
- if (utils.getNodeText(enhancedCallbackRequestData, "ack-final-indicator") == 'N') {
- interim = true
- }
- }
- }
- def timeoutValue = execution.getVariable("URN_mso_sdnc_timeout")
- def sdncAdapterWorkflowRequest = execution.getVariable("sdncAdapterWorkflowRequest")
- if (interim && utils.nodeExists(sdncAdapterWorkflowRequest, "InterimSDNCTimeOutValueInHours")) {
- timeoutValue = "PT" + utils.getNodeText(sdncAdapterWorkflowRequest, "InterimSDNCTimeOutValueInHours") + "H"
- } else if (utils.nodeExists(sdncAdapterWorkflowRequest, "SDNCTimeOutValueInMinutes")) {
- timeoutValue = "PT" + utils.getNodeText(sdncAdapterWorkflowRequest, "SDNCTimeOutValueInMinutes") + "M"
- }
- execution.setVariable("sdncTimeoutValue", timeoutValue)
- utils.log("DEBUG", "Setting SDNC Timeout Value to " + timeoutValue, isDebugEnabled)
-
- utils.log("DEBUG","=========== End Reset Callback Info SDNCAdapter ===========", isDebugEnabled)
- }
-
-
- public void prepareDBMessage(Execution execution) {
-
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
-
- utils.log("DEBUG","=========== Begin Prepare DB Message SDNCAdapter ===========", isDebugEnabled)
-
- // Create DB Message
- def dbRequestId = execution.getVariable("mso-request-id")
- String dbUpdateInterimStageCompletion = """
- <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
- <SOAP-ENV:Body>
- <DBAdapter:updateInterimStageCompletion xmlns:DBAdapter="http://org.openecomp.mso/requestsdb">
- <requestId>${dbRequestId}</requestId>
- <interimStageCompletion>1</interimStageCompletion>
- <lastModifiedBy>BPEL</lastModifiedBy>
- </DBAdapter:updateInterimStageCompletion>
- </SOAP-ENV:Body>
- </SOAP-ENV:Envelope>
- """
-
- execution.setVariable("dbUpdateInterimStageCompletion", dbUpdateInterimStageCompletion)
- utils.logAudit("sdncAdapter - dbUpdateInterimStageCompletion :" + dbUpdateInterimStageCompletion)
- utils.log("DEBUG","DB UpdateInterimStageCompletion:\n" + dbUpdateInterimStageCompletion, isDebugEnabled)
- utils.log("DEBUG","=========== End Prepare DB Message SDNCAdapter ===========", isDebugEnabled)
- }
-
-
-
- public String generateCurrentTimeInUtc(){
- final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
- sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
- final String utcTime = sdf.format(new Date());
- return utcTime;
- }
-
- public void toggleSuccessIndicator(Execution execution){
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- execution.setVariable("SDNCA_SuccessIndicator", true)
- utils.log("DEBUG","Setting SDNCA Success Indicator to True", isDebugEnabled)
- }
-
- public void assignError(Execution execution){
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- utils.log("DEBUG","=========== Started Assign Error ===========", isDebugEnabled)
- WorkflowException wf = execution.getVariable("WorkflowException")
- if(wf == null){
- exceptionUtil.buildWorkflowException(execution, 5000, "SDNCAdapter Encountered an Internal Error") // TODO: Not sure what message and error code we want here.....
- }else{
- execution.setVariable("WorkflowException", wf)
- }
-
- utils.log("DEBUG","Outgoing WorkflowException is: " + execution.getVariable("WorkflowException"), isDebugEnabled)
- utils.log("DEBUG","=========== End Assign Error ===========", isDebugEnabled)
- }
-
-}
-
+ <sdncadapterworkflow:response-data>
+ ${callbackHeader}
+ ${callbackRequestData}
+ </sdncadapterworkflow:response-data>
+ </sdncadapterworkflow:SDNCAdapterWorkflowResponse>"""
+
+
+ utils.log("DEBUG","Outgoing sdncAdapterWorkflowResponse:\n" + sdncAdapterWorkflowResponse, isDebugEnabled)
+ sdncAdapterWorkflowResponse = utils.formatXml(sdncAdapterWorkflowResponse)
+ utils.logAudit("sdncAdapterWorkflowResponse :" + sdncAdapterWorkflowResponse)
+ execution.setVariable("sdncAdapterResponse", sdncAdapterWorkflowResponse)
+ // TODO: Should deprecate use of processKey+Response variable for the response. Will use "WorkflowResponse" instead
+ execution.setVariable("WorkflowResponse", sdncAdapterWorkflowResponse)
+
+ // Check final indicator to determine if we are to continue listening or not
+ def String enhancedCallbackRequestData = callbackRequestData.replaceAll("&amp;", "&")
+ enhancedCallbackRequestData = enhancedCallbackRequestData.replaceAll("&lt;", "<")
+ enhancedCallbackRequestData = enhancedCallbackRequestData.replaceAll("&gt;", ">")
+ // replace the data with '&' (ex: subscriber-name= 'FOUR SEASONS HEATING & COOLING'
+ enhancedCallbackRequestData = enhancedCallbackRequestData.replace("&", "&amp;")
+ utils.log("DEBUG","EnhancedCallbackRequestData:\n" + enhancedCallbackRequestData, isDebugEnabled)
+ execution.setVariable("enhancedCallbackRequestData", enhancedCallbackRequestData)
+ def continueListening = false
+ if (utils.nodeExists(enhancedCallbackRequestData, "ack-final-indicator")) {
+ if (utils.getNodeText(enhancedCallbackRequestData, "ack-final-indicator") == 'N') {
+ continueListening = true
+ }
+ }
+ execution.setVariable("continueListening", continueListening)
+ utils.log("DEBUG", "Continue Listening: " + continueListening, isDebugEnabled)
+ execution.setVariable("asynchronousResponseTimeout", false)
+ }else{
+ // Timed out waiting for asynchronous message, build error response
+ exceptionUtil.buildWorkflowException(execution, 500, "SDNC Callback Timeout Error")
+ execution.setVariable("asynchronousResponseTimeout", true)
+ utils.log("DEBUG", "Timed out waiting for asynchronous message", isDebugEnabled)
+ }
+ }catch(Exception e){
+ utils.log("DEBUG", 'Internal Error occured during PostProcess Method: ' + e, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 9999, 'Internal Error occured during PostProcess Method') // TODO: what message and error code?
+ }
+ utils.log("DEBUG","=========== End POSTProcess SDNCAdapter ===========", isDebugEnabled)
+ }
+
+ public void callbackResponsecheck(Execution execution){
+
+ def sdnccallbackreq=execution.getVariable("sdncAdapterCallbackRequest")
+ utils.logAudit("sdncAdapterCallbackRequest :" + sdnccallbackreq)
+ if (sdnccallbackreq==null){
+ execution.setVariable("callbackResponseReceived",false);
+ }else{
+ execution.setVariable("callbackResponseReceived",true);
+ }
+ }
+
+ public void resetCallbackRequest(Execution execution) {
+
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+
+ utils.log("DEBUG","=========== Begin Reset Callback Info SDNCAdapter ===========", isDebugEnabled)
+
+ // Clear sdncAdapterCallbackRequest variable
+ execution.removeVariable("sdncAdapterCallbackRequest")
+
+ // Determine and set SDNC Timeout Value
+ def enhancedCallbackRequestData = execution.getVariable("enhancedCallbackRequestData")
+ utils.logAudit("sdncAdapter - enhancedCallbackRequestData :" + enhancedCallbackRequestData)
+ def interim = false
+ if (enhancedCallbackRequestData != null) {
+ if (utils.nodeExists(enhancedCallbackRequestData, "ack-final-indicator")) {
+ if (utils.getNodeText(enhancedCallbackRequestData, "ack-final-indicator") == 'N') {
+ interim = true
+ }
+ }
+ }
+ def timeoutValue = execution.getVariable("URN_mso_sdnc_timeout")
+ def sdncAdapterWorkflowRequest = execution.getVariable("sdncAdapterWorkflowRequest")
+ if (interim && utils.nodeExists(sdncAdapterWorkflowRequest, "InterimSDNCTimeOutValueInHours")) {
+ timeoutValue = "PT" + utils.getNodeText(sdncAdapterWorkflowRequest, "InterimSDNCTimeOutValueInHours") + "H"
+ } else if (utils.nodeExists(sdncAdapterWorkflowRequest, "SDNCTimeOutValueInMinutes")) {
+ timeoutValue = "PT" + utils.getNodeText(sdncAdapterWorkflowRequest, "SDNCTimeOutValueInMinutes") + "M"
+ }
+ execution.setVariable("sdncTimeoutValue", timeoutValue)
+ utils.log("DEBUG", "Setting SDNC Timeout Value to " + timeoutValue, isDebugEnabled)
+
+ utils.log("DEBUG","=========== End Reset Callback Info SDNCAdapter ===========", isDebugEnabled)
+ }
+
+
+ public void prepareDBMessage(Execution execution) {
+
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+
+ utils.log("DEBUG","=========== Begin Prepare DB Message SDNCAdapter ===========", isDebugEnabled)
+
+ // Create DB Message
+ def dbRequestId = execution.getVariable("mso-request-id")
+ String dbUpdateInterimStageCompletion = """
+ <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
+ <SOAP-ENV:Body>
+ <DBAdapter:updateInterimStageCompletion xmlns:DBAdapter="http://org.openecomp.mso/requestsdb">
+ <requestId>${dbRequestId}</requestId>
+ <interimStageCompletion>1</interimStageCompletion>
+ <lastModifiedBy>BPEL</lastModifiedBy>
+ </DBAdapter:updateInterimStageCompletion>
+ </SOAP-ENV:Body>
+ </SOAP-ENV:Envelope>
+ """
+
+ execution.setVariable("dbUpdateInterimStageCompletion", dbUpdateInterimStageCompletion)
+ utils.logAudit("sdncAdapter - dbUpdateInterimStageCompletion :" + dbUpdateInterimStageCompletion)
+ utils.log("DEBUG","DB UpdateInterimStageCompletion:\n" + dbUpdateInterimStageCompletion, isDebugEnabled)
+ utils.log("DEBUG","=========== End Prepare DB Message SDNCAdapter ===========", isDebugEnabled)
+ }
+
+ public String generateCurrentTimeInUtc(){
+ final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
+ sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
+ final String utcTime = sdf.format(new Date());
+ return utcTime;
+ }
+
+ public void toggleSuccessIndicator(Execution execution){
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ execution.setVariable("SDNCA_SuccessIndicator", true)
+ utils.log("DEBUG","Setting SDNCA Success Indicator to True", isDebugEnabled)
+ }
+
+ public void assignError(Execution execution){
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ utils.log("DEBUG","=========== Started Assign Error ===========", isDebugEnabled)
+ WorkflowException wf = execution.getVariable("WorkflowException")
+ if(wf == null){
+ exceptionUtil.buildWorkflowException(execution, 5000, "SDNCAdapter Encountered an Internal Error") // TODO: Not sure what message and error code we want here.....
+ }else{
+ execution.setVariable("WorkflowException", wf)
+ }
+
+ utils.log("DEBUG","Outgoing WorkflowException is: " + execution.getVariable("WorkflowException"), isDebugEnabled)
+ utils.log("DEBUG","=========== End Assign Error ===========", isDebugEnabled)
+ }
+
+ public void setTimeout(Execution execution){
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ utils.log("DEBUG","=========== Started SetTimeout ===========", isDebugEnabled)
+ utils.log("DEBUG", "Timer expired, telling correlation service to stop listening", isDebugEnabled)
+ execution.setVariable("asynchronousResponseTimeout", true)
+
+ utils.log("DEBUG", "Timed out branch sleeping for one second to give success branch a chance to complete if running", isDebugEnabled)
+ Thread.sleep(1000)
+ utils.log("DEBUG","=========== End SetTimeout ===========", isDebugEnabled)
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterRestV1.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterRestV1.groovy
new file mode 100644
index 0000000000..1859838f29
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterRestV1.groovy
@@ -0,0 +1,343 @@
+package org.openecomp.mso.bpmn.common.scripts
+
+import java.text.SimpleDateFormat
+import java.net.URLEncoder
+
+import org.apache.commons.codec.binary.Base64
+import org.apache.commons.lang3.*
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.runtime.Execution
+
+import groovy.json.*
+
+import org.json.JSONObject
+
+import org.openecomp.mso.bpmn.core.WorkflowException
+import org.openecomp.mso.bpmn.core.json.JsonUtils
+import org.openecomp.mso.rest.APIResponse
+import org.openecomp.mso.rest.RESTClient
+import org.openecomp.mso.rest.RESTConfig
+
+
+class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
+
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+ JsonUtils jsonUtil = new JsonUtils()
+
+ /**
+ * Processes the incoming request.
+ */
+ public void preProcessRequest (Execution execution) {
+ def method = getClass().getSimpleName() + '.preProcessRequest(' +
+ 'execution=' + execution.getId() +
+ ')'
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ logDebug('Entered ' + method, isDebugLogEnabled)
+
+ def prefix="SDNCREST_"
+ execution.setVariable("prefix", prefix)
+ setSuccessIndicator(execution, false)
+
+ try {
+ // Determine the request type and log the request
+
+ String request = validateRequest(execution, "mso-request-id")
+ String requestType = jsonUtil.getJsonRootProperty(request)
+ execution.setVariable(prefix + 'requestType', requestType)
+ logDebug(getProcessKey(execution) + ': ' + prefix + 'requestType = ' + requestType, isDebugLogEnabled)
+ utils.logAudit('SDNCAdapterRestV1, request: ' + request)
+
+ // Determine the SDNCAdapter endpoint
+
+ String sdncAdapterEndpoint = execution.getVariable("URN_mso_adapters_sdnc_rest_endpoint")
+
+ if (sdncAdapterEndpoint == null || sdncAdapterEndpoint.isEmpty()) {
+ String msg = getProcessKey(execution) + ': mso:adapters:sdnc:rest:endpoint URN mapping is not defined'
+ logDebug(msg, isDebugLogEnabled)
+ logError(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ }
+
+ while (sdncAdapterEndpoint.endsWith('/')) {
+ sdncAdapterEndpoint = sdncAdapterEndpoint.substring(0, sdncAdapterEndpoint.length()-1)
+ }
+
+ String sdncAdapterMethod = null
+ String sdncAdapterUrl = null
+ String sdncAdapterRequest = request
+
+ if ('SDNCServiceRequest'.equals(requestType)) {
+ // Get the sdncRequestId from the request
+
+ String sdncRequestId = jsonUtil.getJsonValue(request, requestType + ".sdncRequestId")
+
+ if (sdncRequestId == null || sdncRequestId.isEmpty()) {
+ String msg = getProcessKey(execution) + ': no sdncRequestId in ' + requestType
+ logDebug(msg, isDebugLogEnabled)
+ logError(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ }
+
+ execution.setVariable('SDNCAResponse_CORRELATOR', sdncRequestId)
+ logDebug(getProcessKey(execution) + ': SDNCAResponse_CORRELATOR = ' + sdncRequestId, isDebugLogEnabled)
+
+ // Get the bpNotificationUrl from the request (just to make sure it's there)
+
+ String bpNotificationUrl = jsonUtil.getJsonValue(request, requestType + ".bpNotificationUrl")
+
+ if (bpNotificationUrl == null || bpNotificationUrl.isEmpty()) {
+ String msg = getProcessKey(execution) + ': no bpNotificationUrl in ' + requestType
+ logDebug(msg, isDebugLogEnabled)
+ logError(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ }
+
+ sdncAdapterMethod = 'POST'
+ sdncAdapterUrl = sdncAdapterEndpoint + '/services'
+
+ } else {
+ String msg = getProcessKey(execution) + ': Unsupported request type: ' + requestType
+ logDebug(msg, isDebugLogEnabled)
+ logError(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ }
+
+ execution.setVariable(prefix + 'sdncAdapterMethod', sdncAdapterMethod)
+ logDebug(getProcessKey(execution) + ': ' + prefix + 'sdncAdapterMethod = ' + sdncAdapterMethod, isDebugLogEnabled)
+ execution.setVariable(prefix + 'sdncAdapterUrl', sdncAdapterUrl)
+ logDebug(getProcessKey(execution) + ': ' + prefix + 'sdncAdapterUrl = ' + sdncAdapterUrl, isDebugLogEnabled)
+ execution.setVariable(prefix + 'sdncAdapterRequest', sdncAdapterRequest)
+ logDebug(getProcessKey(execution) + ': ' + prefix + 'sdncAdapterRequest = \n' + sdncAdapterRequest, isDebugLogEnabled)
+
+ // Get the Basic Auth credentials for the SDNCAdapter (yes... we ARE using the PO adapters credentials)
+
+ String basicAuthValue = execution.getVariable("URN_mso_adapters_po_auth")
+
+ if (basicAuthValue == null || basicAuthValue.isEmpty()) {
+ logDebug(getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined", isDebugLogEnabled)
+ logError(getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined")
+ } else {
+ logDebug(getProcessKey(execution) + ": Obtained BasicAuth credentials for SDNCAdapter:" +
+ basicAuthValue, isDebugLogEnabled)
+ try {
+ def encodedString = utils.getBasicAuth(basicAuthValue, execution.getVariable("URN_mso_msoKey"))
+ execution.setVariable(prefix + 'basicAuthHeaderValue', encodedString)
+ } catch (IOException ex) {
+ logDebug(getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter", isDebugLogEnabled)
+ logError(getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter")
+ }
+ }
+
+ // Set the timeout value, e.g. PT5M. It may be specified in the request as the
+ // bpTimeout value. If it's not in the request, use the URN mapping value.
+
+ String timeout = jsonUtil.getJsonValue(request, requestType + ".bpTimeout")
+
+ if (timeout == null || timeout.isEmpty()) {
+ timeout = execution.getVariable("URN_mso_sdnc_timeout")
+ }
+
+ execution.setVariable(prefix + 'timeout', timeout)
+ logDebug(getProcessKey(execution) + ': ' + prefix + 'timeout = ' + timeout, isDebugLogEnabled)
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception e) {
+ String msg = 'Caught exception in ' + method + ": " + e
+ logDebug(msg, isDebugLogEnabled)
+ logError(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ }
+ }
+
+ /**
+ * Sends the request to the SDNC adapter.
+ */
+ public void sendRequestToSDNCAdapter(Execution execution) {
+ def method = getClass().getSimpleName() + '.sendRequestToSDNCAdapter(' +
+ 'execution=' + execution.getId() +
+ ')'
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ logDebug('Entered ' + method, isDebugLogEnabled)
+
+ String prefix = execution.getVariable('prefix')
+
+ try {
+ String sdncAdapterMethod = execution.getVariable(prefix + 'sdncAdapterMethod')
+ String sdncAdapterUrl = execution.getVariable(prefix + 'sdncAdapterUrl')
+ String sdncAdapterRequest = execution.getVariable(prefix + 'sdncAdapterRequest')
+ utils.logAudit("Outgoing SDNC Rest Request is: " + sdncAdapterRequest)
+
+ RESTConfig config = new RESTConfig(sdncAdapterUrl)
+ RESTClient client = new RESTClient(config).
+ addHeader("Content-Type", "application/json").
+ addAuthorizationHeader(execution.getVariable(prefix + "basicAuthHeaderValue"))
+
+ APIResponse response
+
+ if ("GET".equals(sdncAdapterMethod)) {
+ response = client.httpGet()
+ } else if ("PUT".equals(sdncAdapterMethod)) {
+ response = client.httpPut(sdncAdapterRequest)
+ } else if ("POST".equals(sdncAdapterMethod)) {
+ response = client.httpPost(sdncAdapterRequest)
+ } else if ("DELETE".equals(sdncAdapterMethod)) {
+ response = client.httpDelete(sdncAdapterRequest)
+ } else {
+ String msg = 'Unsupported HTTP method "' + sdncAdapterMethod + '" in ' + method + ": " + e
+ logDebug(msg, isDebugLogEnabled)
+ logError(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ }
+
+ execution.setVariable(prefix + "sdncAdapterStatusCode", response.getStatusCode())
+ execution.setVariable(prefix + "sdncAdapterResponse", response.getResponseBodyAsString())
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception e) {
+ String msg = 'Caught exception in ' + method + ": " + e
+ logDebug(msg, isDebugLogEnabled)
+ logError(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ }
+ }
+
+ /**
+ * Processes a callback.
+ */
+ public void processCallback(Execution execution){
+ def method = getClass().getSimpleName() + '.processCallback(' +
+ 'execution=' + execution.getId() +
+ ')'
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ logDebug('Entered ' + method, isDebugLogEnabled)
+
+ String prefix = execution.getVariable('prefix')
+ String callback = execution.getVariable('SDNCAResponse_MESSAGE')
+ utils.logAudit("Incoming SDNC Rest Callback is: " + callback)
+
+ try {
+ logDebug(getProcessKey(execution) + ": received callback:\n" + callback, isDebugLogEnabled)
+
+ int callbackNumber = 1
+ while (execution.getVariable(prefix + 'callback' + callbackNumber) != null) {
+ ++callbackNumber
+ }
+
+ execution.setVariable(prefix + 'callback' + callbackNumber, callback)
+ execution.removeVariable('SDNCAResponse_MESSAGE')
+
+ String responseType = jsonUtil.getJsonRootProperty(callback)
+
+ // Get the ackFinalIndicator and make sure it's either Y or N. Default to Y.
+ String ackFinalIndicator = jsonUtil.getJsonValue(callback, responseType + ".ackFinalIndicator")
+
+ if (!'N'.equals(ackFinalIndicator)) {
+ ackFinalIndicator = 'Y'
+ }
+
+ execution.setVariable(prefix + "ackFinalIndicator", ackFinalIndicator)
+
+ if (responseType.endsWith('Error')) {
+ sdncAdapterBuildWorkflowException(execution, callback)
+ }
+ } catch (Exception e) {
+ callback = callback == null || String.valueOf(callback).isEmpty() ? "NONE" : callback
+ String msg = "Received error from SDNCAdapter: " + callback
+ logDebug(getProcessKey(execution) + ': ' + msg, isDebugLogEnabled)
+ exceptionUtil.buildWorkflowException(execution, 5300, msg)
+ }
+ }
+
+ /**
+ * Tries to parse the response as XML to extract the information to create
+ * a WorkflowException. If the response cannot be parsed, a more generic
+ * WorkflowException is created.
+ */
+ public void sdncAdapterBuildWorkflowException(Execution execution, String response) {
+ try {
+ String responseType = jsonUtil.getJsonRootProperty(response)
+ String responseCode = jsonUtil.getJsonValue(response, responseType + ".responseCode")
+ String responseMessage = jsonUtil.getJsonValue(response, responseType + ".responseMessage")
+
+ String info = ""
+
+ if (responseCode != null && !responseCode.isEmpty()) {
+ info += " responseCode='" + responseCode + "'"
+ }
+
+ if (responseMessage != null && !responseMessage.isEmpty()) {
+ info += " responseMessage='" + responseMessage + "'"
+ }
+
+ // Note: the mapping function handles a null or empty responseCode
+ int mappedResponseCode = Integer.parseInt(exceptionUtil.MapSDNCResponseCodeToErrorCode(responseCode));
+ exceptionUtil.buildWorkflowException(execution, mappedResponseCode, "Received " + responseType +
+ " from SDNCAdapter:" + info)
+ } catch (Exception e) {
+ response = response == null || String.valueOf(response).isEmpty() ? "NONE" : response
+ exceptionUtil.buildWorkflowException(execution, 5300, "Received error from SDNCAdapter: " + response)
+ }
+ }
+
+ /**
+ * Gets the last callback request from the execution, or null if there was no callback.
+ */
+ public String getLastCallback(Execution execution) {
+ def method = getClass().getSimpleName() + '.getLastCallback(' +
+ 'execution=' + execution.getId() +
+ ')'
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ logDebug('Entered ' + method, isDebugLogEnabled)
+
+ String prefix = execution.getVariable('prefix')
+
+ try {
+ int callbackNumber = 1
+ String callback = null
+
+ while (true) {
+ String thisCallback = (String) execution.getVariable(prefix + 'callback' + callbackNumber)
+
+ if (thisCallback == null) {
+ break
+ }
+
+ callback = thisCallback
+ ++callbackNumber
+ }
+
+ return callback
+ } catch (Exception e) {
+ String msg = 'Caught exception in ' + method + ": " + e
+ logDebug(msg, isDebugLogEnabled)
+ logError(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ }
+ }
+
+ /**
+ * Sets the timeout value to wait for the next notification.
+ */
+ public void setTimeoutValue(Execution execution) {
+ def method = getClass().getSimpleName() + '.setTimeoutValue(' +
+ 'execution=' + execution.getId() +
+ ')'
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ logDebug('Entered ' + method, isDebugLogEnabled)
+
+ String prefix = execution.getVariable('prefix')
+
+ try {
+ def timeoutValue = execution.getVariable("URN_mso_sdnc_timeout")
+
+ if (execution.getVariable(prefix + 'callback1') != null) {
+ // Waiting for subsequent notifications
+ }
+ } catch (Exception e) {
+ String msg = 'Caught exception in ' + method + ": " + e
+ logDebug(msg, isDebugLogEnabled)
+ logError(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ }
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterUtils.groovy
index 5c01bb9c4d..f870e30d1d 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterUtils.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterUtils.groovy
@@ -1,925 +1,966 @@
-/*-
- * ============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.common.scripts;
-
-import org.apache.commons.lang3.*
-import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.runtime.Execution
-import org.openecomp.mso.bpmn.core.WorkflowException
-import org.springframework.web.util.UriUtils
-
-
-/**
- * @version 1.0
- *
- */
-class SDNCAdapterUtils {
-
- ExceptionUtil exceptionUtil = new ExceptionUtil()
-
- private AbstractServiceTaskProcessor taskProcessor
-
- public SDNCAdapterUtils(AbstractServiceTaskProcessor taskProcessor) {
- this.taskProcessor = taskProcessor
- }
-
- String SDNCAdapterFeatureRequest(Execution execution, String requestName, String action, String callbackURL, String serviceOperation, String timeoutValueInMinutes) {
- def utils=new MsoUtils()
-
- def prefix = execution.getVariable('prefix')
- def request = taskProcessor.getVariable(execution, requestName)
- def requestInformation = utils.getNodeXml(request, 'request-information', false)
- def serviceInformation = utils.getNodeXml(request, 'service-information', false)
- def featureInformation = utils.getNodeXml(request, 'feature-information', false)
- def featureParameters = utils.getNodeXml(request, 'feature-parameters', false)
-
- def requestId = execution.getVariable('testReqId') // for junits
- if(requestId==null){
- requestId = execution.getVariable("openecomp-mso-request-id") + "-" + System.currentTimeMillis()
- }
-
- def svcInstanceId = execution.getVariable("openecomp-mso-service-instance-id")
-
- def nnsRequestInformation = utils.removeXmlNamespaces(requestInformation)
- def nnsServiceInformation = utils.removeXmlNamespaces(serviceInformation)
- def nnsFeatureInformation = utils.removeXmlNamespaces(featureInformation)
- def nnsFeatureParameters = utils.removeXmlNamespaces(featureParameters)
-
- String sdncAdapterFeatureRequest = """
- <sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:sdncadapterworkflow="http://openecomp.com/mso/workflow/schema/v1"
- xmlns:sdncadapter="http://domain2.openecomp.com/workflow/sdnc/adapter/schema/v1">
- <sdncadapter:RequestHeader>
- <sdncadapter:RequestId>${requestId}</sdncadapter:RequestId>
- <sdncadapter:SvcInstanceId>${svcInstanceId}</sdncadapter:SvcInstanceId>
- <sdncadapter:SvcAction>${action}</sdncadapter:SvcAction>
- <sdncadapter:SvcOperation>${serviceOperation}</sdncadapter:SvcOperation>
- <sdncadapter:CallbackUrl>${callbackURL}</sdncadapter:CallbackUrl>
- </sdncadapter:RequestHeader>
- <sdncadapterworkflow:SDNCRequestData>
- ${nnsRequestInformation}
- ${nnsServiceInformation}
- ${nnsFeatureInformation}
- ${nnsFeatureParameters}
- </sdncadapterworkflow:SDNCRequestData>
- <sdncadapterworkflow:SDNCTimeOutValueInMinutes>${timeoutValueInMinutes}</sdncadapterworkflow:SDNCTimeOutValueInMinutes>
- </sdncadapterworkflow:SDNCAdapterWorkflowRequest>
- """
- sdncAdapterFeatureRequest = utils.removeXmlPreamble(utils.formatXML(sdncAdapterFeatureRequest))
- return sdncAdapterFeatureRequest
- }
-
- String SDNCAdapterActivateVnfRequest(Execution execution, String action, String callbackURL, String serviceOperation, String msoAction, String timeoutValueInMinutes) {
- def utils=new MsoUtils()
-
- def prefix = execution.getVariable('prefix')
- def request = taskProcessor.getVariable(execution, prefix+'Request')
- def requestInformation = utils.getNodeXml(request, 'request-information', false)
- def serviceInformation = utils.getNodeXml(request, 'service-information', false)
- def vnfInformationList = utils.getNodeXml(request, 'vnf-information-list', false)
-
- def requestId = execution.getVariable('testReqId') // for junits
- if(requestId==null){
- requestId = execution.getVariable("openecomp-mso-request-id") + "-" + System.currentTimeMillis()
- }
-
- def svcInstanceId = execution.getVariable("openecomp-mso-service-instance-id")
-
- def nnsRequestInformation = utils.removeXmlNamespaces(requestInformation)
- def nnsServiceInformation = utils.removeXmlNamespaces(serviceInformation)
- def nnsVnfInformationList = utils.removeXmlNamespaces(vnfInformationList)
-
- String sdncAdapterActivateVnfRequest = """
- <sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:sdncadapterworkflow="http://openecomp.com/mso/workflow/schema/v1"
- xmlns:sdncadapter="http://domain2.openecomp.com/workflow/sdnc/adapter/schema/v1">
- <sdncadapter:RequestHeader>
- <sdncadapter:RequestId>${requestId}</sdncadapter:RequestId>
- <sdncadapter:SvcInstanceId>${svcInstanceId}</sdncadapter:SvcInstanceId>
- <sdncadapter:SvcAction>${action}</sdncadapter:SvcAction>
- <sdncadapter:SvcOperation>${serviceOperation}</sdncadapter:SvcOperation>
- <sdncadapter:CallbackUrl>${callbackURL}</sdncadapter:CallbackUrl>
- <sdncadapter:MsoAction>${msoAction}</sdncadapter:MsoAction>
- </sdncadapter:RequestHeader>
- <sdncadapterworkflow:SDNCRequestData>
- ${nnsRequestInformation}
- ${nnsServiceInformation}
- ${nnsVnfInformationList}
- </sdncadapterworkflow:SDNCRequestData>
- <sdncadapterworkflow:SDNCTimeOutValueInMinutes>${timeoutValueInMinutes}</sdncadapterworkflow:SDNCTimeOutValueInMinutes>
- </sdncadapterworkflow:SDNCAdapterWorkflowRequest>
- """
- sdncAdapterActivateVnfRequest = utils.removeXmlPreamble(utils.formatXML(sdncAdapterActivateVnfRequest))
- return sdncAdapterActivateVnfRequest
- }
-
- String SDNCAdapterL3ToHigherLayerRequest(Execution execution, String action, String callbackURL, String serviceOperation, String timeoutValueInMinutes) {
- def utils=new MsoUtils()
-
- def prefix = execution.getVariable('prefix')
- def request = taskProcessor.getVariable(execution, prefix+'Request')
-
- def requestInformation = """<request-information>
- <request-id>${execution.getVariable("openecomp-mso-request-id")}</request-id>
- <request-action>torepl</request-action>
- <source>${execution.getVariable(prefix+"source")}</source>
- <notification-url>${execution.getVariable(prefix+"notificationUrl")}</notification-url>
- </request-information>"""
-
- // Change the value of the 'request-information'.'request-action' element
- def xml = new XmlSlurper().parseText(requestInformation)
- if("assign".equalsIgnoreCase(action)){
- xml.'request-action'.replaceBody('createTrinityBonding')
- }else if("activate".equalsIgnoreCase(action)){
- xml.'request-action'.replaceBody('activateTrinityBonding')
- }else if("delete".equalsIgnoreCase(action)){
- xml.'request-action'.replaceBody('deleteTrinityBonding')
- }
- requestInformation = utils.removeXmlPreamble(groovy.xml.XmlUtil.serialize(xml))
- def nnsRequestInformation = utils.removeXmlNamespaces(requestInformation)
-
- def requestId = execution.getVariable('testReqId') // for junits
- if(requestId==null){
- requestId = execution.getVariable("openecomp-mso-request-id") + "-" + System.currentTimeMillis()
- }
-
- def svcInstanceId = execution.getVariable("openecomp-mso-service-instance-id")
-
- //Build Service Information
- // Send serviceName from CANOPI to sdnc for service-type
- def serviceInformation = """<service-information>
- <service-type>${execution.getVariable(prefix+"serviceName")}</service-type>
- <service-instance-id>${svcInstanceId}</service-instance-id>
- <subscriber-name>${execution.getVariable(prefix+"subscriberName")}</subscriber-name>
- <subscriber-global-id>${execution.getVariable(prefix+"subscriberGlobalId")}</subscriber-global-id>
- </service-information>"""
-
- //Build Additional Information - vpn or vni
- // Send serviceType from CANOPI to SDNC for nbnc-request-information service-type
- def service = execution.getVariable(prefix+"serviceType")
- def customerId = execution.getVariable(prefix+"customerId")
- def vpnId = execution.getVariable(prefix+"vpnId")
- def vpnRt = execution.getVariable(prefix+"vpnRt")
- def vpnService = execution.getVariable(prefix+"vpnService")
- def vpnRegion = execution.getVariable(prefix+"vpnRegion")
- def additionalInfo = ""
- if("assign".equalsIgnoreCase(action)){
- additionalInfo = """<vpn-data-list>
- <vpn-id>${vpnId}</vpn-id>
- <vpn-rt>${vpnRt}</vpn-rt>
- <vpn-service>${vpnService}</vpn-service>
- <vpn-region>${vpnRegion}</vpn-region>
- </vpn-data-list>"""
- }else if("activate".equalsIgnoreCase(action) || "delete".equalsIgnoreCase(action)){
- def vniId = execution.getVariable(prefix+'vniId')
- additionalInfo = "<vni-id>${vniId}</vni-id>"
- }
-
- //Set Interface Status
- def interfaceStatus = "DISABLE"
- if("activate".equalsIgnoreCase(action)){
- interfaceStatus = "ENABLE"
- }
-
- //Build SDNC Adapter Request
- String sdncAdapterL3ToHLRequest = """
- <sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:sdncadapterworkflow="http://openecomp.com/mso/workflow/schema/v1"
- xmlns:sdncadapter="http://domain2.openecomp.com/workflow/sdnc/adapter/schema/v1">
- <sdncadapter:RequestHeader>
- <sdncadapter:RequestId>${requestId}</sdncadapter:RequestId>
- <sdncadapter:SvcInstanceId>${svcInstanceId}</sdncadapter:SvcInstanceId>
- <sdncadapter:SvcAction>${action}</sdncadapter:SvcAction>
- <sdncadapter:SvcOperation>${serviceOperation}</sdncadapter:SvcOperation>
- <sdncadapter:CallbackUrl>${callbackURL}</sdncadapter:CallbackUrl>
- </sdncadapter:RequestHeader>
- <sdncadapterworkflow:SDNCRequestData>
- ${nnsRequestInformation}
- ${serviceInformation}
- <nbnc-request-information>
- <service-type>${service}</service-type>
- <customer-id>${customerId}</customer-id>
- <interface-status>${interfaceStatus}</interface-status>
- ${additionalInfo}
- </nbnc-request-information>
- </sdncadapterworkflow:SDNCRequestData>
- <sdncadapterworkflow:SDNCTimeOutValueInMinutes>${timeoutValueInMinutes}</sdncadapterworkflow:SDNCTimeOutValueInMinutes>
- </sdncadapterworkflow:SDNCAdapterWorkflowRequest>
- """
- sdncAdapterL3ToHLRequest = utils.removeXmlPreamble(utils.formatXML(sdncAdapterL3ToHLRequest))
-
- return sdncAdapterL3ToHLRequest
- }
-
-
-
- private void SDNCAdapterActivateRequest(Execution execution, String resultVar, String svcAction,
- String svcOperation, String additionalData) {
- def utils=new MsoUtils()
-
- def prefix = execution.getVariable('prefix')
- def request = taskProcessor.getVariable(execution, prefix+'Request')
- def requestInformation = utils.getNodeXml(request, 'request-information', false)
- def serviceInformation = utils.getNodeXml(request, 'service-information', false)
- def serviceParameters = utils.getNodeXml(request, 'service-parameters', false)
-
- def requestId = execution.getVariable('testReqId') // for junits
- if(requestId==null){
- requestId = execution.getVariable("openecomp-mso-request-id") + "-" + System.currentTimeMillis()
- }
-
- def svcInstanceId = execution.getVariable("openecomp-mso-service-instance-id")
- def msoAction = 'gammainternet'
-
- def timeoutInMinutes = execution.getVariable('URN_mso_sdnc_timeout_firewall_minutes')
-
- def callbackUrl = (String) execution.getVariable('URN_mso_workflow_sdncadapter_callback')
- if (callbackUrl == null || callbackUrl.trim() == "") {
- logError('mso:workflow:sdncadapter:callback URN is not set')
- workflowException(execution, 'Internal Error', 9999) // TODO: what message and error code?
- }
-
- def l2HomingInformation = utils.getNodeXml(serviceParameters, 'l2-homing-information', false)
- def internetEvcAccessInformation = utils.getNodeXml(serviceParameters, 'internet-evc-access-information', false)
- def vrLan = utils.getNodeXml(serviceParameters, 'vr-lan', false)
- def upceVmsServiceInformation = utils.getNodeXml(serviceParameters, 'ucpe-vms-service-information', false)
-
-
- def nnsRequestInformation = utils.removeXmlNamespaces(requestInformation)
- def nnsServiceInformation = utils.removeXmlNamespaces(serviceInformation)
- def nnsl2HomingInformation = utils.removeXmlNamespaces(l2HomingInformation)
- def nnsInternetEvcAccessInformation = utils.removeXmlNamespaces(internetEvcAccessInformation)
- def nnsVrLan = utils.removeXmlNamespaces(vrLan)
- def nnsUpceVmsServiceInformation = utils.removeXmlNamespaces(upceVmsServiceInformation)
-
- if (additionalData == null) {
- additionalData = ""
- }
-
- String content = """
- <sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:sdncadapterworkflow="http://openecomp.com/mso/workflow/schema/v1"
- xmlns:sdncadapter="http://domain2.openecomp.com/workflow/sdnc/adapter/schema/v1">
- <sdncadapter:RequestHeader>
- <sdncadapter:RequestId>${requestId}</sdncadapter:RequestId>
- <sdncadapter:SvcInstanceId>${svcInstanceId}</sdncadapter:SvcInstanceId>
- <sdncadapter:SvcAction>${svcAction}</sdncadapter:SvcAction>
- <sdncadapter:SvcOperation>${svcOperation}</sdncadapter:SvcOperation>
- <sdncadapter:CallbackUrl>${callbackUrl}</sdncadapter:CallbackUrl>
- <sdncadapter:MsoAction>${msoAction}</sdncadapter:MsoAction>
- </sdncadapter:RequestHeader>
- <sdncadapterworkflow:SDNCRequestData>
- ${additionalData}
- ${nnsRequestInformation}
- ${nnsServiceInformation}
- ${nnsl2HomingInformation}
- ${nnsInternetEvcAccessInformation}
- ${nnsVrLan}
- ${nnsUpceVmsServiceInformation}
- </sdncadapterworkflow:SDNCRequestData>
- <sdncadapterworkflow:SDNCTimeOutValueInMinutes>${timeoutInMinutes}</sdncadapterworkflow:SDNCTimeOutValueInMinutes>
- </sdncadapterworkflow:SDNCAdapterWorkflowRequest>
- """
-
- content = utils.removeXmlPreamble(utils.formatXML(content))
- execution.setVariable(resultVar, content)
- }
-
- /**
- * Builds an SDNC "reserve" request and stores it in the specified execution
- * variable.
- * @param execution the execution
- * @param resultVar the execution variable in which the result will be stored
- */
- public void sdncReservePrep(Execution execution, String action, String resultVar) {
- sdncPrep(execution, resultVar, action , 'service-configuration-operation', null, this.taskProcessor)
- }
-
- /**
- * Builds a basic SDNC request and stores it in the specified execution variable.
- * @param execution the execution
- * @param resultVar the execution variable in which the result will be stored
- * @param svcAction the svcAction element value
- * @param svcOperation the svcOperation element value
- * @param additionalData additional XML content to be inserted into the
- * RequestData element (may be null)
- */
- public void sdncPrep(Execution execution, String resultVar, String svcAction,
- String svcOperation, String additionalData, AbstractServiceTaskProcessor taskProcessor) {
- def method = getClass().getSimpleName() + '.sdncPrep(' +
- 'execution=' + execution.getId() +
- ', resultVar=' + resultVar +
- ', svcAction=' + svcAction +
- ', svcOperation=' + svcOperation +
- ', additionalData=' + (additionalData == null ? "no" : "yes") +
- ')'
-
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- taskProcessor.logDebug('Entered ' + method, isDebugLogEnabled)
- MsoUtils utils = taskProcessor.utils
- try {
- def prefix = execution.getVariable('prefix')
- def request = taskProcessor.getVariable(execution, prefix+'Request')
- def requestInformation = utils.getNodeXml(request, 'request-information', false)
- def serviceInformation = utils.getNodeXml(request, 'service-information', false)
- def serviceParameters = utils.getChildNodes(request, 'service-parameters')
- def requestAction = utils.getNodeText1(request, 'request-action')
-
- def timeoutInMinutes = execution.getVariable('URN_mso_sdnc_timeout_firewall_minutes')
-
- def requestId = execution.getVariable('testReqId') // for junits
- if(requestId==null){
- requestId = execution.getVariable("openecomp-mso-request-id") + "-" + System.currentTimeMillis()
- }
-
- def svcInstanceId = execution.getVariable("openecomp-mso-service-instance-id")
- def msoAction = 'gammainternet'
-
- def callbackUrl = (String) execution.getVariable('URN_mso_workflow_sdncadapter_callback')
- if (callbackUrl == null || callbackUrl.trim() == "") {
- taskProcessor.logError('mso:workflow:sdncadapter:callback URN is not set')
- taskProcessor.workflowException(execution, 'Internal Error', 9999) // TODO: what message and error code?
- }
-
- def l2HomingInformation = utils.getNodeXml(request, 'l2-homing-information', false)
- def internetEvcAccessInformation = utils.getNodeXml(request, 'internet-evc-access-information', false)
- def vrLan = utils.getNodeXml(request, 'vr-lan', false)
- def upceVmsServiceInfo = utils.getNodeXml(request, 'ucpe-vms-service-information', false)
- def vnfInformationList = utils.getNodeXml(request, 'vnf-information-list', false)
-
- def nnsRequestInformation = utils.removeXmlNamespaces(requestInformation)
- def nnsServiceInformation = utils.removeXmlNamespaces(serviceInformation)
- def nnsl2HomingInformation = utils.removeXmlNamespaces(l2HomingInformation)
- def nnsInternetEvcAccessInformation = utils.removeXmlNamespaces(internetEvcAccessInformation)
- def nnsVrLan = utils.removeXmlNamespaces(vrLan)
- def nnsUpceVmsServiceInfo = utils.removeXmlNamespaces(upceVmsServiceInfo)
- def nnsVnfInformationList = utils.removeXmlNamespaces(vrLan)
- def nnsinternetSvcChangeDetails = ""
-
- if(requestAction!=null && requestAction.equals("ChangeLayer3ServiceProvRequest")){
- def internetSvcChangeDetails = utils.removeXmlNamespaces(serviceParameters)
- nnsinternetSvcChangeDetails = """<internet-service-change-details>
- ${internetSvcChangeDetails}
- </internet-service-change-details>"""
- }
-
- if (additionalData == null) {
- additionalData = ""
- }
-
- String content = """
- <sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:sdncadapterworkflow="http://openecomp.com/mso/workflow/schema/v1"
- xmlns:sdncadapter="http://domain2.openecomp.com/workflow/sdnc/adapter/schema/v1">
- <sdncadapter:RequestHeader>
- <sdncadapter:RequestId>${requestId}</sdncadapter:RequestId>
- <sdncadapter:SvcInstanceId>${svcInstanceId}</sdncadapter:SvcInstanceId>
- <sdncadapter:SvcAction>${svcAction}</sdncadapter:SvcAction>
- <sdncadapter:SvcOperation>${svcOperation}</sdncadapter:SvcOperation>
- <sdncadapter:CallbackUrl>${callbackUrl}</sdncadapter:CallbackUrl>
- <sdncadapter:MsoAction>${msoAction}</sdncadapter:MsoAction>
- </sdncadapter:RequestHeader>
- <sdncadapterworkflow:SDNCRequestData>
- ${additionalData}
- ${nnsRequestInformation}
- ${nnsServiceInformation}
- ${nnsl2HomingInformation}
- ${nnsInternetEvcAccessInformation}
- ${nnsVrLan}
- ${nnsUpceVmsServiceInfo}
- ${nnsVnfInformationList}
- ${nnsinternetSvcChangeDetails}
- </sdncadapterworkflow:SDNCRequestData>
- </sdncadapterworkflow:SDNCAdapterWorkflowRequest>
- """
-
- content = utils.removeXmlPreamble(utils.formatXML(content))
- execution.setVariable(resultVar, content)
- taskProcessor.logDebug(resultVar + ' = ' + System.lineSeparator() + content, isDebugLogEnabled)
-
- taskProcessor.logDebug('Exited ' + method, isDebugLogEnabled)
- } catch (BpmnError e) {
- throw e;
- } catch (Exception e) {
- taskProcessor.logError('Caught exception in ' + method, e)
- taskProcessor.workflowException(execution, 'Internal Error', 9999) // TODO: what message and error code?
- }
- }
-
- /**
- * Builds a topology SDNC request and return String request.
- * As V2 will use 1607-style request, region instead of aic clli code
- * @param execution, the execution
- * @param requestXML, the incoming request for the flow
- * @param serviceInstanceId, the serviceIntance (if available)
- * @param callbackUrl, the call back url
- * @param action, the action element value
- * @param requestAction the svcOperation element value
- * @param cloudRegionId the aai's cloud-region-id
- * @param networkId the aai's network-id
- * @param additionalData additional XML content to be inserted into the
- * RequestData element (may be null)
- */
- public String sdncTopologyRequestV2 (Execution execution, String requestXML, String serviceInstanceId, String callbackUrl, String action, String requestAction, String cloudRegionId, networkId, String queryAAIResponse, String additionalData) {
- def utils=new MsoUtils()
-
- String requestId = ""
- try {
- requestId = execution.getVariable("openecomp-mso-request-id")
- } catch (Exception ex) {
- requestId = utils.getNodeText1(requestXML, "request-id")
- }
-
- String aicCloudRegion = cloudRegionId
- String tenantId = ""
- if (utils.nodeExists(requestXML, "tenant-id")) {
- tenantId = utils.getNodeText1(requestXML, "tenant-id")
- }
- String networkType = ""
- if (utils.nodeExists(requestXML, "network-type")) {
- networkType = utils.getNodeText1(requestXML, "network-type")
- }
-
- // Replace/Use the value of network-type from aai query (vs input) during Delete Network flows.
- if (queryAAIResponse != null) {
- networkType = utils.getNodeText1(queryAAIResponse, "network-type")
- }
-
- String serviceId = ""
- if (utils.nodeExists(requestXML, "service-id")) {
- serviceId = utils.getNodeText1(requestXML, "service-id")
- }
- String networkName = ""
- if (utils.nodeExists(requestXML, "network-name")) {
- networkName = utils.getNodeText1(requestXML, "network-name")
- }
- String source = ""
- if (utils.nodeExists(requestXML, "source")) {
- source = utils.getNodeText1(requestXML, "source")
- }
-
- // get resourceLink from subflow execution variable
- String serviceType = ""
- String subscriberName = ""
- String siRelatedLink = execution.getVariable("GENGSI_siResourceLink")
- if (siRelatedLink != null) {
- // get service type
- int serviceStart = siRelatedLink.indexOf("service-subscription/")
- int serviceEnd = siRelatedLink.indexOf("/service-instances/")
- serviceType = siRelatedLink.substring(serviceStart + 21, serviceEnd)
- serviceType = UriUtils.decode(serviceType,"UTF-8")
- // get subscriber name
- int subscriberNameStart = siRelatedLink.indexOf("customers/customer/")
- int subscriberNameEnd = siRelatedLink.indexOf("/service-subscriptions/")
- subscriberName = siRelatedLink.substring(subscriberNameStart + 19, subscriberNameEnd)
- subscriberName = UriUtils.decode(subscriberName,"UTF-8")
- }
-
- String content =
- """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://openecomp.com/mso/workflow/schema/v1"
- xmlns:sdncadapterworkflow="http://openecomp.com/mso/workflow/schema/v1"
- xmlns:sdncadapter="http://domain2.openecomp.com/workflow/sdnc/adapter/schema/v1"
- xmlns:ns5="http://openecomp.com/mso/request/types/v1">
- <sdncadapter:RequestHeader>
- <sdncadapter:RequestId>${requestId}</sdncadapter:RequestId>
- <sdncadapter:SvcInstanceId>${serviceInstanceId}</sdncadapter:SvcInstanceId>
- <sdncadapter:SvcAction>${action}</sdncadapter:SvcAction>
- <sdncadapter:SvcOperation>network-topology-operation</sdncadapter:SvcOperation>
- <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl>
- </sdncadapter:RequestHeader>
- <sdncadapterworkflow:SDNCRequestData>
- <request-information>
- <request-id>${requestId}</request-id>
- <request-action>${requestAction}</request-action>
- <source>${source}</source>
- <notification-url></notification-url>
- <order-number></order-number>
- <order-version></order-version>
- </request-information>
- <service-information>
- <service-id>${serviceId}</service-id>
- <service-type>${serviceType}</service-type>
- <service-instance-id>${serviceInstanceId}</service-instance-id>
- <subscriber-name>${subscriberName}</subscriber-name>
- </service-information>
- <network-request-information>
- <network-id>${networkId}</network-id>
- <network-type>${networkType}</network-type>
- <network-name>${networkName}</network-name>
- <tenant>${tenantId}</tenant>
- <aic-cloud-region>${aicCloudRegion}</aic-cloud-region>
- </network-request-information>
- </sdncadapterworkflow:SDNCRequestData>
- </aetgt:SDNCAdapterWorkflowRequest>""".trim()
-
- return content
- }
-
- /**
- * Builds a topology SDNC request and return String request.
- * As V2 will use 1607-style request, region instead of aic clli code
- * @param execution, the execution
- * @param requestXML, the incoming request for the flow
- * @param serviceInstanceId, the serviceIntance (if available)
- * @param callbackUrl, the call back url
- * @param action, the action element value
- * @param requestAction the svcOperation element value
- * @param cloudRegionId the aai's cloud-region-id
- * @param networkId the aai's network-id
- * @param additionalData additional XML content to be inserted into the
- * RequestData element (may be null)
- */
- public String sdncTopologyRequestRsrc (Execution execution, String requestXML, String serviceInstanceId, String callbackUrl, String action, String requestAction, String cloudRegionId, networkId, String additionalData) {
- def utils=new MsoUtils()
-
- // SNDC is expecting requestId as unique each call.
- String requestId = ""
- String testRequestId = execution.getVariable("testMessageId") // for test purposes.
- if (testRequestId == null) {
- requestId = UUID.randomUUID() // generate unique
- } else {
- requestId = testRequestId
- }
-
- String aicCloudRegion = cloudRegionId
- String tenantId = ""
- if (utils.nodeExists(requestXML, "tenant-id")) {
- tenantId = utils.getNodeText1(requestXML, "tenant-id")
- }
- String networkType = ""
- if (utils.nodeExists(requestXML, "network-type")) {
- networkType = utils.getNodeText1(requestXML, "network-type")
- }
-
- String subscriptionServiceType = ""
- if (utils.nodeExists(requestXML, "subscription-service-type")) {
- subscriptionServiceType = utils.getNodeText1(requestXML, "subscription-service-type")
- }
-
- String globalCustomerId = ""
- if (utils.nodeExists(requestXML, "global-customer-id")) {
- globalCustomerId = utils.getNodeText1(requestXML, "global-customer-id")
- }
-
- String serviceId = ""
- if (utils.nodeExists(requestXML, "service-id")) {
- serviceId = utils.getNodeText1(requestXML, "service-id")
- }
- String networkName = ""
- if (utils.nodeExists(requestXML, "network-name")) {
- networkName = utils.getNodeText1(requestXML, "network-name")
- }
- String source = ""
- if (utils.nodeExists(requestXML, "source")) {
- source = utils.getNodeText1(requestXML, "source")
- }
-
- // get resourceLink from subflow execution variable
- String serviceType = ""
- String subscriberName = ""
- String siRelatedLink = execution.getVariable("GENGSI_siResourceLink")
- if (siRelatedLink != null) {
- // get service type
- int serviceStart = siRelatedLink.indexOf("service-subscription/")
- int serviceEnd = siRelatedLink.indexOf("/service-instances/")
- serviceType = siRelatedLink.substring(serviceStart + 21, serviceEnd)
- serviceType = UriUtils.decode(serviceType,"UTF-8")
- // get subscriber name
- int subscriberNameStart = siRelatedLink.indexOf("customers/customer/")
- int subscriberNameEnd = siRelatedLink.indexOf("/service-subscriptions/")
- subscriberName = siRelatedLink.substring(subscriberNameStart + 19, subscriberNameEnd)
- subscriberName = UriUtils.decode(subscriberName,"UTF-8")
- }
-
- // network-information from 'networkModelInfo' // verify the DB Catalog response
- String networkModelInfo = utils.getNodeXml(requestXML, "networkModelInfo", false).replace("tag0:","").replace(":tag0","")
- String modelInvariantUuid = utils.getNodeText1(networkModelInfo, "modelInvariantUuid") !=null ?
- utils.getNodeText1(networkModelInfo, "modelInvariantUuid") : ""
- String modelCustomizationUuid = utils.getNodeText1(networkModelInfo, "modelCustomizationUuid") !=null ?
- utils.getNodeText1(networkModelInfo, "modelCustomizationUuid") : ""
- String modelUuid = utils.getNodeText1(networkModelInfo, "modelUuid") !=null ?
- utils.getNodeText1(networkModelInfo, "modelUuid") : ""
- String modelVersion = utils.getNodeText1(networkModelInfo, "modelVersion") !=null ?
- utils.getNodeText1(networkModelInfo, "modelVersion") : ""
- String modelName = utils.getNodeText1(networkModelInfo, "modelName") !=null ?
- utils.getNodeText1(networkModelInfo, "modelName") : ""
-
- // service-information from 'networkModelInfo' // verify the DB Catalog response
- String serviceModelInfo = utils.getNodeXml(requestXML, "serviceModelInfo", false).replace("tag0:","").replace(":tag0","")
- String serviceModelInvariantUuid = utils.getNodeText1(serviceModelInfo, "modelInvariantUuid") !=null ?
- utils.getNodeText1(serviceModelInfo, "modelInvariantUuid") : ""
- String serviceModelUuid = utils.getNodeText1(serviceModelInfo, "modelUuid") !=null ?
- utils.getNodeText1(serviceModelInfo, "modelUuid") : ""
- String serviceModelVersion = utils.getNodeText1(serviceModelInfo, "modelVersion") !=null ?
- utils.getNodeText1(serviceModelInfo, "modelVersion") : ""
- String serviceModelName = utils.getNodeText1(serviceModelInfo, "modelName") !=null ?
- utils.getNodeText1(serviceModelInfo, "modelName") : ""
-
-
- String content =
- """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://openecomp.com/mso/workflow/schema/v1"
- xmlns:sdncadapter="http://domain2.openecomp.com/workflow/sdnc/adapter/schema/v1"
- xmlns:sdncadapterworkflow="http://openecomp.com/mso/workflow/schema/v1">
- <sdncadapter:RequestHeader>
- <sdncadapter:RequestId>${requestId}</sdncadapter:RequestId>
- <sdncadapter:SvcInstanceId>${serviceInstanceId}</sdncadapter:SvcInstanceId>
- <sdncadapter:SvcAction>${action}</sdncadapter:SvcAction>
- <sdncadapter:SvcOperation>network-topology-operation</sdncadapter:SvcOperation>
- <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl>
- <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction>
- </sdncadapter:RequestHeader>
- <sdncadapterworkflow:SDNCRequestData>
- <request-information>
- <request-id>${requestId}</request-id>
- <request-action>${requestAction}</request-action>
- <source>${source}</source>
- <notification-url></notification-url>
- <order-number></order-number>
- <order-version></order-version>
- </request-information>
- <service-information>
- <service-id>${serviceId}</service-id>
- <subscription-service-type>${subscriptionServiceType}</subscription-service-type>
- <ecomp-model-information>
- <model-invariant-uuid>${serviceModelInvariantUuid}</model-invariant-uuid>
- <model-uuid>${serviceModelUuid}</model-uuid>
- <model-version>${serviceModelVersion}</model-version>
- <model-name>${serviceModelName}</model-name>
- </ecomp-model-information>
- <service-instance-id>${serviceInstanceId}</service-instance-id>
- <global-customer-id>${globalCustomerId}</global-customer-id>
- <subscriber-name>${subscriberName}</subscriber-name>
- </service-information>
- <network-information>
- <network-id>${networkId}</network-id>
- <network-type>${networkType}</network-type>
- <ecomp-model-information>
- <model-invariant-uuid>${modelInvariantUuid}</model-invariant-uuid>
- <model-customization-uuid>${modelCustomizationUuid}</model-customization-uuid>
- <model-uuid>${modelUuid}</model-uuid>
- <model-version>${modelVersion}</model-version>
- <model-name>${modelName}</model-name>
- </ecomp-model-information>
- </network-information>
- <network-request-input>
- <network-name>${networkName}</network-name>
- <tenant>${tenantId}</tenant>
- <aic-cloud-region>${aicCloudRegion}</aic-cloud-region>
- <aic-clli></aic-clli>
- <network-input-parameters/>
- </network-request-input>
- </sdncadapterworkflow:SDNCRequestData>
- </aetgt:SDNCAdapterWorkflowRequest>""".trim()
-
- return content
- }
-
- /**
- * Validates a workflow response.
- * @param execution the execution
- * @param responseVar the execution variable in which the response is stored
- * @param workflowException the WorkflowException Object returned from sdnc call
- */
- public void validateSDNCResponse(Execution execution, String response, WorkflowException workflowException, boolean successIndicator){
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- taskProcessor.utils.log("DEBUG", "SDNC Response is: " + response, isDebugLogEnabled)
- taskProcessor.utils.log("DEBUG", "SuccessIndicator is: " + successIndicator, isDebugLogEnabled)
-
- try {
- def prefix = execution.getVariable('prefix')
- execution.setVariable(prefix+'sdncResponseSuccess', false)
- taskProcessor.utils.log("DEBUG", "Response" + ' = ' + (response == null ? "" : System.lineSeparator()) + response, isDebugLogEnabled)
-
- if (successIndicator == true){
- if (response == null || response.trim().equals("")) {
- taskProcessor.utils.log("DEBUG", response + ' is empty');
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, "SDNCAdapter Workflow Response is Empty")
- }else{
-
- // we need to peer into the request data for error
- def String sdncAdapterWorkflowResponse = taskProcessor.utils.getNodeXml(response, 'response-data', false)
- def String decodedXml = decodeXML(sdncAdapterWorkflowResponse).replace('<?xml version="1.0" encoding="UTF-8"?>', "")
-
- // change '&' to "&amp; (if present as data, ex: subscriber-name = 'FOUR SEASONS HEATING & COOLING_8310006378683'
- decodedXml = decodedXml.replace("&", "&amp;")
-
- taskProcessor.utils.log("DEBUG","decodedXml:\n" + decodedXml, isDebugLogEnabled)
-
- int requestDataResponseCode = 200
- def String requestDataResponseMessage = ''
-
- try{
- if (taskProcessor.utils.nodeExists(decodedXml, "response-message")) {
- requestDataResponseMessage = taskProcessor.utils.getNodeText(decodedXml, "response-message")
- } else if (taskProcessor.utils.nodeExists(decodedXml, "ResponseMessage")) {
- requestDataResponseMessage = taskProcessor.utils.getNodeText(decodedXml, "ResponseMessage")
- }
- }catch(Exception e){
- taskProcessor.utils.log("DEBUG", 'Error caught while decoding resposne ' + e.getMessage(), isDebugLogEnabled)
- }
-
- if(taskProcessor.utils.nodeExists(decodedXml, "response-code")) {
- taskProcessor.utils.log("DEBUG","response-code node Exist ", isDebugLogEnabled)
- String code = taskProcessor.utils.getNodeText1(decodedXml, "response-code")
- if(code.isEmpty() || code.equals("")){
- // if response-code is blank then Success
- taskProcessor.utils.log("DEBUG","response-code node is empty", isDebugLogEnabled)
- requestDataResponseCode = 0
- }else{
- requestDataResponseCode = code.toInteger()
- taskProcessor.utils.log("DEBUG","response-code is: " + requestDataResponseCode, isDebugLogEnabled)
- }
- }else if(taskProcessor.utils.nodeExists(decodedXml, "ResponseCode")){
- taskProcessor.utils.log("DEBUG","ResponseCode node Exist ", isDebugLogEnabled)
- String code = taskProcessor.utils.getNodeText1(decodedXml, "ResponseCode")
- if(code.isEmpty() || code.equals("")){
- // if ResponseCode blank then Success
- taskProcessor.utils.log("DEBUG","ResponseCode node is empty", isDebugLogEnabled)
- requestDataResponseCode = 0
- }else{
- requestDataResponseCode = code.toInteger()
- taskProcessor.utils.log("DEBUG","ResponseCode is: " + requestDataResponseCode, isDebugLogEnabled)
- }
- }else{
- taskProcessor.utils.log("DEBUG","A Response Code DOES NOT Exist.", isDebugLogEnabled)
- // if a response code does not exist then Success
- requestDataResponseCode = 0
- }
- try{
-
- // if a response code is 0 or 200 then Success
- if (requestDataResponseCode == 200 || requestDataResponseCode == 0) {
- execution.setVariable(prefix+'sdncResponseSuccess', true)
- taskProcessor.utils.log("DEBUG", "Setting sdncResponseSuccess to True ", isDebugLogEnabled)
- taskProcessor.utils.log("DEBUG", "Exited ValidateSDNCResponse Method", isDebugLogEnabled)
- }else{
- ExceptionUtil exceptionUtil = new ExceptionUtil()
- String convertedCode = exceptionUtil.MapSDNCResponseCodeToErrorCode(requestDataResponseCode.toString())
- int convertedCodeInt = Integer.parseInt(convertedCode)
- exceptionUtil.buildAndThrowWorkflowException(execution, convertedCodeInt, "Received error from SDN-C: " + requestDataResponseMessage)
- }
-
- }catch(Exception e){
- //TODO proper handling of new, non numerical response codes in 1607 and new error handling for common API
- requestDataResponseCode = 500
- }
-
- taskProcessor.utils.log("DEBUG", "SDNC callback response-code: " + requestDataResponseCode, isDebugLogEnabled)
- taskProcessor.utils.log("DEBUG", "SDNC callback response-message: " + requestDataResponseMessage, isDebugLogEnabled)
- }
-
- }else {
- taskProcessor.utils.log("DEBUG", 'SDNCAdapter Subflow did NOT complete Successfully. SuccessIndicator is False. ')
- if(workflowException != null){
- exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage())
- }else{
- //TODO : what error code and error message use here
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Internal Error - SDNCAdapter Subflow did NOT complete successfully.")
- }
- }
-
- } catch (BpmnError e) {
- throw e;
- } catch (Exception e) {
- taskProcessor.utils.log("DEBUG", 'END of Validate SDNC Response', isDebugLogEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, 'Internal Error- Unable to validate SDNC Response ');
- }
- }
-
- /**
- * Validates a workflow response.
- * @param execution the execution
- * @param responseVar the execution variable in which the response is stored
- * @param responseCodeVar the execution variable in which the response code is stored
- * @param errorResponseVar the execution variable in which the error response is stored
- */
- public void validateL3BondingSDNCResp(Execution execution, String response, WorkflowException workflowException, boolean success) {
- def method = getClass().getSimpleName() + '.validateL3BondingSDNCResp(' +
- 'execution=' + execution.getId() +
- ', response=' + response +
- ')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- taskProcessor.logDebug('Entered ' + method, isDebugLogEnabled)
- def prefix = execution.getVariable('prefix')
- CommonExceptionUtil commonExceptionUtil = new CommonExceptionUtil()
-
- try {
- execution.setVariable(prefix+'sdncResponseSuccess', false)
-
- taskProcessor.utils.log("sdncAdapter Success Indicator is: " + success, isDebugLogEnabled)
- if (success == true) {
-
- // we need to look inside the request data for error
- def String callbackRequestData = taskProcessor.utils.getNodeXml(response, 'RequestData', false)
- def String decodedXml = decodeXML(callbackRequestData)
- taskProcessor.utils.log("DEBUG","decodedXml:\n" + decodedXml, isDebugLogEnabled)
-
- def requestDataResponseCode = '200'
- def requestDataResponseMessage = ''
- int intDataResponseCode = 200
-
- if (taskProcessor.utils.nodeExists(decodedXml, "response-code")) {
-
- requestDataResponseCode = ((String) taskProcessor.utils.getNodeText(decodedXml, "response-code"))
- if (taskProcessor.utils.nodeExists(decodedXml, "response-message")) {
- requestDataResponseMessage = taskProcessor.utils.getNodeText(decodedXml, "response-message")
- }
- }else if(taskProcessor.utils.nodeExists(decodedXml, "ResponseCode")){
- requestDataResponseCode = ((String) taskProcessor.utils.getNodeText1(decodedXml, "ResponseCode")).toInteger()
- }else if(taskProcessor.utils.nodeExists(response, "ResponseCode")){
- requestDataResponseCode = ((String) taskProcessor.utils.getNodeText1(response, "ResponseCode")).toInteger()
- requestDataResponseMessage = taskProcessor.utils.getNodeText(response, "ResponseMessage")
- }
-
- taskProcessor.utils.log("DEBUG", "SDNC callback response-code: " + requestDataResponseCode, isDebugLogEnabled)
- taskProcessor.utils.log("DEBUG", "SDNC callback response-message: " + requestDataResponseMessage, isDebugLogEnabled)
-
- // Get the AAI Status to determine if rollback is needed on ASSIGN
- def aai_status = ''
- if (taskProcessor.utils.nodeExists(decodedXml, "aai-status")) {
- aai_status = ((String) taskProcessor.utils.getNodeText(decodedXml, "aai-status"))
- taskProcessor.utils.log("DEBUG", "SDNC sent AAI STATUS code: " + aai_status, isDebugLogEnabled)
- }
- if (aai_status != null && !aai_status.equals("")) {
- execution.setVariable(prefix+"AaiStatus",aai_status)
- taskProcessor.utils.log("DEBUG", "Set variable " + prefix + "AaiStatus: " + execution.getVariable(prefix+"AaiStatus"), isDebugLogEnabled)
- }
-
- // Get the result string to determine if rollback is needed on ASSIGN in Add Bonding flow only
- def sdncResult = ''
- if (taskProcessor.utils.nodeExists(decodedXml, "result")) {
- sdncResult = ((String) taskProcessor.utils.getNodeText(decodedXml, "result"))
- taskProcessor.utils.log("DEBUG", "SDNC sent result: " + sdncResult, isDebugLogEnabled)
- }
- if (sdncResult != null && !sdncResult.equals("")) {
- execution.setVariable(prefix+"SdncResult",sdncResult)
- taskProcessor.utils.log("DEBUG", "Set variable " + prefix + "SdncResult: " + execution.getVariable(prefix+"SdncResult"), isDebugLogEnabled)
- }
-
- try{
- intDataResponseCode = Integer.parseInt(String.valueOf(requestDataResponseCode))
- }catch(Exception e){
- intDataResponseCode = 400
- }
-
- taskProcessor.utils.log("DEBUG", "intDataResponseCode " + intDataResponseCode , isDebugLogEnabled)
-
- // if response-code is not Success (200, 201, etc) we need to throw an exception
- if (intDataResponseCode != 200 && intDataResponseCode != 0) {
- execution.setVariable(prefix+'ResponseCode', intDataResponseCode)
- execution.setVariable("L3HLAB_rollback", true)
- def msg = commonExceptionUtil.mapSDNCAdapterExceptionToErrorResponse(response, execution)
- taskProcessor.commonWorkflowException(execution, intDataResponseCode, "Received error from SDN-C: " + msg)
-
- }
- }else {
- taskProcessor.logWarn('sdncAdapter did not complete successfully, sdncAdapter Success Indicator was false ')
- execution.setVariable("L3HLAB_rollback", true)
- def msg = commonExceptionUtil.mapSDNCAdapterExceptionToErrorResponse(response, execution)
- taskProcessor.commonWorkflowException(execution, responseCode, msg)
- }
-
- if (response == null || response.trim().equals("")) {
- taskProcessor.logWarn('sdncAdapter workflow response is empty');
- execution.setVariable("L3HLAB_rollback", true)
- def msg = commonExceptionUtil.buildException("Exception occurred while validating SDNC response " , execution)
- taskProcessor.commonWorkflowException(execution, intResponseCode, msg)
- }
-
- execution.setVariable(prefix+'sdncResponseSuccess', true)
- taskProcessor.logDebug('Exited ' + method, isDebugLogEnabled)
- } catch (BpmnError e) {
- throw e;
- } catch (Exception e) {
- taskProcessor.logError('Caught exception in ' + method, e)
- execution.setVariable(prefix+"ResponseCode",400)
- execution.setVariable("L3HLAB_rollback", true)
- def msg = commonExceptionUtil.buildException("Exception occurred while validating SDNC response: " + e.getMessage(), execution)
- taskProcessor.commonWorkflowException(execution, 400, msg)
- }
- }
-
- /**
- * Decode XML - replace &amp; &lt; and &gt; with '&', '<' and '>'
- * @param xml - the xml to be decoded
- */
- private String decodeXML(String xml) {
- def String decodedXml = xml.replaceAll("&amp;", "&")
- decodedXml = decodedXml.replaceAll("&lt;", "<")
- decodedXml = decodedXml.replaceAll("&gt;", ">")
- }
-
-}
+/*-
+ * ============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.common.scripts;
+
+import org.apache.commons.lang3.*
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.runtime.Execution
+import org.openecomp.mso.bpmn.core.WorkflowException
+import org.openecomp.mso.bpmn.core.json.JsonUtils;
+import org.springframework.web.util.UriUtils
+
+
+/**
+ * @version 1.0
+ *
+ */
+class SDNCAdapterUtils {
+
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+ JsonUtils jsonUtil = new JsonUtils()
+
+ private AbstractServiceTaskProcessor taskProcessor
+
+ public SDNCAdapterUtils(AbstractServiceTaskProcessor taskProcessor) {
+ this.taskProcessor = taskProcessor
+ }
+
+ String SDNCAdapterFeatureRequest(Execution execution, String requestName, String action, String callbackURL, String serviceOperation, String timeoutValueInMinutes) {
+ def utils=new MsoUtils()
+
+ def prefix = execution.getVariable('prefix')
+ def request = taskProcessor.getVariable(execution, requestName)
+ def requestInformation = utils.getNodeXml(request, 'request-information', false)
+ def serviceInformation = utils.getNodeXml(request, 'service-information', false)
+ def featureInformation = utils.getNodeXml(request, 'feature-information', false)
+ def featureParameters = utils.getNodeXml(request, 'feature-parameters', false)
+
+ def requestId = execution.getVariable('testReqId') // for junits
+ if(requestId==null){
+ requestId = execution.getVariable("mso-request-id") + "-" + System.currentTimeMillis()
+ }
+
+ def svcInstanceId = execution.getVariable("mso-service-instance-id")
+
+ def nnsRequestInformation = utils.removeXmlNamespaces(requestInformation)
+ def nnsServiceInformation = utils.removeXmlNamespaces(serviceInformation)
+ def nnsFeatureInformation = utils.removeXmlNamespaces(featureInformation)
+ def nnsFeatureParameters = utils.removeXmlNamespaces(featureParameters)
+
+ String sdncAdapterFeatureRequest = """
+ <sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:sdncadapterworkflow="http://openecomp.com/mso/workflow/schema/v1"
+ xmlns:sdncadapter="http://domain2.openecomp.com/workflow/sdnc/adapter/schema/v1">
+ <sdncadapter:RequestHeader>
+ <sdncadapter:RequestId>${requestId}</sdncadapter:RequestId>
+ <sdncadapter:SvcInstanceId>${svcInstanceId}</sdncadapter:SvcInstanceId>
+ <sdncadapter:SvcAction>${action}</sdncadapter:SvcAction>
+ <sdncadapter:SvcOperation>${serviceOperation}</sdncadapter:SvcOperation>
+ <sdncadapter:CallbackUrl>${callbackURL}</sdncadapter:CallbackUrl>
+ </sdncadapter:RequestHeader>
+ <sdncadapterworkflow:SDNCRequestData>
+ ${nnsRequestInformation}
+ ${nnsServiceInformation}
+ ${nnsFeatureInformation}
+ ${nnsFeatureParameters}
+ </sdncadapterworkflow:SDNCRequestData>
+ <sdncadapterworkflow:SDNCTimeOutValueInMinutes>${timeoutValueInMinutes}</sdncadapterworkflow:SDNCTimeOutValueInMinutes>
+ </sdncadapterworkflow:SDNCAdapterWorkflowRequest>
+ """
+ sdncAdapterFeatureRequest = utils.removeXmlPreamble(utils.formatXML(sdncAdapterFeatureRequest))
+ return sdncAdapterFeatureRequest
+ }
+
+ String SDNCAdapterActivateVnfRequest(Execution execution, String action, String callbackURL, String serviceOperation, String msoAction, String timeoutValueInMinutes) {
+ def utils=new MsoUtils()
+
+ def prefix = execution.getVariable('prefix')
+ def request = taskProcessor.getVariable(execution, prefix+'Request')
+ def requestInformation = utils.getNodeXml(request, 'request-information', false)
+ def serviceInformation = utils.getNodeXml(request, 'service-information', false)
+ def vnfInformationList = utils.getNodeXml(request, 'vnf-information-list', false)
+
+ def requestId = execution.getVariable('testReqId') // for junits
+ if(requestId==null){
+ requestId = execution.getVariable("mso-request-id") + "-" + System.currentTimeMillis()
+ }
+
+ def svcInstanceId = execution.getVariable("mso-service-instance-id")
+
+ def nnsRequestInformation = utils.removeXmlNamespaces(requestInformation)
+ def nnsServiceInformation = utils.removeXmlNamespaces(serviceInformation)
+ def nnsVnfInformationList = utils.removeXmlNamespaces(vnfInformationList)
+
+ String sdncAdapterActivateVnfRequest = """
+ <sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:sdncadapterworkflow="http://openecomp.com/mso/workflow/schema/v1"
+ xmlns:sdncadapter="http://domain2.openecomp.com/workflow/sdnc/adapter/schema/v1">
+ <sdncadapter:RequestHeader>
+ <sdncadapter:RequestId>${requestId}</sdncadapter:RequestId>
+ <sdncadapter:SvcInstanceId>${svcInstanceId}</sdncadapter:SvcInstanceId>
+ <sdncadapter:SvcAction>${action}</sdncadapter:SvcAction>
+ <sdncadapter:SvcOperation>${serviceOperation}</sdncadapter:SvcOperation>
+ <sdncadapter:CallbackUrl>${callbackURL}</sdncadapter:CallbackUrl>
+ <sdncadapter:MsoAction>${msoAction}</sdncadapter:MsoAction>
+ </sdncadapter:RequestHeader>
+ <sdncadapterworkflow:SDNCRequestData>
+ ${nnsRequestInformation}
+ ${nnsServiceInformation}
+ ${nnsVnfInformationList}
+ </sdncadapterworkflow:SDNCRequestData>
+ <sdncadapterworkflow:SDNCTimeOutValueInMinutes>${timeoutValueInMinutes}</sdncadapterworkflow:SDNCTimeOutValueInMinutes>
+ </sdncadapterworkflow:SDNCAdapterWorkflowRequest>
+ """
+ sdncAdapterActivateVnfRequest = utils.removeXmlPreamble(utils.formatXML(sdncAdapterActivateVnfRequest))
+ return sdncAdapterActivateVnfRequest
+ }
+
+ String SDNCAdapterL3ToHigherLayerRequest(Execution execution, String action, String callbackURL, String serviceOperation, String timeoutValueInMinutes) {
+ def utils=new MsoUtils()
+
+ def prefix = execution.getVariable('prefix')
+ def request = taskProcessor.getVariable(execution, prefix+'Request')
+
+ def requestInformation = """<request-information>
+ <request-id>${execution.getVariable("mso-request-id")}</request-id>
+ <request-action>torepl</request-action>
+ <source>${execution.getVariable(prefix+"source")}</source>
+ <notification-url>${execution.getVariable(prefix+"notificationUrl")}</notification-url>
+ </request-information>"""
+
+ // Change the value of the 'request-information'.'request-action' element
+ def xml = new XmlSlurper().parseText(requestInformation)
+ if("assign".equalsIgnoreCase(action)){
+ xml.'request-action'.replaceBody('createTrinityBonding')
+ }else if("activate".equalsIgnoreCase(action)){
+ xml.'request-action'.replaceBody('activateTrinityBonding')
+ }else if("delete".equalsIgnoreCase(action)){
+ xml.'request-action'.replaceBody('deleteTrinityBonding')
+ }
+ requestInformation = utils.removeXmlPreamble(groovy.xml.XmlUtil.serialize(xml))
+ def nnsRequestInformation = utils.removeXmlNamespaces(requestInformation)
+
+ def requestId = execution.getVariable('testReqId') // for junits
+ if(requestId==null){
+ requestId = execution.getVariable("mso-request-id") + "-" + System.currentTimeMillis()
+ }
+
+ def svcInstanceId = execution.getVariable("mso-service-instance-id")
+
+ //Build Service Information
+ // Send serviceName from CANOPI to sdnc for service-type
+ def serviceInformation = """<service-information>
+ <service-type>${execution.getVariable(prefix+"serviceName")}</service-type>
+ <service-instance-id>${svcInstanceId}</service-instance-id>
+ <subscriber-name>${execution.getVariable(prefix+"subscriberName")}</subscriber-name>
+ <subscriber-global-id>${execution.getVariable(prefix+"subscriberGlobalId")}</subscriber-global-id>
+ </service-information>"""
+
+ //Build Additional Information - vpn or vni
+ // Send serviceType from CANOPI to SDNC for nbnc-request-information service-type
+ def service = execution.getVariable(prefix+"serviceType")
+ def customerId = execution.getVariable(prefix+"customerId")
+ def vpnId = execution.getVariable(prefix+"vpnId")
+ def vpnRt = execution.getVariable(prefix+"vpnRt")
+ def vpnService = execution.getVariable(prefix+"vpnService")
+ def vpnRegion = execution.getVariable(prefix+"vpnRegion")
+ def additionalInfo = ""
+ if("assign".equalsIgnoreCase(action)){
+ additionalInfo = """<vpn-data-list>
+ <vpn-id>${vpnId}</vpn-id>
+ <vpn-rt>${vpnRt}</vpn-rt>
+ <vpn-service>${vpnService}</vpn-service>
+ <vpn-region>${vpnRegion}</vpn-region>
+ </vpn-data-list>"""
+ }else if("activate".equalsIgnoreCase(action) || "delete".equalsIgnoreCase(action)){
+ def vniId = execution.getVariable(prefix+'vniId')
+ additionalInfo = "<vni-id>${vniId}</vni-id>"
+ }
+
+ //Set Interface Status
+ def interfaceStatus = "DISABLE"
+ if("activate".equalsIgnoreCase(action)){
+ interfaceStatus = "ENABLE"
+ }
+
+ //Build SDNC Adapter Request
+ String sdncAdapterL3ToHLRequest = """
+ <sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:sdncadapterworkflow="http://openecomp.com/mso/workflow/schema/v1"
+ xmlns:sdncadapter="http://domain2.openecomp.com/workflow/sdnc/adapter/schema/v1">
+ <sdncadapter:RequestHeader>
+ <sdncadapter:RequestId>${requestId}</sdncadapter:RequestId>
+ <sdncadapter:SvcInstanceId>${svcInstanceId}</sdncadapter:SvcInstanceId>
+ <sdncadapter:SvcAction>${action}</sdncadapter:SvcAction>
+ <sdncadapter:SvcOperation>${serviceOperation}</sdncadapter:SvcOperation>
+ <sdncadapter:CallbackUrl>${callbackURL}</sdncadapter:CallbackUrl>
+ </sdncadapter:RequestHeader>
+ <sdncadapterworkflow:SDNCRequestData>
+ ${nnsRequestInformation}
+ ${serviceInformation}
+ <nbnc-request-information>
+ <service-type>${service}</service-type>
+ <customer-id>${customerId}</customer-id>
+ <interface-status>${interfaceStatus}</interface-status>
+ ${additionalInfo}
+ </nbnc-request-information>
+ </sdncadapterworkflow:SDNCRequestData>
+ <sdncadapterworkflow:SDNCTimeOutValueInMinutes>${timeoutValueInMinutes}</sdncadapterworkflow:SDNCTimeOutValueInMinutes>
+ </sdncadapterworkflow:SDNCAdapterWorkflowRequest>
+ """
+ sdncAdapterL3ToHLRequest = utils.removeXmlPreamble(utils.formatXML(sdncAdapterL3ToHLRequest))
+
+ return sdncAdapterL3ToHLRequest
+ }
+
+
+
+ private void SDNCAdapterActivateRequest(Execution execution, String resultVar, String svcAction,
+ String svcOperation, String additionalData) {
+ def utils=new MsoUtils()
+
+ def prefix = execution.getVariable('prefix')
+ def request = taskProcessor.getVariable(execution, prefix+'Request')
+ def requestInformation = utils.getNodeXml(request, 'request-information', false)
+ def serviceInformation = utils.getNodeXml(request, 'service-information', false)
+ def serviceParameters = utils.getNodeXml(request, 'service-parameters', false)
+
+ def requestId = execution.getVariable('testReqId') // for junits
+ if(requestId==null){
+ requestId = execution.getVariable("mso-request-id") + "-" + System.currentTimeMillis()
+ }
+
+ def svcInstanceId = execution.getVariable("mso-service-instance-id")
+ def msoAction = 'gammainternet'
+
+ def timeoutInMinutes = execution.getVariable('URN_mso_sdnc_timeout_firewall_minutes')
+
+ def callbackUrl = (String) execution.getVariable('URN_mso_workflow_sdncadapter_callback')
+ if (callbackUrl == null || callbackUrl.trim() == "") {
+ logError('mso:workflow:sdncadapter:callback URN is not set')
+ workflowException(execution, 'Internal Error', 9999) // TODO: what message and error code?
+ }
+
+ def l2HomingInformation = utils.getNodeXml(serviceParameters, 'l2-homing-information', false)
+ def internetEvcAccessInformation = utils.getNodeXml(serviceParameters, 'internet-evc-access-information', false)
+ def vrLan = utils.getNodeXml(serviceParameters, 'vr-lan', false)
+ def upceVmsServiceInformation = utils.getNodeXml(serviceParameters, 'ucpe-vms-service-information', false)
+
+
+ def nnsRequestInformation = utils.removeXmlNamespaces(requestInformation)
+ def nnsServiceInformation = utils.removeXmlNamespaces(serviceInformation)
+ def nnsl2HomingInformation = utils.removeXmlNamespaces(l2HomingInformation)
+ def nnsInternetEvcAccessInformation = utils.removeXmlNamespaces(internetEvcAccessInformation)
+ def nnsVrLan = utils.removeXmlNamespaces(vrLan)
+ def nnsUpceVmsServiceInformation = utils.removeXmlNamespaces(upceVmsServiceInformation)
+
+ if (additionalData == null) {
+ additionalData = ""
+ }
+
+ String content = """
+ <sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:sdncadapterworkflow="http://openecomp.com/mso/workflow/schema/v1"
+ xmlns:sdncadapter="http://domain2.openecomp.com/workflow/sdnc/adapter/schema/v1">
+ <sdncadapter:RequestHeader>
+ <sdncadapter:RequestId>${requestId}</sdncadapter:RequestId>
+ <sdncadapter:SvcInstanceId>${svcInstanceId}</sdncadapter:SvcInstanceId>
+ <sdncadapter:SvcAction>${svcAction}</sdncadapter:SvcAction>
+ <sdncadapter:SvcOperation>${svcOperation}</sdncadapter:SvcOperation>
+ <sdncadapter:CallbackUrl>${callbackUrl}</sdncadapter:CallbackUrl>
+ <sdncadapter:MsoAction>${msoAction}</sdncadapter:MsoAction>
+ </sdncadapter:RequestHeader>
+ <sdncadapterworkflow:SDNCRequestData>
+ ${additionalData}
+ ${nnsRequestInformation}
+ ${nnsServiceInformation}
+ ${nnsl2HomingInformation}
+ ${nnsInternetEvcAccessInformation}
+ ${nnsVrLan}
+ ${nnsUpceVmsServiceInformation}
+ </sdncadapterworkflow:SDNCRequestData>
+ <sdncadapterworkflow:SDNCTimeOutValueInMinutes>${timeoutInMinutes}</sdncadapterworkflow:SDNCTimeOutValueInMinutes>
+ </sdncadapterworkflow:SDNCAdapterWorkflowRequest>
+ """
+
+ content = utils.removeXmlPreamble(utils.formatXML(content))
+ execution.setVariable(resultVar, content)
+ }
+
+ /**
+ * Builds an SDNC "reserve" request and stores it in the specified execution
+ * variable.
+ * @param execution the execution
+ * @param resultVar the execution variable in which the result will be stored
+ */
+ public void sdncReservePrep(Execution execution, String action, String resultVar) {
+ sdncPrep(execution, resultVar, action , 'service-configuration-operation', null, this.taskProcessor)
+ }
+
+ /**
+ * Builds a basic SDNC request and stores it in the specified execution variable.
+ * @param execution the execution
+ * @param resultVar the execution variable in which the result will be stored
+ * @param svcAction the svcAction element value
+ * @param svcOperation the svcOperation element value
+ * @param additionalData additional XML content to be inserted into the
+ * RequestData element (may be null)
+ */
+ public void sdncPrep(Execution execution, String resultVar, String svcAction,
+ String svcOperation, String additionalData, AbstractServiceTaskProcessor taskProcessor) {
+ def method = getClass().getSimpleName() + '.sdncPrep(' +
+ 'execution=' + execution.getId() +
+ ', resultVar=' + resultVar +
+ ', svcAction=' + svcAction +
+ ', svcOperation=' + svcOperation +
+ ', additionalData=' + (additionalData == null ? "no" : "yes") +
+ ')'
+
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ taskProcessor.logDebug('Entered ' + method, isDebugLogEnabled)
+ MsoUtils utils = taskProcessor.utils
+ try {
+ def prefix = execution.getVariable('prefix')
+ def request = taskProcessor.getVariable(execution, prefix+'Request')
+ def requestInformation = utils.getNodeXml(request, 'request-information', false)
+ def serviceInformation = utils.getNodeXml(request, 'service-information', false)
+ def serviceParameters = utils.getChildNodes(request, 'service-parameters')
+ def requestAction = utils.getNodeText1(request, 'request-action')
+
+ def timeoutInMinutes = execution.getVariable('URN_mso_sdnc_timeout_firewall_minutes')
+
+ def requestId = execution.getVariable('testReqId') // for junits
+ if(requestId==null){
+ requestId = execution.getVariable("mso-request-id") + "-" + System.currentTimeMillis()
+ }
+
+ def svcInstanceId = execution.getVariable("mso-service-instance-id")
+ def msoAction = 'gammainternet'
+
+ def callbackUrl = (String) execution.getVariable('URN_mso_workflow_sdncadapter_callback')
+ if (callbackUrl == null || callbackUrl.trim() == "") {
+ taskProcessor.logError('mso:workflow:sdncadapter:callback URN is not set')
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Internal Error - During PreProcess Request")
+ }
+
+ def l2HomingInformation = utils.getNodeXml(request, 'l2-homing-information', false)
+ def internetEvcAccessInformation = utils.getNodeXml(request, 'internet-evc-access-information', false)
+ def vrLan = utils.getNodeXml(request, 'vr-lan', false)
+ def upceVmsServiceInfo = utils.getNodeXml(request, 'ucpe-vms-service-information', false)
+ def vnfInformationList = utils.getNodeXml(request, 'vnf-information-list', false)
+
+ def nnsRequestInformation = utils.removeXmlNamespaces(requestInformation)
+ def nnsServiceInformation = utils.removeXmlNamespaces(serviceInformation)
+ def nnsl2HomingInformation = utils.removeXmlNamespaces(l2HomingInformation)
+ def nnsInternetEvcAccessInformation = utils.removeXmlNamespaces(internetEvcAccessInformation)
+ def nnsVrLan = utils.removeXmlNamespaces(vrLan)
+ def nnsUpceVmsServiceInfo = utils.removeXmlNamespaces(upceVmsServiceInfo)
+ def nnsVnfInformationList = utils.removeXmlNamespaces(vrLan)
+ def nnsinternetSvcChangeDetails = ""
+
+ if(requestAction!=null && requestAction.equals("ChangeLayer3ServiceProvRequest")){
+ def internetSvcChangeDetails = utils.removeXmlNamespaces(serviceParameters)
+ nnsinternetSvcChangeDetails = """<internet-service-change-details>
+ ${internetSvcChangeDetails}
+ </internet-service-change-details>"""
+ }
+
+ if (additionalData == null) {
+ additionalData = ""
+ }
+
+ String content = """
+ <sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:sdncadapterworkflow="http://openecomp.com/mso/workflow/schema/v1"
+ xmlns:sdncadapter="http://domain2.openecomp.com/workflow/sdnc/adapter/schema/v1">
+ <sdncadapter:RequestHeader>
+ <sdncadapter:RequestId>${requestId}</sdncadapter:RequestId>
+ <sdncadapter:SvcInstanceId>${svcInstanceId}</sdncadapter:SvcInstanceId>
+ <sdncadapter:SvcAction>${svcAction}</sdncadapter:SvcAction>
+ <sdncadapter:SvcOperation>${svcOperation}</sdncadapter:SvcOperation>
+ <sdncadapter:CallbackUrl>${callbackUrl}</sdncadapter:CallbackUrl>
+ <sdncadapter:MsoAction>${msoAction}</sdncadapter:MsoAction>
+ </sdncadapter:RequestHeader>
+ <sdncadapterworkflow:SDNCRequestData>
+ ${additionalData}
+ ${nnsRequestInformation}
+ ${nnsServiceInformation}
+ ${nnsl2HomingInformation}
+ ${nnsInternetEvcAccessInformation}
+ ${nnsVrLan}
+ ${nnsUpceVmsServiceInfo}
+ ${nnsVnfInformationList}
+ ${nnsinternetSvcChangeDetails}
+ </sdncadapterworkflow:SDNCRequestData>
+ </sdncadapterworkflow:SDNCAdapterWorkflowRequest>
+ """
+
+ content = utils.removeXmlPreamble(utils.formatXML(content))
+ execution.setVariable(resultVar, content)
+ taskProcessor.logDebug(resultVar + ' = ' + System.lineSeparator() + content, isDebugLogEnabled)
+
+ taskProcessor.logDebug('Exited ' + method, isDebugLogEnabled)
+ } catch (BpmnError e) {
+ throw e;
+ } catch (Exception e) {
+ taskProcessor.logError('Caught exception in ' + method, e)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error")
+ }
+ }
+
+ /**
+ * Builds a topology SDNC request and return String request.
+ * As V2 will use 1607-style request, region instead of aic clli code
+ * @param execution, the execution
+ * @param requestXML, the incoming request for the flow
+ * @param serviceInstanceId, the serviceIntance (if available)
+ * @param callbackUrl, the call back url
+ * @param action, the action element value
+ * @param requestAction the svcOperation element value
+ * @param cloudRegionId the aai's cloud-region-id
+ * @param networkId the aai's network-id
+ * @param additionalData additional XML content to be inserted into the
+ * RequestData element (may be null)
+ */
+ public String sdncTopologyRequestV2 (Execution execution, String requestXML, String serviceInstanceId, String callbackUrl, String action, String requestAction, String cloudRegionId, networkId, String queryAAIResponse, String additionalData) {
+ def utils=new MsoUtils()
+
+ String requestId = ""
+ try {
+ requestId = execution.getVariable("mso-request-id")
+ } catch (Exception ex) {
+ requestId = utils.getNodeText1(requestXML, "request-id")
+ }
+
+ String aicCloudRegion = cloudRegionId
+ String tenantId = ""
+ if (utils.nodeExists(requestXML, "tenant-id")) {
+ tenantId = utils.getNodeText1(requestXML, "tenant-id")
+ }
+ String networkType = ""
+ if (utils.nodeExists(requestXML, "network-type")) {
+ networkType = utils.getNodeText1(requestXML, "network-type")
+ }
+
+ // Replace/Use the value of network-type from aai query (vs input) during Delete Network flows.
+ if (queryAAIResponse != null) {
+ networkType = utils.getNodeText1(queryAAIResponse, "network-type")
+ }
+
+ String serviceId = ""
+ if (utils.nodeExists(requestXML, "service-id")) {
+ serviceId = utils.getNodeText1(requestXML, "service-id")
+ }
+ String networkName = ""
+ if (utils.nodeExists(requestXML, "network-name")) {
+ networkName = utils.getNodeText1(requestXML, "network-name")
+ }
+ String source = ""
+ if (utils.nodeExists(requestXML, "source")) {
+ source = utils.getNodeText1(requestXML, "source")
+ }
+
+ // get resourceLink from subflow execution variable
+ String serviceType = ""
+ String subscriberName = ""
+ String siRelatedLink = execution.getVariable("GENGSI_siResourceLink")
+ if (siRelatedLink != null) {
+ // get service type
+ int serviceStart = siRelatedLink.indexOf("service-subscription/")
+ int serviceEnd = siRelatedLink.indexOf("/service-instances/")
+ serviceType = siRelatedLink.substring(serviceStart + 21, serviceEnd)
+ serviceType = UriUtils.decode(serviceType,"UTF-8")
+ // get subscriber name
+ int subscriberNameStart = siRelatedLink.indexOf("customers/customer/")
+ int subscriberNameEnd = siRelatedLink.indexOf("/service-subscriptions/")
+ subscriberName = siRelatedLink.substring(subscriberNameStart + 19, subscriberNameEnd)
+ subscriberName = UriUtils.decode(subscriberName,"UTF-8")
+ }
+
+ String content =
+ """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://openecomp.com/mso/workflow/schema/v1"
+ xmlns:sdncadapterworkflow="http://openecomp.com/mso/workflow/schema/v1"
+ xmlns:sdncadapter="http://domain2.openecomp.com/workflow/sdnc/adapter/schema/v1"
+ xmlns:ns5="http://openecomp.com/mso/request/types/v1">
+ <sdncadapter:RequestHeader>
+ <sdncadapter:RequestId>${requestId}</sdncadapter:RequestId>
+ <sdncadapter:SvcInstanceId>${serviceInstanceId}</sdncadapter:SvcInstanceId>
+ <sdncadapter:SvcAction>${action}</sdncadapter:SvcAction>
+ <sdncadapter:SvcOperation>network-topology-operation</sdncadapter:SvcOperation>
+ <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl>
+ </sdncadapter:RequestHeader>
+ <sdncadapterworkflow:SDNCRequestData>
+ <request-information>
+ <request-id>${requestId}</request-id>
+ <request-action>${requestAction}</request-action>
+ <source>${source}</source>
+ <notification-url></notification-url>
+ <order-number></order-number>
+ <order-version></order-version>
+ </request-information>
+ <service-information>
+ <service-id>${serviceId}</service-id>
+ <service-type>${serviceType}</service-type>
+ <service-instance-id>${serviceInstanceId}</service-instance-id>
+ <subscriber-name>${subscriberName}</subscriber-name>
+ </service-information>
+ <network-request-information>
+ <network-id>${networkId}</network-id>
+ <network-type>${networkType}</network-type>
+ <network-name>${networkName}</network-name>
+ <tenant>${tenantId}</tenant>
+ <aic-cloud-region>${aicCloudRegion}</aic-cloud-region>
+ </network-request-information>
+ </sdncadapterworkflow:SDNCRequestData>
+ </aetgt:SDNCAdapterWorkflowRequest>""".trim()
+
+ return content
+ }
+
+ /**
+ * Builds a topology SDNC request and return String request.
+ * As V2 will use 1607-style request, region instead of aic clli code
+ * @param execution, the execution
+ * @param requestXML, the incoming request for the flow
+ * @param serviceInstanceId, the serviceIntance (if available)
+ * @param callbackUrl, the call back url
+ * @param action, the action element value
+ * @param requestAction the svcOperation element value
+ * @param cloudRegionId the aai's cloud-region-id
+ * @param networkId the aai's network-id
+ * @param additionalData additional XML content to be inserted into the
+ * RequestData element (may be null)
+ */
+ public String sdncTopologyRequestRsrc (Execution execution, String requestXML, String serviceInstanceId, String callbackUrl, String action, String requestAction, String cloudRegionId, networkId, String additionalData) {
+ def utils=new MsoUtils()
+
+ // SNDC is expecting request Id for header as unique each call.
+ String hdrRequestId = ""
+ String testHdrRequestId = execution.getVariable("testMessageId") // for test purposes.
+ if (testHdrRequestId == null) {
+ hdrRequestId = UUID.randomUUID() // generate unique
+ } else {
+ hdrRequestId = testHdrRequestId
+ }
+
+ String requestId = ""
+ String testRequestId = execution.getVariable("testMessageId") // for test purposes.
+ if (testRequestId == null) {
+ try {
+ requestId = execution.getVariable("mso-request-id")
+ } catch (Exception ex) {
+ requestId = utils.getNodeText1(requestXML, "request-id")
+ }
+ } else {
+ requestId = testRequestId
+ }
+
+ String aicCloudRegion = cloudRegionId
+ String tenantId = ""
+ if (utils.nodeExists(requestXML, "tenant-id")) {
+ tenantId = utils.getNodeText1(requestXML, "tenant-id")
+ }
+ String networkType = ""
+ if (utils.nodeExists(requestXML, "network-type")) {
+ networkType = utils.getNodeText1(requestXML, "network-type")
+ }
+
+ String subscriptionServiceType = ""
+ if (utils.nodeExists(requestXML, "subscription-service-type")) {
+ subscriptionServiceType = utils.getNodeText1(requestXML, "subscription-service-type")
+ }
+
+ String globalCustomerId = ""
+ if (utils.nodeExists(requestXML, "global-customer-id")) {
+ globalCustomerId = utils.getNodeText1(requestXML, "global-customer-id")
+ }
+
+ String serviceId = ""
+ if (utils.nodeExists(requestXML, "service-id")) {
+ serviceId = utils.getNodeText1(requestXML, "service-id")
+ }
+ String networkName = ""
+ if (utils.nodeExists(requestXML, "network-name")) {
+ networkName = utils.getNodeText1(requestXML, "network-name")
+ }
+ String source = ""
+ if (utils.nodeExists(requestXML, "source")) {
+ source = utils.getNodeText1(requestXML, "source")
+ }
+
+ // get resourceLink from subflow execution variable
+ String serviceType = ""
+ String subscriberName = ""
+ String siRelatedLink = execution.getVariable("GENGSI_siResourceLink")
+ if (siRelatedLink != null) {
+ // get service type
+ int serviceStart = siRelatedLink.indexOf("service-subscription/")
+ int serviceEnd = siRelatedLink.indexOf("/service-instances/")
+ serviceType = siRelatedLink.substring(serviceStart + 21, serviceEnd)
+ serviceType = UriUtils.decode(serviceType,"UTF-8")
+ // get subscriber name
+ int subscriberNameStart = siRelatedLink.indexOf("customers/customer/")
+ int subscriberNameEnd = siRelatedLink.indexOf("/service-subscriptions/")
+ subscriberName = siRelatedLink.substring(subscriberNameStart + 19, subscriberNameEnd)
+ subscriberName = UriUtils.decode(subscriberName,"UTF-8")
+ }
+
+ // network-information from 'networkModelInfo' // verify the DB Catalog response
+ String networkModelInfo = utils.getNodeXml(requestXML, "networkModelInfo", false).replace("tag0:","").replace(":tag0","")
+ String modelInvariantUuid = utils.getNodeText1(networkModelInfo, "modelInvariantUuid") !=null ?
+ utils.getNodeText1(networkModelInfo, "modelInvariantUuid") : ""
+ String modelCustomizationUuid = utils.getNodeText1(networkModelInfo, "modelCustomizationUuid") !=null ?
+ utils.getNodeText1(networkModelInfo, "modelCustomizationUuid") : ""
+ String modelUuid = utils.getNodeText1(networkModelInfo, "modelUuid") !=null ?
+ utils.getNodeText1(networkModelInfo, "modelUuid") : ""
+ String modelVersion = utils.getNodeText1(networkModelInfo, "modelVersion") !=null ?
+ utils.getNodeText1(networkModelInfo, "modelVersion") : ""
+ String modelName = utils.getNodeText1(networkModelInfo, "modelName") !=null ?
+ utils.getNodeText1(networkModelInfo, "modelName") : ""
+
+ // service-information from 'networkModelInfo' // verify the DB Catalog response
+ String serviceModelInfo = utils.getNodeXml(requestXML, "serviceModelInfo", false).replace("tag0:","").replace(":tag0","")
+ String serviceModelInvariantUuid = utils.getNodeText1(serviceModelInfo, "modelInvariantUuid") !=null ?
+ utils.getNodeText1(serviceModelInfo, "modelInvariantUuid") : ""
+ String serviceModelUuid = utils.getNodeText1(serviceModelInfo, "modelUuid") !=null ?
+ utils.getNodeText1(serviceModelInfo, "modelUuid") : ""
+ String serviceModelVersion = utils.getNodeText1(serviceModelInfo, "modelVersion") !=null ?
+ utils.getNodeText1(serviceModelInfo, "modelVersion") : ""
+ String serviceModelName = utils.getNodeText1(serviceModelInfo, "modelName") !=null ?
+ utils.getNodeText1(serviceModelInfo, "modelName") : ""
+
+
+ String content =
+ """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://openecomp.com/mso/workflow/schema/v1"
+ xmlns:sdncadapter="http://domain2.openecomp.com/workflow/sdnc/adapter/schema/v1"
+ xmlns:sdncadapterworkflow="http://openecomp.com/mso/workflow/schema/v1">
+ <sdncadapter:RequestHeader>
+ <sdncadapter:RequestId>${hdrRequestId}</sdncadapter:RequestId>
+ <sdncadapter:SvcInstanceId>${serviceInstanceId}</sdncadapter:SvcInstanceId>
+ <sdncadapter:SvcAction>${action}</sdncadapter:SvcAction>
+ <sdncadapter:SvcOperation>network-topology-operation</sdncadapter:SvcOperation>
+ <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl>
+ <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction>
+ </sdncadapter:RequestHeader>
+ <sdncadapterworkflow:SDNCRequestData>
+ <request-information>
+ <request-id>${requestId}</request-id>
+ <request-action>${requestAction}</request-action>
+ <source>${source}</source>
+ <notification-url></notification-url>
+ <order-number></order-number>
+ <order-version></order-version>
+ </request-information>
+ <service-information>
+ <service-id>${serviceId}</service-id>
+ <subscription-service-type>${subscriptionServiceType}</subscription-service-type>
+ <ecomp-model-information>
+ <model-invariant-uuid>${serviceModelInvariantUuid}</model-invariant-uuid>
+ <model-uuid>${serviceModelUuid}</model-uuid>
+ <model-version>${serviceModelVersion}</model-version>
+ <model-name>${serviceModelName}</model-name>
+ </ecomp-model-information>
+ <service-instance-id>${serviceInstanceId}</service-instance-id>
+ <global-customer-id>${globalCustomerId}</global-customer-id>
+ <subscriber-name>${subscriberName}</subscriber-name>
+ </service-information>
+ <network-information>
+ <network-id>${networkId}</network-id>
+ <network-type>${networkType}</network-type>
+ <ecomp-model-information>
+ <model-invariant-uuid>${modelInvariantUuid}</model-invariant-uuid>
+ <model-customization-uuid>${modelCustomizationUuid}</model-customization-uuid>
+ <model-uuid>${modelUuid}</model-uuid>
+ <model-version>${modelVersion}</model-version>
+ <model-name>${modelName}</model-name>
+ </ecomp-model-information>
+ </network-information>
+ <network-request-input>
+ <network-name>${networkName}</network-name>
+ <tenant>${tenantId}</tenant>
+ <aic-cloud-region>${aicCloudRegion}</aic-cloud-region>
+ <aic-clli></aic-clli>
+ <network-input-parameters/>
+ </network-request-input>
+ </sdncadapterworkflow:SDNCRequestData>
+ </aetgt:SDNCAdapterWorkflowRequest>""".trim()
+
+ return content
+ }
+
+ /**
+ * Validates a workflow response.
+ * @param execution the execution
+ * @param responseVar the execution variable in which the response is stored
+ * @param workflowException the WorkflowException Object returned from sdnc call
+ */
+ public void validateSDNCResponse(Execution execution, String response, WorkflowException workflowException, boolean successIndicator){
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ taskProcessor.utils.log("DEBUG", "SDNC Response is: " + response, isDebugLogEnabled)
+ taskProcessor.utils.log("DEBUG", "SuccessIndicator is: " + successIndicator, isDebugLogEnabled)
+
+ try {
+ def prefix = execution.getVariable('prefix')
+ execution.setVariable(prefix+'sdncResponseSuccess', false)
+ taskProcessor.utils.log("DEBUG", "Response" + ' = ' + (response == null ? "" : System.lineSeparator()) + response, isDebugLogEnabled)
+
+ if (successIndicator == true){
+ if (response == null || response.trim().equals("")) {
+ taskProcessor.utils.log("DEBUG", response + ' is empty');
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, "SDNCAdapter Workflow Response is Empty")
+ }else{
+
+ // we need to peer into the request data for error
+ def String sdncAdapterWorkflowResponse = taskProcessor.utils.getNodeXml(response, 'response-data', false)
+ def String decodedXml = decodeXML(sdncAdapterWorkflowResponse).replace('<?xml version="1.0" encoding="UTF-8"?>', "")
+
+ // change '&' to "&amp; (if present as data, ex: subscriber-name = 'FOUR SEASONS HEATING & COOLING_8310006378683'
+ decodedXml = decodedXml.replace("&", "&amp;")
+
+ taskProcessor.utils.log("DEBUG","decodedXml:\n" + decodedXml, isDebugLogEnabled)
+
+ int requestDataResponseCode = 200
+ def String requestDataResponseMessage = ''
+
+ try{
+ if (taskProcessor.utils.nodeExists(decodedXml, "response-message")) {
+ requestDataResponseMessage = taskProcessor.utils.getNodeText(decodedXml, "response-message")
+ } else if (taskProcessor.utils.nodeExists(decodedXml, "ResponseMessage")) {
+ requestDataResponseMessage = taskProcessor.utils.getNodeText(decodedXml, "ResponseMessage")
+ }
+ }catch(Exception e){
+ taskProcessor.utils.log("DEBUG", 'Error caught while decoding resposne ' + e.getMessage(), isDebugLogEnabled)
+ }
+
+ if(taskProcessor.utils.nodeExists(decodedXml, "response-code")) {
+ taskProcessor.utils.log("DEBUG","response-code node Exist ", isDebugLogEnabled)
+ String code = taskProcessor.utils.getNodeText1(decodedXml, "response-code")
+ if(code.isEmpty() || code.equals("")){
+ // if response-code is blank then Success
+ taskProcessor.utils.log("DEBUG","response-code node is empty", isDebugLogEnabled)
+ requestDataResponseCode = 0
+ }else{
+ requestDataResponseCode = code.toInteger()
+ taskProcessor.utils.log("DEBUG","response-code is: " + requestDataResponseCode, isDebugLogEnabled)
+ }
+ }else if(taskProcessor.utils.nodeExists(decodedXml, "ResponseCode")){
+ taskProcessor.utils.log("DEBUG","ResponseCode node Exist ", isDebugLogEnabled)
+ String code = taskProcessor.utils.getNodeText1(decodedXml, "ResponseCode")
+ if(code.isEmpty() || code.equals("")){
+ // if ResponseCode blank then Success
+ taskProcessor.utils.log("DEBUG","ResponseCode node is empty", isDebugLogEnabled)
+ requestDataResponseCode = 0
+ }else{
+ requestDataResponseCode = code.toInteger()
+ taskProcessor.utils.log("DEBUG","ResponseCode is: " + requestDataResponseCode, isDebugLogEnabled)
+ }
+ }else{
+ taskProcessor.utils.log("DEBUG","A Response Code DOES NOT Exist.", isDebugLogEnabled)
+ // if a response code does not exist then Success
+ requestDataResponseCode = 0
+ }
+ try{
+
+ // if a response code is 0 or 200 then Success
+ if (requestDataResponseCode == 200 || requestDataResponseCode == 0) {
+ execution.setVariable(prefix+'sdncResponseSuccess', true)
+ taskProcessor.utils.log("DEBUG", "Setting sdncResponseSuccess to True ", isDebugLogEnabled)
+ taskProcessor.utils.log("DEBUG", "Exited ValidateSDNCResponse Method", isDebugLogEnabled)
+ }else{
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+ String convertedCode = exceptionUtil.MapSDNCResponseCodeToErrorCode(requestDataResponseCode.toString())
+ int convertedCodeInt = Integer.parseInt(convertedCode)
+ exceptionUtil.buildAndThrowWorkflowException(execution, convertedCodeInt, "Received error from SDN-C: " + requestDataResponseMessage)
+ }
+
+ }catch(Exception e){
+ //TODO proper handling of new, non numerical response codes in 1607 and new error handling for common API
+ requestDataResponseCode = 500
+ }
+
+ taskProcessor.utils.log("DEBUG", "SDNC callback response-code: " + requestDataResponseCode, isDebugLogEnabled)
+ taskProcessor.utils.log("DEBUG", "SDNC callback response-message: " + requestDataResponseMessage, isDebugLogEnabled)
+ }
+
+ }else {
+ taskProcessor.utils.log("DEBUG", 'SDNCAdapter Subflow did NOT complete Successfully. SuccessIndicator is False. ')
+ if(workflowException != null){
+ exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage())
+ }else{
+ //TODO : what error code and error message use here
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Internal Error - SDNCAdapter Subflow did NOT complete successfully.")
+ }
+ }
+
+ } catch (BpmnError e) {
+ throw e;
+ } catch (Exception e) {
+ taskProcessor.utils.log("DEBUG", 'END of Validate SDNC Response', isDebugLogEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, 'Internal Error- Unable to validate SDNC Response ');
+ }
+ }
+
+ /**
+ * Validates a workflow response.
+ * @param execution the execution
+ * @param responseVar the execution variable in which the response is stored
+ * @param responseCodeVar the execution variable in which the response code is stored
+ * @param errorResponseVar the execution variable in which the error response is stored
+ */
+ public void validateL3BondingSDNCResp(Execution execution, String response, WorkflowException workflowException, boolean success) {
+ def method = getClass().getSimpleName() + '.validateL3BondingSDNCResp(' +
+ 'execution=' + execution.getId() +
+ ', response=' + response +
+ ')'
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ taskProcessor.logDebug('Entered ' + method, isDebugLogEnabled)
+ def prefix = execution.getVariable('prefix')
+ TrinityExceptionUtil trinityExceptionUtil = new TrinityExceptionUtil()
+
+ try {
+ execution.setVariable(prefix+'sdncResponseSuccess', false)
+
+ taskProcessor.utils.log("sdncAdapter Success Indicator is: " + success, isDebugLogEnabled)
+ if (success == true) {
+
+ // we need to look inside the request data for error
+ def String callbackRequestData = taskProcessor.utils.getNodeXml(response, 'RequestData', false)
+ def String decodedXml = decodeXML(callbackRequestData)
+ taskProcessor.utils.log("DEBUG","decodedXml:\n" + decodedXml, isDebugLogEnabled)
+
+ def requestDataResponseCode = '200'
+ def requestDataResponseMessage = ''
+ int intDataResponseCode = 200
+
+ if (taskProcessor.utils.nodeExists(decodedXml, "response-code")) {
+
+ requestDataResponseCode = ((String) taskProcessor.utils.getNodeText(decodedXml, "response-code"))
+ if (taskProcessor.utils.nodeExists(decodedXml, "response-message")) {
+ requestDataResponseMessage = taskProcessor.utils.getNodeText(decodedXml, "response-message")
+ }
+ }else if(taskProcessor.utils.nodeExists(decodedXml, "ResponseCode")){
+ requestDataResponseCode = ((String) taskProcessor.utils.getNodeText1(decodedXml, "ResponseCode")).toInteger()
+ }else if(taskProcessor.utils.nodeExists(response, "ResponseCode")){
+ requestDataResponseCode = ((String) taskProcessor.utils.getNodeText1(response, "ResponseCode")).toInteger()
+ requestDataResponseMessage = taskProcessor.utils.getNodeText(response, "ResponseMessage")
+ }
+
+ taskProcessor.utils.log("DEBUG", "SDNC callback response-code: " + requestDataResponseCode, isDebugLogEnabled)
+ taskProcessor.utils.log("DEBUG", "SDNC callback response-message: " + requestDataResponseMessage, isDebugLogEnabled)
+
+ // Get the AAI Status to determine if rollback is needed on ASSIGN
+ def aai_status = ''
+ if (taskProcessor.utils.nodeExists(decodedXml, "aai-status")) {
+ aai_status = ((String) taskProcessor.utils.getNodeText(decodedXml, "aai-status"))
+ taskProcessor.utils.log("DEBUG", "SDNC sent AAI STATUS code: " + aai_status, isDebugLogEnabled)
+ }
+ if (aai_status != null && !aai_status.equals("")) {
+ execution.setVariable(prefix+"AaiStatus",aai_status)
+ taskProcessor.utils.log("DEBUG", "Set variable " + prefix + "AaiStatus: " + execution.getVariable(prefix+"AaiStatus"), isDebugLogEnabled)
+ }
+
+ // Get the result string to determine if rollback is needed on ASSIGN in Add Bonding flow only
+ def sdncResult = ''
+ if (taskProcessor.utils.nodeExists(decodedXml, "result")) {
+ sdncResult = ((String) taskProcessor.utils.getNodeText(decodedXml, "result"))
+ taskProcessor.utils.log("DEBUG", "SDNC sent result: " + sdncResult, isDebugLogEnabled)
+ }
+ if (sdncResult != null && !sdncResult.equals("")) {
+ execution.setVariable(prefix+"SdncResult",sdncResult)
+ taskProcessor.utils.log("DEBUG", "Set variable " + prefix + "SdncResult: " + execution.getVariable(prefix+"SdncResult"), isDebugLogEnabled)
+ }
+
+ try{
+ intDataResponseCode = Integer.parseInt(String.valueOf(requestDataResponseCode))
+ }catch(Exception e){
+ intDataResponseCode = 400
+ }
+
+ taskProcessor.utils.log("DEBUG", "intDataResponseCode " + intDataResponseCode , isDebugLogEnabled)
+
+ // if response-code is not Success (200, 201, etc) we need to throw an exception
+ if (intDataResponseCode != 200 && intDataResponseCode != 0) {
+ execution.setVariable(prefix+'ResponseCode', intDataResponseCode)
+ execution.setVariable("L3HLAB_rollback", true)
+ def msg = trinityExceptionUtil.mapSDNCAdapterExceptionToErrorResponse(response, execution)
+ exceptionUtil.buildAndThrowWorkflowException(execution, intDataResponseCode, "Received error from SDN-C: " + msg)
+
+ }
+ }else {
+ taskProcessor.logWarn('sdncAdapter did not complete successfully, sdncAdapter Success Indicator was false ')
+ execution.setVariable("L3HLAB_rollback", true)
+ def msg = trinityExceptionUtil.mapSDNCAdapterExceptionToErrorResponse(response, execution)
+ exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, msg)
+ }
+
+ if (response == null || response.trim().equals("")) {
+ taskProcessor.logWarn('sdncAdapter workflow response is empty');
+ execution.setVariable("L3HLAB_rollback", true)
+ def msg = trinityExceptionUtil.buildException("Exception occurred while validating SDNC response " , execution)
+ exceptionUtil.buildAndThrowWorkflowException(execution, intResponseCode, msg)
+ }
+
+ execution.setVariable(prefix+'sdncResponseSuccess', true)
+ taskProcessor.logDebug('Exited ' + method, isDebugLogEnabled)
+ } catch (BpmnError e) {
+ throw e;
+ } catch (Exception e) {
+ taskProcessor.logError('Caught exception in ' + method, e)
+ execution.setVariable(prefix+"ResponseCode",400)
+ execution.setVariable("L3HLAB_rollback", true)
+ def msg = trinityExceptionUtil.buildException("Exception occurred while validating SDNC response: " + e.getMessage(), execution)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 400, msg)
+ }
+ }
+
+ public String modelInfoToEcompModelInformation(String jsonModelInfo) {
+ String modelInvariantId = jsonUtil.getJsonValue(jsonModelInfo, "modelInvariantId")
+ String modelVersionId = jsonUtil.getJsonValue(jsonModelInfo, "modelVersionId")
+ if (modelVersionId == null) {
+ modelVersionId = ""
+ }
+ String modelCustomizationUuid = jsonUtil.getJsonValue(jsonModelInfo, "modelCustomizationId")
+ String modelCustomizationString = ""
+ if (modelCustomizationUuid != null) {
+ modelCustomizationString = "<model-customization-uuid>${modelCustomizationUuid}</model-customization-uuid>"
+ }
+ String modelVersion = jsonUtil.getJsonValue(jsonModelInfo, "modelVersion")
+ String modelName = jsonUtil.getJsonValue(jsonModelInfo, "modelName")
+ String ecompModelInformation =
+ """<ecomp-model-information>
+ <model-invariant-uuid>${modelInvariantId}</model-invariant-uuid>
+ <model-uuid>${modelVersionId}</model-uuid>
+ ${modelCustomizationString}
+ <model-version>${modelVersion}</model-version>
+ <model-name>${modelName}</model-name>
+ </ecomp-model-information>"""
+
+ return ecompModelInformation
+ }
+
+ /**
+ * Decode XML - replace &amp; &lt; and &gt; with '&', '<' and '>'
+ * @param xml - the xml to be decoded
+ */
+ private String decodeXML(String xml) {
+ def String decodedXml = xml.replaceAll("&amp;", "&")
+ decodedXml = decodedXml.replaceAll("&lt;", "<")
+ decodedXml = decodedXml.replaceAll("&gt;", ">")
+ }
+
+
+
+} \ No newline at end of file
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ServiceTaskProcessor.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ServiceTaskProcessor.groovy
index ef21818f81..975fdd3ae2 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ServiceTaskProcessor.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ServiceTaskProcessor.groovy
@@ -1,32 +1,32 @@
-/*-
- * ============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.common.scripts;
-
-import org.camunda.bpm.engine.runtime.Execution
-
-
-/**
- * @version 1.0
- *
- */
-public interface ServiceTaskProcessor {
- public void preProcessRequest(Execution execution);
-}
+/*-
+ * ============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.common.scripts;
+
+import org.camunda.bpm.engine.runtime.Execution
+
+
+/**
+ * @version 1.0
+ *
+ */
+public interface ServiceTaskProcessor {
+ public void preProcessRequest(Execution execution);
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/TrinityExceptionUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/TrinityExceptionUtil.groovy
new file mode 100644
index 0000000000..03fa63e93b
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/TrinityExceptionUtil.groovy
@@ -0,0 +1,382 @@
+/*-
+ * ============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.common.scripts
+
+import org.camunda.bpm.engine.runtime.Execution
+import org.apache.commons.lang3.*
+
+class TrinityExceptionUtil {
+
+
+
+ public static enum Error {
+ SVC_GENERAL_SERVICE_ERROR("SVC0001","Internal Error"),
+ SVC_BAD_PARAMETER("SVC0002", "Invalid input value for message part %1"),
+ SVC_NO_SERVER_RESOURCES("SVC1000", "No server resources available to process the request"),
+ SVC_DETAILED_SERVICE_ERROR("SVC2000", "The following service error occurred: %1. Error code is %2."),
+ POL_GENERAL_POLICY_ERROR("POL0001", "A policy error occurred."),
+ POL_USER_NOT_PROVISIONED("POL1009", "User has not been provisioned for service"),
+ POL_USER_SUSPENDED("POL1010", "User has been suspended from service"),
+ POL_DETAILED_POLICY_ERROR("POL2000", "The following policy error occurred: %1. Error code is %2."),
+ POL_MSG_SIZE_EXCEEDS_LIMIT("POL9003", "Message content size exceeds the allowable limit")
+
+
+ private final String msgId
+ private final String msgTxt
+
+ private Error(String msgId, String msgTxt) {
+ this.msgId = msgId
+ this.msgTxt = msgTxt
+ }
+
+ public String getMsgId() {
+ return msgId
+ }
+
+ public String getMsgTxt() {
+ return msgTxt
+ }
+
+ }
+
+
+
+
+ String mapAdapterExecptionToCommonException(String response, Execution execution)
+ {
+ def utils=new MsoUtils()
+ def method = getClass().getSimpleName() + '.mapAdapterExecptionToCommonException(' +
+ 'execution=' + execution.getId() +
+ ')'
+
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ utils.log("DEBUG",'Entered ' + method, isDebugLogEnabled)
+
+
+ def errorCode
+
+
+ try {
+ errorCode = MapCategoryToErrorCode(utils.getNodeText(response, "category"))
+ execution.setVariable(prefix+"err",errorCode)
+ String message = buildException(response, execution)
+ utils.log("DEBUG","=========== End MapAdapterExecptionToWorkflowException ===========",isDebugLogEnabled)
+ return message
+ }catch (Exception ex) {
+ //Ignore the exception - cases include non xml payload
+ utils.log("DEBUG","error mapping error, ignoring: " + ex,isDebugLogEnabled)
+ utils.log("DEBUG","=========== End MapAdapterExecptionToWorkflowException ===========",isDebugLogEnabled)
+ return buildException(response, execution)
+ }
+ }
+
+ /**
+ * @param response
+ * @param execution
+ * @return mapped exception
+ */
+ String mapAOTSExecptionToCommonException(String response, Execution execution)
+ {
+ def utils=new MsoUtils()
+
+ def prefix=execution.getVariable("prefix")
+ def method = getClass().getSimpleName() + '.mapAOTSExecptionToCommonException(' +
+ 'execution=' + execution.getId() +
+ ')'
+
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ utils.log("DEBUG",'Entered ' + method, isDebugLogEnabled)
+
+
+ try {
+ def errorCode = utils.getNodeText(response,"code")
+ def descr = utils.getNodeText(response, "description")
+ def mappedErr = mapErrorCodetoError(errorCode, descr)
+ if(mappedErr == Error.SVC_DETAILED_SERVICE_ERROR || mappedError == Error.POL_DETAILED_POLICY_ERROR){
+ ArrayList myVars = new ArrayList()
+ myVars.add(descr)
+ myVars.add(errorCode)
+ execution.setVariable(prefix+"errVariables", myVars)
+ }
+ execution.setVariable(prefix+"err",mappedErr)
+ def message = buildException("Received error from AOTS: " + descr, execution)
+ utils.log("DEBUG","=========== End MapAOTSExecptionToCommonException ===========",isDebugLogEnabled)
+ return message
+ }catch (Exception ex) {
+ //Ignore the exception - cases include non xml payload
+ utils.log("DEBUG","error mapping error, ignoring: " + ex,isDebugLogEnabled)
+ utils.log("DEBUG","=========== End MapAOTSExecptionToCommonException ===========",isDebugLogEnabled)
+ return buildException(response, execution)
+ }
+ }
+
+ String mapSDNCAdapterExceptionToErrorResponse(String sdncAdapterCallbackRequest, Execution execution) {
+ def utils=new MsoUtils()
+ def prefix=execution.getVariable("prefix")
+ def method = getClass().getSimpleName() + '.mapSDNCAdapterExceptionToErrorResponse(' +
+ 'execution=' + execution.getId() +
+ ')'
+
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ utils.log("DEBUG",'Entered ' + method, isDebugLogEnabled)
+
+ def sdncResponseCode
+ String responseCode = execution.getVariable(prefix+"ResponseCode")
+ utils.log("DEBUG",'responseCode to map: ' + responseCode, isDebugLogEnabled)
+ def errorMessage
+
+ try {
+
+ if(utils.nodeExists(sdncAdapterCallbackRequest, "RequestData")) {
+ def reqDataXml = StringEscapeUtils.unescapeXml(utils.getNodeXml(sdncAdapterCallbackRequest, "RequestData"))
+ errorMessage = utils.getNodeText(reqDataXml, "response-message")
+ sdncResponseCode = utils.getNodeText(reqDataXml, "response-code")
+ }else{
+ errorMessage = utils.getNodeText(sdncAdapterCallbackRequest, "ResponseMessage")
+ sdncResponseCode = responseCode
+ }
+ def mappedErr = mapErrorCodetoError(responseCode, errorMessage)
+ errorMessage = errorMessage.replace("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;")
+ def modifiedErrorMessage = "Received error from SDN-C: " + errorMessage
+ if(mappedErr == Error.SVC_DETAILED_SERVICE_ERROR || mappedErr == Error.POL_DETAILED_POLICY_ERROR){
+ ArrayList myVars = new ArrayList()
+ myVars.add(errorMessage)
+ myVars.add(sdncResponseCode)
+ execution.setVariable(prefix+"errVariables", myVars)
+ }
+ execution.setVariable(prefix+"err",mappedErr)
+ def message = buildException(modifiedErrorMessage, execution)
+
+
+ utils.log("DEBUG","=========== End MapSDNCAdapterException ===========",isDebugLogEnabled)
+ return message
+ }catch (Exception ex) {
+ //Ignore the exception - cases include non xml payload
+ utils.log("DEBUG","error mapping sdnc error, ignoring: " + ex,isDebugLogEnabled)
+ utils.log("DEBUG","=========== End MapSDNCAdapterException ===========",isDebugLogEnabled)
+ return null
+ }
+
+ }
+
+ /**
+ * @param response message from called component (ex: AAI)
+ * @param execution
+ * @return an error response conforming to the common
+ */
+ String mapAAIExceptionTCommonException(String response, Execution execution)
+ {
+ def utils=new MsoUtils()
+ def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled")
+ def prefix=execution.getVariable("prefix")
+ def method = getClass().getSimpleName() + '.mapAAIExceptionTCommonException(' +
+ 'execution=' + execution.getId() +
+ ')'
+
+ utils.log("DEBUG",'Entered ' + method, isDebugLogEnabled)
+ def variables
+ def message
+ String errorCode = 'SVC0001'
+ utils.log("DEBUG","response: " + response, isDebugLogEnabled)
+ //they use the same format we do, pass their error along
+ //TODO add Received error from A&AI at beg of text
+ try {
+ message = utils.getNodeXml(response, "requestError")
+ message = utils.removeXmlNamespaces(message)
+ } catch (Exception ex) {
+ //Ignore the exception - cases include non xml payload
+ message = buildException("Received error from A&AI, unable to parse",execution)
+ utils.log("DEBUG","error mapping error, ignoring: " + ex,isDebugLogEnabled)
+ }
+
+ if(message != null) {
+ execution.setVariable(prefix+"ErrorResponse",message)
+ utils.log("ERROR","Fault:"+ execution.getVariable(prefix+"ErrorResponse"))
+ return message
+ } else {
+
+ return null
+
+ }
+ }
+
+ /**
+ * @param execution
+ * @return an error response conforming to the common API with default text msg
+ */
+ String buildException(execution){
+ return buildException(null, execution)
+ }
+
+ /**
+ * @param response message from called component (ex: AAI)
+ * @param execution
+ * @return an error response conforming to the common
+ */
+ String buildException(response, execution){
+ def utils=new MsoUtils()
+ def method = getClass().getSimpleName() + '.buildException(' +
+ 'execution=' + execution.getId() +
+ ')'
+
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ utils.log("DEBUG",'Entered ' + method, isDebugLogEnabled)
+ def prefix=execution.getVariable("prefix")
+ def responseCode = String.valueOf(execution.getVariable(prefix+"ResponseCode"))
+ def variables
+ utils.log("DEBUG","response: " + response, isDebugLogEnabled)
+
+ try {
+ utils.log("DEBUG","formatting error message" ,isDebugLogEnabled)
+ def msgVars = execution.getVariable(prefix+"errVariables")
+ def myErr = execution.getVariable(prefix+"err")
+ def messageTxt = execution.getVariable(prefix+"errTxt")
+ def messageId = null
+
+ if(myErr == null){
+ utils.log("DEBUG","mapping response code: " + responseCode, isDebugLogEnabled)
+ myErr = mapErrorCodetoError(responseCode, response)
+ if(myErr == null){
+ //not a service or policy error, just return error code
+ return ""
+ }
+ }
+ messageId = myErr.getMsgId()
+
+ if(messageTxt == null){
+ if(myErr!=null){
+ messageTxt = myErr.getMsgTxt()
+ }else{
+ messageTxt = response
+ }
+ }
+
+ if(msgVars==null && (myErr == Error.SVC_DETAILED_SERVICE_ERROR || myErr == Error.POL_DETAILED_POLICY_ERROR)){
+ msgVars = new ArrayList()
+ msgVars.add(response)
+ msgVars.add(responseCode)
+ }
+
+ def msgVarsXML=""
+ StringBuffer msgVarsBuff = new StringBuffer()
+ if(msgVars!=null){
+ for(String msgVar : msgVars){
+ msgVarsBuff.append(
+ """
+ <tns:variables>${msgVar}</tns:variables>""")
+ }
+
+ }
+ def message = ""
+ if(messageId.startsWith("SVC")){
+ message = """<tns:requestError xmlns:tns="http://org.openecomp/mso/request/types/v1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://org.openecomp/mso/request/types/v1 MsoServiceInstanceTypesV1.xsd">
+ <tns:serviceException>
+ <tns:messageId>${messageId}</tns:messageId>
+ <tns:text>${messageTxt}</tns:text>${msgVarsBuff}
+ </tns:serviceException>
+</tns:requestError>"""
+ }else{
+ message ="""<tns:requestError xmlns:tns="http://org.openecomp/mso/request/types/v1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://org.openecomp/mso/request/types/v1 MsoServiceInstanceTypesV1.xsd">
+ <tns:policyException>
+ <tns:messageId>${messageId}</tns:messageId>
+ <tns:text>${messageTxt}</tns:text>${msgVarsBuff}
+ </tns:policyException>
+</tns:requestError>"""
+ }
+ utils.log("DEBUG", "message " + message, isDebugLogEnabled)
+ execution.setVariable(prefix+"ErrorResponse",message)
+ execution.setVariable(prefix+"err", myErr)
+ execution.setVariable(prefix+"errTxt", messageTxt)
+ execution.setVariable(prefix+"errVariables", msgVars)
+ utils.log("ERROR","Fault:"+ execution.getVariable(prefix+"ErrorResponse"))
+ return message
+ }catch(Exception ex) {
+ utils.log("DEBUG","error mapping error, return null: " + ex,isDebugLogEnabled)
+ return null
+ }
+
+ }
+
+ String parseError(Execution execution){
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ def utils=new MsoUtils()
+ def prefix=execution.getVariable("prefix")
+ def text = execution.getVariable(prefix+"errTxt")
+ def msgVars = execution.getVariable(prefix+"errVariables")
+ utils.log("DEBUG",'parsing message: ' + text, isDebugLogEnabled)
+ if(text == null){
+ return 'failed'
+ }
+ if(msgVars!=null && !msgVars.isEmpty()){
+ for(int i=0; i<msgVars.size(); i++){
+ text = text.replaceFirst("%"+(i+1), msgVars[i])
+ }
+ }
+ utils.log("DEBUG",'parsed message is: ' + text, isDebugLogEnabled)
+ return text
+ }
+
+
+
+ Error mapErrorCodetoError(responseCode, descr)
+ {
+
+ if(responseCode==null || responseCode=='0' || responseCode=='500' || responseCode =='408'){
+ return Error.SVC_NO_SERVER_RESOURCES
+ }else if(responseCode == '401' || responseCode == '405' || responseCode == '409' || responseCode == '503'){
+ return null
+ }else if(responseCode == '400'){
+ if(descr==null){
+ return Error.SVC_GENERAL_SERVICE_ERROR
+ }else{
+ return Error.SVC_DETAILED_SERVICE_ERROR
+ }
+ }else if(responseCode == '401'){
+ if(descr==null){
+ return Error.POL_GENERAL_POLICY_ERROR
+ }else{
+ return Error.POL_DETAILED_POLICY_ERROR
+ }
+ }else{
+ return Error.SVC_NO_SERVER_RESOURCES
+ }
+ }
+
+ String mapCategoryToErrorCode(String errorCategory)
+ {
+ if(errorCategory.equals('OPENSTACK'))
+ return Error.SVC_NO_SERVER_RESOURCES
+ else if (errorCategory.equals('IO'))
+ return Error.SVC_NO_SERVER_RESOURCES
+ else if (errorCategory.equals('INTERNAL'))
+ return Error.SVC_NO_SERVER_RESOURCES
+ else if (errorCategory.equals('USERDATA'))
+ return Error.SVC_GENERAL_SERVICE_ERROR
+ else
+ return Error.SVC_GENERAL_SERVICE_ERROR
+ }
+
+
+
+
+
+
+} \ No newline at end of file
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/UpdateAAIGenericVnf.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/UpdateAAIGenericVnf.groovy
index 2a13fb7d25..4838a67d36 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/UpdateAAIGenericVnf.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/UpdateAAIGenericVnf.groovy
@@ -1,335 +1,328 @@
-/*-
- * ============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.common.scripts
-
-import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.runtime.Execution
-import org.openecomp.mso.bpmn.core.WorkflowException
-import org.openecomp.mso.rest.APIResponse
-import org.springframework.web.util.UriUtils
-
-
-public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor {
-
- private XmlParser xmlParser = new XmlParser()
-
- /**
- * Initialize the flow's variables.
- *
- * @param execution The flow's execution instance.
- */
- public void initProcessVariables(Execution execution) {
- execution.setVariable('prefix', 'UAAIGenVnf_')
- execution.setVariable('UAAIGenVnf_vnfId', null)
- execution.setVariable('UAAIGenVnf_personaModelId', null)
- execution.setVariable('UAAIGenVnf_personaModelVersion', null)
- execution.setVariable("UAAIGenVnf_ipv4OamAddress", null)
- execution.setVariable('UAAIGenVnf_managementV6Address', null)
- execution.setVariable('UAAIGenVnf_getGenericVnfResponseCode' ,null)
- execution.setVariable('UAAIGenVnf_getGenericVnfResponse', '')
- execution.setVariable('UAAIGenVnf_updateGenericVnfResponseCode', null)
- execution.setVariable('UAAIGenVnf_updateGenericVnfResponse', '')
- }
-
- /**
- * Check for missing elements in the received request.
- *
- * @param execution The flow's execution instance.
- */
- public void preProcessRequest(Execution execution) {
- def method = getClass().getSimpleName() + '.preProcessRequest(' +
- 'execution=' + execution.getId() +
- ')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- try {
- def xml = execution.getVariable('UpdateAAIGenericVnfRequest')
- logDebug('Received request xml:\n' + xml, isDebugLogEnabled)
- utils.logAudit("UpdateAAIGenericVnf Request XML: " + xml)
- initProcessVariables(execution)
-
- def vnfId = getRequiredNodeText(execution, xml,'vnf-id')
- execution.setVariable('UAAIGenVnf_vnfId', vnfId)
-
- def personaModelId = getNodeTextForce(xml,'persona-model-id')
- if (personaModelId != null && !personaModelId.isEmpty()) {
- execution.setVariable('UAAIGenVnf_personaModelId', personaModelId)
- }
-
- def personaModelVersion = getNodeTextForce(xml,'persona-model-version')
- if (personaModelVersion != null && !personaModelVersion.isEmpty()) {
- execution.setVariable('UAAIGenVnf_personaModelVersion', personaModelVersion)
- }
-
- def ipv4OamAddress = getNodeTextForce(xml, 'ipv4-oam-address')
- if (ipv4OamAddress != null && !ipv4OamAddress.isEmpty()) {
- execution.setVariable('UAAIGenVnf_ipv4OamAddress', ipv4OamAddress)
- }
-
- def managementV6Address = getNodeTextForce(xml, 'management-v6-address')
- if (managementV6Address != null && !managementV6Address.isEmpty()) {
- execution.setVariable('UAAIGenVnf_managementV6Address', managementV6Address)
- }
-
- logDebug('Exited ' + method, isDebugLogEnabled)
- } catch (BpmnError e) {
- throw e;
- } catch (Exception e) {
- logError('Caught exception in ' + method, e)
- createWorkflowException(execution, 1002, 'Error in preProcessRequest(): ' + e.getMessage())
- }
- }
-
- /**
- * Using the received vnfId, query AAI to get the corresponding Generic VNF.
- * A 200 response is expected with the VF Module in the response body.
- *
- * @param execution The flow's execution instance.
- */
- public void getGenericVnf(Execution execution) {
- def method = getClass().getSimpleName() + '.getGenericVnf(' +
- 'execution=' + execution.getId() +
- ')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- try {
- def vnfId = execution.getVariable('UAAIGenVnf_vnfId')
-
- // Construct endpoint
- AaiUtil aaiUriUtil = new AaiUtil(this)
- def aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution)
- logDebug('AAI URI is: ' + aai_uri, isDebugLogEnabled)
- String endPoint = execution.getVariable('URN_aai_endpoint') + aai_uri + '/' + UriUtils.encode(vnfId, "UTF-8") + "?depth=1"
-
- try {
- logDebug('sending GET to AAI endpoint \'' + endPoint + '\'', isDebugLogEnabled)
- utils.logAudit("Sending GET to AAI endpoint: " + endPoint)
-
- APIResponse response = aaiUriUtil.executeAAIGetCall(execution, endPoint)
- def responseData = response.getResponseBodyAsString()
- execution.setVariable('UAAIGenVnf_getGenericVnfResponseCode', response.getStatusCode())
- execution.setVariable('UAAIGenVnf_getGenericVnfResponse', responseData)
- utils.logAudit("UpdateAAIGenericVnf Response data: " + responseData)
- logDebug('Response code:' + response.getStatusCode(), isDebugLogEnabled)
- logDebug('Response:' + System.lineSeparator() + responseData, isDebugLogEnabled)
- } catch (Exception ex) {
- ex.printStackTrace()
- logDebug('Exception occurred while executing AAI GET:' + ex.getMessage(),isDebugLogEnabled)
- execution.setVariable('UAAIGenVnf_getGenericVnfResponseCode', 500)
- execution.setVariable('UAAIGenVnf_getGenericVnfResponse', 'AAI GET Failed:' + ex.getMessage())
- }
- logDebug('Exited ' + method, isDebugLogEnabled)
- } catch (BpmnError e) {
- throw e;
- } catch (Exception e) {
- logError('Caught exception in ' + method, e)
- createWorkflowException(execution, 1002, 'Error in getGenericVnf(): ' + e.getMessage())
- }
- }
-
- /**
- * Construct and send a PUT request to AAI to update the Generic VNF.
- *
- * @param execution The flow's execution instance.
- */
- public void updateGenericVnf(Execution execution) {
- def method = getClass().getSimpleName() + '.updateGenericVnf(' +
- 'execution=' + execution.getId() +
- ')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- try {
- def vnfId = execution.getVariable('UAAIGenVnf_vnfId')
- def genericVnf = execution.getVariable('UAAIGenVnf_getGenericVnfResponse')
- def origRequest = execution.getVariable('UpdateAAIGenericVnfRequest')
-
- utils.logAudit("UpdateGenericVnf Request: " + origRequest)
- // Confirm resource-version is in retrieved Generic VNF
- def Node genericVnfNode = xmlParser.parseText(genericVnf)
- if (utils.getChildNode(genericVnfNode, 'resource-version') == null) {
- def msg = 'Can\'t update Generic VNF ' + vnfId + ' since \'resource-version\' is missing'
- logError(msg)
- throw new Exception(msg)
- }
-
- // Handle persona-model-id/persona-model-version
-
- def String newPersonaModelId = execution.getVariable('UAAIGenVnf_personaModelId')
- def String newPersonaModelVersion = execution.getVariable('UAAIGenVnf_personaModelVersion')
- if (newPersonaModelId != null || newPersonaModelVersion != null) {
-
- // Confirm "new" persona-model-id is same as "current" persona-model-id
- def Node currPersonaModelIdNode = utils.getChildNode(genericVnfNode, 'persona-model-id')
- def String currPersonaModelId = ''
- if (currPersonaModelIdNode != null) {
- currPersonaModelId = currPersonaModelIdNode.text()
- }
- if (!newPersonaModelId.equals(currPersonaModelId)) {
- def msg = 'Can\'t update Generic VNF ' + vnfId + ' since there is \'persona-model-id\' mismatch between the current and new values'
- logError(msg)
- throw new Exception(msg)
- }
-
- // Construct payload
- updateGenericVnfNode(origRequest, genericVnfNode, 'persona-model-version')
- }
-
- // Handle ipv4-oam-address
- def String ipv4OamAddress = execution.getVariable('UAAIGenVnf_ipv4OamAddress')
- if (ipv4OamAddress != null) {
- // Construct payload
- updateGenericVnfNode(origRequest, genericVnfNode, 'ipv4-oam-address')
- }
-
- // Handle management-v6-address
- def String managementV6Address = execution.getVariable('UAAIGenVnf_managementV6Address')
- if (managementV6Address != null) {
- // Construct payload
- updateGenericVnfNode(origRequest, genericVnfNode, 'management-v6-address')
- }
-
- def payload = utils.nodeToString(genericVnfNode)
-
- // Construct endpoint
- AaiUtil aaiUriUtil = new AaiUtil(this)
- def aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution)
- logDebug('AAI URI is: ' + aai_uri, isDebugLogEnabled)
- String endPoint = execution.getVariable('URN_aai_endpoint') + aai_uri + '/' + UriUtils.encode(vnfId, "UTF-8")
-
- try {
- logDebug('sending PUT to AAI endpoint \'' + endPoint + '\'' + 'with payload \n' + payload, isDebugLogEnabled)
- utils.logAudit("Sending PUT to AAI endpoint: " + endPoint)
-
- APIResponse response = aaiUriUtil.executeAAIPutCall(execution, endPoint, payload)
- def responseData = response.getResponseBodyAsString()
- execution.setVariable('UAAIGenVnf_updateGenericVnfResponseCode', response.getStatusCode())
- execution.setVariable('UAAIGenVnf_updateGenericVnfResponse', responseData)
- utils.logAudit("UpdateAAIGenericVnf Response Data: " + responseData)
- logDebug('Response code:' + response.getStatusCode(), isDebugLogEnabled)
- logDebug('Response:' + System.lineSeparator() + responseData, isDebugLogEnabled)
- } catch (Exception ex) {
- ex.printStackTrace()
- logDebug('Exception occurred while executing AAI PUT:' + ex.getMessage(),isDebugLogEnabled)
- execution.setVariable('UAAIGenVnf_updateGenericVnfResponseCode', 500)
- execution.setVariable('UAAIGenVnf_updateGenericVnfResponse', 'AAI PUT Failed:' + ex.getMessage())
- }
- logDebug('Exited ' + method, isDebugLogEnabled)
- } catch (BpmnError e) {
- throw e;
- } catch (Exception e) {
- logError('Caught exception in ' + method, e)
- createWorkflowException(execution, 1002, 'Error in updateGenericVnf(): ' + e.getMessage())
- }
- }
-
- /**
- * Insert a new Node, replace the value of an existing Node, or delete an existing Node in the current
- * Generic VNF Node, as necessary.
- *
- * If the Node with the same name already exists in current Generic VNF, but is not being updated, then do
- * nothing. If the element is being updated and it already exists in the current Generic VNF, then check
- * the value specified in the original request. If the value is 'DELETE', remove that Node from the
- * current Generic VNF. Otherwise, change the value to the specified new value. If the element is
- * being updated but doesn't exist in the current Generic VNF, and the new value is not 'DELETE', then
- * create an appropriate new node and add it to the Generic VNF.
- *
- * @param origRequest Incoming update request with Generic VNF element(s) to be updated.
- * @param genericVnf Current Generic VNF retrieved from AAI.
- * @param element Name of element to be inserted.
- */
- public void updateGenericVnfNode(String origRequest, Node genericVnfNode, String elementName) {
-
- if (!utils.nodeExists(origRequest, elementName)) {
- return
- }
- def elementValue = utils.getNodeText(origRequest, elementName)
-
- def Node childNode = utils.getChildNode(genericVnfNode, elementName)
- if (childNode == null) {
- if (elementValue.equals('DELETE')) {
- // Element doesn't exist but is being deleted, so do nothing
- return
- }
- // Node doesn't exist, create a new Node as a child
- new Node(genericVnfNode, elementName, elementValue)
- } else {
- if (elementValue.equals('DELETE')) {
- // Node exists, but should be deleted
- genericVnfNode.remove(childNode)
- } else {
- // Node already exists, just give it a new value
- childNode.setValue(elementValue)
- }
- }
- }
-
- /**
- * Generates a WorkflowException if the AAI query returns a response code other than 200.
- *
- * @param execution The flow's execution instance.
- */
- public void handleAAIQueryFailure(Execution execution) {
- def method = getClass().getSimpleName() + '.handleAAIQueryFailure(' +
- 'execution=' + execution.getId() +
- ')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- logError('Error occurred attempting to query AAI, Response Code ' +
- execution.getVariable('UAAIGenVnf_getGenericVnfResponseCode') + ', Error Response ' +
- execution.getVariable('UAAIGenVnf_getGenericVnfResponse'))
- String processKey = getProcessKey(execution);
- WorkflowException exception = new WorkflowException(processKey, 5000,
- execution.getVariable('UAAIGenVnf_getGenericVnfResponse'))
- execution.setVariable('WorkflowException', exception)
-
- utils.logAudit("Workflow Exception occurred when handling Quering AAI: " + exception.getErrorMessage())
- logDebug('Exited ' + method, isDebugLogEnabled)
- }
-
- /**
- * Generates a WorkflowException if updating a VF Module in AAI returns a response code other than 200.
- *
- * @param execution The flow's execution instance.
- */
- public void handleUpdateGenericVnfFailure(Execution execution) {
- def method = getClass().getSimpleName() + '.handleUpdateGenericVnfFailure(' +
- 'execution=' + execution.getId() +
- ')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- logError('Error occurred attempting to update Generic VNF in AAI, Response Code ' +
- execution.getVariable('UAAIGenVnf_updateGenericVnfResponseCode') + ', Error Response ' +
- execution.getVariable('UAAIGenVnf_updateGenericVnfResponse'))
-
- String processKey = getProcessKey(execution);
- WorkflowException exception = new WorkflowException(processKey, 5000,
- execution.getVariable('UAAIGenVnf_updateGenericVnfResponse'))
- execution.setVariable('WorkflowException', exception)
-
- utils.logAudit("Workflow Exception occurred when Updating GenericVnf: " + exception.getErrorMessage())
- logDebug('Exited ' + method, isDebugLogEnabled)
- }
-}
+/*-
+ * ============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.common.scripts
+
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.runtime.Execution
+import org.openecomp.mso.bpmn.core.WorkflowException
+import org.openecomp.mso.rest.APIResponse
+import org.springframework.web.util.UriUtils
+
+
+public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor {
+
+ private XmlParser xmlParser = new XmlParser()
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+
+ /**
+ * Initialize the flow's variables.
+ *
+ * @param execution The flow's execution instance.
+ */
+ public void initProcessVariables(Execution execution) {
+ execution.setVariable('prefix', 'UAAIGenVnf_')
+ execution.setVariable('UAAIGenVnf_vnfId', null)
+ execution.setVariable('UAAIGenVnf_personaModelId', null)
+ execution.setVariable('UAAIGenVnf_personaModelVersion', null)
+ execution.setVariable("UAAIGenVnf_ipv4OamAddress", null)
+ execution.setVariable('UAAIGenVnf_managementV6Address', null)
+ execution.setVariable('UAAIGenVnf_getGenericVnfResponseCode' ,null)
+ execution.setVariable('UAAIGenVnf_getGenericVnfResponse', '')
+ execution.setVariable('UAAIGenVnf_updateGenericVnfResponseCode', null)
+ execution.setVariable('UAAIGenVnf_updateGenericVnfResponse', '')
+ }
+
+ /**
+ * Check for missing elements in the received request.
+ *
+ * @param execution The flow's execution instance.
+ */
+ public void preProcessRequest(Execution execution) {
+ def method = getClass().getSimpleName() + '.preProcessRequest(' +
+ 'execution=' + execution.getId() +
+ ')'
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ logDebug('Entered ' + method, isDebugLogEnabled)
+
+ try {
+ def xml = execution.getVariable('UpdateAAIGenericVnfRequest')
+ logDebug('Received request xml:\n' + xml, isDebugLogEnabled)
+ utils.logAudit("UpdateAAIGenericVnf Request XML: " + xml)
+ initProcessVariables(execution)
+
+ def vnfId = getRequiredNodeText(execution, xml,'vnf-id')
+ execution.setVariable('UAAIGenVnf_vnfId', vnfId)
+
+ def personaModelId = getNodeTextForce(xml,'persona-model-id')
+ if (personaModelId != null && !personaModelId.isEmpty()) {
+ execution.setVariable('UAAIGenVnf_personaModelId', personaModelId)
+ }
+
+ def personaModelVersion = getNodeTextForce(xml,'persona-model-version')
+ if (personaModelVersion != null && !personaModelVersion.isEmpty()) {
+ execution.setVariable('UAAIGenVnf_personaModelVersion', personaModelVersion)
+ }
+
+ def ipv4OamAddress = getNodeTextForce(xml, 'ipv4-oam-address')
+ if (ipv4OamAddress != null && !ipv4OamAddress.isEmpty()) {
+ execution.setVariable('UAAIGenVnf_ipv4OamAddress', ipv4OamAddress)
+ }
+
+ def managementV6Address = getNodeTextForce(xml, 'management-v6-address')
+ if (managementV6Address != null && !managementV6Address.isEmpty()) {
+ execution.setVariable('UAAIGenVnf_managementV6Address', managementV6Address)
+ }
+
+ logDebug('Exited ' + method, isDebugLogEnabled)
+ } catch (BpmnError e) {
+ throw e;
+ } catch (Exception e) {
+ logError('Caught exception in ' + method, e)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preProcessRequest(): ' + e.getMessage())
+ }
+ }
+
+ /**
+ * Using the received vnfId, query AAI to get the corresponding Generic VNF.
+ * A 200 response is expected with the VF Module in the response body.
+ *
+ * @param execution The flow's execution instance.
+ */
+ public void getGenericVnf(Execution execution) {
+ def method = getClass().getSimpleName() + '.getGenericVnf(' +
+ 'execution=' + execution.getId() +
+ ')'
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ logDebug('Entered ' + method, isDebugLogEnabled)
+
+ try {
+ def vnfId = execution.getVariable('UAAIGenVnf_vnfId')
+
+ // Construct endpoint
+ AaiUtil aaiUriUtil = new AaiUtil(this)
+ def aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution)
+ logDebug('AAI URI is: ' + aai_uri, isDebugLogEnabled)
+ String endPoint = execution.getVariable('URN_aai_endpoint') + aai_uri + '/' + UriUtils.encode(vnfId, "UTF-8") + "?depth=1"
+
+ try {
+ logDebug('sending GET to AAI endpoint \'' + endPoint + '\'', isDebugLogEnabled)
+ utils.logAudit("Sending GET to AAI endpoint: " + endPoint)
+
+ APIResponse response = aaiUriUtil.executeAAIGetCall(execution, endPoint)
+ def responseData = response.getResponseBodyAsString()
+ execution.setVariable('UAAIGenVnf_getGenericVnfResponseCode', response.getStatusCode())
+ execution.setVariable('UAAIGenVnf_getGenericVnfResponse', responseData)
+ utils.logAudit("UpdateAAIGenericVnf Response data: " + responseData)
+ logDebug('Response code:' + response.getStatusCode(), isDebugLogEnabled)
+ logDebug('Response:' + System.lineSeparator() + responseData, isDebugLogEnabled)
+ } catch (Exception ex) {
+ ex.printStackTrace()
+ logDebug('Exception occurred while executing AAI GET:' + ex.getMessage(),isDebugLogEnabled)
+ execution.setVariable('UAAIGenVnf_getGenericVnfResponseCode', 500)
+ execution.setVariable('UAAIGenVnf_getGenericVnfResponse', 'AAI GET Failed:' + ex.getMessage())
+ }
+ logDebug('Exited ' + method, isDebugLogEnabled)
+ } catch (BpmnError e) {
+ throw e;
+ } catch (Exception e) {
+ logError('Caught exception in ' + method, e)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in getGenericVnf(): ' + e.getMessage())
+ }
+ }
+
+ /**
+ * Construct and send a PUT request to AAI to update the Generic VNF.
+ *
+ * @param execution The flow's execution instance.
+ */
+ public void updateGenericVnf(Execution execution) {
+ def method = getClass().getSimpleName() + '.updateGenericVnf(' +
+ 'execution=' + execution.getId() +
+ ')'
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ logDebug('Entered ' + method, isDebugLogEnabled)
+
+ try {
+ def vnfId = execution.getVariable('UAAIGenVnf_vnfId')
+ def genericVnf = execution.getVariable('UAAIGenVnf_getGenericVnfResponse')
+ def origRequest = execution.getVariable('UpdateAAIGenericVnfRequest')
+
+ utils.logAudit("UpdateGenericVnf Request: " + origRequest)
+ // Confirm resource-version is in retrieved Generic VNF
+ def Node genericVnfNode = xmlParser.parseText(genericVnf)
+ if (utils.getChildNode(genericVnfNode, 'resource-version') == null) {
+ def msg = 'Can\'t update Generic VNF ' + vnfId + ' since \'resource-version\' is missing'
+ logError(msg)
+ throw new Exception(msg)
+ }
+
+ // Handle persona-model-id/persona-model-version
+
+ def String newPersonaModelId = execution.getVariable('UAAIGenVnf_personaModelId')
+ def String newPersonaModelVersion = execution.getVariable('UAAIGenVnf_personaModelVersion')
+ def String personaModelVersionEntry = ""
+ if (newPersonaModelId != null || newPersonaModelVersion != null) {
+
+ // Confirm "new" persona-model-id is same as "current" persona-model-id
+ def Node currPersonaModelIdNode = utils.getChildNode(genericVnfNode, 'persona-model-id')
+ def String currPersonaModelId = ''
+ if (currPersonaModelIdNode != null) {
+ currPersonaModelId = currPersonaModelIdNode.text()
+ }
+ if (!newPersonaModelId.equals(currPersonaModelId)) {
+ def msg = 'Can\'t update Generic VNF ' + vnfId + ' since there is \'persona-model-id\' mismatch between the current and new values'
+ logError(msg)
+ throw new Exception(msg)
+ }
+
+ // Construct payload
+ personaModelVersionEntry = updateGenericVnfNode(origRequest, genericVnfNode, 'persona-model-version')
+ }
+
+ // Handle ipv4-oam-address
+ def String ipv4OamAddress = execution.getVariable('UAAIGenVnf_ipv4OamAddress')
+ def String ipv4OamAddressEntry = ""
+ if (ipv4OamAddress != null) {
+ // Construct payload
+ ipv4OamAddressEntry = updateGenericVnfNode(origRequest, genericVnfNode, 'ipv4-oam-address')
+ }
+
+ // Handle management-v6-address
+ def String managementV6Address = execution.getVariable('UAAIGenVnf_managementV6Address')
+ def String managementV6AddressEntry = ""
+ if (managementV6Address != null) {
+ // Construct payload
+ managementV6AddressEntry = updateGenericVnfNode(origRequest, genericVnfNode, 'management-v6-address')
+ }
+
+ def payload = """
+ { ${personaModelVersionEntry}
+ ${ipv4OamAddressEntry}
+ ${managementV6AddressEntry}
+ "vnf-id": "${vnfId}"
+ }
+ """
+
+ // Construct endpoint
+ AaiUtil aaiUriUtil = new AaiUtil(this)
+ def aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution)
+ logDebug('AAI URI is: ' + aai_uri, isDebugLogEnabled)
+ String endPoint = execution.getVariable('URN_aai_endpoint') + aai_uri + '/' + UriUtils.encode(vnfId, "UTF-8")
+
+ try {
+ logDebug('sending PATCH to AAI endpoint \'' + endPoint + '\'' + 'with payload \n' + payload, isDebugLogEnabled)
+ utils.logAudit("Sending PATCH to AAI endpoint: " + endPoint)
+
+ APIResponse response = aaiUriUtil.executeAAIPatchCall(execution, endPoint, payload)
+ def responseData = response.getResponseBodyAsString()
+ execution.setVariable('UAAIGenVnf_updateGenericVnfResponseCode', response.getStatusCode())
+ execution.setVariable('UAAIGenVnf_updateGenericVnfResponse', responseData)
+ utils.logAudit("UpdateAAIGenericVnf Response Data: " + responseData)
+ logDebug('Response code:' + response.getStatusCode(), isDebugLogEnabled)
+ logDebug('Response:' + System.lineSeparator() + responseData, isDebugLogEnabled)
+ } catch (Exception ex) {
+ ex.printStackTrace()
+ logDebug('Exception occurred while executing AAI PATCH:' + ex.getMessage(),isDebugLogEnabled)
+ execution.setVariable('UAAIGenVnf_updateGenericVnfResponseCode', 500)
+ execution.setVariable('UAAIGenVnf_updateGenericVnfResponse', 'AAI PATCH Failed:' + ex.getMessage())
+ }
+ logDebug('Exited ' + method, isDebugLogEnabled)
+ } catch (BpmnError e) {
+ throw e;
+ } catch (Exception e) {
+ logError('Caught exception in ' + method, e)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in updateGenericVnf(): ' + e.getMessage())
+ }
+ }
+
+ /**
+ * Sets up json attributes for PATCH request for Update
+ *
+ * @param origRequest Incoming update request with Generic VNF element(s) to be updated.
+ * @param genericVnf Current Generic VNF retrieved from AAI.
+ * @param element Name of element to be inserted.
+ */
+ public String updateGenericVnfNode(String origRequest, Node genericVnfNode, String elementName) {
+
+ if (!utils.nodeExists(origRequest, elementName)) {
+ return ""
+ }
+ def elementValue = utils.getNodeText(origRequest, elementName)
+
+ if (elementValue.equals('DELETE')) {
+ // Set the element being deleted to null
+ return """"${elementName}": null,"""
+ }
+ else {
+ return """"${elementName}": "${elementValue}","""
+ }
+
+ }
+
+ /**
+ * Generates a WorkflowException if the AAI query returns a response code other than 200.
+ *
+ * @param execution The flow's execution instance.
+ */
+ public void handleAAIQueryFailure(Execution execution) {
+ def method = getClass().getSimpleName() + '.handleAAIQueryFailure(' +
+ 'execution=' + execution.getId() +
+ ')'
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ logDebug('Entered ' + method, isDebugLogEnabled)
+
+ logError('Error occurred attempting to query AAI, Response Code ' +
+ execution.getVariable('UAAIGenVnf_getGenericVnfResponseCode') + ', Error Response ' +
+ execution.getVariable('UAAIGenVnf_getGenericVnfResponse'))
+ String processKey = getProcessKey(execution);
+ WorkflowException exception = new WorkflowException(processKey, 5000,
+ execution.getVariable('UAAIGenVnf_getGenericVnfResponse'))
+ execution.setVariable('WorkflowException', exception)
+
+ utils.logAudit("Workflow Exception occurred when handling Quering AAI: " + exception.getErrorMessage())
+ logDebug('Exited ' + method, isDebugLogEnabled)
+ }
+
+ /**
+ * Generates a WorkflowException if updating a VF Module in AAI returns a response code other than 200.
+ *
+ * @param execution The flow's execution instance.
+ */
+ public void handleUpdateGenericVnfFailure(Execution execution) {
+ def method = getClass().getSimpleName() + '.handleUpdateGenericVnfFailure(' +
+ 'execution=' + execution.getId() +
+ ')'
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ logDebug('Entered ' + method, isDebugLogEnabled)
+
+ logError('Error occurred attempting to update Generic VNF in AAI, Response Code ' +
+ execution.getVariable('UAAIGenVnf_updateGenericVnfResponseCode') + ', Error Response ' +
+ execution.getVariable('UAAIGenVnf_updateGenericVnfResponse'))
+
+ String processKey = getProcessKey(execution);
+ WorkflowException exception = new WorkflowException(processKey, 5000,
+ execution.getVariable('UAAIGenVnf_updateGenericVnfResponse'))
+ execution.setVariable('WorkflowException', exception)
+
+ utils.logAudit("Workflow Exception occurred when Updating GenericVnf: " + exception.getErrorMessage())
+ logDebug('Exited ' + method, isDebugLogEnabled)
+ }
+} \ No newline at end of file
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/UpdateAAIVfModule.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/UpdateAAIVfModule.groovy
index e1949d981d..7283a3ecfc 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/UpdateAAIVfModule.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/UpdateAAIVfModule.groovy
@@ -1,385 +1,378 @@
-/*-
- * ============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.common.scripts
-
-import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.runtime.Execution
-import org.openecomp.mso.bpmn.core.WorkflowException
-import org.openecomp.mso.rest.APIResponse
-import org.springframework.web.util.UriUtils
-
-
-public class UpdateAAIVfModule extends AbstractServiceTaskProcessor {
-
- private XmlParser xmlParser = new XmlParser()
-
- /**
- * Initialize the flow's variables.
- *
- * @param execution The flow's execution instance.
- */
- public void initProcessVariables(Execution execution) {
- execution.setVariable('prefix', 'UAAIVfMod_')
- execution.setVariable('UAAIVfMod_vnfId', null)
- execution.setVariable('UAAIVfMod_vfModuleId', null)
- execution.setVariable('UAAIVfMod_orchestrationStatus', null)
- execution.setVariable('UAAIVfMod_heatStackId', null)
- execution.setVariable('UAAIVfMod_volumeGroupId', null)
- execution.setVariable('UAAIVfMod_getVfModuleResponseCode' ,null)
- execution.setVariable('UAAIVfMod_getVfModuleResponse', '')
- execution.setVariable('UAAIVfMod_updateVfModuleResponseCode', null)
- execution.setVariable('UAAIVfMod_updateVfModuleResponse', '')
- }
-
- /**
- * Check for missing elements in the received request.
- *
- * @param execution The flow's execution instance.
- */
- public void preProcessRequest(Execution execution) {
- def method = getClass().getSimpleName() + '.preProcessRequest(' +
- 'execution=' + execution.getId() +
- ')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- try {
- def xml = execution.getVariable('UpdateAAIVfModuleRequest')
- logDebug('Received request xml:\n' + xml, isDebugLogEnabled)
- utils.logAudit("UpdateAAIVfModule Request XML: " + xml)
- initProcessVariables(execution)
-
- def vnfId = getRequiredNodeText(execution, xml,'vnf-id')
- execution.setVariable('UAAIVfMod_vnfId', vnfId)
-
- def vfModuleId = getRequiredNodeText(execution, xml,'vf-module-id')
- execution.setVariable('UAAIVfMod_vfModuleId', vfModuleId)
-
- logDebug('Exited ' + method, isDebugLogEnabled)
- } catch (BpmnError e) {
- throw e;
- } catch (Exception e) {
- logError('Caught exception in ' + method, e)
- createWorkflowException(execution, 1002, 'Error in preProcessRequest(): ' + e.getMessage())
- }
- }
-
- /**
- * Using the received vnfId and vfModuleId, query AAI to get the corresponding VF Module.
- * A 200 response is expected with the VF Module in the response body.
- *
- * @param execution The flow's execution instance.
- */
- public void getVfModule(Execution execution) {
- def method = getClass().getSimpleName() + '.getVfModule(' +
- 'execution=' + execution.getId() +
- ')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- try {
- def vnfId = execution.getVariable('UAAIVfMod_vnfId')
- def vfModuleId = execution.getVariable('UAAIVfMod_vfModuleId')
-
- // Construct endpoint
- AaiUtil aaiUriUtil = new AaiUtil(this)
- def aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution)
- logDebug('AAI URI is: ' + aai_uri, isDebugLogEnabled)
- String endPoint = execution.getVariable('URN_aai_endpoint') + aai_uri + '/' + UriUtils.encode(vnfId, "UTF-8") + '/vf-modules/vf-module/' + UriUtils.encode(vfModuleId, "UTF-8")
-
- try {
- logDebug('sending GET to AAI endpoint \'' + endPoint + '\'', isDebugLogEnabled)
- utils.logAudit("UpdateAAIVfModule sending GET to AAI endpoint: " + endPoint)
-
- APIResponse response = aaiUriUtil.executeAAIGetCall(execution, endPoint)
- def responseData = response.getResponseBodyAsString()
- execution.setVariable('UAAIVfMod_getVfModuleResponseCode', response.getStatusCode())
- execution.setVariable('UAAIVfMod_getVfModuleResponse', responseData)
- logDebug('Response code:' + response.getStatusCode(), isDebugLogEnabled)
- logDebug('Response:' + System.lineSeparator() + responseData, isDebugLogEnabled)
- utils.logAudit("UpdateAAIVfModule response data: " + responseData)
- } catch (Exception ex) {
- ex.printStackTrace()
- logDebug('Exception occurred while executing AAI GET:' + ex.getMessage(),isDebugLogEnabled)
- execution.setVariable('UAAIVfMod_getVfModuleResponseCode', 500)
- execution.setVariable('UAAIVfMod_getVfModuleResponse', 'AAI GET Failed:' + ex.getMessage())
- }
- logDebug('Exited ' + method, isDebugLogEnabled)
- } catch (BpmnError e) {
- throw e;
- } catch (Exception e) {
- logError('Caught exception in ' + method, e)
- createWorkflowException(execution, 1002, 'Error in getVfModule(): ' + e.getMessage())
- }
- }
-
- /**
- * Construct and send a PUT request to AAI to update the VF Module.
- *
- * @param execution The flow's execution instance.
- */
- public void updateVfModule(Execution execution) {
- def method = getClass().getSimpleName() + '.updateVfModule(' +
- 'execution=' + execution.getId() +
- ')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- try {
- def vnfId = execution.getVariable('UAAIVfMod_vnfId')
- def vfModuleId = execution.getVariable('UAAIVfMod_vfModuleId')
- def vfModule = execution.getVariable('UAAIVfMod_getVfModuleResponse')
- def origRequest = execution.getVariable('UpdateAAIVfModuleRequest')
- def Node vfModuleNode = xmlParser.parseText(vfModule)
-
- utils.logAudit("UpdateAAIVfModule request: " + origRequest)
- // Confirm resource-version is in retrieved VF Module
- if (utils.getChildNode(vfModuleNode, 'resource-version') == null) {
- def msg = 'Can\'t update VF Module ' + vfModuleId + ' since \'resource-version\' is missing'
- logError(msg)
- throw new Exception(msg)
- }
-
- // TEMPORARY!!! Disable Volume Group Check
- // Check volume-group-id conditions
- //def checkVgiResult = checkVolumeGroupId(origRequest, vfModuleNode, isDebugLogEnabled)
- //if (checkVgiResult != null) {
- // def msg = 'Can\'t update VF Module ' + vfModuleId + ': ' + checkVgiResult
- // logError(msg)
- // throw new Exception(msg)
- //}
-
- // Handle persona-model-id/persona-model-version
- def boolean doPersonaModelVersion = true
- def String newPersonaModelId = utils.getNodeText1(origRequest, 'persona-model-id')
- def String newPersonaModelVersion = utils.getNodeText1(origRequest, 'persona-model-version')
- if ((newPersonaModelId == null) || (newPersonaModelVersion == null)) {
- doPersonaModelVersion = false
- } else {
- // Confirm "new" persona-model-id is same as "current" persona-model-id
- def String currPersonaModelId = utils.getChildNodeText(vfModuleNode, 'persona-model-id')
- if (currPersonaModelId == null) {
- currPersonaModelId = ''
- }
- if (!newPersonaModelId.equals(currPersonaModelId)) {
- def msg = 'Can\'t update VF Module ' + vfModuleId + ' since there is \'persona-model-id\' mismatch between the current and new values'
- logError(msg)
- throw new Exception(msg)
- }
- }
-
- // Construct payload
- updateVfModuleNode(origRequest, vfModuleNode, 'orchestration-status')
- updateVfModuleNode(origRequest, vfModuleNode, 'heat-stack-id')
- if (doPersonaModelVersion) {
- updateVfModuleNode(origRequest, vfModuleNode, 'persona-model-version')
- }
- updateVfModuleNode(origRequest, vfModuleNode, 'contrail-service-instance-fqdn')
- def payload = utils.nodeToString(vfModuleNode)
-
- // Construct endpoint
- AaiUtil aaiUriUtil = new AaiUtil(this)
- def aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution)
- logDebug('AAI URI is: ' + aai_uri, isDebugLogEnabled)
- String endPoint = execution.getVariable('URN_aai_endpoint') + aai_uri + '/' + UriUtils.encode(vnfId, "UTF-8") + '/vf-modules/vf-module/' + UriUtils.encode(vfModuleId, "UTF-8")
-
- try {
- logDebug('sending PUT to AAI endpoint \'' + endPoint + '\'' + 'with payload \n' + payload, isDebugLogEnabled)
- utils.logAudit("Sending PUT to AAI endpoint: " + endPoint)
-
- APIResponse response = aaiUriUtil.executeAAIPutCall(execution, endPoint, payload)
- def responseData = response.getResponseBodyAsString()
- execution.setVariable('UAAIVfMod_updateVfModuleResponseCode', response.getStatusCode())
- execution.setVariable('UAAIVfMod_updateVfModuleResponse', responseData)
- utils.logAudit("UpdateAAIVfModule Response data: " + responseData)
- logDebug('Response code:' + response.getStatusCode(), isDebugLogEnabled)
- logDebug('Response:' + System.lineSeparator() + responseData, isDebugLogEnabled)
- } catch (Exception ex) {
- ex.printStackTrace()
- logDebug('Exception occurred while executing AAI PUT:' + ex.getMessage(),isDebugLogEnabled)
- execution.setVariable('UAAIVfMod_updateVfModuleResponseCode', 500)
- execution.setVariable('UAAIVfMod_updateVfModuleResponse', 'AAI PUT Failed:' + ex.getMessage())
- }
- logDebug('Exited ' + method, isDebugLogEnabled)
- } catch (BpmnError e) {
- throw e;
- } catch (Exception e) {
- logError('Caught exception in ' + method, e)
- createWorkflowException(execution, 1002, 'Error in updateVfModule(): ' + e.getMessage())
- }
- }
-
- /**
- * Insert a new Node, replace the value of an existing Node, or delete an existing Node in the current
- * VF Module Node, as necessary.
- *
- * If the Node with the same name already exists in current VF Module, but is not being updated, then do
- * nothing. If the element is being updated and it already exists in the current VF Module, then check
- * the value specified in the original request. If the value is 'DELETE', remove that Node from the
- * current VF Module. Otherwise, change the value to the specified new value. If the element is
- * being updated but doesn't exist in the current VF Module, and the new value is not 'DELETE', then
- * create an appropriate new node and add it to the VF Module.
- *
- * @param origRequest Incoming update request with VF Module elements to be updated.
- * @param vfModule Current VF Module retrieved from AAI.
- * @param element Name of element to be inserted.
- */
- private void updateVfModuleNode(String origRequest, Node vfModuleNode, String elementName) {
-
- if (!utils.nodeExists(origRequest, elementName)) {
- return
- }
- def elementValue = utils.getNodeText(origRequest, elementName)
-
- def Node childNode = utils.getChildNode(vfModuleNode, elementName)
- if (childNode == null) {
- if (elementValue.equals('DELETE')) {
- // Element doesn't exist but is being deleted, so do nothing
- return
- }
- // Node doesn't exist, create a new Node as a child
- new Node(vfModuleNode, elementName, elementValue)
- } else {
- if (elementValue.equals('DELETE')) {
- // Node exists, but should be deleted
- vfModuleNode.remove(childNode)
- } else {
- // Node already exists, just give it a new value
- childNode.setValue(elementValue)
- }
- }
- }
-
- /**
- * Check the Volume Group ID from the incoming update request against the Volume Group ID from the
- * given VF Module. If they are equal or if they are both 'null', then that is acceptable and 'null'
- * is returned. Otherwise a message describing how the values are unacceptable/incompatible is returned.
- *
- * @param origRequest Incoming update request with VF Module elements to be updated.
- * @param vfModuleNode VF Module (as a Node) retrieved from AAI.
- * @param isDebugLogEnabled Is DEBUG log enabled?
- * @return 'null' if the Volume Group IDs are acceptable. Otherwise return a message describing how the
- * values are unacceptable/incompatible.
- */
- private String checkVolumeGroupId(String origRequest, Node vfModuleNode, String isDebugLogEnabled) {
- def requestVolumeGroupId = utils.getNodeText1(origRequest, 'volume-group-id')
- def currVolumeGroupId = getCurrVolumeGroupId(vfModuleNode)
-
- logDebug('Check volume-group-id: volume-group-id in original request is \'' + requestVolumeGroupId +
- '\', volume-group-id from VF Module is \'' + currVolumeGroupId + '\'', isDebugLogEnabled)
-
- def result = null
-
- if (requestVolumeGroupId == null) {
- if (currVolumeGroupId == null) {
- // This is OK
- } else {
- result = 'Cannot detach a volume group from an existing VF Module'
- }
- } else {
- if (currVolumeGroupId == null) {
- result = 'Cannot add a volume gruop to an existing VF Module'
- } else {
- if (!requestVolumeGroupId.equals(currVolumeGroupId)) {
- result = 'Cannot change the volume group on an existing VF Module'
- }
- }
- }
-
- return result
- }
-
- /**
- * Find and return the value of the Volume Group ID for the specified VF Module. If
- * the value of the Volume Group ID cannot be found for any reason, 'null' is returned.
- *
- * @param vfModuleNode VF Module (as a Node) retrieved from AAI.
- * @return the value of the Volume Group ID for the specified VF Module. If the
- * value of the Volume Group ID cannot be found for any reason, 'null' is returned.
- */
- private String getCurrVolumeGroupId(Node vfModuleNode) {
- def Node relationshipList = utils.getChildNode(vfModuleNode, 'relationship-list')
- if (relationshipList == null) {
- return null
- }
- def NodeList relationships = utils.getIdenticalChildren(relationshipList, 'relationship')
- for (Node relationshipNode in relationships) {
- def String relatedTo = utils.getChildNodeText(relationshipNode, 'related-to')
- if ((relatedTo != null) && relatedTo.equals('volume-group')) {
- def NodeList relationshipDataList = utils.getIdenticalChildren(relationshipNode, 'relationship-data')
- for (Node relationshipDataNode in relationshipDataList) {
- def String relationshipKey = utils.getChildNodeText(relationshipDataNode, 'relationship-key')
- if ((relationshipKey != null) && relationshipKey.equals('volume-group.volume-group-id')) {
- return utils.getChildNodeText(relationshipDataNode, 'relationship-value')
- }
- }
- }
- }
- return null
- }
-
- /**
- * Generates a WorkflowException if the AAI query returns a response code other than 200.
- *
- * @param execution The flow's execution instance.
- */
- public void handleAAIQueryFailure(Execution execution) {
- def method = getClass().getSimpleName() + '.handleAAIQueryFailure(' +
- 'execution=' + execution.getId() +
- ')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- logError('Error occurred attempting to query AAI, Response Code ' +
- execution.getVariable('UAAIVfMod_getVfModuleResponseCode') + ', Error Response ' +
- execution.getVariable('UAAIVfMod_getVfModuleResponse'))
- String processKey = getProcessKey(execution);
- WorkflowException exception = new WorkflowException(processKey, 5000,
- execution.getVariable('UAAIVfMod_getVfModuleResponse'))
- execution.setVariable('WorkflowException', exception)
- utils.logAudit("UpdateAAIVfModule query failure: " + exception.getErrorMessage())
- logDebug('Exited ' + method, isDebugLogEnabled)
- }
-
- /**
- * Generates a WorkflowException if updating a VF Module in AAI returns a response code other than 200.
- *
- * @param execution The flow's execution instance.
- */
- public void handleUpdateVfModuleFailure(Execution execution) {
- def method = getClass().getSimpleName() + '.handleUpdateVfModuleFailure(' +
- 'execution=' + execution.getId() +
- ')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- logError('Error occurred attempting to update VF Module in AAI, Response Code ' +
- execution.getVariable('UAAIVfMod_updateVfModuleResponseCode') + ', Error Response ' +
- execution.getVariable('UAAIVfMod_updateVfModuleResponse'))
- String processKey = getProcessKey(execution);
- WorkflowException exception = new WorkflowException(processKey, 5000,
- execution.getVariable('UAAIVfMod_updateVfModuleResponse'))
- execution.setVariable('WorkflowException', exception)
-
- utils.logAudit("UpdateAAIVfModule failure: " + exception.getErrorMessage())
- logDebug('Exited ' + method, isDebugLogEnabled)
- }
-}
+/*-
+ * ============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.common.scripts
+
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.runtime.Execution
+import org.openecomp.mso.bpmn.core.WorkflowException
+import org.openecomp.mso.rest.APIResponse
+import org.springframework.web.util.UriUtils
+
+
+public class UpdateAAIVfModule extends AbstractServiceTaskProcessor {
+
+ private XmlParser xmlParser = new XmlParser()
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+
+ /**
+ * Initialize the flow's variables.
+ *
+ * @param execution The flow's execution instance.
+ */
+ public void initProcessVariables(Execution execution) {
+ execution.setVariable('prefix', 'UAAIVfMod_')
+ execution.setVariable('UAAIVfMod_vnfId', null)
+ execution.setVariable('UAAIVfMod_vfModuleId', null)
+ execution.setVariable('UAAIVfMod_orchestrationStatus', null)
+ execution.setVariable('UAAIVfMod_heatStackId', null)
+ execution.setVariable('UAAIVfMod_volumeGroupId', null)
+ execution.setVariable('UAAIVfMod_getVfModuleResponseCode' ,null)
+ execution.setVariable('UAAIVfMod_getVfModuleResponse', '')
+ execution.setVariable('UAAIVfMod_updateVfModuleResponseCode', null)
+ execution.setVariable('UAAIVfMod_updateVfModuleResponse', '')
+ }
+
+ /**
+ * Check for missing elements in the received request.
+ *
+ * @param execution The flow's execution instance.
+ */
+ public void preProcessRequest(Execution execution) {
+ def method = getClass().getSimpleName() + '.preProcessRequest(' +
+ 'execution=' + execution.getId() +
+ ')'
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ logDebug('Entered ' + method, isDebugLogEnabled)
+
+ try {
+ def xml = execution.getVariable('UpdateAAIVfModuleRequest')
+ logDebug('Received request xml:\n' + xml, isDebugLogEnabled)
+ utils.logAudit("UpdateAAIVfModule Request XML: " + xml)
+ initProcessVariables(execution)
+
+ def vnfId = getRequiredNodeText(execution, xml,'vnf-id')
+ execution.setVariable('UAAIVfMod_vnfId', vnfId)
+
+ def vfModuleId = getRequiredNodeText(execution, xml,'vf-module-id')
+ execution.setVariable('UAAIVfMod_vfModuleId', vfModuleId)
+
+ logDebug('Exited ' + method, isDebugLogEnabled)
+ } catch (BpmnError e) {
+ throw e;
+ } catch (Exception e) {
+ logError('Caught exception in ' + method, e)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preProcessRequest(): ' + e.getMessage())
+ }
+ }
+
+ /**
+ * Using the received vnfId and vfModuleId, query AAI to get the corresponding VF Module.
+ * A 200 response is expected with the VF Module in the response body.
+ *
+ * @param execution The flow's execution instance.
+ */
+ public void getVfModule(Execution execution) {
+ def method = getClass().getSimpleName() + '.getVfModule(' +
+ 'execution=' + execution.getId() +
+ ')'
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ logDebug('Entered ' + method, isDebugLogEnabled)
+
+ try {
+ def vnfId = execution.getVariable('UAAIVfMod_vnfId')
+ def vfModuleId = execution.getVariable('UAAIVfMod_vfModuleId')
+
+ // Construct endpoint
+ AaiUtil aaiUriUtil = new AaiUtil(this)
+ def aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution)
+ logDebug('AAI URI is: ' + aai_uri, isDebugLogEnabled)
+ String endPoint = execution.getVariable('URN_aai_endpoint') + aai_uri + '/' + UriUtils.encode(vnfId, "UTF-8") + '/vf-modules/vf-module/' + UriUtils.encode(vfModuleId, "UTF-8")
+
+ try {
+ logDebug('sending GET to AAI endpoint \'' + endPoint + '\'', isDebugLogEnabled)
+ utils.logAudit("UpdateAAIVfModule sending GET to AAI endpoint: " + endPoint)
+
+ APIResponse response = aaiUriUtil.executeAAIGetCall(execution, endPoint)
+ def responseData = response.getResponseBodyAsString()
+ execution.setVariable('UAAIVfMod_getVfModuleResponseCode', response.getStatusCode())
+ execution.setVariable('UAAIVfMod_getVfModuleResponse', responseData)
+ logDebug('Response code:' + response.getStatusCode(), isDebugLogEnabled)
+ logDebug('Response:' + System.lineSeparator() + responseData, isDebugLogEnabled)
+ utils.logAudit("UpdateAAIVfModule response data: " + responseData)
+ } catch (Exception ex) {
+ ex.printStackTrace()
+ logDebug('Exception occurred while executing AAI GET:' + ex.getMessage(),isDebugLogEnabled)
+ execution.setVariable('UAAIVfMod_getVfModuleResponseCode', 500)
+ execution.setVariable('UAAIVfMod_getVfModuleResponse', 'AAI GET Failed:' + ex.getMessage())
+ }
+ logDebug('Exited ' + method, isDebugLogEnabled)
+ } catch (BpmnError e) {
+ throw e;
+ } catch (Exception e) {
+ logError('Caught exception in ' + method, e)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in getVfModule(): ' + e.getMessage())
+ }
+ }
+
+ /**
+ * Construct and send a PUT request to AAI to update the VF Module.
+ *
+ * @param execution The flow's execution instance.
+ */
+ public void updateVfModule(Execution execution) {
+ def method = getClass().getSimpleName() + '.updateVfModule(' +
+ 'execution=' + execution.getId() +
+ ')'
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ logDebug('Entered ' + method, isDebugLogEnabled)
+
+ try {
+ def vnfId = execution.getVariable('UAAIVfMod_vnfId')
+ def vfModuleId = execution.getVariable('UAAIVfMod_vfModuleId')
+ def vfModule = execution.getVariable('UAAIVfMod_getVfModuleResponse')
+ def origRequest = execution.getVariable('UpdateAAIVfModuleRequest')
+ def Node vfModuleNode = xmlParser.parseText(vfModule)
+
+ utils.logAudit("UpdateAAIVfModule request: " + origRequest)
+ // Confirm resource-version is in retrieved VF Module
+ if (utils.getChildNode(vfModuleNode, 'resource-version') == null) {
+ def msg = 'Can\'t update VF Module ' + vfModuleId + ' since \'resource-version\' is missing'
+ logError(msg)
+ throw new Exception(msg)
+ }
+
+ // TEMPORARY!!! Disable Volume Group Check
+ // Check volume-group-id conditions
+ //def checkVgiResult = checkVolumeGroupId(origRequest, vfModuleNode, isDebugLogEnabled)
+ //if (checkVgiResult != null) {
+ // def msg = 'Can\'t update VF Module ' + vfModuleId + ': ' + checkVgiResult
+ // logError(msg)
+ // throw new Exception(msg)
+ //}
+
+ // Handle persona-model-id/persona-model-version
+ def boolean doPersonaModelVersion = true
+ def String newPersonaModelId = utils.getNodeText1(origRequest, 'persona-model-id')
+ def String newPersonaModelVersion = utils.getNodeText1(origRequest, 'persona-model-version')
+ if ((newPersonaModelId == null) || (newPersonaModelVersion == null)) {
+ doPersonaModelVersion = false
+ } else {
+ // Confirm "new" persona-model-id is same as "current" persona-model-id
+ def String currPersonaModelId = utils.getChildNodeText(vfModuleNode, 'persona-model-id')
+ if (currPersonaModelId == null) {
+ currPersonaModelId = ''
+ }
+ if (!newPersonaModelId.equals(currPersonaModelId)) {
+ def msg = 'Can\'t update VF Module ' + vfModuleId + ' since there is \'persona-model-id\' mismatch between the current and new values'
+ logError(msg)
+ throw new Exception(msg)
+ }
+ }
+
+ // Construct payload
+ String orchestrationStatusEntry = updateVfModuleNode(origRequest, vfModuleNode, 'orchestration-status')
+ String heatStackIdEntry = updateVfModuleNode(origRequest, vfModuleNode, 'heat-stack-id')
+ String personaModelVersionEntry = ""
+ if (doPersonaModelVersion) {
+ personaModelVersionEntry = updateVfModuleNode(origRequest, vfModuleNode, 'persona-model-version')
+ }
+ String contrailServiceInstanceFqdnEntry = updateVfModuleNode(origRequest, vfModuleNode, 'contrail-service-instance-fqdn')
+ def payload = """
+ { ${orchestrationStatusEntry}
+ ${heatStackIdEntry}
+ ${personaModelVersionEntry}
+ ${contrailServiceInstanceFqdnEntry}
+ "vf-module-id": "${vfModuleId}"
+ }
+ """
+
+
+ // Construct endpoint
+ AaiUtil aaiUriUtil = new AaiUtil(this)
+ def aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution)
+ logDebug('AAI URI is: ' + aai_uri, isDebugLogEnabled)
+ String endPoint = execution.getVariable('URN_aai_endpoint') + aai_uri + '/' + UriUtils.encode(vnfId, "UTF-8") + '/vf-modules/vf-module/' + UriUtils.encode(vfModuleId, "UTF-8")
+
+ try {
+ logDebug('sending PATCH to AAI endpoint \'' + endPoint + '\'' + 'with payload \n' + payload, isDebugLogEnabled)
+ utils.logAudit("Sending PATCH to AAI endpoint: " + endPoint)
+
+ APIResponse response = aaiUriUtil.executeAAIPatchCall(execution, endPoint, payload)
+ def responseData = response.getResponseBodyAsString()
+ execution.setVariable('UAAIVfMod_updateVfModuleResponseCode', response.getStatusCode())
+ execution.setVariable('UAAIVfMod_updateVfModuleResponse', responseData)
+ utils.logAudit("UpdateAAIVfModule Response data: " + responseData)
+ logDebug('Response code:' + response.getStatusCode(), isDebugLogEnabled)
+ logDebug('Response:' + System.lineSeparator() + responseData, isDebugLogEnabled)
+ } catch (Exception ex) {
+ ex.printStackTrace()
+ logDebug('Exception occurred while executing AAI PATCH:' + ex.getMessage(),isDebugLogEnabled)
+ execution.setVariable('UAAIVfMod_updateVfModuleResponseCode', 500)
+ execution.setVariable('UAAIVfMod_updateVfModuleResponse', 'AAI PATCH Failed:' + ex.getMessage())
+ }
+ logDebug('Exited ' + method, isDebugLogEnabled)
+ } catch (BpmnError e) {
+ throw e;
+ } catch (Exception e) {
+ logError('Caught exception in ' + method, e)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in updateVfModule(): ' + e.getMessage())
+ }
+ }
+
+ /**
+ * Sets up json attributes for PATCH request for Update
+ *
+ * @param origRequest Incoming update request with VF Module elements to be updated.
+ * @param vfModule Current VF Module retrieved from AAI.
+ * @param element Name of element to be inserted.
+ */
+ private String updateVfModuleNode(String origRequest, Node vfModuleNode, String elementName) {
+
+ if (!utils.nodeExists(origRequest, elementName)) {
+ return ""
+ }
+ def elementValue = utils.getNodeText(origRequest, elementName)
+
+ if (elementValue.equals('DELETE')) {
+ // Set the element being deleted to null
+ return """"${elementName}": null,"""
+ }
+ else {
+ return """"${elementName}": "${elementValue}","""
+ }
+ }
+
+
+ /**
+ * Check the Volume Group ID from the incoming update request against the Volume Group ID from the
+ * given VF Module. If they are equal or if they are both 'null', then that is acceptable and 'null'
+ * is returned. Otherwise a message describing how the values are unacceptable/incompatible is returned.
+ *
+ * @param origRequest Incoming update request with VF Module elements to be updated.
+ * @param vfModuleNode VF Module (as a Node) retrieved from AAI.
+ * @param isDebugLogEnabled Is DEBUG log enabled?
+ * @return 'null' if the Volume Group IDs are acceptable. Otherwise return a message describing how the
+ * values are unacceptable/incompatible.
+ */
+ private String checkVolumeGroupId(String origRequest, Node vfModuleNode, String isDebugLogEnabled) {
+ def requestVolumeGroupId = utils.getNodeText1(origRequest, 'volume-group-id')
+ def currVolumeGroupId = getCurrVolumeGroupId(vfModuleNode)
+
+ logDebug('Check volume-group-id: volume-group-id in original request is \'' + requestVolumeGroupId +
+ '\', volume-group-id from VF Module is \'' + currVolumeGroupId + '\'', isDebugLogEnabled)
+
+ def result = null
+
+ if (requestVolumeGroupId == null) {
+ if (currVolumeGroupId == null) {
+ // This is OK
+ } else {
+ result = 'Cannot detach a volume group from an existing VF Module'
+ }
+ } else {
+ if (currVolumeGroupId == null) {
+ result = 'Cannot add a volume gruop to an existing VF Module'
+ } else {
+ if (!requestVolumeGroupId.equals(currVolumeGroupId)) {
+ result = 'Cannot change the volume group on an existing VF Module'
+ }
+ }
+ }
+
+ return result
+ }
+
+ /**
+ * Find and return the value of the Volume Group ID for the specified VF Module. If
+ * the value of the Volume Group ID cannot be found for any reason, 'null' is returned.
+ *
+ * @param vfModuleNode VF Module (as a Node) retrieved from AAI.
+ * @return the value of the Volume Group ID for the specified VF Module. If the
+ * value of the Volume Group ID cannot be found for any reason, 'null' is returned.
+ */
+ private String getCurrVolumeGroupId(Node vfModuleNode) {
+ def Node relationshipList = utils.getChildNode(vfModuleNode, 'relationship-list')
+ if (relationshipList == null) {
+ return null
+ }
+ def NodeList relationships = utils.getIdenticalChildren(relationshipList, 'relationship')
+ for (Node relationshipNode in relationships) {
+ def String relatedTo = utils.getChildNodeText(relationshipNode, 'related-to')
+ if ((relatedTo != null) && relatedTo.equals('volume-group')) {
+ def NodeList relationshipDataList = utils.getIdenticalChildren(relationshipNode, 'relationship-data')
+ for (Node relationshipDataNode in relationshipDataList) {
+ def String relationshipKey = utils.getChildNodeText(relationshipDataNode, 'relationship-key')
+ if ((relationshipKey != null) && relationshipKey.equals('volume-group.volume-group-id')) {
+ return utils.getChildNodeText(relationshipDataNode, 'relationship-value')
+ }
+ }
+ }
+ }
+ return null
+ }
+
+ /**
+ * Generates a WorkflowException if the AAI query returns a response code other than 200.
+ *
+ * @param execution The flow's execution instance.
+ */
+ public void handleAAIQueryFailure(Execution execution) {
+ def method = getClass().getSimpleName() + '.handleAAIQueryFailure(' +
+ 'execution=' + execution.getId() +
+ ')'
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ logDebug('Entered ' + method, isDebugLogEnabled)
+
+ logError('Error occurred attempting to query AAI, Response Code ' +
+ execution.getVariable('UAAIVfMod_getVfModuleResponseCode') + ', Error Response ' +
+ execution.getVariable('UAAIVfMod_getVfModuleResponse'))
+ String processKey = getProcessKey(execution);
+ WorkflowException exception = new WorkflowException(processKey, 5000,
+ execution.getVariable('UAAIVfMod_getVfModuleResponse'))
+ execution.setVariable('WorkflowException', exception)
+ utils.logAudit("UpdateAAIVfModule query failure: " + exception.getErrorMessage())
+ logDebug('Exited ' + method, isDebugLogEnabled)
+ }
+
+ /**
+ * Generates a WorkflowException if updating a VF Module in AAI returns a response code other than 200.
+ *
+ * @param execution The flow's execution instance.
+ */
+ public void handleUpdateVfModuleFailure(Execution execution) {
+ def method = getClass().getSimpleName() + '.handleUpdateVfModuleFailure(' +
+ 'execution=' + execution.getId() +
+ ')'
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ logDebug('Entered ' + method, isDebugLogEnabled)
+
+ logError('Error occurred attempting to update VF Module in AAI, Response Code ' +
+ execution.getVariable('UAAIVfMod_updateVfModuleResponseCode') + ', Error Response ' +
+ execution.getVariable('UAAIVfMod_updateVfModuleResponse'))
+ String processKey = getProcessKey(execution);
+ WorkflowException exception = new WorkflowException(processKey, 5000,
+ execution.getVariable('UAAIVfMod_updateVfModuleResponse'))
+ execution.setVariable('WorkflowException', exception)
+
+ utils.logAudit("UpdateAAIVfModule failure: " + exception.getErrorMessage())
+ logDebug('Exited ' + method, isDebugLogEnabled)
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VfModule.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VfModule.groovy
index f52d21513d..f45d779139 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VfModule.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VfModule.groovy
@@ -1,87 +1,87 @@
-/*-
- * ============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.common.scripts;
-
-import org.apache.commons.lang3.*
-
-public class VfModule implements Serializable {
-
- /**
- * Class representing a VF Module Node. Fields of this class include indicators
- * as to whether the VF Module is the only VF Module in its containing Generic VNF
- * and whether the VF Module is the base VF Module in its containing Generic VNF.
- */
-
- private Node node
- private Boolean onlyVfModule
- private Boolean baseVfModule
-
- /**
- * Constructor.
- *
- * @param node Node representing the VF Module xml.
- * @param onlyVfModule Is this VF Module the only VF Module in its containing Generic VNF?
- */
- public VfModule(Node node, boolean onlyVfModule) {
- this.node = node
- this.onlyVfModule = onlyVfModule
- this.baseVfModule = getElementText('is-base-vf-module').equals('true')
- }
-
- /**
- * Get the Node representing the VF Module xml.
- *
- * @return the Node representing the VF Module xml.
- */
- public Node getNode() {
- return node
- }
-
- public String getElementText(String childNodeName) {
- def Node childNode = (new MsoUtils()).getChildNode(node, childNodeName)
- if (childNode == null) {
- return ''
- } else {
- return childNode.text()
- }
- }
-
- /**
- * Is this VF Module the only VF Module in its containing Generic VNF?
- *
- * @return true if this VF Module is the only VF Module in its containing Generic VNF;
- * false otherwise.
- */
- public boolean isOnlyVfModule() {
- return onlyVfModule
- }
-
- /**
- * Is this VF Module the base VF Module in its containing Generic VNF?
- *
- * @return true if this VF Module is the base VF Module in its containing Generic VNF;
- * false otherwise.
- */
- public boolean isBaseVfModule() {
- return baseVfModule
- }
-}
-
+/*-
+ * ============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.common.scripts;
+
+import org.apache.commons.lang3.*
+
+public class VfModule implements Serializable {
+
+ /**
+ * Class representing a VF Module Node. Fields of this class include indicators
+ * as to whether the VF Module is the only VF Module in its containing Generic VNF
+ * and whether the VF Module is the base VF Module in its containing Generic VNF.
+ */
+
+ private Node node
+ private Boolean onlyVfModule
+ private Boolean baseVfModule
+
+ /**
+ * Constructor.
+ *
+ * @param node Node representing the VF Module xml.
+ * @param onlyVfModule Is this VF Module the only VF Module in its containing Generic VNF?
+ */
+ public VfModule(Node node, boolean onlyVfModule) {
+ this.node = node
+ this.onlyVfModule = onlyVfModule
+ this.baseVfModule = getElementText('is-base-vf-module').equals('true')
+ }
+
+ /**
+ * Get the Node representing the VF Module xml.
+ *
+ * @return the Node representing the VF Module xml.
+ */
+ public Node getNode() {
+ return node
+ }
+
+ public String getElementText(String childNodeName) {
+ def Node childNode = (new MsoUtils()).getChildNode(node, childNodeName)
+ if (childNode == null) {
+ return ''
+ } else {
+ return childNode.text()
+ }
+ }
+
+ /**
+ * Is this VF Module the only VF Module in its containing Generic VNF?
+ *
+ * @return true if this VF Module is the only VF Module in its containing Generic VNF;
+ * false otherwise.
+ */
+ public boolean isOnlyVfModule() {
+ return onlyVfModule
+ }
+
+ /**
+ * Is this VF Module the base VF Module in its containing Generic VNF?
+ *
+ * @return true if this VF Module is the base VF Module in its containing Generic VNF;
+ * false otherwise.
+ */
+ public boolean isBaseVfModule() {
+ return baseVfModule
+ }
+}
+
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VfModuleBase.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VfModuleBase.groovy
index b4d3c6f4d8..d48ae8f84e 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VfModuleBase.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VfModuleBase.groovy
@@ -1,609 +1,998 @@
-/*-
- * ============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.common.scripts;
-
-//import groovy.util.Node;
-
-import javax.xml.parsers.DocumentBuilder
-import javax.xml.parsers.DocumentBuilderFactory
-
-import org.apache.commons.lang3.*
-import org.camunda.bpm.engine.runtime.Execution
-import org.w3c.dom.Document
-import org.w3c.dom.Element
-import org.w3c.dom.Node
-import org.w3c.dom.NodeList
-import org.xml.sax.InputSource
-
-
-public abstract class VfModuleBase extends AbstractServiceTaskProcessor {
-
- protected XmlParser xmlParser = new XmlParser()
-
- /**
- * Get the XmlParser.
- *
- * @return the XmlParser.
- */
- protected XmlParser getXmlParser() {
- return xmlParser
- }
-
- /**
- * Find the VF Module with specified ID in the specified Generic VF. If no such
- * VF Module is found, null is returned.
- *
- * @param genericVnf The Generic VNF in which to search for the specified VF Moduel.
- * @param vfModuleId The ID of the VF Module for which to search.
- * @return a VFModule object for the found VF Module or null if no VF Module is found.
- */
- protected VfModule findVfModule(String genericVnf, String vfModuleId) {
-
- def genericVnfNode = xmlParser.parseText(genericVnf)
- def vfModulesNode = utils.getChildNode(genericVnfNode, 'vf-modules')
- if (vfModulesNode == null) {
- return null
- }
- def vfModuleList = utils.getIdenticalChildren(vfModulesNode, 'vf-module')
- for (vfModuleNode in vfModuleList) {
- def vfModuleIdNode = utils.getChildNode(vfModuleNode, 'vf-module-id')
- if ((vfModuleIdNode != null) && (vfModuleIdNode.text().equals(vfModuleId))) {
- return new VfModule(vfModuleNode, (vfModuleList.size() == 1))
- }
- }
- return null
- }
-
- /**
- * Transform all '*_network' parameter specifications from the incoming '*-params' root
- * element to a corresponding list of 'vnf-networks' specifications (typically used when
- * invoking the VNF Rest Adpater). Each element in '*-params' whose name attribute ends
- * with '_network' is used to create an 'vnf-networks' element.
- *
- * @param paramsNode A Node representing a '*-params' element.
- * @return a String of 'vnf-networks' elements, one for each 'param' element whose name
- * attribute ends with '_network'.
- */
- protected String transformNetworkParamsToVnfNetworks(String paramsRootXml) {
- if ((paramsRootXml == null) || (paramsRootXml.isEmpty())) {
- return ''
- }
- def String vnfNetworks = ''
- try {
- paramsRootXml = utils.removeXmlNamespaces(paramsRootXml)
- def paramsNode = xmlParser.parseText(paramsRootXml)
- def params = utils.getIdenticalChildren(paramsNode, 'param')
- for (param in params) {
- def String attrName = (String) param.attribute('name')
- if (attrName.endsWith('_network')) {
- def networkRole = attrName.substring(0, (attrName.length()-'_network'.length()))
- def networkName = param.text()
- String vnfNetwork = """
- <vnf-networks>
- <network-role>${networkRole}</network-role>
- <network-name>${networkName}</network-name>
- </vnf-networks>
- """
- vnfNetworks = vnfNetworks + vnfNetwork
- }
- }
- } catch (Exception e) {
- logWarn('Exception transforming \'_network\' params to vnfNetworks', e)
- }
- return vnfNetworks
- }
-
- /**
- * Transform the parameter specifications from the incoming '*-params' root element to
- * a corresponding list of 'entry's (typically used when invoking the VNF Rest Adpater).
- * Each element in '*-params' is used to create an 'entry' element.
- *
- * @param paramsNode A Node representing a '*-params' element.
- * @return a String of 'entry' elements, one for each 'param' element.
- */
- protected String transformParamsToEntries(String paramsRootXml) {
- if ((paramsRootXml == null) || (paramsRootXml.isEmpty())) {
- return ''
- }
- def String entries = ''
- try {
- paramsRootXml = utils.removeXmlNamespaces(paramsRootXml)
- def paramsNode = xmlParser.parseText(paramsRootXml)
- def params = utils.getIdenticalChildren(paramsNode, 'param')
- for (param in params) {
- def key = (String) param.attribute('name')
- if (key == null) {
- key = ''
- }
- def value = (String) param.text()
- String entry = """
- <entry>
- <key>${key}</key>
- <value>${value}</value>
- </entry>
- """
- entries = entries + entry
- }
- } catch (Exception e) {
- logWarn('Exception transforming params to entries', e)
- }
- return entries
- }
-
- /**
- * Transform the parameter specifications from the incoming '*-params' root element to
- * a corresponding list of 'entry's (typically used when invoking the VNF Rest Adpater).
- * Each element in '*-params' is used to create an 'entry' element.
- *
- * @param paramsNode A Node representing a '*-params' element.
- * @return a String of 'entry' elements, one for each 'param' element.
- */
- protected String transformVolumeParamsToEntries(String paramsRootXml) {
- if ((paramsRootXml == null) || (paramsRootXml.isEmpty())) {
- return ''
- }
- def String entries = ''
- try {
- paramsRootXml = utils.removeXmlNamespaces(paramsRootXml)
- def paramsNode = xmlParser.parseText(paramsRootXml)
- def params = utils.getIdenticalChildren(paramsNode, 'param')
- for (param in params) {
- def key = (String) param.attribute('name')
- if (key == null) {
- key = ''
- }
- if ( !(key in ['vnf_id', 'vnf_name', 'vf_module_id', 'vf_module_name'])) {
- def value = (String) param.text()
- String entry = """
- <entry>
- <key>${key}</key>
- <value>${value}</value>
- </entry>
- """
- entries = entries + entry
- }
- }
- } catch (Exception e) {
- logWarn('Exception transforming params to entries', e)
- }
- return entries
- }
-
- /**
- * Extract the Tenant Id from the Volume Group information returned by AAI.
- *
- * @param volumeGroupXml Volume Group XML returned by AAI.
- * @return the Tenant Id extracted from the Volume Group information. 'null' is returned if
- * the Tenant Id is missing or could not otherwise be extracted.
- */
- protected String getTenantIdFromVolumeGroup(String volumeGroupXml) {
- def groovy.util.Node volumeGroupNode = xmlParser.parseText(volumeGroupXml)
- def groovy.util.Node relationshipList = utils.getChildNode(volumeGroupNode, 'relationship-list')
- if (relationshipList != null) {
- def groovy.util.NodeList relationships = utils.getIdenticalChildren(relationshipList, 'relationship')
- for (groovy.util.Node relationship in relationships) {
- def groovy.util.Node relatedTo = utils.getChildNode(relationship, 'related-to')
- if ((relatedTo != null) && (relatedTo.text().equals('tenant'))) {
- def groovy.util.NodeList relationshipDataList = utils.getIdenticalChildren(relationship, 'relationship-data')
- for (groovy.util.Node relationshipData in relationshipDataList) {
- def groovy.util.Node relationshipKey = utils.getChildNode(relationshipData, 'relationship-key')
- if ((relationshipKey != null) && (relationshipKey.text().equals('tenant.tenant-id'))) {
- def groovy.util.Node relationshipValue = utils.getChildNode(relationshipData, 'relationship-value')
- if (relationshipValue != null) {
- return relationshipValue.text()
- }
- }
- }
- }
- }
- }
- return null
- }
-
-
- /*
- * Parses VNF parameters passed in on the incoming requests and SDNC parameters returned from SDNC get response
- * and puts them into the format expected by VNF adapter.
- * @param vnfParamsMap - map of VNF parameters passed in the request body
- * @param sdncGetResponse - response string from SDNC GET topology request
- * @param vnfId
- * @param vnfName
- * @param vfModuleId
- * @param vfModuleName
- * @return a String of key/value entries for vfModuleParams
- */
-
-
- protected String buildVfModuleParams(String vnfParams, String sdncGetResponse, String vnfId, String vnfName,
- String vfModuleId, String vfModuleName) {
-
- //Get SDNC Response Data
-
- String data = utils.getNodeXml(sdncGetResponse, "response-data")
- data = data.replaceAll("&lt;", "<")
- data = data.replaceAll("&gt;", ">")
-
- String serviceData = utils.getNodeXml(data, "service-data")
- serviceData = utils.removeXmlPreamble(serviceData)
- serviceData = utils.removeXmlNamespaces(serviceData)
- String vnfRequestInfo = utils.getNodeXml(serviceData, "vnf-request-information")
- String oldVnfId = utils.getNodeXml(vnfRequestInfo, "vnf-id")
- oldVnfId = utils.removeXmlPreamble(oldVnfId)
- oldVnfId = utils.removeXmlNamespaces(oldVnfId)
- serviceData = serviceData.replace(oldVnfId, "")
- def vnfId1 = utils.getNodeText1(serviceData, "vnf-id")
-
- // Add-on data
- String vnfInfo =
- """<entry>
- <key>vnf_id</key>
- <value>${vnfId}</value>
- </entry>
- <entry>
- <key>vnf_name</key>
- <value>${vnfName}</value>
- </entry>
- <entry>
- <key>vf_module_id</key>
- <value>${vfModuleId}</value>
- </entry>
- <entry>
- <key>vf_module_name</key>
- <value>${vfModuleName}</value>
- </entry>"""
-
- utils.logAudit("vnfInfo: " + vnfInfo)
- InputSource source = new InputSource(new StringReader(data));
- DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
- docFactory.setNamespaceAware(true)
- DocumentBuilder docBuilder = docFactory.newDocumentBuilder()
- Document responseXml = docBuilder.parse(source)
-
-
- // Availability Zones Data
- String aZones = ""
- StringBuilder sbAZone = new StringBuilder()
- NodeList aZonesList = responseXml.getElementsByTagNameNS("*", "availability-zones")
- String aZonePosition = "0"
- for (int z = 0; z < aZonesList.getLength(); z++) {
- Node node = aZonesList.item(z)
- if (node.getNodeType() == Node.ELEMENT_NODE) {
- Element eElement = (Element) node
- String aZoneValue = utils.getElementText(eElement, "availability-zone")
- aZonePosition = z.toString()
- String aZoneXml =
- """<entry>
- <key>availability_zone_${aZonePosition}</key>
- <value>${aZoneValue}</value>
- </entry>"""
- aZones = sbAZone.append(aZoneXml)
- }
- }
-
- // VNF Networks Data
- String vnfNetworkNetId = ""
- String vnfNetworkNetName = ""
- String vnfNetworkSubNetId = ""
- String vnfNetworkV6SubNetId = ""
- String vnfNetworkNetFqdn = ""
- String vnfNetworksSriovVlanFilters = ""
- StringBuilder sbNet = new StringBuilder()
- StringBuilder sbNet2 = new StringBuilder()
- StringBuilder sbNet3 = new StringBuilder()
- StringBuilder sbNet4 = new StringBuilder()
- StringBuilder sbNet5 = new StringBuilder()
- StringBuilder sbNet6 = new StringBuilder()
- NodeList vnfNetworkList = responseXml.getElementsByTagNameNS("*", "vnf-networks")
- for (int x = 0; x < vnfNetworkList.getLength(); x++) {
- Node node = vnfNetworkList.item(x)
- if (node.getNodeType() == Node.ELEMENT_NODE) {
- Element eElement = (Element) node
- String vnfNetworkKey = utils.getElementText(eElement, "network-role")
- String vnfNetworkNeutronIdValue = utils.getElementText(eElement, "neutron-id")
- String vnfNetworkNetNameValue = utils.getElementText(eElement, "network-name")
- String vnfNetworkSubNetIdValue = utils.getElementText(eElement, "subnet-id")
- String vnfNetworkV6SubNetIdValue = utils.getElementText(eElement, "ipv6-subnet-id")
- String vnfNetworkNetFqdnValue = utils.getElementText(eElement, "contrail-network-fqdn")
- String vnfNetworkNetIdXml =
- """<entry>
- <key>${vnfNetworkKey}_net_id</key>
- <value>${vnfNetworkNeutronIdValue}</value>
- </entry>"""
- vnfNetworkNetId = sbNet.append(vnfNetworkNetIdXml)
- String vnfNetworkNetNameXml =
- """<entry>
- <key>${vnfNetworkKey}_net_name</key>
- <value>${vnfNetworkNetNameValue}</value>
- </entry>"""
- vnfNetworkNetName = sbNet2.append(vnfNetworkNetNameXml)
- String vnfNetworkSubNetIdXml =
- """<entry>
- <key>${vnfNetworkKey}_subnet_id</key>
- <value>${vnfNetworkSubNetIdValue}</value>
- </entry>"""
- vnfNetworkSubNetId = sbNet3.append(vnfNetworkSubNetIdXml)
- String vnfNetworkV6SubNetIdXml =
- """<entry>
- <key>${vnfNetworkKey}_v6_subnet_id</key>
- <value>${vnfNetworkV6SubNetIdValue}</value>
- </entry>"""
- vnfNetworkV6SubNetId = sbNet5.append(vnfNetworkV6SubNetIdXml)
- String vnfNetworkNetFqdnXml =
- """<entry>
- <key>${vnfNetworkKey}_net_fqdn</key>
- <value>${vnfNetworkNetFqdnValue}</value>
- </entry>"""
- vnfNetworkNetFqdn = sbNet4.append(vnfNetworkNetFqdnXml)
-
- NodeList sriovVlanFilterList = eElement.getElementsByTagNameNS("*","sriov-vlan-filter-list")
- StringBuffer sriovFilterBuf = new StringBuffer()
- String values = ""
- for(int i = 0; i < sriovVlanFilterList.getLength(); i++){
- Node node1 = sriovVlanFilterList.item(i)
- if (node1.getNodeType() == Node.ELEMENT_NODE) {
- Element eElement1 = (Element) node1
- String value = utils.getElementText(eElement1, "sriov-vlan-filter")
- if (i != sriovVlanFilterList.getLength() - 1) {
- values = sriovFilterBuf.append(value + ",")
- }
- else {
- values = sriovFilterBuf.append(value);
- }
- }
- }
- if (!values.isEmpty()) {
- String vnfNetworkSriovVlanFilterXml =
- """<entry>
- <key>${vnfNetworkKey}_ATT_VF_VLAN_FILTER</key>
- <value>${values}</value>
- </entry>"""
- vnfNetworksSriovVlanFilters = sbNet6.append(vnfNetworkSriovVlanFilterXml)
- }
- }
- }
-
- // VNF-VMS Data
- String vnfVMS = ""
- String vnfVMSPositions = ""
- String vmNetworks = ""
- String vmNetworksPositions = ""
- String vmNetworksPositionsV6 = ""
- String interfaceRoutePrefixes = ""
- def key
- def value
- def networkKey
- def networkValue
- def floatingIPKey
- def floatingIPKeyValue
- def floatingIPV6Key
- def floatingIPV6KeyValue
- StringBuilder sb = new StringBuilder()
- StringBuilder sbPositions = new StringBuilder()
- StringBuilder sbVmNetworks = new StringBuilder()
- StringBuilder sbNetworksPositions = new StringBuilder()
- StringBuilder sbInterfaceRoutePrefixes = new StringBuilder()
- StringBuilder sbNetworksPositionsV6 = new StringBuilder()
-
- NodeList vmsList = responseXml.getElementsByTagNameNS("*","vnf-vms")
- for (int x = 0; x < vmsList.getLength(); x++) {
- Node node = vmsList.item(x)
- if (node.getNodeType() == Node.ELEMENT_NODE) {
- Element eElement = (Element) node
- key = utils.getElementText(eElement, "vm-type")
- String values
- String position = "0"
- StringBuilder sb1 = new StringBuilder()
- NodeList valueList = eElement.getElementsByTagNameNS("*","vm-names")
- NodeList vmNetworksList = eElement.getElementsByTagNameNS("*","vm-networks")
- for(int i = 0; i < valueList.getLength(); i++){
- Node node1 = valueList.item(i)
- if (node1.getNodeType() == Node.ELEMENT_NODE) {
- Element eElement1 = (Element) node1
- value = utils.getElementText(eElement1, "vm-name")
- if (i != valueList.getLength() - 1) {
- values = sb1.append(value + ",")
- }
- else {
- values = sb1.append(value);
- }
- position = i.toString()
- String vnfPositionXml =
- """<entry>
- <key>${key}_name_${position}</key>
- <value>${value}</value>
- </entry>"""
- vnfVMSPositions = sbPositions.append(vnfPositionXml)
- }
- }
- for(int n = 0; n < vmNetworksList.getLength(); n++){
- String floatingIpKeyValueStr = ""
- String floatingIpV6KeyValueStr = ""
- Node nodeNetworkKey = vmNetworksList.item(n)
- if (nodeNetworkKey.getNodeType() == Node.ELEMENT_NODE) {
- Element eElementNetworkKey = (Element) nodeNetworkKey
- String ipAddressValues
- String ipV6AddressValues
- String networkPosition = "0"
- StringBuilder sb2 = new StringBuilder()
- StringBuilder sb3 = new StringBuilder()
- StringBuilder sb4 = new StringBuilder()
- networkKey = utils.getElementText(eElementNetworkKey, "network-role")
- floatingIPKey = key + '_' + networkKey + '_floating_ip'
- floatingIPKeyValue = utils.getElementText(eElementNetworkKey, "floating-ip")
- if(!floatingIPKeyValue.isEmpty()){
- floatingIpKeyValueStr = """<entry>
- <key>$floatingIPKey</key>
- <value>$floatingIPKeyValue</value>
- </entry>"""
- }
- floatingIPV6Key = key + '_' + networkKey + '_floating_v6_ip'
- floatingIPV6KeyValue = utils.getElementText(eElementNetworkKey, "floating-ip-v6")
- if(!floatingIPV6KeyValue.isEmpty()){
- floatingIpV6KeyValueStr = """<entry>
- <key>$floatingIPV6Key</key>
- <value>$floatingIPV6KeyValue</value>
- </entry>"""
- }
- NodeList networkIpsList = eElementNetworkKey.getElementsByTagNameNS("*","network-ips")
- for(int a = 0; a < networkIpsList.getLength(); a++){
- Node ipAddress = networkIpsList.item(a)
- if (ipAddress.getNodeType() == Node.ELEMENT_NODE) {
- Element eElementIpAddress = (Element) ipAddress
- String ipAddressValue = utils.getElementText(eElementIpAddress, "ip-address")
- if (a != networkIpsList.getLength() - 1) {
- ipAddressValues = sb2.append(ipAddressValue + ",")
- }
- else {
- ipAddressValues = sb2.append(ipAddressValue);
- }
- networkPosition = a.toString()
- String vmNetworksPositionsXml =
- """<entry>
- <key>${key}_${networkKey}_ip_${networkPosition}</key>
- <value>${ipAddressValue}</value>
- </entry>"""
- vmNetworksPositions = sbNetworksPositions.append(vmNetworksPositionsXml)
- }
- }
- vmNetworksPositions = sbNetworksPositions.append(floatingIpKeyValueStr).append(floatingIpV6KeyValueStr)
-
- String vmNetworksXml =
- """<entry>
- <key>${key}_${networkKey}_ips</key>
- <value>${ipAddressValues}</value>
- </entry>"""
- vmNetworks = sbVmNetworks.append(vmNetworksXml)
-
- NodeList interfaceRoutePrefixesList = eElementNetworkKey.getElementsByTagNameNS("*","interface-route-prefixes")
- String interfaceRoutePrefixValues = sb3.append("[")
-
- for(int a = 0; a < interfaceRoutePrefixesList.getLength(); a++){
- Node interfaceRoutePrefix = interfaceRoutePrefixesList.item(a)
- if (interfaceRoutePrefix.getNodeType() == Node.ELEMENT_NODE) {
- Element eElementInterfaceRoutePrefix = (Element) interfaceRoutePrefix
- String interfaceRoutePrefixValue = utils.getElementText(eElementInterfaceRoutePrefix, "interface-route-prefix-cidr")
- if (interfaceRoutePrefixValue == null || interfaceRoutePrefixValue.isEmpty()) {
- interfaceRoutePrefixValue = utils.getElementText(eElementInterfaceRoutePrefix, "interface-route-prefix")
- }
- if (a != interfaceRoutePrefixesList.getLength() - 1) {
- interfaceRoutePrefixValues = sb3.append("{\"interface_route_table_routes_route_prefix\": \"" + interfaceRoutePrefixValue + "\"}" + ",")
- }
- else {
- interfaceRoutePrefixValues = sb3.append("{\"interface_route_table_routes_route_prefix\": \"" + interfaceRoutePrefixValue + "\"}")
- }
- }
- }
- interfaceRoutePrefixValues = sb3.append("]")
- if (interfaceRoutePrefixesList.getLength() > 0) {
- String interfaceRoutePrefixesXml =
- """<entry>
- <key>${key}_${networkKey}_route_prefixes</key>
- <value>${interfaceRoutePrefixValues}</value>
- </entry>"""
- interfaceRoutePrefixes = sbInterfaceRoutePrefixes.append(interfaceRoutePrefixesXml)
- }
-
- NodeList networkIpsV6List = eElementNetworkKey.getElementsByTagNameNS("*","network-ips-v6")
- for(int a = 0; a < networkIpsV6List.getLength(); a++){
- Node ipV6Address = networkIpsV6List.item(a)
- if (ipV6Address.getNodeType() == Node.ELEMENT_NODE) {
- Element eElementIpV6Address = (Element) ipV6Address
- String ipV6AddressValue = utils.getElementText(eElementIpV6Address, "ip-address-ipv6")
- if (a != networkIpsV6List.getLength() - 1) {
- ipV6AddressValues = sb4.append(ipV6AddressValue + ",")
- }
- else {
- ipV6AddressValues = sb4.append(ipV6AddressValue);
- }
- networkPosition = a.toString()
- String vmNetworksPositionsV6Xml =
- """<entry>
- <key>${key}_${networkKey}_v6_ip_${networkPosition}</key>
- <value>${ipV6AddressValue}</value>
- </entry>"""
- vmNetworksPositionsV6 = sbNetworksPositionsV6.append(vmNetworksPositionsV6Xml)
- }
- }
- String vmNetworksV6Xml =
- """<entry>
- <key>${key}_${networkKey}_v6_ips</key>
- <value>${ipV6AddressValues}</value>
- </entry>"""
- vmNetworks = sbVmNetworks.append(vmNetworksV6Xml)
- }
- }
- String vnfXml =
- """<entry>
- <key>${key}_names</key>
- <value>${values}</value>
- </entry>"""
- vnfVMS = sb.append(vnfXml)
- }
- }
- //SDNC Response Params
- String sdncResponseParams = ""
- List<String> sdncResponseParamsToSkip = ["vnf_id", "vf_module_id", "vnf_name", "vf_module_name"]
- String vnfParamsChildNodes = utils.getChildNodes(data, "vnf-parameters")
- if(vnfParamsChildNodes == null || vnfParamsChildNodes.length() < 1){
- // No SDNC params
- }else{
- NodeList paramsList = responseXml.getElementsByTagNameNS("*", "vnf-parameters")
- for (int z = 0; z < paramsList.getLength(); z++) {
- Node node = paramsList.item(z)
- Element eElement = (Element) node
- String vnfParameterName = utils.getElementText(eElement, "vnf-parameter-name")
- if (!sdncResponseParamsToSkip.contains(vnfParameterName)) {
- String vnfParameterValue = utils.getElementText(eElement, "vnf-parameter-value")
- String paraEntry =
- """<entry>
- <key>${vnfParameterName}</key>
- <value>${vnfParameterValue}</value>
- </entry>"""
- sdncResponseParams = sb.append(paraEntry)
- }
- }
- }
-
-
- def vfModuleParams = """
- ${vnfInfo}
- ${aZones}
- ${vnfNetworkNetId}
- ${vnfNetworkNetName}
- ${vnfNetworkSubNetId}
- ${vnfNetworkV6SubNetId}
- ${vnfNetworkNetFqdn}
- ${vnfNetworksSriovVlanFilters}
- ${vnfVMS}
- ${vnfVMSPositions}
- ${vmNetworks}
- ${vmNetworksPositions}
- ${vmNetworksPositionsV6}
- ${interfaceRoutePrefixes}
- ${vnfParams}
- ${sdncResponseParams}"""
-
- return vfModuleParams
-
- }
-
-
-}
+/*-
+ * ============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.common.scripts;
+
+//import groovy.util.Node;
+
+import javax.xml.parsers.DocumentBuilder
+import javax.xml.parsers.DocumentBuilderFactory
+
+import org.apache.commons.lang3.*
+import org.camunda.bpm.engine.runtime.Execution
+import org.w3c.dom.Document
+import org.w3c.dom.Element
+import org.w3c.dom.Node
+import org.w3c.dom.NodeList
+import org.xml.sax.InputSource
+
+
+public abstract class VfModuleBase extends AbstractServiceTaskProcessor {
+
+ protected XmlParser xmlParser = new XmlParser()
+
+ /**
+ * Get the XmlParser.
+ *
+ * @return the XmlParser.
+ */
+ protected XmlParser getXmlParser() {
+ return xmlParser
+ }
+
+ /**
+ * Find the VF Module with specified ID in the specified Generic VF. If no such
+ * VF Module is found, null is returned.
+ *
+ * @param genericVnf The Generic VNF in which to search for the specified VF Moduel.
+ * @param vfModuleId The ID of the VF Module for which to search.
+ * @return a VFModule object for the found VF Module or null if no VF Module is found.
+ */
+ protected VfModule findVfModule(String genericVnf, String vfModuleId) {
+
+ def genericVnfNode = xmlParser.parseText(genericVnf)
+ def vfModulesNode = utils.getChildNode(genericVnfNode, 'vf-modules')
+ if (vfModulesNode == null) {
+ return null
+ }
+ def vfModuleList = utils.getIdenticalChildren(vfModulesNode, 'vf-module')
+ for (vfModuleNode in vfModuleList) {
+ def vfModuleIdNode = utils.getChildNode(vfModuleNode, 'vf-module-id')
+ if ((vfModuleIdNode != null) && (vfModuleIdNode.text().equals(vfModuleId))) {
+ return new VfModule(vfModuleNode, (vfModuleList.size() == 1))
+ }
+ }
+ return null
+ }
+
+ /**
+ * Transform all '*_network' parameter specifications from the incoming '*-params' root
+ * element to a corresponding list of 'vnf-networks' specifications (typically used when
+ * invoking the VNF Rest Adpater). Each element in '*-params' whose name attribute ends
+ * with '_network' is used to create an 'vnf-networks' element.
+ *
+ * @param paramsNode A Node representing a '*-params' element.
+ * @return a String of 'vnf-networks' elements, one for each 'param' element whose name
+ * attribute ends with '_network'.
+ */
+ protected String transformNetworkParamsToVnfNetworks(String paramsRootXml) {
+ if ((paramsRootXml == null) || (paramsRootXml.isEmpty())) {
+ return ''
+ }
+ def String vnfNetworks = ''
+ try {
+ paramsRootXml = utils.removeXmlNamespaces(paramsRootXml)
+ def paramsNode = xmlParser.parseText(paramsRootXml)
+ def params = utils.getIdenticalChildren(paramsNode, 'param')
+ for (param in params) {
+ def String attrName = (String) param.attribute('name')
+ if (attrName.endsWith('_network')) {
+ def networkRole = attrName.substring(0, (attrName.length()-'_network'.length()))
+ def networkName = param.text()
+ String vnfNetwork = """
+ <vnf-networks>
+ <network-role>${networkRole}</network-role>
+ <network-name>${networkName}</network-name>
+ </vnf-networks>
+ """
+ vnfNetworks = vnfNetworks + vnfNetwork
+ }
+ }
+ } catch (Exception e) {
+ logWarn('Exception transforming \'_network\' params to vnfNetworks', e)
+ }
+ return vnfNetworks
+ }
+
+ /**
+ * Transform the parameter specifications from the incoming '*-params' root element to
+ * a corresponding list of 'entry's (typically used when invoking the VNF Rest Adpater).
+ * Each element in '*-params' is used to create an 'entry' element.
+ *
+ * @param paramsNode A Node representing a '*-params' element.
+ * @return a String of 'entry' elements, one for each 'param' element.
+ */
+ protected String transformParamsToEntries(String paramsRootXml) {
+ if ((paramsRootXml == null) || (paramsRootXml.isEmpty())) {
+ return ''
+ }
+ def String entries = ''
+ try {
+ paramsRootXml = utils.removeXmlNamespaces(paramsRootXml)
+ def paramsNode = xmlParser.parseText(paramsRootXml)
+ def params = utils.getIdenticalChildren(paramsNode, 'param')
+ for (param in params) {
+ def key = (String) param.attribute('name')
+ if (key == null) {
+ key = ''
+ }
+ def value = (String) param.text()
+ String entry = """
+ <entry>
+ <key>${key}</key>
+ <value>${value}</value>
+ </entry>
+ """
+ entries = entries + entry
+ }
+ } catch (Exception e) {
+ logWarn('Exception transforming params to entries', e)
+ }
+ return entries
+ }
+
+ /**
+ * Transform the parameter specifications from the incoming '*-params' root element to
+ * a corresponding list of 'entry's (typically used when invoking the VNF Rest Adpater).
+ * Each element in '*-params' is used to create an 'entry' element.
+ *
+ * @param paramsNode A Node representing a '*-params' element.
+ * @return a String of 'entry' elements, one for each 'param' element.
+ */
+ protected String transformVolumeParamsToEntries(String paramsRootXml) {
+ if ((paramsRootXml == null) || (paramsRootXml.isEmpty())) {
+ return ''
+ }
+ def String entries = ''
+ try {
+ paramsRootXml = utils.removeXmlNamespaces(paramsRootXml)
+ def paramsNode = xmlParser.parseText(paramsRootXml)
+ def params = utils.getIdenticalChildren(paramsNode, 'param')
+ for (param in params) {
+ def key = (String) param.attribute('name')
+ if (key == null) {
+ key = ''
+ }
+ if ( !(key in ['vnf_id', 'vnf_name', 'vf_module_id', 'vf_module_name'])) {
+ def value = (String) param.text()
+ String entry = """
+ <entry>
+ <key>${key}</key>
+ <value>${value}</value>
+ </entry>
+ """
+ entries = entries + entry
+ }
+ }
+ } catch (Exception e) {
+ logWarn('Exception transforming params to entries', e)
+ }
+ return entries
+ }
+
+ /**
+ * Extract the Tenant Id from the Volume Group information returned by AAI.
+ *
+ * @param volumeGroupXml Volume Group XML returned by AAI.
+ * @return the Tenant Id extracted from the Volume Group information. 'null' is returned if
+ * the Tenant Id is missing or could not otherwise be extracted.
+ */
+ protected String getTenantIdFromVolumeGroup(String volumeGroupXml) {
+ def groovy.util.Node volumeGroupNode = xmlParser.parseText(volumeGroupXml)
+ def groovy.util.Node relationshipList = utils.getChildNode(volumeGroupNode, 'relationship-list')
+ if (relationshipList != null) {
+ def groovy.util.NodeList relationships = utils.getIdenticalChildren(relationshipList, 'relationship')
+ for (groovy.util.Node relationship in relationships) {
+ def groovy.util.Node relatedTo = utils.getChildNode(relationship, 'related-to')
+ if ((relatedTo != null) && (relatedTo.text().equals('tenant'))) {
+ def groovy.util.NodeList relationshipDataList = utils.getIdenticalChildren(relationship, 'relationship-data')
+ for (groovy.util.Node relationshipData in relationshipDataList) {
+ def groovy.util.Node relationshipKey = utils.getChildNode(relationshipData, 'relationship-key')
+ if ((relationshipKey != null) && (relationshipKey.text().equals('tenant.tenant-id'))) {
+ def groovy.util.Node relationshipValue = utils.getChildNode(relationshipData, 'relationship-value')
+ if (relationshipValue != null) {
+ return relationshipValue.text()
+ }
+ }
+ }
+ }
+ }
+ }
+ return null
+ }
+
+
+ /*
+ * Parses VNF parameters passed in on the incoming requests and SDNC parameters returned from SDNC get response
+ * and puts them into the format expected by VNF adapter.
+ * @param vnfParamsMap - map of VNF parameters passed in the request body
+ * @param sdncGetResponse - response string from SDNC GET topology request
+ * @param vnfId
+ * @param vnfName
+ * @param vfModuleId
+ * @param vfModuleName
+ * @param vfModuleIndex - can be null
+ * @return a String of key/value entries for vfModuleParams
+ */
+
+
+ protected String buildVfModuleParams(String vnfParams, String sdncGetResponse, String vnfId, String vnfName,
+ String vfModuleId, String vfModuleName, String vfModuleIndex) {
+
+ //Get SDNC Response Data
+
+ String data = utils.getNodeXml(sdncGetResponse, "response-data")
+ data = data.replaceAll("&lt;", "<")
+ data = data.replaceAll("&gt;", ">")
+
+ String serviceData = utils.getNodeXml(data, "service-data")
+ serviceData = utils.removeXmlPreamble(serviceData)
+ serviceData = utils.removeXmlNamespaces(serviceData)
+ String vnfRequestInfo = utils.getNodeXml(serviceData, "vnf-request-information")
+ String oldVnfId = utils.getNodeXml(vnfRequestInfo, "vnf-id")
+ oldVnfId = utils.removeXmlPreamble(oldVnfId)
+ oldVnfId = utils.removeXmlNamespaces(oldVnfId)
+ serviceData = serviceData.replace(oldVnfId, "")
+ def vnfId1 = utils.getNodeText1(serviceData, "vnf-id")
+ String vfModuleIndexParam = ""
+
+ if (vfModuleIndex != null) {
+ vfModuleIndexParam = """<entry>
+ <key>vf_module_index</key>
+ <value>${vfModuleIndex}</value>
+ </entry>"""
+ }
+
+ // Add-on data
+ String vnfInfo =
+ """<entry>
+ <key>vnf_id</key>
+ <value>${vnfId}</value>
+ </entry>
+ <entry>
+ <key>vnf_name</key>
+ <value>${vnfName}</value>
+ </entry>
+ <entry>
+ <key>vf_module_id</key>
+ <value>${vfModuleId}</value>
+ </entry>
+ <entry>
+ <key>vf_module_name</key>
+ <value>${vfModuleName}</value>
+ </entry>
+ ${vfModuleIndexParam}"""
+
+ utils.logAudit("vnfInfo: " + vnfInfo)
+ InputSource source = new InputSource(new StringReader(data));
+ DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
+ docFactory.setNamespaceAware(true)
+ DocumentBuilder docBuilder = docFactory.newDocumentBuilder()
+ Document responseXml = docBuilder.parse(source)
+
+
+ // Availability Zones Data
+ String aZones = ""
+ StringBuilder sbAZone = new StringBuilder()
+
+ NodeList aZonesList = responseXml.getElementsByTagNameNS("*", "availability-zones")
+ String aZonePosition = "0"
+ for (int z = 0; z < aZonesList.getLength(); z++) {
+ Node node = aZonesList.item(z)
+ if (node.getNodeType() == Node.ELEMENT_NODE) {
+ Element eElement = (Element) node
+ String aZoneValue = utils.getElementText(eElement, "availability-zone")
+ aZonePosition = z.toString()
+ String aZoneXml =
+ """<entry>
+ <key>availability_zone_${aZonePosition}</key>
+ <value>${aZoneValue}</value>
+ </entry>"""
+ aZones = sbAZone.append(aZoneXml)
+ }
+ }
+
+ // VNF Networks Data
+ String vnfNetworkNetId = ""
+ String vnfNetworkNetName = ""
+ String vnfNetworkSubNetId = ""
+ String vnfNetworkV6SubNetId = ""
+ String vnfNetworkNetFqdn = ""
+ String vnfNetworksSriovVlanFilters = ""
+ StringBuilder sbNet = new StringBuilder()
+ StringBuilder sbNet2 = new StringBuilder()
+ StringBuilder sbNet3 = new StringBuilder()
+ StringBuilder sbNet4 = new StringBuilder()
+ StringBuilder sbNet5 = new StringBuilder()
+ StringBuilder sbNet6 = new StringBuilder()
+ NodeList vnfNetworkList = responseXml.getElementsByTagNameNS("*", "vnf-networks")
+ for (int x = 0; x < vnfNetworkList.getLength(); x++) {
+ Node node = vnfNetworkList.item(x)
+ if (node.getNodeType() == Node.ELEMENT_NODE) {
+ Element eElement = (Element) node
+ String vnfNetworkKey = utils.getElementText(eElement, "network-role")
+ String vnfNetworkNeutronIdValue = utils.getElementText(eElement, "neutron-id")
+ String vnfNetworkNetNameValue = utils.getElementText(eElement, "network-name")
+ String vnfNetworkSubNetIdValue = utils.getElementText(eElement, "subnet-id")
+ String vnfNetworkV6SubNetIdValue = utils.getElementText(eElement, "ipv6-subnet-id")
+ String vnfNetworkNetFqdnValue = utils.getElementText(eElement, "contrail-network-fqdn")
+ String vnfNetworkNetIdXml =
+ """<entry>
+ <key>${vnfNetworkKey}_net_id</key>
+ <value>${vnfNetworkNeutronIdValue}</value>
+ </entry>"""
+ vnfNetworkNetId = sbNet.append(vnfNetworkNetIdXml)
+ String vnfNetworkNetNameXml =
+ """<entry>
+ <key>${vnfNetworkKey}_net_name</key>
+ <value>${vnfNetworkNetNameValue}</value>
+ </entry>"""
+ vnfNetworkNetName = sbNet2.append(vnfNetworkNetNameXml)
+ String vnfNetworkSubNetIdXml =
+ """<entry>
+ <key>${vnfNetworkKey}_subnet_id</key>
+ <value>${vnfNetworkSubNetIdValue}</value>
+ </entry>"""
+ vnfNetworkSubNetId = sbNet3.append(vnfNetworkSubNetIdXml)
+ String vnfNetworkV6SubNetIdXml =
+ """<entry>
+ <key>${vnfNetworkKey}_v6_subnet_id</key>
+ <value>${vnfNetworkV6SubNetIdValue}</value>
+ </entry>"""
+ vnfNetworkV6SubNetId = sbNet5.append(vnfNetworkV6SubNetIdXml)
+ String vnfNetworkNetFqdnXml =
+ """<entry>
+ <key>${vnfNetworkKey}_net_fqdn</key>
+ <value>${vnfNetworkNetFqdnValue}</value>
+ </entry>"""
+ vnfNetworkNetFqdn = sbNet4.append(vnfNetworkNetFqdnXml)
+
+ NodeList sriovVlanFilterList = eElement.getElementsByTagNameNS("*","sriov-vlan-filter-list")
+ StringBuffer sriovFilterBuf = new StringBuffer()
+ String values = ""
+ for(int i = 0; i < sriovVlanFilterList.getLength(); i++){
+ Node node1 = sriovVlanFilterList.item(i)
+ if (node1.getNodeType() == Node.ELEMENT_NODE) {
+ Element eElement1 = (Element) node1
+ String value = utils.getElementText(eElement1, "sriov-vlan-filter")
+ if (i != sriovVlanFilterList.getLength() - 1) {
+ values = sriovFilterBuf.append(value + ",")
+ }
+ else {
+ values = sriovFilterBuf.append(value);
+ }
+ }
+ }
+ if (!values.isEmpty()) {
+ String vnfNetworkSriovVlanFilterXml =
+ """<entry>
+ <key>${vnfNetworkKey}_ATT_VF_VLAN_FILTER</key>
+ <value>${values}</value>
+ </entry>"""
+ vnfNetworksSriovVlanFilters = sbNet6.append(vnfNetworkSriovVlanFilterXml)
+ }
+ }
+ }
+
+ // VNF-VMS Data
+ String vnfVMS = ""
+ String vnfVMSPositions = ""
+ String vmNetworks = ""
+ String vmNetworksPositions = ""
+ String vmNetworksPositionsV6 = ""
+ String interfaceRoutePrefixes = ""
+ def key
+ def value
+ def networkKey
+ def networkValue
+ def floatingIPKey
+ def floatingIPKeyValue
+ def floatingIPV6Key
+ def floatingIPV6KeyValue
+ StringBuilder sb = new StringBuilder()
+ StringBuilder sbPositions = new StringBuilder()
+ StringBuilder sbVmNetworks = new StringBuilder()
+ StringBuilder sbNetworksPositions = new StringBuilder()
+ StringBuilder sbInterfaceRoutePrefixes = new StringBuilder()
+ StringBuilder sbNetworksPositionsV6 = new StringBuilder()
+
+ NodeList vmsList = responseXml.getElementsByTagNameNS("*","vnf-vms")
+ for (int x = 0; x < vmsList.getLength(); x++) {
+ Node node = vmsList.item(x)
+ if (node.getNodeType() == Node.ELEMENT_NODE) {
+ Element eElement = (Element) node
+ key = utils.getElementText(eElement, "vm-type")
+ String values
+ String position = "0"
+ StringBuilder sb1 = new StringBuilder()
+ NodeList valueList = eElement.getElementsByTagNameNS("*","vm-names")
+ NodeList vmNetworksList = eElement.getElementsByTagNameNS("*","vm-networks")
+ for(int i = 0; i < valueList.getLength(); i++){
+ Node node1 = valueList.item(i)
+ if (node1.getNodeType() == Node.ELEMENT_NODE) {
+ Element eElement1 = (Element) node1
+ value = utils.getElementText(eElement1, "vm-name")
+ if (i != valueList.getLength() - 1) {
+ values = sb1.append(value + ",")
+ }
+ else {
+ values = sb1.append(value);
+ }
+ position = i.toString()
+ String vnfPositionXml =
+ """<entry>
+ <key>${key}_name_${position}</key>
+ <value>${value}</value>
+ </entry>"""
+ vnfVMSPositions = sbPositions.append(vnfPositionXml)
+ }
+ }
+ for(int n = 0; n < vmNetworksList.getLength(); n++){
+ String floatingIpKeyValueStr = ""
+ String floatingIpV6KeyValueStr = ""
+ Node nodeNetworkKey = vmNetworksList.item(n)
+ if (nodeNetworkKey.getNodeType() == Node.ELEMENT_NODE) {
+ Element eElementNetworkKey = (Element) nodeNetworkKey
+ String ipAddressValues
+ String ipV6AddressValues
+ String networkPosition = "0"
+ StringBuilder sb2 = new StringBuilder()
+ StringBuilder sb3 = new StringBuilder()
+ StringBuilder sb4 = new StringBuilder()
+ networkKey = utils.getElementText(eElementNetworkKey, "network-role")
+ floatingIPKey = key + '_' + networkKey + '_floating_ip'
+ floatingIPKeyValue = utils.getElementText(eElementNetworkKey, "floating-ip")
+ if(!floatingIPKeyValue.isEmpty()){
+ floatingIpKeyValueStr = """<entry>
+ <key>$floatingIPKey</key>
+ <value>$floatingIPKeyValue</value>
+ </entry>"""
+ }
+ floatingIPV6Key = key + '_' + networkKey + '_floating_v6_ip'
+ floatingIPV6KeyValue = utils.getElementText(eElementNetworkKey, "floating-ip-v6")
+ if(!floatingIPV6KeyValue.isEmpty()){
+ floatingIpV6KeyValueStr = """<entry>
+ <key>$floatingIPV6Key</key>
+ <value>$floatingIPV6KeyValue</value>
+ </entry>"""
+ }
+ NodeList networkIpsList = eElementNetworkKey.getElementsByTagNameNS("*","network-ips")
+ for(int a = 0; a < networkIpsList.getLength(); a++){
+ Node ipAddress = networkIpsList.item(a)
+ if (ipAddress.getNodeType() == Node.ELEMENT_NODE) {
+ Element eElementIpAddress = (Element) ipAddress
+ String ipAddressValue = utils.getElementText(eElementIpAddress, "ip-address")
+ if (a != networkIpsList.getLength() - 1) {
+ ipAddressValues = sb2.append(ipAddressValue + ",")
+ }
+ else {
+ ipAddressValues = sb2.append(ipAddressValue);
+ }
+ networkPosition = a.toString()
+ String vmNetworksPositionsXml =
+ """<entry>
+ <key>${key}_${networkKey}_ip_${networkPosition}</key>
+ <value>${ipAddressValue}</value>
+ </entry>"""
+ vmNetworksPositions = sbNetworksPositions.append(vmNetworksPositionsXml)
+ }
+ }
+ vmNetworksPositions = sbNetworksPositions.append(floatingIpKeyValueStr).append(floatingIpV6KeyValueStr)
+
+ String vmNetworksXml =
+ """<entry>
+ <key>${key}_${networkKey}_ips</key>
+ <value>${ipAddressValues}</value>
+ </entry>"""
+ vmNetworks = sbVmNetworks.append(vmNetworksXml)
+
+ NodeList interfaceRoutePrefixesList = eElementNetworkKey.getElementsByTagNameNS("*","interface-route-prefixes")
+ String interfaceRoutePrefixValues = sb3.append("[")
+
+ for(int a = 0; a < interfaceRoutePrefixesList.getLength(); a++){
+ Node interfaceRoutePrefix = interfaceRoutePrefixesList.item(a)
+ if (interfaceRoutePrefix.getNodeType() == Node.ELEMENT_NODE) {
+ Element eElementInterfaceRoutePrefix = (Element) interfaceRoutePrefix
+ String interfaceRoutePrefixValue = utils.getElementText(eElementInterfaceRoutePrefix, "interface-route-prefix-cidr")
+ if (interfaceRoutePrefixValue == null || interfaceRoutePrefixValue.isEmpty()) {
+ interfaceRoutePrefixValue = utils.getElementText(eElementInterfaceRoutePrefix, "interface-route-prefix")
+ }
+ if (a != interfaceRoutePrefixesList.getLength() - 1) {
+ interfaceRoutePrefixValues = sb3.append("{\"interface_route_table_routes_route_prefix\": \"" + interfaceRoutePrefixValue + "\"}" + ",")
+ }
+ else {
+ interfaceRoutePrefixValues = sb3.append("{\"interface_route_table_routes_route_prefix\": \"" + interfaceRoutePrefixValue + "\"}")
+ }
+ }
+ }
+ interfaceRoutePrefixValues = sb3.append("]")
+ if (interfaceRoutePrefixesList.getLength() > 0) {
+ String interfaceRoutePrefixesXml =
+ """<entry>
+ <key>${key}_${networkKey}_route_prefixes</key>
+ <value>${interfaceRoutePrefixValues}</value>
+ </entry>"""
+ interfaceRoutePrefixes = sbInterfaceRoutePrefixes.append(interfaceRoutePrefixesXml)
+ }
+
+ NodeList networkIpsV6List = eElementNetworkKey.getElementsByTagNameNS("*","network-ips-v6")
+ for(int a = 0; a < networkIpsV6List.getLength(); a++){
+ Node ipV6Address = networkIpsV6List.item(a)
+ if (ipV6Address.getNodeType() == Node.ELEMENT_NODE) {
+ Element eElementIpV6Address = (Element) ipV6Address
+ String ipV6AddressValue = utils.getElementText(eElementIpV6Address, "ip-address-ipv6")
+ if (a != networkIpsV6List.getLength() - 1) {
+ ipV6AddressValues = sb4.append(ipV6AddressValue + ",")
+ }
+ else {
+ ipV6AddressValues = sb4.append(ipV6AddressValue);
+ }
+ networkPosition = a.toString()
+ String vmNetworksPositionsV6Xml =
+ """<entry>
+ <key>${key}_${networkKey}_v6_ip_${networkPosition}</key>
+ <value>${ipV6AddressValue}</value>
+ </entry>"""
+ vmNetworksPositionsV6 = sbNetworksPositionsV6.append(vmNetworksPositionsV6Xml)
+ }
+ }
+ String vmNetworksV6Xml =
+ """<entry>
+ <key>${key}_${networkKey}_v6_ips</key>
+ <value>${ipV6AddressValues}</value>
+ </entry>"""
+ vmNetworks = sbVmNetworks.append(vmNetworksV6Xml)
+ }
+ }
+ String vnfXml =
+ """<entry>
+ <key>${key}_names</key>
+ <value>${values}</value>
+ </entry>"""
+ vnfVMS = sb.append(vnfXml)
+ }
+ }
+ //SDNC Response Params
+ String sdncResponseParams = ""
+ List<String> sdncResponseParamsToSkip = ["vnf_id", "vf_module_id", "vnf_name", "vf_module_name"]
+ String vnfParamsChildNodes = utils.getChildNodes(data, "vnf-parameters")
+ if(vnfParamsChildNodes == null || vnfParamsChildNodes.length() < 1){
+ // No SDNC params
+ }else{
+ NodeList paramsList = responseXml.getElementsByTagNameNS("*", "vnf-parameters")
+ for (int z = 0; z < paramsList.getLength(); z++) {
+ Node node = paramsList.item(z)
+ Element eElement = (Element) node
+ String vnfParameterName = utils.getElementText(eElement, "vnf-parameter-name")
+ if (!sdncResponseParamsToSkip.contains(vnfParameterName)) {
+ String vnfParameterValue = utils.getElementText(eElement, "vnf-parameter-value")
+ String paraEntry =
+ """<entry>
+ <key>${vnfParameterName}</key>
+ <value>${vnfParameterValue}</value>
+ </entry>"""
+ sdncResponseParams = sb.append(paraEntry)
+ }
+ }
+ }
+
+
+ def vfModuleParams = """
+ ${vnfInfo}
+ ${aZones}
+ ${vnfNetworkNetId}
+ ${vnfNetworkNetName}
+ ${vnfNetworkSubNetId}
+ ${vnfNetworkV6SubNetId}
+ ${vnfNetworkNetFqdn}
+ ${vnfNetworksSriovVlanFilters}
+ ${vnfVMS}
+ ${vnfVMSPositions}
+ ${vmNetworks}
+ ${vmNetworksPositions}
+ ${vmNetworksPositionsV6}
+ ${interfaceRoutePrefixes}
+ ${vnfParams}
+ ${sdncResponseParams}"""
+
+ return vfModuleParams
+
+ }
+
+
+ /*
+ * VBNG specific method that parses VNF parameters passed in on the
+ * incoming requests and SDNC parameters returned from SDNC get response
+ * and puts them into the format expected by VNF adapter.
+ * @param vnfParamsMap - map of VNF parameters passed in the request body
+ * @param sdncGetResponse - response string from SDNC GET topology request
+ * @param vnfId
+ * @param vnfName
+ * @param vfModuleId
+ * @param vfModuleName
+ * @return a String of key/value entries for vfModuleParams
+ */
+
+ protected String buildVfModuleParamsVbng(String vnfParams, String sdncGetResponse, String vnfId, String vnfName,
+ String vfModuleId, String vfModuleName) {
+
+ //Get SDNC Response Data
+
+ String data = utils.getNodeXml(sdncGetResponse, "response-data")
+ data = data.replaceAll("&lt;", "<")
+ data = data.replaceAll("&gt;", ">")
+
+
+
+ // Add-on data
+ String vnfInfo =
+ """<entry>
+ <key>vnf_id</key>
+ <value>${vnfId}</value>
+ </entry>
+ <entry>
+ <key>vnf_name</key>
+ <value>${vnfName}</value>
+ </entry>
+ <entry>
+ <key>vf_module_id</key>
+ <value>${vfModuleId}</value>
+ </entry>
+ <entry>
+ <key>vf_module_name</key>
+ <value>${vfModuleName}</value>
+ </entry>"""
+
+ utils.logAudit("vnfInfo: " + vnfInfo)
+ InputSource source = new InputSource(new StringReader(data));
+ DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
+ docFactory.setNamespaceAware(true)
+ DocumentBuilder docBuilder = docFactory.newDocumentBuilder()
+ Document responseXml = docBuilder.parse(source)
+
+
+ // Availability Zones Data
+ String aZones = ""
+ StringBuilder sbAZone = new StringBuilder()
+ NodeList aZonesList = responseXml.getElementsByTagNameNS("*", "availability-zones")
+ String aZonePosition = "0"
+ for (int z = 0; z < aZonesList.getLength(); z++) {
+ Node node = aZonesList.item(z)
+ if (node.getNodeType() == Node.ELEMENT_NODE) {
+ Element eElement = (Element) node
+ String aZoneValue = utils.getElementText(eElement, "availability-zone")
+ aZonePosition = z.toString()
+ String aZoneXml =
+ """<entry>
+ <key>availability_zone_${aZonePosition}</key>
+ <value>${aZoneValue}</value>
+ </entry>"""
+ aZones = sbAZone.append(aZoneXml)
+ }
+ }
+
+ // VNF Networks Data
+ String vnfNetworkNetId = ""
+ String vnfNetworkNetName = ""
+ String vnfNetworkSubNetId = ""
+ String vnfNetworkV6SubNetId = ""
+ String vnfNetworkNetFqdn = ""
+ String vnfNetworksSriovVlanFilters = ""
+ StringBuilder sbNet = new StringBuilder()
+ StringBuilder sbNet2 = new StringBuilder()
+ StringBuilder sbNet3 = new StringBuilder()
+ StringBuilder sbNet4 = new StringBuilder()
+ StringBuilder sbNet5 = new StringBuilder()
+ StringBuilder sbNet6 = new StringBuilder()
+ NodeList vnfNetworkList = responseXml.getElementsByTagNameNS("*", "vnf-networks")
+ for (int x = 0; x < vnfNetworkList.getLength(); x++) {
+ Node node = vnfNetworkList.item(x)
+ if (node.getNodeType() == Node.ELEMENT_NODE) {
+ Element eElement = (Element) node
+ String vnfNetworkKey = utils.getElementText(eElement, "network-role")
+ String vnfNetworkNeutronIdValue = utils.getElementText(eElement, "neutron-id")
+ String vnfNetworkNetNameValue = utils.getElementText(eElement, "network-name")
+ String vnfNetworkSubNetIdValue = utils.getElementText(eElement, "subnet-id")
+ String vnfNetworkV6SubNetIdValue = utils.getElementText(eElement, "ipv6-subnet-id")
+ String vnfNetworkNetFqdnValue = utils.getElementText(eElement, "contrail-network-fqdn")
+ String vnfNetworkNetIdXml =
+ """<entry>
+ <key>${vnfNetworkKey}_net_id</key>
+ <value>${vnfNetworkNeutronIdValue}</value>
+ </entry>"""
+ vnfNetworkNetId = sbNet.append(vnfNetworkNetIdXml)
+ String vnfNetworkNetNameXml =
+ """<entry>
+ <key>${vnfNetworkKey}_net_name</key>
+ <value>${vnfNetworkNetNameValue}</value>
+ </entry>"""
+ vnfNetworkNetName = sbNet2.append(vnfNetworkNetNameXml)
+ String vnfNetworkSubNetIdXml =
+ """<entry>
+ <key>${vnfNetworkKey}_subnet_id</key>
+ <value>${vnfNetworkSubNetIdValue}</value>
+ </entry>"""
+ vnfNetworkSubNetId = sbNet3.append(vnfNetworkSubNetIdXml)
+ String vnfNetworkV6SubNetIdXml =
+ """<entry>
+ <key>${vnfNetworkKey}_v6_subnet_id</key>
+ <value>${vnfNetworkV6SubNetIdValue}</value>
+ </entry>"""
+ vnfNetworkV6SubNetId = sbNet5.append(vnfNetworkV6SubNetIdXml)
+ String vnfNetworkNetFqdnXml =
+ """<entry>
+ <key>${vnfNetworkKey}_net_fqdn</key>
+ <value>${vnfNetworkNetFqdnValue}</value>
+ </entry>"""
+ vnfNetworkNetFqdn = sbNet4.append(vnfNetworkNetFqdnXml)
+
+ NodeList sriovVlanFilterList = eElement.getElementsByTagNameNS("*","sriov-vlan-filter-list")
+ StringBuffer sriovFilterBuf = new StringBuffer()
+ String values = ""
+ for(int i = 0; i < sriovVlanFilterList.getLength(); i++){
+ Node node1 = sriovVlanFilterList.item(i)
+ if (node1.getNodeType() == Node.ELEMENT_NODE) {
+ Element eElement1 = (Element) node1
+ String value = utils.getElementText(eElement1, "sriov-vlan-filter")
+ if (i != sriovVlanFilterList.getLength() - 1) {
+ values = sriovFilterBuf.append(value + ",")
+ }
+ else {
+ values = sriovFilterBuf.append(value);
+ }
+ }
+ }
+ if (!values.isEmpty()) {
+ String vnfNetworkSriovVlanFilterXml =
+ """<entry>
+ <key>${vnfNetworkKey}_ATT_VF_VLAN_FILTER</key>
+ <value>${values}</value>
+ </entry>"""
+ vnfNetworksSriovVlanFilters = sbNet6.append(vnfNetworkSriovVlanFilterXml)
+ }
+ }
+ }
+
+ // VNF-VMS Data
+ String vnfVMS = ""
+ String vnfVMSPositions = ""
+ String vmNetworks = ""
+ String vmNetworksPositions = ""
+ String vmNetworksPositionsV6 = ""
+ String interfaceRoutePrefixes = ""
+ def key
+ def value
+ def networkKey
+ def networkValue
+ def floatingIPKey
+ def floatingIPKeyValue
+ def floatingIPV6Key
+ def floatingIPV6KeyValue
+ StringBuilder sb = new StringBuilder()
+ StringBuilder sbPositions = new StringBuilder()
+ StringBuilder sbVmNetworks = new StringBuilder()
+ StringBuilder sbNetworksPositions = new StringBuilder()
+ StringBuilder sbInterfaceRoutePrefixes = new StringBuilder()
+ StringBuilder sbNetworksPositionsV6 = new StringBuilder()
+
+ NodeList vmsList = responseXml.getElementsByTagNameNS("*","vnf-vms")
+ for (int x = 0; x < vmsList.getLength(); x++) {
+ Node node = vmsList.item(x)
+ if (node.getNodeType() == Node.ELEMENT_NODE) {
+ Element eElement = (Element) node
+ key = utils.getElementText(eElement, "vm-type")
+ String values
+ String position = "0"
+ StringBuilder sb1 = new StringBuilder()
+ NodeList valueList = eElement.getElementsByTagNameNS("*","vm-names")
+ NodeList vmNetworksList = eElement.getElementsByTagNameNS("*","vm-networks")
+ for(int i = 0; i < valueList.getLength(); i++){
+ Node node1 = valueList.item(i)
+ if (node1.getNodeType() == Node.ELEMENT_NODE) {
+ Element eElement1 = (Element) node1
+ value = utils.getElementText(eElement1, "vm-name")
+ if (i != valueList.getLength() - 1) {
+ values = sb1.append(value + ",")
+ }
+ else {
+ values = sb1.append(value);
+ }
+ position = i.toString()
+ String vnfPositionXml =
+ """<entry>
+ <key>${key}_name_${position}</key>
+ <value>${value}</value>
+ </entry>"""
+ vnfVMSPositions = sbPositions.append(vnfPositionXml)
+ }
+ }
+ for(int n = 0; n < vmNetworksList.getLength(); n++){
+ String floatingIpKeyValueStr = ""
+ String floatingIpV6KeyValueStr = ""
+ Node nodeNetworkKey = vmNetworksList.item(n)
+ if (nodeNetworkKey.getNodeType() == Node.ELEMENT_NODE) {
+ Element eElementNetworkKey = (Element) nodeNetworkKey
+ String ipAddressValues
+ String ipV6AddressValues
+ String networkPosition = "0"
+ StringBuilder sb2 = new StringBuilder()
+ StringBuilder sb3 = new StringBuilder()
+ StringBuilder sb4 = new StringBuilder()
+ networkKey = utils.getElementText(eElementNetworkKey, "network-role")
+ floatingIPKey = key + '_' + networkKey + '_floating_ip'
+ floatingIPKeyValue = utils.getElementText(eElementNetworkKey, "floating-ip")
+ if(!floatingIPKeyValue.isEmpty()){
+ floatingIpKeyValueStr = """<entry>
+ <key>$floatingIPKey</key>
+ <value>$floatingIPKeyValue</value>
+ </entry>"""
+ }
+ floatingIPV6Key = key + '_' + networkKey + '_floating_v6_ip'
+ floatingIPV6KeyValue = utils.getElementText(eElementNetworkKey, "floating-ip-v6")
+ if(!floatingIPV6KeyValue.isEmpty()){
+ floatingIpV6KeyValueStr = """<entry>
+ <key>$floatingIPV6Key</key>
+ <value>$floatingIPV6KeyValue</value>
+ </entry>"""
+ }
+ NodeList networkIpsList = eElementNetworkKey.getElementsByTagNameNS("*","network-ips")
+ for(int a = 0; a < networkIpsList.getLength(); a++){
+ Node ipAddress = networkIpsList.item(a)
+ if (ipAddress.getNodeType() == Node.ELEMENT_NODE) {
+ Element eElementIpAddress = (Element) ipAddress
+ String ipAddressValue = utils.getElementText(eElementIpAddress, "ip-address")
+ if (a != networkIpsList.getLength() - 1) {
+ ipAddressValues = sb2.append(ipAddressValue + ",")
+ }
+ else {
+ ipAddressValues = sb2.append(ipAddressValue);
+ }
+ networkPosition = a.toString()
+ String vmNetworksPositionsXml =
+ """<entry>
+ <key>${key}_${networkKey}_ip_${networkPosition}</key>
+ <value>${ipAddressValue}</value>
+ </entry>"""
+ vmNetworksPositions = sbNetworksPositions.append(vmNetworksPositionsXml)
+ }
+ }
+ vmNetworksPositions = sbNetworksPositions.append(floatingIpKeyValueStr).append(floatingIpV6KeyValueStr)
+
+ String vmNetworksXml =
+ """<entry>
+ <key>${key}_${networkKey}_ips</key>
+ <value>${ipAddressValues}</value>
+ </entry>"""
+ vmNetworks = sbVmNetworks.append(vmNetworksXml)
+
+ NodeList interfaceRoutePrefixesList = eElementNetworkKey.getElementsByTagNameNS("*","interface-route-prefixes")
+ String interfaceRoutePrefixValues = sb3.append("[")
+
+ for(int a = 0; a < interfaceRoutePrefixesList.getLength(); a++){
+ Node interfaceRoutePrefix = interfaceRoutePrefixesList.item(a)
+ if (interfaceRoutePrefix.getNodeType() == Node.ELEMENT_NODE) {
+ Element eElementInterfaceRoutePrefix = (Element) interfaceRoutePrefix
+ String interfaceRoutePrefixValue = utils.getElementText(eElementInterfaceRoutePrefix, "interface-route-prefix-cidr")
+ if (interfaceRoutePrefixValue == null || interfaceRoutePrefixValue.isEmpty()) {
+ interfaceRoutePrefixValue = utils.getElementText(eElementInterfaceRoutePrefix, "interface-route-prefix")
+ }
+ if (a != interfaceRoutePrefixesList.getLength() - 1) {
+ interfaceRoutePrefixValues = sb3.append("{\"interface_route_table_routes_route_prefix\": \"" + interfaceRoutePrefixValue + "\"}" + ",")
+ }
+ else {
+ interfaceRoutePrefixValues = sb3.append("{\"interface_route_table_routes_route_prefix\": \"" + interfaceRoutePrefixValue + "\"}")
+ }
+ }
+ }
+ interfaceRoutePrefixValues = sb3.append("]")
+ if (interfaceRoutePrefixesList.getLength() > 0) {
+ String interfaceRoutePrefixesXml =
+ """<entry>
+ <key>${key}_${networkKey}_route_prefixes</key>
+ <value>${interfaceRoutePrefixValues}</value>
+ </entry>"""
+ interfaceRoutePrefixes = sbInterfaceRoutePrefixes.append(interfaceRoutePrefixesXml)
+ }
+
+ NodeList networkIpsV6List = eElementNetworkKey.getElementsByTagNameNS("*","network-ips-v6")
+ for(int a = 0; a < networkIpsV6List.getLength(); a++){
+ Node ipV6Address = networkIpsV6List.item(a)
+ if (ipV6Address.getNodeType() == Node.ELEMENT_NODE) {
+ Element eElementIpV6Address = (Element) ipV6Address
+ String ipV6AddressValue = utils.getElementText(eElementIpV6Address, "ip-address-ipv6")
+ if (a != networkIpsV6List.getLength() - 1) {
+ ipV6AddressValues = sb4.append(ipV6AddressValue + ",")
+ }
+ else {
+ ipV6AddressValues = sb4.append(ipV6AddressValue);
+ }
+ networkPosition = a.toString()
+ String vmNetworksPositionsV6Xml =
+ """<entry>
+ <key>${key}_${networkKey}_v6_ip_${networkPosition}</key>
+ <value>${ipV6AddressValue}</value>
+ </entry>"""
+ vmNetworksPositionsV6 = sbNetworksPositionsV6.append(vmNetworksPositionsV6Xml)
+ }
+ }
+ String vmNetworksV6Xml =
+ """<entry>
+ <key>${key}_${networkKey}_v6_ips</key>
+ <value>${ipV6AddressValues}</value>
+ </entry>"""
+ vmNetworks = sbVmNetworks.append(vmNetworksV6Xml)
+ }
+ }
+ String vnfXml =
+ """<entry>
+ <key>${key}_names</key>
+ <value>${values}</value>
+ </entry>"""
+ vnfVMS = sb.append(vnfXml)
+ }
+ }
+ //SDNC Response Params
+ String sdncResponseParams = ""
+ List<String> sdncResponseParamsToSkip = ["vnf_id", "vf_module_id", "vnf_name", "vf_module_name"]
+ String vnfParamsChildNodes = utils.getChildNodes(data, "vnf-parameters")
+ if(vnfParamsChildNodes == null || vnfParamsChildNodes.length() < 1){
+ // No SDNC params
+ }else{
+ NodeList paramsList = responseXml.getElementsByTagNameNS("*", "vnf-parameters")
+ for (int z = 0; z < paramsList.getLength(); z++) {
+ Node node = paramsList.item(z)
+ Element eElement = (Element) node
+ String vnfParameterName = utils.getElementText(eElement, "vnf-parameter-name")
+ if (!sdncResponseParamsToSkip.contains(vnfParameterName)) {
+ String vnfParameterValue = utils.getElementText(eElement, "vnf-parameter-value")
+ String paraEntry =
+ """<entry>
+ <key>${vnfParameterName}</key>
+ <value>${vnfParameterValue}</value>
+ </entry>"""
+ sdncResponseParams = sb.append(paraEntry)
+ }
+ }
+ }
+
+
+ def vfModuleParams = """
+ ${vnfInfo}
+ ${aZones}
+ ${vnfNetworkNetId}
+ ${vnfNetworkNetName}
+ ${vnfNetworkSubNetId}
+ ${vnfNetworkV6SubNetId}
+ ${vnfNetworkNetFqdn}
+ ${vnfNetworksSriovVlanFilters}
+ ${vnfVMS}
+ ${vnfVMSPositions}
+ ${vmNetworks}
+ ${vmNetworksPositions}
+ ${vmNetworksPositionsV6}
+ ${interfaceRoutePrefixes}
+ ${vnfParams}
+ ${sdncResponseParams}"""
+
+ return vfModuleParams
+
+ }
+
+} \ No newline at end of file
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VidUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VidUtils.groovy
index de59c68a7d..022a00c192 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VidUtils.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VidUtils.groovy
@@ -1,550 +1,550 @@
-/*-
- * ============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.common.scripts
-
-import groovy.json.JsonBuilder
-import groovy.json.JsonSlurper
-
-import org.json.JSONObject
-import org.json.XML
-import org.openecomp.mso.bpmn.core.xml.XmlTool
-
-class VidUtils {
-
- public MsoUtils utils = new MsoUtils()
- private AbstractServiceTaskProcessor taskProcessor
-
- public VidUtils(AbstractServiceTaskProcessor taskProcessor) {
- this.taskProcessor = taskProcessor
- }
-
- /**
- * Create a volume-request XML using a JSON string
- * @param jsonReq - JSON request from VID
- * @param action
- * @return
- */
- public String createXmlVolumeRequest(String jsonReq, String action, String serviceInstanceId) {
- def jsonSlurper = new JsonSlurper()
- try{
- Map reqMap = jsonSlurper.parseText(jsonReq)
- return createXmlVolumeRequest(reqMap, action, serviceInstanceId)
- }
- catch(Exception e) {
- throw e
- }
- }
-
- /**
- * Create a volume-request XML using a map
- * @param requestMap - map created from VID JSON
- * @param action
- * @param serviceInstanceId
- * @return
- */
- public String createXmlVolumeRequest(Map requestMap, String action, String serviceInstanceId) {
- createXmlVolumeRequest(requestMap, action, serviceInstanceId, '')
- }
-
-
- /**
- * Create a volume-request XML using a map
- * @param requestMap
- * @param action
- * @param serviceInstanceId
- * @param volumeGroupId
- * @return
- */
- public String createXmlVolumeRequest(Map requestMap, String action, String serviceInstanceId, String volumeGroupId) {
- def vnfType = ''
- def serviceName = ''
- def modelCustomizationName = ''
- def asdcServiceModelVersion = ''
-
- def suppressRollback = requestMap.requestDetails.requestInfo.suppressRollback
-
- def backoutOnFailure = ""
- if(suppressRollback != null){
- if ( suppressRollback == true) {
- backoutOnFailure = "false"
- } else if ( suppressRollback == false) {
- backoutOnFailure = "true"
- }
- }
-
- def volGrpName = requestMap.requestDetails.requestInfo?.instanceName ?: ''
- def serviceId = requestMap.requestDetails.requestParameters?.serviceId ?: ''
- def relatedInstanceList = requestMap.requestDetails.relatedInstanceList
- relatedInstanceList.each {
- if (it.relatedInstance.modelInfo?.modelType == 'service') {
- serviceName = it.relatedInstance.modelInfo?.modelName
- asdcServiceModelVersion = it.relatedInstance.modelInfo?.modelVersion
- }
- if (it.relatedInstance.modelInfo?.modelType == 'vnf') {
- modelCustomizationName = it.relatedInstance.modelInfo?.modelCustomizationName
- }
- }
-
- vnfType = serviceName + '/' + modelCustomizationName
-
- def userParams = requestMap.requestDetails?.requestParameters?.userParams
- def userParamsNode = ''
- if(userParams != null) {
- userParamsNode = buildUserParams(userParams)
- }
- def modelCustomizationId = requestMap.requestDetails?.modelInfo?.modelCustomizationId ?: ''
-
- def xmlReq = """
- <volume-request xmlns="http://www.w3.org/2001/XMLSchema">
- <request-info>
- <action>${action}</action>
- <source>${requestMap.requestDetails.requestInfo.source}</source>
- <service-instance-id>${serviceInstanceId}</service-instance-id>
- </request-info>
- <volume-inputs>
- <volume-group-id>${volumeGroupId}</volume-group-id>
- <volume-group-name>${volGrpName}</volume-group-name>
- <vnf-type>${vnfType}</vnf-type>
- <vf-module-model-name>${requestMap.requestDetails.modelInfo.modelName}</vf-module-model-name>
- <asdc-service-model-version>${asdcServiceModelVersion}</asdc-service-model-version>
- <aic-cloud-region>${requestMap.requestDetails.cloudConfiguration.lcpCloudRegionId}</aic-cloud-region>
- <tenant-id>${requestMap.requestDetails.cloudConfiguration.tenantId}</tenant-id>
- <service-id>${serviceId}</service-id>
- <backout-on-failure>${backoutOnFailure}</backout-on-failure>
- <model-customization-id>${modelCustomizationId}</model-customization-id>
- </volume-inputs>
- <volume-params>
- $userParamsNode
- </volume-params>
- </volume-request>
- """
- // return a pretty-print of the volume-request xml without the preamble
- return groovy.xml.XmlUtil.serialize(xmlReq.normalize().replaceAll("\t", "").replaceAll("\n", "")).replaceAll("(<\\?[^<]*\\?>\\s*[\\r\\n]*)?", "")
- }
-
- /**
- * A common method that can be used to build volume-params node from a map.
- * @param Map userParams
- * @return
- */
- public String buildUserParams(userParams) {
- if (userParams == null) return ""
- def xml = ""
- def key = ""
- def value = ""
- userParams.each {it ->
- key = it.name.replaceAll(/\B[A-Z]/) { '_' + it }.toLowerCase()
- value = it.value
- xml += "<param name=\"${key}\">${value}</param>"
- }
-
- return xml
- }
-
- /**
- * A common method that can be used to extract 'requestDetails'
- * @param String json
- * @return String json requestDetails
- */
- @Deprecated
- public getJsonRequestDetails(String jsonInput) {
- String rtn = ""
- if (jsonInput.isEmpty() || jsonInput == null) {
- return rtn
- } else {
- def jsonMapObject = new JsonSlurper().parseText(jsonInput)
- if (jsonMapObject instanceof Map) {
- String jsonString = new JsonBuilder(jsonMapObject.requestDetails)
- rtn = '{'+"requestDetails"+":"+jsonString+'}'
- return rtn
- } else {
- return rtn
- }
- }
- }
-
- /**
- * A common method that can be used to extract 'requestDetails' in Xml
- * @param String json
- * @return String xml requestDetails
- */
- @Deprecated
- public getJsonRequestDetailstoXml(String jsonInput) {
- String rtn = null
- def jsonString = getJsonRequestDetails(jsonInput)
- if (jsonString == null) {
- return rtn
- } else {
- JSONObject jsonObj = new JSONObject(jsonString)
- return XmlTool.normalize(XML.toString(jsonObj))
- }
- }
-
- /**
- * Create a network-request XML using a map
- * @param execution
- * @param xmlRequestDetails - requestDetails in xml
- * @return
- * Note: See latest version: createXmlNetworkRequestInstance()
- */
- public String createXmlNetworkRequestInfra(execution, def networkJsonIncoming) {
-
- def requestId = execution.getVariable("requestId")
- def serviceInstanceId = execution.getVariable("serviceInstanceId")
- def requestAction = execution.getVariable("requestAction")
- def networkId = (execution.getVariable("networkId")) != null ? execution.getVariable("networkId") : ""
-
- def jsonSlurper = new JsonSlurper()
- try {
- Map reqMap = jsonSlurper.parseText(networkJsonIncoming)
- def instanceName = reqMap.requestDetails.requestInfo.instanceName
- def modelName = reqMap.requestDetails.modelInfo.modelName
- def lcpCloudRegionId = reqMap.requestDetails.cloudConfiguration.lcpCloudRegionId
- def tenantId = reqMap.requestDetails.cloudConfiguration.tenantId
- def serviceId = reqMap.requestDetails.requestInfo.productFamilyId
- def suppressRollback = reqMap.requestDetails.requestInfo.suppressRollback.toString()
- def backoutOnFailure = ""
- if(suppressRollback != null){
- if (suppressRollback == true || suppressRollback == "true") {
- backoutOnFailure = "false"
- } else if (suppressRollback == false || suppressRollback == "false") {
- backoutOnFailure = "true"
- }
- }
-
- //def userParams = reqMap.requestDetails.requestParameters.userParams
- //def userParamsNode = buildUserParams(userParams)
- def userParams = reqMap.requestDetails?.requestParameters?.userParams
- def userParamsNode = ''
- if(userParams != null) {
- userParamsNode = buildUserParams(userParams)
- }
-
- //'sdncVersion' = current, '1610' (non-RPC SDNC) or '1702' (RPC SDNC)
- def sdncVersion = execution.getVariable("sdncVersion")
-
- def xmlReq = """
- <network-request xmlns="http://www.w3.org/2001/XMLSchema">
- <request-info>
- <request-id>${requestId}</request-id>
- <action>${requestAction}</action>
- <source>VID</source>
- <service-instance-id>${serviceInstanceId}</service-instance-id>
- </request-info>
- <network-inputs>
- <network-id>${networkId}</network-id>
- <network-name>${instanceName}</network-name>
- <network-type>${modelName}</network-type>
- <aic-cloud-region>${lcpCloudRegionId}</aic-cloud-region>
- <tenant-id>${tenantId}</tenant-id>
- <service-id>${serviceId}</service-id>
- <backout-on-failure>${backoutOnFailure}</backout-on-failure>
- <sdncVersion>${sdncVersion}</sdncVersion>
- </network-inputs>
- <network-params>
- ${userParamsNode}
- </network-params>
- </network-request>
- """
- // return a pretty-print of the volume-request xml without the preamble
- return groovy.xml.XmlUtil.serialize(xmlReq.normalize().replaceAll("\t", "").replaceAll("\n", "")).replaceAll("(<\\?[^<]*\\?>\\s*[\\r\\n]*)?", "")
-
- } catch(Exception e) {
- throw e
- }
- }
-
- /**
- * Create a network-request XML using a map,
- * @param execution
- * @return
- */
- public String createXmlNetworkRequestInstance(execution) {
-
- def networkModelVersionId = ""
- def networkModelName = ""
- def networkModelType = ""
- def networkModelVersion = ""
- def networkModelCustomizationId = ""
- def networkModelInvariantId = ""
-
- // verify the DB Catalog response JSON structure
- def networkModelInfo = execution.getVariable("networkModelInfo")
- def jsonSlurper = new JsonSlurper()
- if (networkModelInfo != null) {
- try {
- Map modelMap = jsonSlurper.parseText(networkModelInfo)
- if (modelMap != null) {
- if (networkModelInfo.contains("modelVersionId")) {
- networkModelVersionId = modelMap.modelVersionId !=null ? modelMap.modelVersionId : ""
- }
- if (networkModelInfo.contains("modelName")) {
- networkModelName = modelMap.modelName !=null ? modelMap.modelName : ""
- }
- if (networkModelInfo.contains("modelType")) {
- networkModelType = modelMap.modelType !=null ? modelMap.modelType : ""
- }
- if (networkModelInfo.contains("modelVersion")) {
- networkModelVersion = modelMap.modelVersion !=null ? modelMap.modelVersion : ""
- }
- if (networkModelInfo.contains("modelCustomizationId")) {
- networkModelCustomizationId = modelMap.modelCustomizationId !=null ? modelMap.modelCustomizationId : ""
- }
- if (networkModelInfo.contains("modelInvariantId")) {
- networkModelInvariantId = modelMap.modelInvariantId !=null ? modelMap.modelInvariantId : ""
- }
- }
- } catch (Exception ex) {
- throw ex
- }
- }
-
- def serviceModelVersionId = ""
- def serviceModelName = ""
- def serviceModelType = ""
- def serviceModelVersion = ""
- def serviceModelCustomizationId = ""
- def serviceModelInvariantId = ""
-
- // verify the DB Catalog response JSON structure
- def serviceModelInfo = execution.getVariable("serviceModelInfo")
- def jsonServiceSlurper = new JsonSlurper()
- if (serviceModelInfo != null) {
- try {
- Map modelMap = jsonServiceSlurper.parseText(serviceModelInfo)
- if (modelMap != null) {
- if (serviceModelInfo.contains("modelVersionId")) {
- serviceModelVersionId = modelMap.modelVersionId !=null ? modelMap.modelVersionId : ""
- }
- if (serviceModelInfo.contains("modelName")) {
- serviceModelName = modelMap.modelName !=null ? modelMap.modelName : ""
- }
- if (serviceModelInfo.contains("modelType")) {
- serviceModelType = modelMap.modelType !=null ? modelMap.modelType : ""
- }
- if (serviceModelInfo.contains("modelVersion")) {
- serviceModelVersion = modelMap.modelVersion !=null ? modelMap.modelVersion : ""
- }
- if (serviceModelInfo.contains("modelCustomizationId")) {
- serviceModelCustomizationId = modelMap.modelCustomizationId !=null ? modelMap.modelCustomizationId : ""
- }
- if (serviceModelInfo.contains("modelInvariantId")) {
- serviceModelInvariantId = modelMap.modelInvariantId !=null ? modelMap.modelInvariantId : ""
- }
- }
- } catch (Exception ex) {
- throw ex
- }
- }
-
-
- def subscriptionServiceType = execution.getVariable("subscriptionServiceType") != null ? execution.getVariable("subscriptionServiceType") : ""
- def globalSubscriberId = execution.getVariable("globalSubscriberId") != null ? execution.getVariable("globalSubscriberId") : ""
- def requestId = execution.getVariable("msoRequestId")
- def serviceInstanceId = execution.getVariable("serviceInstanceId") != null ? execution.getVariable("serviceInstanceId") : ""
- def networkId = (execution.getVariable("networkId")) != null ? execution.getVariable("networkId") : "" // optional
- def networkName = execution.getVariable("networkName") != null ? execution.getVariable("networkName") : "" // optional
- def aicCloudReqion = execution.getVariable("lcpCloudRegionId") != null ? execution.getVariable("lcpCloudRegionId") : ""
- def tenantId = execution.getVariable("tenantId") != null ? execution.getVariable("tenantId") : ""
- def serviceId = execution.getVariable("productFamilyId") != null ? execution.getVariable("productFamilyId") : ""
- def failIfExist = execution.getVariable("failIfExists") != null ? execution.getVariable("failIfExists") : ""
- def suppressRollback = execution.getVariable("disableRollback")
- def backoutOnFailure = ""
- if(suppressRollback != null){
- if (suppressRollback == true || suppressRollback == "true") {
- backoutOnFailure = "false"
- } else if (suppressRollback == false || suppressRollback == "'false") {
- backoutOnFailure = "true"
- }
- }
-
- //'sdncVersion' = current, '1610' (non-RPC SDNC) or '1702' (RPC SDNC)
- def sdncVersion = execution.getVariable("sdncVersion")
-
- def source = "VID"
- def action = execution.getVariable("action")
-
- def userParamsNode = ""
- def userParams = execution.getVariable("networkInputParams")
- if(userParams != null) {
- userParamsNode = buildUserParams(userParams)
- }
-
- def xmlReq = """
- <network-request xmlns="http://www.w3.org/2001/XMLSchema">
- <request-info>
- <request-id>${requestId}</request-id>
- <action>${action}</action>
- <source>${source}</source>
- <service-instance-id>${serviceInstanceId}</service-instance-id>
- </request-info>
- <network-inputs>
- <network-id>${networkId}</network-id>
- <network-name>${networkName}</network-name>
- <network-type>${networkModelType}</network-type>
- <subscription-service-type>${subscriptionServiceType}</subscription-service-type>
- <global-customer-id>${globalSubscriberId}</global-customer-id>
- <aic-cloud-region>${aicCloudReqion}</aic-cloud-region>
- <tenant-id>${tenantId}</tenant-id>
- <service-id>${serviceId}</service-id>
- <backout-on-failure>${backoutOnFailure}</backout-on-failure>
- <failIfExist>${failIfExist}</failIfExist>
- <networkModelInfo>
- <modelName>${networkModelName}</modelName>
- <modelUuid>${networkModelVersionId}</modelUuid>
- <modelInvariantUuid>${networkModelInvariantId}</modelInvariantUuid>
- <modelVersion>${networkModelVersion}</modelVersion>
- <modelCustomizationUuid>${networkModelCustomizationId}</modelCustomizationUuid>
- <modelType>${networkModelType}</modelType>
- </networkModelInfo>
- <serviceModelInfo>
- <modelName>${serviceModelName}</modelName>
- <modelUuid>${serviceModelVersionId}</modelUuid>
- <modelInvariantUuid>${serviceModelInvariantId}</modelInvariantUuid>
- <modelVersion>${serviceModelVersion}</modelVersion>
- <modelCustomizationUuid>${serviceModelCustomizationId}</modelCustomizationUuid>
- <modelType>${serviceModelType}</modelType>
- </serviceModelInfo>
- <sdncVersion>${sdncVersion}</sdncVersion>
- </network-inputs>
- <network-params>
- ${userParamsNode}
- </network-params>
- </network-request>
- """
- // return a pretty-print of the volume-request xml without the preamble
- return groovy.xml.XmlUtil.serialize(xmlReq.normalize().replaceAll("\t", "").replaceAll("\n", "")).replaceAll("(<\\?[^<]*\\?>\\s*[\\r\\n]*)?", "")
-
- }
-
- /**
- * Create a vnf-request XML using a map
- * @param requestMap - map created from VID JSON
- * @param action
- * @return
- */
- public String createXmlVfModuleRequest(execution, Map requestMap, String action, String serviceInstanceId) {
-
- //def relatedInstanceList = requestMap.requestDetails.relatedInstanceList
-
- //relatedInstanceList.each {
- // if (it.relatedInstance.modelInfo.modelType == 'vnf') {
- // vnfType = it.relatedInstance.modelInfo.modelName
- // vnfId = it.relatedInstance.modelInfo.modelInvariantId
- // }
- //}
-
- def vnfName = ''
- def asdcServiceModelInfo = ''
-
- def relatedInstanceList = requestMap.requestDetails?.relatedInstanceList
-
-
- if (relatedInstanceList != null) {
- relatedInstanceList.each {
- if (it.relatedInstance.modelInfo?.modelType == 'service') {
- asdcServiceModelInfo = it.relatedInstance.modelInfo?.modelVersion
- }
- if (it.relatedInstance.modelInfo.modelType == 'vnf') {
- vnfName = it.relatedInstance.instanceName ?: ''
- }
- }
- }
-
- def vnfType = execution.getVariable('vnfType')
- def vnfId = execution.getVariable('vnfId')
-
- def vfModuleId = execution.getVariable('vfModuleId')
- def volumeGroupId = execution.getVariable('volumeGroupId')
- def userParams = requestMap.requestDetails?.requestParameters?.userParams
-
-
- def userParamsNode = ''
- if(userParams != null) {
- userParamsNode = buildUserParams(userParams)
- }
-
- def isBaseVfModule = "false"
- if (execution.getVariable('isBaseVfModule') == true) {
- isBaseVfModule = "true"
- }
-
- def requestId = execution.getVariable("mso-request-id")
- def vfModuleName = requestMap.requestDetails?.requestInfo?.instanceName ?: ''
- def vfModuleModelName = requestMap.requestDetails?.modelInfo?.modelName ?: ''
- def suppressRollback = requestMap.requestDetails?.requestInfo?.suppressRollback
-
- def backoutOnFailure = ""
- if(suppressRollback != null){
- if ( suppressRollback == true) {
- backoutOnFailure = "false"
- } else if ( suppressRollback == false) {
- backoutOnFailure = "true"
- }
- }
-
- def serviceId = requestMap.requestDetails?.requestParameters?.serviceId ?: ''
- def aicCloudRegion = requestMap.requestDetails?.cloudConfiguration?.lcpCloudRegionId ?: ''
- def tenantId = requestMap.requestDetails?.cloudConfiguration?.tenantId ?: ''
- def personaModelId = requestMap.requestDetails?.modelInfo?.modelInvariantId ?: ''
- def personaModelVersion = requestMap.requestDetails?.modelInfo?.modelVersion ?: ''
- def modelCustomizationId = requestMap.requestDetails?.modelInfo?.modelCustomizationId ?: ''
-
- def xmlReq = """
- <vnf-request>
- <request-info>
- <request-id>${requestId}</request-id>
- <action>${action}</action>
- <source>VID</source>
- <!-- new 1610 field -->
- <service-instance-id>${serviceInstanceId}</service-instance-id>
- </request-info>
- <vnf-inputs>
- <!-- not in use in 1610 -->
- <vnf-name>${vnfName}</vnf-name>
- <vnf-type>${vnfType}</vnf-type>
- <vnf-id>${vnfId}</vnf-id>
- <volume-group-id>${volumeGroupId}</volume-group-id>
- <vf-module-id>${vfModuleId}</vf-module-id>
- <vf-module-name>${vfModuleName}</vf-module-name>
- <vf-module-model-name>${vfModuleModelName}</vf-module-model-name>
- <model-customization-id>${modelCustomizationId}</model-customization-id>
- <is-base-vf-module>${isBaseVfModule}</is-base-vf-module>
- <asdc-service-model-version>${asdcServiceModelInfo}</asdc-service-model-version>
- <aic-cloud-region>${aicCloudRegion}</aic-cloud-region>
- <tenant-id>${tenantId}</tenant-id>
- <service-id>${serviceId}</service-id>
- <backout-on-failure>${backoutOnFailure}</backout-on-failure>
- <persona-model-id>${personaModelId}</persona-model-id>
- <persona-model-version>${personaModelVersion}</persona-model-version>
- </vnf-inputs>
- <vnf-params>
- $userParamsNode
- </vnf-params>
- </vnf-request>
- """
-
- // return a pretty-print of the volume-request xml without the preamble
- return groovy.xml.XmlUtil.serialize(xmlReq.normalize().replaceAll("\t", "").replaceAll("\n", "")).replaceAll("(<\\?[^<]*\\?>\\s*[\\r\\n]*)?", "")
- }
-
-
-}
+/*-
+ * ============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.common.scripts
+
+import groovy.json.JsonBuilder
+import groovy.json.JsonSlurper
+
+import org.json.JSONObject
+import org.json.XML
+import org.openecomp.mso.bpmn.core.xml.XmlTool
+
+class VidUtils {
+
+ public MsoUtils utils = new MsoUtils()
+ private AbstractServiceTaskProcessor taskProcessor
+
+ public VidUtils(AbstractServiceTaskProcessor taskProcessor) {
+ this.taskProcessor = taskProcessor
+ }
+
+ /**
+ * Create a volume-request XML using a JSON string
+ * @param jsonReq - JSON request from VID
+ * @param action
+ * @return
+ */
+ public String createXmlVolumeRequest(String jsonReq, String action, String serviceInstanceId) {
+ def jsonSlurper = new JsonSlurper()
+ try{
+ Map reqMap = jsonSlurper.parseText(jsonReq)
+ return createXmlVolumeRequest(reqMap, action, serviceInstanceId)
+ }
+ catch(Exception e) {
+ throw e
+ }
+ }
+
+ /**
+ * Create a volume-request XML using a map
+ * @param requestMap - map created from VID JSON
+ * @param action
+ * @param serviceInstanceId
+ * @return
+ */
+ public String createXmlVolumeRequest(Map requestMap, String action, String serviceInstanceId) {
+ createXmlVolumeRequest(requestMap, action, serviceInstanceId, '')
+ }
+
+
+ /**
+ * Create a volume-request XML using a map
+ * @param requestMap
+ * @param action
+ * @param serviceInstanceId
+ * @param volumeGroupId
+ * @return
+ */
+ public String createXmlVolumeRequest(Map requestMap, String action, String serviceInstanceId, String volumeGroupId) {
+ def vnfType = ''
+ def serviceName = ''
+ def modelCustomizationName = ''
+ def asdcServiceModelVersion = ''
+
+ def suppressRollback = requestMap.requestDetails.requestInfo.suppressRollback
+
+ def backoutOnFailure = ""
+ if(suppressRollback != null){
+ if ( suppressRollback == true) {
+ backoutOnFailure = "false"
+ } else if ( suppressRollback == false) {
+ backoutOnFailure = "true"
+ }
+ }
+
+ def volGrpName = requestMap.requestDetails.requestInfo?.instanceName ?: ''
+ def serviceId = requestMap.requestDetails.requestParameters?.serviceId ?: ''
+ def relatedInstanceList = requestMap.requestDetails.relatedInstanceList
+ relatedInstanceList.each {
+ if (it.relatedInstance.modelInfo?.modelType == 'service') {
+ serviceName = it.relatedInstance.modelInfo?.modelName
+ asdcServiceModelVersion = it.relatedInstance.modelInfo?.modelVersion
+ }
+ if (it.relatedInstance.modelInfo?.modelType == 'vnf') {
+ modelCustomizationName = it.relatedInstance.modelInfo?.modelCustomizationName
+ }
+ }
+
+ vnfType = serviceName + '/' + modelCustomizationName
+
+ def userParams = requestMap.requestDetails?.requestParameters?.userParams
+ def userParamsNode = ''
+ if(userParams != null) {
+ userParamsNode = buildUserParams(userParams)
+ }
+ def modelCustomizationId = requestMap.requestDetails?.modelInfo?.modelCustomizationId ?: ''
+
+ def xmlReq = """
+ <volume-request xmlns="http://www.w3.org/2001/XMLSchema">
+ <request-info>
+ <action>${action}</action>
+ <source>${requestMap.requestDetails.requestInfo.source}</source>
+ <service-instance-id>${serviceInstanceId}</service-instance-id>
+ </request-info>
+ <volume-inputs>
+ <volume-group-id>${volumeGroupId}</volume-group-id>
+ <volume-group-name>${volGrpName}</volume-group-name>
+ <vnf-type>${vnfType}</vnf-type>
+ <vf-module-model-name>${requestMap.requestDetails.modelInfo.modelName}</vf-module-model-name>
+ <asdc-service-model-version>${asdcServiceModelVersion}</asdc-service-model-version>
+ <aic-cloud-region>${requestMap.requestDetails.cloudConfiguration.lcpCloudRegionId}</aic-cloud-region>
+ <tenant-id>${requestMap.requestDetails.cloudConfiguration.tenantId}</tenant-id>
+ <service-id>${serviceId}</service-id>
+ <backout-on-failure>${backoutOnFailure}</backout-on-failure>
+ <model-customization-id>${modelCustomizationId}</model-customization-id>
+ </volume-inputs>
+ <volume-params>
+ $userParamsNode
+ </volume-params>
+ </volume-request>
+ """
+ // return a pretty-print of the volume-request xml without the preamble
+ return groovy.xml.XmlUtil.serialize(xmlReq.normalize().replaceAll("\t", "").replaceAll("\n", "")).replaceAll("(<\\?[^<]*\\?>\\s*[\\r\\n]*)?", "")
+ }
+
+ /**
+ * A common method that can be used to build volume-params node from a map.
+ * @param Map userParams
+ * @return
+ */
+ public String buildUserParams(userParams) {
+ if (userParams == null) return ""
+ def xml = ""
+ def key = ""
+ def value = ""
+ userParams.each {it ->
+ key = it.name.replaceAll(/\B[A-Z]/) { '_' + it }.toLowerCase()
+ value = it.value
+ xml += "<param name=\"${key}\">${value}</param>"
+ }
+
+ return xml
+ }
+
+ /**
+ * A common method that can be used to extract 'requestDetails'
+ * @param String json
+ * @return String json requestDetails
+ */
+ @Deprecated
+ public getJsonRequestDetails(String jsonInput) {
+ String rtn = ""
+ if (jsonInput.isEmpty() || jsonInput == null) {
+ return rtn
+ } else {
+ def jsonMapObject = new JsonSlurper().parseText(jsonInput)
+ if (jsonMapObject instanceof Map) {
+ String jsonString = new JsonBuilder(jsonMapObject.requestDetails)
+ rtn = '{'+"requestDetails"+":"+jsonString+'}'
+ return rtn
+ } else {
+ return rtn
+ }
+ }
+ }
+
+ /**
+ * A common method that can be used to extract 'requestDetails' in Xml
+ * @param String json
+ * @return String xml requestDetails
+ */
+ @Deprecated
+ public getJsonRequestDetailstoXml(String jsonInput) {
+ String rtn = null
+ def jsonString = getJsonRequestDetails(jsonInput)
+ if (jsonString == null) {
+ return rtn
+ } else {
+ JSONObject jsonObj = new JSONObject(jsonString)
+ return XmlTool.normalize(XML.toString(jsonObj))
+ }
+ }
+
+ /**
+ * Create a network-request XML using a map
+ * @param execution
+ * @param xmlRequestDetails - requestDetails in xml
+ * @return
+ * Note: See latest version: createXmlNetworkRequestInstance()
+ */
+ public String createXmlNetworkRequestInfra(execution, def networkJsonIncoming) {
+
+ def requestId = execution.getVariable("requestId")
+ def serviceInstanceId = execution.getVariable("serviceInstanceId")
+ def requestAction = execution.getVariable("requestAction")
+ def networkId = (execution.getVariable("networkId")) != null ? execution.getVariable("networkId") : ""
+
+ def jsonSlurper = new JsonSlurper()
+ try {
+ Map reqMap = jsonSlurper.parseText(networkJsonIncoming)
+ def instanceName = reqMap.requestDetails.requestInfo.instanceName
+ def modelName = reqMap.requestDetails.modelInfo.modelName
+ def lcpCloudRegionId = reqMap.requestDetails.cloudConfiguration.lcpCloudRegionId
+ def tenantId = reqMap.requestDetails.cloudConfiguration.tenantId
+ def serviceId = reqMap.requestDetails.requestInfo.productFamilyId
+ def suppressRollback = reqMap.requestDetails.requestInfo.suppressRollback.toString()
+ def backoutOnFailure = "true"
+ if(suppressRollback != null){
+ if (suppressRollback == true || suppressRollback == "true") {
+ backoutOnFailure = "false"
+ } else if (suppressRollback == false || suppressRollback == "false") {
+ backoutOnFailure = "true"
+ }
+ }
+
+ //def userParams = reqMap.requestDetails.requestParameters.userParams
+ //def userParamsNode = buildUserParams(userParams)
+ def userParams = reqMap.requestDetails?.requestParameters?.userParams
+ def userParamsNode = ''
+ if(userParams != null) {
+ userParamsNode = buildUserParams(userParams)
+ }
+
+ //'sdncVersion' = current, '1610' (non-RPC SDNC) or '1702' (RPC SDNC)
+ def sdncVersion = execution.getVariable("sdncVersion")
+
+ def xmlReq = """
+ <network-request xmlns="http://www.w3.org/2001/XMLSchema">
+ <request-info>
+ <request-id>${requestId}</request-id>
+ <action>${requestAction}</action>
+ <source>VID</source>
+ <service-instance-id>${serviceInstanceId}</service-instance-id>
+ </request-info>
+ <network-inputs>
+ <network-id>${networkId}</network-id>
+ <network-name>${instanceName}</network-name>
+ <network-type>${modelName}</network-type>
+ <aic-cloud-region>${lcpCloudRegionId}</aic-cloud-region>
+ <tenant-id>${tenantId}</tenant-id>
+ <service-id>${serviceId}</service-id>
+ <backout-on-failure>${backoutOnFailure}</backout-on-failure>
+ <sdncVersion>${sdncVersion}</sdncVersion>
+ </network-inputs>
+ <network-params>
+ ${userParamsNode}
+ </network-params>
+ </network-request>
+ """
+ // return a pretty-print of the volume-request xml without the preamble
+ return groovy.xml.XmlUtil.serialize(xmlReq.normalize().replaceAll("\t", "").replaceAll("\n", "")).replaceAll("(<\\?[^<]*\\?>\\s*[\\r\\n]*)?", "")
+
+ } catch(Exception e) {
+ throw e
+ }
+ }
+
+ /**
+ * Create a network-request XML using a map,
+ * @param execution
+ * @return
+ */
+ public String createXmlNetworkRequestInstance(execution) {
+
+ def networkModelVersionId = ""
+ def networkModelName = ""
+ def networkModelType = ""
+ def networkModelVersion = ""
+ def networkModelCustomizationId = ""
+ def networkModelInvariantId = ""
+
+ // verify the DB Catalog response JSON structure
+ def networkModelInfo = execution.getVariable("networkModelInfo")
+ def jsonSlurper = new JsonSlurper()
+ if (networkModelInfo != null) {
+ try {
+ Map modelMap = jsonSlurper.parseText(networkModelInfo)
+ if (modelMap != null) {
+ if (networkModelInfo.contains("modelVersionId")) {
+ networkModelVersionId = modelMap.modelVersionId !=null ? modelMap.modelVersionId : ""
+ }
+ if (networkModelInfo.contains("modelName")) {
+ networkModelName = modelMap.modelName !=null ? modelMap.modelName : ""
+ }
+ if (networkModelInfo.contains("modelType")) {
+ networkModelType = modelMap.modelType !=null ? modelMap.modelType : ""
+ }
+ if (networkModelInfo.contains("modelVersion")) {
+ networkModelVersion = modelMap.modelVersion !=null ? modelMap.modelVersion : ""
+ }
+ if (networkModelInfo.contains("modelCustomizationId")) {
+ networkModelCustomizationId = modelMap.modelCustomizationId !=null ? modelMap.modelCustomizationId : ""
+ }
+ if (networkModelInfo.contains("modelInvariantId")) {
+ networkModelInvariantId = modelMap.modelInvariantId !=null ? modelMap.modelInvariantId : ""
+ }
+ }
+ } catch (Exception ex) {
+ throw ex
+ }
+ }
+
+ def serviceModelVersionId = ""
+ def serviceModelName = ""
+ def serviceModelType = ""
+ def serviceModelVersion = ""
+ def serviceModelCustomizationId = ""
+ def serviceModelInvariantId = ""
+
+ // verify the DB Catalog response JSON structure
+ def serviceModelInfo = execution.getVariable("serviceModelInfo")
+ def jsonServiceSlurper = new JsonSlurper()
+ if (serviceModelInfo != null) {
+ try {
+ Map modelMap = jsonServiceSlurper.parseText(serviceModelInfo)
+ if (modelMap != null) {
+ if (serviceModelInfo.contains("modelVersionId")) {
+ serviceModelVersionId = modelMap.modelVersionId !=null ? modelMap.modelVersionId : ""
+ }
+ if (serviceModelInfo.contains("modelName")) {
+ serviceModelName = modelMap.modelName !=null ? modelMap.modelName : ""
+ }
+ if (serviceModelInfo.contains("modelType")) {
+ serviceModelType = modelMap.modelType !=null ? modelMap.modelType : ""
+ }
+ if (serviceModelInfo.contains("modelVersion")) {
+ serviceModelVersion = modelMap.modelVersion !=null ? modelMap.modelVersion : ""
+ }
+ if (serviceModelInfo.contains("modelCustomizationId")) {
+ serviceModelCustomizationId = modelMap.modelCustomizationId !=null ? modelMap.modelCustomizationId : ""
+ }
+ if (serviceModelInfo.contains("modelInvariantId")) {
+ serviceModelInvariantId = modelMap.modelInvariantId !=null ? modelMap.modelInvariantId : ""
+ }
+ }
+ } catch (Exception ex) {
+ throw ex
+ }
+ }
+
+
+ def subscriptionServiceType = execution.getVariable("subscriptionServiceType") != null ? execution.getVariable("subscriptionServiceType") : ""
+ def globalSubscriberId = execution.getVariable("globalSubscriberId") != null ? execution.getVariable("globalSubscriberId") : ""
+ def requestId = execution.getVariable("msoRequestId")
+ def serviceInstanceId = execution.getVariable("serviceInstanceId") != null ? execution.getVariable("serviceInstanceId") : ""
+ def networkId = (execution.getVariable("networkId")) != null ? execution.getVariable("networkId") : "" // optional
+ def networkName = execution.getVariable("networkName") != null ? execution.getVariable("networkName") : "" // optional
+ def aicCloudReqion = execution.getVariable("lcpCloudRegionId") != null ? execution.getVariable("lcpCloudRegionId") : ""
+ def tenantId = execution.getVariable("tenantId") != null ? execution.getVariable("tenantId") : ""
+ def serviceId = execution.getVariable("productFamilyId") != null ? execution.getVariable("productFamilyId") : ""
+ def failIfExist = execution.getVariable("failIfExists") != null ? execution.getVariable("failIfExists") : ""
+ def suppressRollback = execution.getVariable("disableRollback")
+ def backoutOnFailure = "true"
+ if(suppressRollback != null){
+ if (suppressRollback == true || suppressRollback == "true") {
+ backoutOnFailure = "false"
+ } else if (suppressRollback == false || suppressRollback == "false") {
+ backoutOnFailure = "true"
+ }
+ }
+
+ //'sdncVersion' = current, '1610' (non-RPC SDNC) or '1702' (RPC SDNC)
+ def sdncVersion = execution.getVariable("sdncVersion")
+
+ def source = "VID"
+ def action = execution.getVariable("action")
+
+ def userParamsNode = ""
+ def userParams = execution.getVariable("networkInputParams")
+ if(userParams != null) {
+ userParamsNode = buildUserParams(userParams)
+ }
+
+ def xmlReq = """
+ <network-request xmlns="http://www.w3.org/2001/XMLSchema">
+ <request-info>
+ <request-id>${requestId}</request-id>
+ <action>${action}</action>
+ <source>${source}</source>
+ <service-instance-id>${serviceInstanceId}</service-instance-id>
+ </request-info>
+ <network-inputs>
+ <network-id>${networkId}</network-id>
+ <network-name>${networkName}</network-name>
+ <network-type>${networkModelType}</network-type>
+ <subscription-service-type>${subscriptionServiceType}</subscription-service-type>
+ <global-customer-id>${globalSubscriberId}</global-customer-id>
+ <aic-cloud-region>${aicCloudReqion}</aic-cloud-region>
+ <tenant-id>${tenantId}</tenant-id>
+ <service-id>${serviceId}</service-id>
+ <backout-on-failure>${backoutOnFailure}</backout-on-failure>
+ <failIfExist>${failIfExist}</failIfExist>
+ <networkModelInfo>
+ <modelName>${networkModelName}</modelName>
+ <modelUuid>${networkModelVersionId}</modelUuid>
+ <modelInvariantUuid>${networkModelInvariantId}</modelInvariantUuid>
+ <modelVersion>${networkModelVersion}</modelVersion>
+ <modelCustomizationUuid>${networkModelCustomizationId}</modelCustomizationUuid>
+ <modelType>${networkModelType}</modelType>
+ </networkModelInfo>
+ <serviceModelInfo>
+ <modelName>${serviceModelName}</modelName>
+ <modelUuid>${serviceModelVersionId}</modelUuid>
+ <modelInvariantUuid>${serviceModelInvariantId}</modelInvariantUuid>
+ <modelVersion>${serviceModelVersion}</modelVersion>
+ <modelCustomizationUuid>${serviceModelCustomizationId}</modelCustomizationUuid>
+ <modelType>${serviceModelType}</modelType>
+ </serviceModelInfo>
+ <sdncVersion>${sdncVersion}</sdncVersion>
+ </network-inputs>
+ <network-params>
+ ${userParamsNode}
+ </network-params>
+ </network-request>
+ """
+ // return a pretty-print of the volume-request xml without the preamble
+ return groovy.xml.XmlUtil.serialize(xmlReq.normalize().replaceAll("\t", "").replaceAll("\n", "")).replaceAll("(<\\?[^<]*\\?>\\s*[\\r\\n]*)?", "")
+
+ }
+
+ /**
+ * Create a vnf-request XML using a map
+ * @param requestMap - map created from VID JSON
+ * @param action
+ * @return
+ */
+ public String createXmlVfModuleRequest(execution, Map requestMap, String action, String serviceInstanceId) {
+
+ //def relatedInstanceList = requestMap.requestDetails.relatedInstanceList
+
+ //relatedInstanceList.each {
+ // if (it.relatedInstance.modelInfo.modelType == 'vnf') {
+ // vnfType = it.relatedInstance.modelInfo.modelName
+ // vnfId = it.relatedInstance.modelInfo.modelInvariantId
+ // }
+ //}
+
+ def vnfName = ''
+ def asdcServiceModelInfo = ''
+
+ def relatedInstanceList = requestMap.requestDetails?.relatedInstanceList
+
+
+ if (relatedInstanceList != null) {
+ relatedInstanceList.each {
+ if (it.relatedInstance.modelInfo?.modelType == 'service') {
+ asdcServiceModelInfo = it.relatedInstance.modelInfo?.modelVersion
+ }
+ if (it.relatedInstance.modelInfo.modelType == 'vnf') {
+ vnfName = it.relatedInstance.instanceName ?: ''
+ }
+ }
+ }
+
+ def vnfType = execution.getVariable('vnfType')
+ def vnfId = execution.getVariable('vnfId')
+
+ def vfModuleId = execution.getVariable('vfModuleId')
+ def volumeGroupId = execution.getVariable('volumeGroupId')
+ def userParams = requestMap.requestDetails?.requestParameters?.userParams
+
+
+ def userParamsNode = ''
+ if(userParams != null) {
+ userParamsNode = buildUserParams(userParams)
+ }
+
+ def isBaseVfModule = "false"
+ if (execution.getVariable('isBaseVfModule') == true) {
+ isBaseVfModule = "true"
+ }
+
+ def requestId = execution.getVariable("mso-request-id")
+ def vfModuleName = requestMap.requestDetails?.requestInfo?.instanceName ?: ''
+ def vfModuleModelName = requestMap.requestDetails?.modelInfo?.modelName ?: ''
+ def suppressRollback = requestMap.requestDetails?.requestInfo?.suppressRollback
+
+ def backoutOnFailure = ""
+ if(suppressRollback != null){
+ if ( suppressRollback == true) {
+ backoutOnFailure = "false"
+ } else if ( suppressRollback == false) {
+ backoutOnFailure = "true"
+ }
+ }
+
+ def serviceId = requestMap.requestDetails?.requestParameters?.serviceId ?: ''
+ def aicCloudRegion = requestMap.requestDetails?.cloudConfiguration?.lcpCloudRegionId ?: ''
+ def tenantId = requestMap.requestDetails?.cloudConfiguration?.tenantId ?: ''
+ def personaModelId = requestMap.requestDetails?.modelInfo?.modelInvariantId ?: ''
+ def personaModelVersion = requestMap.requestDetails?.modelInfo?.modelVersion ?: ''
+ def modelCustomizationId = requestMap.requestDetails?.modelInfo?.modelCustomizationId ?: ''
+
+ def xmlReq = """
+ <vnf-request>
+ <request-info>
+ <request-id>${requestId}</request-id>
+ <action>${action}</action>
+ <source>VID</source>
+ <!-- new 1610 field -->
+ <service-instance-id>${serviceInstanceId}</service-instance-id>
+ </request-info>
+ <vnf-inputs>
+ <!-- not in use in 1610 -->
+ <vnf-name>${vnfName}</vnf-name>
+ <vnf-type>${vnfType}</vnf-type>
+ <vnf-id>${vnfId}</vnf-id>
+ <volume-group-id>${volumeGroupId}</volume-group-id>
+ <vf-module-id>${vfModuleId}</vf-module-id>
+ <vf-module-name>${vfModuleName}</vf-module-name>
+ <vf-module-model-name>${vfModuleModelName}</vf-module-model-name>
+ <model-customization-id>${modelCustomizationId}</model-customization-id>
+ <is-base-vf-module>${isBaseVfModule}</is-base-vf-module>
+ <asdc-service-model-version>${asdcServiceModelInfo}</asdc-service-model-version>
+ <aic-cloud-region>${aicCloudRegion}</aic-cloud-region>
+ <tenant-id>${tenantId}</tenant-id>
+ <service-id>${serviceId}</service-id>
+ <backout-on-failure>${backoutOnFailure}</backout-on-failure>
+ <persona-model-id>${personaModelId}</persona-model-id>
+ <persona-model-version>${personaModelVersion}</persona-model-version>
+ </vnf-inputs>
+ <vnf-params>
+ $userParamsNode
+ </vnf-params>
+ </vnf-request>
+ """
+
+ // return a pretty-print of the volume-request xml without the preamble
+ return groovy.xml.XmlUtil.serialize(xmlReq.normalize().replaceAll("\t", "").replaceAll("\n", "")).replaceAll("(<\\?[^<]*\\?>\\s*[\\r\\n]*)?", "")
+ }
+
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VnfAdapterRestV1.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VnfAdapterRestV1.groovy
index 31c5596cbb..0ec9c93862 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VnfAdapterRestV1.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VnfAdapterRestV1.groovy
@@ -1,404 +1,404 @@
-/*-
- * ============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.common.scripts
-
-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.openecomp.mso.rest.RESTClient
-import org.openecomp.mso.rest.RESTConfig
-
-class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
-
- ExceptionUtil exceptionUtil = new ExceptionUtil()
-
- // VNF Response Processing
- public void preProcessRequest (Execution execution) {
- def method = getClass().getSimpleName() + '.preProcessRequest(' +
- 'execution=' + execution.getId() +
- ')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- def prefix="VNFREST_"
- execution.setVariable("prefix", prefix)
- setSuccessIndicator(execution, false)
-
- try {
- String request = validateRequest(execution, "mso-request-id")
-
- // Get the request type (the name of the root element) from the request
-
- Node root = new XmlParser().parseText(request)
- String requestType = root.name()
- execution.setVariable(prefix + 'requestType', requestType)
- logDebug(getProcessKey(execution) + ': ' + prefix + 'requestType = ' + requestType, isDebugLogEnabled)
-
- utils.logAudit('VnfAdapterRestV1, request: ' + request)
- // Get the messageId from the request
-
- String messageId = getChildText(root, 'messageId')
-
- if (messageId == null || messageId.isEmpty()) {
- String msg = getProcessKey(execution) + ': no messageId in ' + requestType
- logError(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
- }
-
- execution.setVariable('VNFAResponse_CORRELATOR', messageId)
- logDebug(getProcessKey(execution) + ': VNFAResponse_CORRELATOR = ' + messageId, isDebugLogEnabled)
-
- // Get the notificationUrl from the request
-
- String notificationUrl = getChildText(root, 'notificationUrl')
-
- if (notificationUrl == null || notificationUrl.isEmpty()) {
- String msg = getProcessKey(execution) + ': no notificationUrl in ' + requestType
- logError(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
- }
-
- execution.setVariable(prefix + 'notificationUrl', notificationUrl)
- logDebug(getProcessKey(execution) + ': ' + prefix + 'notificationUrl = ' + notificationUrl, isDebugLogEnabled)
-
- // Determine the VnfAdapter endpoint
-
- String vnfAdapterEndpoint = execution.getVariable("URN_mso_adapters_vnf_rest_endpoint")
-
- if (vnfAdapterEndpoint == null || vnfAdapterEndpoint.isEmpty()) {
- String msg = getProcessKey(execution) + ': mso:adapters:vnf:rest:endpoint URN mapping is not defined'
- logError(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
- }
-
- while (vnfAdapterEndpoint.endsWith('/')) {
- vnfAdapterEndpoint = vnfAdapterEndpoint.substring(0, vnfAdapterEndpoint.length()-1)
- }
-
- String vnfAdapterMethod = null
- String vnfAdapterUrl = null
- String vnfAdapterRequest = request
-
- if ('createVfModuleRequest'.equals(requestType)) {
- String vnfId = getChildText(root, 'vnfId')
-
- if (vnfId == null || vnfId.isEmpty()) {
- String msg = getProcessKey(execution) + ': no vnfId in ' + requestType
- logError(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
- }
-
- vnfAdapterMethod = 'POST'
- vnfAdapterUrl = vnfAdapterEndpoint + '/' + URLEncoder.encode(vnfId, 'UTF-8') + '/vf-modules'
-
- } else if ('updateVfModuleRequest'.equals(requestType)) {
- String vnfId = getChildText(root, 'vnfId')
-
- if (vnfId == null || vnfId.isEmpty()) {
- String msg = getProcessKey(execution) + ': no vnfId in ' + requestType
- logError(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
- }
-
- String vfModuleId = getChildText(root, 'vfModuleId')
-
- if (vfModuleId == null || vfModuleId.isEmpty()) {
- String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType
- logError(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
- }
-
- vnfAdapterMethod = 'PUT'
- vnfAdapterUrl = vnfAdapterEndpoint + '/' + URLEncoder.encode(vnfId, 'UTF-8') +
- '/vf-modules/' + URLEncoder.encode(vfModuleId, 'UTF-8')
-
- } else if ('deleteVfModuleRequest'.equals(requestType)) {
- String vnfId = getChildText(root, 'vnfId')
-
- if (vnfId == null || vnfId.isEmpty()) {
- String msg = getProcessKey(execution) + ': no vnfId in ' + requestType
- logError(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
- }
-
- String vfModuleId = getChildText(root, 'vfModuleId')
-
- if (vfModuleId == null || vfModuleId.isEmpty()) {
- String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType
- logError(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
- }
-
- vnfAdapterMethod = 'DELETE'
- vnfAdapterUrl = vnfAdapterEndpoint + '/' + URLEncoder.encode(vnfId, 'UTF-8') +
- '/vf-modules/' + URLEncoder.encode(vfModuleId, 'UTF-8')
-
- } else if ('rollbackVfModuleRequest'.equals(requestType)) {
- Node vfModuleRollbackNode = getChild(root, 'vfModuleRollback')
-
- if (vfModuleRollbackNode == null) {
- String msg = getProcessKey(execution) + ': no vfModuleRollback in ' + requestType
- logError(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
- }
-
- String vnfId = getChildText(vfModuleRollbackNode, 'vnfId')
-
- if (vnfId == null || vnfId.isEmpty()) {
- String msg = getProcessKey(execution) + ': no vnfId in ' + requestType
- logError(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
- }
-
- String vfModuleId = getChildText(vfModuleRollbackNode, 'vfModuleId')
-
- if (vfModuleId == null || vfModuleId.isEmpty()) {
- String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType
- logError(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
- }
-
- vnfAdapterMethod = 'DELETE'
- vnfAdapterUrl = vnfAdapterEndpoint + '/' + URLEncoder.encode(vnfId, 'UTF-8') +
- '/vf-modules/' + URLEncoder.encode(vfModuleId, 'UTF-8') + '/rollback'
-
- } else if ('createVolumeGroupRequest'.equals(requestType)) {
- vnfAdapterMethod = 'POST'
- if (vnfAdapterEndpoint.endsWith('v1/vnfs')) {
- vnfAdapterEndpoint = vnfAdapterEndpoint.substring(0, (vnfAdapterEndpoint.length()-'/vnfs'.length()))
- }
- vnfAdapterUrl = vnfAdapterEndpoint + '/volume-groups'
-
- } else if ('updateVolumeGroupRequest'.equals(requestType)) {
- String volumeGroupId = getChildText(root, 'volumeGroupId')
-
- if (volumeGroupId == null || volumeGroupId.isEmpty()) {
- String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType
- logError(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
- }
-
- vnfAdapterMethod = 'PUT'
- if (vnfAdapterEndpoint.endsWith('v1/vnfs')) {
- vnfAdapterEndpoint = vnfAdapterEndpoint.substring(0, (vnfAdapterEndpoint.length()-'/vnfs'.length()))
- }
- vnfAdapterUrl = vnfAdapterEndpoint + '/volume-groups/' + URLEncoder.encode(volumeGroupId, 'UTF-8')
-
- } else if ('deleteVolumeGroupRequest'.equals(requestType)) {
- String volumeGroupId = getChildText(root, 'volumeGroupId')
-
- if (volumeGroupId == null || volumeGroupId.isEmpty()) {
- String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType
- logError(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
- }
-
- vnfAdapterMethod = 'DELETE'
- if (vnfAdapterEndpoint.endsWith('v1/vnfs')) {
- vnfAdapterEndpoint = vnfAdapterEndpoint.substring(0, (vnfAdapterEndpoint.length()-'/vnfs'.length()))
- }
- vnfAdapterUrl = vnfAdapterEndpoint + '/volume-groups/' + URLEncoder.encode(volumeGroupId, 'UTF-8')
-
- } else if ('rollbackVolumeGroupRequest'.equals(requestType)) {
- String volumeGroupId = getChildText(root, 'volumeGroupId')
-
- if (volumeGroupId == null || volumeGroupId.isEmpty()) {
- String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType
- logError(msg)
- createWorkflowException(execution, 2000, msg)
- }
-
- vnfAdapterMethod = 'DELETE'
- if (vnfAdapterEndpoint.endsWith('v1/vnfs')) {
- vnfAdapterEndpoint = vnfAdapterEndpoint.substring(0, (vnfAdapterEndpoint.length()-'/vnfs'.length()))
- }
- vnfAdapterUrl = vnfAdapterEndpoint + '/volume-groups/' + URLEncoder.encode(volumeGroupId, 'UTF-8') + '/rollback'
-
- } else {
- String msg = getProcessKey(execution) + ': Unsupported request type: ' + requestType
- logError(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
- }
-
- execution.setVariable(prefix + 'vnfAdapterMethod', vnfAdapterMethod)
- logDebug(getProcessKey(execution) + ': ' + prefix + 'vnfAdapterMethod = ' + vnfAdapterMethod, isDebugLogEnabled)
- execution.setVariable(prefix + 'vnfAdapterUrl', vnfAdapterUrl)
- logDebug(getProcessKey(execution) + ': ' + prefix + 'vnfAdapterUrl = ' + vnfAdapterUrl, isDebugLogEnabled)
- execution.setVariable(prefix + 'vnfAdapterRequest', vnfAdapterRequest)
- logDebug(getProcessKey(execution) + ': ' + prefix + 'vnfAdapterRequest = \n' + vnfAdapterRequest, isDebugLogEnabled)
-
- // Get the Basic Auth credentials for the VnfAdapter
-
- String basicAuthValue = execution.getVariable("URN_mso_adapters_po_auth")
-
- if (basicAuthValue == null || basicAuthValue.isEmpty()) {
- logError(getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined")
- } else {
- logDebug(getProcessKey(execution) + ": Obtained BasicAuth credentials for VnfAdapter:" +
- basicAuthValue, isDebugLogEnabled)
- try {
- def encodedString = utils.getBasicAuth(basicAuthValue, execution.getVariable("URN_mso_msoKey"))
- execution.setVariable(prefix + 'basicAuthHeaderValue', encodedString)
- } catch (IOException ex) {
- logError(getProcessKey(execution) + ": Unable to encode BasicAuth credentials for VnfAdapter")
- }
- }
-
- } catch (BpmnError e) {
- logDebug(" Rethrowing MSOWorkflowException", isDebugLogEnabled)
- throw e
- } catch (Exception e) {
- String msg = 'Caught exception in ' + method + ": " + e
- logError(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
- }
- }
-
- /**
- * This method is used instead of an HTTP Connector task because the
- * connector does not allow DELETE with a body.
- */
- public void sendRequestToVnfAdapter(Execution execution) {
- def method = getClass().getSimpleName() + '.sendRequestToVnfAdapter(' +
- 'execution=' + execution.getId() +
- ')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- String prefix = execution.getVariable('prefix')
-
- try {
- String vnfAdapterMethod = execution.getVariable(prefix + 'vnfAdapterMethod')
- String vnfAdapterUrl = execution.getVariable(prefix + 'vnfAdapterUrl')
- String vnfAdapterRequest = execution.getVariable(prefix + 'vnfAdapterRequest')
-
- RESTConfig config = new RESTConfig(vnfAdapterUrl)
- RESTClient client = new RESTClient(config).
- addHeader("Content-Type", "application/xml").
- addAuthorizationHeader(execution.getVariable(prefix + "basicAuthHeaderValue"));
-
- APIResponse response;
-
- if ("GET".equals(vnfAdapterMethod)) {
- response = client.httpGet()
- } else if ("PUT".equals(vnfAdapterMethod)) {
- response = client.httpPut(vnfAdapterRequest)
- } else if ("POST".equals(vnfAdapterMethod)) {
- response = client.httpPost(vnfAdapterRequest)
- } else if ("DELETE".equals(vnfAdapterMethod)) {
- response = client.httpDelete(vnfAdapterRequest)
- } else {
- String msg = 'Unsupported HTTP method "' + vnfAdapterMethod + '" in ' + method + ": " + e
- logError(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
- }
-
- execution.setVariable(prefix + "vnfAdapterStatusCode", response.getStatusCode())
- execution.setVariable(prefix + "vnfAdapterResponse", response.getResponseBodyAsString())
- } catch (BpmnError e) {
- throw e
- } catch (Exception e) {
- String msg = 'Caught exception in ' + method + ": " + e
- logError(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
- }
- }
-
- public void processCallback(Execution execution){
- def method = getClass().getSimpleName() + '.processCallback(' +
- 'execution=' + execution.getId() +
- ')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- String callback = execution.getVariable('VNFAResponse_MESSAGE')
-
- try {
- logDebug(getProcessKey(execution) + ": received callback:\n" + callback, isDebugLogEnabled)
-
- // The XML callback is available to the calling flow in any case,
- // even if a WorkflowException is generated.
- execution.setVariable(getProcessKey(execution) + 'Response', callback)
- // TODO: Should deprecate use of processKey+Response variable for the response. Will use "WorkflowResponse" instead.
- execution.setVariable("WorkflowResponse", callback)
-
- Node root = new XmlParser().parseText(callback)
- if (root.name().endsWith('Exception')) {
- vnfAdapterWorkflowException(execution, callback)
- }
- } catch (Exception e) {
- e.printStackTrace()
- callback = callback == null || String.valueOf(callback).isEmpty() ? "NONE" : callback
- String msg = "Received error from VnfAdapter: " + callback
- logDebug(getProcessKey(execution) + ': ' + msg, isDebugLogEnabled)
- exceptionUtil.buildWorkflowException(execution, 7020, msg)
- }
- }
-
- /**
- * Tries to parse the response as XML to extract the information to create
- * a WorkflowException. If the response cannot be parsed, a more generic
- * WorkflowException is created.
- */
- public void vnfAdapterWorkflowException(Execution execution, Object response) {
- try {
- Node root = new XmlParser().parseText(response)
- String category = getChildText(root, "category")
- category = category == null || category.isEmpty() ? "" : " category='" + category + "'"
- String message = getChildText(root, "message")
- message = message == null || message.isEmpty() ? "" : " message='" + message + "'"
- String rolledBack = getChildText(root, "rolledBack")
- rolledBack = rolledBack == null || rolledBack.isEmpty() ? "" : " rolledBack='" + rolledBack + "'"
- exceptionUtil.buildWorkflowException(execution, 7020, "Received " + root.name() +
- " from VnfAdapter:" + category + message + rolledBack);
- } catch (Exception e) {
- response = response == null || String.valueOf(response).isEmpty() ? "NONE" : response
- exceptionUtil.buildWorkflowException(execution, 7020, "Received error from VnfAdapter: " + response)
- }
- }
-
- /**
- * Gets the named child of the specified node.
- * @param node the node
- * @param name the child name
- * @return the child node, or null if no such child exists
- */
- private Node getChild(Node node, String name) {
- for (Node child : node.children()) {
- if (child.name() == name) {
- return child
- }
- }
- return null
- }
-
- /**
- * Gets the text of the named child of the specified node.
- * @param node the node
- * @param name the child name
- * @return the child node text, or null if no such child exists
- */
- private String getChildText(Node node, String name) {
- Node child = getChild(node, name)
- return child == null ? null : child.text()
- }
-}
+/*-
+ * ============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.common.scripts
+
+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.openecomp.mso.rest.RESTClient
+import org.openecomp.mso.rest.RESTConfig
+
+class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
+
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+
+ // VNF Response Processing
+ public void preProcessRequest (Execution execution) {
+ def method = getClass().getSimpleName() + '.preProcessRequest(' +
+ 'execution=' + execution.getId() +
+ ')'
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ logDebug('Entered ' + method, isDebugLogEnabled)
+
+ def prefix="VNFREST_"
+ execution.setVariable("prefix", prefix)
+ setSuccessIndicator(execution, false)
+
+ try {
+ String request = validateRequest(execution, "mso-request-id")
+
+ // Get the request type (the name of the root element) from the request
+
+ Node root = new XmlParser().parseText(request)
+ String requestType = root.name()
+ execution.setVariable(prefix + 'requestType', requestType)
+ logDebug(getProcessKey(execution) + ': ' + prefix + 'requestType = ' + requestType, isDebugLogEnabled)
+
+ utils.logAudit('VnfAdapterRestV1, request: ' + request)
+ // Get the messageId from the request
+
+ String messageId = getChildText(root, 'messageId')
+
+ if (messageId == null || messageId.isEmpty()) {
+ String msg = getProcessKey(execution) + ': no messageId in ' + requestType
+ logError(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ }
+
+ execution.setVariable('VNFAResponse_CORRELATOR', messageId)
+ logDebug(getProcessKey(execution) + ': VNFAResponse_CORRELATOR = ' + messageId, isDebugLogEnabled)
+
+ // Get the notificationUrl from the request
+
+ String notificationUrl = getChildText(root, 'notificationUrl')
+
+ if (notificationUrl == null || notificationUrl.isEmpty()) {
+ String msg = getProcessKey(execution) + ': no notificationUrl in ' + requestType
+ logError(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ }
+
+ execution.setVariable(prefix + 'notificationUrl', notificationUrl)
+ logDebug(getProcessKey(execution) + ': ' + prefix + 'notificationUrl = ' + notificationUrl, isDebugLogEnabled)
+
+ // Determine the VnfAdapter endpoint
+
+ String vnfAdapterEndpoint = execution.getVariable("URN_mso_adapters_vnf_rest_endpoint")
+
+ if (vnfAdapterEndpoint == null || vnfAdapterEndpoint.isEmpty()) {
+ String msg = getProcessKey(execution) + ': mso:adapters:vnf:rest:endpoint URN mapping is not defined'
+ logError(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ }
+
+ while (vnfAdapterEndpoint.endsWith('/')) {
+ vnfAdapterEndpoint = vnfAdapterEndpoint.substring(0, vnfAdapterEndpoint.length()-1)
+ }
+
+ String vnfAdapterMethod = null
+ String vnfAdapterUrl = null
+ String vnfAdapterRequest = request
+
+ if ('createVfModuleRequest'.equals(requestType)) {
+ String vnfId = getChildText(root, 'vnfId')
+
+ if (vnfId == null || vnfId.isEmpty()) {
+ String msg = getProcessKey(execution) + ': no vnfId in ' + requestType
+ logError(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ }
+
+ vnfAdapterMethod = 'POST'
+ vnfAdapterUrl = vnfAdapterEndpoint + '/' + URLEncoder.encode(vnfId, 'UTF-8') + '/vf-modules'
+
+ } else if ('updateVfModuleRequest'.equals(requestType)) {
+ String vnfId = getChildText(root, 'vnfId')
+
+ if (vnfId == null || vnfId.isEmpty()) {
+ String msg = getProcessKey(execution) + ': no vnfId in ' + requestType
+ logError(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ }
+
+ String vfModuleId = getChildText(root, 'vfModuleId')
+
+ if (vfModuleId == null || vfModuleId.isEmpty()) {
+ String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType
+ logError(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ }
+
+ vnfAdapterMethod = 'PUT'
+ vnfAdapterUrl = vnfAdapterEndpoint + '/' + URLEncoder.encode(vnfId, 'UTF-8') +
+ '/vf-modules/' + URLEncoder.encode(vfModuleId, 'UTF-8')
+
+ } else if ('deleteVfModuleRequest'.equals(requestType)) {
+ String vnfId = getChildText(root, 'vnfId')
+
+ if (vnfId == null || vnfId.isEmpty()) {
+ String msg = getProcessKey(execution) + ': no vnfId in ' + requestType
+ logError(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ }
+
+ String vfModuleId = getChildText(root, 'vfModuleId')
+
+ if (vfModuleId == null || vfModuleId.isEmpty()) {
+ String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType
+ logError(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ }
+
+ vnfAdapterMethod = 'DELETE'
+ vnfAdapterUrl = vnfAdapterEndpoint + '/' + URLEncoder.encode(vnfId, 'UTF-8') +
+ '/vf-modules/' + URLEncoder.encode(vfModuleId, 'UTF-8')
+
+ } else if ('rollbackVfModuleRequest'.equals(requestType)) {
+ Node vfModuleRollbackNode = getChild(root, 'vfModuleRollback')
+
+ if (vfModuleRollbackNode == null) {
+ String msg = getProcessKey(execution) + ': no vfModuleRollback in ' + requestType
+ logError(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ }
+
+ String vnfId = getChildText(vfModuleRollbackNode, 'vnfId')
+
+ if (vnfId == null || vnfId.isEmpty()) {
+ String msg = getProcessKey(execution) + ': no vnfId in ' + requestType
+ logError(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ }
+
+ String vfModuleId = getChildText(vfModuleRollbackNode, 'vfModuleId')
+
+ if (vfModuleId == null || vfModuleId.isEmpty()) {
+ String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType
+ logError(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ }
+
+ vnfAdapterMethod = 'DELETE'
+ vnfAdapterUrl = vnfAdapterEndpoint + '/' + URLEncoder.encode(vnfId, 'UTF-8') +
+ '/vf-modules/' + URLEncoder.encode(vfModuleId, 'UTF-8') + '/rollback'
+
+ } else if ('createVolumeGroupRequest'.equals(requestType)) {
+ vnfAdapterMethod = 'POST'
+ if (vnfAdapterEndpoint.endsWith('v1/vnfs')) {
+ vnfAdapterEndpoint = vnfAdapterEndpoint.substring(0, (vnfAdapterEndpoint.length()-'/vnfs'.length()))
+ }
+ vnfAdapterUrl = vnfAdapterEndpoint + '/volume-groups'
+
+ } else if ('updateVolumeGroupRequest'.equals(requestType)) {
+ String volumeGroupId = getChildText(root, 'volumeGroupId')
+
+ if (volumeGroupId == null || volumeGroupId.isEmpty()) {
+ String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType
+ logError(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ }
+
+ vnfAdapterMethod = 'PUT'
+ if (vnfAdapterEndpoint.endsWith('v1/vnfs')) {
+ vnfAdapterEndpoint = vnfAdapterEndpoint.substring(0, (vnfAdapterEndpoint.length()-'/vnfs'.length()))
+ }
+ vnfAdapterUrl = vnfAdapterEndpoint + '/volume-groups/' + URLEncoder.encode(volumeGroupId, 'UTF-8')
+
+ } else if ('deleteVolumeGroupRequest'.equals(requestType)) {
+ String volumeGroupId = getChildText(root, 'volumeGroupId')
+
+ if (volumeGroupId == null || volumeGroupId.isEmpty()) {
+ String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType
+ logError(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ }
+
+ vnfAdapterMethod = 'DELETE'
+ if (vnfAdapterEndpoint.endsWith('v1/vnfs')) {
+ vnfAdapterEndpoint = vnfAdapterEndpoint.substring(0, (vnfAdapterEndpoint.length()-'/vnfs'.length()))
+ }
+ vnfAdapterUrl = vnfAdapterEndpoint + '/volume-groups/' + URLEncoder.encode(volumeGroupId, 'UTF-8')
+
+ } else if ('rollbackVolumeGroupRequest'.equals(requestType)) {
+ String volumeGroupId = getChildText(root, 'volumeGroupId')
+
+ if (volumeGroupId == null || volumeGroupId.isEmpty()) {
+ String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType
+ logError(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ }
+
+ vnfAdapterMethod = 'DELETE'
+ if (vnfAdapterEndpoint.endsWith('v1/vnfs')) {
+ vnfAdapterEndpoint = vnfAdapterEndpoint.substring(0, (vnfAdapterEndpoint.length()-'/vnfs'.length()))
+ }
+ vnfAdapterUrl = vnfAdapterEndpoint + '/volume-groups/' + URLEncoder.encode(volumeGroupId, 'UTF-8') + '/rollback'
+
+ } else {
+ String msg = getProcessKey(execution) + ': Unsupported request type: ' + requestType
+ logError(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ }
+
+ execution.setVariable(prefix + 'vnfAdapterMethod', vnfAdapterMethod)
+ logDebug(getProcessKey(execution) + ': ' + prefix + 'vnfAdapterMethod = ' + vnfAdapterMethod, isDebugLogEnabled)
+ execution.setVariable(prefix + 'vnfAdapterUrl', vnfAdapterUrl)
+ logDebug(getProcessKey(execution) + ': ' + prefix + 'vnfAdapterUrl = ' + vnfAdapterUrl, isDebugLogEnabled)
+ execution.setVariable(prefix + 'vnfAdapterRequest', vnfAdapterRequest)
+ logDebug(getProcessKey(execution) + ': ' + prefix + 'vnfAdapterRequest = \n' + vnfAdapterRequest, isDebugLogEnabled)
+
+ // Get the Basic Auth credentials for the VnfAdapter
+
+ String basicAuthValue = execution.getVariable("URN_mso_adapters_po_auth")
+
+ if (basicAuthValue == null || basicAuthValue.isEmpty()) {
+ logError(getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined")
+ } else {
+ logDebug(getProcessKey(execution) + ": Obtained BasicAuth credentials for VnfAdapter:" +
+ basicAuthValue, isDebugLogEnabled)
+ try {
+ def encodedString = utils.getBasicAuth(basicAuthValue, execution.getVariable("URN_mso_msoKey"))
+ execution.setVariable(prefix + 'basicAuthHeaderValue', encodedString)
+ } catch (IOException ex) {
+ logError(getProcessKey(execution) + ": Unable to encode BasicAuth credentials for VnfAdapter")
+ }
+ }
+
+ } catch (BpmnError e) {
+ logDebug(" Rethrowing MSOWorkflowException", isDebugLogEnabled)
+ throw e
+ } catch (Exception e) {
+ String msg = 'Caught exception in ' + method + ": " + e
+ logError(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ }
+ }
+
+ /**
+ * This method is used instead of an HTTP Connector task because the
+ * connector does not allow DELETE with a body.
+ */
+ public void sendRequestToVnfAdapter(Execution execution) {
+ def method = getClass().getSimpleName() + '.sendRequestToVnfAdapter(' +
+ 'execution=' + execution.getId() +
+ ')'
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ logDebug('Entered ' + method, isDebugLogEnabled)
+
+ String prefix = execution.getVariable('prefix')
+
+ try {
+ String vnfAdapterMethod = execution.getVariable(prefix + 'vnfAdapterMethod')
+ String vnfAdapterUrl = execution.getVariable(prefix + 'vnfAdapterUrl')
+ String vnfAdapterRequest = execution.getVariable(prefix + 'vnfAdapterRequest')
+
+ RESTConfig config = new RESTConfig(vnfAdapterUrl)
+ RESTClient client = new RESTClient(config).
+ addHeader("Content-Type", "application/xml").
+ addAuthorizationHeader(execution.getVariable(prefix + "basicAuthHeaderValue"));
+
+ APIResponse response;
+
+ if ("GET".equals(vnfAdapterMethod)) {
+ response = client.httpGet()
+ } else if ("PUT".equals(vnfAdapterMethod)) {
+ response = client.httpPut(vnfAdapterRequest)
+ } else if ("POST".equals(vnfAdapterMethod)) {
+ response = client.httpPost(vnfAdapterRequest)
+ } else if ("DELETE".equals(vnfAdapterMethod)) {
+ response = client.httpDelete(vnfAdapterRequest)
+ } else {
+ String msg = 'Unsupported HTTP method "' + vnfAdapterMethod + '" in ' + method + ": " + e
+ logError(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ }
+
+ execution.setVariable(prefix + "vnfAdapterStatusCode", response.getStatusCode())
+ execution.setVariable(prefix + "vnfAdapterResponse", response.getResponseBodyAsString())
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception e) {
+ String msg = 'Caught exception in ' + method + ": " + e
+ logError(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ }
+ }
+
+ public void processCallback(Execution execution){
+ def method = getClass().getSimpleName() + '.processCallback(' +
+ 'execution=' + execution.getId() +
+ ')'
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ logDebug('Entered ' + method, isDebugLogEnabled)
+
+ String callback = execution.getVariable('VNFAResponse_MESSAGE')
+
+ try {
+ logDebug(getProcessKey(execution) + ": received callback:\n" + callback, isDebugLogEnabled)
+
+ // The XML callback is available to the calling flow in any case,
+ // even if a WorkflowException is generated.
+ execution.setVariable(getProcessKey(execution) + 'Response', callback)
+ // TODO: Should deprecate use of processKey+Response variable for the response. Will use "WorkflowResponse" instead.
+ execution.setVariable("WorkflowResponse", callback)
+
+ Node root = new XmlParser().parseText(callback)
+ if (root.name().endsWith('Exception')) {
+ vnfAdapterWorkflowException(execution, callback)
+ }
+ } catch (Exception e) {
+ e.printStackTrace()
+ callback = callback == null || String.valueOf(callback).isEmpty() ? "NONE" : callback
+ String msg = "Received error from VnfAdapter: " + callback
+ logDebug(getProcessKey(execution) + ': ' + msg, isDebugLogEnabled)
+ exceptionUtil.buildWorkflowException(execution, 7020, msg)
+ }
+ }
+
+ /**
+ * Tries to parse the response as XML to extract the information to create
+ * a WorkflowException. If the response cannot be parsed, a more generic
+ * WorkflowException is created.
+ */
+ public void vnfAdapterWorkflowException(Execution execution, Object response) {
+ try {
+ Node root = new XmlParser().parseText(response)
+ String category = getChildText(root, "category")
+ category = category == null || category.isEmpty() ? "" : " category='" + category + "'"
+ String message = getChildText(root, "message")
+ message = message == null || message.isEmpty() ? "" : " message='" + message + "'"
+ String rolledBack = getChildText(root, "rolledBack")
+ rolledBack = rolledBack == null || rolledBack.isEmpty() ? "" : " rolledBack='" + rolledBack + "'"
+ exceptionUtil.buildWorkflowException(execution, 7020, "Received " + root.name() +
+ " from VnfAdapter:" + category + message + rolledBack);
+ } catch (Exception e) {
+ response = response == null || String.valueOf(response).isEmpty() ? "NONE" : response
+ exceptionUtil.buildWorkflowException(execution, 7020, "Received error from VnfAdapter: " + response)
+ }
+ }
+
+ /**
+ * Gets the named child of the specified node.
+ * @param node the node
+ * @param name the child name
+ * @return the child node, or null if no such child exists
+ */
+ private Node getChild(Node node, String name) {
+ for (Node child : node.children()) {
+ if (child.name() == name) {
+ return child
+ }
+ }
+ return null
+ }
+
+ /**
+ * Gets the text of the named child of the specified node.
+ * @param node the node
+ * @param name the child name
+ * @return the child node text, or null if no such child exists
+ */
+ private String getChildText(Node node, String name) {
+ Node child = getChild(node, name)
+ return child == null ? null : child.text()
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VnfAdapterUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VnfAdapterUtils.groovy
index cd8d2a3374..82b67ce3bf 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VnfAdapterUtils.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VnfAdapterUtils.groovy
@@ -1,78 +1,86 @@
-/*-
- * ============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.common.scripts
-
-import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.runtime.Execution;
-import org.openecomp.mso.bpmn.core.WorkflowException
-
-class VnfAdapterUtils {
-
- private AbstractServiceTaskProcessor taskProcessor
-
- public VnfAdapterUtils(AbstractServiceTaskProcessor taskProcessor) {
- this.taskProcessor = taskProcessor
- }
-
- ExceptionUtil exceptionUtil = new ExceptionUtil()
-
- public void validateVnfResponse(Execution execution, String responseVar, String responseCodeVar, String errorResponseVar) {
- def method = getClass().getSimpleName() + '.validateVnfResponse(' +
- 'execution=' + execution.getId() +
- ', responseVar=' + responseVar +
- ', responseCodeVar=' + responseCodeVar +
- ', errorResponseVar=' + errorResponseVar +
- ')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- taskProcessor.logDebug('Entered ' + method, isDebugLogEnabled)
-
- try {
- def prefix = execution.getVariable('prefix')
-
- def response = execution.getVariable(responseVar)
- def responseCode = execution.getVariable(responseCodeVar)
- def errorResponse = execution.getVariable(errorResponseVar)
-
- // The following if statement never appears to be true as any VNF Adapter error seems to be stored in 'errorResponse'.
- // Also, the value is stored as a WorkflowException object, not a String. Added the else if to provide the proper
- // functionality but leaving the original code in case it is hit under some circumstances.
- if (response.contains("WorkflowException")) {
- execution.setVariable(prefix + "ErrorResponse", response)
- //execution.setVariable(prefix + "ResponseCode", responseCode)
- taskProcessor.logDebug(" Sub Vnf flow Error WorkflowException Response - " + "\n" + response, isDebugLogEnabled)
- throw new BpmnError("MSOWorkflowException")
- } else if (errorResponse != null && errorResponse instanceof WorkflowException) {
- // Not sure the variables with the associated prefix are still used
- execution.setVariable(prefix + "ErrorResponse", errorResponse.getErrorMessage())
- execution.setVariable(prefix + "ResponseCode", errorResponse.getErrorCode())
- taskProcessor.logDebug("Sub Vnf flow Error WorkflowException " + prefix + "ErrorResponse" + " - " +
- errorResponse.getErrorMessage(), isDebugLogEnabled)
- // this is the important part to ensure we hit the Fallout Handler
- throw new BpmnError("MSOWorkflowException")
- }
- } catch (BpmnError e) {
- throw e;
- } catch (Exception e) {
- taskProcessor.logError('Caught exception in ' + method, e)
- taskProcessor.workflowException(execution, 'Internal Error- Unable to validate VNF Response ' + e.getMessage(), 500)
- }
- }
-
-}
+/*-
+ * ============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.common.scripts
+
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.runtime.Execution;
+import org.openecomp.mso.bpmn.core.WorkflowException
+
+class VnfAdapterUtils {
+
+ private AbstractServiceTaskProcessor taskProcessor
+
+ public VnfAdapterUtils(AbstractServiceTaskProcessor taskProcessor) {
+ this.taskProcessor = taskProcessor
+ }
+
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+
+ public void validateVnfResponse(Execution execution, String responseVar, String responseCodeVar, String errorResponseVar) {
+ def method = getClass().getSimpleName() + '.validateVnfResponse(' +
+ 'execution=' + execution.getId() +
+ ', responseVar=' + responseVar +
+ ', responseCodeVar=' + responseCodeVar +
+ ', errorResponseVar=' + errorResponseVar +
+ ')'
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ taskProcessor.logDebug('Entered ' + method, isDebugLogEnabled)
+
+ try {
+ def prefix = execution.getVariable('prefix')
+
+ def response = execution.getVariable(responseVar)
+ def responseCode = execution.getVariable(responseCodeVar)
+ def errorResponse = execution.getVariable(errorResponseVar)
+
+ // The following if statement never appears to be true as any VNF Adapter error seems to be stored in 'errorResponse'.
+ // Also, the value is stored as a WorkflowException object, not a String. Added the else if to provide the proper
+ // functionality but leaving the original code in case it is hit under some circumstances.
+ if (response.contains("WorkflowException")) {
+ execution.setVariable(prefix + "ErrorResponse", response)
+ //execution.setVariable(prefix + "ResponseCode", responseCode)
+ taskProcessor.logDebug(" Sub Vnf flow Error WorkflowException Response - " + "\n" + response, isDebugLogEnabled)
+ throw new BpmnError("MSOWorkflowException")
+ } else if (errorResponse != null && errorResponse instanceof WorkflowException) {
+ // Not sure the variables with the associated prefix are still used
+ execution.setVariable(prefix + "ErrorResponse", errorResponse.getErrorMessage())
+ execution.setVariable(prefix + "ResponseCode", errorResponse.getErrorCode())
+ taskProcessor.logDebug("Sub Vnf flow Error WorkflowException " + prefix + "ErrorResponse" + " - " +
+ errorResponse.getErrorMessage(), isDebugLogEnabled)
+ // this is the important part to ensure we hit the Fallout Handler
+ throw new BpmnError("MSOWorkflowException")
+ } else if (errorResponse != null && errorResponse instanceof WorkflowException) {
+ // Not sure the variables with the associated prefix are still used
+ execution.setVariable(prefix + "ErrorResponse", errorResponse.getErrorMessage())
+ execution.setVariable(prefix + "ResponseCode", errorResponse.getErrorCode())
+ taskProcessor.logDebug("Sub Vnf flow Error WorkflowException " + prefix + "ErrorResponse" + " - " +
+ errorResponse.getErrorMessage(), isDebugLogEnabled)
+ // this is the important part to ensure we hit the Fallout Handler
+ throw new BpmnError("MSOWorkflowException")
+ }
+ } catch (BpmnError e) {
+ throw e;
+ } catch (Exception e) {
+ taskProcessor.logError('Caught exception in ' + method, e)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 5000, 'Internal Error- Unable to validate VNF Response ' + e.getMessage())
+ }
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/MSOCommonApplication.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/MSOCommonApplication.java
index 9931247885..9100974596 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/MSOCommonApplication.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/MSOCommonApplication.java
@@ -1,59 +1,59 @@
-package org.openecomp.mso.bpmn.common;
-/*-
- * ============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=========================================================
- */
-
-
-
-import java.util.List;
-
-import org.camunda.bpm.application.PostDeploy;
-import org.camunda.bpm.application.PreUndeploy;
-import org.camunda.bpm.application.ProcessApplication;
-import org.camunda.bpm.application.ProcessApplicationInfo;
-import org.camunda.bpm.application.impl.ServletProcessApplication;
-import org.camunda.bpm.engine.ProcessEngine;
-
-import org.openecomp.mso.logger.MsoLogger;
-
-/**
- * @since Version 1.0
- *
- */
-@ProcessApplication("MSO Common Application")
-public class MSOCommonApplication extends ServletProcessApplication {
-
- private MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
-
- @PostDeploy
- public void postDeploy(ProcessEngine processEngineInstance) {
- long startTime = System.currentTimeMillis();
-
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Post deployment complete...");
- }
-
- @PreUndeploy
- public void cleanup(ProcessEngine processEngine, ProcessApplicationInfo processApplicationInfo, List<ProcessEngine> processEngines) {
- long startTime = System.currentTimeMillis();
-
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Pre Undeploy complete...");
-
- }
-
-}
+package org.openecomp.mso.bpmn.common;
+/*-
+ * ============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=========================================================
+ */
+
+
+
+import java.util.List;
+
+import org.camunda.bpm.application.PostDeploy;
+import org.camunda.bpm.application.PreUndeploy;
+import org.camunda.bpm.application.ProcessApplication;
+import org.camunda.bpm.application.ProcessApplicationInfo;
+import org.camunda.bpm.application.impl.ServletProcessApplication;
+import org.camunda.bpm.engine.ProcessEngine;
+
+import org.openecomp.mso.logger.MsoLogger;
+
+/**
+ * @since Version 1.0
+ *
+ */
+@ProcessApplication(name="MSO Common Application", deploymentDescriptors={"../processes.xml"})
+public class MSOCommonApplication extends ServletProcessApplication {
+
+ private MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
+
+ @PostDeploy
+ public void postDeploy(ProcessEngine processEngineInstance) {
+ long startTime = System.currentTimeMillis();
+
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Post deployment complete...");
+ }
+
+ @PreUndeploy
+ public void cleanup(ProcessEngine processEngine, ProcessApplicationInfo processApplicationInfo, List<ProcessEngine> processEngines) {
+ long startTime = System.currentTimeMillis();
+
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Pre Undeploy complete...");
+
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/ObjectFactory.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/ObjectFactory.java
index 2e0ae1b930..3d6570166d 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/ObjectFactory.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/ObjectFactory.java
@@ -1,91 +1,91 @@
-/*-
- * ============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.common.adapter.sdnc;
-
-import javax.xml.bind.annotation.XmlRegistry;
-
-
-/**
- * This object contains factory methods for each
- * Java content interface and Java element interface
- * generated in the org.openecomp.domain2.workflow.sdnc.adapter.schema.v1 package.
- * <p>An ObjectFactory allows you to programatically
- * construct new instances of the Java representation
- * for XML content. The Java representation of XML
- * content can consist of schema derived interfaces
- * and classes representing the binding of schema
- * type definitions, element declarations and model
- * groups. Factory methods for each of these are
- * provided in this class.
- *
- */
-@XmlRegistry
-public class ObjectFactory {
-
-
- /**
- * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.openecomp.domain2.workflow.sdnc.adapter.schema.v1
- *
- */
- public ObjectFactory() {
- }
-
- /**
- * Create an instance of {@link RequestHeader }
- *
- */
- public RequestHeader createRequestHeader() {
- return new RequestHeader();
- }
-
- /**
- * Create an instance of {@link SDNCAdapterResponse }
- *
- */
- public SDNCAdapterResponse createSDNCAdapterResponse() {
- return new SDNCAdapterResponse();
- }
-
- /**
- * Create an instance of {@link SDNCAdapterCallbackRequest }
- *
- */
- public SDNCAdapterCallbackRequest createSDNCAdapterCallbackRequest() {
- return new SDNCAdapterCallbackRequest();
- }
-
- /**
- * Create an instance of {@link CallbackHeader }
- *
- */
- public CallbackHeader createCallbackHeader() {
- return new CallbackHeader();
- }
-
- /**
- * Create an instance of {@link SDNCAdapterRequest }
- *
- */
- public SDNCAdapterRequest createSDNCAdapterRequest() {
- return new SDNCAdapterRequest();
- }
-
-}
+/*-
+ * ============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.common.adapter.sdnc;
+
+import javax.xml.bind.annotation.XmlRegistry;
+
+
+/**
+ * This object contains factory methods for each
+ * Java content interface and Java element interface
+ * generated in the org.openecomp.domain2.workflow.sdnc.adapter.schema.v1 package.
+ * <p>An ObjectFactory allows you to programatically
+ * construct new instances of the Java representation
+ * for XML content. The Java representation of XML
+ * content can consist of schema derived interfaces
+ * and classes representing the binding of schema
+ * type definitions, element declarations and model
+ * groups. Factory methods for each of these are
+ * provided in this class.
+ *
+ */
+@XmlRegistry
+public class ObjectFactory {
+
+
+ /**
+ * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.openecomp.domain2.workflow.sdnc.adapter.schema.v1
+ *
+ */
+ public ObjectFactory() {
+ }
+
+ /**
+ * Create an instance of {@link RequestHeader }
+ *
+ */
+ public RequestHeader createRequestHeader() {
+ return new RequestHeader();
+ }
+
+ /**
+ * Create an instance of {@link SDNCAdapterResponse }
+ *
+ */
+ public SDNCAdapterResponse createSDNCAdapterResponse() {
+ return new SDNCAdapterResponse();
+ }
+
+ /**
+ * Create an instance of {@link SDNCAdapterCallbackRequest }
+ *
+ */
+ public SDNCAdapterCallbackRequest createSDNCAdapterCallbackRequest() {
+ return new SDNCAdapterCallbackRequest();
+ }
+
+ /**
+ * Create an instance of {@link CallbackHeader }
+ *
+ */
+ public CallbackHeader createCallbackHeader() {
+ return new CallbackHeader();
+ }
+
+ /**
+ * Create an instance of {@link SDNCAdapterRequest }
+ *
+ */
+ public SDNCAdapterRequest createSDNCAdapterRequest() {
+ return new SDNCAdapterRequest();
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/RequestHeader.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/RequestHeader.java
index 27b1245856..f2e4de88d6 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/RequestHeader.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/RequestHeader.java
@@ -1,223 +1,223 @@
-/*-
- * ============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.common.adapter.sdnc;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- * <p>Java class for anonymous complex type.
- *
- * <p>The following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * &lt;complexType>
- * &lt;complexContent>
- * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * &lt;sequence>
- * &lt;element name="RequestId" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * &lt;element name="SvcInstanceId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * &lt;element name="SvcAction" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * &lt;element name="SvcOperation" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * &lt;element name="CallbackUrl" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * &lt;element name="MsoAction" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * &lt;/sequence>
- * &lt;/restriction>
- * &lt;/complexContent>
- * &lt;/complexType>
- * </pre>
- *
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "", propOrder = {
- "requestId",
- "svcInstanceId",
- "svcAction",
- "svcOperation",
- "callbackUrl",
- "msoAction"
-})
-@XmlRootElement(name = "RequestHeader")
-public class RequestHeader {
-
- @XmlElement(name = "RequestId", required = true)
- protected String requestId;
- @XmlElement(name = "SvcInstanceId")
- protected String svcInstanceId;
- @XmlElement(name = "SvcAction", required = true)
- protected String svcAction;
- @XmlElement(name = "SvcOperation", required = true)
- protected String svcOperation;
- @XmlElement(name = "CallbackUrl", required = true)
- protected String callbackUrl;
- @XmlElement(name = "MsoAction")
- protected String msoAction;
-
- /**
- * Gets the value of the requestId property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getRequestId() {
- return requestId;
- }
-
- /**
- * Sets the value of the requestId property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setRequestId(String value) {
- this.requestId = value;
- }
-
- /**
- * Gets the value of the svcInstanceId property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getSvcInstanceId() {
- return svcInstanceId;
- }
-
- /**
- * Sets the value of the svcInstanceId property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setSvcInstanceId(String value) {
- this.svcInstanceId = value;
- }
-
- /**
- * Gets the value of the svcAction property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getSvcAction() {
- return svcAction;
- }
-
- /**
- * Sets the value of the svcAction property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setSvcAction(String value) {
- this.svcAction = value;
- }
-
- /**
- * Gets the value of the svcOperation property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getSvcOperation() {
- return svcOperation;
- }
-
- /**
- * Sets the value of the svcOperation property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setSvcOperation(String value) {
- this.svcOperation = value;
- }
-
- /**
- * Gets the value of the callbackUrl property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getCallbackUrl() {
- return callbackUrl;
- }
-
- /**
- * Sets the value of the callbackUrl property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setCallbackUrl(String value) {
- this.callbackUrl = value;
- }
-
- /**
- * Gets the value of the msoAction property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getMsoAction() {
- return msoAction;
- }
-
- /**
- * Sets the value of the msoAction property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setMsoAction(String value) {
- this.msoAction = value;
- }
-
-}
+/*-
+ * ============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.common.adapter.sdnc;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for anonymous complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType>
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="RequestId" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="SvcInstanceId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="SvcAction" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="SvcOperation" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="CallbackUrl" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="MsoAction" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = {
+ "requestId",
+ "svcInstanceId",
+ "svcAction",
+ "svcOperation",
+ "callbackUrl",
+ "msoAction"
+})
+@XmlRootElement(name = "RequestHeader")
+public class RequestHeader {
+
+ @XmlElement(name = "RequestId", required = true)
+ protected String requestId;
+ @XmlElement(name = "SvcInstanceId")
+ protected String svcInstanceId;
+ @XmlElement(name = "SvcAction", required = true)
+ protected String svcAction;
+ @XmlElement(name = "SvcOperation", required = true)
+ protected String svcOperation;
+ @XmlElement(name = "CallbackUrl", required = true)
+ protected String callbackUrl;
+ @XmlElement(name = "MsoAction")
+ protected String msoAction;
+
+ /**
+ * Gets the value of the requestId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getRequestId() {
+ return requestId;
+ }
+
+ /**
+ * Sets the value of the requestId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setRequestId(String value) {
+ this.requestId = value;
+ }
+
+ /**
+ * Gets the value of the svcInstanceId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getSvcInstanceId() {
+ return svcInstanceId;
+ }
+
+ /**
+ * Sets the value of the svcInstanceId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setSvcInstanceId(String value) {
+ this.svcInstanceId = value;
+ }
+
+ /**
+ * Gets the value of the svcAction property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getSvcAction() {
+ return svcAction;
+ }
+
+ /**
+ * Sets the value of the svcAction property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setSvcAction(String value) {
+ this.svcAction = value;
+ }
+
+ /**
+ * Gets the value of the svcOperation property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getSvcOperation() {
+ return svcOperation;
+ }
+
+ /**
+ * Sets the value of the svcOperation property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setSvcOperation(String value) {
+ this.svcOperation = value;
+ }
+
+ /**
+ * Gets the value of the callbackUrl property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getCallbackUrl() {
+ return callbackUrl;
+ }
+
+ /**
+ * Sets the value of the callbackUrl property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setCallbackUrl(String value) {
+ this.callbackUrl = value;
+ }
+
+ /**
+ * Gets the value of the msoAction property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getMsoAction() {
+ return msoAction;
+ }
+
+ /**
+ * Sets the value of the msoAction property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setMsoAction(String value) {
+ this.msoAction = value;
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/SDNCAdapterResponse.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/SDNCAdapterResponse.java
index 829af2c20b..2c38abe4ff 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/SDNCAdapterResponse.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/sdnc/SDNCAdapterResponse.java
@@ -1,51 +1,51 @@
-/*-
- * ============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.common.adapter.sdnc;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- * <p>Java class for anonymous complex type.
- *
- * <p>The following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * &lt;complexType>
- * &lt;complexContent>
- * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * &lt;/restriction>
- * &lt;/complexContent>
- * &lt;/complexType>
- * </pre>
- *
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "")
-@XmlRootElement(name = "SDNCAdapterResponse")
-public class SDNCAdapterResponse {
-
-
-}
+/*-
+ * ============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.common.adapter.sdnc;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for anonymous complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType>
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "")
+@XmlRootElement(name = "SDNCAdapterResponse")
+public class SDNCAdapterResponse {
+
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/DeleteVnfNotification.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/DeleteVnfNotification.java
index b408184ae3..0cbb988e3b 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/DeleteVnfNotification.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/DeleteVnfNotification.java
@@ -1,198 +1,198 @@
-/*-
- * ============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.common.adapter.vnf;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- * <p>Java class for deleteVnfNotification complex type.
- *
- * <p>The following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * &lt;complexType name="deleteVnfNotification">
- * &lt;complexContent>
- * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * &lt;sequence>
- * &lt;element name="messageId" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * &lt;element name="completed" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
- * &lt;element name="exception" type="{http://org.openecomp.mso/vnfNotify}msoExceptionCategory" minOccurs="0"/>
- * &lt;element name="errorMessage" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * &lt;/sequence>
- * &lt;/restriction>
- * &lt;/complexContent>
- * &lt;/complexType>
- * </pre>
- *
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "deleteVnfNotification1", propOrder = {
- "messageId",
- "completed",
- "exception",
- "errorMessage"
-})
-public class DeleteVnfNotification {
-
- @XmlElement(required = true)
- protected String messageId;
- protected boolean completed;
- protected MsoExceptionCategory exception;
- protected String errorMessage;
-
- /**
- * Gets the value of the messageId property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getMessageId() {
- return messageId;
- }
-
- /**
- * Sets the value of the messageId property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setMessageId(String value) {
- this.messageId = value;
- }
-
- /**
- * Gets the value of the completed property.
- *
- */
- public boolean isCompleted() {
- return completed;
- }
-
- /**
- * Sets the value of the completed property.
- *
- */
- public void setCompleted(boolean value) {
- this.completed = value;
- }
-
- /**
- * Gets the value of the exception property.
- *
- * @return
- * possible object is
- * {@link MsoExceptionCategory }
- *
- */
- public MsoExceptionCategory getException() {
- return exception;
- }
-
- /**
- * Sets the value of the exception property.
- *
- * @param value
- * allowed object is
- * {@link MsoExceptionCategory }
- *
- */
- public void setException(MsoExceptionCategory value) {
- this.exception = value;
- }
-
- /**
- * Gets the value of the errorMessage property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getErrorMessage() {
- return errorMessage;
- }
-
- /**
- * Sets the value of the errorMessage property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setErrorMessage(String value) {
- this.errorMessage = value;
- }
-
- /**
- * Overrides toString() method
- * @return String type (deleteVnfNotification)
- */
-
-
- public String toString() {
- String deleteVnfNotification = "";
- if (exception==null) {
- deleteVnfNotification = "<ns2:deleteVnfNotification xmlns:ns2=\"http://org.openecomp.mso/vnfNotify\"" + '\n' +
- " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' +
- " <messageId>"+messageId+"</messageId>" + '\n' +
- " <completed>"+completed+"</completed>" + '\n' +
- "</ns2:deleteVnfNotification>";
- } else {
- deleteVnfNotification = "<ns2:deleteVnfNotification xmlns:ns2=\"http://org.openecomp.mso/vnfNotify\"" + '\n' +
- " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' +
- " <messageId>"+messageId+"</messageId>" + '\n' +
- " <completed>"+completed+"</completed>" + '\n' +
- " <exception>"+exception+"</exception>" + '\n' +
- " <errorMessage>"+errorMessage+"</errorMessage>" + '\n' +
- "</ns2:deleteVnfNotification>";
- }
- return deleteVnfNotification;
- }
-
-/*
- public String toString() {
- StringWriter writer = new StringWriter();
- try {
- JAXBContext context = JAXBContext
- .newInstance(DeleteVnfNotification.class);
- Marshaller m = context.createMarshaller();
- m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
- m.marshal(this, writer);
- //System.out.println("toString() - " + writer.getBuffer().toString());
- return writer.getBuffer().toString();
- } catch (JAXBException e) {
- //System.out.println("JAXBException - " + e.getStackTrace());
- return "";
- }
- }
-*/
-
-}
+/*-
+ * ============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.common.adapter.vnf;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for deleteVnfNotification complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType name="deleteVnfNotification">
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="messageId" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="completed" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
+ * &lt;element name="exception" type="{http://org.openecomp.mso/vnfNotify}msoExceptionCategory" minOccurs="0"/>
+ * &lt;element name="errorMessage" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "deleteVnfNotification1", propOrder = {
+ "messageId",
+ "completed",
+ "exception",
+ "errorMessage"
+})
+public class DeleteVnfNotification {
+
+ @XmlElement(required = true)
+ protected String messageId;
+ protected boolean completed;
+ protected MsoExceptionCategory exception;
+ protected String errorMessage;
+
+ /**
+ * Gets the value of the messageId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getMessageId() {
+ return messageId;
+ }
+
+ /**
+ * Sets the value of the messageId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setMessageId(String value) {
+ this.messageId = value;
+ }
+
+ /**
+ * Gets the value of the completed property.
+ *
+ */
+ public boolean isCompleted() {
+ return completed;
+ }
+
+ /**
+ * Sets the value of the completed property.
+ *
+ */
+ public void setCompleted(boolean value) {
+ this.completed = value;
+ }
+
+ /**
+ * Gets the value of the exception property.
+ *
+ * @return
+ * possible object is
+ * {@link MsoExceptionCategory }
+ *
+ */
+ public MsoExceptionCategory getException() {
+ return exception;
+ }
+
+ /**
+ * Sets the value of the exception property.
+ *
+ * @param value
+ * allowed object is
+ * {@link MsoExceptionCategory }
+ *
+ */
+ public void setException(MsoExceptionCategory value) {
+ this.exception = value;
+ }
+
+ /**
+ * Gets the value of the errorMessage property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getErrorMessage() {
+ return errorMessage;
+ }
+
+ /**
+ * Sets the value of the errorMessage property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setErrorMessage(String value) {
+ this.errorMessage = value;
+ }
+
+ /**
+ * Overrides toString() method
+ * @return String type (deleteVnfNotification)
+ */
+
+
+ public String toString() {
+ String deleteVnfNotification = "";
+ if (exception==null) {
+ deleteVnfNotification = "<ns2:deleteVnfNotification xmlns:ns2=\"http://org.openecomp.mso/vnfNotify\"" + '\n' +
+ " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' +
+ " <messageId>"+messageId+"</messageId>" + '\n' +
+ " <completed>"+completed+"</completed>" + '\n' +
+ "</ns2:deleteVnfNotification>";
+ } else {
+ deleteVnfNotification = "<ns2:deleteVnfNotification xmlns:ns2=\"http://org.openecomp.mso/vnfNotify\"" + '\n' +
+ " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' +
+ " <messageId>"+messageId+"</messageId>" + '\n' +
+ " <completed>"+completed+"</completed>" + '\n' +
+ " <exception>"+exception+"</exception>" + '\n' +
+ " <errorMessage>"+errorMessage+"</errorMessage>" + '\n' +
+ "</ns2:deleteVnfNotification>";
+ }
+ return deleteVnfNotification;
+ }
+
+/*
+ public String toString() {
+ StringWriter writer = new StringWriter();
+ try {
+ JAXBContext context = JAXBContext
+ .newInstance(DeleteVnfNotification.class);
+ Marshaller m = context.createMarshaller();
+ m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
+ m.marshal(this, writer);
+ //System.out.println("toString() - " + writer.getBuffer().toString());
+ return writer.getBuffer().toString();
+ } catch (JAXBException e) {
+ //System.out.println("JAXBException - " + e.getStackTrace());
+ return "";
+ }
+ }
+*/
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/MsoExceptionCategory.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/MsoExceptionCategory.java
index 80673a0fb6..444ef982fd 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/MsoExceptionCategory.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/MsoExceptionCategory.java
@@ -1,61 +1,61 @@
-/*-
- * ============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.common.adapter.vnf;
-
-import javax.xml.bind.annotation.XmlEnum;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- * <p>Java class for msoExceptionCategory.
- *
- * <p>The following schema fragment specifies the expected content contained within this class.
- * <p>
- * <pre>
- * &lt;simpleType name="msoExceptionCategory">
- * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string">
- * &lt;enumeration value="OPENSTACK"/>
- * &lt;enumeration value="IO"/>
- * &lt;enumeration value="INTERNAL"/>
- * &lt;enumeration value="USERDATA"/>
- * &lt;/restriction>
- * &lt;/simpleType>
- * </pre>
- *
- */
-@XmlType(name = "msoExceptionCategory")
-@XmlEnum
-public enum MsoExceptionCategory {
-
- OPENSTACK,
- IO,
- INTERNAL,
- USERDATA;
-
- public String value() {
- return name();
- }
-
- public static MsoExceptionCategory fromValue(String v) {
- return valueOf(v);
- }
-
-}
+/*-
+ * ============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.common.adapter.vnf;
+
+import javax.xml.bind.annotation.XmlEnum;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for msoExceptionCategory.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ * <p>
+ * <pre>
+ * &lt;simpleType name="msoExceptionCategory">
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ * &lt;enumeration value="OPENSTACK"/>
+ * &lt;enumeration value="IO"/>
+ * &lt;enumeration value="INTERNAL"/>
+ * &lt;enumeration value="USERDATA"/>
+ * &lt;/restriction>
+ * &lt;/simpleType>
+ * </pre>
+ *
+ */
+@XmlType(name = "msoExceptionCategory")
+@XmlEnum
+public enum MsoExceptionCategory {
+
+ OPENSTACK,
+ IO,
+ INTERNAL,
+ USERDATA;
+
+ public String value() {
+ return name();
+ }
+
+ public static MsoExceptionCategory fromValue(String v) {
+ return valueOf(v);
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/MsoRequest.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/MsoRequest.java
index f251a31ce8..01a6705898 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/MsoRequest.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/MsoRequest.java
@@ -1,114 +1,114 @@
-/*-
- * ============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.common.adapter.vnf;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- * <p>Java class for msoRequest complex type.
- *
- * <p>The following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * &lt;complexType name="msoRequest">
- * &lt;complexContent>
- * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * &lt;sequence>
- * &lt;element name="requestId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * &lt;element name="serviceInstanceId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * &lt;/sequence>
- * &lt;/restriction>
- * &lt;/complexContent>
- * &lt;/complexType>
- * </pre>
- *
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "msoRequest", propOrder = {
- "requestId",
- "serviceInstanceId"
-})
-public class MsoRequest {
-
- protected String requestId;
- protected String serviceInstanceId;
-
- /**
- * Gets the value of the requestId property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getRequestId() {
- return requestId;
- }
-
- /**
- * Sets the value of the requestId property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setRequestId(String value) {
- this.requestId = value;
- }
-
- /**
- * Gets the value of the serviceInstanceId property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getServiceInstanceId() {
- return serviceInstanceId;
- }
-
- /**
- * Sets the value of the serviceInstanceId property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setServiceInstanceId(String value) {
- this.serviceInstanceId = value;
- }
-
- public String toString() {
- String request = "";
- request =
- "<requestId>"+requestId+"</requestId>" + '\n' +
- "<serviceInstanceId>"+serviceInstanceId+"</serviceInstanceId>";
- return request;
- }
-
-}
+/*-
+ * ============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.common.adapter.vnf;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for msoRequest complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType name="msoRequest">
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="requestId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="serviceInstanceId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "msoRequest", propOrder = {
+ "requestId",
+ "serviceInstanceId"
+})
+public class MsoRequest {
+
+ protected String requestId;
+ protected String serviceInstanceId;
+
+ /**
+ * Gets the value of the requestId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getRequestId() {
+ return requestId;
+ }
+
+ /**
+ * Sets the value of the requestId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setRequestId(String value) {
+ this.requestId = value;
+ }
+
+ /**
+ * Gets the value of the serviceInstanceId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getServiceInstanceId() {
+ return serviceInstanceId;
+ }
+
+ /**
+ * Sets the value of the serviceInstanceId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setServiceInstanceId(String value) {
+ this.serviceInstanceId = value;
+ }
+
+ public String toString() {
+ String request = "";
+ request =
+ "<requestId>"+requestId+"</requestId>" + '\n' +
+ "<serviceInstanceId>"+serviceInstanceId+"</serviceInstanceId>";
+ return request;
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/QueryVnfNotification.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/QueryVnfNotification.java
index 47ae04577e..b7b93b7b5d 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/QueryVnfNotification.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/QueryVnfNotification.java
@@ -1,488 +1,488 @@
-/*-
- * ============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.common.adapter.vnf;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- * <p>Java class for queryVnfNotification complex type.
- *
- * <p>The following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * &lt;complexType name="queryVnfNotification">
- * &lt;complexContent>
- * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * &lt;sequence>
- * &lt;element name="messageId" type="{http://www.w3.org/2001/XMLSchema}string"/>
- * &lt;element name="completed" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
- * &lt;element name="exception" type="{http://org.openecomp.mso/vnfNotify}msoExceptionCategory" minOccurs="0"/>
- * &lt;element name="errorMessage" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * &lt;element name="vnfExists" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
- * &lt;element name="vnfId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * &lt;element name="status" type="{http://org.openecomp.mso/vnfNotify}vnfStatus" minOccurs="0"/>
- * &lt;element name="outputs" minOccurs="0">
- * &lt;complexType>
- * &lt;complexContent>
- * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * &lt;sequence>
- * &lt;element name="entry" maxOccurs="unbounded" minOccurs="0">
- * &lt;complexType>
- * &lt;complexContent>
- * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * &lt;sequence>
- * &lt;element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * &lt;element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * &lt;/sequence>
- * &lt;/restriction>
- * &lt;/complexContent>
- * &lt;/complexType>
- * &lt;/element>
- * &lt;/sequence>
- * &lt;/restriction>
- * &lt;/complexContent>
- * &lt;/complexType>
- * &lt;/element>
- * &lt;/sequence>
- * &lt;/restriction>
- * &lt;/complexContent>
- * &lt;/complexType>
- * </pre>
- *
- *
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "queryVnfNotification1", propOrder = {
- "messageId",
- "completed",
- "exception",
- "errorMessage",
- "vnfExists",
- "vnfId",
- "status",
- "outputs"
-})
-public class QueryVnfNotification {
-
- @XmlElement(required = true)
- protected String messageId;
- protected boolean completed;
- protected MsoExceptionCategory exception;
- protected String errorMessage;
- protected Boolean vnfExists;
- protected String vnfId;
- protected VnfStatus status;
- protected QueryVnfNotification.Outputs outputs;
-
- /**
- * Gets the value of the messageId property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getMessageId() {
- return messageId;
- }
-
- /**
- * Sets the value of the messageId property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setMessageId(String value) {
- this.messageId = value;
- }
-
- /**
- * Gets the value of the completed property.
- *
- */
- public boolean isCompleted() {
- return completed;
- }
-
- /**
- * Sets the value of the completed property.
- *
- */
- public void setCompleted(boolean value) {
- this.completed = value;
- }
-
- /**
- * Gets the value of the exception property.
- *
- * @return
- * possible object is
- * {@link MsoExceptionCategory }
- *
- */
- public MsoExceptionCategory getException() {
- return exception;
- }
-
- /**
- * Sets the value of the exception property.
- *
- * @param value
- * allowed object is
- * {@link MsoExceptionCategory }
- *
- */
- public void setException(MsoExceptionCategory value) {
- this.exception = value;
- }
-
- /**
- * Gets the value of the errorMessage property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getErrorMessage() {
- return errorMessage;
- }
-
- /**
- * Sets the value of the errorMessage property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setErrorMessage(String value) {
- this.errorMessage = value;
- }
-
- /**
- * Gets the value of the vnfExists property.
- *
- * @return
- * possible object is
- * {@link Boolean }
- *
- */
- public Boolean isVnfExists() {
- return vnfExists;
- }
-
- /**
- * Sets the value of the vnfExists property.
- *
- * @param value
- * allowed object is
- * {@link Boolean }
- *
- */
- public void setVnfExists(Boolean value) {
- this.vnfExists = value;
- }
-
- /**
- * Gets the value of the vnfId property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getVnfId() {
- return vnfId;
- }
-
- /**
- * Sets the value of the vnfId property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setVnfId(String value) {
- this.vnfId = value;
- }
-
- /**
- * Gets the value of the status property.
- *
- * @return
- * possible object is
- * {@link VnfStatus }
- *
- */
- public VnfStatus getStatus() {
- return status;
- }
-
- /**
- * Sets the value of the status property.
- *
- * @param value
- * allowed object is
- * {@link VnfStatus }
- *
- */
- public void setStatus(VnfStatus value) {
- this.status = value;
- }
-
- /**
- * Gets the value of the outputs property.
- *
- * @return
- * possible object is
- * {@link QueryVnfNotification.Outputs }
- *
- */
- public QueryVnfNotification.Outputs getOutputs() {
- return outputs;
- }
-
- /**
- * Sets the value of the outputs property.
- *
- * @param value
- * allowed object is
- * {@link QueryVnfNotification.Outputs }
- *
- */
- public void setOutputs(QueryVnfNotification.Outputs value) {
- this.outputs = value;
- }
-
-
- /**
- * <p>Java class for anonymous complex type.
- *
- * <p>The following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * &lt;complexType>
- * &lt;complexContent>
- * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * &lt;sequence>
- * &lt;element name="entry" maxOccurs="unbounded" minOccurs="0">
- * &lt;complexType>
- * &lt;complexContent>
- * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * &lt;sequence>
- * &lt;element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * &lt;element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * &lt;/sequence>
- * &lt;/restriction>
- * &lt;/complexContent>
- * &lt;/complexType>
- * &lt;/element>
- * &lt;/sequence>
- * &lt;/restriction>
- * &lt;/complexContent>
- * &lt;/complexType>
- * </pre>
- *
- *
- */
- @XmlAccessorType(XmlAccessType.FIELD)
- @XmlType(name = "", propOrder = {
- "entry"
- })
- public static class Outputs {
-
- protected List<QueryVnfNotification.Outputs.Entry> entry;
-
- /**
- * Gets the value of the entry property.
- *
- * <p>
- * This accessor method returns a reference to the live list,
- * not a snapshot. Therefore any modification you make to the
- * returned list will be present inside the JAXB object.
- * This is why there is not a <CODE>set</CODE> method for the entry property.
- *
- * <p>
- * For example, to add a new item, do as follows:
- * <pre>
- * getEntry().add(newItem);
- * </pre>
- *
- *
- * <p>
- * Objects of the following type(s) are allowed in the list
- * {@link QueryVnfNotification.Outputs.Entry }
- *
- *
- */
- public List<QueryVnfNotification.Outputs.Entry> getEntry() {
- if (entry == null) {
- entry = new ArrayList<QueryVnfNotification.Outputs.Entry>();
- }
- return this.entry;
- }
-
- // Not a generated method
- public String toString() {
- StringBuilder out = new StringBuilder();
- out.append("<outputs>\n");
- if (entry != null) {
- for (Entry e : entry) {
- out.append(e.toString());
- out.append('\n');
- }
- }
- out.append("</outputs>");
- return out.toString();
- }
-
-
- /**
- * <p>Java class for anonymous complex type.
- *
- * <p>The following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * &lt;complexType>
- * &lt;complexContent>
- * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * &lt;sequence>
- * &lt;element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * &lt;element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
- * &lt;/sequence>
- * &lt;/restriction>
- * &lt;/complexContent>
- * &lt;/complexType>
- * </pre>
- *
- *
- */
- @XmlAccessorType(XmlAccessType.FIELD)
- @XmlType(name = "", propOrder = {
- "key",
- "value"
- })
- public static class Entry {
-
- protected String key;
- protected String value;
-
- /**
- * Gets the value of the key property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getKey() {
- return key;
- }
-
- /**
- * Sets the value of the key property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setKey(String value) {
- this.key = value;
- }
-
- /**
- * Gets the value of the value property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getValue() {
- return value;
- }
-
- /**
- * Sets the value of the value property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setValue(String value) {
- this.value = value;
- }
-
- // Not a generated method
- public String toString() {
- String entry = "";
- entry =
- "<entry>"+ '\n' +
- " <key>"+key+"</key>" + '\n' +
- " <value>"+value+"</value>" + '\n' +
- "</entry>";
- return entry;
- }
-
- }
-
- }
-
- // Not a generated method
- public String toString() {
- String queryVnfNotification = "";
- if (exception==null) {
- queryVnfNotification = "<ns2:queryVnfNotification xmlns:ns2=\"http://org.openecomp.mso/vnfNotify\"" + '\n' +
- " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' +
- " <messageId>"+messageId+"</messageId>" + '\n' +
- " <completed>"+completed+"</completed>" + '\n' +
- " <vnfExists>"+vnfExists+"</vnfExists>" + '\n' +
- " <vnfId>"+vnfId+"</vnfId>" + '\n' +
- " <status>"+status+"</status>" + '\n' +
- (outputs == null ? "" : outputs.toString() + '\n') +
- "</ns2:queryVnfNotification>";
- } else {
- queryVnfNotification = "<ns2:queryVnfNotification xmlns:ns2=\"http://org.openecomp.mso/vnfNotify\"" + '\n' +
- " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' +
- " <messageId>"+messageId+"</messageId>" + '\n' +
- " <completed>"+completed+"</completed>" + '\n' +
- (outputs == null ? "" : outputs.toString() + '\n') +
- " <exception>"+exception+"</exception>" + '\n' +
- " <errorMessage>"+errorMessage+"</errorMessage>" + '\n' +
- "</ns2:queryVnfNotification>";
- }
- return queryVnfNotification;
- }
-
-}
+/*-
+ * ============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.common.adapter.vnf;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for queryVnfNotification complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType name="queryVnfNotification">
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="messageId" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="completed" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
+ * &lt;element name="exception" type="{http://org.openecomp.mso/vnfNotify}msoExceptionCategory" minOccurs="0"/>
+ * &lt;element name="errorMessage" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="vnfExists" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
+ * &lt;element name="vnfId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="status" type="{http://org.openecomp.mso/vnfNotify}vnfStatus" minOccurs="0"/>
+ * &lt;element name="outputs" minOccurs="0">
+ * &lt;complexType>
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="entry" maxOccurs="unbounded" minOccurs="0">
+ * &lt;complexType>
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * &lt;/element>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * &lt;/element>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "queryVnfNotification1", propOrder = {
+ "messageId",
+ "completed",
+ "exception",
+ "errorMessage",
+ "vnfExists",
+ "vnfId",
+ "status",
+ "outputs"
+})
+public class QueryVnfNotification {
+
+ @XmlElement(required = true)
+ protected String messageId;
+ protected boolean completed;
+ protected MsoExceptionCategory exception;
+ protected String errorMessage;
+ protected Boolean vnfExists;
+ protected String vnfId;
+ protected VnfStatus status;
+ protected QueryVnfNotification.Outputs outputs;
+
+ /**
+ * Gets the value of the messageId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getMessageId() {
+ return messageId;
+ }
+
+ /**
+ * Sets the value of the messageId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setMessageId(String value) {
+ this.messageId = value;
+ }
+
+ /**
+ * Gets the value of the completed property.
+ *
+ */
+ public boolean isCompleted() {
+ return completed;
+ }
+
+ /**
+ * Sets the value of the completed property.
+ *
+ */
+ public void setCompleted(boolean value) {
+ this.completed = value;
+ }
+
+ /**
+ * Gets the value of the exception property.
+ *
+ * @return
+ * possible object is
+ * {@link MsoExceptionCategory }
+ *
+ */
+ public MsoExceptionCategory getException() {
+ return exception;
+ }
+
+ /**
+ * Sets the value of the exception property.
+ *
+ * @param value
+ * allowed object is
+ * {@link MsoExceptionCategory }
+ *
+ */
+ public void setException(MsoExceptionCategory value) {
+ this.exception = value;
+ }
+
+ /**
+ * Gets the value of the errorMessage property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getErrorMessage() {
+ return errorMessage;
+ }
+
+ /**
+ * Sets the value of the errorMessage property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setErrorMessage(String value) {
+ this.errorMessage = value;
+ }
+
+ /**
+ * Gets the value of the vnfExists property.
+ *
+ * @return
+ * possible object is
+ * {@link Boolean }
+ *
+ */
+ public Boolean isVnfExists() {
+ return vnfExists;
+ }
+
+ /**
+ * Sets the value of the vnfExists property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Boolean }
+ *
+ */
+ public void setVnfExists(Boolean value) {
+ this.vnfExists = value;
+ }
+
+ /**
+ * Gets the value of the vnfId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getVnfId() {
+ return vnfId;
+ }
+
+ /**
+ * Sets the value of the vnfId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setVnfId(String value) {
+ this.vnfId = value;
+ }
+
+ /**
+ * Gets the value of the status property.
+ *
+ * @return
+ * possible object is
+ * {@link VnfStatus }
+ *
+ */
+ public VnfStatus getStatus() {
+ return status;
+ }
+
+ /**
+ * Sets the value of the status property.
+ *
+ * @param value
+ * allowed object is
+ * {@link VnfStatus }
+ *
+ */
+ public void setStatus(VnfStatus value) {
+ this.status = value;
+ }
+
+ /**
+ * Gets the value of the outputs property.
+ *
+ * @return
+ * possible object is
+ * {@link QueryVnfNotification.Outputs }
+ *
+ */
+ public QueryVnfNotification.Outputs getOutputs() {
+ return outputs;
+ }
+
+ /**
+ * Sets the value of the outputs property.
+ *
+ * @param value
+ * allowed object is
+ * {@link QueryVnfNotification.Outputs }
+ *
+ */
+ public void setOutputs(QueryVnfNotification.Outputs value) {
+ this.outputs = value;
+ }
+
+
+ /**
+ * <p>Java class for anonymous complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType>
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="entry" maxOccurs="unbounded" minOccurs="0">
+ * &lt;complexType>
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * &lt;/element>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+ @XmlAccessorType(XmlAccessType.FIELD)
+ @XmlType(name = "", propOrder = {
+ "entry"
+ })
+ public static class Outputs {
+
+ protected List<QueryVnfNotification.Outputs.Entry> entry;
+
+ /**
+ * Gets the value of the entry property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the entry property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getEntry().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link QueryVnfNotification.Outputs.Entry }
+ *
+ *
+ */
+ public List<QueryVnfNotification.Outputs.Entry> getEntry() {
+ if (entry == null) {
+ entry = new ArrayList<QueryVnfNotification.Outputs.Entry>();
+ }
+ return this.entry;
+ }
+
+ // Not a generated method
+ public String toString() {
+ StringBuilder out = new StringBuilder();
+ out.append("<outputs>\n");
+ if (entry != null) {
+ for (Entry e : entry) {
+ out.append(e.toString());
+ out.append('\n');
+ }
+ }
+ out.append("</outputs>");
+ return out.toString();
+ }
+
+
+ /**
+ * <p>Java class for anonymous complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType>
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+ @XmlAccessorType(XmlAccessType.FIELD)
+ @XmlType(name = "", propOrder = {
+ "key",
+ "value"
+ })
+ public static class Entry {
+
+ protected String key;
+ protected String value;
+
+ /**
+ * Gets the value of the key property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getKey() {
+ return key;
+ }
+
+ /**
+ * Sets the value of the key property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setKey(String value) {
+ this.key = value;
+ }
+
+ /**
+ * Gets the value of the value property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getValue() {
+ return value;
+ }
+
+ /**
+ * Sets the value of the value property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ // Not a generated method
+ public String toString() {
+ String entry = "";
+ entry =
+ "<entry>"+ '\n' +
+ " <key>"+key+"</key>" + '\n' +
+ " <value>"+value+"</value>" + '\n' +
+ "</entry>";
+ return entry;
+ }
+
+ }
+
+ }
+
+ // Not a generated method
+ public String toString() {
+ String queryVnfNotification = "";
+ if (exception==null) {
+ queryVnfNotification = "<ns2:queryVnfNotification xmlns:ns2=\"http://org.openecomp.mso/vnfNotify\"" + '\n' +
+ " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' +
+ " <messageId>"+messageId+"</messageId>" + '\n' +
+ " <completed>"+completed+"</completed>" + '\n' +
+ " <vnfExists>"+vnfExists+"</vnfExists>" + '\n' +
+ " <vnfId>"+vnfId+"</vnfId>" + '\n' +
+ " <status>"+status+"</status>" + '\n' +
+ (outputs == null ? "" : outputs.toString() + '\n') +
+ "</ns2:queryVnfNotification>";
+ } else {
+ queryVnfNotification = "<ns2:queryVnfNotification xmlns:ns2=\"http://org.openecomp.mso/vnfNotify\"" + '\n' +
+ " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' +
+ " <messageId>"+messageId+"</messageId>" + '\n' +
+ " <completed>"+completed+"</completed>" + '\n' +
+ (outputs == null ? "" : outputs.toString() + '\n') +
+ " <exception>"+exception+"</exception>" + '\n' +
+ " <errorMessage>"+errorMessage+"</errorMessage>" + '\n' +
+ "</ns2:queryVnfNotification>";
+ }
+ return queryVnfNotification;
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfStatus.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfStatus.java
index a9b2ee2732..62026fb888 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfStatus.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/adapter/vnf/VnfStatus.java
@@ -1,61 +1,61 @@
-/*-
- * ============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.common.adapter.vnf;
-
-import javax.xml.bind.annotation.XmlEnum;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- * <p>Java class for vnfStatus.
- *
- * <p>The following schema fragment specifies the expected content contained within this class.
- * <p>
- * <pre>
- * &lt;simpleType name="vnfStatus">
- * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string">
- * &lt;enumeration value="ACTIVE"/>
- * &lt;enumeration value="FAILED"/>
- * &lt;enumeration value="NOTFOUND"/>
- * &lt;enumeration value="UNKNOWN"/>
- * &lt;/restriction>
- * &lt;/simpleType>
- * </pre>
- *
- */
-@XmlType(name = "vnfStatus")
-@XmlEnum
-public enum VnfStatus {
-
- ACTIVE,
- FAILED,
- NOTFOUND,
- UNKNOWN;
-
- public String value() {
- return name();
- }
-
- public static VnfStatus fromValue(String v) {
- return valueOf(v);
- }
-
-}
+/*-
+ * ============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.common.adapter.vnf;
+
+import javax.xml.bind.annotation.XmlEnum;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for vnfStatus.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ * <p>
+ * <pre>
+ * &lt;simpleType name="vnfStatus">
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ * &lt;enumeration value="ACTIVE"/>
+ * &lt;enumeration value="FAILED"/>
+ * &lt;enumeration value="NOTFOUND"/>
+ * &lt;enumeration value="UNKNOWN"/>
+ * &lt;/restriction>
+ * &lt;/simpleType>
+ * </pre>
+ *
+ */
+@XmlType(name = "vnfStatus")
+@XmlEnum
+public enum VnfStatus {
+
+ ACTIVE,
+ FAILED,
+ NOTFOUND,
+ UNKNOWN;
+
+ public String value() {
+ return name();
+ }
+
+ public static VnfStatus fromValue(String v) {
+ return valueOf(v);
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/CryptoHandler.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/CryptoHandler.java
index 1759b208b7..da1f177ea2 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/CryptoHandler.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/CryptoHandler.java
@@ -1,57 +1,57 @@
-/*-
- * ============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.common.util;
-
-import java.security.GeneralSecurityException;
-
-public class CryptoHandler implements ICryptoHandler {
-
- private static String msoKey = "aa3871669d893c7fb8abbcda31b88b4f";
- //private static String msoAaiPwd = "mso0206";
- private static String msoAaiEncryptedPwd = "C1FC4A39E16419DD41DFC1212843F440";
-
- public String getMsoAaiPassword() {
- try {
- return CryptoUtils.decrypt(msoAaiEncryptedPwd, msoKey);
- } catch (GeneralSecurityException e) {
- return null;
- }
- }
-
-
- public String encryptMsoPassword(String plainMsoPwd) {
- try {
- return CryptoUtils.encrypt(plainMsoPwd, msoKey);
- } catch (GeneralSecurityException e) {
- return null;
- }
- }
-
-
- public String decryptMsoPassword(String encryptedPwd) {
- try {
- return CryptoUtils.decrypt(encryptedPwd, msoKey);
- } catch (GeneralSecurityException e) {
- return null;
- }
- }
-
-}
+/*-
+ * ============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.common.util;
+
+import java.security.GeneralSecurityException;
+
+public class CryptoHandler implements ICryptoHandler {
+
+ private static String msoKey = "aa3871669d893c7fb8abbcda31b88b4f";
+ //private static String msoAaiPwd = "mso0206";
+ private static String msoAaiEncryptedPwd = "C1FC4A39E16419DD41DFC1212843F440";
+
+ public String getMsoAaiPassword() {
+ try {
+ return CryptoUtils.decrypt(msoAaiEncryptedPwd, msoKey);
+ } catch (GeneralSecurityException e) {
+ return null;
+ }
+ }
+
+
+ public String encryptMsoPassword(String plainMsoPwd) {
+ try {
+ return CryptoUtils.encrypt(plainMsoPwd, msoKey);
+ } catch (GeneralSecurityException e) {
+ return null;
+ }
+ }
+
+
+ public String decryptMsoPassword(String encryptedPwd) {
+ try {
+ return CryptoUtils.decrypt(encryptedPwd, msoKey);
+ } catch (GeneralSecurityException e) {
+ return null;
+ }
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/CryptoUtils.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/CryptoUtils.java
index 70aeda01b0..6237735691 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/CryptoUtils.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/CryptoUtils.java
@@ -1,118 +1,118 @@
-/*-
- * ============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.common.util;
-
-
-import java.security.GeneralSecurityException;
-import java.security.NoSuchAlgorithmException;
-
-import javax.crypto.Cipher;
-import javax.crypto.spec.SecretKeySpec;
-
-//Need to add BPM error handler
-
-/**
- * CryptoUtils adapted from RTTP client.
- *
- */
-public class CryptoUtils {
-
- public static final String AES = "AES";
-
- /**
- * encrypt a value and generate a keyfile
- * if the keyfile is not found then a new one is created
- * @throws GeneralSecurityException
- * @throws IOException
- */
- public static String encrypt(String value, String keyString) throws GeneralSecurityException
- {
- SecretKeySpec sks = getSecretKeySpec(keyString);
- Cipher cipher = Cipher.getInstance(CryptoUtils.AES);
- cipher.init(Cipher.ENCRYPT_MODE, sks, cipher.getParameters());
- byte[] encrypted = cipher.doFinal(value.getBytes());
- return byteArrayToHexString(encrypted);
- }
-
- /**
- * decrypt a value
- * @throws GeneralSecurityException
- * @throws IOException
- */
- public static String decrypt(String message, String keyString) throws GeneralSecurityException
- {
- SecretKeySpec sks = getSecretKeySpec(keyString);
- Cipher cipher = Cipher.getInstance(CryptoUtils.AES);
- cipher.init(Cipher.DECRYPT_MODE, sks);
- byte[] decrypted = cipher.doFinal(hexStringToByteArray(message));
- return new String(decrypted);
- }
-
- private static SecretKeySpec getSecretKeySpec(String keyString) throws NoSuchAlgorithmException
- {
- byte [] key = hexStringToByteArray(keyString);
- SecretKeySpec sks = new SecretKeySpec(key, CryptoUtils.AES);
- return sks;
- }
-
-
- private static String byteArrayToHexString(byte[] b){
- StringBuffer sb = new StringBuffer(b.length * 2);
- for (int i = 0; i < b.length; i++){
- int v = b[i] & 0xff;
- if (v < 16) {
- sb.append('0');
- }
- sb.append(Integer.toHexString(v));
- }
- return sb.toString().toUpperCase();
- }
-
- private static byte[] hexStringToByteArray(String s) {
- byte[] b = new byte[s.length() / 2];
- for (int i = 0; i < b.length; i++){
- int index = i * 2;
- int v = Integer.parseInt(s.substring(index, index + 2), 16);
- b[i] = (byte)v;
- }
- return b;
- }
-
- /**
- * Not Used...
- *
- * Call Rttp utility jar to encrypt pwd
- * @param clearPassword
- * @return
- * @throws GeneralSecurityException
- * @throws Exception
- *
- public static String encryptRttpPwd(String clearPassword) throws GeneralSecurityException {
- try {
- return RttpBasicAuth.encrypt(clearPassword);
- } catch (Exception e) {
- // wrap generic exception
- throw new GeneralSecurityException(e);
- }
- }
- */
-}
-
+/*-
+ * ============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.common.util;
+
+
+import java.security.GeneralSecurityException;
+import java.security.NoSuchAlgorithmException;
+
+import javax.crypto.Cipher;
+import javax.crypto.spec.SecretKeySpec;
+
+//Need to add BPM error handler
+
+/**
+ * CryptoUtils adapted from RTTP client.
+ *
+ */
+public class CryptoUtils {
+
+ public static final String AES = "AES";
+
+ /**
+ * encrypt a value and generate a keyfile
+ * if the keyfile is not found then a new one is created
+ * @throws GeneralSecurityException
+ * @throws IOException
+ */
+ public static String encrypt(String value, String keyString) throws GeneralSecurityException
+ {
+ SecretKeySpec sks = getSecretKeySpec(keyString);
+ Cipher cipher = Cipher.getInstance(CryptoUtils.AES);
+ cipher.init(Cipher.ENCRYPT_MODE, sks, cipher.getParameters());
+ byte[] encrypted = cipher.doFinal(value.getBytes());
+ return byteArrayToHexString(encrypted);
+ }
+
+ /**
+ * decrypt a value
+ * @throws GeneralSecurityException
+ * @throws IOException
+ */
+ public static String decrypt(String message, String keyString) throws GeneralSecurityException
+ {
+ SecretKeySpec sks = getSecretKeySpec(keyString);
+ Cipher cipher = Cipher.getInstance(CryptoUtils.AES);
+ cipher.init(Cipher.DECRYPT_MODE, sks);
+ byte[] decrypted = cipher.doFinal(hexStringToByteArray(message));
+ return new String(decrypted);
+ }
+
+ private static SecretKeySpec getSecretKeySpec(String keyString) throws NoSuchAlgorithmException
+ {
+ byte [] key = hexStringToByteArray(keyString);
+ SecretKeySpec sks = new SecretKeySpec(key, CryptoUtils.AES);
+ return sks;
+ }
+
+
+ private static String byteArrayToHexString(byte[] b){
+ StringBuffer sb = new StringBuffer(b.length * 2);
+ for (int i = 0; i < b.length; i++){
+ int v = b[i] & 0xff;
+ if (v < 16) {
+ sb.append('0');
+ }
+ sb.append(Integer.toHexString(v));
+ }
+ return sb.toString().toUpperCase();
+ }
+
+ private static byte[] hexStringToByteArray(String s) {
+ byte[] b = new byte[s.length() / 2];
+ for (int i = 0; i < b.length; i++){
+ int index = i * 2;
+ int v = Integer.parseInt(s.substring(index, index + 2), 16);
+ b[i] = (byte)v;
+ }
+ return b;
+ }
+
+ /**
+ * Not Used...
+ *
+ * Call Rttp utility jar to encrypt pwd
+ * @param clearPassword
+ * @return
+ * @throws GeneralSecurityException
+ * @throws Exception
+ *
+ public static String encryptRttpPwd(String clearPassword) throws GeneralSecurityException {
+ try {
+ return RttpBasicAuth.encrypt(clearPassword);
+ } catch (Exception e) {
+ // wrap generic exception
+ throw new GeneralSecurityException(e);
+ }
+ }
+ */
+}
+
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/ICryptoHandler.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/ICryptoHandler.java
index 8d4f167596..bc74be05a7 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/ICryptoHandler.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/util/ICryptoHandler.java
@@ -1,27 +1,27 @@
-/*-
- * ============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.common.util;
-
-public interface ICryptoHandler {
- public String getMsoAaiPassword();
- public String encryptMsoPassword(String plainPwd);
- public String decryptMsoPassword(String encryptedPwd);
-}
+/*-
+ * ============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.common.util;
+
+public interface ICryptoHandler {
+ public String getMsoAaiPassword();
+ public String encryptMsoPassword(String plainPwd);
+ public String decryptMsoPassword(String encryptedPwd);
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/SDNCAdapterCallbackServiceImpl.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/SDNCAdapterCallbackServiceImpl.java
index 02a471c971..4585d620ac 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/SDNCAdapterCallbackServiceImpl.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/SDNCAdapterCallbackServiceImpl.java
@@ -1,254 +1,280 @@
-/*-
- * ============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.common.workflow.service;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.jws.WebMethod;
-import javax.jws.WebParam;
-import javax.jws.WebResult;
-import javax.jws.WebService;
-import javax.ws.rs.core.Context;
-import javax.xml.ws.WebServiceContext;
-
-import org.camunda.bpm.BpmPlatform;
-import org.camunda.bpm.engine.MismatchingMessageCorrelationException;
-import org.camunda.bpm.engine.ProcessEngineServices;
-import org.camunda.bpm.engine.RuntimeService;
-import org.openecomp.mso.bpmn.common.adapter.sdnc.SDNCAdapterCallbackRequest;
-import org.openecomp.mso.bpmn.common.adapter.sdnc.SDNCAdapterResponse;
-import org.openecomp.mso.bpmn.common.adapter.sdnc.SDNCCallbackAdapterPortType;
-import org.openecomp.mso.bpmn.core.PropertyConfiguration;
-import org.openecomp.mso.logger.MessageEnum;
-import org.openecomp.mso.logger.MsoLogger;
-/**
- * @version 1.0
- *
- */
-@WebService(serviceName="SDNCAdapterCallbackService", targetNamespace="http://org.openecomp/workflow/sdnc/adapter/schema/v1")
-public class SDNCAdapterCallbackServiceImpl implements SDNCCallbackAdapterPortType {
-
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
- private final int DEFAULT_RETRY_ATTEMPTS = 60;
- private final int DEFAULT_SLEEP_TIME = 500;
-
- private final String logMarker = "[SDNC-CALLBACK]";
-
- @Context WebServiceContext wsContext;
-
- private volatile ProcessEngineServices pes4junit = null;
-
- @WebMethod(operationName = "SDNCAdapterCallback")
- @WebResult(name = "SDNCAdapterResponse", targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/schema/v1", partName = "SDNCAdapterCallbackResponse")
- public SDNCAdapterResponse sdncAdapterCallback(
- @WebParam(name = "SDNCAdapterCallbackRequest", targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/schema/v1", partName = "SDNCAdapterCallbackRequest")
- SDNCAdapterCallbackRequest sdncAdapterCallbackRequest) {
-
- //Callback URL to use http://localhost:28080/mso/SDNCAdapterCallbackService
- ProcessEngineServices pes = getProcessEngineServices();
- RuntimeService runtimeService = pes.getRuntimeService();
- String receivedRequestId = sdncAdapterCallbackRequest.getCallbackHeader().getRequestId();
- MsoLogger.setServiceName("MSO." + "sdncAdapter");
- MsoLogger.setLogContext(receivedRequestId, "N/A");
- msoLogger.debug(logMarker + "Received callback response:" + sdncAdapterCallbackRequest.toString());
- SDNCAdapterResponse sdncAdapterResponse;
- long startTime = System.currentTimeMillis();
-
- /* Check to make sure the process instance is reay for correlation*/
- isReadyforCorrelation(runtimeService, receivedRequestId);
-
- msoLogger.debug(logMarker + "*** Received MSO sdncAdapterCallbackService ******");
-
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Call to MSO sdncAdapterCallbackService");
-
- msoLogger.debug(logMarker + "Callback response string:\n" + sdncAdapterCallbackRequest.toString());
-
- String reqId = receivedRequestId;
- Map<String,Object> variables = new HashMap<String,Object>();
- variables.put("SDNCA_requestId", reqId );
- variables.put("sdncAdapterCallbackRequest", sdncAdapterCallbackRequest.toString());
-
- /*Correlating the response with the running instance*/
-
- // NOTE: the following loop is a workaround for problems we've had
- // with reliability of the runtime service. It seems that queries
- // sometimes return results, and sometimes they don't. This might
- // be a problem in mysql only. We aren't sure if it affects camunda
- // on oracle or mariadb. The workaround is to repeat the request
- // a number of times until it succeeds. If it doesn't succeed after
- // 60 tries, then we give up.
-
- int maxAttempts = DEFAULT_RETRY_ATTEMPTS;
- int attempt = 1;
- int sleepTime = DEFAULT_SLEEP_TIME;
-
- Map<String,String> bpmnProperties = getMSOBPMNURNProperties();
- if (bpmnProperties != null) {
- try {
- maxAttempts = Integer.parseInt(bpmnProperties.get("mso.callbackRetryAttempts"));
- msoLogger.debug(logMarker + "mso.callbackRetryAttempts=" + maxAttempts);
- sleepTime = Integer.parseInt(bpmnProperties.get("mso.callbackRetrySleepTime"));
- msoLogger.debug(logMarker + "mso.callbackRetrySleepTime:" + sleepTime);
- } catch (Exception ex) {
-
- msoLogger.info (MessageEnum.BPMN_SDNC_CALLBACK_EXCEPTION, "BPMN", logMarker
- + "Error parsing mso.callbackRetrySleepTime/mso.callbackRetryAttempts:"
- + sleepTime + ":"
- + maxAttempts);
-
- msoLogger.error (MessageEnum.BPMN_SDNC_CALLBACK_EXCEPTION, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, logMarker
- + "Error parsing mso.callbackRetrySleepTime/mso.callbackRetryAttempts:"
- + sleepTime + ":"
- + maxAttempts);
-
- }
- }
-
- while (true) {
- try {
- // sdncAdapterCallbackRequest is the message event name (defined in the bpmn process)
- runtimeService.createMessageCorrelation("sdncAdapterCallbackRequest")
- .setVariables(variables)
- .processInstanceVariableEquals("SDNCA_requestId", reqId).correlate();
- sdncAdapterResponse = new SDNCAdapterResponse();
- msoLogger.debug(logMarker + "***** Completed processing of MSO sdncAdapterCallbackService ******");
-
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, logMarker
- + "Completed the execution of MSO SDNCAdapterCallbackService.");
-
- msoLogger.recordMetricEvent ( startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- logMarker + "Completed the execution of MSO SDNCAdapterCallbackService.", "BPMN",
- MsoLogger.getServiceName(), "sdncAdapterCallback");
-
- return sdncAdapterResponse;
- } catch(MismatchingMessageCorrelationException e) {
- msoLogger.debug(logMarker + "[CORM]correlation id mismatch (attempt " + attempt + "/" + maxAttempts + ")");
- if (attempt == maxAttempts) {
- // Couldn't correlate requestId to any active flow
- //MsoLogger logger = MsoLogger.getMsoLogger("SDNCAdapterCallbackService");
- String msg =
- "SDNC Adapter Callback Service received a SDNC Adapter Callback Request with RequestId '"
- + receivedRequestId
- + "' but that RequestId could not be correlated to any active process - ignoring the Request";
- sdncAdapterResponse = new SDNCAdapterExceptionResponse(e);
-
- msoLogger.error (MessageEnum.BPMN_SDNC_CALLBACK_EXCEPTION, "BPMN", MsoLogger.getServiceName(),
- MsoLogger.ErrorCode.UnknownError, logMarker + ":" + msg, e);
-
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, logMarker
- + "Completed the execution of MSO SDNCAdapterCallbackService." );
-
- msoLogger.recordMetricEvent ( startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- logMarker + "Completed the execution of MSO SDNCAdapterCallbackService.", "BPMN",
- MsoLogger.getServiceName(), "sdncAdapterCallback");
-
- return sdncAdapterResponse;
- }
-
- try {
- Thread.sleep(sleepTime);
- } catch (InterruptedException e2) {
- String msg =
- "SDNC Adapter Callback Service received a SDNC Adapter Callback Request with RequestId '"
- + receivedRequestId
- + "' but correlation was interrupted";
- sdncAdapterResponse = new SDNCAdapterExceptionResponse(e);
-
- msoLogger.error (MessageEnum.BPMN_SDNC_CALLBACK_EXCEPTION, "BPMN", MsoLogger.getServiceName(),
- MsoLogger.ErrorCode.UnknownError, logMarker + ":" + msg, e);
-
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, logMarker
- + "Completed the execution of MSO SDNCAdapterCallbackService.");
-
- msoLogger.recordMetricEvent ( startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- logMarker + "Completed the execution of MSO SDNCAdapterCallbackService.", "BPMN",
- MsoLogger.getServiceName(), "sdncAdapterCallback");
-
- return sdncAdapterResponse;
- }
- }
-
- attempt++;
- }
- }
-
-
- private Map<String,String> getMSOBPMNURNProperties() {
- PropertyConfiguration propertyConfiguration = PropertyConfiguration.getInstance();
- Map<String,String> props = propertyConfiguration.getProperties("mso.bpmn.urn.properties");
- return props;
- }
-
- private void isReadyforCorrelation(RuntimeService runtimeService,
- String receivedRequestId) {
- long waitingInstances = runtimeService.createExecutionQuery() //
- .messageEventSubscriptionName("sdncAdapterCallbackRequest")
- .processVariableValueEquals("SDNCA_requestId", receivedRequestId).count();
- //Workaround for performance testing, explicit wait for a second for the transactions to be committed
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e1) {
- }
-
- int retries = 50;
- while (waitingInstances==0 && retries > 0) {
- try {
- Thread.sleep(100);
- } catch (InterruptedException e) {
-
- msoLogger.error (MessageEnum.BPMN_SDNC_CALLBACK_EXCEPTION, "BPMN", MsoLogger.getServiceName(),
- MsoLogger.ErrorCode.UnknownError, logMarker, e);
-
- } // you can still play with the numbers
- waitingInstances = runtimeService.createExecutionQuery() //
- .messageEventSubscriptionName("sdncAdapterCallbackRequest")
- .processVariableValueEquals("SDNCA_requestId", receivedRequestId).count();
- retries--;
- }
- }
-
- private ProcessEngineServices getProcessEngineServices() {
- if (pes4junit == null) {
- return BpmPlatform.getDefaultProcessEngine();
- } else {
- return pes4junit;
- }
- }
-
- @WebMethod(exclude=true)
- public void setProcessEngineServices4junit(ProcessEngineServices pes) {
- pes4junit = pes;
- }
-
- public class SDNCAdapterExceptionResponse extends SDNCAdapterResponse {
- private Exception ex;
-
- public SDNCAdapterExceptionResponse(Exception ex) {
- super();
- this.ex = ex;
- }
-
- public Exception getException() {
- return ex;
- }
- }
-}
+/*-
+ * ============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.common.workflow.service;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebResult;
+import javax.jws.WebService;
+import javax.ws.rs.core.Context;
+import javax.xml.ws.WebServiceContext;
+
+import org.camunda.bpm.BpmPlatform;
+import org.camunda.bpm.engine.MismatchingMessageCorrelationException;
+import org.camunda.bpm.engine.ProcessEngineServices;
+import org.camunda.bpm.engine.RuntimeService;
+import org.camunda.bpm.engine.runtime.ExecutionQuery;
+import org.openecomp.mso.bpmn.common.adapter.sdnc.SDNCAdapterCallbackRequest;
+import org.openecomp.mso.bpmn.common.adapter.sdnc.SDNCAdapterResponse;
+import org.openecomp.mso.bpmn.common.adapter.sdnc.SDNCCallbackAdapterPortType;
+import org.openecomp.mso.bpmn.core.PropertyConfiguration;
+import org.openecomp.mso.logger.MessageEnum;
+import org.openecomp.mso.logger.MsoLogger;
+/**
+ * @version 1.0
+ *
+ */
+@WebService(serviceName="SDNCAdapterCallbackService", targetNamespace="http://org.openecomp/workflow/sdnc/adapter/schema/v1")
+public class SDNCAdapterCallbackServiceImpl implements SDNCCallbackAdapterPortType {
+
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
+ private final int DEFAULT_RETRY_ATTEMPTS = 60;
+ private final int DEFAULT_SLEEP_TIME = 500;
+
+ private final String logMarker = "[SDNC-CALLBACK]";
+
+ @Context WebServiceContext wsContext;
+
+ private volatile ProcessEngineServices pes4junit = null;
+
+ @WebMethod(operationName = "SDNCAdapterCallback")
+ @WebResult(name = "SDNCAdapterResponse", targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/schema/v1", partName = "SDNCAdapterCallbackResponse")
+ public SDNCAdapterResponse sdncAdapterCallback(
+ @WebParam(name = "SDNCAdapterCallbackRequest", targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/schema/v1", partName = "SDNCAdapterCallbackRequest")
+ SDNCAdapterCallbackRequest sdncAdapterCallbackRequest) {
+
+ //Callback URL to use http://localhost:28080/mso/SDNCAdapterCallbackService
+ ProcessEngineServices pes = getProcessEngineServices();
+ RuntimeService runtimeService = pes.getRuntimeService();
+ String receivedRequestId = sdncAdapterCallbackRequest.getCallbackHeader().getRequestId();
+ MsoLogger.setServiceName("MSO." + "sdncAdapter");
+ MsoLogger.setLogContext(receivedRequestId, "N/A");
+ msoLogger.debug(logMarker + "Received callback response:" + sdncAdapterCallbackRequest.toString());
+ SDNCAdapterResponse sdncAdapterResponse;
+ long startTime = System.currentTimeMillis();
+
+ /*Correlating the response with the running instance*/
+
+ // NOTE: the following loop is a workaround for problems we've had
+ // with reliability of the runtime service. It seems that queries
+ // sometimes return results, and sometimes they don't. This might
+ // be a problem in mysql only. We aren't sure if it affects camunda
+ // on oracle or mariadb. The workaround is to repeat the request
+ // a number of times until it succeeds. If it doesn't succeed after
+ // 60 tries, then we give up.
+
+ int maxAttempts = DEFAULT_RETRY_ATTEMPTS;
+ int attempt = 1;
+ int sleepTime = DEFAULT_SLEEP_TIME;
+
+ Map<String,String> bpmnProperties = getMSOBPMNURNProperties();
+ if (bpmnProperties != null) {
+ try {
+ maxAttempts = Integer.parseInt(bpmnProperties.get("mso.callbackRetryAttempts"));
+ msoLogger.debug(logMarker + "mso.callbackRetryAttempts=" + maxAttempts);
+ sleepTime = Integer.parseInt(bpmnProperties.get("mso.callbackRetrySleepTime"));
+ msoLogger.debug(logMarker + "mso.callbackRetrySleepTime:" + sleepTime);
+ } catch (Exception ex) {
+
+ msoLogger.debug (logMarker
+ + "Error parsing mso.callbackRetrySleepTime/mso.callbackRetryAttempts:"
+ + sleepTime + ":"
+ + maxAttempts);
+
+ }
+ }
+
+ /* Check to make sure the process instance is reay for correlation*/
+ try{
+ isReadyforCorrelation(runtimeService, receivedRequestId, maxAttempts, sleepTime );
+ }catch(Exception e){
+ String msg =
+ "SDNC Adapter Callback Service received a SDNC Adapter Callback Request with RequestId '"
+ + receivedRequestId
+ + "' but that RequestId doesn't exist or has timed out waiting for the callback";
+ sdncAdapterResponse = new SDNCAdapterExceptionResponse(e);
+
+ msoLogger.error (MessageEnum.BPMN_SDNC_CALLBACK_EXCEPTION, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError, logMarker + ":" + msg, e);
+
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, logMarker
+ + "Completed the execution of MSO SDNCAdapterCallbackService." );
+
+ msoLogger.recordMetricEvent ( startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
+ logMarker + "Completed the execution of MSO SDNCAdapterCallbackService.", "BPMN",
+ MsoLogger.getServiceName(), "sdncAdapterCallback");
+
+ return sdncAdapterResponse;
+ }
+
+ msoLogger.debug(logMarker + "*** Received MSO sdncAdapterCallbackService ******");
+
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Call to MSO sdncAdapterCallbackService");
+
+ msoLogger.debug(logMarker + "Callback response string:\n" + sdncAdapterCallbackRequest.toString());
+
+ String reqId = receivedRequestId;
+ Map<String,Object> variables = new HashMap<String,Object>();
+ variables.put("SDNCA_requestId", reqId );
+ variables.put("sdncAdapterCallbackRequest", sdncAdapterCallbackRequest.toString());
+ while (true) {
+ try {
+ // sdncAdapterCallbackRequest is the message event name (defined in the bpmn process)
+ runtimeService.createMessageCorrelation("sdncAdapterCallbackRequest")
+ .setVariables(variables)
+ .processInstanceVariableEquals("SDNCA_requestId", reqId).correlate();
+ sdncAdapterResponse = new SDNCAdapterResponse();
+ msoLogger.debug(logMarker + "***** Completed processing of MSO sdncAdapterCallbackService ******");
+
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, logMarker
+ + "Completed the execution of MSO SDNCAdapterCallbackService.");
+
+ msoLogger.recordMetricEvent ( startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
+ logMarker + "Completed the execution of MSO SDNCAdapterCallbackService.", "BPMN",
+ MsoLogger.getServiceName(), "sdncAdapterCallback");
+
+ return sdncAdapterResponse;
+ } catch(MismatchingMessageCorrelationException e) {
+ msoLogger.debug(logMarker + "[CORM]correlation id mismatch (attempt " + attempt + "/" + maxAttempts + ")");
+ if (attempt == maxAttempts) {
+ // Couldn't correlate requestId to any active flow
+ //MsoLogger logger = MsoLogger.getMsoLogger("SDNCAdapterCallbackService");
+ String msg =
+ "SDNC Adapter Callback Service received a SDNC Adapter Callback Request with RequestId '"
+ + receivedRequestId
+ + "' but that RequestId could not be correlated to any active process - ignoring the Request";
+ sdncAdapterResponse = new SDNCAdapterExceptionResponse(e);
+
+ msoLogger.error (MessageEnum.BPMN_SDNC_CALLBACK_EXCEPTION, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError, logMarker + ":" + msg, e);
+
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, logMarker
+ + "Completed the execution of MSO SDNCAdapterCallbackService." );
+
+ msoLogger.recordMetricEvent ( startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
+ logMarker + "Completed the execution of MSO SDNCAdapterCallbackService.", "BPMN",
+ MsoLogger.getServiceName(), "sdncAdapterCallback");
+
+ return sdncAdapterResponse;
+ }
+
+ try {
+ Thread.sleep(sleepTime);
+ } catch (InterruptedException e2) {
+ String msg =
+ "SDNC Adapter Callback Service received a SDNC Adapter Callback Request with RequestId '"
+ + receivedRequestId
+ + "' but correlation was interrupted";
+ sdncAdapterResponse = new SDNCAdapterExceptionResponse(e);
+
+ msoLogger.error (MessageEnum.BPMN_SDNC_CALLBACK_EXCEPTION, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError, logMarker + ":" + msg, e);
+
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, logMarker
+ + "Completed the execution of MSO SDNCAdapterCallbackService.");
+
+ msoLogger.recordMetricEvent ( startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
+ logMarker + "Completed the execution of MSO SDNCAdapterCallbackService.", "BPMN",
+ MsoLogger.getServiceName(), "sdncAdapterCallback");
+
+ return sdncAdapterResponse;
+ }
+ }
+
+ attempt++;
+ }
+ }
+
+
+ private Map<String,String> getMSOBPMNURNProperties() {
+ PropertyConfiguration propertyConfiguration = PropertyConfiguration.getInstance();
+ Map<String,String> props = propertyConfiguration.getProperties("mso.bpmn.urn.properties");
+ return props;
+ }
+
+ private void isReadyforCorrelation(RuntimeService runtimeService,
+ String receivedRequestId, int retries, int sleepTime){
+ ExecutionQuery waitingInstances = null;
+ long waitingInstancesCount = 0;
+
+ //Workaround for performance testing, explicit wait for a second for the transactions to be committed
+ //Also check to make sure the process didn't timeout before trying to correlate
+
+ do{
+ waitingInstances = runtimeService.createExecutionQuery() //
+ .messageEventSubscriptionName("sdncAdapterCallbackRequest")
+ .processVariableValueEquals("SDNCA_requestId", receivedRequestId);
+ waitingInstancesCount = waitingInstances.count();
+ retries--;
+ msoLogger.debug(logMarker + "waitingInstancesCount: " + waitingInstancesCount);
+ try {
+ Thread.sleep(sleepTime);
+ } catch (InterruptedException e) {
+
+ msoLogger.error (MessageEnum.BPMN_SDNC_CALLBACK_EXCEPTION, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError, logMarker, e);
+
+ }
+ }while (waitingInstancesCount==0 && retries > 0);
+ if(waitingInstancesCount > 0){
+ msoLogger.debug(logMarker + "waitingInstancesCount before timeout check: " + waitingInstancesCount);
+ waitingInstancesCount = waitingInstances.processVariableValueEquals("asynchronousResponseTimeout", false).count();
+ msoLogger.debug(logMarker + "waitingInstancesCount after timeout check: " + waitingInstancesCount);
+ if(waitingInstancesCount<=0){
+ msoLogger.debug(logMarker + "detected timeout on flow to correlate");
+ throw new IllegalStateException("process timed out");
+ }
+ }else{
+ //flow may have already ended, so can't check timeout variable. Throw exception?
+ msoLogger.debug(logMarker + "no flow to correlate to");
+ throw new IllegalStateException("no flow to correlate to");
+ }
+ }
+
+ private ProcessEngineServices getProcessEngineServices() {
+ if (pes4junit == null) {
+ return BpmPlatform.getDefaultProcessEngine();
+ } else {
+ return pes4junit;
+ }
+ }
+
+ @WebMethod(exclude=true)
+ public void setProcessEngineServices4junit(ProcessEngineServices pes) {
+ pes4junit = pes;
+ }
+
+ public class SDNCAdapterExceptionResponse extends SDNCAdapterResponse {
+ private Exception ex;
+
+ public SDNCAdapterExceptionResponse(Exception ex) {
+ super();
+ this.ex = ex;
+ }
+
+ public Exception getException() {
+ return ex;
+ }
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowAsyncCommonResource.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowAsyncCommonResource.java
index 5abd4e91da..c0ea0cf874 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowAsyncCommonResource.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowAsyncCommonResource.java
@@ -1,36 +1,36 @@
-/*-
- * ============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.common.workflow.service;
-
-import org.camunda.bpm.engine.ProcessEngineServices;
-import org.camunda.bpm.engine.ProcessEngines;
-
-
-public class WorkflowAsyncCommonResource extends WorkflowAsyncResource {
-
- protected ProcessEngineServices getProcessEngineServices() {
- if (pes4junit == null) {
- return ProcessEngines.getProcessEngine("common");
- } else {
- return pes4junit;
- }
- }
-}
+/*-
+ * ============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.common.workflow.service;
+
+import org.camunda.bpm.engine.ProcessEngineServices;
+import org.camunda.bpm.engine.ProcessEngines;
+
+
+public class WorkflowAsyncCommonResource extends WorkflowAsyncResource {
+
+ protected ProcessEngineServices getProcessEngineServices() {
+ if (pes4junit == null) {
+ return ProcessEngines.getProcessEngine("common");
+ } else {
+ return pes4junit;
+ }
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowAsyncResource.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowAsyncResource.java
index 28541930ab..b13ac46784 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowAsyncResource.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowAsyncResource.java
@@ -1,293 +1,293 @@
-/*-
- * ============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.common.workflow.service;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.UUID;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.Response;
-
-import org.camunda.bpm.engine.ProcessEngineServices;
-import org.camunda.bpm.engine.ProcessEngines;
-import org.camunda.bpm.engine.RuntimeService;
-import org.camunda.bpm.engine.runtime.ProcessInstance;
-import org.camunda.bpm.engine.variable.impl.VariableMapImpl;
-import org.jboss.resteasy.annotations.Suspend;
-import org.jboss.resteasy.spi.AsynchronousResponse;
-import org.openecomp.mso.logger.MessageEnum;
-import org.openecomp.mso.logger.MsoLogger;
-import org.slf4j.MDC;
-
-/**
- *
- * @version 1.0
- * Asynchronous Workflow processing using JAX RS RESTeasy implementation
- * Both Synchronous and Asynchronous BPMN process can benefit from this implementation since the workflow gets executed in the background
- * and the server thread is freed up, server scales better to process more incoming requests
- *
- * Usage: For synchronous process, when you are ready to send the response invoke the callback to write the response
- * For asynchronous process - the activity may send a acknowledgement response and then proceed further on executing the process
- */
-@Path("/async")
+/*-
+ * ============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.common.workflow.service;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Response;
+
+import org.camunda.bpm.engine.ProcessEngineServices;
+import org.camunda.bpm.engine.ProcessEngines;
+import org.camunda.bpm.engine.RuntimeService;
+import org.camunda.bpm.engine.runtime.ProcessInstance;
+import org.camunda.bpm.engine.variable.impl.VariableMapImpl;
+import org.jboss.resteasy.annotations.Suspend;
+import org.jboss.resteasy.spi.AsynchronousResponse;
+import org.openecomp.mso.logger.MessageEnum;
+import org.openecomp.mso.logger.MsoLogger;
+import org.slf4j.MDC;
+
+/**
+ *
+ * @version 1.0
+ * Asynchronous Workflow processing using JAX RS RESTeasy implementation
+ * Both Synchronous and Asynchronous BPMN process can benefit from this implementation since the workflow gets executed in the background
+ * and the server thread is freed up, server scales better to process more incoming requests
+ *
+ * Usage: For synchronous process, when you are ready to send the response invoke the callback to write the response
+ * For asynchronous process - the activity may send a acknowledgement response and then proceed further on executing the process
+ */
+@Path("/async")
public abstract class WorkflowAsyncResource {
-
- private WorkflowContextHolder contextHolder = WorkflowContextHolder.getInstance();
- protected ProcessEngineServices pes4junit = null;
-
- private MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
-
- private static final String logMarker = "[WRKFLOW-RESOURCE]";
- private static final int DEFAULT_WAIT_TIME = 30000; //default wait time
-
- /**
- * Asynchronous JAX-RS method that starts a process instance.
- * @param asyncResponse an object that will receive the asynchronous response
- * @param processKey the process key
- * @param variableMap input variables to the process
- */
- @POST
- @Path("/services/{processKey}")
- @Produces("application/json")
- @Consumes("application/json")
- public void startProcessInstanceByKey(final @Suspend(180000) AsynchronousResponse asyncResponse,
- @PathParam("processKey") String processKey, VariableMapImpl variableMap) {
-
- WorkflowResponse response = new WorkflowResponse();
- long startTime = System.currentTimeMillis();
- Map<String, Object> inputVariables = null;
- WorkflowContext workflowContext = null;
-
- try {
- inputVariables = getInputVariables(variableMap);
- setLogContext(processKey, inputVariables);
-
- // This variable indicates that the flow was invoked asynchronously
- inputVariables.put("isAsyncProcess", "true");
-
- workflowContext = new WorkflowContext(processKey, getRequestId(inputVariables),
- asyncResponse, getWaitTime(inputVariables));
-
- msoLogger.debug("Adding the workflow context into holder: "
- + workflowContext.getProcessKey() + ":"
- + workflowContext.getRequestId() + ":"
- + workflowContext.getTimeout());
-
- contextHolder.put(workflowContext);
-
- ProcessThread processThread = new ProcessThread(processKey, inputVariables);
- processThread.start();
- } catch (Exception e) {
- setLogContext(processKey, inputVariables);
-
- if (workflowContext != null) {
- contextHolder.remove(workflowContext);
- }
-
- msoLogger.debug(logMarker + "Exception in startProcessInstance by key");
- response.setMessage("Fail" );
- response.setResponse("Error occurred while executing the process: " + e);
- response.setMessageCode(500);
- recordEvents(processKey, response, startTime);
-
- msoLogger.error (MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, logMarker
- + response.getMessage() + " for processKey: "
- + processKey + " with response: " + response.getResponse());
-
- Response errorResponse = Response.serverError().entity(response).build();
- asyncResponse.setResponse(errorResponse);
- }
- }
-
- /**
- *
- * @version 1.0
- *
- */
- class ProcessThread extends Thread {
- private final String processKey;
- private final Map<String,Object> inputVariables;
-
- public ProcessThread(String processKey, Map<String, Object> inputVariables) {
- this.processKey = processKey;
- this.inputVariables = inputVariables;
- }
-
- public void run() {
-
- String processInstanceId = null;
- long startTime = System.currentTimeMillis();
-
- try {
- setLogContext(processKey, inputVariables);
-
- // Note: this creates a random businessKey if it wasn't specified.
- String businessKey = getBusinessKey(inputVariables);
-
- msoLogger.debug(logMarker + "***Received MSO startProcessInstanceByKey with processKey: "
- + processKey + " and variables: " + inputVariables);
-
- msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, logMarker
- + "Call to MSO workflow/services in Camunda. Received MSO startProcessInstanceByKey with processKey:"
- + processKey + " and variables: " + inputVariables);
-
- RuntimeService runtimeService = getProcessEngineServices().getRuntimeService();
- ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(
- processKey, businessKey, inputVariables);
- processInstanceId = processInstance.getId();
-
- msoLogger.debug(logMarker + "Process " + processKey + ":" + processInstanceId + " " +
- (processInstance.isEnded() ? "ENDED" : "RUNNING"));
- } catch (Exception e) {
-
- msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError,
- logMarker + "Error in starting the process: "+ e.getMessage());
-
- WorkflowCallbackResponse callbackResponse = new WorkflowCallbackResponse();
- callbackResponse.setStatusCode(500);
- callbackResponse.setMessage("Fail");
- callbackResponse.setResponse("Error occurred while executing the process: " + e);
-
- // TODO: is the processInstanceId used by the API handler? I don't think so.
- // It may be null here.
- WorkflowContextHolder.getInstance().processCallback(
- processKey, processInstanceId,
- getRequestId(inputVariables),
- callbackResponse);
- }
- }
- }
-
-
- /**
- * Callback resource which is invoked from BPMN to process to send the workflow response
- *
- * @param processKey
- * @param processInstanceId
- * @param requestId
- * @param callbackResponse
- * @return
- */
- @POST
- @Path("/services/callback/{processKey}/{processInstanceId}/{requestId}")
- @Produces("application/json")
- @Consumes("application/json")
- public Response processWorkflowCallback(
- @PathParam("processKey") String processKey,
- @PathParam("processInstanceId") String processInstanceId,
- @PathParam("requestId")String requestId,
- WorkflowCallbackResponse callbackResponse) {
-
- msoLogger.debug(logMarker + "Process instance ID:" + processInstanceId + ":" + requestId + ":" + processKey + ":" + isProcessEnded(processInstanceId));
- msoLogger.debug(logMarker + "About to process the callback request:" + callbackResponse.getResponse() + ":" + callbackResponse.getMessage() + ":" + callbackResponse.getStatusCode());
- return contextHolder.processCallback(processKey, processInstanceId, requestId, callbackResponse);
- }
-
- // Note: the business key is used to identify the process in unit tests
- private String getBusinessKey(Map<String, Object> inputVariables) {
- Object businessKey = inputVariables.get("mso-business-key");
- if (businessKey == null ) {
- businessKey = UUID.randomUUID().toString();
- inputVariables.put("mso-business-key", businessKey);
- }
- return businessKey.toString();
- }
-
- private String getRequestId(Map<String, Object> inputVariables) {
- Object requestId = inputVariables.get("mso-request-id");
- if (requestId == null ) {
- requestId = UUID.randomUUID().toString();
- inputVariables.put("mso-request-id", requestId);
- }
- return requestId.toString();
- }
-
- private long getWaitTime(Map<String, Object> inputVariables)
- {
- String timeout = inputVariables.get("mso-service-request-timeout") == null
- ? null : inputVariables.get("mso-service-request-timeout").toString();
-
- if (timeout != null) {
- try {
- return Long.parseLong(timeout)*1000;
- } catch (NumberFormatException nex) {
- msoLogger.debug("Invalid input for mso-service-request-timeout");
- }
- }
-
- return DEFAULT_WAIT_TIME;
- }
-
- private void recordEvents(String processKey, WorkflowResponse response,
- long startTime) {
-
- msoLogger.recordMetricEvent ( startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- logMarker + response.getMessage() + " for processKey: "
- + processKey + " with response: " + response.getResponse(), "BPMN", MDC.get(processKey), null);
-
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- logMarker + response.getMessage() + "for processKey: " + processKey + " with response: " + response.getResponse());
-
- }
-
- private void setLogContext(String processKey,
- Map<String, Object> inputVariables) {
- MsoLogger.setServiceName("MSO." + processKey);
- if (inputVariables != null) {
- MsoLogger.setLogContext(getKeyValueFromInputVariables(inputVariables,"mso-request-id"), getKeyValueFromInputVariables(inputVariables,"mso-service-instance-id"));
- }
- }
-
- private String getKeyValueFromInputVariables(Map<String,Object> inputVariables, String key) {
- if (inputVariables == null) return "";
- Object requestId = inputVariables.get(key);
- if (requestId != null) return requestId.toString();
- return "N/A";
- }
-
- private boolean isProcessEnded(String processInstanceId) {
- ProcessEngineServices pes = getProcessEngineServices();
- return pes.getRuntimeService().createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult() == null ? true : false ;
- }
-
-
+
+ private WorkflowContextHolder contextHolder = WorkflowContextHolder.getInstance();
+ protected ProcessEngineServices pes4junit = null;
+
+ private MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
+
+ private static final String logMarker = "[WRKFLOW-RESOURCE]";
+ private static final int DEFAULT_WAIT_TIME = 30000; //default wait time
+
+ /**
+ * Asynchronous JAX-RS method that starts a process instance.
+ * @param asyncResponse an object that will receive the asynchronous response
+ * @param processKey the process key
+ * @param variableMap input variables to the process
+ */
+ @POST
+ @Path("/services/{processKey}")
+ @Produces("application/json")
+ @Consumes("application/json")
+ public void startProcessInstanceByKey(final @Suspend(180000) AsynchronousResponse asyncResponse,
+ @PathParam("processKey") String processKey, VariableMapImpl variableMap) {
+
+ WorkflowResponse response = new WorkflowResponse();
+ long startTime = System.currentTimeMillis();
+ Map<String, Object> inputVariables = null;
+ WorkflowContext workflowContext = null;
+
+ try {
+ inputVariables = getInputVariables(variableMap);
+ setLogContext(processKey, inputVariables);
+
+ // This variable indicates that the flow was invoked asynchronously
+ inputVariables.put("isAsyncProcess", "true");
+
+ workflowContext = new WorkflowContext(processKey, getRequestId(inputVariables),
+ asyncResponse, getWaitTime(inputVariables));
+
+ msoLogger.debug("Adding the workflow context into holder: "
+ + workflowContext.getProcessKey() + ":"
+ + workflowContext.getRequestId() + ":"
+ + workflowContext.getTimeout());
+
+ contextHolder.put(workflowContext);
+
+ ProcessThread processThread = new ProcessThread(processKey, inputVariables);
+ processThread.start();
+ } catch (Exception e) {
+ setLogContext(processKey, inputVariables);
+
+ if (workflowContext != null) {
+ contextHolder.remove(workflowContext);
+ }
+
+ msoLogger.debug(logMarker + "Exception in startProcessInstance by key");
+ response.setMessage("Fail" );
+ response.setResponse("Error occurred while executing the process: " + e);
+ response.setMessageCode(500);
+ recordEvents(processKey, response, startTime);
+
+ msoLogger.error (MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, logMarker
+ + response.getMessage() + " for processKey: "
+ + processKey + " with response: " + response.getResponse());
+
+ Response errorResponse = Response.serverError().entity(response).build();
+ asyncResponse.setResponse(errorResponse);
+ }
+ }
+
+ /**
+ *
+ * @version 1.0
+ *
+ */
+ class ProcessThread extends Thread {
+ private final String processKey;
+ private final Map<String,Object> inputVariables;
+
+ public ProcessThread(String processKey, Map<String, Object> inputVariables) {
+ this.processKey = processKey;
+ this.inputVariables = inputVariables;
+ }
+
+ public void run() {
+
+ String processInstanceId = null;
+ long startTime = System.currentTimeMillis();
+
+ try {
+ setLogContext(processKey, inputVariables);
+
+ // Note: this creates a random businessKey if it wasn't specified.
+ String businessKey = getBusinessKey(inputVariables);
+
+ msoLogger.debug(logMarker + "***Received MSO startProcessInstanceByKey with processKey: "
+ + processKey + " and variables: " + inputVariables);
+
+ msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, logMarker
+ + "Call to MSO workflow/services in Camunda. Received MSO startProcessInstanceByKey with processKey:"
+ + processKey + " and variables: " + inputVariables);
+
+ RuntimeService runtimeService = getProcessEngineServices().getRuntimeService();
+ ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(
+ processKey, businessKey, inputVariables);
+ processInstanceId = processInstance.getId();
+
+ msoLogger.debug(logMarker + "Process " + processKey + ":" + processInstanceId + " " +
+ (processInstance.isEnded() ? "ENDED" : "RUNNING"));
+ } catch (Exception e) {
+
+ msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError,
+ logMarker + "Error in starting the process: "+ e.getMessage());
+
+ WorkflowCallbackResponse callbackResponse = new WorkflowCallbackResponse();
+ callbackResponse.setStatusCode(500);
+ callbackResponse.setMessage("Fail");
+ callbackResponse.setResponse("Error occurred while executing the process: " + e);
+
+ // TODO: is the processInstanceId used by the API handler? I don't think so.
+ // It may be null here.
+ WorkflowContextHolder.getInstance().processCallback(
+ processKey, processInstanceId,
+ getRequestId(inputVariables),
+ callbackResponse);
+ }
+ }
+ }
+
+
+ /**
+ * Callback resource which is invoked from BPMN to process to send the workflow response
+ *
+ * @param processKey
+ * @param processInstanceId
+ * @param requestId
+ * @param callbackResponse
+ * @return
+ */
+ @POST
+ @Path("/services/callback/{processKey}/{processInstanceId}/{requestId}")
+ @Produces("application/json")
+ @Consumes("application/json")
+ public Response processWorkflowCallback(
+ @PathParam("processKey") String processKey,
+ @PathParam("processInstanceId") String processInstanceId,
+ @PathParam("requestId")String requestId,
+ WorkflowCallbackResponse callbackResponse) {
+
+ msoLogger.debug(logMarker + "Process instance ID:" + processInstanceId + ":" + requestId + ":" + processKey + ":" + isProcessEnded(processInstanceId));
+ msoLogger.debug(logMarker + "About to process the callback request:" + callbackResponse.getResponse() + ":" + callbackResponse.getMessage() + ":" + callbackResponse.getStatusCode());
+ return contextHolder.processCallback(processKey, processInstanceId, requestId, callbackResponse);
+ }
+
+ // Note: the business key is used to identify the process in unit tests
+ private String getBusinessKey(Map<String, Object> inputVariables) {
+ Object businessKey = inputVariables.get("mso-business-key");
+ if (businessKey == null ) {
+ businessKey = UUID.randomUUID().toString();
+ inputVariables.put("mso-business-key", businessKey);
+ }
+ return businessKey.toString();
+ }
+
+ private String getRequestId(Map<String, Object> inputVariables) {
+ Object requestId = inputVariables.get("mso-request-id");
+ if (requestId == null ) {
+ requestId = UUID.randomUUID().toString();
+ inputVariables.put("mso-request-id", requestId);
+ }
+ return requestId.toString();
+ }
+
+ private long getWaitTime(Map<String, Object> inputVariables)
+ {
+ String timeout = inputVariables.get("mso-service-request-timeout") == null
+ ? null : inputVariables.get("mso-service-request-timeout").toString();
+
+ if (timeout != null) {
+ try {
+ return Long.parseLong(timeout)*1000;
+ } catch (NumberFormatException nex) {
+ msoLogger.debug("Invalid input for mso-service-request-timeout");
+ }
+ }
+
+ return DEFAULT_WAIT_TIME;
+ }
+
+ private void recordEvents(String processKey, WorkflowResponse response,
+ long startTime) {
+
+ msoLogger.recordMetricEvent ( startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
+ logMarker + response.getMessage() + " for processKey: "
+ + processKey + " with response: " + response.getResponse(), "BPMN", MDC.get(processKey), null);
+
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
+ logMarker + response.getMessage() + "for processKey: " + processKey + " with response: " + response.getResponse());
+
+ }
+
+ private void setLogContext(String processKey,
+ Map<String, Object> inputVariables) {
+ MsoLogger.setServiceName("MSO." + processKey);
+ if (inputVariables != null) {
+ MsoLogger.setLogContext(getKeyValueFromInputVariables(inputVariables,"mso-request-id"), getKeyValueFromInputVariables(inputVariables,"mso-service-instance-id"));
+ }
+ }
+
+ private String getKeyValueFromInputVariables(Map<String,Object> inputVariables, String key) {
+ if (inputVariables == null) return "";
+ Object requestId = inputVariables.get(key);
+ if (requestId != null) return requestId.toString();
+ return "N/A";
+ }
+
+ private boolean isProcessEnded(String processInstanceId) {
+ ProcessEngineServices pes = getProcessEngineServices();
+ return pes.getRuntimeService().createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult() == null ? true : false ;
+ }
+
+
protected abstract ProcessEngineServices getProcessEngineServices();
-
- public void setProcessEngineServices4junit(ProcessEngineServices pes) {
- pes4junit = pes;
- }
-
- private Map<String, Object> getInputVariables(VariableMapImpl variableMap) {
- Map<String, Object> inputVariables = new HashMap<String,Object>();
- @SuppressWarnings("unchecked")
- Map<String, Object> vMap = (Map<String, Object>) variableMap.get("variables");
- for (String vName : vMap.keySet()) {
- @SuppressWarnings("unchecked")
- Map<String, Object> valueMap = (Map<String,Object>)vMap.get(vName); // value, type
- inputVariables.put(vName, valueMap.get("value"));
- }
- return inputVariables;
- }
-}
+
+ public void setProcessEngineServices4junit(ProcessEngineServices pes) {
+ pes4junit = pes;
+ }
+
+ private Map<String, Object> getInputVariables(VariableMapImpl variableMap) {
+ Map<String, Object> inputVariables = new HashMap<String,Object>();
+ @SuppressWarnings("unchecked")
+ Map<String, Object> vMap = (Map<String, Object>) variableMap.get("variables");
+ for (String vName : vMap.keySet()) {
+ @SuppressWarnings("unchecked")
+ Map<String, Object> valueMap = (Map<String,Object>)vMap.get(vName); // value, type
+ inputVariables.put(vName, valueMap.get("value"));
+ }
+ return inputVariables;
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowCallbackResponse.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowCallbackResponse.java
index b3e5ad1c58..945d64d81a 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowCallbackResponse.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowCallbackResponse.java
@@ -1,52 +1,52 @@
-/*-
- * ============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.common.workflow.service;
-
-/**
- * @version 1.0
- * Workflow Response bean to generate workflow response in JSON format
- */
-public class WorkflowCallbackResponse {
-
- private String response;
- private int statusCode;
- private String message;
-
- public String getResponse() {
- return response;
- }
- public void setResponse(String response) {
- this.response = response;
- }
- public int getStatusCode() {
- return statusCode;
- }
- public void setStatusCode(int statusCode) {
- this.statusCode = statusCode;
- }
- public String getMessage() {
- return message;
- }
- public void setMessage(String message) {
- this.message = message;
- }
-
-}
+/*-
+ * ============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.common.workflow.service;
+
+/**
+ * @version 1.0
+ * Workflow Response bean to generate workflow response in JSON format
+ */
+public class WorkflowCallbackResponse {
+
+ private String response;
+ private int statusCode;
+ private String message;
+
+ public String getResponse() {
+ return response;
+ }
+ public void setResponse(String response) {
+ this.response = response;
+ }
+ public int getStatusCode() {
+ return statusCode;
+ }
+ public void setStatusCode(int statusCode) {
+ this.statusCode = statusCode;
+ }
+ public String getMessage() {
+ return message;
+ }
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowContext.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowContext.java
index 867226c02a..3d7e333fdf 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowContext.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowContext.java
@@ -1,96 +1,96 @@
-/*-
- * ============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.common.workflow.service;
-
-import java.util.concurrent.Delayed;
-import java.util.concurrent.TimeUnit;
-
-import org.jboss.resteasy.spi.AsynchronousResponse;
-
-/**
- * @version 1.0
- * Workflow context object used to send timeout response, if workflow instance does not write the response in time
- */
-public class WorkflowContext implements Delayed {
- private final String processKey;
- private final String requestId;
- private final AsynchronousResponse asynchronousResponse;
- private final long startTime;
- private final long timeout;
-
- public WorkflowContext(String processKey, String requestId,
- AsynchronousResponse asynchronousResponse, long timeout) {
- this.processKey = processKey;
- this.requestId = requestId;
- this.asynchronousResponse = asynchronousResponse;
- this.timeout = timeout;
- this.startTime = System.currentTimeMillis();
- }
-
- public String getRequestId() {
- return requestId;
- }
-
- public String getProcessKey() {
- return processKey;
- }
-
- public AsynchronousResponse getAsynchronousResponse() {
- return asynchronousResponse;
- }
-
- public long getTimeout() {
- return timeout;
- }
-
- public long getStartTime() {
- return startTime;
- }
-
- /**
- * Required implementation by Delay queue
- * Returns the elapsed time for this context
- */
- @Override
- public long getDelay(TimeUnit unit) {
- // 0 or negative means this object is considered to be expired
- return unit.convert(startTime + timeout - System.currentTimeMillis(), unit);
- }
-
- /**
- * Required implementation by Delay queue
- * Compares the object to determine whether the object can be marked as expired
- */
- @Override
- public int compareTo(Delayed object) {
- WorkflowContext that = (WorkflowContext) object;
- long thisEndTime = startTime + timeout;
- long thatEndTime = that.startTime + that.timeout;
-
- if (thisEndTime < thatEndTime) {
- return -1;
- } else if (thisEndTime > thatEndTime) {
- return 1;
- } else {
- return 0;
- }
- }
-}
+/*-
+ * ============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.common.workflow.service;
+
+import java.util.concurrent.Delayed;
+import java.util.concurrent.TimeUnit;
+
+import org.jboss.resteasy.spi.AsynchronousResponse;
+
+/**
+ * @version 1.0
+ * Workflow context object used to send timeout response, if workflow instance does not write the response in time
+ */
+public class WorkflowContext implements Delayed {
+ private final String processKey;
+ private final String requestId;
+ private final AsynchronousResponse asynchronousResponse;
+ private final long startTime;
+ private final long timeout;
+
+ public WorkflowContext(String processKey, String requestId,
+ AsynchronousResponse asynchronousResponse, long timeout) {
+ this.processKey = processKey;
+ this.requestId = requestId;
+ this.asynchronousResponse = asynchronousResponse;
+ this.timeout = timeout;
+ this.startTime = System.currentTimeMillis();
+ }
+
+ public String getRequestId() {
+ return requestId;
+ }
+
+ public String getProcessKey() {
+ return processKey;
+ }
+
+ public AsynchronousResponse getAsynchronousResponse() {
+ return asynchronousResponse;
+ }
+
+ public long getTimeout() {
+ return timeout;
+ }
+
+ public long getStartTime() {
+ return startTime;
+ }
+
+ /**
+ * Required implementation by Delay queue
+ * Returns the elapsed time for this context
+ */
+ @Override
+ public long getDelay(TimeUnit unit) {
+ // 0 or negative means this object is considered to be expired
+ return unit.convert(startTime + timeout - System.currentTimeMillis(), unit);
+ }
+
+ /**
+ * Required implementation by Delay queue
+ * Compares the object to determine whether the object can be marked as expired
+ */
+ @Override
+ public int compareTo(Delayed object) {
+ WorkflowContext that = (WorkflowContext) object;
+ long thisEndTime = startTime + timeout;
+ long thatEndTime = that.startTime + that.timeout;
+
+ if (thisEndTime < thatEndTime) {
+ return -1;
+ } else if (thisEndTime > thatEndTime) {
+ return 1;
+ } else {
+ return 0;
+ }
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowContextHolder.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowContextHolder.java
index 1c48e7173a..ca3b1f1390 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowContextHolder.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowContextHolder.java
@@ -1,188 +1,188 @@
-/*-
- * ============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.common.workflow.service;
-
-import java.util.concurrent.DelayQueue;
-import java.util.concurrent.TimeUnit;
-
-import javax.ws.rs.core.Response;
-
-import org.jboss.resteasy.spi.AsynchronousResponse;
-import org.slf4j.MDC;
-
-import org.openecomp.mso.logger.MessageEnum;
-import org.openecomp.mso.logger.MsoLogger;
-
-/**
- * Workflow Context Holder instance which can be accessed elsewhere either in groovy scripts or Java
- * @version 1.0
- *
- */
-public class WorkflowContextHolder {
-
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
- private static final String logMarker = "[WORKFLOW-CONTEXT-HOLDER]";
- private static WorkflowContextHolder instance = null;
-
- /**
- * Delay Queue which holds workflow context holder objects
- */
- private final DelayQueue<WorkflowContext> responseQueue = new DelayQueue<WorkflowContext>();
- private final TimeoutThread timeoutThread = new TimeoutThread();
-
- private WorkflowContextHolder() {
- timeoutThread.start();
- }
-
- /**
- * Singleton holder which eliminates hot lock
- * Since the JVM synchronizes static method there is no synchronization needed for this method
- * @return
- */
- public static synchronized WorkflowContextHolder getInstance() {
- if (instance == null) {
- instance = new WorkflowContextHolder();
- }
- return instance;
- }
-
- public void put(WorkflowContext context) {
- msoLogger.debug(logMarker + " Adding context to the queue: "
- + context.getRequestId());
- responseQueue.put(context);
- }
-
- public void remove(WorkflowContext context) {
- msoLogger.debug(logMarker + " Removing context from the queue: "
- + context.getRequestId());
- responseQueue.remove(context);
- }
-
- public WorkflowContext getWorkflowContext(String requestId) {
- // Note: DelayQueue interator is threadsafe
- for (WorkflowContext context : responseQueue) {
- if (requestId.equals(context.getRequestId())) {
- msoLogger.debug("Found context for request id: " + requestId);
- return context;
- }
- }
-
- msoLogger.debug("Unable to find context for request id: " + requestId);
- return null;
- }
-
- /**
- * Builds the callback response object to respond to client
- * @param processKey
- * @param processInstanceId
- * @param requestId
- * @param callbackResponse
- * @return
- */
- public Response processCallback(String processKey, String processInstanceId,
- String requestId, WorkflowCallbackResponse callbackResponse) {
- WorkflowResponse workflowResponse = new WorkflowResponse();
- WorkflowContext workflowContext = getWorkflowContext(requestId);
-
- if (workflowContext == null) {
- msoLogger.debug("Unable to correlate workflow context for request id: " + requestId
- + ":processInstance Id:" + processInstanceId
- + ":process key:" + processKey);
- workflowResponse.setMessage("Fail");
- workflowResponse.setMessageCode(400);
- workflowResponse.setResponse("Unable to correlate workflow context, bad request. Request Id: " + requestId);
- return Response.serverError().entity(workflowResponse).build();
- }
-
- responseQueue.remove(workflowContext);
-
- msoLogger.debug("Using callback response for request id: " + requestId);
- workflowResponse.setResponse(callbackResponse.getResponse());
- workflowResponse.setProcessInstanceID(processInstanceId);
- workflowResponse.setMessageCode(callbackResponse.getStatusCode());
- workflowResponse.setMessage(callbackResponse.getMessage());
- sendWorkflowResponseToClient(processKey, workflowContext, workflowResponse);
- return Response.ok().entity(workflowResponse).build();
- }
-
- /**
- * Send the response to client asynchronously when invoked by the BPMN process
- * @param processKey
- * @param workflowContext
- * @param workflowResponse
- */
- private void sendWorkflowResponseToClient(String processKey, WorkflowContext workflowContext,
- WorkflowResponse workflowResponse) {
- msoLogger.debug(logMarker + "Sending the response for request id: " + workflowContext.getRequestId());
- recordEvents(processKey, workflowResponse, workflowContext.getStartTime());
- Response response = Response.status(workflowResponse.getMessageCode()).entity(workflowResponse).build();
- AsynchronousResponse asyncResp = workflowContext.getAsynchronousResponse();
- asyncResp.setResponse(response);
- }
-
- /**
- * Timeout thread which monitors the delay queue for expired context and send timeout response
- * to client
- *
- * */
- private class TimeoutThread extends Thread {
- public void run() {
- while (!isInterrupted()) {
- try {
- WorkflowContext requestObject = responseQueue.take();
- msoLogger.debug("Time remaining for request id: " + requestObject.getRequestId() + ":" + requestObject.getDelay(TimeUnit.MILLISECONDS));
- msoLogger.debug("Preparing timeout response for " + requestObject.getProcessKey() + ":" + ":" + requestObject.getRequestId());
- WorkflowResponse response = new WorkflowResponse();
- response.setMessage("Fail");
- response.setResponse("Request timedout, request id:" + requestObject.getRequestId());
- //response.setProcessInstanceID(requestObject.getProcessInstance().getProcessInstanceId());
- recordEvents(requestObject.getProcessKey(), response, requestObject.getStartTime());
- response.setMessageCode(500);
- Response result = Response.status(500).entity(response).build();
- requestObject.getAsynchronousResponse().setResponse(result);
- msoLogger.debug("Sending timeout response for request id:" + requestObject.getRequestId() + ":response:" + response);
- } catch (InterruptedException e) {
- break;
- } catch (Exception e) {
- msoLogger.debug("WorkflowContextHolder timeout thread caught exception: " + e);
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(),
- MsoLogger.ErrorCode.UnknownError, "Error in WorkflowContextHolder timeout thread");
-
- }
- }
-
- msoLogger.debug("WorkflowContextHolder timeout thread interrupted, quitting");
- }
- }
-
- private static void recordEvents(String processKey, WorkflowResponse response,
- long startTime) {
-
- msoLogger.recordMetricEvent ( startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- logMarker + response.getMessage() + " for processKey: "
- + processKey + " with response: " + response.getResponse(), "BPMN", MDC.get(processKey), null);
-
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, logMarker
- + response.getMessage() + " for processKey: "
- + processKey + " with response: " + response.getResponse());
-
- }
-}
+/*-
+ * ============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.common.workflow.service;
+
+import java.util.concurrent.DelayQueue;
+import java.util.concurrent.TimeUnit;
+
+import javax.ws.rs.core.Response;
+
+import org.jboss.resteasy.spi.AsynchronousResponse;
+import org.slf4j.MDC;
+
+import org.openecomp.mso.logger.MessageEnum;
+import org.openecomp.mso.logger.MsoLogger;
+
+/**
+ * Workflow Context Holder instance which can be accessed elsewhere either in groovy scripts or Java
+ * @version 1.0
+ *
+ */
+public class WorkflowContextHolder {
+
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
+ private static final String logMarker = "[WORKFLOW-CONTEXT-HOLDER]";
+ private static WorkflowContextHolder instance = null;
+
+ /**
+ * Delay Queue which holds workflow context holder objects
+ */
+ private final DelayQueue<WorkflowContext> responseQueue = new DelayQueue<WorkflowContext>();
+ private final TimeoutThread timeoutThread = new TimeoutThread();
+
+ private WorkflowContextHolder() {
+ timeoutThread.start();
+ }
+
+ /**
+ * Singleton holder which eliminates hot lock
+ * Since the JVM synchronizes static method there is no synchronization needed for this method
+ * @return
+ */
+ public static synchronized WorkflowContextHolder getInstance() {
+ if (instance == null) {
+ instance = new WorkflowContextHolder();
+ }
+ return instance;
+ }
+
+ public void put(WorkflowContext context) {
+ msoLogger.debug(logMarker + " Adding context to the queue: "
+ + context.getRequestId());
+ responseQueue.put(context);
+ }
+
+ public void remove(WorkflowContext context) {
+ msoLogger.debug(logMarker + " Removing context from the queue: "
+ + context.getRequestId());
+ responseQueue.remove(context);
+ }
+
+ public WorkflowContext getWorkflowContext(String requestId) {
+ // Note: DelayQueue interator is threadsafe
+ for (WorkflowContext context : responseQueue) {
+ if (requestId.equals(context.getRequestId())) {
+ msoLogger.debug("Found context for request id: " + requestId);
+ return context;
+ }
+ }
+
+ msoLogger.debug("Unable to find context for request id: " + requestId);
+ return null;
+ }
+
+ /**
+ * Builds the callback response object to respond to client
+ * @param processKey
+ * @param processInstanceId
+ * @param requestId
+ * @param callbackResponse
+ * @return
+ */
+ public Response processCallback(String processKey, String processInstanceId,
+ String requestId, WorkflowCallbackResponse callbackResponse) {
+ WorkflowResponse workflowResponse = new WorkflowResponse();
+ WorkflowContext workflowContext = getWorkflowContext(requestId);
+
+ if (workflowContext == null) {
+ msoLogger.debug("Unable to correlate workflow context for request id: " + requestId
+ + ":processInstance Id:" + processInstanceId
+ + ":process key:" + processKey);
+ workflowResponse.setMessage("Fail");
+ workflowResponse.setMessageCode(400);
+ workflowResponse.setResponse("Unable to correlate workflow context, bad request. Request Id: " + requestId);
+ return Response.serverError().entity(workflowResponse).build();
+ }
+
+ responseQueue.remove(workflowContext);
+
+ msoLogger.debug("Using callback response for request id: " + requestId);
+ workflowResponse.setResponse(callbackResponse.getResponse());
+ workflowResponse.setProcessInstanceID(processInstanceId);
+ workflowResponse.setMessageCode(callbackResponse.getStatusCode());
+ workflowResponse.setMessage(callbackResponse.getMessage());
+ sendWorkflowResponseToClient(processKey, workflowContext, workflowResponse);
+ return Response.ok().entity(workflowResponse).build();
+ }
+
+ /**
+ * Send the response to client asynchronously when invoked by the BPMN process
+ * @param processKey
+ * @param workflowContext
+ * @param workflowResponse
+ */
+ private void sendWorkflowResponseToClient(String processKey, WorkflowContext workflowContext,
+ WorkflowResponse workflowResponse) {
+ msoLogger.debug(logMarker + "Sending the response for request id: " + workflowContext.getRequestId());
+ recordEvents(processKey, workflowResponse, workflowContext.getStartTime());
+ Response response = Response.status(workflowResponse.getMessageCode()).entity(workflowResponse).build();
+ AsynchronousResponse asyncResp = workflowContext.getAsynchronousResponse();
+ asyncResp.setResponse(response);
+ }
+
+ /**
+ * Timeout thread which monitors the delay queue for expired context and send timeout response
+ * to client
+ *
+ * */
+ private class TimeoutThread extends Thread {
+ public void run() {
+ while (!isInterrupted()) {
+ try {
+ WorkflowContext requestObject = responseQueue.take();
+ msoLogger.debug("Time remaining for request id: " + requestObject.getRequestId() + ":" + requestObject.getDelay(TimeUnit.MILLISECONDS));
+ msoLogger.debug("Preparing timeout response for " + requestObject.getProcessKey() + ":" + ":" + requestObject.getRequestId());
+ WorkflowResponse response = new WorkflowResponse();
+ response.setMessage("Fail");
+ response.setResponse("Request timedout, request id:" + requestObject.getRequestId());
+ //response.setProcessInstanceID(requestObject.getProcessInstance().getProcessInstanceId());
+ recordEvents(requestObject.getProcessKey(), response, requestObject.getStartTime());
+ response.setMessageCode(500);
+ Response result = Response.status(500).entity(response).build();
+ requestObject.getAsynchronousResponse().setResponse(result);
+ msoLogger.debug("Sending timeout response for request id:" + requestObject.getRequestId() + ":response:" + response);
+ } catch (InterruptedException e) {
+ break;
+ } catch (Exception e) {
+ msoLogger.debug("WorkflowContextHolder timeout thread caught exception: " + e);
+ msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError, "Error in WorkflowContextHolder timeout thread");
+
+ }
+ }
+
+ msoLogger.debug("WorkflowContextHolder timeout thread interrupted, quitting");
+ }
+ }
+
+ private static void recordEvents(String processKey, WorkflowResponse response,
+ long startTime) {
+
+ msoLogger.recordMetricEvent ( startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
+ logMarker + response.getMessage() + " for processKey: "
+ + processKey + " with response: " + response.getResponse(), "BPMN", MDC.get(processKey), null);
+
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, logMarker
+ + response.getMessage() + " for processKey: "
+ + processKey + " with response: " + response.getResponse());
+
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowMessageResource.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowMessageResource.java
index da9376ddc0..5afbded982 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowMessageResource.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowMessageResource.java
@@ -1,141 +1,141 @@
-package org.openecomp.mso.bpmn.common.workflow.service;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-import org.camunda.bpm.BpmPlatform;
-import org.camunda.bpm.engine.ProcessEngineServices;
-import org.camunda.bpm.engine.RuntimeService;
-
-import org.openecomp.mso.logger.MessageEnum;
-import org.openecomp.mso.logger.MsoLogger;
-
-/**
- * Generalized REST interface that injects a message event into a waiting BPMN process.
- * Examples:
- * <pre>
- * /WorkflowMessage/SDNCAResponse/6d10d075-100c-42d0-9d84-a52432681cae-1478486185286
- * /WorkflowMessage/SDNCAEvent/USOSTCDALTX0101UJZZ01
- * </pre>
- */
-@Path("/")
-public class WorkflowMessageResource {
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
- private static final String LOGMARKER = "[WORKFLOW-MESSAGE]";
-
- private ProcessEngineServices pes4junit = null;
-
- @POST
- @Path("/WorkflowMessage/{messageType}/{correlator}")
- @Consumes("*/*")
- @Produces(MediaType.TEXT_PLAIN)
- public Response deliver(@PathParam("messageType") String messageType,
- @PathParam("correlator") String correlator, String message) {
-
- LOGGER.debug(LOGMARKER + " Received workflow message"
- + " type='" + messageType + "'"
- + " correlator='" + correlator + "'"
- + System.lineSeparator() + message);
-
- MsoLogger.setServiceName("MSO." + "WorkflowMessage");
-
- if (messageType == null || messageType.isEmpty()) {
- String msg = "Missing message type";
- LOGGER.debug(LOGMARKER + " " + msg);
- LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(),
- MsoLogger.ErrorCode.DataError, LOGMARKER + ":" + msg);
- return Response.status(400).entity(msg).build();
- }
-
- if (correlator == null || correlator.isEmpty()) {
- String msg = "Missing correlator";
- LOGGER.debug(LOGMARKER + " " + msg);
- LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(),
- MsoLogger.ErrorCode.DataError, LOGMARKER + ":" + msg);
- return Response.status(400).entity(msg).build();
- }
-
- String correlatorVariable = messageType + "_CORRELATOR";
- String messageVariable = messageType + "_MESSAGE";
-
- long startTime = System.currentTimeMillis();
-
- try {
- RuntimeService runtimeService = getProcessEngineServices().getRuntimeService();
-
- if (!isReadyforCorrelation(runtimeService, correlatorVariable, correlator)) {
- String msg = "No process is waiting to receive '" + messageType + "' WorkflowMessage with correlator '" + correlator + "'";
- LOGGER.debug(LOGMARKER + " " + msg);
- LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, LOGMARKER + ":" + msg);
- LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.BusinessProcesssError, msg, "BPMN", MsoLogger.getServiceName(), messageType);
- LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.BusinessProcesssError, msg);
- return Response.status(500).entity(msg).build();
- }
-
- Map<String, Object> variables = new HashMap<String, Object>();
- variables.put(correlatorVariable, correlator);
- variables.put(messageVariable, message);
-
- runtimeService.createMessageCorrelation("WorkflowMessage").setVariables(variables)
- .processInstanceVariableEquals(correlatorVariable, correlator).correlate();
-
- String msg = "Completed delivery of '" + messageType + "' WorkflowMessage with correlator '" + correlator + "'";
- LOGGER.debug(LOGMARKER + msg);
- LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, msg, "BPMN", MsoLogger.getServiceName(), messageType);
- LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, msg);
- return Response.status(204).build();
- } catch (Exception e) {
- // For example: MismatchingMessageCorrelationException
- String msg = "Caught " + e.getClass().getSimpleName() + " processing '" + messageType + "' WorkflowMessage with " + correlatorVariable + "='" + correlator + "'";
- LOGGER.debug(LOGMARKER + " " + msg);
- LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, LOGMARKER + ":" + msg, e);
- LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.UnknownError, msg, "BPMN", MsoLogger.getServiceName(), messageType);
- LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.UnknownError, msg);
- return Response.status(500).entity(msg).build();
- }
- }
-
- private boolean isReadyforCorrelation(RuntimeService runtimeService,
- String correlationVariable, String correlationValue)
- throws InterruptedException {
-
- long waitingInstances = runtimeService.createExecutionQuery()
- .messageEventSubscriptionName("WorkflowMessage")
- .processVariableValueEquals(correlationVariable, correlationValue)
- .count();
-
- int retries = 50;
- while (waitingInstances == 0 && retries > 0) {
- Thread.sleep(100);
-
- waitingInstances = runtimeService.createExecutionQuery()
- .messageEventSubscriptionName("WorkflowMessage")
- .processVariableValueEquals(correlationVariable, correlationValue)
- .count();
-
- retries--;
- }
-
- return waitingInstances != 0;
- }
-
- private ProcessEngineServices getProcessEngineServices() {
- if (pes4junit == null) {
- return BpmPlatform.getDefaultProcessEngine();
- } else {
- return pes4junit;
- }
- }
-
- public void setProcessEngineServices4junit(ProcessEngineServices pes) {
- pes4junit = pes;
- }
+package org.openecomp.mso.bpmn.common.workflow.service;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import org.camunda.bpm.BpmPlatform;
+import org.camunda.bpm.engine.ProcessEngineServices;
+import org.camunda.bpm.engine.RuntimeService;
+
+import org.openecomp.mso.logger.MessageEnum;
+import org.openecomp.mso.logger.MsoLogger;
+
+/**
+ * Generalized REST interface that injects a message event into a waiting BPMN process.
+ * Examples:
+ * <pre>
+ * /WorkflowMessage/SDNCAResponse/6d10d075-100c-42d0-9d84-a52432681cae-1478486185286
+ * /WorkflowMessage/SDNCAEvent/USOSTCDALTX0101UJZZ01
+ * </pre>
+ */
+@Path("/")
+public class WorkflowMessageResource {
+ private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
+ private static final String LOGMARKER = "[WORKFLOW-MESSAGE]";
+
+ private ProcessEngineServices pes4junit = null;
+
+ @POST
+ @Path("/WorkflowMessage/{messageType}/{correlator}")
+ @Consumes("*/*")
+ @Produces(MediaType.TEXT_PLAIN)
+ public Response deliver(@PathParam("messageType") String messageType,
+ @PathParam("correlator") String correlator, String message) {
+
+ LOGGER.debug(LOGMARKER + " Received workflow message"
+ + " type='" + messageType + "'"
+ + " correlator='" + correlator + "'"
+ + System.lineSeparator() + message);
+
+ MsoLogger.setServiceName("MSO." + "WorkflowMessage");
+
+ if (messageType == null || messageType.isEmpty()) {
+ String msg = "Missing message type";
+ LOGGER.debug(LOGMARKER + " " + msg);
+ LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.DataError, LOGMARKER + ":" + msg);
+ return Response.status(400).entity(msg).build();
+ }
+
+ if (correlator == null || correlator.isEmpty()) {
+ String msg = "Missing correlator";
+ LOGGER.debug(LOGMARKER + " " + msg);
+ LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.DataError, LOGMARKER + ":" + msg);
+ return Response.status(400).entity(msg).build();
+ }
+
+ String correlatorVariable = messageType + "_CORRELATOR";
+ String messageVariable = messageType + "_MESSAGE";
+
+ long startTime = System.currentTimeMillis();
+
+ try {
+ RuntimeService runtimeService = getProcessEngineServices().getRuntimeService();
+
+ if (!isReadyforCorrelation(runtimeService, correlatorVariable, correlator)) {
+ String msg = "No process is waiting to receive '" + messageType + "' WorkflowMessage with correlator '" + correlator + "'";
+ LOGGER.debug(LOGMARKER + " " + msg);
+ LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, LOGMARKER + ":" + msg);
+ LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.BusinessProcesssError, msg, "BPMN", MsoLogger.getServiceName(), messageType);
+ LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.BusinessProcesssError, msg);
+ return Response.status(500).entity(msg).build();
+ }
+
+ Map<String, Object> variables = new HashMap<String, Object>();
+ variables.put(correlatorVariable, correlator);
+ variables.put(messageVariable, message);
+
+ runtimeService.createMessageCorrelation("WorkflowMessage").setVariables(variables)
+ .processInstanceVariableEquals(correlatorVariable, correlator).correlate();
+
+ String msg = "Completed delivery of '" + messageType + "' WorkflowMessage with correlator '" + correlator + "'";
+ LOGGER.debug(LOGMARKER + msg);
+ LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, msg, "BPMN", MsoLogger.getServiceName(), messageType);
+ LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, msg);
+ return Response.status(204).build();
+ } catch (Exception e) {
+ // For example: MismatchingMessageCorrelationException
+ String msg = "Caught " + e.getClass().getSimpleName() + " processing '" + messageType + "' WorkflowMessage with " + correlatorVariable + "='" + correlator + "'";
+ LOGGER.debug(LOGMARKER + " " + msg);
+ LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, LOGMARKER + ":" + msg, e);
+ LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.UnknownError, msg, "BPMN", MsoLogger.getServiceName(), messageType);
+ LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.UnknownError, msg);
+ return Response.status(500).entity(msg).build();
+ }
+ }
+
+ private boolean isReadyforCorrelation(RuntimeService runtimeService,
+ String correlationVariable, String correlationValue)
+ throws InterruptedException {
+
+ long waitingInstances = runtimeService.createExecutionQuery()
+ .messageEventSubscriptionName("WorkflowMessage")
+ .processVariableValueEquals(correlationVariable, correlationValue)
+ .count();
+
+ int retries = 50;
+ while (waitingInstances == 0 && retries > 0) {
+ Thread.sleep(100);
+
+ waitingInstances = runtimeService.createExecutionQuery()
+ .messageEventSubscriptionName("WorkflowMessage")
+ .processVariableValueEquals(correlationVariable, correlationValue)
+ .count();
+
+ retries--;
+ }
+
+ return waitingInstances != 0;
+ }
+
+ private ProcessEngineServices getProcessEngineServices() {
+ if (pes4junit == null) {
+ return BpmPlatform.getDefaultProcessEngine();
+ } else {
+ return pes4junit;
+ }
+ }
+
+ public void setProcessEngineServices4junit(ProcessEngineServices pes) {
+ pes4junit = pes;
+ }
} \ No newline at end of file
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResource.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResource.java
index d15bc31625..a9a9f4b12d 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResource.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResource.java
@@ -1,609 +1,625 @@
-/*-
- * ============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.common.workflow.service;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-import java.util.concurrent.atomic.AtomicLong;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.UriInfo;
-
-import org.camunda.bpm.engine.HistoryService;
-import org.camunda.bpm.engine.ProcessEngineException;
-import org.camunda.bpm.engine.ProcessEngineServices;
-import org.camunda.bpm.engine.ProcessEngines;
-import org.camunda.bpm.engine.RuntimeService;
-import org.camunda.bpm.engine.history.HistoricVariableInstance;
-import org.camunda.bpm.engine.runtime.ProcessInstance;
-import org.camunda.bpm.engine.variable.VariableMap;
-import org.camunda.bpm.engine.variable.Variables;
-import org.camunda.bpm.engine.variable.Variables.SerializationDataFormats;
-import org.camunda.bpm.engine.variable.impl.VariableMapImpl;
-import org.openecomp.mso.bpmn.core.WorkflowException;
-import org.openecomp.mso.logger.MessageEnum;
-import org.openecomp.mso.logger.MsoLogger;
-import org.slf4j.MDC;
-
-@Path("/workflow")
-public class WorkflowResource {
-
- private ProcessEngineServices pes4junit = null;
-
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
- private static final String LOGMARKER = "[WRKFLOW-RESOURCE]";
-
- private static final int DEFAULT_WAIT_TIME = 30000;
-
- @Context
- private UriInfo uriInfo = null;
-
- /**
- * Starts the process instance and responds to client synchronously
- * If the request does not contain mso-service-request-timeout then it waits for the value specified in DEFAULT_WAIT_TIME
- * Note: value specified in mso-service-request-timeout is in seconds
- * During polling time, if there is an exception encountered in the process execution then polling is stopped and the error response is
- * returned to the client
- * @param processKey
- * @param variableMap
- * @return
- */
- @POST
- @Path("/services/{processKey}")
- @Produces("application/json")
- @Consumes("application/json")
- public Response startProcessInstanceByKey(@PathParam("processKey") String processKey,
- VariableMapImpl variableMap) {
-
- Map<String, Object> inputVariables = getInputVariables(variableMap);
- setLogContext(processKey, inputVariables);
-
- WorkflowResponse workflowResponse = new WorkflowResponse();
- long startTime = System.currentTimeMillis();
- ProcessInstance processInstance = null;
-
- try {
- //Kickoff the process
- ProcessThread thread = new ProcessThread(inputVariables,processKey,msoLogger);
- thread.start();
-
- Map<String, Object> responseMap = null;
-
- //wait for process to be completed
- long waitTime = getWaitTime(inputVariables);
- long now = System.currentTimeMillis();
- long start = now;
- long endTime = start + waitTime;
- long pollingInterval = 500;
-
- // TEMPORARY LOGIC FOR UNIT TEST REFACTORING
- // If this is a unit test (method is invoked directly), wait a max
- // of 5 seconds after process ended for a result. In production,
- // wait up to 60 seconds.
- long timeToWaitAfterProcessEnded = uriInfo == null ? 5000 : 60000;
- AtomicLong timeProcessEnded = new AtomicLong(0);
- boolean endedWithNoResponse = false;
-
- while (now <= endTime) {
- Thread.sleep(pollingInterval);
-
- now = System.currentTimeMillis();
-
- // Increase the polling interval over time
-
- long elapsed = now - start;
-
- if (elapsed > 60000) {
- pollingInterval = 5000;
- } else if (elapsed > 10000) {
- pollingInterval = 1000;
- }
- Exception exception = thread.getException();
- if (exception != null) {
- throw new Exception(exception);
- }
-
- processInstance = thread.getProcessInstance();
-
- if (processInstance == null) {
- msoLogger.debug(LOGMARKER + processKey + " process has not been created yet");
- continue;
- }
-
- String processInstanceId = processInstance.getId();
- workflowResponse.setProcessInstanceID(processInstanceId);
-
- responseMap = getResponseMap(processInstance, processKey, timeProcessEnded);
-
- if (responseMap == null) {
- msoLogger.debug(LOGMARKER + processKey + " has not produced a response yet");
-
- if (timeProcessEnded.longValue() != 0) {
- long elapsedSinceEnded = System.currentTimeMillis() - timeProcessEnded.longValue();
-
- if (elapsedSinceEnded > timeToWaitAfterProcessEnded) {
- endedWithNoResponse = true;
- break;
- }
- }
- } else {
- processResponseMap(workflowResponse, responseMap);
- recordEvents(processKey, workflowResponse, startTime);
- return Response.status(workflowResponse.getMessageCode()).entity(workflowResponse).build();
- }
- }
-
- //if we dont get response after waiting then send timeout response
-
- String state;
- String processInstanceId;
-
- if (processInstance == null) {
- processInstanceId = "N/A";
- state = "NOT STARTED";
- } else {
- processInstanceId = processInstance.getProcessInstanceId();
- state = isProcessEnded(processInstanceId) ? "ENDED" : "NOT ENDED";
- }
-
- workflowResponse.setMessage("Fail");
- if (endedWithNoResponse) {
- workflowResponse.setResponse("Process ended without producing a response");
- } else {
- workflowResponse.setResponse("Request timed out, process state: " + state);
- }
- workflowResponse.setProcessInstanceID(processInstanceId);
- recordEvents(processKey, workflowResponse, startTime);
- workflowResponse.setMessageCode(500);
- return Response.status(500).entity(workflowResponse).build();
- } catch (Exception ex) {
- msoLogger.debug(LOGMARKER + "Exception in startProcessInstance by key");
- ex.printStackTrace();
- workflowResponse.setMessage("Fail" );
- workflowResponse.setResponse("Error occurred while executing the process: " + ex.getMessage());
- if (processInstance != null) workflowResponse.setProcessInstanceID(processInstance.getId());
-
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "BPMN", MDC.get(processKey),
- MsoLogger.ErrorCode.UnknownError, LOGMARKER + workflowResponse.getMessage()
- + " for processKey: " + processKey + " with response: " + workflowResponse.getResponse());
-
- workflowResponse.setMessageCode(500);
- recordEvents(processKey, workflowResponse, startTime);
- return Response.status(500).entity(workflowResponse).build();
- }
- }
-
- /**
- * Returns the wait time, this is used by the resource on how long it should wait to send a response
- * If none specified DEFAULT_WAIT_TIME is used
- * @param inputVariables
- * @return
- */
- private int getWaitTime(Map<String, Object> inputVariables)
- {
- String timeout = inputVariables.get("mso-service-request-timeout") == null
- ? null : inputVariables.get("mso-service-request-timeout").toString();
-
- if (timeout != null) {
- try {
- return Integer.parseInt(timeout)*1000;
- } catch (NumberFormatException nex) {
- msoLogger.debug("Invalid input for mso-service-request-timeout");
- }
- }
- return DEFAULT_WAIT_TIME;
- }
-
- private void recordEvents(String processKey, WorkflowResponse response, long startTime) {
-
- msoLogger.recordMetricEvent ( startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- LOGMARKER + response.getMessage() + " for processKey: "
- + processKey + " with response: " + response.getResponse(), "BPMN", MDC.get(processKey), null);
-
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- LOGMARKER + response.getMessage() + " for processKey: "
- + processKey + " with response: " + response.getResponse());
- }
-
- private void setLogContext(String processKey, Map<String, Object> inputVariables) {
- MsoLogger.setServiceName("MSO." + processKey);
- if (inputVariables != null) {
- MsoLogger.setLogContext(getValueFromInputVariables(inputVariables, "mso-request-id"),
- getValueFromInputVariables(inputVariables, "mso-service-instance-id"));
- }
- }
-
- private String getValueFromInputVariables(Map<String,Object> inputVariables, String key) {
- Object value = inputVariables.get(key);
- if (value == null) {
- return "N/A";
- } else {
- return value.toString();
- }
- }
-
- /**
- * Checks to see if the specified process is ended.
- * @param processInstanceId the process instance ID
- * @return true if the process is ended
- */
- private boolean isProcessEnded(String processInstanceId) {
- ProcessEngineServices pes = getProcessEngineServices();
- return pes.getRuntimeService().createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult() == null ? true : false ;
- }
-
- private void processResponseMap(WorkflowResponse workflowResponse, Map<String, Object> responseMap) {
- Object object = responseMap.get("Response");
- String response = object == null ? null : String.valueOf(object);
- if(response == null){
- object = responseMap.get("WorkflowResponse");
- response = object == null ? null : String.valueOf(object);
- }
-
- workflowResponse.setResponse(response);
-
- object = responseMap.get("ResponseCode");
- String responseCode = object == null ? null : String.valueOf(object);
-
- try {
- workflowResponse.setMessageCode(Integer.parseInt(responseCode));
- } catch(NumberFormatException nex) {
- msoLogger.debug(LOGMARKER + "Failed to parse ResponseCode: " + responseCode);
- workflowResponse.setMessageCode(-1);
- }
-
- Object status = responseMap.get("Status");
-
- if ("Success".equalsIgnoreCase(String.valueOf(status))) {
- workflowResponse.setMessage("Success");
- } else if ("Fail".equalsIgnoreCase(String.valueOf(status))) {
- workflowResponse.setMessage("Fail");
- } else {
- msoLogger.debug(LOGMARKER + "Unrecognized Status: " + responseCode);
- workflowResponse.setMessage("Fail");
- }
- }
-
- /**
- * @version 1.0
- * Triggers the workflow in a separate thread
- */
- private class ProcessThread extends Thread {
- private final Map<String,Object> inputVariables;
- private final String processKey;
- private final MsoLogger msoLogger;
- private final String businessKey;
- private ProcessInstance processInstance = null;
- private Exception exception = null;
-
- public ProcessThread(Map<String, Object> inputVariables, String processKey, MsoLogger msoLogger) {
- this.inputVariables = inputVariables;
- this.processKey = processKey;
- this.msoLogger = msoLogger;
- this.businessKey = UUID.randomUUID().toString();
- }
-
- /**
- * If an exception occurs when starting the process instance, it may
- * be obtained by calling this method. Note that exceptions are only
- * recorded while the process is executing in its original thread.
- * Once a process is suspended, exception recording stops.
- * @return the exception, or null if none has occurred
- */
- public Exception getException() {
- return exception;
- }
-
-
- public ProcessInstance getProcessInstance() {
- return this.processInstance;
- }
-
- /**
- * Sets the process instance exception.
- * @param exception the exception
- */
- private void setException(Exception exception) {
- this.exception = exception;
- }
-
- public void run() {
- setLogContext(processKey, inputVariables);
-
- long startTime = System.currentTimeMillis();
-
- try {
- msoLogger.debug(LOGMARKER + "***Received MSO startProcessInstanceByKey with processKey:"
- + processKey + " and variables: " + inputVariables);
-
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, LOGMARKER
- + "Call to MSO workflow/services in Camunda. Received MSO startProcessInstanceByKey with"
- + " processKey:" + processKey
- + " businessKey:" + businessKey
- + " variables: " + inputVariables);
-
- RuntimeService runtimeService = getProcessEngineServices().getRuntimeService();
-
- // Note that this method doesn't return until the process suspends
- // itself or finishes. We provide a business key so we can identify
- // the process instance immediately.
- processInstance = runtimeService.startProcessInstanceByKey(
- processKey, inputVariables);
-
- } catch (Exception e) {
- msoLogger.debug(LOGMARKER + "ProcessThread caught an exception executing "
- + processKey + ": " + e);
- setException(e);
- }
- }
-
- }
-
- private Map<String, Object> getInputVariables(VariableMapImpl variableMap) {
- VariableMap inputVariables = Variables.createVariables();
- @SuppressWarnings("unchecked")
- Map<String, Object> vMap = (Map<String, Object>) variableMap.get("variables");
- for (String key : vMap.keySet()) { //variabe name vn
- @SuppressWarnings("unchecked")
- Map<String, Object> valueMap = (Map<String,Object>)vMap.get(key); //value, type
- inputVariables.putValueTyped(key, Variables
- .objectValue(valueMap.get("value"))
- .serializationDataFormat(SerializationDataFormats.JAVA) // tells the engine to use java serialization for persisting the value
- .create());
- }
- return inputVariables;
- }
-
- /**
- * Attempts to get a response map from the specified process instance.
- * @return the response map, or null if it is unavailable
- */
- private Map<String, Object> getResponseMap(ProcessInstance processInstance,
- String processKey, AtomicLong timeProcessEnded) {
-
- String responseMapVariable = processKey + "ResponseMap";
- String processInstanceId = processInstance.getId();
-
- // Query the runtime service to see if a response map is ready.
-
-/* RuntimeService runtimeService = getProcessEngineServices().getRuntimeService();
- List<Execution> executions = runtimeService.createExecutionQuery()
- .processInstanceId(processInstanceId).list();
-
- for (Execution execution : executions) {
- @SuppressWarnings("unchecked")
- Map<String, Object> responseMap = (Map<String, Object>)
- getVariableFromExecution(runtimeService, execution.getId(),
- responseMapVariable);
-
- if (responseMap != null) {
- msoLogger.debug(LOGMARKER + "Obtained " + responseMapVariable
- + " from process " + processInstanceId + " execution "
- + execution.getId());
- return responseMap;
- }
- }
-*/
- //Querying history seem to return consistent results compared to querying the runtime service
-
- boolean alreadyEnded = timeProcessEnded.longValue() != 0;
-
- if (alreadyEnded || isProcessEnded(processInstance.getId())) {
- if (!alreadyEnded) {
- timeProcessEnded.set(System.currentTimeMillis());
- }
-
- // Query the history service to see if a response map exists.
-
- HistoryService historyService = getProcessEngineServices().getHistoryService();
- @SuppressWarnings("unchecked")
- Map<String, Object> responseMap = (Map<String, Object>)
- getVariableFromHistory(historyService, processInstance.getId(),
- responseMapVariable);
-
- if (responseMap != null) {
- msoLogger.debug(LOGMARKER + "Obtained " + responseMapVariable
- + " from process " + processInstanceId + " history");
- return responseMap;
- }
-
- // Query the history service for old-style response variables.
-
- String prefix = (String) getVariableFromHistory(historyService, processInstanceId, "prefix");
-
- if (prefix != null) {
-
- // Check for 'WorkflowResponse' variable
- Object workflowResponseObject = getVariableFromHistory(historyService, processInstanceId, "WorkflowResponse");
- String workflowResponse = workflowResponseObject == null ? null : String.valueOf(workflowResponseObject);
- msoLogger.debug(LOGMARKER + "WorkflowResponse: " + workflowResponse);
-
- if (workflowResponse != null) {
- Object responseCodeObject = getVariableFromHistory(historyService, processInstanceId, prefix + "ResponseCode");
- String responseCode = responseCodeObject == null ? null : String.valueOf(responseCodeObject);
- msoLogger.debug(LOGMARKER + prefix + "ResponseCode: " + responseCode);
- responseMap = new HashMap<String, Object>();
- responseMap.put("WorkflowResponse", workflowResponse);
- responseMap.put("ResponseCode", responseCode);
- responseMap.put("Status", "Success");
- return responseMap;
- }
-
-
- // Check for 'WorkflowException' variable
- WorkflowException workflowException = null;
- String workflowExceptionText = null;
-
- Object workflowExceptionObject = getVariableFromHistory(historyService, processInstanceId, "WorkflowException");
- if(workflowExceptionObject != null) {
- if(workflowExceptionObject instanceof WorkflowException) {
- workflowException = (WorkflowException) workflowExceptionObject;
- workflowExceptionText = workflowException.toString();
- responseMap = new HashMap<String, Object>();
- responseMap.put("WorkflowException", workflowExceptionText);
- responseMap.put("ResponseCode", workflowException.getErrorCode());
- responseMap.put("Status", "Fail");
- return responseMap;
- }
- else if (workflowExceptionObject instanceof String) {
- Object object = getVariableFromHistory(historyService, processInstanceId, prefix + "ResponseCode");
- String responseCode = object == null ? null : String.valueOf(object);
- workflowExceptionText = (String) workflowExceptionObject;
- responseMap = new HashMap<String, Object>();
- responseMap.put("WorkflowException", workflowExceptionText);
- responseMap.put("ResponseCode", responseCode);
- responseMap.put("Status", "Fail");
- return responseMap;
- }
-
- }
- msoLogger.debug(LOGMARKER + "WorkflowException: " + workflowExceptionText);
-
- // BEGIN LEGACY SUPPORT. TODO: REMOVE THIS CODE
- Object object = getVariableFromHistory(historyService, processInstanceId, processKey + "Response");
- String response = object == null ? null : String.valueOf(object);
- msoLogger.debug(LOGMARKER + processKey + "Response: " + response);
-
- if (response != null) {
- object = getVariableFromHistory(historyService, processInstanceId, prefix + "ResponseCode");
- String responseCode = object == null ? null : String.valueOf(object);
- msoLogger.debug(LOGMARKER + prefix + "ResponseCode: " + responseCode);
- responseMap = new HashMap<String, Object>();
- responseMap.put("Response", response);
- responseMap.put("ResponseCode", responseCode);
- responseMap.put("Status", "Success");
- return responseMap;
- }
-
- object = getVariableFromHistory(historyService, processInstanceId, prefix + "ErrorResponse");
- String errorResponse = object == null ? null : String.valueOf(object);
- msoLogger.debug(LOGMARKER + prefix + "ErrorResponse: " + errorResponse);
-
- if (errorResponse != null) {
- object = getVariableFromHistory(historyService, processInstanceId, prefix + "ResponseCode");
- String responseCode = object == null ? null : String.valueOf(object);
- msoLogger.debug(LOGMARKER + prefix + "ResponseCode: " + responseCode);
- responseMap = new HashMap<String, Object>();
- responseMap.put("Response", errorResponse);
- responseMap.put("ResponseCode", responseCode);
- responseMap.put("Status", "Fail");
- return responseMap;
- }
- // END LEGACY SUPPORT. TODO: REMOVE THIS CODE
- }
- }
- return null;
- }
-
- /**
- * Gets a variable value from specified historical process instance.
- * @return the variable value, or null if the variable could not be
- * obtained
- */
- private Object getVariableFromHistory(HistoryService historyService,
- String processInstanceId, String variableName) {
- try {
- HistoricVariableInstance v = historyService.createHistoricVariableInstanceQuery()
- .processInstanceId(processInstanceId).variableName(variableName).singleResult();
- return v == null ? null : v.getValue();
- } catch (Exception e) {
- msoLogger.debug("Error retrieving process " + processInstanceId
- + " variable " + variableName + " from history: " + e);
- return null;
- }
- }
-
- @POST
- @Path("/services/{processKey}/{processInstanceId}")
- @Produces("application/json")
- @Consumes("application/json")
- public WorkflowResponse getProcessVariables(@PathParam("processKey") String processKey, @PathParam("processInstanceId") String processInstanceId) {
- //TODO filter only set of variables
- WorkflowResponse response = new WorkflowResponse();
-
- long startTime = System.currentTimeMillis();
- try {
- ProcessEngineServices engine = getProcessEngineServices();
- List<HistoricVariableInstance> variables = engine.getHistoryService().createHistoricVariableInstanceQuery().processInstanceId(processInstanceId).list();
- Map<String,String> variablesMap = new HashMap<String,String>();
- for (HistoricVariableInstance variableInstance: variables) {
- variablesMap.put(variableInstance.getName(), variableInstance.getValue().toString());
- }
-
- msoLogger.debug(LOGMARKER + "***Received MSO getProcessVariables with processKey:" + processKey + " and variables: " + variablesMap.toString());
-
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, LOGMARKER
- + "Call to MSO workflow/services in Camunda. Received MSO getProcessVariables with processKey:"
- + processKey + " and variables: "
- + variablesMap.toString());
-
-
- response.setVariables(variablesMap);
- response.setMessage("Success");
- response.setResponse("Successfully retrieved the variables");
- response.setProcessInstanceID(processInstanceId);
-
- msoLogger.debug(LOGMARKER + response.getMessage() + " for processKey: " + processKey + " with response: " + response.getResponse());
- } catch (Exception ex) {
- response.setMessage("Fail");
- response.setResponse("Failed to retrieve the variables," + ex.getMessage());
- response.setProcessInstanceID(processInstanceId);
-
- msoLogger.error (MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "BPMN", MDC.get(processKey), MsoLogger.ErrorCode.UnknownError, LOGMARKER
- + response.getMessage()
- + " for processKey: "
- + processKey
- + " with response: "
- + response.getResponse());
-
- }
-
- msoLogger.recordMetricEvent ( startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- LOGMARKER + response.getMessage() + " for processKey: "
- + processKey + " with response: " + response.getResponse(), "BPMN", MDC.get(processKey), null);
-
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- LOGMARKER + response.getMessage() + " for processKey: "
- + processKey + " with response: " + response.getResponse());
-
- return response;
- }
-
- private ProcessEngineServices getProcessEngineServices() {
- if (pes4junit == null) {
- return ProcessEngines.getDefaultProcessEngine();
- } else {
- return pes4junit;
- }
- }
-
- public void setProcessEngineServices4junit(ProcessEngineServices pes) {
- pes4junit = pes;
- }
-}
+/*-
+ * ============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.common.workflow.service;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import java.util.concurrent.atomic.AtomicLong;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
+
+import org.camunda.bpm.engine.HistoryService;
+import org.camunda.bpm.engine.ProcessEngineException;
+import org.camunda.bpm.engine.ProcessEngineServices;
+import org.camunda.bpm.engine.ProcessEngines;
+import org.camunda.bpm.engine.RuntimeService;
+import org.camunda.bpm.engine.history.HistoricVariableInstance;
+import org.camunda.bpm.engine.runtime.ProcessInstance;
+import org.camunda.bpm.engine.variable.VariableMap;
+import org.camunda.bpm.engine.variable.Variables;
+import org.camunda.bpm.engine.variable.Variables.SerializationDataFormats;
+import org.camunda.bpm.engine.variable.impl.VariableMapImpl;
+import org.openecomp.mso.bpmn.core.WorkflowException;
+import org.openecomp.mso.logger.MessageEnum;
+import org.openecomp.mso.logger.MsoLogger;
+import org.slf4j.MDC;
+
+@Path("/workflow")
+public class WorkflowResource {
+
+ private ProcessEngineServices pes4junit = null;
+
+ private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
+ private static final String LOGMARKER = "[WRKFLOW-RESOURCE]";
+
+ private static final int DEFAULT_WAIT_TIME = 30000;
+
+ @Context
+ private UriInfo uriInfo = null;
+
+ /**
+ * Starts the process instance and responds to client synchronously
+ * If the request does not contain mso-service-request-timeout then it waits for the value specified in DEFAULT_WAIT_TIME
+ * Note: value specified in mso-service-request-timeout is in seconds
+ * During polling time, if there is an exception encountered in the process execution then polling is stopped and the error response is
+ * returned to the client
+ * @param processKey
+ * @param variableMap
+ * @return
+ */
+ @POST
+ @Path("/services/{processKey}")
+ @Produces("application/json")
+ @Consumes("application/json")
+ public Response startProcessInstanceByKey(@PathParam("processKey") String processKey,
+ VariableMapImpl variableMap) {
+
+ Map<String, Object> inputVariables = getInputVariables(variableMap);
+ setLogContext(processKey, inputVariables);
+
+ WorkflowResponse workflowResponse = new WorkflowResponse();
+ long startTime = System.currentTimeMillis();
+ ProcessInstance processInstance = null;
+
+ try {
+ //Kickoff the process
+ ProcessThread thread = new ProcessThread(inputVariables,processKey,msoLogger);
+ thread.start();
+
+ Map<String, Object> responseMap = null;
+
+ //wait for process to be completed
+ long waitTime = getWaitTime(inputVariables);
+ long now = System.currentTimeMillis();
+ long start = now;
+ long endTime = start + waitTime;
+ long pollingInterval = 500;
+
+ // TEMPORARY LOGIC FOR UNIT TEST REFACTORING
+ // If this is a unit test (method is invoked directly), wait a max
+ // of 5 seconds after process ended for a result. In production,
+ // wait up to 60 seconds.
+ long timeToWaitAfterProcessEnded = uriInfo == null ? 5000 : 60000;
+ AtomicLong timeProcessEnded = new AtomicLong(0);
+ boolean endedWithNoResponse = false;
+
+ while (now <= endTime) {
+ Thread.sleep(pollingInterval);
+
+ now = System.currentTimeMillis();
+
+ // Increase the polling interval over time
+
+ long elapsed = now - start;
+
+ if (elapsed > 60000) {
+ pollingInterval = 5000;
+ } else if (elapsed > 10000) {
+ pollingInterval = 1000;
+ }
+ Exception exception = thread.getException();
+ if (exception != null) {
+ throw new Exception(exception);
+ }
+
+ processInstance = thread.getProcessInstance();
+
+ if (processInstance == null) {
+ msoLogger.debug(LOGMARKER + processKey + " process has not been created yet");
+ continue;
+ }
+
+ String processInstanceId = processInstance.getId();
+ workflowResponse.setProcessInstanceID(processInstanceId);
+
+ responseMap = getResponseMap(processInstance, processKey, timeProcessEnded);
+
+ if (responseMap == null) {
+ msoLogger.debug(LOGMARKER + processKey + " has not produced a response yet");
+
+ if (timeProcessEnded.longValue() != 0) {
+ long elapsedSinceEnded = System.currentTimeMillis() - timeProcessEnded.longValue();
+
+ if (elapsedSinceEnded > timeToWaitAfterProcessEnded) {
+ endedWithNoResponse = true;
+ break;
+ }
+ }
+ } else {
+ processResponseMap(workflowResponse, responseMap);
+ recordEvents(processKey, workflowResponse, startTime);
+ return Response.status(workflowResponse.getMessageCode()).entity(workflowResponse).build();
+ }
+ }
+
+ //if we dont get response after waiting then send timeout response
+
+ String state;
+ String processInstanceId;
+
+ if (processInstance == null) {
+ processInstanceId = "N/A";
+ state = "NOT STARTED";
+ } else {
+ processInstanceId = processInstance.getProcessInstanceId();
+ state = isProcessEnded(processInstanceId) ? "ENDED" : "NOT ENDED";
+ }
+
+ workflowResponse.setMessage("Fail");
+ if (endedWithNoResponse) {
+ workflowResponse.setResponse("Process ended without producing a response");
+ } else {
+ workflowResponse.setResponse("Request timed out, process state: " + state);
+ }
+ workflowResponse.setProcessInstanceID(processInstanceId);
+ recordEvents(processKey, workflowResponse, startTime);
+ workflowResponse.setMessageCode(500);
+ return Response.status(500).entity(workflowResponse).build();
+ } catch (Exception ex) {
+ msoLogger.debug(LOGMARKER + "Exception in startProcessInstance by key");
+ ex.printStackTrace();
+ workflowResponse.setMessage("Fail" );
+ workflowResponse.setResponse("Error occurred while executing the process: " + ex.getMessage());
+ if (processInstance != null) workflowResponse.setProcessInstanceID(processInstance.getId());
+
+ msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "BPMN", MDC.get(processKey),
+ MsoLogger.ErrorCode.UnknownError, LOGMARKER + workflowResponse.getMessage()
+ + " for processKey: " + processKey + " with response: " + workflowResponse.getResponse());
+
+ workflowResponse.setMessageCode(500);
+ recordEvents(processKey, workflowResponse, startTime);
+ return Response.status(500).entity(workflowResponse).build();
+ }
+ }
+
+ /**
+ * Returns the wait time, this is used by the resource on how long it should wait to send a response
+ * If none specified DEFAULT_WAIT_TIME is used
+ * @param inputVariables
+ * @return
+ */
+ private int getWaitTime(Map<String, Object> inputVariables)
+ {
+ String timeout = inputVariables.get("mso-service-request-timeout") == null
+ ? null : inputVariables.get("mso-service-request-timeout").toString();
+
+ if (timeout != null) {
+ try {
+ return Integer.parseInt(timeout)*1000;
+ } catch (NumberFormatException nex) {
+ msoLogger.debug("Invalid input for mso-service-request-timeout");
+ }
+ }
+ return DEFAULT_WAIT_TIME;
+ }
+
+ private void recordEvents(String processKey, WorkflowResponse response, long startTime) {
+
+ msoLogger.recordMetricEvent ( startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
+ LOGMARKER + response.getMessage() + " for processKey: "
+ + processKey + " with response: " + response.getResponse(), "BPMN", MDC.get(processKey), null);
+
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
+ LOGMARKER + response.getMessage() + " for processKey: "
+ + processKey + " with response: " + response.getResponse());
+ }
+
+ private void setLogContext(String processKey, Map<String, Object> inputVariables) {
+ MsoLogger.setServiceName("MSO." + processKey);
+ if (inputVariables != null) {
+ MsoLogger.setLogContext(getValueFromInputVariables(inputVariables, "mso-request-id"),
+ getValueFromInputVariables(inputVariables, "mso-service-instance-id"));
+ }
+ }
+
+ private String getValueFromInputVariables(Map<String,Object> inputVariables, String key) {
+ Object value = inputVariables.get(key);
+ if (value == null) {
+ return "N/A";
+ } else {
+ return value.toString();
+ }
+ }
+
+ /**
+ * Checks to see if the specified process is ended.
+ * @param processInstanceId the process instance ID
+ * @return true if the process is ended
+ */
+ private boolean isProcessEnded(String processInstanceId) {
+ ProcessEngineServices pes = getProcessEngineServices();
+ return pes.getRuntimeService().createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult() == null ? true : false ;
+ }
+
+ private void processResponseMap(WorkflowResponse workflowResponse, Map<String, Object> responseMap) {
+ Object object = responseMap.get("Response");
+ String response = object == null ? null : String.valueOf(object);
+ if(response == null){
+ object = responseMap.get("WorkflowResponse");
+ response = object == null ? null : String.valueOf(object);
+ }
+
+ workflowResponse.setResponse(response);
+
+ object = responseMap.get("ResponseCode");
+ String responseCode = object == null ? null : String.valueOf(object);
+
+ try {
+ workflowResponse.setMessageCode(Integer.parseInt(responseCode));
+ } catch(NumberFormatException nex) {
+ msoLogger.debug(LOGMARKER + "Failed to parse ResponseCode: " + responseCode);
+ workflowResponse.setMessageCode(-1);
+ }
+
+ Object status = responseMap.get("Status");
+
+ if ("Success".equalsIgnoreCase(String.valueOf(status))) {
+ workflowResponse.setMessage("Success");
+ } else if ("Fail".equalsIgnoreCase(String.valueOf(status))) {
+ workflowResponse.setMessage("Fail");
+ } else {
+ msoLogger.debug(LOGMARKER + "Unrecognized Status: " + responseCode);
+ workflowResponse.setMessage("Fail");
+ }
+ }
+
+ /**
+ * @version 1.0
+ * Triggers the workflow in a separate thread
+ */
+ private class ProcessThread extends Thread {
+ private final Map<String,Object> inputVariables;
+ private final String processKey;
+ private final MsoLogger msoLogger;
+ private final String businessKey;
+ private ProcessInstance processInstance = null;
+ private Exception exception = null;
+
+ public ProcessThread(Map<String, Object> inputVariables, String processKey, MsoLogger msoLogger) {
+ this.inputVariables = inputVariables;
+ this.processKey = processKey;
+ this.msoLogger = msoLogger;
+ this.businessKey = UUID.randomUUID().toString();
+ }
+
+ /**
+ * If an exception occurs when starting the process instance, it may
+ * be obtained by calling this method. Note that exceptions are only
+ * recorded while the process is executing in its original thread.
+ * Once a process is suspended, exception recording stops.
+ * @return the exception, or null if none has occurred
+ */
+ public Exception getException() {
+ return exception;
+ }
+
+
+ public ProcessInstance getProcessInstance() {
+ return this.processInstance;
+ }
+
+ /**
+ * Sets the process instance exception.
+ * @param exception the exception
+ */
+ private void setException(Exception exception) {
+ this.exception = exception;
+ }
+
+ public void run() {
+ setLogContext(processKey, inputVariables);
+
+ long startTime = System.currentTimeMillis();
+
+ try {
+ msoLogger.debug(LOGMARKER + "***Received MSO startProcessInstanceByKey with processKey:"
+ + processKey + " and variables: " + inputVariables);
+
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, LOGMARKER
+ + "Call to MSO workflow/services in Camunda. Received MSO startProcessInstanceByKey with"
+ + " processKey:" + processKey
+ + " businessKey:" + businessKey
+ + " variables: " + inputVariables);
+
+ RuntimeService runtimeService = getProcessEngineServices().getRuntimeService();
+
+ // Note that this method doesn't return until the process suspends
+ // itself or finishes. We provide a business key so we can identify
+ // the process instance immediately.
+ processInstance = runtimeService.startProcessInstanceByKey(
+ processKey, inputVariables);
+
+ } catch (Exception e) {
+ msoLogger.debug(LOGMARKER + "ProcessThread caught an exception executing "
+ + processKey + ": " + e);
+ setException(e);
+ }
+ }
+
+ }
+
+ private Map<String, Object> getInputVariables(VariableMapImpl variableMap) {
+ VariableMap inputVariables = Variables.createVariables();
+ @SuppressWarnings("unchecked")
+ Map<String, Object> vMap = (Map<String, Object>) variableMap.get("variables");
+ for (String key : vMap.keySet()) { //variabe name vn
+ @SuppressWarnings("unchecked")
+ Map<String, Object> valueMap = (Map<String,Object>)vMap.get(key); //value, type
+ inputVariables.putValueTyped(key, Variables
+ .objectValue(valueMap.get("value"))
+ .serializationDataFormat(SerializationDataFormats.JAVA) // tells the engine to use java serialization for persisting the value
+ .create());
+ }
+ return inputVariables;
+ }
+
+ /**
+ * Attempts to get a response map from the specified process instance.
+ * @return the response map, or null if it is unavailable
+ */
+ private Map<String, Object> getResponseMap(ProcessInstance processInstance,
+ String processKey, AtomicLong timeProcessEnded) {
+
+ String responseMapVariable = processKey + "ResponseMap";
+ String processInstanceId = processInstance.getId();
+
+ // Query the runtime service to see if a response map is ready.
+
+/* RuntimeService runtimeService = getProcessEngineServices().getRuntimeService();
+ List<Execution> executions = runtimeService.createExecutionQuery()
+ .processInstanceId(processInstanceId).list();
+
+ for (Execution execution : executions) {
+ @SuppressWarnings("unchecked")
+ Map<String, Object> responseMap = (Map<String, Object>)
+ getVariableFromExecution(runtimeService, execution.getId(),
+ responseMapVariable);
+
+ if (responseMap != null) {
+ msoLogger.debug(LOGMARKER + "Obtained " + responseMapVariable
+ + " from process " + processInstanceId + " execution "
+ + execution.getId());
+ return responseMap;
+ }
+ }
+*/
+ //Querying history seem to return consistent results compared to querying the runtime service
+
+ boolean alreadyEnded = timeProcessEnded.longValue() != 0;
+
+ if (alreadyEnded || isProcessEnded(processInstance.getId())) {
+ if (!alreadyEnded) {
+ timeProcessEnded.set(System.currentTimeMillis());
+ }
+
+ // Query the history service to see if a response map exists.
+
+ HistoryService historyService = getProcessEngineServices().getHistoryService();
+ @SuppressWarnings("unchecked")
+ Map<String, Object> responseMap = (Map<String, Object>)
+ getVariableFromHistory(historyService, processInstance.getId(),
+ responseMapVariable);
+
+ if (responseMap != null) {
+ msoLogger.debug(LOGMARKER + "Obtained " + responseMapVariable
+ + " from process " + processInstanceId + " history");
+ return responseMap;
+ }
+
+ // Query the history service for old-style response variables.
+
+ String prefix = (String) getVariableFromHistory(historyService, processInstanceId, "prefix");
+
+ if (prefix != null) {
+
+ // Check for 'WorkflowResponse' variable
+ Object workflowResponseObject = getVariableFromHistory(historyService, processInstanceId, "WorkflowResponse");
+ String workflowResponse = workflowResponseObject == null ? null : String.valueOf(workflowResponseObject);
+ msoLogger.debug(LOGMARKER + "WorkflowResponse: " + workflowResponse);
+
+ if (workflowResponse != null) {
+ Object responseCodeObject = getVariableFromHistory(historyService, processInstanceId, prefix + "ResponseCode");
+ String responseCode = responseCodeObject == null ? null : String.valueOf(responseCodeObject);
+ msoLogger.debug(LOGMARKER + prefix + "ResponseCode: " + responseCode);
+ responseMap = new HashMap<String, Object>();
+ responseMap.put("WorkflowResponse", workflowResponse);
+ responseMap.put("ResponseCode", responseCode);
+ responseMap.put("Status", "Success");
+ return responseMap;
+ }
+
+
+ // Check for 'WorkflowException' variable
+ WorkflowException workflowException = null;
+ String workflowExceptionText = null;
+
+ Object workflowExceptionObject = getVariableFromHistory(historyService, processInstanceId, "WorkflowException");
+ if(workflowExceptionObject != null) {
+ if(workflowExceptionObject instanceof WorkflowException) {
+ workflowException = (WorkflowException) workflowExceptionObject;
+ workflowExceptionText = workflowException.toString();
+ responseMap = new HashMap<String, Object>();
+ responseMap.put("WorkflowException", workflowExceptionText);
+ responseMap.put("ResponseCode", workflowException.getErrorCode());
+ responseMap.put("Status", "Fail");
+ return responseMap;
+ }
+ else if (workflowExceptionObject instanceof String) {
+ Object object = getVariableFromHistory(historyService, processInstanceId, prefix + "ResponseCode");
+ String responseCode = object == null ? null : String.valueOf(object);
+ workflowExceptionText = (String) workflowExceptionObject;
+ responseMap = new HashMap<String, Object>();
+ responseMap.put("WorkflowException", workflowExceptionText);
+ responseMap.put("ResponseCode", responseCode);
+ responseMap.put("Status", "Fail");
+ return responseMap;
+ }
+
+ }
+ msoLogger.debug(LOGMARKER + "WorkflowException: " + workflowExceptionText);
+
+ // BEGIN LEGACY SUPPORT. TODO: REMOVE THIS CODE
+ Object object = getVariableFromHistory(historyService, processInstanceId, processKey + "Response");
+ String response = object == null ? null : String.valueOf(object);
+ msoLogger.debug(LOGMARKER + processKey + "Response: " + response);
+
+ if (response != null) {
+ object = getVariableFromHistory(historyService, processInstanceId, prefix + "ResponseCode");
+ String responseCode = object == null ? null : String.valueOf(object);
+ msoLogger.debug(LOGMARKER + prefix + "ResponseCode: " + responseCode);
+ responseMap = new HashMap<String, Object>();
+ responseMap.put("Response", response);
+ responseMap.put("ResponseCode", responseCode);
+ responseMap.put("Status", "Success");
+ return responseMap;
+ }
+
+ object = getVariableFromHistory(historyService, processInstanceId, prefix + "ErrorResponse");
+ String errorResponse = object == null ? null : String.valueOf(object);
+ msoLogger.debug(LOGMARKER + prefix + "ErrorResponse: " + errorResponse);
+
+ if (errorResponse != null) {
+ object = getVariableFromHistory(historyService, processInstanceId, prefix + "ResponseCode");
+ String responseCode = object == null ? null : String.valueOf(object);
+ msoLogger.debug(LOGMARKER + prefix + "ResponseCode: " + responseCode);
+ responseMap = new HashMap<String, Object>();
+ responseMap.put("Response", errorResponse);
+ responseMap.put("ResponseCode", responseCode);
+ responseMap.put("Status", "Fail");
+ return responseMap;
+ }
+ // END LEGACY SUPPORT. TODO: REMOVE THIS CODE
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Gets a variable value from the specified execution.
+ * @return the variable value, or null if the variable could not be
+ * obtained
+ */
+ private Object getVariableFromExecution(RuntimeService runtimeService,
+ String executionId, String variableName) {
+ try {
+ return runtimeService.getVariable(executionId, variableName);
+ } catch (ProcessEngineException e) {
+ // Most likely cause is that the execution no longer exists.
+ msoLogger.debug("Error retrieving execution " + executionId
+ + " variable " + variableName + ": " + e);
+ return null;
+ }
+ }
+ /**
+ * Gets a variable value from specified historical process instance.
+ * @return the variable value, or null if the variable could not be
+ * obtained
+ */
+ private Object getVariableFromHistory(HistoryService historyService,
+ String processInstanceId, String variableName) {
+ try {
+ HistoricVariableInstance v = historyService.createHistoricVariableInstanceQuery()
+ .processInstanceId(processInstanceId).variableName(variableName).singleResult();
+ return v == null ? null : v.getValue();
+ } catch (Exception e) {
+ msoLogger.debug("Error retrieving process " + processInstanceId
+ + " variable " + variableName + " from history: " + e);
+ return null;
+ }
+ }
+
+ @POST
+ @Path("/services/{processKey}/{processInstanceId}")
+ @Produces("application/json")
+ @Consumes("application/json")
+ public WorkflowResponse getProcessVariables(@PathParam("processKey") String processKey, @PathParam("processInstanceId") String processInstanceId) {
+ //TODO filter only set of variables
+ WorkflowResponse response = new WorkflowResponse();
+
+ long startTime = System.currentTimeMillis();
+ try {
+ ProcessEngineServices engine = getProcessEngineServices();
+ List<HistoricVariableInstance> variables = engine.getHistoryService().createHistoricVariableInstanceQuery().processInstanceId(processInstanceId).list();
+ Map<String,String> variablesMap = new HashMap<String,String>();
+ for (HistoricVariableInstance variableInstance: variables) {
+ variablesMap.put(variableInstance.getName(), variableInstance.getValue().toString());
+ }
+
+ msoLogger.debug(LOGMARKER + "***Received MSO getProcessVariables with processKey:" + processKey + " and variables: " + variablesMap.toString());
+
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, LOGMARKER
+ + "Call to MSO workflow/services in Camunda. Received MSO getProcessVariables with processKey:"
+ + processKey + " and variables: "
+ + variablesMap.toString());
+
+
+ response.setVariables(variablesMap);
+ response.setMessage("Success");
+ response.setResponse("Successfully retrieved the variables");
+ response.setProcessInstanceID(processInstanceId);
+
+ msoLogger.debug(LOGMARKER + response.getMessage() + " for processKey: " + processKey + " with response: " + response.getResponse());
+ } catch (Exception ex) {
+ response.setMessage("Fail");
+ response.setResponse("Failed to retrieve the variables," + ex.getMessage());
+ response.setProcessInstanceID(processInstanceId);
+
+ msoLogger.error (MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "BPMN", MDC.get(processKey), MsoLogger.ErrorCode.UnknownError, LOGMARKER
+ + response.getMessage()
+ + " for processKey: "
+ + processKey
+ + " with response: "
+ + response.getResponse());
+
+ }
+
+ msoLogger.recordMetricEvent ( startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
+ LOGMARKER + response.getMessage() + " for processKey: "
+ + processKey + " with response: " + response.getResponse(), "BPMN", MDC.get(processKey), null);
+
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
+ LOGMARKER + response.getMessage() + " for processKey: "
+ + processKey + " with response: " + response.getResponse());
+
+ return response;
+ }
+
+ private ProcessEngineServices getProcessEngineServices() {
+ if (pes4junit == null) {
+ return ProcessEngines.getDefaultProcessEngine();
+ } else {
+ return pes4junit;
+ }
+ }
+
+ public void setProcessEngineServices4junit(ProcessEngineServices pes) {
+ pes4junit = pes;
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResourceApplication.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResourceApplication.java
index afc7bdb128..d6c9b51cd6 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResourceApplication.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResourceApplication.java
@@ -1,57 +1,57 @@
-/*-
- * ============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.common.workflow.service;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import javax.ws.rs.ApplicationPath;
-import javax.ws.rs.core.Application;
-
-import org.openecomp.mso.bpmn.common.workflow.service.WorkflowMessageResource;
-import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResource;
-
-/**
- * @version 1.0
- * RESTeasy workflow application which wires synchronous and asynchronous response
- *
- */
-@ApplicationPath("/")
-public class WorkflowResourceApplication extends Application {
- private Set<Object> singletons = new HashSet<Object>();
- private Set<Class<?>> classes = new HashSet<Class<?>>();
-
- public WorkflowResourceApplication() {
- singletons.add(new WorkflowResource());
- singletons.add(new WorkflowAsyncCommonResource());
- singletons.add(new WorkflowMessageResource());
- }
-
- @Override
- public Set<Class<?>> getClasses() {
- return classes;
- }
-
- @Override
- public Set<Object> getSingletons() {
- return singletons;
- }
-}
+/*-
+ * ============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.common.workflow.service;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.ws.rs.ApplicationPath;
+import javax.ws.rs.core.Application;
+
+import org.openecomp.mso.bpmn.common.workflow.service.WorkflowMessageResource;
+import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResource;
+
+/**
+ * @version 1.0
+ * RESTeasy workflow application which wires synchronous and asynchronous response
+ *
+ */
+@ApplicationPath("/")
+public class WorkflowResourceApplication extends Application {
+ private Set<Object> singletons = new HashSet<Object>();
+ private Set<Class<?>> classes = new HashSet<Class<?>>();
+
+ public WorkflowResourceApplication() {
+ singletons.add(new WorkflowResource());
+ singletons.add(new WorkflowAsyncCommonResource());
+ singletons.add(new WorkflowMessageResource());
+ }
+
+ @Override
+ public Set<Class<?>> getClasses() {
+ return classes;
+ }
+
+ @Override
+ public Set<Object> getSingletons() {
+ return singletons;
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResponse.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResponse.java
index 5da7c8fef4..79e29e6770 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResponse.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowResponse.java
@@ -1,69 +1,69 @@
-/*-
- * ============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.common.workflow.service;
-
-import java.util.Map;
-
-/**
- * @version 1.0
- * Synchronous workflow response bean
- *
- */
-public class WorkflowResponse {
-
- private String response;
- private String message;
- private String processInstanceID;
- private Map<String,String> variables;
- private int messageCode;
-
- public String getResponse() {
- return response;
- }
- public void setResponse(String response) {
- this.response = response;
- }
- public String getMessage() {
- return message;
- }
- public void setMessage(String message) {
- this.message = message;
- }
- public String getProcessInstanceID() {
- return processInstanceID;
- }
- public void setProcessInstanceID(String pID) {
- this.processInstanceID = pID;
- }
- public Map<String, String> getVariables() {
- return variables;
- }
- public void setVariables(Map<String, String> variables) {
- this.variables = variables;
- }
- public void setMessageCode(int messageCode) {
- this.messageCode = messageCode;
- }
-
- public int getMessageCode() {
- return messageCode;
- }
-}
+/*-
+ * ============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.common.workflow.service;
+
+import java.util.Map;
+
+/**
+ * @version 1.0
+ * Synchronous workflow response bean
+ *
+ */
+public class WorkflowResponse {
+
+ private String response;
+ private String message;
+ private String processInstanceID;
+ private Map<String,String> variables;
+ private int messageCode;
+
+ public String getResponse() {
+ return response;
+ }
+ public void setResponse(String response) {
+ this.response = response;
+ }
+ public String getMessage() {
+ return message;
+ }
+ public void setMessage(String message) {
+ this.message = message;
+ }
+ public String getProcessInstanceID() {
+ return processInstanceID;
+ }
+ public void setProcessInstanceID(String pID) {
+ this.processInstanceID = pID;
+ }
+ public Map<String, String> getVariables() {
+ return variables;
+ }
+ public void setVariables(Map<String, String> variables) {
+ this.variables = variables;
+ }
+ public void setMessageCode(int messageCode) {
+ this.messageCode = messageCode;
+ }
+
+ public int getMessageCode() {
+ return messageCode;
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/resources/META-INF/persistence.xml b/bpmn/MSOCommonBPMN/src/main/resources/META-INF/persistence.xml
index fb027b8ed0..d7166d81a9 100644
--- a/bpmn/MSOCommonBPMN/src/main/resources/META-INF/persistence.xml
+++ b/bpmn/MSOCommonBPMN/src/main/resources/META-INF/persistence.xml
@@ -1,37 +1,37 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ============LICENSE_START=======================================================
- ECOMP 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=========================================================
- -->
-
-<persistence version="2.0"
- xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="
- http://java.sun.com/xml/ns/persistence
- http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
-
- <persistence-unit name="common">
- <jta-data-source>java:jboss/datasources/ProcessEngine</jta-data-source>
- <properties>
- <!-- Properties for Hibernate -->
- <property name="hibernate.hbm2ddl.auto" value="create-drop" />
- <property name="hibernate.show_sql" value="true" />
- </properties>
- </persistence-unit>
-
-</persistence>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ============LICENSE_START=======================================================
+ ECOMP 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=========================================================
+ -->
+
+<persistence version="2.0"
+ xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://java.sun.com/xml/ns/persistence
+ http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
+
+ <persistence-unit name="common">
+ <jta-data-source>java:jboss/datasources/ProcessEngine</jta-data-source>
+ <properties>
+ <!-- Properties for Hibernate -->
+ <property name="hibernate.hbm2ddl.auto" value="create-drop" />
+ <property name="hibernate.show_sql" value="true" />
+ </properties>
+ </persistence-unit>
+
+</persistence>
diff --git a/bpmn/MSOCommonBPMN/src/main/resources/processes.xml b/bpmn/MSOCommonBPMN/src/main/resources/processes.xml
new file mode 100644
index 0000000000..f4f8efdbc4
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/resources/processes.xml
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ ============LICENSE_START=======================================================
+ ECOMP 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=========================================================
+ -->
+
+
+<process-application
+ xmlns="http://www.camunda.org/schema/1.0/ProcessApplication"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <process-engine name="common">
+ <configuration>org.camunda.bpm.engine.impl.cfg.StandaloneProcessEngineConfiguration</configuration>
+ <datasource>java:jboss/datasources/ProcessEngine</datasource>
+ <properties>
+ <property name="history">full</property>
+ <property name="databaseSchemaUpdate">true</property>
+ <property name="authorizationEnabled">true</property>
+ <property name="jobExecutorDeploymentAware">true</property>
+ <property name="jobExecutorActivate">true</property>
+ </properties>
+ <plugins>
+
+ <!-- plugin enabling Process Application event listener support -->
+ <plugin>
+ <class>org.camunda.bpm.application.impl.event.ProcessApplicationEventListenerPlugin</class>
+ </plugin>
+
+ <!-- plugin enabling integration of camunda Spin -->
+ <plugin>
+ <class>org.camunda.spin.plugin.impl.SpinProcessEnginePlugin</class>
+ </plugin>
+
+ <!-- plugin enabling connect support -->
+ <plugin>
+ <class>org.camunda.connect.plugin.impl.ConnectProcessEnginePlugin</class>
+ </plugin>
+
+ <plugin>
+ <class>org.openecomp.mso.bpmn.core.plugins.LoggingAndURNMappingPlugin</class>
+ </plugin>
+
+ <!-- Needed until all subflows generate MSOWorkflowException events -->
+ <plugin>
+ <class>org.openecomp.mso.bpmn.core.plugins.WorkflowExceptionPlugin</class>
+ </plugin>
+
+ <!-- Optional Plugin for Camunda BPM Workbench -->
+ <!-- <plugin>
+ <class>org.camunda.bpm.debugger.server.EmbeddableDebugWebsocketBootstrap</class>
+ <properties>
+ <property name="httpPort">8088</property>
+ </properties>
+ </plugin> -->
+ </plugins>
+ </process-engine>
+
+
+ <process-archive name="MSOCommonBPMN">
+ <process-engine>common</process-engine>
+ <properties>
+ <property name="isDeleteUponUndeploy">false</property>
+ <property name="isScanForProcessDefinitions">true</property>
+ </properties>
+ </process-archive>
+
+</process-application>
diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CompleteMsoProcess.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CompleteMsoProcess.bpmn
index caf39010a7..cd977e3ae6 100644
--- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CompleteMsoProcess.bpmn
+++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CompleteMsoProcess.bpmn
@@ -1,19 +1,34 @@
<?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="_EsMs0HcuEeW2U_kkOHX1ZQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
+<bpmn2: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="_EsMs0HcuEeW2U_kkOHX1ZQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.6.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
<bpmn2:process id="CompleteMsoProcess" name="CompleteMsoProcess" isExecutable="true">
<bpmn2:scriptTask id="preProcessRequest" name="Pre-Process Request" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_1s593bx</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_1epmndu</bpmn2:outgoing>
+ <bpmn2:incoming>SequenceFlow_18</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_2</bpmn2:outgoing>
<bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
def preProcessRequestData = new CompleteMsoProcess()
preProcessRequestData.preProcessRequest(execution)
]]></bpmn2:script>
</bpmn2:scriptTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_2" name="" sourceRef="preProcessRequest" targetRef="ExclusiveGateway_5" />
<bpmn2:startEvent id="StartEvent_1" name="Start With Message ">
- <bpmn2:outgoing>SequenceFlow_1s593bx</bpmn2:outgoing>
+ <bpmn2:outgoing>SequenceFlow_18</bpmn2:outgoing>
<bpmn2:messageEventDefinition id="MessageEventDefinition_1" messageRef="Message_2" />
</bpmn2:startEvent>
+ <bpmn2:sequenceFlow id="SequenceFlow_18" name="" sourceRef="StartEvent_1" targetRef="preProcessRequest" />
+ <bpmn2:parallelGateway id="ExclusiveGateway_5">
+ <bpmn2:incoming>SequenceFlow_2</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_45</bpmn2:outgoing>
+ <bpmn2:outgoing>SequenceFlow_46</bpmn2:outgoing>
+ </bpmn2:parallelGateway>
+ <bpmn2:sequenceFlow id="SequenceFlow_45" name="" sourceRef="ExclusiveGateway_5" targetRef="ParallelGateway_3" />
+ <bpmn2:sequenceFlow id="SequenceFlow_46" name="" sourceRef="ExclusiveGateway_5" targetRef="ExclusiveGateway_3" />
+ <bpmn2:exclusiveGateway id="ParallelGateway_3" name="Notification Url Present?" default="SequenceFlow_40">
+ <bpmn2:incoming>SequenceFlow_45</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_40</bpmn2:outgoing>
+ <bpmn2:outgoing>if_notifcationURLExists</bpmn2:outgoing>
+ </bpmn2:exclusiveGateway>
+ <bpmn2:sequenceFlow id="SequenceFlow_40" name="No" sourceRef="ParallelGateway_3" targetRef="ParallelGateway_5" />
<bpmn2:subProcess id="subProcessExceptionCompleteMSO" name="Sub Process Exception Complete MSO" triggeredByEvent="true">
<bpmn2:endEvent id="endEventExceptionCompleteMSO">
<bpmn2:extensionElements>
@@ -23,28 +38,26 @@ preProcessRequestData.preProcessRequest(execution)
</camunda:inputOutput>
</camunda:connector>
</bpmn2:extensionElements>
- <bpmn2:incoming>SequenceFlow_19</bpmn2:incoming>
+ <bpmn2:incoming>SequenceFlow_1i1h3il</bpmn2:incoming>
<bpmn2:terminateEventDefinition id="MessageEventDefinition_3" />
</bpmn2:endEvent>
<bpmn2:startEvent id="startEventExceptionCompleteMSO">
- <bpmn2:outgoing>SequenceFlow_19</bpmn2:outgoing>
+ <bpmn2:outgoing>SequenceFlow_1i1h3il</bpmn2:outgoing>
<bpmn2:errorEventDefinition id="ErrorEventDefinition_4" />
</bpmn2:startEvent>
- <bpmn2:sequenceFlow id="SequenceFlow_19" name="" sourceRef="startEventExceptionCompleteMSO" targetRef="endEventExceptionCompleteMSO" />
+ <bpmn2:sequenceFlow id="SequenceFlow_1i1h3il" sourceRef="startEventExceptionCompleteMSO" targetRef="endEventExceptionCompleteMSO" />
</bpmn2:subProcess>
- <bpmn2:endEvent id="EndEvent_13">
- <bpmn2:incoming>SequenceFlow_21</bpmn2:incoming>
- </bpmn2:endEvent>
<bpmn2:exclusiveGateway id="ParallelGateway_7">
<bpmn2:incoming>SequenceFlow_7</bpmn2:incoming>
<bpmn2:incoming>SequenceFlow_24</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_0fni7aq</bpmn2:outgoing>
+ <bpmn2:outgoing>SequenceFlow_39</bpmn2:outgoing>
</bpmn2:exclusiveGateway>
+ <bpmn2:sequenceFlow id="SequenceFlow_39" name="" sourceRef="ParallelGateway_7" targetRef="ParallelGateway_6" />
<bpmn2:endEvent id="EndEvent_4">
<bpmn2:incoming>SequenceFlow_9</bpmn2:incoming>
<bpmn2:errorEventDefinition id="ErrorEventDefinition_5" errorRef="Error_3" />
</bpmn2:endEvent>
- <bpmn2:scriptTask id="ScriptTask_3" name="Prepare &#10;&#10;Update DB Request" scriptFormat="groovy">
+ <bpmn2:scriptTask id="ScriptTask_3" name="Prepare&#10;&#10;Update DB Request" scriptFormat="groovy">
<bpmn2:incoming>SequenceFlow_72</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_10</bpmn2:outgoing>
<bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
@@ -57,7 +70,7 @@ completeMsoProcess.setUpdateDBstatustoSuccessPayload(execution)]]></bpmn2:script
<bpmn2:errorEventDefinition id="ErrorEventDefinition_3" errorRef="Error_3" />
</bpmn2:endEvent>
<bpmn2:exclusiveGateway id="ExclusiveGateway_3" name="Active Request?" default="SequenceFlow_72">
- <bpmn2:incoming>SequenceFlow_1epmndu</bpmn2:incoming>
+ <bpmn2:incoming>SequenceFlow_46</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_72</bpmn2:outgoing>
<bpmn2:outgoing>SequenceFlow_81</bpmn2:outgoing>
</bpmn2:exclusiveGateway>
@@ -67,6 +80,7 @@ completeMsoProcess.setUpdateDBstatustoSuccessPayload(execution)]]></bpmn2:script
</bpmn2:sequenceFlow>
<bpmn2:scriptTask id="BuildErrorMessage1" name="Build Error Message" scriptFormat="groovy">
<bpmn2:incoming>SequenceFlow_25</bpmn2:incoming>
+ <bpmn2:incoming>SequenceFlow_1q7eer1</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_13</bpmn2:outgoing>
<bpmn2:script><![CDATA[//println "INSIDE --> Build Error Message @@@@"
import org.openecomp.mso.bpmn.common.scripts.*
@@ -74,7 +88,7 @@ def buildDataErrorMessage = new CompleteMsoProcess()
buildDataErrorMessage.buildDataError(execution, "Complete --Update DB status to SUCCESS-- Failed")]]></bpmn2:script>
</bpmn2:scriptTask>
<bpmn2:sequenceFlow id="SequenceFlow_13" name="" sourceRef="BuildErrorMessage1" targetRef="EndEvent_5" />
- <bpmn2:scriptTask id="prepareUpdateRequest" name="Prepare &#10;&#10;Update DB Request" scriptFormat="groovy">
+ <bpmn2:scriptTask id="prepareUpdateRequest" name="Prepare&#10;&#10;Update DB Request" scriptFormat="groovy">
<bpmn2:incoming>SequenceFlow_81</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_49</bpmn2:outgoing>
<bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
@@ -106,12 +120,12 @@ completeMsoProcess.updateDBStatusToSuccessPayload(execution)]]></bpmn2:script>
</bpmn2:serviceTask>
<bpmn2:sequenceFlow id="SequenceFlow_6" name="" sourceRef="updateInfraRequest" targetRef="ExclusiveGateway_7" />
<bpmn2:boundaryEvent id="BoundaryEvent_6" name="" attachedToRef="updateDBStatus">
- <bpmn2:outgoing>SequenceFlow_14</bpmn2:outgoing>
+ <bpmn2:outgoing>SequenceFlow_1q7eer1</bpmn2:outgoing>
<bpmn2:errorEventDefinition id="_ErrorEventDefinition_83" errorRef="Error_1" />
</bpmn2:boundaryEvent>
- <bpmn2:sequenceFlow id="SequenceFlow_14" name="" sourceRef="BoundaryEvent_6" targetRef="EndEvent_12" />
<bpmn2:scriptTask id="BuildErrorMessage" name="Build Error Message" scriptFormat="groovy">
<bpmn2:incoming>SequenceFlow_1</bpmn2:incoming>
+ <bpmn2:incoming>SequenceFlow_0mipf25</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_9</bpmn2:outgoing>
<bpmn2:script><![CDATA[//println "INSIDE --> Build Error Message @@@@"
//println "CMSO_updateRequestResponse IS --> " + execution.getVariable("CMSO_updateRequestResponse")
@@ -161,16 +175,24 @@ buildDataErrorMessage.buildDataError(execution, "Complete MSO -- Update DB stat
<bpmn2:outgoing>SequenceFlow_23</bpmn2:outgoing>
</bpmn2:serviceTask>
<bpmn2:sequenceFlow id="SequenceFlow_23" name="" sourceRef="updateDBStatus" targetRef="ExclusiveGateway_10" />
- <bpmn2:endEvent id="EndEvent_12">
- <bpmn2:incoming>SequenceFlow_14</bpmn2:incoming>
- </bpmn2:endEvent>
<bpmn2:boundaryEvent id="BoundaryEvent_7" name="" attachedToRef="updateInfraRequest">
- <bpmn2:outgoing>SequenceFlow_21</bpmn2:outgoing>
+ <bpmn2:outgoing>SequenceFlow_0mipf25</bpmn2:outgoing>
<bpmn2:errorEventDefinition id="_ErrorEventDefinition_84" errorRef="Error_1" />
</bpmn2:boundaryEvent>
- <bpmn2:sequenceFlow id="SequenceFlow_21" name="" sourceRef="BoundaryEvent_7" targetRef="EndEvent_13" />
+ <bpmn2:exclusiveGateway id="ParallelGateway_5">
+ <bpmn2:incoming>SequenceFlow_40</bpmn2:incoming>
+ <bpmn2:incoming>SequenceFlow_13qdn1s</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_32</bpmn2:outgoing>
+ </bpmn2:exclusiveGateway>
+ <bpmn2:sequenceFlow id="SequenceFlow_32" name="" sourceRef="ParallelGateway_5" targetRef="ParallelGateway_6" />
+ <bpmn2:parallelGateway id="ParallelGateway_6">
+ <bpmn2:incoming>SequenceFlow_32</bpmn2:incoming>
+ <bpmn2:incoming>SequenceFlow_39</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_33</bpmn2:outgoing>
+ </bpmn2:parallelGateway>
+ <bpmn2:sequenceFlow id="SequenceFlow_33" name="" sourceRef="ParallelGateway_6" targetRef="Done" />
<bpmn2:scriptTask id="Done" name="Prepare Response" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_0fni7aq</bpmn2:incoming>
+ <bpmn2:incoming>SequenceFlow_33</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_17</bpmn2:outgoing>
<bpmn2:script><![CDATA[println "INSIDE --> Complete MSO Process Done SUCCESSFULLY"
import org.openecomp.mso.bpmn.common.scripts.*
@@ -183,9 +205,22 @@ println "CompleteMsoProcess Response -->" + "\n" + execution.getVariable("Comple
<bpmn2:incoming>SequenceFlow_17</bpmn2:incoming>
<bpmn2:terminateEventDefinition id="_TerminateEventDefinition_2" />
</bpmn2:endEvent>
- <bpmn2:sequenceFlow id="SequenceFlow_1s593bx" sourceRef="StartEvent_1" targetRef="preProcessRequest" />
- <bpmn2:sequenceFlow id="SequenceFlow_1epmndu" sourceRef="preProcessRequest" targetRef="ExclusiveGateway_3" />
- <bpmn2:sequenceFlow id="SequenceFlow_0fni7aq" sourceRef="ParallelGateway_7" targetRef="Done" />
+ <bpmn2:sequenceFlow id="SequenceFlow_1q7eer1" name="Connect Fault" sourceRef="BoundaryEvent_6" targetRef="BuildErrorMessage1" />
+ <bpmn2:sequenceFlow id="SequenceFlow_0mipf25" name="Connect Fault" sourceRef="BoundaryEvent_7" targetRef="BuildErrorMessage" />
+ <bpmn2:callActivity id="CallActivity_101qf6x" name="Call Notification Service" calledElement="${URN_mso_workflow_notification_name}">
+ <bpmn2:extensionElements>
+ <camunda:in source="mso-request-id" target="mso-request-id" />
+ <camunda:in source="mso-service-instance-id" target="mso-service-instance-id" />
+ <camunda:in variables="all" />
+ <camunda:out variables="all" />
+ </bpmn2:extensionElements>
+ <bpmn2:incoming>if_notifcationURLExists</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_13qdn1s</bpmn2:outgoing>
+ </bpmn2:callActivity>
+ <bpmn2:sequenceFlow id="SequenceFlow_13qdn1s" sourceRef="CallActivity_101qf6x" targetRef="ParallelGateway_5" />
+ <bpmn2:sequenceFlow id="if_notifcationURLExists" name="Yes" sourceRef="ParallelGateway_3" targetRef="CallActivity_101qf6x">
+ <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("CMSO_notification-url-Ok") ==true}]]></bpmn2:conditionExpression>
+ </bpmn2:sequenceFlow>
</bpmn2:process>
<bpmn2:message id="Message_2" name="CompleteMsoProcessRequest" />
<bpmn2:error id="Error_3" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
@@ -193,253 +228,325 @@ println "CompleteMsoProcess Response -->" + "\n" + execution.getVariable("Comple
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="CompleteMsoProcess">
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_41" bpmnElement="StartEvent_1">
- <dc:Bounds x="377" y="1075" width="36" height="36" />
+ <dc:Bounds x="106" y="297" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="401" y="1116" width="54" height="24" />
+ <dc:Bounds x="132" y="338" width="50" height="24" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_ParallelGateway_4" bpmnElement="ParallelGateway_3" isMarkerVisible="true">
+ <dc:Bounds x="471" y="193" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="386" y="170" width="73" height="24" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_ParallelGateway_6" bpmnElement="ParallelGateway_5" isMarkerVisible="true">
+ <dc:Bounds x="811" y="193" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="836" y="248" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_59" bpmnElement="ExclusiveGateway_5">
+ <dc:Bounds x="372" y="289" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="397" y="344" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_ParallelGateway_7" bpmnElement="ParallelGateway_6">
+ <dc:Bounds x="1162" y="290" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1187" y="345" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_32" bpmnElement="SequenceFlow_32" sourceElement="_BPMNShape_ParallelGateway_6" targetElement="_BPMNShape_ParallelGateway_7">
+ <di:waypoint xsi:type="dc:Point" x="861" y="218" />
+ <di:waypoint xsi:type="dc:Point" x="1187" y="218" />
+ <di:waypoint xsi:type="dc:Point" x="1187" y="290" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1024" y="203" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_ScriptTask_34" bpmnElement="preProcessRequest">
- <dc:Bounds x="543" y="1053" width="100" height="80" />
+ <dc:Bounds x="226" y="275" width="100" height="80" />
</bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_2" bpmnElement="SequenceFlow_2" sourceElement="_BPMNShape_ScriptTask_34" targetElement="_BPMNShape_ExclusiveGateway_59">
+ <di:waypoint xsi:type="dc:Point" x="326" y="315" />
+ <di:waypoint xsi:type="dc:Point" x="372" y="314" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="338" y="315" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_20" bpmnElement="SequenceFlow_18" sourceElement="_BPMNShape_StartEvent_41" targetElement="_BPMNShape_ScriptTask_34">
+ <di:waypoint xsi:type="dc:Point" x="142" y="315" />
+ <di:waypoint xsi:type="dc:Point" x="226" y="315" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="184" y="300" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_60" bpmnElement="ExclusiveGateway_3" isMarkerVisible="true">
- <dc:Bounds x="734" y="1068" width="50" height="50" />
+ <dc:Bounds x="475" y="538" width="50" height="50" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="782" y="1083" width="100" height="22" />
+ <dc:Bounds x="533" y="553" width="80" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_ParallelGateway_9" bpmnElement="ParallelGateway_7" isMarkerVisible="true">
- <dc:Bounds x="1214" y="1068" width="50" height="50" />
+ <dc:Bounds x="955" y="538" width="50" height="50" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1239" y="1123" width="0" height="0" />
+ <dc:Bounds x="980" y="593" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_41" bpmnElement="SequenceFlow_39" sourceElement="_BPMNShape_ParallelGateway_9" targetElement="_BPMNShape_ParallelGateway_7">
+ <di:waypoint xsi:type="dc:Point" x="1005" y="563" />
+ <di:waypoint xsi:type="dc:Point" x="1187" y="563" />
+ <di:waypoint xsi:type="dc:Point" x="1187" y="340" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1096" y="548" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_42" bpmnElement="SequenceFlow_40" sourceElement="_BPMNShape_ParallelGateway_4" targetElement="_BPMNShape_ParallelGateway_6">
+ <di:waypoint xsi:type="dc:Point" x="496" y="243" />
+ <di:waypoint xsi:type="dc:Point" x="496" y="306" />
+ <di:waypoint xsi:type="dc:Point" x="836" y="306" />
+ <di:waypoint xsi:type="dc:Point" x="836" y="243" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="502" y="248.42647058823525" width="14" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_ScriptTask_51" bpmnElement="updateInfraRequest">
- <dc:Bounds x="973" y="1144" width="100" height="80" />
+ <dc:Bounds x="714" y="614" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_ScriptTask_52" bpmnElement="updateDBStatus">
- <dc:Bounds x="970" y="963" width="100" height="80" />
+ <dc:Bounds x="711" y="433" width="100" height="80" />
</bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_47" bpmnElement="SequenceFlow_45" sourceElement="_BPMNShape_ExclusiveGateway_59" targetElement="_BPMNShape_ParallelGateway_4">
+ <di:waypoint xsi:type="dc:Point" x="397" y="289" />
+ <di:waypoint xsi:type="dc:Point" x="397" y="218" />
+ <di:waypoint xsi:type="dc:Point" x="471" y="218" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="412" y="253.5" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_ScriptTask_64" bpmnElement="prepareUpdateRequest">
- <dc:Bounds x="822" y="963" width="100" height="80" />
+ <dc:Bounds x="563" y="433" width="100" height="80" />
</bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_48" bpmnElement="SequenceFlow_46" sourceElement="_BPMNShape_ExclusiveGateway_59" targetElement="_BPMNShape_ExclusiveGateway_60">
+ <di:waypoint xsi:type="dc:Point" x="397" y="339" />
+ <di:waypoint xsi:type="dc:Point" x="397" y="563" />
+ <di:waypoint xsi:type="dc:Point" x="475" y="563" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="412" y="451" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_50" bpmnElement="SequenceFlow_49" sourceElement="_BPMNShape_ScriptTask_64" targetElement="_BPMNShape_ScriptTask_52">
- <di:waypoint xsi:type="dc:Point" x="922" y="1003" />
- <di:waypoint xsi:type="dc:Point" x="970" y="1003" />
+ <di:waypoint xsi:type="dc:Point" x="663" y="473" />
+ <di:waypoint xsi:type="dc:Point" x="711" y="473" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="937" y="1003" width="6" height="6" />
+ <dc:Bounds x="681" y="473" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_73" bpmnElement="SequenceFlow_72" sourceElement="_BPMNShape_ExclusiveGateway_60" targetElement="_BPMNShape_ScriptTask_88">
- <di:waypoint xsi:type="dc:Point" x="759" y="1118" />
- <di:waypoint xsi:type="dc:Point" x="759" y="1184" />
- <di:waypoint xsi:type="dc:Point" x="822" y="1184" />
+ <di:waypoint xsi:type="dc:Point" x="500" y="588" />
+ <di:waypoint xsi:type="dc:Point" x="500" y="654" />
+ <di:waypoint xsi:type="dc:Point" x="563" y="654" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="761" y="1141" width="22" height="22" />
+ <dc:Bounds x="506" y="611" width="14" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_82" bpmnElement="SequenceFlow_81" sourceElement="_BPMNShape_ExclusiveGateway_60" targetElement="_BPMNShape_ScriptTask_64">
- <di:waypoint xsi:type="dc:Point" x="759" y="1068" />
- <di:waypoint xsi:type="dc:Point" x="759" y="1003" />
- <di:waypoint xsi:type="dc:Point" x="822" y="1003" />
+ <di:waypoint xsi:type="dc:Point" x="500" y="538" />
+ <di:waypoint xsi:type="dc:Point" x="500" y="473" />
+ <di:waypoint xsi:type="dc:Point" x="563" y="473" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="758" y="1022" width="29" height="22" />
+ <dc:Bounds x="505" y="492" width="18" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_SubProcess_13" bpmnElement="subProcessExceptionCompleteMSO" isExpanded="true">
- <dc:Bounds x="596" y="1416" width="427" height="169" />
+ <dc:Bounds x="166" y="858" width="427" height="169" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_EndEvent_110" bpmnElement="endEventExceptionCompleteMSO">
- <dc:Bounds x="896" y="1483" width="36" height="36" />
+ <dc:Bounds x="466" y="925" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="914" y="1524" width="0" height="0" />
+ <dc:Bounds x="484" y="966" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_51" bpmnElement="startEventExceptionCompleteMSO">
- <dc:Bounds x="692" y="1483" width="36" height="36" />
+ <dc:Bounds x="214" y="925" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="710" y="1524" width="0" height="0" />
+ <dc:Bounds x="232" y="966" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_63" bpmnElement="ExclusiveGateway_7" isMarkerVisible="true">
- <dc:Bounds x="1132" y="1158" width="50" height="50" />
+ <dc:Bounds x="873" y="628" width="50" height="50" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1157" y="1213" width="0" height="0" />
+ <dc:Bounds x="898" y="683" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_6" bpmnElement="SequenceFlow_6" sourceElement="_BPMNShape_ScriptTask_51" targetElement="_BPMNShape_ExclusiveGateway_63">
- <di:waypoint xsi:type="dc:Point" x="1073" y="1184" />
- <di:waypoint xsi:type="dc:Point" x="1132" y="1183" />
+ <di:waypoint xsi:type="dc:Point" x="814" y="654" />
+ <di:waypoint xsi:type="dc:Point" x="873" y="653" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1255" y="1227" width="6" height="6" />
+ <dc:Bounds x="999" y="697" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_7" bpmnElement="SequenceFlow_7" sourceElement="_BPMNShape_ExclusiveGateway_63" targetElement="_BPMNShape_ParallelGateway_9">
- <di:waypoint xsi:type="dc:Point" x="1182" y="1183" />
- <di:waypoint xsi:type="dc:Point" x="1239" y="1183" />
- <di:waypoint xsi:type="dc:Point" x="1239" y="1118" />
+ <di:waypoint xsi:type="dc:Point" x="923" y="653" />
+ <di:waypoint xsi:type="dc:Point" x="980" y="653" />
+ <di:waypoint xsi:type="dc:Point" x="980" y="588" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1158" y="1141" width="0" height="0" />
+ <dc:Bounds x="899" y="611" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_EndEvent_111" bpmnElement="EndEvent_4">
- <dc:Bounds x="1269" y="1271" width="36" height="36" />
+ <dc:Bounds x="1010" y="741" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1287" y="1312" width="0" height="0" />
+ <dc:Bounds x="1028" y="782" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_ScriptTask_76" bpmnElement="BuildErrorMessage">
- <dc:Bounds x="1108" y="1249" width="100" height="80" />
+ <dc:Bounds x="849" y="719" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="_BPMNShape_ExclusiveGateway_63" targetElement="_BPMNShape_ScriptTask_76">
- <di:waypoint xsi:type="dc:Point" x="1157" y="1208" />
- <di:waypoint xsi:type="dc:Point" x="1158" y="1249" />
+ <di:waypoint xsi:type="dc:Point" x="898" y="678" />
+ <di:waypoint xsi:type="dc:Point" x="899" y="719" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1199" y="1035" width="6" height="6" />
+ <dc:Bounds x="943" y="505" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_9" bpmnElement="SequenceFlow_9" sourceElement="_BPMNShape_ScriptTask_76" targetElement="_BPMNShape_EndEvent_111">
- <di:waypoint xsi:type="dc:Point" x="1208" y="1289" />
- <di:waypoint xsi:type="dc:Point" x="1269" y="1289" />
+ <di:waypoint xsi:type="dc:Point" x="949" y="759" />
+ <di:waypoint xsi:type="dc:Point" x="1010" y="759" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1236" y="1289" width="6" height="6" />
+ <dc:Bounds x="980" y="759" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_ScriptTask_77" bpmnElement="Done">
- <dc:Bounds x="1409" y="1053" width="100" height="80" />
+ <dc:Bounds x="1253" y="276" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_66" bpmnElement="ExclusiveGateway_10" isMarkerVisible="true">
- <dc:Bounds x="1132" y="977" width="50" height="50" />
+ <dc:Bounds x="873" y="447" width="50" height="50" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1157" y="1032" width="0" height="0" />
+ <dc:Bounds x="898" y="502" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_23" bpmnElement="SequenceFlow_23" sourceElement="_BPMNShape_ScriptTask_52" targetElement="_BPMNShape_ExclusiveGateway_66">
- <di:waypoint xsi:type="dc:Point" x="1070" y="1003" />
- <di:waypoint xsi:type="dc:Point" x="1132" y="1002" />
+ <di:waypoint xsi:type="dc:Point" x="811" y="473" />
+ <di:waypoint xsi:type="dc:Point" x="873" y="472" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1261" y="1003" width="6" height="6" />
+ <dc:Bounds x="1005" y="473" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_25" bpmnElement="SequenceFlow_24" sourceElement="_BPMNShape_ExclusiveGateway_66" targetElement="_BPMNShape_ParallelGateway_9">
- <di:waypoint xsi:type="dc:Point" x="1182" y="1002" />
- <di:waypoint xsi:type="dc:Point" x="1239" y="1002" />
- <di:waypoint xsi:type="dc:Point" x="1239" y="1068" />
+ <di:waypoint xsi:type="dc:Point" x="923" y="472" />
+ <di:waypoint xsi:type="dc:Point" x="980" y="472" />
+ <di:waypoint xsi:type="dc:Point" x="980" y="538" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1348" y="1003" width="6" height="6" />
+ <dc:Bounds x="1092" y="473" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_ScriptTask_79" bpmnElement="BuildErrorMessage1">
- <dc:Bounds x="1108" y="856" width="100" height="80" />
+ <dc:Bounds x="849" y="326" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_26" bpmnElement="SequenceFlow_25" sourceElement="_BPMNShape_ExclusiveGateway_66" targetElement="_BPMNShape_ScriptTask_79">
- <di:waypoint xsi:type="dc:Point" x="1157" y="977" />
- <di:waypoint xsi:type="dc:Point" x="1158" y="936" />
+ <di:waypoint xsi:type="dc:Point" x="898" y="447" />
+ <di:waypoint xsi:type="dc:Point" x="899" y="406" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1242" y="957" width="6" height="6" />
+ <dc:Bounds x="986" y="427" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_EndEvent_113" bpmnElement="EndEvent_5">
- <dc:Bounds x="1269" y="878" width="36" height="36" />
+ <dc:Bounds x="1010" y="348" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1287" y="919" width="0" height="0" />
+ <dc:Bounds x="1028" y="389" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_34" bpmnElement="SequenceFlow_33" sourceElement="_BPMNShape_ParallelGateway_7" targetElement="_BPMNShape_ScriptTask_77">
+ <di:waypoint xsi:type="dc:Point" x="1212" y="315" />
+ <di:waypoint xsi:type="dc:Point" x="1253" y="316" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1202" y="316" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_14" bpmnElement="SequenceFlow_13" sourceElement="_BPMNShape_ScriptTask_79" targetElement="_BPMNShape_EndEvent_113">
- <di:waypoint xsi:type="dc:Point" x="1208" y="896" />
- <di:waypoint xsi:type="dc:Point" x="1269" y="896" />
+ <di:waypoint xsi:type="dc:Point" x="949" y="366" />
+ <di:waypoint xsi:type="dc:Point" x="1010" y="366" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1225" y="896" width="6" height="6" />
+ <dc:Bounds x="969" y="366" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_EndEvent_128" bpmnElement="EndEvent_1">
- <dc:Bounds x="1623" y="1075" width="36" height="36" />
+ <dc:Bounds x="1397" y="297" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1641" y="1116" width="0" height="0" />
+ <dc:Bounds x="1415" y="338" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_18" bpmnElement="SequenceFlow_17" sourceElement="_BPMNShape_ScriptTask_77" targetElement="_BPMNShape_EndEvent_128">
- <di:waypoint xsi:type="dc:Point" x="1509" y="1093" />
- <di:waypoint xsi:type="dc:Point" x="1623" y="1093" />
+ <di:waypoint xsi:type="dc:Point" x="1353" y="316" />
+ <di:waypoint xsi:type="dc:Point" x="1397" y="315" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1566" y="1078" width="0" height="0" />
+ <dc:Bounds x="1375" y="300.5" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_BoundaryEvent_28" bpmnElement="BoundaryEvent_6">
- <dc:Bounds x="1001" y="945" width="36" height="36" />
+ <dc:Bounds x="742" y="415" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1016" y="986" width="6" height="6" />
+ <dc:Bounds x="760" y="456" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_BoundaryEvent_29" bpmnElement="BoundaryEvent_7">
- <dc:Bounds x="1002" y="1206" width="36" height="36" />
+ <dc:Bounds x="743" y="676" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1292" y="1088" width="6" height="6" />
+ <dc:Bounds x="1036" y="558" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_EndEvent_218" bpmnElement="EndEvent_12">
- <dc:Bounds x="1001" y="864" width="36" height="36" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="1019" y="905" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_15" bpmnElement="SequenceFlow_14" sourceElement="_BPMNShape_BoundaryEvent_28" targetElement="_BPMNShape_EndEvent_218">
- <di:waypoint xsi:type="dc:Point" x="1019" y="945" />
- <di:waypoint xsi:type="dc:Point" x="1019" y="900" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="1180" y="927" width="6" height="6" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_EndEvent_219" bpmnElement="EndEvent_13">
- <dc:Bounds x="1002" y="1292" width="36" height="36" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="1020" y="1333" width="0" height="0" />
- </bpmndi:BPMNLabel>
+ <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_88" bpmnElement="ScriptTask_3">
+ <dc:Bounds x="563" y="614" width="100" height="80" />
</bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_22" bpmnElement="SequenceFlow_21" sourceElement="_BPMNShape_BoundaryEvent_29" targetElement="_BPMNShape_EndEvent_219">
- <di:waypoint xsi:type="dc:Point" x="1020" y="1242" />
- <di:waypoint xsi:type="dc:Point" x="1020" y="1292" />
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_11" bpmnElement="SequenceFlow_10" sourceElement="_BPMNShape_ScriptTask_88" targetElement="_BPMNShape_ScriptTask_51">
+ <di:waypoint xsi:type="dc:Point" x="663" y="654" />
+ <di:waypoint xsi:type="dc:Point" x="714" y="654" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="847" y="747" width="6" height="6" />
+ <dc:Bounds x="683" y="678" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_88" bpmnElement="ScriptTask_3">
- <dc:Bounds x="822" y="1144" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_11" bpmnElement="SequenceFlow_10" sourceElement="_BPMNShape_ScriptTask_88" targetElement="_BPMNShape_ScriptTask_51">
- <di:waypoint xsi:type="dc:Point" x="922" y="1184" />
- <di:waypoint xsi:type="dc:Point" x="973" y="1184" />
+ <bpmndi:BPMNEdge id="SequenceFlow_1q7eer1_di" bpmnElement="SequenceFlow_1q7eer1">
+ <di:waypoint xsi:type="dc:Point" x="760" y="415" />
+ <di:waypoint xsi:type="dc:Point" x="760" y="366" />
+ <di:waypoint xsi:type="dc:Point" x="849" y="366" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="939" y="1208" width="6" height="6" />
+ <dc:Bounds x="680" y="380" width="68" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_21" bpmnElement="SequenceFlow_19" sourceElement="_BPMNShape_StartEvent_51" targetElement="_BPMNShape_EndEvent_110">
- <di:waypoint xsi:type="dc:Point" x="728" y="1501" />
- <di:waypoint xsi:type="dc:Point" x="896" y="1501" />
+ <bpmndi:BPMNEdge id="SequenceFlow_0mipf25_di" bpmnElement="SequenceFlow_0mipf25">
+ <di:waypoint xsi:type="dc:Point" x="761" y="712" />
+ <di:waypoint xsi:type="dc:Point" x="761" y="759" />
+ <di:waypoint xsi:type="dc:Point" x="849" y="759" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="854" y="1501" width="0" height="0" />
+ <dc:Bounds x="680" y="726" width="68" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_1s593bx_di" bpmnElement="SequenceFlow_1s593bx">
- <di:waypoint xsi:type="dc:Point" x="413" y="1093" />
- <di:waypoint xsi:type="dc:Point" x="543" y="1093" />
+ <bpmndi:BPMNShape id="CallActivity_101qf6x_di" bpmnElement="CallActivity_101qf6x">
+ <dc:Bounds x="620" y="119" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_13qdn1s_di" bpmnElement="SequenceFlow_13qdn1s">
+ <di:waypoint xsi:type="dc:Point" x="720" y="159" />
+ <di:waypoint xsi:type="dc:Point" x="836" y="159" />
+ <di:waypoint xsi:type="dc:Point" x="836" y="193" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="478" y="1078" width="0" height="0" />
+ <dc:Bounds x="778" y="144" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_1epmndu_di" bpmnElement="SequenceFlow_1epmndu">
- <di:waypoint xsi:type="dc:Point" x="643" y="1093" />
- <di:waypoint xsi:type="dc:Point" x="734" y="1093" />
+ <bpmndi:BPMNEdge id="SequenceFlow_1i1h3il_di" bpmnElement="SequenceFlow_1i1h3il">
+ <di:waypoint xsi:type="dc:Point" x="250" y="943" />
+ <di:waypoint xsi:type="dc:Point" x="466" y="943" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="689" y="1078" width="0" height="0" />
+ <dc:Bounds x="358" y="928" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_0fni7aq_di" bpmnElement="SequenceFlow_0fni7aq">
- <di:waypoint xsi:type="dc:Point" x="1264" y="1093" />
- <di:waypoint xsi:type="dc:Point" x="1319" y="1093" />
- <di:waypoint xsi:type="dc:Point" x="1319" y="1093" />
- <di:waypoint xsi:type="dc:Point" x="1409" y="1093" />
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_10" bpmnElement="if_notifcationURLExists">
+ <di:waypoint xsi:type="dc:Point" x="496" y="193" />
+ <di:waypoint xsi:type="dc:Point" x="496" y="159" />
+ <di:waypoint xsi:type="dc:Point" x="620" y="159" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1334" y="1093" width="0" height="0" />
+ <dc:Bounds x="519" y="165" width="18" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/ConfirmVolumeGroupTenant.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/ConfirmVolumeGroupTenant.bpmn
index fee4dbd2d3..df55046a7b 100644
--- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/ConfirmVolumeGroupTenant.bpmn
+++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/ConfirmVolumeGroupTenant.bpmn
@@ -1,190 +1,190 @@
-<?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" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd" id="_jPy0EB7JEeaR94RQz1cKqQ" exporter="camunda modeler" exporterVersion="2.7.0" targetNamespace="http://camunda.org/schema/1.0/bpmn">
- <bpmn2:process id="ConfirmVolumeGroupTenant" name="ConfirmVolumeGroupTenant" isExecutable="true">
- <bpmn2:scriptTask id="queryAAIForVolumeGroup" name="Query AAI Volume Group" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_2</bpmn2:outgoing>
+<?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" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd" id="_jPy0EB7JEeaR94RQz1cKqQ" exporter="camunda modeler" exporterVersion="2.7.0" targetNamespace="http://camunda.org/schema/1.0/bpmn">
+ <bpmn2:process id="ConfirmVolumeGroupTenant" name="ConfirmVolumeGroupTenant" isExecutable="true">
+ <bpmn2:scriptTask id="queryAAIForVolumeGroup" name="Query AAI Volume Group" scriptFormat="groovy">
+ <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_2</bpmn2:outgoing>
<bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
ConfirmVolumeGroupTenant volume = new ConfirmVolumeGroupTenant()
-volume.preProcessRequest(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:exclusiveGateway id="tenantIdMatchCheck" name="Tenant Ids&#xD;&#xA;Match?" default="idsMatchNo">
- <bpmn2:incoming>SequenceFlow_2</bpmn2:incoming>
- <bpmn2:outgoing>idsMatchNo</bpmn2:outgoing>
- <bpmn2:outgoing>idsMatchYes</bpmn2:outgoing>
- </bpmn2:exclusiveGateway>
- <bpmn2:sequenceFlow id="SequenceFlow_2" name="" sourceRef="queryAAIForVolumeGroup" targetRef="tenantIdMatchCheck"/>
- <bpmn2:sequenceFlow id="idsMatchNo" name="No" sourceRef="tenantIdMatchCheck" targetRef="assignError"/>
- <bpmn2:sequenceFlow id="idsMatchYes" name="Yes" sourceRef="tenantIdMatchCheck" targetRef="tenantNamesMatchCheck">
- <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("tenantIdsMatch")==true}]]></bpmn2:conditionExpression>
- </bpmn2:sequenceFlow>
- <bpmn2:endEvent id="EndEvent_1">
- <bpmn2:incoming>SequenceFlow_7</bpmn2:incoming>
- <bpmn2:terminateEventDefinition id="_TerminateEventDefinition_2"/>
- </bpmn2:endEvent>
- <bpmn2:scriptTask id="assignError" name="Assign Workflow Exception" scriptFormat="groovy">
- <bpmn2:incoming>idsMatchNo</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_8</bpmn2:outgoing>
+volume.preProcessRequest(execution)]]></bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:exclusiveGateway id="tenantIdMatchCheck" name="Tenant Ids&#xD;&#xA;Match?" default="idsMatchNo">
+ <bpmn2:incoming>SequenceFlow_2</bpmn2:incoming>
+ <bpmn2:outgoing>idsMatchNo</bpmn2:outgoing>
+ <bpmn2:outgoing>idsMatchYes</bpmn2:outgoing>
+ </bpmn2:exclusiveGateway>
+ <bpmn2:sequenceFlow id="SequenceFlow_2" name="" sourceRef="queryAAIForVolumeGroup" targetRef="tenantIdMatchCheck"/>
+ <bpmn2:sequenceFlow id="idsMatchNo" name="No" sourceRef="tenantIdMatchCheck" targetRef="assignError"/>
+ <bpmn2:sequenceFlow id="idsMatchYes" name="Yes" sourceRef="tenantIdMatchCheck" targetRef="tenantNamesMatchCheck">
+ <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("tenantIdsMatch")==true}]]></bpmn2:conditionExpression>
+ </bpmn2:sequenceFlow>
+ <bpmn2:endEvent id="EndEvent_1">
+ <bpmn2:incoming>SequenceFlow_7</bpmn2:incoming>
+ <bpmn2:terminateEventDefinition id="_TerminateEventDefinition_2"/>
+ </bpmn2:endEvent>
+ <bpmn2:scriptTask id="assignError" name="Assign Workflow Exception" scriptFormat="groovy">
+ <bpmn2:incoming>idsMatchNo</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_8</bpmn2:outgoing>
<bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
ConfirmVolumeGroupTenant volume = new ConfirmVolumeGroupTenant()
-volume.assignWorkflowException(execution, "does not belong to your tenant")]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_8" name="" sourceRef="assignError" targetRef="EndEvent_3"/>
- <bpmn2:endEvent id="EndEvent_3">
- <bpmn2:incoming>SequenceFlow_8</bpmn2:incoming>
- <bpmn2:errorEventDefinition id="_ErrorEventDefinition_75" errorRef="Error_1"/>
- </bpmn2:endEvent>
- <bpmn2:scriptTask id="assignVolumeHeatId" name="Assign Volume Heat Id" scriptFormat="groovy">
- <bpmn2:incoming>groupNamesMatchYes</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_7</bpmn2:outgoing>
+volume.assignWorkflowException(execution, "does not belong to your tenant")]]></bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_8" name="" sourceRef="assignError" targetRef="EndEvent_3"/>
+ <bpmn2:endEvent id="EndEvent_3">
+ <bpmn2:incoming>SequenceFlow_8</bpmn2:incoming>
+ <bpmn2:errorEventDefinition id="_ErrorEventDefinition_75" errorRef="Error_1"/>
+ </bpmn2:endEvent>
+ <bpmn2:scriptTask id="assignVolumeHeatId" name="Assign Volume Heat Id" scriptFormat="groovy">
+ <bpmn2:incoming>groupNamesMatchYes</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_7</bpmn2:outgoing>
<bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
ConfirmVolumeGroupTenant volume = new ConfirmVolumeGroupTenant()
-volume.assignVolumeHeatId(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_7" name="" sourceRef="assignVolumeHeatId" targetRef="EndEvent_1"/>
- <bpmn2:scriptTask id="assignErrorNames" name="Assign Workflow Exception" scriptFormat="groovy">
- <bpmn2:incoming>groupNamesMatchNo</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_9</bpmn2:outgoing>
+volume.assignVolumeHeatId(execution)]]></bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_7" name="" sourceRef="assignVolumeHeatId" targetRef="EndEvent_1"/>
+ <bpmn2:scriptTask id="assignErrorNames" name="Assign Workflow Exception" scriptFormat="groovy">
+ <bpmn2:incoming>groupNamesMatchNo</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_9</bpmn2:outgoing>
<bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
ConfirmVolumeGroupTenant volume = new ConfirmVolumeGroupTenant()
-volume.assignWorkflowException(execution, "name does not match")]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_9" name="" sourceRef="assignErrorNames" targetRef="EndEvent_2"/>
- <bpmn2:endEvent id="EndEvent_2">
- <bpmn2:incoming>SequenceFlow_9</bpmn2:incoming>
- <bpmn2:errorEventDefinition id="_ErrorEventDefinition_74" errorRef="Error_1"/>
- </bpmn2:endEvent>
- <bpmn2:exclusiveGateway id="tenantNamesMatchCheck" name="Volume Group&#xD;&#xA;Names Match?" default="groupNamesMatchNo">
- <bpmn2:incoming>idsMatchYes</bpmn2:incoming>
- <bpmn2:outgoing>groupNamesMatchNo</bpmn2:outgoing>
- <bpmn2:outgoing>groupNamesMatchYes</bpmn2:outgoing>
- </bpmn2:exclusiveGateway>
- <bpmn2:sequenceFlow id="groupNamesMatchNo" name="No" sourceRef="tenantNamesMatchCheck" targetRef="assignErrorNames"/>
- <bpmn2:sequenceFlow id="groupNamesMatchYes" name="Yes" sourceRef="tenantNamesMatchCheck" targetRef="assignVolumeHeatId">
- <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("groupNamesMatch")==true}]]></bpmn2:conditionExpression>
- </bpmn2:sequenceFlow>
- <bpmn2:startEvent id="StartEvent_1">
- <bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing>
- </bpmn2:startEvent>
- <bpmn2:sequenceFlow id="SequenceFlow_1" name="" sourceRef="StartEvent_1" targetRef="queryAAIForVolumeGroup"/>
- </bpmn2:process>
- <bpmn2:error id="Error_1" errorCode="MSOWorkflowException" name="MSO Workflow Exception"/>
- <bpmndi:BPMNDiagram id="BPMNDiagram_1">
- <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="ConfirmVolumeGroupTenant">
- <bpmndi:BPMNShape id="_BPMNShape_StartEvent_61" bpmnElement="StartEvent_1">
- <dc:Bounds height="36.0" width="36.0" x="129.0" y="324.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="147.0" y="365.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_237" bpmnElement="queryAAIForVolumeGroup">
- <dc:Bounds height="80.0" width="100.0" x="252.0" y="302.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="_BPMNShape_StartEvent_61" targetElement="_BPMNShape_ScriptTask_237">
- <di:waypoint xsi:type="dc:Point" x="165.0" y="342.0"/>
- <di:waypoint xsi:type="dc:Point" x="252.0" y="342.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="179.0" y="342.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_209" bpmnElement="tenantIdMatchCheck" isMarkerVisible="true">
- <dc:Bounds height="50.0" width="50.0" x="384.0" y="316.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="38.0" width="76.0" x="414.0" y="347.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_2" bpmnElement="SequenceFlow_2" sourceElement="_BPMNShape_ScriptTask_237" targetElement="_BPMNShape_ExclusiveGateway_209">
- <di:waypoint xsi:type="dc:Point" x="352.0" y="342.0"/>
- <di:waypoint xsi:type="dc:Point" x="368.0" y="342.0"/>
- <di:waypoint xsi:type="dc:Point" x="368.0" y="341.0"/>
- <di:waypoint xsi:type="dc:Point" x="384.0" y="341.0"/>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_210" bpmnElement="tenantNamesMatchCheck" isMarkerVisible="true">
- <dc:Bounds height="50.0" width="50.0" x="460.0" y="216.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="38.0" width="99.0" x="494.0" y="246.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_238" bpmnElement="assignError">
- <dc:Bounds height="80.0" width="100.0" x="456.0" y="400.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="idsMatchNo" sourceElement="_BPMNShape_ExclusiveGateway_209" targetElement="_BPMNShape_ScriptTask_238">
- <di:waypoint xsi:type="dc:Point" x="409.0" y="366.0"/>
- <di:waypoint xsi:type="dc:Point" x="409.0" y="440.0"/>
- <di:waypoint xsi:type="dc:Point" x="456.0" y="440.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="22.0" width="22.0" x="414.0" y="400.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_4" bpmnElement="idsMatchYes" sourceElement="_BPMNShape_ExclusiveGateway_209" targetElement="_BPMNShape_ExclusiveGateway_210">
- <di:waypoint xsi:type="dc:Point" x="409.0" y="316.0"/>
- <di:waypoint xsi:type="dc:Point" x="409.0" y="241.0"/>
- <di:waypoint xsi:type="dc:Point" x="460.0" y="241.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="22.0" width="29.0" x="411.0" y="266.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_239" bpmnElement="assignErrorNames">
- <dc:Bounds height="80.0" width="100.0" x="555.0" y="296.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_5" bpmnElement="groupNamesMatchNo" sourceElement="_BPMNShape_ExclusiveGateway_210" targetElement="_BPMNShape_ScriptTask_239">
- <di:waypoint xsi:type="dc:Point" x="485.0" y="266.0"/>
- <di:waypoint xsi:type="dc:Point" x="485.0" y="336.0"/>
- <di:waypoint xsi:type="dc:Point" x="555.0" y="336.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="22.0" width="22.0" x="491.0" y="296.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_240" bpmnElement="assignVolumeHeatId">
- <dc:Bounds height="80.0" width="100.0" x="555.0" y="120.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_6" bpmnElement="groupNamesMatchYes" sourceElement="_BPMNShape_ExclusiveGateway_210" targetElement="_BPMNShape_ScriptTask_240">
- <di:waypoint xsi:type="dc:Point" x="485.0" y="216.0"/>
- <di:waypoint xsi:type="dc:Point" x="485.0" y="160.0"/>
- <di:waypoint xsi:type="dc:Point" x="555.0" y="160.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="22.0" width="29.0" x="487.0" y="173.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_EndEvent_200" bpmnElement="EndEvent_1">
- <dc:Bounds height="36.0" width="36.0" x="738.0" y="142.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="756.0" y="183.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_7" bpmnElement="SequenceFlow_7" sourceElement="_BPMNShape_ScriptTask_240" targetElement="_BPMNShape_EndEvent_200">
- <di:waypoint xsi:type="dc:Point" x="655.0" y="160.0"/>
- <di:waypoint xsi:type="dc:Point" x="738.0" y="160.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="692.0" y="160.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_EndEvent_210" bpmnElement="EndEvent_2">
- <dc:Bounds height="36.0" width="36.0" x="709.0" y="318.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="727.0" y="359.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_EndEvent_211" bpmnElement="EndEvent_3">
- <dc:Bounds height="36.0" width="36.0" x="605.0" y="422.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="623.0" y="463.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_8" bpmnElement="SequenceFlow_8" sourceElement="_BPMNShape_ScriptTask_238" targetElement="_BPMNShape_EndEvent_211">
- <di:waypoint xsi:type="dc:Point" x="556.0" y="440.0"/>
- <di:waypoint xsi:type="dc:Point" x="605.0" y="440.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="591.0" y="440.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_9" bpmnElement="SequenceFlow_9" sourceElement="_BPMNShape_ScriptTask_239" targetElement="_BPMNShape_EndEvent_210">
- <di:waypoint xsi:type="dc:Point" x="655.0" y="336.0"/>
- <di:waypoint xsi:type="dc:Point" x="709.0" y="336.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="680.0" y="336.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- </bpmndi:BPMNPlane>
- </bpmndi:BPMNDiagram>
+volume.assignWorkflowException(execution, "name does not match")]]></bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_9" name="" sourceRef="assignErrorNames" targetRef="EndEvent_2"/>
+ <bpmn2:endEvent id="EndEvent_2">
+ <bpmn2:incoming>SequenceFlow_9</bpmn2:incoming>
+ <bpmn2:errorEventDefinition id="_ErrorEventDefinition_74" errorRef="Error_1"/>
+ </bpmn2:endEvent>
+ <bpmn2:exclusiveGateway id="tenantNamesMatchCheck" name="Volume Group&#xD;&#xA;Names Match?" default="groupNamesMatchNo">
+ <bpmn2:incoming>idsMatchYes</bpmn2:incoming>
+ <bpmn2:outgoing>groupNamesMatchNo</bpmn2:outgoing>
+ <bpmn2:outgoing>groupNamesMatchYes</bpmn2:outgoing>
+ </bpmn2:exclusiveGateway>
+ <bpmn2:sequenceFlow id="groupNamesMatchNo" name="No" sourceRef="tenantNamesMatchCheck" targetRef="assignErrorNames"/>
+ <bpmn2:sequenceFlow id="groupNamesMatchYes" name="Yes" sourceRef="tenantNamesMatchCheck" targetRef="assignVolumeHeatId">
+ <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("groupNamesMatch")==true}]]></bpmn2:conditionExpression>
+ </bpmn2:sequenceFlow>
+ <bpmn2:startEvent id="StartEvent_1">
+ <bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing>
+ </bpmn2:startEvent>
+ <bpmn2:sequenceFlow id="SequenceFlow_1" name="" sourceRef="StartEvent_1" targetRef="queryAAIForVolumeGroup"/>
+ </bpmn2:process>
+ <bpmn2:error id="Error_1" errorCode="MSOWorkflowException" name="MSO Workflow Exception"/>
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="ConfirmVolumeGroupTenant">
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_61" bpmnElement="StartEvent_1">
+ <dc:Bounds height="36.0" width="36.0" x="129.0" y="324.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="0.0" width="0.0" x="147.0" y="365.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_237" bpmnElement="queryAAIForVolumeGroup">
+ <dc:Bounds height="80.0" width="100.0" x="252.0" y="302.0"/>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="_BPMNShape_StartEvent_61" targetElement="_BPMNShape_ScriptTask_237">
+ <di:waypoint xsi:type="dc:Point" x="165.0" y="342.0"/>
+ <di:waypoint xsi:type="dc:Point" x="252.0" y="342.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="6.0" width="6.0" x="179.0" y="342.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_209" bpmnElement="tenantIdMatchCheck" isMarkerVisible="true">
+ <dc:Bounds height="50.0" width="50.0" x="384.0" y="316.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="38.0" width="76.0" x="414.0" y="347.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_2" bpmnElement="SequenceFlow_2" sourceElement="_BPMNShape_ScriptTask_237" targetElement="_BPMNShape_ExclusiveGateway_209">
+ <di:waypoint xsi:type="dc:Point" x="352.0" y="342.0"/>
+ <di:waypoint xsi:type="dc:Point" x="368.0" y="342.0"/>
+ <di:waypoint xsi:type="dc:Point" x="368.0" y="341.0"/>
+ <di:waypoint xsi:type="dc:Point" x="384.0" y="341.0"/>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_210" bpmnElement="tenantNamesMatchCheck" isMarkerVisible="true">
+ <dc:Bounds height="50.0" width="50.0" x="460.0" y="216.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="38.0" width="99.0" x="494.0" y="246.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_238" bpmnElement="assignError">
+ <dc:Bounds height="80.0" width="100.0" x="456.0" y="400.0"/>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="idsMatchNo" sourceElement="_BPMNShape_ExclusiveGateway_209" targetElement="_BPMNShape_ScriptTask_238">
+ <di:waypoint xsi:type="dc:Point" x="409.0" y="366.0"/>
+ <di:waypoint xsi:type="dc:Point" x="409.0" y="440.0"/>
+ <di:waypoint xsi:type="dc:Point" x="456.0" y="440.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="22.0" width="22.0" x="414.0" y="400.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_4" bpmnElement="idsMatchYes" sourceElement="_BPMNShape_ExclusiveGateway_209" targetElement="_BPMNShape_ExclusiveGateway_210">
+ <di:waypoint xsi:type="dc:Point" x="409.0" y="316.0"/>
+ <di:waypoint xsi:type="dc:Point" x="409.0" y="241.0"/>
+ <di:waypoint xsi:type="dc:Point" x="460.0" y="241.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="22.0" width="29.0" x="411.0" y="266.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_239" bpmnElement="assignErrorNames">
+ <dc:Bounds height="80.0" width="100.0" x="555.0" y="296.0"/>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_5" bpmnElement="groupNamesMatchNo" sourceElement="_BPMNShape_ExclusiveGateway_210" targetElement="_BPMNShape_ScriptTask_239">
+ <di:waypoint xsi:type="dc:Point" x="485.0" y="266.0"/>
+ <di:waypoint xsi:type="dc:Point" x="485.0" y="336.0"/>
+ <di:waypoint xsi:type="dc:Point" x="555.0" y="336.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="22.0" width="22.0" x="491.0" y="296.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_240" bpmnElement="assignVolumeHeatId">
+ <dc:Bounds height="80.0" width="100.0" x="555.0" y="120.0"/>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_6" bpmnElement="groupNamesMatchYes" sourceElement="_BPMNShape_ExclusiveGateway_210" targetElement="_BPMNShape_ScriptTask_240">
+ <di:waypoint xsi:type="dc:Point" x="485.0" y="216.0"/>
+ <di:waypoint xsi:type="dc:Point" x="485.0" y="160.0"/>
+ <di:waypoint xsi:type="dc:Point" x="555.0" y="160.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="22.0" width="29.0" x="487.0" y="173.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_EndEvent_200" bpmnElement="EndEvent_1">
+ <dc:Bounds height="36.0" width="36.0" x="738.0" y="142.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="0.0" width="0.0" x="756.0" y="183.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_7" bpmnElement="SequenceFlow_7" sourceElement="_BPMNShape_ScriptTask_240" targetElement="_BPMNShape_EndEvent_200">
+ <di:waypoint xsi:type="dc:Point" x="655.0" y="160.0"/>
+ <di:waypoint xsi:type="dc:Point" x="738.0" y="160.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="6.0" width="6.0" x="692.0" y="160.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_EndEvent_210" bpmnElement="EndEvent_2">
+ <dc:Bounds height="36.0" width="36.0" x="709.0" y="318.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="0.0" width="0.0" x="727.0" y="359.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_EndEvent_211" bpmnElement="EndEvent_3">
+ <dc:Bounds height="36.0" width="36.0" x="605.0" y="422.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="0.0" width="0.0" x="623.0" y="463.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_8" bpmnElement="SequenceFlow_8" sourceElement="_BPMNShape_ScriptTask_238" targetElement="_BPMNShape_EndEvent_211">
+ <di:waypoint xsi:type="dc:Point" x="556.0" y="440.0"/>
+ <di:waypoint xsi:type="dc:Point" x="605.0" y="440.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="6.0" width="6.0" x="591.0" y="440.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_9" bpmnElement="SequenceFlow_9" sourceElement="_BPMNShape_ScriptTask_239" targetElement="_BPMNShape_EndEvent_210">
+ <di:waypoint xsi:type="dc:Point" x="655.0" y="336.0"/>
+ <di:waypoint xsi:type="dc:Point" x="709.0" y="336.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="6.0" width="6.0" x="680.0" y="336.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
</bpmn2:definitions> \ No newline at end of file
diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CreateAAIVfModule.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CreateAAIVfModule.bpmn
index 2ca2693b7c..3ac1fe7781 100644
--- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CreateAAIVfModule.bpmn
+++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CreateAAIVfModule.bpmn
@@ -1,519 +1,519 @@
-<?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" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd" id="_Wblj8GyfEeWUWLTvug7ZOg" exporter="camunda modeler" exporterVersion="2.7.0" targetNamespace="http://camunda.org/schema/1.0/bpmn">
- <bpmn2:process id="CreateAAIVfModule" name="CreateAAIVfModule" isExecutable="true">
- <bpmn2:exclusiveGateway id="ExclusiveGateway_5" default="SequenceFlow_7">
- <bpmn2:incoming>SequenceFlow_24</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_6</bpmn2:outgoing>
- <bpmn2:outgoing>SequenceFlow_7</bpmn2:outgoing>
- <bpmn2:outgoing>SequenceFlow_28</bpmn2:outgoing>
- </bpmn2:exclusiveGateway>
- <bpmn2:sequenceFlow id="SequenceFlow_6" name="" sourceRef="ExclusiveGateway_5" targetRef="ExclusiveGateway_6">
- <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{(execution.getVariable("CAAIVfMod_newGenericVnf") == true && execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") == 404) || execution.getVariable("CAAIVfMod_isBaseVfModule") == true}]]></bpmn2:conditionExpression>
- </bpmn2:sequenceFlow>
- <bpmn2:sequenceFlow id="SequenceFlow_7" name="" sourceRef="ExclusiveGateway_5" targetRef="ScriptTask_2"/>
- <bpmn2:exclusiveGateway id="ExclusiveGateway_3" default="SequenceFlow_22">
- <bpmn2:incoming>SequenceFlow_39</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_22</bpmn2:outgoing>
- <bpmn2:outgoing>SequenceFlow_23</bpmn2:outgoing>
- </bpmn2:exclusiveGateway>
- <bpmn2:sequenceFlow id="SequenceFlow_22" name="" sourceRef="ExclusiveGateway_3" targetRef="ProcessAAISearch"/>
- <bpmn2:sequenceFlow id="SequenceFlow_23" name="" sourceRef="ExclusiveGateway_3" targetRef="AAIQueryFailure">
- <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") != 200 && execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") != 404}]]></bpmn2:conditionExpression>
- </bpmn2:sequenceFlow>
- <bpmn2:scriptTask id="AAIQueryFailure" name="AAI Query Failure" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_23</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_18</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
-def cvm = new CreateAAIVfModule()
-cvm.handleAAIQueryFailure(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_18" name="" sourceRef="AAIQueryFailure" targetRef="EndEvent_7"/>
- <bpmn2:endEvent id="EndEvent_7">
- <bpmn2:incoming>SequenceFlow_18</bpmn2:incoming>
- <bpmn2:errorEventDefinition id="_ErrorEventDefinition_68" errorRef="Error_1"/>
- </bpmn2:endEvent>
- <bpmn2:scriptTask id="ProcessAAISearch" name="Process AAI Generic Vnf Query" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_22</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_24</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
-def cvm = new CreateAAIVfModule()
-cvm.processAAIGenericVnfQuery(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_24" name="" sourceRef="ProcessAAISearch" targetRef="ExclusiveGateway_5"/>
- <bpmn2:exclusiveGateway id="ExclusiveGateway_1" default="SequenceFlow_5">
- <bpmn2:incoming>SequenceFlow_8</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_5</bpmn2:outgoing>
- <bpmn2:outgoing>SequenceFlow_10</bpmn2:outgoing>
- </bpmn2:exclusiveGateway>
- <bpmn2:exclusiveGateway id="ExclusiveGateway_7">
- <bpmn2:incoming>SequenceFlow_4</bpmn2:incoming>
- <bpmn2:incoming>SequenceFlow_35</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_8</bpmn2:outgoing>
- </bpmn2:exclusiveGateway>
- <bpmn2:sequenceFlow id="SequenceFlow_28" name="Generic Vnf does not exist&#xD;&#xA; and Vnf Id != null or&#xD;&#xA;Generic Vnf does exist&#xD;&#xA;and Vnf Id == null" sourceRef="ExclusiveGateway_5" targetRef="CreateGenericVnfFailure">
- <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{(execution.getVariable("CAAIVfMod_newGenericVnf") == false && execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") == 404) || (execution.getVariable("CAAIVfMod_newGenericVnf") == true && execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") == 200)}]]></bpmn2:conditionExpression>
- </bpmn2:sequenceFlow>
- <bpmn2:scriptTask id="CreateGenericVnfFailure" name="Create Generic Vnf Failure" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_28</bpmn2:incoming>
- <bpmn2:incoming>SequenceFlow_26</bpmn2:incoming>
- <bpmn2:incoming>SequenceFlow_33</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_29</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
-def cvm = new CreateAAIVfModule()
-cvm.handleCreateVfModuleFailure(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:endEvent id="EndEvent_8">
- <bpmn2:incoming>SequenceFlow_29</bpmn2:incoming>
- <bpmn2:errorEventDefinition id="_ErrorEventDefinition_69" errorRef="Error_1"/>
- </bpmn2:endEvent>
- <bpmn2:sequenceFlow id="SequenceFlow_29" name="" sourceRef="CreateGenericVnfFailure" targetRef="EndEvent_8"/>
- <bpmn2:scriptTask id="ScriptTask_2" name="Parse For Add-on Module" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_7</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_31</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
-def cvm = new CreateAAIVfModule()
-cvm.parseForAddOnModule(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_31" name="" sourceRef="ScriptTask_2" targetRef="ExclusiveGateway_4"/>
- <bpmn2:scriptTask id="ScriptTask_8" name="Create Add-on Module" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_34</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_35</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
-def cvm = new CreateAAIVfModule()
-cvm.createVfModule(execution, false)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_35" name="" sourceRef="ScriptTask_8" targetRef="ExclusiveGateway_7"/>
- <bpmn2:exclusiveGateway id="ExclusiveGateway_4" default="SequenceFlow_33">
- <bpmn2:incoming>SequenceFlow_31</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_33</bpmn2:outgoing>
- <bpmn2:outgoing>SequenceFlow_34</bpmn2:outgoing>
- </bpmn2:exclusiveGateway>
- <bpmn2:sequenceFlow id="SequenceFlow_33" name="Vnf Module Exists&#xD;&#xA;" sourceRef="ExclusiveGateway_4" targetRef="CreateGenericVnfFailure"/>
- <bpmn2:sequenceFlow id="SequenceFlow_34" name="" sourceRef="ExclusiveGateway_4" targetRef="ScriptTask_8">
- <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("CAAIVfMod_moduleExists") != true}]]></bpmn2:conditionExpression>
- </bpmn2:sequenceFlow>
- <bpmn2:scriptTask id="QueryAAIForGenericVnf" name="Query AAI for&#xD;&#xA;Generic Vnf" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_38</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_39</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
-def cvm = new CreateAAIVfModule()
-cvm.queryAAIForGenericVnf(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_39" name="" sourceRef="QueryAAIForGenericVnf" targetRef="ExclusiveGateway_3"/>
- <bpmn2:scriptTask id="InitializeVariables" name="Initialize Variables" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_38</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
-def cvm = new CreateAAIVfModule()
-cvm.preProcessRequest(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_38" name="" sourceRef="InitializeVariables" targetRef="QueryAAIForGenericVnf"/>
- <bpmn2:endEvent id="EndEvent_2">
- <bpmn2:incoming>SequenceFlow_2</bpmn2:incoming>
- <bpmn2:errorEventDefinition id="_ErrorEventDefinition_50" errorRef="Error_1"/>
- </bpmn2:endEvent>
- <bpmn2:scriptTask id="CreateVfModuleFailure" name="Create Vf Module Failure" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_5</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_2</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
-def cvm = new CreateAAIVfModule()
-cvm.handleCreateVfModuleFailure(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_2" name="" sourceRef="CreateVfModuleFailure" targetRef="EndEvent_2"/>
- <bpmn2:sequenceFlow id="SequenceFlow_5" name="" sourceRef="ExclusiveGateway_1" targetRef="CreateVfModuleFailure"/>
- <bpmn2:sequenceFlow id="SequenceFlow_8" name="" sourceRef="ExclusiveGateway_7" targetRef="ExclusiveGateway_1"/>
- <bpmn2:endEvent id="EndEvent_1">
- <bpmn2:incoming>SequenceFlow_10</bpmn2:incoming>
- </bpmn2:endEvent>
- <bpmn2:sequenceFlow id="SequenceFlow_10" name="" sourceRef="ExclusiveGateway_1" targetRef="EndEvent_1">
- <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("CAAIVfMod_createVfModuleResponseCode") == 200 || execution.getVariable("CAAIVfMod_createVfModuleResponseCode") == 201}]]></bpmn2:conditionExpression>
- </bpmn2:sequenceFlow>
- <bpmn2:exclusiveGateway id="ExclusiveGateway_2" default="SequenceFlow_26">
- <bpmn2:incoming>SequenceFlow_20</bpmn2:incoming>
- <bpmn2:incoming>SequenceFlow_13</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_26</bpmn2:outgoing>
- <bpmn2:outgoing>SequenceFlow_27</bpmn2:outgoing>
- </bpmn2:exclusiveGateway>
- <bpmn2:sequenceFlow id="SequenceFlow_26" name="Create Generic Vnf&#xD;&#xA;Failure" sourceRef="ExclusiveGateway_2" targetRef="CreateGenericVnfFailure"/>
- <bpmn2:sequenceFlow id="SequenceFlow_27" name="" sourceRef="ExclusiveGateway_2" targetRef="ScriptTask_4">
- <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("CAAIVfMod_createGenericVnfResponseCode") == 200 || execution.getVariable("CAAIVfMod_createGenericVnfResponseCode") == 201}]]></bpmn2:conditionExpression>
- </bpmn2:sequenceFlow>
- <bpmn2:exclusiveGateway id="ExclusiveGateway_6" name="Is VID Request?" default="SequenceFlow_9">
- <bpmn2:incoming>SequenceFlow_6</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_9</bpmn2:outgoing>
- <bpmn2:outgoing>SequenceFlow_11</bpmn2:outgoing>
- </bpmn2:exclusiveGateway>
- <bpmn2:sequenceFlow id="SequenceFlow_9" name="No" sourceRef="ExclusiveGateway_6" targetRef="ScriptTask_3"/>
- <bpmn2:scriptTask id="ScriptTask_3" name="Create Generic Vnf" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_9</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_20</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
-def cvm = new CreateAAIVfModule()
-cvm.createGenericVnf(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_20" name="" sourceRef="ScriptTask_3" targetRef="ExclusiveGateway_2"/>
- <bpmn2:sequenceFlow id="SequenceFlow_11" name="Yes" sourceRef="ExclusiveGateway_6" targetRef="ScriptTask_1">
- <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("isVidRequest") =="true"}]]></bpmn2:conditionExpression>
- </bpmn2:sequenceFlow>
- <bpmn2:scriptTask id="ScriptTask_4" name="Create Base Module" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_27</bpmn2:incoming>
- <bpmn2:incoming>SequenceFlow_12</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_4</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
-def cvm = new CreateAAIVfModule()
-cvm.createVfModule(execution, true)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_4" name="" sourceRef="ScriptTask_4" targetRef="ExclusiveGateway_7"/>
- <bpmn2:startEvent id="StartEvent_1">
- <bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing>
- <bpmn2:messageEventDefinition id="_MessageEventDefinition_6" messageRef="Message_1"/>
- </bpmn2:startEvent>
- <bpmn2:sequenceFlow id="SequenceFlow_1" name="" sourceRef="StartEvent_1" targetRef="InitializeVariables"/>
- <bpmn2:scriptTask id="ScriptTask_1" name="Parse for Base Module" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_11</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_3</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
-def cvm = new CreateAAIVfModule()
-cvm.parseForBaseModule(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_3" name="" sourceRef="ScriptTask_1" targetRef="ExclusiveGateway_8"/>
- <bpmn2:exclusiveGateway id="ExclusiveGateway_8" default="SequenceFlow_13">
- <bpmn2:incoming>SequenceFlow_3</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_12</bpmn2:outgoing>
- <bpmn2:outgoing>SequenceFlow_13</bpmn2:outgoing>
- </bpmn2:exclusiveGateway>
- <bpmn2:sequenceFlow id="SequenceFlow_12" name="" sourceRef="ExclusiveGateway_8" targetRef="ScriptTask_4">
- <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{(execution.getVariable("CAAIVfMod_baseModuleConflict") != true) && (execution.getVariable("CAAIVfMod_moduleExists") != true)}]]></bpmn2:conditionExpression>
- </bpmn2:sequenceFlow>
- <bpmn2:sequenceFlow id="SequenceFlow_13" name="Base Module Conflict" sourceRef="ExclusiveGateway_8" targetRef="ExclusiveGateway_2"/>
- </bpmn2:process>
- <bpmn2:message id="Message_1" name="CreateAAIVfModuleRequest"/>
- <bpmn2:error id="Error_1" errorCode="MSOWorkflowException" name="MSO Workflow Exception"/>
- <bpmndi:BPMNDiagram id="BPMNDiagram_1">
- <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="CreateAAIVfModule">
- <bpmndi:BPMNShape id="_BPMNShape_StartEvent_37" bpmnElement="StartEvent_1">
- <dc:Bounds height="36.0" width="36.0" x="65.0" y="240.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="83.0" y="281.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_22" bpmnElement="InitializeVariables">
- <dc:Bounds height="80.0" width="100.0" x="204.0" y="216.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="_BPMNShape_StartEvent_37" targetElement="_BPMNShape_ScriptTask_22">
- <di:waypoint xsi:type="dc:Point" x="101.0" y="258.0"/>
- <di:waypoint xsi:type="dc:Point" x="160.0" y="258.0"/>
- <di:waypoint xsi:type="dc:Point" x="160.0" y="256.0"/>
- <di:waypoint xsi:type="dc:Point" x="204.0" y="256.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="123.0" y="258.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_Task_2" bpmnElement="ProcessAAISearch">
- <dc:Bounds height="80.0" width="100.0" x="518.0" y="117.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_50" bpmnElement="ExclusiveGateway_5" isMarkerVisible="true">
- <dc:Bounds height="50.0" width="50.0" x="630.0" y="230.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="655.0" y="285.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_52" bpmnElement="ExclusiveGateway_7" isMarkerVisible="true">
- <dc:Bounds height="50.0" width="50.0" x="1120.0" y="230.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="1145.0" y="285.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_47" bpmnElement="ScriptTask_3">
- <dc:Bounds height="80.0" width="100.0" x="718.0" y="93.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_7" bpmnElement="SequenceFlow_6" sourceElement="_BPMNShape_ExclusiveGateway_50" targetElement="_BPMNShape_ExclusiveGateway_225">
- <di:waypoint xsi:type="dc:Point" x="655.0" y="230.0"/>
- <di:waypoint xsi:type="dc:Point" x="655.0" y="88.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="601.0" y="133.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_48" bpmnElement="ScriptTask_2">
- <dc:Bounds height="80.0" width="100.0" x="695.0" y="391.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_8" bpmnElement="SequenceFlow_7" sourceElement="_BPMNShape_ExclusiveGateway_50" targetElement="_BPMNShape_ScriptTask_48">
- <di:waypoint xsi:type="dc:Point" x="655.0" y="280.0"/>
- <di:waypoint xsi:type="dc:Point" x="655.0" y="431.0"/>
- <di:waypoint xsi:type="dc:Point" x="695.0" y="431.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="574.0" y="256.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_54" bpmnElement="ExclusiveGateway_1" isMarkerVisible="true">
- <dc:Bounds height="50.0" width="50.0" x="1216.0" y="230.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="1241.0" y="285.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_EndEvent_120" bpmnElement="EndEvent_2">
- <dc:Bounds height="36.0" width="36.0" x="1224.0" y="454.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="1242.0" y="495.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_115" bpmnElement="ScriptTask_4">
- <dc:Bounds height="80.0" width="100.0" x="996.0" y="24.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_5" bpmnElement="SequenceFlow_4" sourceElement="_BPMNShape_ScriptTask_115" targetElement="_BPMNShape_ExclusiveGateway_52">
- <di:waypoint xsi:type="dc:Point" x="1096.0" y="64.0"/>
- <di:waypoint xsi:type="dc:Point" x="1145.0" y="64.0"/>
- <di:waypoint xsi:type="dc:Point" x="1145.0" y="177.0"/>
- <di:waypoint xsi:type="dc:Point" x="1145.0" y="230.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="1282.0" y="51.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_86" bpmnElement="ExclusiveGateway_3" isMarkerVisible="true">
- <dc:Bounds height="50.0" width="50.0" x="468.0" y="229.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="493.0" y="284.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_23" bpmnElement="SequenceFlow_22" sourceElement="_BPMNShape_ExclusiveGateway_86" targetElement="_BPMNShape_Task_2">
- <di:waypoint xsi:type="dc:Point" x="493.0" y="229.0"/>
- <di:waypoint xsi:type="dc:Point" x="493.0" y="158.0"/>
- <di:waypoint xsi:type="dc:Point" x="518.0" y="158.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="490.0" y="192.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_155" bpmnElement="AAIQueryFailure">
- <dc:Bounds height="80.0" width="100.0" x="518.0" y="335.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_24" bpmnElement="SequenceFlow_23" sourceElement="_BPMNShape_ExclusiveGateway_86" targetElement="_BPMNShape_ScriptTask_155">
- <di:waypoint xsi:type="dc:Point" x="493.0" y="279.0"/>
- <di:waypoint xsi:type="dc:Point" x="493.0" y="297.0"/>
- <di:waypoint xsi:type="dc:Point" x="568.0" y="297.0"/>
- <di:waypoint xsi:type="dc:Point" x="568.0" y="335.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="547.0" y="297.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_25" bpmnElement="SequenceFlow_24" sourceElement="_BPMNShape_Task_2" targetElement="_BPMNShape_ExclusiveGateway_50">
- <di:waypoint xsi:type="dc:Point" x="568.0" y="197.0"/>
- <di:waypoint xsi:type="dc:Point" x="568.0" y="255.0"/>
- <di:waypoint xsi:type="dc:Point" x="630.0" y="255.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="565.0" y="250.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_EndEvent_160" bpmnElement="EndEvent_7">
- <dc:Bounds height="36.0" width="36.0" x="550.0" y="454.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="568.0" y="495.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_18" bpmnElement="SequenceFlow_18" sourceElement="_BPMNShape_ScriptTask_155" targetElement="_BPMNShape_EndEvent_160">
- <di:waypoint xsi:type="dc:Point" x="568.0" y="415.0"/>
- <di:waypoint xsi:type="dc:Point" x="568.0" y="454.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="565.0" y="426.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_158" bpmnElement="CreateGenericVnfFailure">
- <dc:Bounds height="80.0" width="100.0" x="837.0" y="213.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_99" bpmnElement="ExclusiveGateway_2" isMarkerVisible="true">
- <dc:Bounds height="50.0" width="50.0" x="861.0" y="107.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="886.0" y="162.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_20" bpmnElement="SequenceFlow_20" sourceElement="_BPMNShape_ScriptTask_47" targetElement="_BPMNShape_ExclusiveGateway_99">
- <di:waypoint xsi:type="dc:Point" x="818.0" y="133.0"/>
- <di:waypoint xsi:type="dc:Point" x="839.0" y="133.0"/>
- <di:waypoint xsi:type="dc:Point" x="839.0" y="132.0"/>
- <di:waypoint xsi:type="dc:Point" x="861.0" y="132.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="839.0" y="132.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_21" bpmnElement="SequenceFlow_26" sourceElement="_BPMNShape_ExclusiveGateway_99" targetElement="_BPMNShape_ScriptTask_158">
- <di:waypoint xsi:type="dc:Point" x="886.0" y="157.0"/>
- <di:waypoint xsi:type="dc:Point" x="887.0" y="213.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="38.0" width="126.0" x="899.0" y="162.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_27" bpmnElement="SequenceFlow_27" sourceElement="_BPMNShape_ExclusiveGateway_99" targetElement="_BPMNShape_ScriptTask_115">
- <di:waypoint xsi:type="dc:Point" x="911.0" y="132.0"/>
- <di:waypoint xsi:type="dc:Point" x="953.0" y="132.0"/>
- <di:waypoint xsi:type="dc:Point" x="1045.0" y="132.0"/>
- <di:waypoint xsi:type="dc:Point" x="1045.0" y="104.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="959.0" y="132.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_28" bpmnElement="SequenceFlow_28" sourceElement="_BPMNShape_ExclusiveGateway_50" targetElement="_BPMNShape_ScriptTask_158">
- <di:waypoint xsi:type="dc:Point" x="680.0" y="255.0"/>
- <di:waypoint xsi:type="dc:Point" x="758.0" y="255.0"/>
- <di:waypoint xsi:type="dc:Point" x="758.0" y="253.0"/>
- <di:waypoint xsi:type="dc:Point" x="837.0" y="253.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="38.0" width="170.0" x="669.0" y="260.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_EndEvent_161" bpmnElement="EndEvent_8">
- <dc:Bounds height="36.0" width="36.0" x="987.0" y="235.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_29" bpmnElement="SequenceFlow_29" sourceElement="_BPMNShape_ScriptTask_158" targetElement="_BPMNShape_EndEvent_161">
- <di:waypoint xsi:type="dc:Point" x="937.0" y="253.0"/>
- <di:waypoint xsi:type="dc:Point" x="987.0" y="253.0"/>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_100" bpmnElement="ExclusiveGateway_4" isMarkerVisible="true">
- <dc:Bounds height="50.0" width="50.0" x="863.0" y="403.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="888.0" y="458.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_31" bpmnElement="SequenceFlow_31" sourceElement="_BPMNShape_ScriptTask_48" targetElement="_BPMNShape_ExclusiveGateway_100">
- <di:waypoint xsi:type="dc:Point" x="795.0" y="431.0"/>
- <di:waypoint xsi:type="dc:Point" x="822.0" y="431.0"/>
- <di:waypoint xsi:type="dc:Point" x="822.0" y="428.0"/>
- <di:waypoint xsi:type="dc:Point" x="863.0" y="428.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="817.0" y="431.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_33" bpmnElement="SequenceFlow_33" sourceElement="_BPMNShape_ExclusiveGateway_100" targetElement="_BPMNShape_ScriptTask_158">
- <di:waypoint xsi:type="dc:Point" x="888.0" y="403.0"/>
- <di:waypoint xsi:type="dc:Point" x="888.0" y="348.0"/>
- <di:waypoint xsi:type="dc:Point" x="887.0" y="348.0"/>
- <di:waypoint xsi:type="dc:Point" x="887.0" y="293.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="22.0" width="122.0" x="889.0" y="344.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_159" bpmnElement="ScriptTask_8">
- <dc:Bounds height="80.0" width="100.0" x="996.0" y="389.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_34" bpmnElement="SequenceFlow_34" sourceElement="_BPMNShape_ExclusiveGateway_100" targetElement="_BPMNShape_ScriptTask_159">
- <di:waypoint xsi:type="dc:Point" x="913.0" y="428.0"/>
- <di:waypoint xsi:type="dc:Point" x="954.0" y="428.0"/>
- <di:waypoint xsi:type="dc:Point" x="954.0" y="429.0"/>
- <di:waypoint xsi:type="dc:Point" x="996.0" y="429.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="955.0" y="429.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_35" bpmnElement="SequenceFlow_35" sourceElement="_BPMNShape_ScriptTask_159" targetElement="_BPMNShape_ExclusiveGateway_52">
- <di:waypoint xsi:type="dc:Point" x="1096.0" y="429.0"/>
- <di:waypoint xsi:type="dc:Point" x="1108.0" y="429.0"/>
- <di:waypoint xsi:type="dc:Point" x="1145.0" y="429.0"/>
- <di:waypoint xsi:type="dc:Point" x="1145.0" y="280.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="1142.0" y="379.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_160" bpmnElement="QueryAAIForGenericVnf">
- <dc:Bounds height="80.0" width="100.0" x="336.0" y="216.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_38" bpmnElement="SequenceFlow_38" sourceElement="_BPMNShape_ScriptTask_22" targetElement="_BPMNShape_ScriptTask_160">
- <di:waypoint xsi:type="dc:Point" x="304.0" y="256.0"/>
- <di:waypoint xsi:type="dc:Point" x="336.0" y="256.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="324.0" y="256.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_39" bpmnElement="SequenceFlow_39" sourceElement="_BPMNShape_ScriptTask_160" targetElement="_BPMNShape_ExclusiveGateway_86">
- <di:waypoint xsi:type="dc:Point" x="436.0" y="256.0"/>
- <di:waypoint xsi:type="dc:Point" x="452.0" y="256.0"/>
- <di:waypoint xsi:type="dc:Point" x="452.0" y="254.0"/>
- <di:waypoint xsi:type="dc:Point" x="468.0" y="254.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="449.0" y="255.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_161" bpmnElement="CreateVfModuleFailure">
- <dc:Bounds height="80.0" width="100.0" x="1192.0" y="324.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_2" bpmnElement="SequenceFlow_2" sourceElement="_BPMNShape_ScriptTask_161" targetElement="_BPMNShape_EndEvent_120">
- <di:waypoint xsi:type="dc:Point" x="1242.0" y="404.0"/>
- <di:waypoint xsi:type="dc:Point" x="1242.0" y="454.0"/>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="SequenceFlow_5" sourceElement="_BPMNShape_ExclusiveGateway_54" targetElement="_BPMNShape_ScriptTask_161">
- <di:waypoint xsi:type="dc:Point" x="1241.0" y="280.0"/>
- <di:waypoint xsi:type="dc:Point" x="1241.0" y="302.0"/>
- <di:waypoint xsi:type="dc:Point" x="1242.0" y="302.0"/>
- <di:waypoint xsi:type="dc:Point" x="1242.0" y="324.0"/>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_6" bpmnElement="SequenceFlow_8" sourceElement="_BPMNShape_ExclusiveGateway_52" targetElement="_BPMNShape_ExclusiveGateway_54">
- <di:waypoint xsi:type="dc:Point" x="1170.0" y="255.0"/>
- <di:waypoint xsi:type="dc:Point" x="1216.0" y="255.0"/>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_EndEvent_164" bpmnElement="EndEvent_1">
- <dc:Bounds height="36.0" width="36.0" x="1316.0" y="237.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_10" bpmnElement="SequenceFlow_10" sourceElement="_BPMNShape_ExclusiveGateway_54" targetElement="_BPMNShape_EndEvent_164">
- <di:waypoint xsi:type="dc:Point" x="1266.0" y="255.0"/>
- <di:waypoint xsi:type="dc:Point" x="1316.0" y="255.0"/>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_225" bpmnElement="ExclusiveGateway_6" isMarkerVisible="true">
- <dc:Bounds height="50.0" width="50.0" x="630.0" y="38.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="22.0" width="100.0" x="617.0" y="18.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_9" bpmnElement="SequenceFlow_9" sourceElement="_BPMNShape_ExclusiveGateway_225" targetElement="_BPMNShape_ScriptTask_47">
- <di:waypoint xsi:type="dc:Point" x="680.0" y="64.0"/>
- <di:waypoint xsi:type="dc:Point" x="699.0" y="64.0"/>
- <di:waypoint xsi:type="dc:Point" x="699.0" y="133.0"/>
- <di:waypoint xsi:type="dc:Point" x="718.0" y="133.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="22.0" width="22.0" x="669.0" y="93.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_11" bpmnElement="SequenceFlow_11" sourceElement="_BPMNShape_ExclusiveGateway_225" targetElement="_BPMNShape_ScriptTask_162">
- <di:waypoint xsi:type="dc:Point" x="680.0" y="63.0"/>
- <di:waypoint xsi:type="dc:Point" x="702.0" y="63.0"/>
- <di:waypoint xsi:type="dc:Point" x="702.0" y="40.0"/>
- <di:waypoint xsi:type="dc:Point" x="724.0" y="40.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="22.0" width="29.0" x="688.0" y="54.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_226" bpmnElement="ExclusiveGateway_8" isMarkerVisible="true">
- <dc:Bounds height="50.0" width="50.0" x="863.0" y="14.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="888.0" y="69.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_162" bpmnElement="ScriptTask_1">
- <dc:Bounds height="80.0" width="100.0" x="724.0" y="0.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_4" bpmnElement="SequenceFlow_3" sourceElement="_BPMNShape_ScriptTask_162" targetElement="_BPMNShape_ExclusiveGateway_226">
- <di:waypoint xsi:type="dc:Point" x="824.0" y="40.0"/>
- <di:waypoint xsi:type="dc:Point" x="843.0" y="40.0"/>
- <di:waypoint xsi:type="dc:Point" x="843.0" y="39.0"/>
- <di:waypoint xsi:type="dc:Point" x="863.0" y="39.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="840.0" y="39.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_12" bpmnElement="SequenceFlow_12" sourceElement="_BPMNShape_ExclusiveGateway_226" targetElement="_BPMNShape_ScriptTask_115">
- <di:waypoint xsi:type="dc:Point" x="913.0" y="39.0"/>
- <di:waypoint xsi:type="dc:Point" x="954.0" y="39.0"/>
- <di:waypoint xsi:type="dc:Point" x="954.0" y="64.0"/>
- <di:waypoint xsi:type="dc:Point" x="996.0" y="64.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="951.0" y="52.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_13" bpmnElement="SequenceFlow_13" sourceElement="_BPMNShape_ExclusiveGateway_226" targetElement="_BPMNShape_ExclusiveGateway_99">
- <di:waypoint xsi:type="dc:Point" x="888.0" y="64.0"/>
- <di:waypoint xsi:type="dc:Point" x="888.0" y="85.0"/>
- <di:waypoint xsi:type="dc:Point" x="886.0" y="85.0"/>
- <di:waypoint xsi:type="dc:Point" x="886.0" y="107.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="884.0" y="85.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- </bpmndi:BPMNPlane>
- </bpmndi:BPMNDiagram>
+<?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" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd" id="_Wblj8GyfEeWUWLTvug7ZOg" exporter="camunda modeler" exporterVersion="2.7.0" targetNamespace="http://camunda.org/schema/1.0/bpmn">
+ <bpmn2:process id="CreateAAIVfModule" name="CreateAAIVfModule" isExecutable="true">
+ <bpmn2:exclusiveGateway id="ExclusiveGateway_5" default="SequenceFlow_7">
+ <bpmn2:incoming>SequenceFlow_24</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_6</bpmn2:outgoing>
+ <bpmn2:outgoing>SequenceFlow_7</bpmn2:outgoing>
+ <bpmn2:outgoing>SequenceFlow_28</bpmn2:outgoing>
+ </bpmn2:exclusiveGateway>
+ <bpmn2:sequenceFlow id="SequenceFlow_6" name="" sourceRef="ExclusiveGateway_5" targetRef="ExclusiveGateway_6">
+ <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{(execution.getVariable("CAAIVfMod_newGenericVnf") == true && execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") == 404) || execution.getVariable("CAAIVfMod_isBaseVfModule") == true}]]></bpmn2:conditionExpression>
+ </bpmn2:sequenceFlow>
+ <bpmn2:sequenceFlow id="SequenceFlow_7" name="" sourceRef="ExclusiveGateway_5" targetRef="ScriptTask_2"/>
+ <bpmn2:exclusiveGateway id="ExclusiveGateway_3" default="SequenceFlow_22">
+ <bpmn2:incoming>SequenceFlow_39</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_22</bpmn2:outgoing>
+ <bpmn2:outgoing>SequenceFlow_23</bpmn2:outgoing>
+ </bpmn2:exclusiveGateway>
+ <bpmn2:sequenceFlow id="SequenceFlow_22" name="" sourceRef="ExclusiveGateway_3" targetRef="ProcessAAISearch"/>
+ <bpmn2:sequenceFlow id="SequenceFlow_23" name="" sourceRef="ExclusiveGateway_3" targetRef="AAIQueryFailure">
+ <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") != 200 && execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") != 404}]]></bpmn2:conditionExpression>
+ </bpmn2:sequenceFlow>
+ <bpmn2:scriptTask id="AAIQueryFailure" name="AAI Query Failure" scriptFormat="groovy">
+ <bpmn2:incoming>SequenceFlow_23</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_18</bpmn2:outgoing>
+ <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
+def cvm = new CreateAAIVfModule()
+cvm.handleAAIQueryFailure(execution)]]></bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_18" name="" sourceRef="AAIQueryFailure" targetRef="EndEvent_7"/>
+ <bpmn2:endEvent id="EndEvent_7">
+ <bpmn2:incoming>SequenceFlow_18</bpmn2:incoming>
+ <bpmn2:errorEventDefinition id="_ErrorEventDefinition_68" errorRef="Error_1"/>
+ </bpmn2:endEvent>
+ <bpmn2:scriptTask id="ProcessAAISearch" name="Process AAI Generic Vnf Query" scriptFormat="groovy">
+ <bpmn2:incoming>SequenceFlow_22</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_24</bpmn2:outgoing>
+ <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
+def cvm = new CreateAAIVfModule()
+cvm.processAAIGenericVnfQuery(execution)]]></bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_24" name="" sourceRef="ProcessAAISearch" targetRef="ExclusiveGateway_5"/>
+ <bpmn2:exclusiveGateway id="ExclusiveGateway_1" default="SequenceFlow_5">
+ <bpmn2:incoming>SequenceFlow_8</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_5</bpmn2:outgoing>
+ <bpmn2:outgoing>SequenceFlow_10</bpmn2:outgoing>
+ </bpmn2:exclusiveGateway>
+ <bpmn2:exclusiveGateway id="ExclusiveGateway_7">
+ <bpmn2:incoming>SequenceFlow_4</bpmn2:incoming>
+ <bpmn2:incoming>SequenceFlow_35</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_8</bpmn2:outgoing>
+ </bpmn2:exclusiveGateway>
+ <bpmn2:sequenceFlow id="SequenceFlow_28" name="Generic Vnf does not exist&#xD;&#xA; and Vnf Id != null or&#xD;&#xA;Generic Vnf does exist&#xD;&#xA;and Vnf Id == null" sourceRef="ExclusiveGateway_5" targetRef="CreateGenericVnfFailure">
+ <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{(execution.getVariable("CAAIVfMod_newGenericVnf") == false && execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") == 404) || (execution.getVariable("CAAIVfMod_newGenericVnf") == true && execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") == 200)}]]></bpmn2:conditionExpression>
+ </bpmn2:sequenceFlow>
+ <bpmn2:scriptTask id="CreateGenericVnfFailure" name="Create Generic Vnf Failure" scriptFormat="groovy">
+ <bpmn2:incoming>SequenceFlow_28</bpmn2:incoming>
+ <bpmn2:incoming>SequenceFlow_26</bpmn2:incoming>
+ <bpmn2:incoming>SequenceFlow_33</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_29</bpmn2:outgoing>
+ <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
+def cvm = new CreateAAIVfModule()
+cvm.handleCreateVfModuleFailure(execution)]]></bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:endEvent id="EndEvent_8">
+ <bpmn2:incoming>SequenceFlow_29</bpmn2:incoming>
+ <bpmn2:errorEventDefinition id="_ErrorEventDefinition_69" errorRef="Error_1"/>
+ </bpmn2:endEvent>
+ <bpmn2:sequenceFlow id="SequenceFlow_29" name="" sourceRef="CreateGenericVnfFailure" targetRef="EndEvent_8"/>
+ <bpmn2:scriptTask id="ScriptTask_2" name="Parse For Add-on Module" scriptFormat="groovy">
+ <bpmn2:incoming>SequenceFlow_7</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_31</bpmn2:outgoing>
+ <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
+def cvm = new CreateAAIVfModule()
+cvm.parseForAddOnModule(execution)]]></bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_31" name="" sourceRef="ScriptTask_2" targetRef="ExclusiveGateway_4"/>
+ <bpmn2:scriptTask id="ScriptTask_8" name="Create Add-on Module" scriptFormat="groovy">
+ <bpmn2:incoming>SequenceFlow_34</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_35</bpmn2:outgoing>
+ <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
+def cvm = new CreateAAIVfModule()
+cvm.createVfModule(execution, false)]]></bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_35" name="" sourceRef="ScriptTask_8" targetRef="ExclusiveGateway_7"/>
+ <bpmn2:exclusiveGateway id="ExclusiveGateway_4" default="SequenceFlow_33">
+ <bpmn2:incoming>SequenceFlow_31</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_33</bpmn2:outgoing>
+ <bpmn2:outgoing>SequenceFlow_34</bpmn2:outgoing>
+ </bpmn2:exclusiveGateway>
+ <bpmn2:sequenceFlow id="SequenceFlow_33" name="Vnf Module Exists&#xD;&#xA;" sourceRef="ExclusiveGateway_4" targetRef="CreateGenericVnfFailure"/>
+ <bpmn2:sequenceFlow id="SequenceFlow_34" name="" sourceRef="ExclusiveGateway_4" targetRef="ScriptTask_8">
+ <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("CAAIVfMod_moduleExists") != true}]]></bpmn2:conditionExpression>
+ </bpmn2:sequenceFlow>
+ <bpmn2:scriptTask id="QueryAAIForGenericVnf" name="Query AAI for&#xD;&#xA;Generic Vnf" scriptFormat="groovy">
+ <bpmn2:incoming>SequenceFlow_38</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_39</bpmn2:outgoing>
+ <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
+def cvm = new CreateAAIVfModule()
+cvm.queryAAIForGenericVnf(execution)]]></bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_39" name="" sourceRef="QueryAAIForGenericVnf" targetRef="ExclusiveGateway_3"/>
+ <bpmn2:scriptTask id="InitializeVariables" name="Initialize Variables" scriptFormat="groovy">
+ <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_38</bpmn2:outgoing>
+ <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
+def cvm = new CreateAAIVfModule()
+cvm.preProcessRequest(execution)]]></bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_38" name="" sourceRef="InitializeVariables" targetRef="QueryAAIForGenericVnf"/>
+ <bpmn2:endEvent id="EndEvent_2">
+ <bpmn2:incoming>SequenceFlow_2</bpmn2:incoming>
+ <bpmn2:errorEventDefinition id="_ErrorEventDefinition_50" errorRef="Error_1"/>
+ </bpmn2:endEvent>
+ <bpmn2:scriptTask id="CreateVfModuleFailure" name="Create Vf Module Failure" scriptFormat="groovy">
+ <bpmn2:incoming>SequenceFlow_5</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_2</bpmn2:outgoing>
+ <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
+def cvm = new CreateAAIVfModule()
+cvm.handleCreateVfModuleFailure(execution)]]></bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_2" name="" sourceRef="CreateVfModuleFailure" targetRef="EndEvent_2"/>
+ <bpmn2:sequenceFlow id="SequenceFlow_5" name="" sourceRef="ExclusiveGateway_1" targetRef="CreateVfModuleFailure"/>
+ <bpmn2:sequenceFlow id="SequenceFlow_8" name="" sourceRef="ExclusiveGateway_7" targetRef="ExclusiveGateway_1"/>
+ <bpmn2:endEvent id="EndEvent_1">
+ <bpmn2:incoming>SequenceFlow_10</bpmn2:incoming>
+ </bpmn2:endEvent>
+ <bpmn2:sequenceFlow id="SequenceFlow_10" name="" sourceRef="ExclusiveGateway_1" targetRef="EndEvent_1">
+ <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("CAAIVfMod_createVfModuleResponseCode") == 200 || execution.getVariable("CAAIVfMod_createVfModuleResponseCode") == 201}]]></bpmn2:conditionExpression>
+ </bpmn2:sequenceFlow>
+ <bpmn2:exclusiveGateway id="ExclusiveGateway_2" default="SequenceFlow_26">
+ <bpmn2:incoming>SequenceFlow_20</bpmn2:incoming>
+ <bpmn2:incoming>SequenceFlow_13</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_26</bpmn2:outgoing>
+ <bpmn2:outgoing>SequenceFlow_27</bpmn2:outgoing>
+ </bpmn2:exclusiveGateway>
+ <bpmn2:sequenceFlow id="SequenceFlow_26" name="Create Generic Vnf&#xD;&#xA;Failure" sourceRef="ExclusiveGateway_2" targetRef="CreateGenericVnfFailure"/>
+ <bpmn2:sequenceFlow id="SequenceFlow_27" name="" sourceRef="ExclusiveGateway_2" targetRef="ScriptTask_4">
+ <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("CAAIVfMod_createGenericVnfResponseCode") == 200 || execution.getVariable("CAAIVfMod_createGenericVnfResponseCode") == 201}]]></bpmn2:conditionExpression>
+ </bpmn2:sequenceFlow>
+ <bpmn2:exclusiveGateway id="ExclusiveGateway_6" name="Is VID Request?" default="SequenceFlow_9">
+ <bpmn2:incoming>SequenceFlow_6</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_9</bpmn2:outgoing>
+ <bpmn2:outgoing>SequenceFlow_11</bpmn2:outgoing>
+ </bpmn2:exclusiveGateway>
+ <bpmn2:sequenceFlow id="SequenceFlow_9" name="No" sourceRef="ExclusiveGateway_6" targetRef="ScriptTask_3"/>
+ <bpmn2:scriptTask id="ScriptTask_3" name="Create Generic Vnf" scriptFormat="groovy">
+ <bpmn2:incoming>SequenceFlow_9</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_20</bpmn2:outgoing>
+ <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
+def cvm = new CreateAAIVfModule()
+cvm.createGenericVnf(execution)]]></bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_20" name="" sourceRef="ScriptTask_3" targetRef="ExclusiveGateway_2"/>
+ <bpmn2:sequenceFlow id="SequenceFlow_11" name="Yes" sourceRef="ExclusiveGateway_6" targetRef="ScriptTask_1">
+ <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("isVidRequest") =="true"}]]></bpmn2:conditionExpression>
+ </bpmn2:sequenceFlow>
+ <bpmn2:scriptTask id="ScriptTask_4" name="Create Base Module" scriptFormat="groovy">
+ <bpmn2:incoming>SequenceFlow_27</bpmn2:incoming>
+ <bpmn2:incoming>SequenceFlow_12</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_4</bpmn2:outgoing>
+ <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
+def cvm = new CreateAAIVfModule()
+cvm.createVfModule(execution, true)]]></bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_4" name="" sourceRef="ScriptTask_4" targetRef="ExclusiveGateway_7"/>
+ <bpmn2:startEvent id="StartEvent_1">
+ <bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing>
+ <bpmn2:messageEventDefinition id="_MessageEventDefinition_6" messageRef="Message_1"/>
+ </bpmn2:startEvent>
+ <bpmn2:sequenceFlow id="SequenceFlow_1" name="" sourceRef="StartEvent_1" targetRef="InitializeVariables"/>
+ <bpmn2:scriptTask id="ScriptTask_1" name="Parse for Base Module" scriptFormat="groovy">
+ <bpmn2:incoming>SequenceFlow_11</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_3</bpmn2:outgoing>
+ <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
+def cvm = new CreateAAIVfModule()
+cvm.parseForBaseModule(execution)]]></bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_3" name="" sourceRef="ScriptTask_1" targetRef="ExclusiveGateway_8"/>
+ <bpmn2:exclusiveGateway id="ExclusiveGateway_8" default="SequenceFlow_13">
+ <bpmn2:incoming>SequenceFlow_3</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_12</bpmn2:outgoing>
+ <bpmn2:outgoing>SequenceFlow_13</bpmn2:outgoing>
+ </bpmn2:exclusiveGateway>
+ <bpmn2:sequenceFlow id="SequenceFlow_12" name="" sourceRef="ExclusiveGateway_8" targetRef="ScriptTask_4">
+ <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{(execution.getVariable("CAAIVfMod_baseModuleConflict") != true) && (execution.getVariable("CAAIVfMod_moduleExists") != true)}]]></bpmn2:conditionExpression>
+ </bpmn2:sequenceFlow>
+ <bpmn2:sequenceFlow id="SequenceFlow_13" name="Base Module Conflict" sourceRef="ExclusiveGateway_8" targetRef="ExclusiveGateway_2"/>
+ </bpmn2:process>
+ <bpmn2:message id="Message_1" name="CreateAAIVfModuleRequest"/>
+ <bpmn2:error id="Error_1" errorCode="MSOWorkflowException" name="MSO Workflow Exception"/>
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="CreateAAIVfModule">
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_37" bpmnElement="StartEvent_1">
+ <dc:Bounds height="36.0" width="36.0" x="65.0" y="240.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="0.0" width="0.0" x="83.0" y="281.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_22" bpmnElement="InitializeVariables">
+ <dc:Bounds height="80.0" width="100.0" x="204.0" y="216.0"/>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="_BPMNShape_StartEvent_37" targetElement="_BPMNShape_ScriptTask_22">
+ <di:waypoint xsi:type="dc:Point" x="101.0" y="258.0"/>
+ <di:waypoint xsi:type="dc:Point" x="160.0" y="258.0"/>
+ <di:waypoint xsi:type="dc:Point" x="160.0" y="256.0"/>
+ <di:waypoint xsi:type="dc:Point" x="204.0" y="256.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="6.0" width="6.0" x="123.0" y="258.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_Task_2" bpmnElement="ProcessAAISearch">
+ <dc:Bounds height="80.0" width="100.0" x="518.0" y="117.0"/>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_50" bpmnElement="ExclusiveGateway_5" isMarkerVisible="true">
+ <dc:Bounds height="50.0" width="50.0" x="630.0" y="230.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="0.0" width="0.0" x="655.0" y="285.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_52" bpmnElement="ExclusiveGateway_7" isMarkerVisible="true">
+ <dc:Bounds height="50.0" width="50.0" x="1120.0" y="230.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="0.0" width="0.0" x="1145.0" y="285.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_47" bpmnElement="ScriptTask_3">
+ <dc:Bounds height="80.0" width="100.0" x="718.0" y="93.0"/>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_7" bpmnElement="SequenceFlow_6" sourceElement="_BPMNShape_ExclusiveGateway_50" targetElement="_BPMNShape_ExclusiveGateway_225">
+ <di:waypoint xsi:type="dc:Point" x="655.0" y="230.0"/>
+ <di:waypoint xsi:type="dc:Point" x="655.0" y="88.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="6.0" width="6.0" x="601.0" y="133.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_48" bpmnElement="ScriptTask_2">
+ <dc:Bounds height="80.0" width="100.0" x="695.0" y="391.0"/>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_8" bpmnElement="SequenceFlow_7" sourceElement="_BPMNShape_ExclusiveGateway_50" targetElement="_BPMNShape_ScriptTask_48">
+ <di:waypoint xsi:type="dc:Point" x="655.0" y="280.0"/>
+ <di:waypoint xsi:type="dc:Point" x="655.0" y="431.0"/>
+ <di:waypoint xsi:type="dc:Point" x="695.0" y="431.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="6.0" width="6.0" x="574.0" y="256.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_54" bpmnElement="ExclusiveGateway_1" isMarkerVisible="true">
+ <dc:Bounds height="50.0" width="50.0" x="1216.0" y="230.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="0.0" width="0.0" x="1241.0" y="285.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_EndEvent_120" bpmnElement="EndEvent_2">
+ <dc:Bounds height="36.0" width="36.0" x="1224.0" y="454.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="0.0" width="0.0" x="1242.0" y="495.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_115" bpmnElement="ScriptTask_4">
+ <dc:Bounds height="80.0" width="100.0" x="996.0" y="24.0"/>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_5" bpmnElement="SequenceFlow_4" sourceElement="_BPMNShape_ScriptTask_115" targetElement="_BPMNShape_ExclusiveGateway_52">
+ <di:waypoint xsi:type="dc:Point" x="1096.0" y="64.0"/>
+ <di:waypoint xsi:type="dc:Point" x="1145.0" y="64.0"/>
+ <di:waypoint xsi:type="dc:Point" x="1145.0" y="177.0"/>
+ <di:waypoint xsi:type="dc:Point" x="1145.0" y="230.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="6.0" width="6.0" x="1282.0" y="51.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_86" bpmnElement="ExclusiveGateway_3" isMarkerVisible="true">
+ <dc:Bounds height="50.0" width="50.0" x="468.0" y="229.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="0.0" width="0.0" x="493.0" y="284.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_23" bpmnElement="SequenceFlow_22" sourceElement="_BPMNShape_ExclusiveGateway_86" targetElement="_BPMNShape_Task_2">
+ <di:waypoint xsi:type="dc:Point" x="493.0" y="229.0"/>
+ <di:waypoint xsi:type="dc:Point" x="493.0" y="158.0"/>
+ <di:waypoint xsi:type="dc:Point" x="518.0" y="158.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="6.0" width="6.0" x="490.0" y="192.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_155" bpmnElement="AAIQueryFailure">
+ <dc:Bounds height="80.0" width="100.0" x="518.0" y="335.0"/>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_24" bpmnElement="SequenceFlow_23" sourceElement="_BPMNShape_ExclusiveGateway_86" targetElement="_BPMNShape_ScriptTask_155">
+ <di:waypoint xsi:type="dc:Point" x="493.0" y="279.0"/>
+ <di:waypoint xsi:type="dc:Point" x="493.0" y="297.0"/>
+ <di:waypoint xsi:type="dc:Point" x="568.0" y="297.0"/>
+ <di:waypoint xsi:type="dc:Point" x="568.0" y="335.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="6.0" width="6.0" x="547.0" y="297.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_25" bpmnElement="SequenceFlow_24" sourceElement="_BPMNShape_Task_2" targetElement="_BPMNShape_ExclusiveGateway_50">
+ <di:waypoint xsi:type="dc:Point" x="568.0" y="197.0"/>
+ <di:waypoint xsi:type="dc:Point" x="568.0" y="255.0"/>
+ <di:waypoint xsi:type="dc:Point" x="630.0" y="255.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="6.0" width="6.0" x="565.0" y="250.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_EndEvent_160" bpmnElement="EndEvent_7">
+ <dc:Bounds height="36.0" width="36.0" x="550.0" y="454.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="0.0" width="0.0" x="568.0" y="495.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_18" bpmnElement="SequenceFlow_18" sourceElement="_BPMNShape_ScriptTask_155" targetElement="_BPMNShape_EndEvent_160">
+ <di:waypoint xsi:type="dc:Point" x="568.0" y="415.0"/>
+ <di:waypoint xsi:type="dc:Point" x="568.0" y="454.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="6.0" width="6.0" x="565.0" y="426.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_158" bpmnElement="CreateGenericVnfFailure">
+ <dc:Bounds height="80.0" width="100.0" x="837.0" y="213.0"/>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_99" bpmnElement="ExclusiveGateway_2" isMarkerVisible="true">
+ <dc:Bounds height="50.0" width="50.0" x="861.0" y="107.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="0.0" width="0.0" x="886.0" y="162.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_20" bpmnElement="SequenceFlow_20" sourceElement="_BPMNShape_ScriptTask_47" targetElement="_BPMNShape_ExclusiveGateway_99">
+ <di:waypoint xsi:type="dc:Point" x="818.0" y="133.0"/>
+ <di:waypoint xsi:type="dc:Point" x="839.0" y="133.0"/>
+ <di:waypoint xsi:type="dc:Point" x="839.0" y="132.0"/>
+ <di:waypoint xsi:type="dc:Point" x="861.0" y="132.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="6.0" width="6.0" x="839.0" y="132.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_21" bpmnElement="SequenceFlow_26" sourceElement="_BPMNShape_ExclusiveGateway_99" targetElement="_BPMNShape_ScriptTask_158">
+ <di:waypoint xsi:type="dc:Point" x="886.0" y="157.0"/>
+ <di:waypoint xsi:type="dc:Point" x="887.0" y="213.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="38.0" width="126.0" x="899.0" y="162.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_27" bpmnElement="SequenceFlow_27" sourceElement="_BPMNShape_ExclusiveGateway_99" targetElement="_BPMNShape_ScriptTask_115">
+ <di:waypoint xsi:type="dc:Point" x="911.0" y="132.0"/>
+ <di:waypoint xsi:type="dc:Point" x="953.0" y="132.0"/>
+ <di:waypoint xsi:type="dc:Point" x="1045.0" y="132.0"/>
+ <di:waypoint xsi:type="dc:Point" x="1045.0" y="104.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="6.0" width="6.0" x="959.0" y="132.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_28" bpmnElement="SequenceFlow_28" sourceElement="_BPMNShape_ExclusiveGateway_50" targetElement="_BPMNShape_ScriptTask_158">
+ <di:waypoint xsi:type="dc:Point" x="680.0" y="255.0"/>
+ <di:waypoint xsi:type="dc:Point" x="758.0" y="255.0"/>
+ <di:waypoint xsi:type="dc:Point" x="758.0" y="253.0"/>
+ <di:waypoint xsi:type="dc:Point" x="837.0" y="253.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="38.0" width="170.0" x="669.0" y="260.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_EndEvent_161" bpmnElement="EndEvent_8">
+ <dc:Bounds height="36.0" width="36.0" x="987.0" y="235.0"/>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_29" bpmnElement="SequenceFlow_29" sourceElement="_BPMNShape_ScriptTask_158" targetElement="_BPMNShape_EndEvent_161">
+ <di:waypoint xsi:type="dc:Point" x="937.0" y="253.0"/>
+ <di:waypoint xsi:type="dc:Point" x="987.0" y="253.0"/>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_100" bpmnElement="ExclusiveGateway_4" isMarkerVisible="true">
+ <dc:Bounds height="50.0" width="50.0" x="863.0" y="403.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="0.0" width="0.0" x="888.0" y="458.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_31" bpmnElement="SequenceFlow_31" sourceElement="_BPMNShape_ScriptTask_48" targetElement="_BPMNShape_ExclusiveGateway_100">
+ <di:waypoint xsi:type="dc:Point" x="795.0" y="431.0"/>
+ <di:waypoint xsi:type="dc:Point" x="822.0" y="431.0"/>
+ <di:waypoint xsi:type="dc:Point" x="822.0" y="428.0"/>
+ <di:waypoint xsi:type="dc:Point" x="863.0" y="428.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="6.0" width="6.0" x="817.0" y="431.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_33" bpmnElement="SequenceFlow_33" sourceElement="_BPMNShape_ExclusiveGateway_100" targetElement="_BPMNShape_ScriptTask_158">
+ <di:waypoint xsi:type="dc:Point" x="888.0" y="403.0"/>
+ <di:waypoint xsi:type="dc:Point" x="888.0" y="348.0"/>
+ <di:waypoint xsi:type="dc:Point" x="887.0" y="348.0"/>
+ <di:waypoint xsi:type="dc:Point" x="887.0" y="293.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="22.0" width="122.0" x="889.0" y="344.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_159" bpmnElement="ScriptTask_8">
+ <dc:Bounds height="80.0" width="100.0" x="996.0" y="389.0"/>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_34" bpmnElement="SequenceFlow_34" sourceElement="_BPMNShape_ExclusiveGateway_100" targetElement="_BPMNShape_ScriptTask_159">
+ <di:waypoint xsi:type="dc:Point" x="913.0" y="428.0"/>
+ <di:waypoint xsi:type="dc:Point" x="954.0" y="428.0"/>
+ <di:waypoint xsi:type="dc:Point" x="954.0" y="429.0"/>
+ <di:waypoint xsi:type="dc:Point" x="996.0" y="429.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="6.0" width="6.0" x="955.0" y="429.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_35" bpmnElement="SequenceFlow_35" sourceElement="_BPMNShape_ScriptTask_159" targetElement="_BPMNShape_ExclusiveGateway_52">
+ <di:waypoint xsi:type="dc:Point" x="1096.0" y="429.0"/>
+ <di:waypoint xsi:type="dc:Point" x="1108.0" y="429.0"/>
+ <di:waypoint xsi:type="dc:Point" x="1145.0" y="429.0"/>
+ <di:waypoint xsi:type="dc:Point" x="1145.0" y="280.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="6.0" width="6.0" x="1142.0" y="379.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_160" bpmnElement="QueryAAIForGenericVnf">
+ <dc:Bounds height="80.0" width="100.0" x="336.0" y="216.0"/>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_38" bpmnElement="SequenceFlow_38" sourceElement="_BPMNShape_ScriptTask_22" targetElement="_BPMNShape_ScriptTask_160">
+ <di:waypoint xsi:type="dc:Point" x="304.0" y="256.0"/>
+ <di:waypoint xsi:type="dc:Point" x="336.0" y="256.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="6.0" width="6.0" x="324.0" y="256.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_39" bpmnElement="SequenceFlow_39" sourceElement="_BPMNShape_ScriptTask_160" targetElement="_BPMNShape_ExclusiveGateway_86">
+ <di:waypoint xsi:type="dc:Point" x="436.0" y="256.0"/>
+ <di:waypoint xsi:type="dc:Point" x="452.0" y="256.0"/>
+ <di:waypoint xsi:type="dc:Point" x="452.0" y="254.0"/>
+ <di:waypoint xsi:type="dc:Point" x="468.0" y="254.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="6.0" width="6.0" x="449.0" y="255.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_161" bpmnElement="CreateVfModuleFailure">
+ <dc:Bounds height="80.0" width="100.0" x="1192.0" y="324.0"/>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_2" bpmnElement="SequenceFlow_2" sourceElement="_BPMNShape_ScriptTask_161" targetElement="_BPMNShape_EndEvent_120">
+ <di:waypoint xsi:type="dc:Point" x="1242.0" y="404.0"/>
+ <di:waypoint xsi:type="dc:Point" x="1242.0" y="454.0"/>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="SequenceFlow_5" sourceElement="_BPMNShape_ExclusiveGateway_54" targetElement="_BPMNShape_ScriptTask_161">
+ <di:waypoint xsi:type="dc:Point" x="1241.0" y="280.0"/>
+ <di:waypoint xsi:type="dc:Point" x="1241.0" y="302.0"/>
+ <di:waypoint xsi:type="dc:Point" x="1242.0" y="302.0"/>
+ <di:waypoint xsi:type="dc:Point" x="1242.0" y="324.0"/>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_6" bpmnElement="SequenceFlow_8" sourceElement="_BPMNShape_ExclusiveGateway_52" targetElement="_BPMNShape_ExclusiveGateway_54">
+ <di:waypoint xsi:type="dc:Point" x="1170.0" y="255.0"/>
+ <di:waypoint xsi:type="dc:Point" x="1216.0" y="255.0"/>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_EndEvent_164" bpmnElement="EndEvent_1">
+ <dc:Bounds height="36.0" width="36.0" x="1316.0" y="237.0"/>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_10" bpmnElement="SequenceFlow_10" sourceElement="_BPMNShape_ExclusiveGateway_54" targetElement="_BPMNShape_EndEvent_164">
+ <di:waypoint xsi:type="dc:Point" x="1266.0" y="255.0"/>
+ <di:waypoint xsi:type="dc:Point" x="1316.0" y="255.0"/>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_225" bpmnElement="ExclusiveGateway_6" isMarkerVisible="true">
+ <dc:Bounds height="50.0" width="50.0" x="630.0" y="38.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="22.0" width="100.0" x="617.0" y="18.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_9" bpmnElement="SequenceFlow_9" sourceElement="_BPMNShape_ExclusiveGateway_225" targetElement="_BPMNShape_ScriptTask_47">
+ <di:waypoint xsi:type="dc:Point" x="680.0" y="64.0"/>
+ <di:waypoint xsi:type="dc:Point" x="699.0" y="64.0"/>
+ <di:waypoint xsi:type="dc:Point" x="699.0" y="133.0"/>
+ <di:waypoint xsi:type="dc:Point" x="718.0" y="133.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="22.0" width="22.0" x="669.0" y="93.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_11" bpmnElement="SequenceFlow_11" sourceElement="_BPMNShape_ExclusiveGateway_225" targetElement="_BPMNShape_ScriptTask_162">
+ <di:waypoint xsi:type="dc:Point" x="680.0" y="63.0"/>
+ <di:waypoint xsi:type="dc:Point" x="702.0" y="63.0"/>
+ <di:waypoint xsi:type="dc:Point" x="702.0" y="40.0"/>
+ <di:waypoint xsi:type="dc:Point" x="724.0" y="40.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="22.0" width="29.0" x="688.0" y="54.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_226" bpmnElement="ExclusiveGateway_8" isMarkerVisible="true">
+ <dc:Bounds height="50.0" width="50.0" x="863.0" y="14.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="0.0" width="0.0" x="888.0" y="69.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_162" bpmnElement="ScriptTask_1">
+ <dc:Bounds height="80.0" width="100.0" x="724.0" y="0.0"/>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_4" bpmnElement="SequenceFlow_3" sourceElement="_BPMNShape_ScriptTask_162" targetElement="_BPMNShape_ExclusiveGateway_226">
+ <di:waypoint xsi:type="dc:Point" x="824.0" y="40.0"/>
+ <di:waypoint xsi:type="dc:Point" x="843.0" y="40.0"/>
+ <di:waypoint xsi:type="dc:Point" x="843.0" y="39.0"/>
+ <di:waypoint xsi:type="dc:Point" x="863.0" y="39.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="6.0" width="6.0" x="840.0" y="39.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_12" bpmnElement="SequenceFlow_12" sourceElement="_BPMNShape_ExclusiveGateway_226" targetElement="_BPMNShape_ScriptTask_115">
+ <di:waypoint xsi:type="dc:Point" x="913.0" y="39.0"/>
+ <di:waypoint xsi:type="dc:Point" x="954.0" y="39.0"/>
+ <di:waypoint xsi:type="dc:Point" x="954.0" y="64.0"/>
+ <di:waypoint xsi:type="dc:Point" x="996.0" y="64.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="6.0" width="6.0" x="951.0" y="52.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_13" bpmnElement="SequenceFlow_13" sourceElement="_BPMNShape_ExclusiveGateway_226" targetElement="_BPMNShape_ExclusiveGateway_99">
+ <di:waypoint xsi:type="dc:Point" x="888.0" y="64.0"/>
+ <di:waypoint xsi:type="dc:Point" x="888.0" y="85.0"/>
+ <di:waypoint xsi:type="dc:Point" x="886.0" y="85.0"/>
+ <di:waypoint xsi:type="dc:Point" x="886.0" y="107.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="6.0" width="6.0" x="884.0" y="85.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
</bpmn2:definitions> \ No newline at end of file
diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/DeleteAAIVfModule.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/DeleteAAIVfModule.bpmn
index 0fce6d846f..297e04c0f7 100644
--- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/DeleteAAIVfModule.bpmn
+++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/DeleteAAIVfModule.bpmn
@@ -1,482 +1,482 @@
-<?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" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd" id="_Wblj8GyfEeWUWLTvug7ZOg" exporter="camunda modeler" exporterVersion="2.7.0" targetNamespace="http://camunda.org/schema/1.0/bpmn">
- <bpmn2:process id="DeleteAAIVfModule" name="DeleteAAIVfModule" isExecutable="true">
- <bpmn2:exclusiveGateway id="ExclusiveGateway_5" default="SequenceFlow_8">
- <bpmn2:incoming>SequenceFlow_24</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_6</bpmn2:outgoing>
- <bpmn2:outgoing>SequenceFlow_8</bpmn2:outgoing>
- </bpmn2:exclusiveGateway>
- <bpmn2:sequenceFlow id="SequenceFlow_6" name="" sourceRef="ExclusiveGateway_5" targetRef="DeleteVfModule">
- <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("DAAIVfMod_moduleExists") == true && (execution.getVariable("DAAIVfMod_isBaseModule") == false || (execution.getVariable("DAAIVfMod_isBaseModule") == true && execution.getVariable("DAAIVfMod_isLastModule") == true ))}]]></bpmn2:conditionExpression>
- </bpmn2:sequenceFlow>
- <bpmn2:exclusiveGateway id="ExclusiveGateway_3" default="SequenceFlow_22">
- <bpmn2:incoming>SequenceFlow_39</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_22</bpmn2:outgoing>
- <bpmn2:outgoing>SequenceFlow_23</bpmn2:outgoing>
- </bpmn2:exclusiveGateway>
- <bpmn2:sequenceFlow id="SequenceFlow_22" name="" sourceRef="ExclusiveGateway_3" targetRef="ParseForAddonModule"/>
- <bpmn2:sequenceFlow id="SequenceFlow_23" name="" sourceRef="ExclusiveGateway_3" targetRef="AAIQueryFailure">
- <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("DAAIVfMod_queryGenericVnfResponseCode") != 200}]]></bpmn2:conditionExpression>
- </bpmn2:sequenceFlow>
- <bpmn2:scriptTask id="AAIQueryFailure" name="AAI Query Failure" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_23</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_18</bpmn2:outgoing>
+<?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" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd" id="_Wblj8GyfEeWUWLTvug7ZOg" exporter="camunda modeler" exporterVersion="2.7.0" targetNamespace="http://camunda.org/schema/1.0/bpmn">
+ <bpmn2:process id="DeleteAAIVfModule" name="DeleteAAIVfModule" isExecutable="true">
+ <bpmn2:exclusiveGateway id="ExclusiveGateway_5" default="SequenceFlow_8">
+ <bpmn2:incoming>SequenceFlow_24</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_6</bpmn2:outgoing>
+ <bpmn2:outgoing>SequenceFlow_8</bpmn2:outgoing>
+ </bpmn2:exclusiveGateway>
+ <bpmn2:sequenceFlow id="SequenceFlow_6" name="" sourceRef="ExclusiveGateway_5" targetRef="DeleteVfModule">
+ <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("DAAIVfMod_moduleExists") == true && (execution.getVariable("DAAIVfMod_isBaseModule") == false || (execution.getVariable("DAAIVfMod_isBaseModule") == true && execution.getVariable("DAAIVfMod_isLastModule") == true ))}]]></bpmn2:conditionExpression>
+ </bpmn2:sequenceFlow>
+ <bpmn2:exclusiveGateway id="ExclusiveGateway_3" default="SequenceFlow_22">
+ <bpmn2:incoming>SequenceFlow_39</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_22</bpmn2:outgoing>
+ <bpmn2:outgoing>SequenceFlow_23</bpmn2:outgoing>
+ </bpmn2:exclusiveGateway>
+ <bpmn2:sequenceFlow id="SequenceFlow_22" name="" sourceRef="ExclusiveGateway_3" targetRef="ParseForAddonModule"/>
+ <bpmn2:sequenceFlow id="SequenceFlow_23" name="" sourceRef="ExclusiveGateway_3" targetRef="AAIQueryFailure">
+ <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("DAAIVfMod_queryGenericVnfResponseCode") != 200}]]></bpmn2:conditionExpression>
+ </bpmn2:sequenceFlow>
+ <bpmn2:scriptTask id="AAIQueryFailure" name="AAI Query Failure" scriptFormat="groovy">
+ <bpmn2:incoming>SequenceFlow_23</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_18</bpmn2:outgoing>
<bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
def dvm = new DeleteAAIVfModule()
-dvm.handleAAIQueryFailure(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_18" name="" sourceRef="AAIQueryFailure" targetRef="EndEvent_7"/>
- <bpmn2:endEvent id="EndEvent_7">
- <bpmn2:incoming>SequenceFlow_18</bpmn2:incoming>
- <bpmn2:errorEventDefinition id="_ErrorEventDefinition_68" errorRef="Error_1"/>
- </bpmn2:endEvent>
- <bpmn2:scriptTask id="ParseForAddonModule" name="Parse For Vf Module" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_22</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_24</bpmn2:outgoing>
+dvm.handleAAIQueryFailure(execution)]]></bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_18" name="" sourceRef="AAIQueryFailure" targetRef="EndEvent_7"/>
+ <bpmn2:endEvent id="EndEvent_7">
+ <bpmn2:incoming>SequenceFlow_18</bpmn2:incoming>
+ <bpmn2:errorEventDefinition id="_ErrorEventDefinition_68" errorRef="Error_1"/>
+ </bpmn2:endEvent>
+ <bpmn2:scriptTask id="ParseForAddonModule" name="Parse For Vf Module" scriptFormat="groovy">
+ <bpmn2:incoming>SequenceFlow_22</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_24</bpmn2:outgoing>
<bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
def dvm = new DeleteAAIVfModule()
-dvm.parseForVfModule(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_24" name="" sourceRef="ParseForAddonModule" targetRef="ExclusiveGateway_5"/>
- <bpmn2:scriptTask id="DeleteVfModule" name="Delete Vf Module" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_6</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_20</bpmn2:outgoing>
+dvm.parseForVfModule(execution)]]></bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_24" name="" sourceRef="ParseForAddonModule" targetRef="ExclusiveGateway_5"/>
+ <bpmn2:scriptTask id="DeleteVfModule" name="Delete Vf Module" scriptFormat="groovy">
+ <bpmn2:incoming>SequenceFlow_6</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_20</bpmn2:outgoing>
<bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
def dvm = new DeleteAAIVfModule()
-dvm.deleteVfModule(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_20" name="" sourceRef="DeleteVfModule" targetRef="ExclusiveGateway_2"/>
- <bpmn2:exclusiveGateway id="ExclusiveGateway_2" default="SequenceFlow_26">
- <bpmn2:incoming>SequenceFlow_20</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_26</bpmn2:outgoing>
- <bpmn2:outgoing>SequenceFlow_27</bpmn2:outgoing>
- <bpmn2:outgoing>SequenceFlow_11</bpmn2:outgoing>
- </bpmn2:exclusiveGateway>
- <bpmn2:sequenceFlow id="SequenceFlow_26" name="Delete Vf Module&#xD;&#xA;Failure" sourceRef="ExclusiveGateway_2" targetRef="DeleteVfModuleFailure"/>
- <bpmn2:sequenceFlow id="SequenceFlow_27" name="" sourceRef="ExclusiveGateway_2" targetRef="ExclusiveGateway_6">
- <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{(execution.getVariable("DAAIVfMod_deleteVfModuleResponseCode") == 200 || execution.getVariable("DAAIVfMod_deleteVfModuleResponseCode") == 204) && execution.getVariable("DAAIVfMod_isLastModule") == true}]]></bpmn2:conditionExpression>
- </bpmn2:sequenceFlow>
- <bpmn2:scriptTask id="DeleteVfModuleFailure" name="Delete Vf Module Failure" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_26</bpmn2:incoming>
- <bpmn2:incoming>SequenceFlow_8</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_29</bpmn2:outgoing>
+dvm.deleteVfModule(execution)]]></bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_20" name="" sourceRef="DeleteVfModule" targetRef="ExclusiveGateway_2"/>
+ <bpmn2:exclusiveGateway id="ExclusiveGateway_2" default="SequenceFlow_26">
+ <bpmn2:incoming>SequenceFlow_20</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_26</bpmn2:outgoing>
+ <bpmn2:outgoing>SequenceFlow_27</bpmn2:outgoing>
+ <bpmn2:outgoing>SequenceFlow_11</bpmn2:outgoing>
+ </bpmn2:exclusiveGateway>
+ <bpmn2:sequenceFlow id="SequenceFlow_26" name="Delete Vf Module&#xD;&#xA;Failure" sourceRef="ExclusiveGateway_2" targetRef="DeleteVfModuleFailure"/>
+ <bpmn2:sequenceFlow id="SequenceFlow_27" name="" sourceRef="ExclusiveGateway_2" targetRef="ExclusiveGateway_6">
+ <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{(execution.getVariable("DAAIVfMod_deleteVfModuleResponseCode") == 200 || execution.getVariable("DAAIVfMod_deleteVfModuleResponseCode") == 204) && execution.getVariable("DAAIVfMod_isLastModule") == true}]]></bpmn2:conditionExpression>
+ </bpmn2:sequenceFlow>
+ <bpmn2:scriptTask id="DeleteVfModuleFailure" name="Delete Vf Module Failure" scriptFormat="groovy">
+ <bpmn2:incoming>SequenceFlow_26</bpmn2:incoming>
+ <bpmn2:incoming>SequenceFlow_8</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_29</bpmn2:outgoing>
<bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
def dvm = new DeleteAAIVfModule()
-dvm.handleDeleteVfModuleFailure(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_29" name="" sourceRef="DeleteVfModuleFailure" targetRef="EndEvent_8"/>
- <bpmn2:scriptTask id="QueryAAIForGenericVnf" name="Query AAI for&#xD;&#xA;Generic Vnf" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_38</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_39</bpmn2:outgoing>
+dvm.handleDeleteVfModuleFailure(execution)]]></bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_29" name="" sourceRef="DeleteVfModuleFailure" targetRef="EndEvent_8"/>
+ <bpmn2:scriptTask id="QueryAAIForGenericVnf" name="Query AAI for&#xD;&#xA;Generic Vnf" scriptFormat="groovy">
+ <bpmn2:incoming>SequenceFlow_38</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_39</bpmn2:outgoing>
<bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
def dvm = new DeleteAAIVfModule()
-dvm.queryAAIForGenericVnf(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_39" name="" sourceRef="QueryAAIForGenericVnf" targetRef="ExclusiveGateway_3"/>
- <bpmn2:sequenceFlow id="SequenceFlow_8" name="Vf Module&#xD;&#xA;Does Not Exist or&#xD;&#xA;Base Module is Not&#xD;&#xA;the Last Vf Module" sourceRef="ExclusiveGateway_5" targetRef="DeleteVfModuleFailure"/>
- <bpmn2:endEvent id="EndEvent_8">
- <bpmn2:incoming>SequenceFlow_29</bpmn2:incoming>
- <bpmn2:errorEventDefinition id="_ErrorEventDefinition_69" errorRef="Error_1"/>
- </bpmn2:endEvent>
- <bpmn2:sequenceFlow id="SequenceFlow_11" name="" sourceRef="ExclusiveGateway_2" targetRef="ExclusiveGateway_1">
- <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{(execution.getVariable("DAAIVfMod_deleteVfModuleResponseCode") == 200 || execution.getVariable("DAAIVfMod_deleteVfModuleResponseCode") == 204) && execution.getVariable("DAAIVfMod_isLastModule") == false} ]]></bpmn2:conditionExpression>
- </bpmn2:sequenceFlow>
- <bpmn2:scriptTask id="QueryAAIForGenericVnf1" name="Query AAI for Generif VNF 1" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_3</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_9</bpmn2:outgoing>
+dvm.queryAAIForGenericVnf(execution)]]></bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_39" name="" sourceRef="QueryAAIForGenericVnf" targetRef="ExclusiveGateway_3"/>
+ <bpmn2:sequenceFlow id="SequenceFlow_8" name="Vf Module&#xD;&#xA;Does Not Exist or&#xD;&#xA;Base Module is Not&#xD;&#xA;the Last Vf Module" sourceRef="ExclusiveGateway_5" targetRef="DeleteVfModuleFailure"/>
+ <bpmn2:endEvent id="EndEvent_8">
+ <bpmn2:incoming>SequenceFlow_29</bpmn2:incoming>
+ <bpmn2:errorEventDefinition id="_ErrorEventDefinition_69" errorRef="Error_1"/>
+ </bpmn2:endEvent>
+ <bpmn2:sequenceFlow id="SequenceFlow_11" name="" sourceRef="ExclusiveGateway_2" targetRef="ExclusiveGateway_1">
+ <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{(execution.getVariable("DAAIVfMod_deleteVfModuleResponseCode") == 200 || execution.getVariable("DAAIVfMod_deleteVfModuleResponseCode") == 204) && execution.getVariable("DAAIVfMod_isLastModule") == false} ]]></bpmn2:conditionExpression>
+ </bpmn2:sequenceFlow>
+ <bpmn2:scriptTask id="QueryAAIForGenericVnf1" name="Query AAI for Generif VNF 1" scriptFormat="groovy">
+ <bpmn2:incoming>SequenceFlow_3</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_9</bpmn2:outgoing>
<bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
def dvm = new DeleteAAIVfModule()
-dvm.queryAAIForGenericVnf(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_9" name="" sourceRef="QueryAAIForGenericVnf1" targetRef="ExclusiveGateway_4"/>
- <bpmn2:scriptTask id="DeleteGenericVnfFailure" name="Delete Generic Vnf Failure" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_5</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_2</bpmn2:outgoing>
+dvm.queryAAIForGenericVnf(execution)]]></bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_9" name="" sourceRef="QueryAAIForGenericVnf1" targetRef="ExclusiveGateway_4"/>
+ <bpmn2:scriptTask id="DeleteGenericVnfFailure" name="Delete Generic Vnf Failure" scriptFormat="groovy">
+ <bpmn2:incoming>SequenceFlow_5</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_2</bpmn2:outgoing>
<bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
def dvm = new DeleteAAIVfModule()
-dvm.handleDeleteGenericVnfFailure(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_2" name="" sourceRef="DeleteGenericVnfFailure" targetRef="EndEvent_2"/>
- <bpmn2:endEvent id="EndEvent_2">
- <bpmn2:incoming>SequenceFlow_2</bpmn2:incoming>
- <bpmn2:errorEventDefinition id="_ErrorEventDefinition_50" errorRef="Error_1"/>
- </bpmn2:endEvent>
- <bpmn2:exclusiveGateway id="ExclusiveGateway_1" default="SequenceFlow_5">
- <bpmn2:incoming>SequenceFlow_11</bpmn2:incoming>
- <bpmn2:incoming>SequenceFlow_4</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_5</bpmn2:outgoing>
- <bpmn2:outgoing>SequenceFlow_7</bpmn2:outgoing>
- </bpmn2:exclusiveGateway>
- <bpmn2:sequenceFlow id="SequenceFlow_5" name="" sourceRef="ExclusiveGateway_1" targetRef="DeleteGenericVnfFailure"/>
- <bpmn2:sequenceFlow id="SequenceFlow_7" name="" sourceRef="ExclusiveGateway_1" targetRef="EndEvent_1">
- <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{((execution.getVariable("DAAIVfMod_deleteVfModuleResponseCode") == 200 || execution.getVariable("DAAIVfMod_deleteVfModuleResponseCode") == 204) && execution.getVariable("DAAIVfMod_isLastModule") == false) || (execution.getVariable("DAAIVfMod_deleteGenericVnfResponseCode") == 200 || execution.getVariable("DAAIVfMod_deleteGenericVnfResponseCode") == 204)}]]></bpmn2:conditionExpression>
- </bpmn2:sequenceFlow>
- <bpmn2:endEvent id="EndEvent_1">
- <bpmn2:incoming>SequenceFlow_7</bpmn2:incoming>
- <bpmn2:incoming>SequenceFlow_15</bpmn2:incoming>
- </bpmn2:endEvent>
- <bpmn2:scriptTask id="AAIQueryFailure1" name="AAI Query Failure 1" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_10</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_12</bpmn2:outgoing>
+dvm.handleDeleteGenericVnfFailure(execution)]]></bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_2" name="" sourceRef="DeleteGenericVnfFailure" targetRef="EndEvent_2"/>
+ <bpmn2:endEvent id="EndEvent_2">
+ <bpmn2:incoming>SequenceFlow_2</bpmn2:incoming>
+ <bpmn2:errorEventDefinition id="_ErrorEventDefinition_50" errorRef="Error_1"/>
+ </bpmn2:endEvent>
+ <bpmn2:exclusiveGateway id="ExclusiveGateway_1" default="SequenceFlow_5">
+ <bpmn2:incoming>SequenceFlow_11</bpmn2:incoming>
+ <bpmn2:incoming>SequenceFlow_4</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_5</bpmn2:outgoing>
+ <bpmn2:outgoing>SequenceFlow_7</bpmn2:outgoing>
+ </bpmn2:exclusiveGateway>
+ <bpmn2:sequenceFlow id="SequenceFlow_5" name="" sourceRef="ExclusiveGateway_1" targetRef="DeleteGenericVnfFailure"/>
+ <bpmn2:sequenceFlow id="SequenceFlow_7" name="" sourceRef="ExclusiveGateway_1" targetRef="EndEvent_1">
+ <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{((execution.getVariable("DAAIVfMod_deleteVfModuleResponseCode") == 200 || execution.getVariable("DAAIVfMod_deleteVfModuleResponseCode") == 204) && execution.getVariable("DAAIVfMod_isLastModule") == false) || (execution.getVariable("DAAIVfMod_deleteGenericVnfResponseCode") == 200 || execution.getVariable("DAAIVfMod_deleteGenericVnfResponseCode") == 204)}]]></bpmn2:conditionExpression>
+ </bpmn2:sequenceFlow>
+ <bpmn2:endEvent id="EndEvent_1">
+ <bpmn2:incoming>SequenceFlow_7</bpmn2:incoming>
+ <bpmn2:incoming>SequenceFlow_15</bpmn2:incoming>
+ </bpmn2:endEvent>
+ <bpmn2:scriptTask id="AAIQueryFailure1" name="AAI Query Failure 1" scriptFormat="groovy">
+ <bpmn2:incoming>SequenceFlow_10</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_12</bpmn2:outgoing>
<bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
def dvm = new DeleteAAIVfModule()
-dvm.handleAAIQueryFailure(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_12" name="" sourceRef="AAIQueryFailure1" targetRef="EndEvent_3"/>
- <bpmn2:endEvent id="EndEvent_3">
- <bpmn2:incoming>SequenceFlow_12</bpmn2:incoming>
- <bpmn2:errorEventDefinition id="_ErrorEventDefinition_70" errorRef="Error_1"/>
- </bpmn2:endEvent>
- <bpmn2:scriptTask id="DeleteGenericVnf" name="Delete Generic Vnf" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_14</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_4</bpmn2:outgoing>
+dvm.handleAAIQueryFailure(execution)]]></bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_12" name="" sourceRef="AAIQueryFailure1" targetRef="EndEvent_3"/>
+ <bpmn2:endEvent id="EndEvent_3">
+ <bpmn2:incoming>SequenceFlow_12</bpmn2:incoming>
+ <bpmn2:errorEventDefinition id="_ErrorEventDefinition_70" errorRef="Error_1"/>
+ </bpmn2:endEvent>
+ <bpmn2:scriptTask id="DeleteGenericVnf" name="Delete Generic Vnf" scriptFormat="groovy">
+ <bpmn2:incoming>SequenceFlow_14</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_4</bpmn2:outgoing>
<bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
def dvm = new DeleteAAIVfModule()
-dvm.deleteGenericVnf(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_4" name="" sourceRef="DeleteGenericVnf" targetRef="ExclusiveGateway_1"/>
- <bpmn2:scriptTask id="ParseForGenericVNFResourceVersion" name="Parse for Generic VNF Resource Version" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_13</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_14</bpmn2:outgoing>
+dvm.deleteGenericVnf(execution)]]></bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_4" name="" sourceRef="DeleteGenericVnf" targetRef="ExclusiveGateway_1"/>
+ <bpmn2:scriptTask id="ParseForGenericVNFResourceVersion" name="Parse for Generic VNF Resource Version" scriptFormat="groovy">
+ <bpmn2:incoming>SequenceFlow_13</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_14</bpmn2:outgoing>
<bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
def dvm = new DeleteAAIVfModule()
-dvm.parseForResourceVersion(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_14" name="" sourceRef="ParseForGenericVNFResourceVersion" targetRef="DeleteGenericVnf"/>
- <bpmn2:exclusiveGateway id="ExclusiveGateway_4" default="SequenceFlow_13">
- <bpmn2:incoming>SequenceFlow_9</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_10</bpmn2:outgoing>
- <bpmn2:outgoing>SequenceFlow_13</bpmn2:outgoing>
- </bpmn2:exclusiveGateway>
- <bpmn2:sequenceFlow id="SequenceFlow_10" name="" sourceRef="ExclusiveGateway_4" targetRef="AAIQueryFailure1">
- <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("DAAIVfMod_queryGenericVnfResponseCode") != 200}]]></bpmn2:conditionExpression>
- </bpmn2:sequenceFlow>
- <bpmn2:sequenceFlow id="SequenceFlow_13" name="" sourceRef="ExclusiveGateway_4" targetRef="ParseForGenericVNFResourceVersion"/>
- <bpmn2:startEvent id="StartEvent_1">
- <bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing>
- <bpmn2:messageEventDefinition id="_MessageEventDefinition_6" messageRef="Message_1"/>
- </bpmn2:startEvent>
- <bpmn2:sequenceFlow id="SequenceFlow_1" name="" sourceRef="StartEvent_1" targetRef="InitializeVariables"/>
- <bpmn2:scriptTask id="InitializeVariables" name="Initialize Variables" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_38</bpmn2:outgoing>
+dvm.parseForResourceVersion(execution)]]></bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_14" name="" sourceRef="ParseForGenericVNFResourceVersion" targetRef="DeleteGenericVnf"/>
+ <bpmn2:exclusiveGateway id="ExclusiveGateway_4" default="SequenceFlow_13">
+ <bpmn2:incoming>SequenceFlow_9</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_10</bpmn2:outgoing>
+ <bpmn2:outgoing>SequenceFlow_13</bpmn2:outgoing>
+ </bpmn2:exclusiveGateway>
+ <bpmn2:sequenceFlow id="SequenceFlow_10" name="" sourceRef="ExclusiveGateway_4" targetRef="AAIQueryFailure1">
+ <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("DAAIVfMod_queryGenericVnfResponseCode") != 200}]]></bpmn2:conditionExpression>
+ </bpmn2:sequenceFlow>
+ <bpmn2:sequenceFlow id="SequenceFlow_13" name="" sourceRef="ExclusiveGateway_4" targetRef="ParseForGenericVNFResourceVersion"/>
+ <bpmn2:startEvent id="StartEvent_1">
+ <bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing>
+ <bpmn2:messageEventDefinition id="_MessageEventDefinition_6" messageRef="Message_1"/>
+ </bpmn2:startEvent>
+ <bpmn2:sequenceFlow id="SequenceFlow_1" name="" sourceRef="StartEvent_1" targetRef="InitializeVariables"/>
+ <bpmn2:scriptTask id="InitializeVariables" name="Initialize Variables" scriptFormat="groovy">
+ <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_38</bpmn2:outgoing>
<bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
def dvm = new DeleteAAIVfModule()
-dvm.preProcessRequest(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_38" name="" sourceRef="InitializeVariables" targetRef="QueryAAIForGenericVnf"/>
- <bpmn2:exclusiveGateway id="ExclusiveGateway_6" name="Is VID Request?" default="SequenceFlow_3">
- <bpmn2:incoming>SequenceFlow_27</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_3</bpmn2:outgoing>
- <bpmn2:outgoing>SequenceFlow_15</bpmn2:outgoing>
- </bpmn2:exclusiveGateway>
- <bpmn2:sequenceFlow id="SequenceFlow_3" name="no" sourceRef="ExclusiveGateway_6" targetRef="QueryAAIForGenericVnf1"/>
- <bpmn2:sequenceFlow id="SequenceFlow_15" name="yes" sourceRef="ExclusiveGateway_6" targetRef="EndEvent_1">
- <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("isVidRequest") =="true"}]]></bpmn2:conditionExpression>
- </bpmn2:sequenceFlow>
- </bpmn2:process>
- <bpmn2:error id="Error_1" errorCode="MSOWorkflowException" name="MSO Workflow Exception"/>
- <bpmn2:message id="Message_1" name="DeleteAAIVfModuleRequest"/>
- <bpmndi:BPMNDiagram id="BPMNDiagram_1">
- <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DeleteAAIVfModule">
- <bpmndi:BPMNShape id="_BPMNShape_StartEvent_37" bpmnElement="StartEvent_1">
- <dc:Bounds height="36.0" width="36.0" x="59.0" y="200.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="77.0" y="241.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_22" bpmnElement="InitializeVariables">
- <dc:Bounds height="80.0" width="100.0" x="192.0" y="178.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="_BPMNShape_StartEvent_37" targetElement="_BPMNShape_ScriptTask_22">
- <di:waypoint xsi:type="dc:Point" x="95.0" y="218.0"/>
- <di:waypoint xsi:type="dc:Point" x="192.0" y="218.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="117.0" y="218.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_Task_2" bpmnElement="ParseForAddonModule">
- <dc:Bounds height="80.0" width="100.0" x="518.0" y="79.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_50" bpmnElement="ExclusiveGateway_5" isMarkerVisible="true">
- <dc:Bounds height="50.0" width="50.0" x="630.0" y="192.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="655.0" y="247.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_47" bpmnElement="DeleteVfModule">
- <dc:Bounds height="80.0" width="100.0" x="695.0" y="0.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_7" bpmnElement="SequenceFlow_6" sourceElement="_BPMNShape_ExclusiveGateway_50" targetElement="_BPMNShape_ScriptTask_47">
- <di:waypoint xsi:type="dc:Point" x="655.0" y="192.0"/>
- <di:waypoint xsi:type="dc:Point" x="655.0" y="40.0"/>
- <di:waypoint xsi:type="dc:Point" x="695.0" y="40.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="579.0" y="73.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_54" bpmnElement="ExclusiveGateway_1" isMarkerVisible="true">
- <dc:Bounds height="50.0" width="50.0" x="1681.0" y="297.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="1706.0" y="352.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_EndEvent_120" bpmnElement="EndEvent_2">
- <dc:Bounds height="36.0" width="36.0" x="1689.0" y="564.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="1707.0" y="605.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_115" bpmnElement="DeleteGenericVnf">
- <dc:Bounds height="80.0" width="100.0" x="1582.0" y="0.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_86" bpmnElement="ExclusiveGateway_3" isMarkerVisible="true">
- <dc:Bounds height="50.0" width="50.0" x="468.0" y="191.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="493.0" y="246.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_23" bpmnElement="SequenceFlow_22" sourceElement="_BPMNShape_ExclusiveGateway_86" targetElement="_BPMNShape_Task_2">
- <di:waypoint xsi:type="dc:Point" x="493.0" y="191.0"/>
- <di:waypoint xsi:type="dc:Point" x="493.0" y="120.0"/>
- <di:waypoint xsi:type="dc:Point" x="518.0" y="120.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="490.0" y="154.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_155" bpmnElement="AAIQueryFailure">
- <dc:Bounds height="80.0" width="100.0" x="518.0" y="297.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_24" bpmnElement="SequenceFlow_23" sourceElement="_BPMNShape_ExclusiveGateway_86" targetElement="_BPMNShape_ScriptTask_155">
- <di:waypoint xsi:type="dc:Point" x="493.0" y="241.0"/>
- <di:waypoint xsi:type="dc:Point" x="493.0" y="259.0"/>
- <di:waypoint xsi:type="dc:Point" x="568.0" y="259.0"/>
- <di:waypoint xsi:type="dc:Point" x="568.0" y="297.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="547.0" y="259.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_25" bpmnElement="SequenceFlow_24" sourceElement="_BPMNShape_Task_2" targetElement="_BPMNShape_ExclusiveGateway_50">
- <di:waypoint xsi:type="dc:Point" x="568.0" y="159.0"/>
- <di:waypoint xsi:type="dc:Point" x="568.0" y="217.0"/>
- <di:waypoint xsi:type="dc:Point" x="630.0" y="217.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="565.0" y="212.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_EndEvent_160" bpmnElement="EndEvent_7">
- <dc:Bounds height="36.0" width="36.0" x="550.0" y="416.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="568.0" y="457.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_18" bpmnElement="SequenceFlow_18" sourceElement="_BPMNShape_ScriptTask_155" targetElement="_BPMNShape_EndEvent_160">
- <di:waypoint xsi:type="dc:Point" x="568.0" y="377.0"/>
- <di:waypoint xsi:type="dc:Point" x="568.0" y="416.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="565.0" y="388.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_158" bpmnElement="DeleteVfModuleFailure">
- <dc:Bounds height="80.0" width="100.0" x="837.0" y="175.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_99" bpmnElement="ExclusiveGateway_2" isMarkerVisible="true">
- <dc:Bounds height="50.0" width="50.0" x="861.0" y="14.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="886.0" y="69.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_20" bpmnElement="SequenceFlow_20" sourceElement="_BPMNShape_ScriptTask_47" targetElement="_BPMNShape_ExclusiveGateway_99">
- <di:waypoint xsi:type="dc:Point" x="795.0" y="40.0"/>
- <di:waypoint xsi:type="dc:Point" x="861.0" y="39.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="817.0" y="40.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_21" bpmnElement="SequenceFlow_26" sourceElement="_BPMNShape_ExclusiveGateway_99" targetElement="_BPMNShape_ScriptTask_158">
- <di:waypoint xsi:type="dc:Point" x="886.0" y="64.0"/>
- <di:waypoint xsi:type="dc:Point" x="886.0" y="98.0"/>
- <di:waypoint xsi:type="dc:Point" x="887.0" y="98.0"/>
- <di:waypoint xsi:type="dc:Point" x="887.0" y="175.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="38.0" width="126.0" x="887.0" y="100.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_27" bpmnElement="SequenceFlow_27" sourceElement="_BPMNShape_ExclusiveGateway_99" targetElement="_BPMNShape_ExclusiveGateway_226">
- <di:waypoint xsi:type="dc:Point" x="911.0" y="39.0"/>
- <di:waypoint xsi:type="dc:Point" x="1068.0" y="39.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="959.0" y="39.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_EndEvent_161" bpmnElement="EndEvent_8">
- <dc:Bounds height="36.0" width="36.0" x="869.0" y="299.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="887.0" y="340.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_29" bpmnElement="SequenceFlow_29" sourceElement="_BPMNShape_ScriptTask_158" targetElement="_BPMNShape_EndEvent_161">
- <di:waypoint xsi:type="dc:Point" x="887.0" y="255.0"/>
- <di:waypoint xsi:type="dc:Point" x="887.0" y="299.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="884.0" y="280.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_160" bpmnElement="QueryAAIForGenericVnf">
- <dc:Bounds height="80.0" width="100.0" x="336.0" y="178.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_38" bpmnElement="SequenceFlow_38" sourceElement="_BPMNShape_ScriptTask_22" targetElement="_BPMNShape_ScriptTask_160">
- <di:waypoint xsi:type="dc:Point" x="292.0" y="218.0"/>
- <di:waypoint xsi:type="dc:Point" x="336.0" y="218.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="299.0" y="218.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_39" bpmnElement="SequenceFlow_39" sourceElement="_BPMNShape_ScriptTask_160" targetElement="_BPMNShape_ExclusiveGateway_86">
- <di:waypoint xsi:type="dc:Point" x="436.0" y="218.0"/>
- <di:waypoint xsi:type="dc:Point" x="452.0" y="218.0"/>
- <di:waypoint xsi:type="dc:Point" x="452.0" y="216.0"/>
- <di:waypoint xsi:type="dc:Point" x="468.0" y="216.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="449.0" y="217.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_161" bpmnElement="DeleteGenericVnfFailure">
- <dc:Bounds height="80.0" width="100.0" x="1656.0" y="432.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_2" bpmnElement="SequenceFlow_2" sourceElement="_BPMNShape_ScriptTask_161" targetElement="_BPMNShape_EndEvent_120">
- <di:waypoint xsi:type="dc:Point" x="1706.0" y="512.0"/>
- <di:waypoint xsi:type="dc:Point" x="1707.0" y="564.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="1703.0" y="515.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="SequenceFlow_5" sourceElement="_BPMNShape_ExclusiveGateway_54" targetElement="_BPMNShape_ScriptTask_161">
- <di:waypoint xsi:type="dc:Point" x="1706.0" y="347.0"/>
- <di:waypoint xsi:type="dc:Point" x="1706.0" y="432.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="1703.0" y="390.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_6" bpmnElement="SequenceFlow_8" sourceElement="_BPMNShape_ExclusiveGateway_50" targetElement="_BPMNShape_ScriptTask_158">
- <di:waypoint xsi:type="dc:Point" x="680.0" y="217.0"/>
- <di:waypoint xsi:type="dc:Point" x="758.0" y="217.0"/>
- <di:waypoint xsi:type="dc:Point" x="758.0" y="215.0"/>
- <di:waypoint xsi:type="dc:Point" x="837.0" y="215.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="38.0" width="94.0" x="708.0" y="231.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_11" bpmnElement="SequenceFlow_11" sourceElement="_BPMNShape_ExclusiveGateway_99" targetElement="_BPMNShape_ExclusiveGateway_54">
- <di:waypoint xsi:type="dc:Point" x="911.0" y="39.0"/>
- <di:waypoint xsi:type="dc:Point" x="1008.0" y="39.0"/>
- <di:waypoint xsi:type="dc:Point" x="1008.0" y="140.0"/>
- <di:waypoint xsi:type="dc:Point" x="1008.0" y="322.0"/>
- <di:waypoint xsi:type="dc:Point" x="1681.0" y="322.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="1005.0" y="197.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_5" bpmnElement="SequenceFlow_4" sourceElement="_BPMNShape_ScriptTask_115" targetElement="_BPMNShape_ExclusiveGateway_54">
- <di:waypoint xsi:type="dc:Point" x="1632.0" y="80.0"/>
- <di:waypoint xsi:type="dc:Point" x="1632.0" y="322.0"/>
- <di:waypoint xsi:type="dc:Point" x="1681.0" y="322.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="1629.0" y="187.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_EndEvent_162" bpmnElement="EndEvent_1">
- <dc:Bounds height="36.0" width="36.0" x="1806.0" y="305.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="1824.0" y="346.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_8" bpmnElement="SequenceFlow_7" sourceElement="_BPMNShape_ExclusiveGateway_54" targetElement="_BPMNShape_EndEvent_162">
- <di:waypoint xsi:type="dc:Point" x="1731.0" y="322.0"/>
- <di:waypoint xsi:type="dc:Point" x="1806.0" y="323.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="1753.0" y="322.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_242" bpmnElement="QueryAAIForGenericVnf1">
- <dc:Bounds height="80.0" width="100.0" x="1166.0" y="0.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_213" bpmnElement="ExclusiveGateway_4" isMarkerVisible="true">
- <dc:Bounds height="50.0" width="50.0" x="1325.0" y="15.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="1350.0" y="70.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_9" bpmnElement="SequenceFlow_9" sourceElement="_BPMNShape_ScriptTask_242" targetElement="_BPMNShape_ExclusiveGateway_213">
- <di:waypoint xsi:type="dc:Point" x="1266.0" y="40.0"/>
- <di:waypoint xsi:type="dc:Point" x="1325.0" y="40.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="1292.0" y="40.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_243" bpmnElement="AAIQueryFailure1">
- <dc:Bounds height="80.0" width="100.0" x="1300.0" y="117.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_244" bpmnElement="ParseForGenericVNFResourceVersion">
- <dc:Bounds height="80.0" width="100.0" x="1440.0" y="0.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_EndEvent_181" bpmnElement="EndEvent_3">
- <dc:Bounds height="36.0" width="36.0" x="1332.0" y="244.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="1350.0" y="285.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_10" bpmnElement="SequenceFlow_10" sourceElement="_BPMNShape_ExclusiveGateway_213" targetElement="_BPMNShape_ScriptTask_243">
- <di:waypoint xsi:type="dc:Point" x="1350.0" y="65.0"/>
- <di:waypoint xsi:type="dc:Point" x="1349.0" y="90.0"/>
- <di:waypoint xsi:type="dc:Point" x="1350.0" y="90.0"/>
- <di:waypoint xsi:type="dc:Point" x="1350.0" y="117.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="1347.0" y="95.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_12" bpmnElement="SequenceFlow_12" sourceElement="_BPMNShape_ScriptTask_243" targetElement="_BPMNShape_EndEvent_181">
- <di:waypoint xsi:type="dc:Point" x="1350.0" y="197.0"/>
- <di:waypoint xsi:type="dc:Point" x="1350.0" y="244.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="1347.0" y="226.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_13" bpmnElement="SequenceFlow_13" sourceElement="_BPMNShape_ExclusiveGateway_213" targetElement="_BPMNShape_ScriptTask_244">
- <di:waypoint xsi:type="dc:Point" x="1375.0" y="40.0"/>
- <di:waypoint xsi:type="dc:Point" x="1440.0" y="40.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="1394.0" y="40.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_14" bpmnElement="SequenceFlow_14" sourceElement="_BPMNShape_ScriptTask_244" targetElement="_BPMNShape_ScriptTask_115">
- <di:waypoint xsi:type="dc:Point" x="1540.0" y="40.0"/>
- <di:waypoint xsi:type="dc:Point" x="1582.0" y="40.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="1565.0" y="40.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_226" bpmnElement="ExclusiveGateway_6" isMarkerVisible="true">
- <dc:Bounds height="50.0" width="50.0" x="1068.0" y="14.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="22.0" width="100.0" x="1044.0" y="-6.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_4" bpmnElement="SequenceFlow_3" sourceElement="_BPMNShape_ExclusiveGateway_226" targetElement="_BPMNShape_ScriptTask_242">
- <di:waypoint xsi:type="dc:Point" x="1118.0" y="39.0"/>
- <di:waypoint xsi:type="dc:Point" x="1142.0" y="39.0"/>
- <di:waypoint xsi:type="dc:Point" x="1142.0" y="40.0"/>
- <di:waypoint xsi:type="dc:Point" x="1166.0" y="40.0"/>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_15" bpmnElement="SequenceFlow_15" sourceElement="_BPMNShape_ExclusiveGateway_226" targetElement="_BPMNShape_EndEvent_162">
- <di:waypoint xsi:type="dc:Point" x="1093.0" y="64.0"/>
- <di:waypoint xsi:type="dc:Point" x="1093.0" y="289.0"/>
- <di:waypoint xsi:type="dc:Point" x="1823.0" y="289.0"/>
- <di:waypoint xsi:type="dc:Point" x="1823.0" y="305.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="22.0" width="27.0" x="1104.0" y="146.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- </bpmndi:BPMNPlane>
- </bpmndi:BPMNDiagram>
+dvm.preProcessRequest(execution)]]></bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_38" name="" sourceRef="InitializeVariables" targetRef="QueryAAIForGenericVnf"/>
+ <bpmn2:exclusiveGateway id="ExclusiveGateway_6" name="Is VID Request?" default="SequenceFlow_3">
+ <bpmn2:incoming>SequenceFlow_27</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_3</bpmn2:outgoing>
+ <bpmn2:outgoing>SequenceFlow_15</bpmn2:outgoing>
+ </bpmn2:exclusiveGateway>
+ <bpmn2:sequenceFlow id="SequenceFlow_3" name="no" sourceRef="ExclusiveGateway_6" targetRef="QueryAAIForGenericVnf1"/>
+ <bpmn2:sequenceFlow id="SequenceFlow_15" name="yes" sourceRef="ExclusiveGateway_6" targetRef="EndEvent_1">
+ <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("isVidRequest") =="true"}]]></bpmn2:conditionExpression>
+ </bpmn2:sequenceFlow>
+ </bpmn2:process>
+ <bpmn2:error id="Error_1" errorCode="MSOWorkflowException" name="MSO Workflow Exception"/>
+ <bpmn2:message id="Message_1" name="DeleteAAIVfModuleRequest"/>
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DeleteAAIVfModule">
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_37" bpmnElement="StartEvent_1">
+ <dc:Bounds height="36.0" width="36.0" x="59.0" y="200.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="0.0" width="0.0" x="77.0" y="241.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_22" bpmnElement="InitializeVariables">
+ <dc:Bounds height="80.0" width="100.0" x="192.0" y="178.0"/>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="_BPMNShape_StartEvent_37" targetElement="_BPMNShape_ScriptTask_22">
+ <di:waypoint xsi:type="dc:Point" x="95.0" y="218.0"/>
+ <di:waypoint xsi:type="dc:Point" x="192.0" y="218.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="6.0" width="6.0" x="117.0" y="218.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_Task_2" bpmnElement="ParseForAddonModule">
+ <dc:Bounds height="80.0" width="100.0" x="518.0" y="79.0"/>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_50" bpmnElement="ExclusiveGateway_5" isMarkerVisible="true">
+ <dc:Bounds height="50.0" width="50.0" x="630.0" y="192.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="0.0" width="0.0" x="655.0" y="247.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_47" bpmnElement="DeleteVfModule">
+ <dc:Bounds height="80.0" width="100.0" x="695.0" y="0.0"/>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_7" bpmnElement="SequenceFlow_6" sourceElement="_BPMNShape_ExclusiveGateway_50" targetElement="_BPMNShape_ScriptTask_47">
+ <di:waypoint xsi:type="dc:Point" x="655.0" y="192.0"/>
+ <di:waypoint xsi:type="dc:Point" x="655.0" y="40.0"/>
+ <di:waypoint xsi:type="dc:Point" x="695.0" y="40.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="6.0" width="6.0" x="579.0" y="73.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_54" bpmnElement="ExclusiveGateway_1" isMarkerVisible="true">
+ <dc:Bounds height="50.0" width="50.0" x="1681.0" y="297.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="0.0" width="0.0" x="1706.0" y="352.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_EndEvent_120" bpmnElement="EndEvent_2">
+ <dc:Bounds height="36.0" width="36.0" x="1689.0" y="564.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="0.0" width="0.0" x="1707.0" y="605.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_115" bpmnElement="DeleteGenericVnf">
+ <dc:Bounds height="80.0" width="100.0" x="1582.0" y="0.0"/>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_86" bpmnElement="ExclusiveGateway_3" isMarkerVisible="true">
+ <dc:Bounds height="50.0" width="50.0" x="468.0" y="191.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="0.0" width="0.0" x="493.0" y="246.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_23" bpmnElement="SequenceFlow_22" sourceElement="_BPMNShape_ExclusiveGateway_86" targetElement="_BPMNShape_Task_2">
+ <di:waypoint xsi:type="dc:Point" x="493.0" y="191.0"/>
+ <di:waypoint xsi:type="dc:Point" x="493.0" y="120.0"/>
+ <di:waypoint xsi:type="dc:Point" x="518.0" y="120.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="6.0" width="6.0" x="490.0" y="154.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_155" bpmnElement="AAIQueryFailure">
+ <dc:Bounds height="80.0" width="100.0" x="518.0" y="297.0"/>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_24" bpmnElement="SequenceFlow_23" sourceElement="_BPMNShape_ExclusiveGateway_86" targetElement="_BPMNShape_ScriptTask_155">
+ <di:waypoint xsi:type="dc:Point" x="493.0" y="241.0"/>
+ <di:waypoint xsi:type="dc:Point" x="493.0" y="259.0"/>
+ <di:waypoint xsi:type="dc:Point" x="568.0" y="259.0"/>
+ <di:waypoint xsi:type="dc:Point" x="568.0" y="297.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="6.0" width="6.0" x="547.0" y="259.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_25" bpmnElement="SequenceFlow_24" sourceElement="_BPMNShape_Task_2" targetElement="_BPMNShape_ExclusiveGateway_50">
+ <di:waypoint xsi:type="dc:Point" x="568.0" y="159.0"/>
+ <di:waypoint xsi:type="dc:Point" x="568.0" y="217.0"/>
+ <di:waypoint xsi:type="dc:Point" x="630.0" y="217.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="6.0" width="6.0" x="565.0" y="212.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_EndEvent_160" bpmnElement="EndEvent_7">
+ <dc:Bounds height="36.0" width="36.0" x="550.0" y="416.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="0.0" width="0.0" x="568.0" y="457.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_18" bpmnElement="SequenceFlow_18" sourceElement="_BPMNShape_ScriptTask_155" targetElement="_BPMNShape_EndEvent_160">
+ <di:waypoint xsi:type="dc:Point" x="568.0" y="377.0"/>
+ <di:waypoint xsi:type="dc:Point" x="568.0" y="416.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="6.0" width="6.0" x="565.0" y="388.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_158" bpmnElement="DeleteVfModuleFailure">
+ <dc:Bounds height="80.0" width="100.0" x="837.0" y="175.0"/>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_99" bpmnElement="ExclusiveGateway_2" isMarkerVisible="true">
+ <dc:Bounds height="50.0" width="50.0" x="861.0" y="14.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="0.0" width="0.0" x="886.0" y="69.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_20" bpmnElement="SequenceFlow_20" sourceElement="_BPMNShape_ScriptTask_47" targetElement="_BPMNShape_ExclusiveGateway_99">
+ <di:waypoint xsi:type="dc:Point" x="795.0" y="40.0"/>
+ <di:waypoint xsi:type="dc:Point" x="861.0" y="39.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="6.0" width="6.0" x="817.0" y="40.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_21" bpmnElement="SequenceFlow_26" sourceElement="_BPMNShape_ExclusiveGateway_99" targetElement="_BPMNShape_ScriptTask_158">
+ <di:waypoint xsi:type="dc:Point" x="886.0" y="64.0"/>
+ <di:waypoint xsi:type="dc:Point" x="886.0" y="98.0"/>
+ <di:waypoint xsi:type="dc:Point" x="887.0" y="98.0"/>
+ <di:waypoint xsi:type="dc:Point" x="887.0" y="175.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="38.0" width="126.0" x="887.0" y="100.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_27" bpmnElement="SequenceFlow_27" sourceElement="_BPMNShape_ExclusiveGateway_99" targetElement="_BPMNShape_ExclusiveGateway_226">
+ <di:waypoint xsi:type="dc:Point" x="911.0" y="39.0"/>
+ <di:waypoint xsi:type="dc:Point" x="1068.0" y="39.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="6.0" width="6.0" x="959.0" y="39.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_EndEvent_161" bpmnElement="EndEvent_8">
+ <dc:Bounds height="36.0" width="36.0" x="869.0" y="299.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="0.0" width="0.0" x="887.0" y="340.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_29" bpmnElement="SequenceFlow_29" sourceElement="_BPMNShape_ScriptTask_158" targetElement="_BPMNShape_EndEvent_161">
+ <di:waypoint xsi:type="dc:Point" x="887.0" y="255.0"/>
+ <di:waypoint xsi:type="dc:Point" x="887.0" y="299.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="6.0" width="6.0" x="884.0" y="280.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_160" bpmnElement="QueryAAIForGenericVnf">
+ <dc:Bounds height="80.0" width="100.0" x="336.0" y="178.0"/>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_38" bpmnElement="SequenceFlow_38" sourceElement="_BPMNShape_ScriptTask_22" targetElement="_BPMNShape_ScriptTask_160">
+ <di:waypoint xsi:type="dc:Point" x="292.0" y="218.0"/>
+ <di:waypoint xsi:type="dc:Point" x="336.0" y="218.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="6.0" width="6.0" x="299.0" y="218.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_39" bpmnElement="SequenceFlow_39" sourceElement="_BPMNShape_ScriptTask_160" targetElement="_BPMNShape_ExclusiveGateway_86">
+ <di:waypoint xsi:type="dc:Point" x="436.0" y="218.0"/>
+ <di:waypoint xsi:type="dc:Point" x="452.0" y="218.0"/>
+ <di:waypoint xsi:type="dc:Point" x="452.0" y="216.0"/>
+ <di:waypoint xsi:type="dc:Point" x="468.0" y="216.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="6.0" width="6.0" x="449.0" y="217.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_161" bpmnElement="DeleteGenericVnfFailure">
+ <dc:Bounds height="80.0" width="100.0" x="1656.0" y="432.0"/>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_2" bpmnElement="SequenceFlow_2" sourceElement="_BPMNShape_ScriptTask_161" targetElement="_BPMNShape_EndEvent_120">
+ <di:waypoint xsi:type="dc:Point" x="1706.0" y="512.0"/>
+ <di:waypoint xsi:type="dc:Point" x="1707.0" y="564.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="6.0" width="6.0" x="1703.0" y="515.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="SequenceFlow_5" sourceElement="_BPMNShape_ExclusiveGateway_54" targetElement="_BPMNShape_ScriptTask_161">
+ <di:waypoint xsi:type="dc:Point" x="1706.0" y="347.0"/>
+ <di:waypoint xsi:type="dc:Point" x="1706.0" y="432.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="6.0" width="6.0" x="1703.0" y="390.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_6" bpmnElement="SequenceFlow_8" sourceElement="_BPMNShape_ExclusiveGateway_50" targetElement="_BPMNShape_ScriptTask_158">
+ <di:waypoint xsi:type="dc:Point" x="680.0" y="217.0"/>
+ <di:waypoint xsi:type="dc:Point" x="758.0" y="217.0"/>
+ <di:waypoint xsi:type="dc:Point" x="758.0" y="215.0"/>
+ <di:waypoint xsi:type="dc:Point" x="837.0" y="215.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="38.0" width="94.0" x="708.0" y="231.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_11" bpmnElement="SequenceFlow_11" sourceElement="_BPMNShape_ExclusiveGateway_99" targetElement="_BPMNShape_ExclusiveGateway_54">
+ <di:waypoint xsi:type="dc:Point" x="911.0" y="39.0"/>
+ <di:waypoint xsi:type="dc:Point" x="1008.0" y="39.0"/>
+ <di:waypoint xsi:type="dc:Point" x="1008.0" y="140.0"/>
+ <di:waypoint xsi:type="dc:Point" x="1008.0" y="322.0"/>
+ <di:waypoint xsi:type="dc:Point" x="1681.0" y="322.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="6.0" width="6.0" x="1005.0" y="197.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_5" bpmnElement="SequenceFlow_4" sourceElement="_BPMNShape_ScriptTask_115" targetElement="_BPMNShape_ExclusiveGateway_54">
+ <di:waypoint xsi:type="dc:Point" x="1632.0" y="80.0"/>
+ <di:waypoint xsi:type="dc:Point" x="1632.0" y="322.0"/>
+ <di:waypoint xsi:type="dc:Point" x="1681.0" y="322.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="6.0" width="6.0" x="1629.0" y="187.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_EndEvent_162" bpmnElement="EndEvent_1">
+ <dc:Bounds height="36.0" width="36.0" x="1806.0" y="305.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="0.0" width="0.0" x="1824.0" y="346.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_8" bpmnElement="SequenceFlow_7" sourceElement="_BPMNShape_ExclusiveGateway_54" targetElement="_BPMNShape_EndEvent_162">
+ <di:waypoint xsi:type="dc:Point" x="1731.0" y="322.0"/>
+ <di:waypoint xsi:type="dc:Point" x="1806.0" y="323.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="6.0" width="6.0" x="1753.0" y="322.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_242" bpmnElement="QueryAAIForGenericVnf1">
+ <dc:Bounds height="80.0" width="100.0" x="1166.0" y="0.0"/>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_213" bpmnElement="ExclusiveGateway_4" isMarkerVisible="true">
+ <dc:Bounds height="50.0" width="50.0" x="1325.0" y="15.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="0.0" width="0.0" x="1350.0" y="70.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_9" bpmnElement="SequenceFlow_9" sourceElement="_BPMNShape_ScriptTask_242" targetElement="_BPMNShape_ExclusiveGateway_213">
+ <di:waypoint xsi:type="dc:Point" x="1266.0" y="40.0"/>
+ <di:waypoint xsi:type="dc:Point" x="1325.0" y="40.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="6.0" width="6.0" x="1292.0" y="40.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_243" bpmnElement="AAIQueryFailure1">
+ <dc:Bounds height="80.0" width="100.0" x="1300.0" y="117.0"/>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_244" bpmnElement="ParseForGenericVNFResourceVersion">
+ <dc:Bounds height="80.0" width="100.0" x="1440.0" y="0.0"/>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_EndEvent_181" bpmnElement="EndEvent_3">
+ <dc:Bounds height="36.0" width="36.0" x="1332.0" y="244.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="0.0" width="0.0" x="1350.0" y="285.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_10" bpmnElement="SequenceFlow_10" sourceElement="_BPMNShape_ExclusiveGateway_213" targetElement="_BPMNShape_ScriptTask_243">
+ <di:waypoint xsi:type="dc:Point" x="1350.0" y="65.0"/>
+ <di:waypoint xsi:type="dc:Point" x="1349.0" y="90.0"/>
+ <di:waypoint xsi:type="dc:Point" x="1350.0" y="90.0"/>
+ <di:waypoint xsi:type="dc:Point" x="1350.0" y="117.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="6.0" width="6.0" x="1347.0" y="95.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_12" bpmnElement="SequenceFlow_12" sourceElement="_BPMNShape_ScriptTask_243" targetElement="_BPMNShape_EndEvent_181">
+ <di:waypoint xsi:type="dc:Point" x="1350.0" y="197.0"/>
+ <di:waypoint xsi:type="dc:Point" x="1350.0" y="244.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="6.0" width="6.0" x="1347.0" y="226.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_13" bpmnElement="SequenceFlow_13" sourceElement="_BPMNShape_ExclusiveGateway_213" targetElement="_BPMNShape_ScriptTask_244">
+ <di:waypoint xsi:type="dc:Point" x="1375.0" y="40.0"/>
+ <di:waypoint xsi:type="dc:Point" x="1440.0" y="40.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="6.0" width="6.0" x="1394.0" y="40.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_14" bpmnElement="SequenceFlow_14" sourceElement="_BPMNShape_ScriptTask_244" targetElement="_BPMNShape_ScriptTask_115">
+ <di:waypoint xsi:type="dc:Point" x="1540.0" y="40.0"/>
+ <di:waypoint xsi:type="dc:Point" x="1582.0" y="40.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="6.0" width="6.0" x="1565.0" y="40.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_226" bpmnElement="ExclusiveGateway_6" isMarkerVisible="true">
+ <dc:Bounds height="50.0" width="50.0" x="1068.0" y="14.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="22.0" width="100.0" x="1044.0" y="-6.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_4" bpmnElement="SequenceFlow_3" sourceElement="_BPMNShape_ExclusiveGateway_226" targetElement="_BPMNShape_ScriptTask_242">
+ <di:waypoint xsi:type="dc:Point" x="1118.0" y="39.0"/>
+ <di:waypoint xsi:type="dc:Point" x="1142.0" y="39.0"/>
+ <di:waypoint xsi:type="dc:Point" x="1142.0" y="40.0"/>
+ <di:waypoint xsi:type="dc:Point" x="1166.0" y="40.0"/>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_15" bpmnElement="SequenceFlow_15" sourceElement="_BPMNShape_ExclusiveGateway_226" targetElement="_BPMNShape_EndEvent_162">
+ <di:waypoint xsi:type="dc:Point" x="1093.0" y="64.0"/>
+ <di:waypoint xsi:type="dc:Point" x="1093.0" y="289.0"/>
+ <di:waypoint xsi:type="dc:Point" x="1823.0" y="289.0"/>
+ <di:waypoint xsi:type="dc:Point" x="1823.0" y="305.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="22.0" width="27.0" x="1104.0" y="146.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
</bpmn2:definitions> \ No newline at end of file
diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/FalloutHandler.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/FalloutHandler.bpmn
index 5f5fd3daae..75e05cb58e 100644
--- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/FalloutHandler.bpmn
+++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/FalloutHandler.bpmn
@@ -1,28 +1,58 @@
<?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="_3SPHsLr9EeWak-hhutJWuQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
+<bpmn2: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="_3SPHsLr9EeWak-hhutJWuQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.6.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
<bpmn2:process id="FalloutHandler" name="Fallout Handler" isExecutable="true">
+ <bpmn2:parallelGateway id="ParallelGateway_1">
+ <bpmn2:incoming>SequenceFlow_12</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_2</bpmn2:outgoing>
+ <bpmn2:outgoing>SequenceFlow_24</bpmn2:outgoing>
+ </bpmn2:parallelGateway>
+ <bpmn2:sequenceFlow id="SequenceFlow_2" name="" sourceRef="ParallelGateway_1" targetRef="ExclusiveGateway_1" />
+ <bpmn2:sequenceFlow id="SequenceFlow_24" name="" sourceRef="ParallelGateway_1" targetRef="ExclusiveGateway_6" />
+ <bpmn2:exclusiveGateway id="ExclusiveGateway_1" name="Notification URL exists?" default="SequenceFlow_23">
+ <bpmn2:incoming>SequenceFlow_2</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_3</bpmn2:outgoing>
+ <bpmn2:outgoing>SequenceFlow_23</bpmn2:outgoing>
+ </bpmn2:exclusiveGateway>
+ <bpmn2:sequenceFlow id="SequenceFlow_3" name="yes" sourceRef="ExclusiveGateway_1" targetRef="Task_0ixuwt5">
+ <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("FH_notification-url-Ok") ==true}]]></bpmn2:conditionExpression>
+ </bpmn2:sequenceFlow>
+ <bpmn2:sequenceFlow id="SequenceFlow_23" name="no" sourceRef="ExclusiveGateway_1" targetRef="ParallelGateway_4" />
<bpmn2:scriptTask id="ScriptTask_8" name="Pre-Process Request" scriptFormat="groovy">
<bpmn2:incoming>SequenceFlow_10</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_1nn37a8</bpmn2:outgoing>
+ <bpmn2:outgoing>SequenceFlow_12</bpmn2:outgoing>
<bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
def preProcessRequestData = new FalloutHandler()
preProcessRequestData.preProcessRequest(execution)
]]></bpmn2:script>
</bpmn2:scriptTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_12" name="" sourceRef="ScriptTask_8" targetRef="ParallelGateway_1" />
<bpmn2:startEvent id="StartEvent_1" name="Start">
<bpmn2:outgoing>SequenceFlow_10</bpmn2:outgoing>
</bpmn2:startEvent>
<bpmn2:sequenceFlow id="SequenceFlow_10" name="" sourceRef="StartEvent_1" targetRef="ScriptTask_8" />
+ <bpmn2:parallelGateway id="ParallelGateway_6">
+ <bpmn2:incoming>SequenceFlow_37</bpmn2:incoming>
+ <bpmn2:incoming>SequenceFlow_38</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_8</bpmn2:outgoing>
+ </bpmn2:parallelGateway>
+ <bpmn2:sequenceFlow id="SequenceFlow_8" name="" sourceRef="ParallelGateway_6" targetRef="ScriptTask_2" />
<bpmn2:scriptTask id="ScriptTask_2" name="Post Process Response" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_0fg02po</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_0x2jgo4</bpmn2:outgoing>
+ <bpmn2:incoming>SequenceFlow_8</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_9</bpmn2:outgoing>
<bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
def falloutHandler = new FalloutHandler()
falloutHandler.postProcessResponse(execution)]]></bpmn2:script>
</bpmn2:scriptTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_9" name="" sourceRef="ScriptTask_2" targetRef="EndEvent_6" />
+ <bpmn2:exclusiveGateway id="ParallelGateway_4">
+ <bpmn2:incoming>SequenceFlow_23</bpmn2:incoming>
+ <bpmn2:incoming>SequenceFlow_0m7gwor</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_38</bpmn2:outgoing>
+ </bpmn2:exclusiveGateway>
+ <bpmn2:sequenceFlow id="SequenceFlow_38" name="" sourceRef="ParallelGateway_4" targetRef="ParallelGateway_6" />
<bpmn2:exclusiveGateway id="ExclusiveGateway_6" default="SequenceFlow_26">
- <bpmn2:incoming>SequenceFlow_1nn37a8</bpmn2:incoming>
+ <bpmn2:incoming>SequenceFlow_24</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_25</bpmn2:outgoing>
<bpmn2:outgoing>SequenceFlow_26</bpmn2:outgoing>
</bpmn2:exclusiveGateway>
@@ -65,10 +95,11 @@ return updateRequestGamma.updateRequestGammaPayload(execution)]]></camunda:scrip
<bpmn2:exclusiveGateway id="ParallelGateway_5">
<bpmn2:incoming>SequenceFlow_35</bpmn2:incoming>
<bpmn2:incoming>SequenceFlow_36</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_0fg02po</bpmn2:outgoing>
+ <bpmn2:outgoing>SequenceFlow_37</bpmn2:outgoing>
</bpmn2:exclusiveGateway>
+ <bpmn2:sequenceFlow id="SequenceFlow_37" name="" sourceRef="ParallelGateway_5" targetRef="ParallelGateway_6" />
<bpmn2:endEvent id="EndEvent_6" name="Normal End">
- <bpmn2:incoming>SequenceFlow_0x2jgo4</bpmn2:incoming>
+ <bpmn2:incoming>SequenceFlow_9</bpmn2:incoming>
</bpmn2:endEvent>
<bpmn2:sequenceFlow id="SequenceFlow_72" name="" sourceRef="BoundaryEvent_2" targetRef="ScriptTask_6" />
<bpmn2:scriptTask id="ScriptTask_6" name="Build Workflow Exception" scriptFormat="groovy">
@@ -142,8 +173,8 @@ return updateRequestInfra.updateRequestInfraPayload(execution)]]></camunda:scrip
<bpmn2:sequenceFlow id="SequenceFlow_80" name="" sourceRef="BoundaryEvent_3" targetRef="ScriptTask_7" />
<bpmn2:subProcess id="SubProcess_1" name="Event Handler" triggeredByEvent="true">
<bpmn2:scriptTask id="ScriptTask_4" name="Handle Event" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_1k7it63</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_0celhl1</bpmn2:outgoing>
+ <bpmn2:incoming>SequenceFlow_1ko8ggw</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_1pm9r7h</bpmn2:outgoing>
<bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
execution.setVariable("FH_success", false)
def falloutHandler = new FalloutHandler()
@@ -157,15 +188,15 @@ execution.setVariable("WorkflowException", null)
execution.setVariable("FH_WorkflowException", wfe)]]></bpmn2:script>
</bpmn2:scriptTask>
<bpmn2:startEvent id="StartEvent_2">
- <bpmn2:outgoing>SequenceFlow_1k7it63</bpmn2:outgoing>
+ <bpmn2:outgoing>SequenceFlow_1ko8ggw</bpmn2:outgoing>
<bpmn2:errorEventDefinition id="ErrorEventDefinition_8" />
</bpmn2:startEvent>
<bpmn2:endEvent id="EndEvent_2" name="Error End">
- <bpmn2:incoming>SequenceFlow_0celhl1</bpmn2:incoming>
+ <bpmn2:incoming>SequenceFlow_1pm9r7h</bpmn2:incoming>
<bpmn2:terminateEventDefinition />
</bpmn2:endEvent>
- <bpmn2:sequenceFlow id="SequenceFlow_1k7it63" sourceRef="StartEvent_2" targetRef="ScriptTask_4" />
- <bpmn2:sequenceFlow id="SequenceFlow_0celhl1" sourceRef="ScriptTask_4" targetRef="EndEvent_2" />
+ <bpmn2:sequenceFlow id="SequenceFlow_1ko8ggw" sourceRef="StartEvent_2" targetRef="ScriptTask_4" />
+ <bpmn2:sequenceFlow id="SequenceFlow_1pm9r7h" sourceRef="ScriptTask_4" targetRef="EndEvent_2" />
</bpmn2:subProcess>
<bpmn2:endEvent id="EndEvent_14">
<bpmn2:incoming>SequenceFlow_73</bpmn2:incoming>
@@ -175,247 +206,337 @@ execution.setVariable("FH_WorkflowException", wfe)]]></bpmn2:script>
<bpmn2:incoming>SequenceFlow_79</bpmn2:incoming>
<bpmn2:terminateEventDefinition />
</bpmn2:endEvent>
- <bpmn2:sequenceFlow id="SequenceFlow_1nn37a8" sourceRef="ScriptTask_8" targetRef="ExclusiveGateway_6" />
- <bpmn2:sequenceFlow id="SequenceFlow_0fg02po" sourceRef="ParallelGateway_5" targetRef="ScriptTask_2" />
- <bpmn2:sequenceFlow id="SequenceFlow_0x2jgo4" sourceRef="ScriptTask_2" targetRef="EndEvent_6" />
+ <bpmn2:sequenceFlow id="SequenceFlow_0m7gwor" sourceRef="Task_0ixuwt5" targetRef="ParallelGateway_4" />
+ <bpmn2:callActivity id="Task_0ixuwt5" name="Call Notification Service" calledElement="${URN_mso_workflow_notification_name}" camunda:calledElementBinding="deployment">
+ <bpmn2:extensionElements>
+ <camunda:in source="mso-request-id" target="mso-request-id" />
+ <camunda:in source="mso-service-instance-id" target="mso-service-instance-id" />
+ <camunda:in variables="all" />
+ <camunda:out variables="all" />
+ </bpmn2:extensionElements>
+ <bpmn2:incoming>SequenceFlow_3</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_0m7gwor</bpmn2:outgoing>
+ </bpmn2:callActivity>
</bpmn2:process>
<bpmn2:error id="Error_1" name="MSOWorkflowException" 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="FalloutHandler">
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_52" bpmnElement="StartEvent_1">
- <dc:Bounds x="122" y="1112" width="36" height="36" />
+ <dc:Bounds x="139" y="263" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="145" y="300" width="23" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_ParallelGateway_12" bpmnElement="ParallelGateway_1">
+ <dc:Bounds x="342" y="255" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="367" y="310" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_74" bpmnElement="ExclusiveGateway_1" isMarkerVisible="true">
+ <dc:Bounds x="415" y="107" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="315" y="89" width="81" height="24" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_2" bpmnElement="SequenceFlow_2" sourceElement="_BPMNShape_ParallelGateway_12" targetElement="_BPMNShape_ExclusiveGateway_74">
+ <di:waypoint xsi:type="dc:Point" x="367" y="255" />
+ <di:waypoint xsi:type="dc:Point" x="367" y="132" />
+ <di:waypoint xsi:type="dc:Point" x="415" y="132" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="438" y="212" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="SequenceFlow_3" sourceElement="_BPMNShape_ExclusiveGateway_74" targetElement="CallActivity_0jz0w0k_di">
+ <di:waypoint xsi:type="dc:Point" x="440" y="107" />
+ <di:waypoint xsi:type="dc:Point" x="440" y="65" />
+ <di:waypoint xsi:type="dc:Point" x="553" y="65" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="475" y="70" width="18" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_ParallelGateway_15" bpmnElement="ParallelGateway_4" isMarkerVisible="true">
+ <dc:Bounds x="742" y="107" width="50" height="50" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="128" y="1149" width="23" height="12" />
+ <dc:Bounds x="767" y="162" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_23" bpmnElement="SequenceFlow_23" sourceElement="_BPMNShape_ExclusiveGateway_74" targetElement="_BPMNShape_ParallelGateway_15">
+ <di:waypoint xsi:type="dc:Point" x="440" y="157" />
+ <di:waypoint xsi:type="dc:Point" x="441" y="198" />
+ <di:waypoint xsi:type="dc:Point" x="767" y="198" />
+ <di:waypoint xsi:type="dc:Point" x="767" y="157" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="452" y="173" width="12" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_79" bpmnElement="ExclusiveGateway_6" isMarkerVisible="true">
- <dc:Bounds x="381" y="1105" width="50" height="50" />
+ <dc:Bounds x="412" y="468" width="50" height="50" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="406" y="1160" width="0" height="0" />
+ <dc:Bounds x="437" y="523" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_24" bpmnElement="SequenceFlow_24" sourceElement="_BPMNShape_ParallelGateway_12" targetElement="_BPMNShape_ExclusiveGateway_79">
+ <di:waypoint xsi:type="dc:Point" x="367" y="305" />
+ <di:waypoint xsi:type="dc:Point" x="367" y="493" />
+ <di:waypoint xsi:type="dc:Point" x="412" y="493" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="415" y="445" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_25" bpmnElement="SequenceFlow_25" sourceElement="_BPMNShape_ExclusiveGateway_79" targetElement="_BPMNShape_ServiceTask_90">
- <di:waypoint xsi:type="dc:Point" x="406" y="1105" />
- <di:waypoint xsi:type="dc:Point" x="406" y="1039" />
- <di:waypoint xsi:type="dc:Point" x="461" y="1039" />
+ <di:waypoint xsi:type="dc:Point" x="437" y="468" />
+ <di:waypoint xsi:type="dc:Point" x="437" y="402" />
+ <di:waypoint xsi:type="dc:Point" x="492" y="402" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="403" y="1081" width="6" height="6" />
+ <dc:Bounds x="437" y="444" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_26" bpmnElement="SequenceFlow_26" sourceElement="_BPMNShape_ExclusiveGateway_79" targetElement="_BPMNShape_ServiceTask_91">
- <di:waypoint xsi:type="dc:Point" x="406" y="1155" />
- <di:waypoint xsi:type="dc:Point" x="406" y="1287" />
- <di:waypoint xsi:type="dc:Point" x="457" y="1287" />
+ <di:waypoint xsi:type="dc:Point" x="437" y="518" />
+ <di:waypoint xsi:type="dc:Point" x="437" y="650" />
+ <di:waypoint xsi:type="dc:Point" x="488" y="650" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="403" y="1233" width="6" height="6" />
+ <dc:Bounds x="437" y="596" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_ServiceTask_90" bpmnElement="ServiceTask_3">
- <dc:Bounds x="461" y="999" width="100" height="80" />
+ <dc:Bounds x="492" y="362" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_ServiceTask_91" bpmnElement="ServiceTask_2">
- <dc:Bounds x="457" y="1247" width="100" height="80" />
+ <dc:Bounds x="488" y="610" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_80" bpmnElement="ExclusiveGateway_7" isMarkerVisible="true">
- <dc:Bounds x="644" y="1013" width="50" height="50" />
+ <dc:Bounds x="675" y="376" width="50" height="50" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="615" y="1068" width="109" height="22" />
+ <dc:Bounds x="657" y="431" width="87" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_29" bpmnElement="SequenceFlow_29" sourceElement="_BPMNShape_ServiceTask_90" targetElement="_BPMNShape_ExclusiveGateway_80">
- <di:waypoint xsi:type="dc:Point" x="561" y="1039" />
- <di:waypoint xsi:type="dc:Point" x="644" y="1038" />
+ <di:waypoint xsi:type="dc:Point" x="592" y="402" />
+ <di:waypoint xsi:type="dc:Point" x="675" y="401" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="598" y="1041" width="6" height="6" />
+ <dc:Bounds x="632" y="404" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_81" bpmnElement="ExclusiveGateway_8" isMarkerVisible="true">
- <dc:Bounds x="643" y="1262" width="50" height="50" />
+ <dc:Bounds x="674" y="625" width="50" height="50" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="614" y="1317" width="109" height="22" />
+ <dc:Bounds x="656" y="680" width="87" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_30" bpmnElement="SequenceFlow_30" sourceElement="_BPMNShape_ServiceTask_91" targetElement="_BPMNShape_ExclusiveGateway_81">
- <di:waypoint xsi:type="dc:Point" x="557" y="1287" />
- <di:waypoint xsi:type="dc:Point" x="595" y="1287" />
- <di:waypoint xsi:type="dc:Point" x="595" y="1286" />
- <di:waypoint xsi:type="dc:Point" x="643" y="1287" />
+ <di:waypoint xsi:type="dc:Point" x="588" y="650" />
+ <di:waypoint xsi:type="dc:Point" x="626" y="650" />
+ <di:waypoint xsi:type="dc:Point" x="626" y="649" />
+ <di:waypoint xsi:type="dc:Point" x="674" y="650" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="602" y="1288" width="6" height="6" />
+ <dc:Bounds x="636" y="651" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_31" bpmnElement="SequenceFlow_31" sourceElement="_BPMNShape_ExclusiveGateway_80" targetElement="_BPMNShape_ScriptTask_252">
- <di:waypoint xsi:type="dc:Point" x="669" y="1013" />
- <di:waypoint xsi:type="dc:Point" x="670" y="961" />
+ <di:waypoint xsi:type="dc:Point" x="700" y="376" />
+ <di:waypoint xsi:type="dc:Point" x="701" y="324" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="673" y="988" width="6" height="6" />
+ <dc:Bounds x="707" y="351" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_32" bpmnElement="SequenceFlow_32" sourceElement="_BPMNShape_ExclusiveGateway_81" targetElement="_BPMNShape_ScriptTask_253">
- <di:waypoint xsi:type="dc:Point" x="668" y="1262" />
- <di:waypoint xsi:type="dc:Point" x="668" y="1245" />
- <di:waypoint xsi:type="dc:Point" x="668" y="1214" />
+ <di:waypoint xsi:type="dc:Point" x="699" y="625" />
+ <di:waypoint xsi:type="dc:Point" x="699" y="608" />
+ <di:waypoint xsi:type="dc:Point" x="699" y="577" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="675" y="1294" width="6" height="6" />
+ <dc:Bounds x="709" y="657" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_ParallelGateway_16" bpmnElement="ParallelGateway_5" isMarkerVisible="true">
- <dc:Bounds x="822" y="1105" width="50" height="50" />
+ <dc:Bounds x="853" y="468" width="50" height="50" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="847" y="1160" width="0" height="0" />
+ <dc:Bounds x="878" y="523" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_35" bpmnElement="SequenceFlow_35" sourceElement="_BPMNShape_ExclusiveGateway_80" targetElement="_BPMNShape_ParallelGateway_16">
- <di:waypoint xsi:type="dc:Point" x="694" y="1038" />
- <di:waypoint xsi:type="dc:Point" x="847" y="1038" />
- <di:waypoint xsi:type="dc:Point" x="847" y="1105" />
+ <di:waypoint xsi:type="dc:Point" x="725" y="401" />
+ <di:waypoint xsi:type="dc:Point" x="878" y="401" />
+ <di:waypoint xsi:type="dc:Point" x="878" y="468" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="728" y="1029" width="6" height="6" />
+ <dc:Bounds x="762" y="392" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_36" bpmnElement="SequenceFlow_36" sourceElement="_BPMNShape_ExclusiveGateway_81" targetElement="_BPMNShape_ParallelGateway_16">
- <di:waypoint xsi:type="dc:Point" x="693" y="1287" />
- <di:waypoint xsi:type="dc:Point" x="847" y="1287" />
- <di:waypoint xsi:type="dc:Point" x="847" y="1155" />
+ <di:waypoint xsi:type="dc:Point" x="724" y="650" />
+ <di:waypoint xsi:type="dc:Point" x="878" y="650" />
+ <di:waypoint xsi:type="dc:Point" x="878" y="518" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="844" y="1211" width="6" height="6" />
+ <dc:Bounds x="878" y="574" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_ParallelGateway_17" bpmnElement="ParallelGateway_6">
+ <dc:Bounds x="957" y="254" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="982" y="309" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_37" bpmnElement="SequenceFlow_37" sourceElement="_BPMNShape_ParallelGateway_16" targetElement="_BPMNShape_ParallelGateway_17">
+ <di:waypoint xsi:type="dc:Point" x="903" y="493" />
+ <di:waypoint xsi:type="dc:Point" x="982" y="493" />
+ <di:waypoint xsi:type="dc:Point" x="982" y="304" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="943" y="478" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_38" bpmnElement="SequenceFlow_38" sourceElement="_BPMNShape_ParallelGateway_15" targetElement="_BPMNShape_ParallelGateway_17">
+ <di:waypoint xsi:type="dc:Point" x="792" y="132" />
+ <di:waypoint xsi:type="dc:Point" x="982" y="132" />
+ <di:waypoint xsi:type="dc:Point" x="982" y="254" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="887" y="117" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_10" bpmnElement="SequenceFlow_10" sourceElement="_BPMNShape_StartEvent_52" targetElement="_BPMNShape_ScriptTask_99">
- <di:waypoint xsi:type="dc:Point" x="158" y="1130" />
- <di:waypoint xsi:type="dc:Point" x="212" y="1130" />
+ <di:waypoint xsi:type="dc:Point" x="175" y="281" />
+ <di:waypoint xsi:type="dc:Point" x="211" y="281" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="185" y="1115" width="0" height="0" />
+ <dc:Bounds x="193" y="281" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_ScriptTask_99" bpmnElement="ScriptTask_8">
- <dc:Bounds x="212" y="1090" width="100" height="80" />
+ <dc:Bounds x="211" y="241" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_SubProcess_14" bpmnElement="SubProcess_1" isExpanded="true">
- <dc:Bounds x="115" y="1396" width="329" height="167" />
+ <dc:Bounds x="146" y="759" width="329" height="167" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_ScriptTask_100" bpmnElement="ScriptTask_4">
- <dc:Bounds x="228" y="1440" width="100" height="80" />
+ <dc:Bounds x="259" y="803" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_54" bpmnElement="StartEvent_2">
- <dc:Bounds x="144" y="1462" width="36" height="36" />
+ <dc:Bounds x="175" y="825" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="162" y="1506" width="0" height="0" />
+ <dc:Bounds x="193" y="869" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_ScriptTask_101" bpmnElement="ScriptTask_2">
- <dc:Bounds x="913" y="1090" width="100" height="80" />
+ <dc:Bounds x="1054" y="240" width="100" height="80" />
</bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_8" bpmnElement="SequenceFlow_8" sourceElement="_BPMNShape_ParallelGateway_17" targetElement="_BPMNShape_ScriptTask_101">
+ <di:waypoint xsi:type="dc:Point" x="1007" y="279" />
+ <di:waypoint xsi:type="dc:Point" x="1054" y="280" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1177" y="280" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_12" bpmnElement="SequenceFlow_12" sourceElement="_BPMNShape_ScriptTask_99" targetElement="_BPMNShape_ParallelGateway_12">
+ <di:waypoint xsi:type="dc:Point" x="311" y="281" />
+ <di:waypoint xsi:type="dc:Point" x="342" y="280" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="327" y="281" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_EndEvent_129" bpmnElement="EndEvent_6">
- <dc:Bounds x="1062" y="1112" width="36" height="36" />
+ <dc:Bounds x="1188" y="262" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1051" y="1153" width="57" height="12" />
+ <dc:Bounds x="1177" y="303" width="57" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_9" bpmnElement="SequenceFlow_9" sourceElement="_BPMNShape_ScriptTask_101" targetElement="_BPMNShape_EndEvent_129">
+ <di:waypoint xsi:type="dc:Point" x="1154" y="280" />
+ <di:waypoint xsi:type="dc:Point" x="1188" y="280" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1171" y="280" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_BoundaryEvent_31" bpmnElement="BoundaryEvent_2">
- <dc:Bounds x="494" y="981" width="36" height="36" />
+ <dc:Bounds x="525" y="344" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="522" y="937" width="87" height="22" />
+ <dc:Bounds x="563" y="300" width="68" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_BoundaryEvent_32" bpmnElement="BoundaryEvent_3">
- <dc:Bounds x="490" y="1229" width="36" height="36" />
+ <dc:Bounds x="521" y="592" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="522" y="1191" width="87" height="22" />
+ <dc:Bounds x="563" y="554" width="68" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_72" bpmnElement="SequenceFlow_72" sourceElement="_BPMNShape_BoundaryEvent_31" targetElement="_BPMNShape_ScriptTask_252">
- <di:waypoint xsi:type="dc:Point" x="512" y="981" />
- <di:waypoint xsi:type="dc:Point" x="512" y="921" />
- <di:waypoint xsi:type="dc:Point" x="620" y="921" />
+ <di:waypoint xsi:type="dc:Point" x="543" y="344" />
+ <di:waypoint xsi:type="dc:Point" x="543" y="284" />
+ <di:waypoint xsi:type="dc:Point" x="651" y="284" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="509" y="963" width="6" height="6" />
+ <dc:Bounds x="543" y="326" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_73" bpmnElement="SequenceFlow_73" sourceElement="_BPMNShape_ScriptTask_253">
- <di:waypoint xsi:type="dc:Point" x="719" y="1174" />
- <di:waypoint xsi:type="dc:Point" x="759" y="1174" />
+ <di:waypoint xsi:type="dc:Point" x="750" y="537" />
+ <di:waypoint xsi:type="dc:Point" x="790" y="537" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="739" y="1159" width="0" height="0" />
+ <dc:Bounds x="770" y="522" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_ScriptTask_252" bpmnElement="ScriptTask_6">
- <dc:Bounds x="620" y="881" width="100" height="80" />
+ <dc:Bounds x="651" y="244" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_ScriptTask_253" bpmnElement="ScriptTask_7">
- <dc:Bounds x="619" y="1134" width="100" height="80" />
+ <dc:Bounds x="650" y="497" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_79" bpmnElement="SequenceFlow_79" sourceElement="_BPMNShape_ScriptTask_252">
- <di:waypoint xsi:type="dc:Point" x="720" y="921" />
- <di:waypoint xsi:type="dc:Point" x="762" y="921" />
+ <di:waypoint xsi:type="dc:Point" x="751" y="284" />
+ <di:waypoint xsi:type="dc:Point" x="793" y="284" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="741" y="906" width="0" height="0" />
+ <dc:Bounds x="772" y="269" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_80" bpmnElement="SequenceFlow_80" sourceElement="_BPMNShape_BoundaryEvent_32" targetElement="_BPMNShape_ScriptTask_253">
- <di:waypoint xsi:type="dc:Point" x="508" y="1229" />
- <di:waypoint xsi:type="dc:Point" x="508" y="1174" />
- <di:waypoint xsi:type="dc:Point" x="619" y="1174" />
+ <di:waypoint xsi:type="dc:Point" x="539" y="592" />
+ <di:waypoint xsi:type="dc:Point" x="539" y="537" />
+ <di:waypoint xsi:type="dc:Point" x="650" y="537" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="533" y="1174" width="6" height="6" />
+ <dc:Bounds x="567" y="537" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="EndEvent_0b9vn2u_di" bpmnElement="EndEvent_2">
- <dc:Bounds x="372" y="1462" width="36" height="36" />
+ <dc:Bounds x="403" y="825" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="368" y="1506" width="47" height="12" />
+ <dc:Bounds x="399" y="869" width="47" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="EndEvent_1fmpj5u_di" bpmnElement="EndEvent_14">
- <dc:Bounds x="759" y="1156" width="36" height="36" />
+ <dc:Bounds x="790" y="519" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="777" y="1197" width="0" height="0" />
+ <dc:Bounds x="808" y="560" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="EndEvent_0w1puhf_di" bpmnElement="EndEvent_13">
- <dc:Bounds x="762" y="903" width="36" height="36" />
+ <dc:Bounds x="793" y="266" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="780" y="944" width="0" height="0" />
+ <dc:Bounds x="811" y="307" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_1nn37a8_di" bpmnElement="SequenceFlow_1nn37a8">
- <di:waypoint xsi:type="dc:Point" x="312" y="1130" />
- <di:waypoint xsi:type="dc:Point" x="340" y="1130" />
- <di:waypoint xsi:type="dc:Point" x="340" y="1130" />
- <di:waypoint xsi:type="dc:Point" x="381" y="1130" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="355" y="1130" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_0fg02po_di" bpmnElement="SequenceFlow_0fg02po">
- <di:waypoint xsi:type="dc:Point" x="872" y="1130" />
- <di:waypoint xsi:type="dc:Point" x="913" y="1130" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="893" y="1115" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_0x2jgo4_di" bpmnElement="SequenceFlow_0x2jgo4">
- <di:waypoint xsi:type="dc:Point" x="1013" y="1130" />
- <di:waypoint xsi:type="dc:Point" x="1062" y="1130" />
+ <bpmndi:BPMNEdge id="SequenceFlow_0m7gwor_di" bpmnElement="SequenceFlow_0m7gwor">
+ <di:waypoint xsi:type="dc:Point" x="654" y="65" />
+ <di:waypoint xsi:type="dc:Point" x="767" y="65" />
+ <di:waypoint xsi:type="dc:Point" x="767" y="107" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1038" y="1105" width="0" height="0" />
+ <dc:Bounds x="711" y="50" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_1k7it63_di" bpmnElement="SequenceFlow_1k7it63">
- <di:waypoint xsi:type="dc:Point" x="180" y="1480" />
- <di:waypoint xsi:type="dc:Point" x="228" y="1480" />
+ <bpmndi:BPMNEdge id="SequenceFlow_1ko8ggw_di" bpmnElement="SequenceFlow_1ko8ggw">
+ <di:waypoint xsi:type="dc:Point" x="211" y="843" />
+ <di:waypoint xsi:type="dc:Point" x="259" y="843" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="204" y="1455" width="0" height="0" />
+ <dc:Bounds x="235" y="818" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_0celhl1_di" bpmnElement="SequenceFlow_0celhl1">
- <di:waypoint xsi:type="dc:Point" x="328" y="1480" />
- <di:waypoint xsi:type="dc:Point" x="372" y="1480" />
+ <bpmndi:BPMNEdge id="SequenceFlow_1pm9r7h_di" bpmnElement="SequenceFlow_1pm9r7h">
+ <di:waypoint xsi:type="dc:Point" x="359" y="843" />
+ <di:waypoint xsi:type="dc:Point" x="403" y="843" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="350" y="1455" width="0" height="0" />
+ <dc:Bounds x="381" y="818" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="CallActivity_0jz0w0k_di" bpmnElement="Task_0ixuwt5">
+ <dc:Bounds x="554" y="25" width="100" height="80" />
+ </bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn2:definitions>
diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericDeleteService.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericDeleteService.bpmn
index f4edac612c..15929b87eb 100644
--- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericDeleteService.bpmn
+++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericDeleteService.bpmn
@@ -1,303 +1,304 @@
-<?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" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd" id="_wAtdAGrUEeaJwpcpVN5gXw" exporter="camunda modeler" exporterVersion="2.7.0" targetNamespace="http://camunda.org/schema/1.0/bpmn">
- <bpmn2:process id="GenericDeleteService" name="GenericDeleteService" isExecutable="true">
- <bpmn2:subProcess id="bpmnExceptionHandlingSubProcess" name="Error Handling Sub Process" triggeredByEvent="true">
- <bpmn2:scriptTask id="processError" name="Process Error" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_9</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_10</bpmn2:outgoing>
+<?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="_wAtdAGrUEeaJwpcpVN5gXw" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
+ <bpmn2:process id="GenericDeleteService" name="GenericDeleteService" isExecutable="true">
+ <bpmn2:subProcess id="bpmnExceptionHandlingSubProcess" name="Error Handling Sub Process" triggeredByEvent="true">
+ <bpmn2:scriptTask id="processError" name="Process 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.processSubflowsBPMNException(execution)
-]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_10" name="" sourceRef="processError" targetRef="EndEvent_3"/>
- <bpmn2:startEvent id="StartEvent_2">
- <bpmn2:outgoing>SequenceFlow_9</bpmn2:outgoing>
- <bpmn2:errorEventDefinition id="ErrorEventDefinition_1"/>
- </bpmn2:startEvent>
- <bpmn2:sequenceFlow id="SequenceFlow_9" name="" sourceRef="StartEvent_2" targetRef="processError"/>
- <bpmn2:endEvent id="EndEvent_3">
- <bpmn2:incoming>SequenceFlow_10</bpmn2:incoming>
- <bpmn2:terminateEventDefinition id="_TerminateEventDefinition_25"/>
- </bpmn2:endEvent>
- </bpmn2:subProcess>
- <bpmn2:subProcess id="javaExceptionSubProcess" name="Java Exception Handling Sub Process" triggeredByEvent="true">
- <bpmn2:endEvent id="EndEvent_2">
- <bpmn2:incoming>SequenceFlow_12</bpmn2:incoming>
- </bpmn2:endEvent>
- <bpmn2:scriptTask id="processJavaError" name="Process Error">
- <bpmn2:incoming>SequenceFlow_11</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_12</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
-
-ExceptionUtil ex = new ExceptionUtil()
-ex.processSubflowsJavaException(execution)
-]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:startEvent id="StartEvent_3">
- <bpmn2:outgoing>SequenceFlow_11</bpmn2:outgoing>
- <bpmn2:errorEventDefinition id="ErrorEventDefinition_2"/>
- </bpmn2:startEvent>
- <bpmn2:sequenceFlow id="SequenceFlow_11" name="" sourceRef="StartEvent_3" targetRef="processJavaError"/>
- <bpmn2:sequenceFlow id="SequenceFlow_12" name="" sourceRef="processJavaError" targetRef="EndEvent_2"/>
- </bpmn2:subProcess>
- <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: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.*
-GenericDeleteService deleteService = new GenericDeleteService()
-deleteService.preProcessRequest(execution)
-]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_3" name="" sourceRef="initialization" targetRef="resourceVersionCheck"/>
- <bpmn2:exclusiveGateway id="resourceVersionCheck" name="Resource Version Provided?" default="yes">
- <bpmn2:incoming>SequenceFlow_3</bpmn2:incoming>
- <bpmn2:outgoing>no</bpmn2:outgoing>
- <bpmn2:outgoing>yes</bpmn2:outgoing>
- </bpmn2:exclusiveGateway>
- <bpmn2:sequenceFlow id="no" name="No" sourceRef="resourceVersionCheck" targetRef="queryForResourceVersion">
- <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("GENDS_resourceVersionProvidedFlag" ) == false}]]></bpmn2:conditionExpression>
- </bpmn2:sequenceFlow>
- <bpmn2:sequenceFlow id="yes" name="Yes" sourceRef="resourceVersionCheck" targetRef="ExclusiveGateway_2"/>
- <bpmn2:scriptTask id="toggleSuccess" name="Toggle Success Indicator" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_7</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_4</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
-GenericDeleteService deleteService = new GenericDeleteService()
-deleteService.setSuccessIndicator(execution, true)
-
-execution.setVariable("WorkflowResponse", " ") //for junits
-]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_4" name="" sourceRef="toggleSuccess" targetRef="EndEvent_1"/>
- <bpmn2:exclusiveGateway id="ExclusiveGateway_2">
- <bpmn2:incoming>yes</bpmn2:incoming>
- <bpmn2:incoming>siExistYes</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_6</bpmn2:outgoing>
- </bpmn2:exclusiveGateway>
- <bpmn2:sequenceFlow id="SequenceFlow_6" name="" sourceRef="ExclusiveGateway_2" targetRef="deleteServiceInstance"/>
- <bpmn2:endEvent id="EndEvent_1">
- <bpmn2:incoming>SequenceFlow_4</bpmn2:incoming>
- <bpmn2:terminateEventDefinition id="_TerminateEventDefinition_24"/>
- </bpmn2:endEvent>
- <bpmn2:scriptTask id="deleteServiceInstance" name="DELETE&#xD;&#xA;Service Instance" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_6</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_7</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
-GenericDeleteService deleteService = new GenericDeleteService()
-deleteService.deleteServiceObject(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_7" name="" sourceRef="deleteServiceInstance" targetRef="toggleSuccess"/>
- <bpmn2:scriptTask id="queryForResourceVersion" name="Query SI Resource Version" scriptFormat="groovy">
- <bpmn2:incoming>no</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_5</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
-GenericDeleteService deleteService = new GenericDeleteService()
-deleteService.getServiceResourceVersion(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_5" name="" sourceRef="queryForResourceVersion" targetRef="siExistCheck"/>
- <bpmn2:exclusiveGateway id="siExistCheck" name="Service Exist?">
- <bpmn2:incoming>SequenceFlow_5</bpmn2:incoming>
- <bpmn2:outgoing>siExistYes</bpmn2:outgoing>
- <bpmn2:outgoing>siExistNo</bpmn2:outgoing>
- </bpmn2:exclusiveGateway>
- <bpmn2:sequenceFlow id="siExistYes" name="Yes" sourceRef="siExistCheck" targetRef="ExclusiveGateway_2">
- <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("GENDS_FoundIndicator" ) == true}]]></bpmn2:conditionExpression>
- </bpmn2:sequenceFlow>
- <bpmn2:sequenceFlow id="siExistNo" name="No" sourceRef="siExistCheck" targetRef="EndEvent_4"/>
- <bpmn2:endEvent id="EndEvent_4">
- <bpmn2:incoming>siExistNo</bpmn2:incoming>
- <bpmn2:terminateEventDefinition id="_TerminateEventDefinition_38"/>
- </bpmn2:endEvent>
- </bpmn2:process>
- <bpmn2:error id="Error_1" errorCode="MSOWorkflowException" name="MSO Workflow Exception"/>
- <bpmndi:BPMNDiagram id="BPMNDiagram_1">
- <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="GenericDeleteService">
- <bpmndi:BPMNShape id="_BPMNShape_StartEvent_63" bpmnElement="StartEvent_1">
- <dc:Bounds height="36.0" width="36.0" x="84.0" y="221.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="102.0" y="262.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_267" bpmnElement="initialization">
- <dc:Bounds height="80.0" width="100.0" x="216.0" y="199.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_224" bpmnElement="resourceVersionCheck" isMarkerVisible="true">
- <dc:Bounds height="50.0" width="50.0" x="365.0" y="213.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="22.0" width="169.0" x="401.0" y="243.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_268" bpmnElement="queryForResourceVersion">
- <dc:Bounds height="80.0" width="100.0" x="457.0" y="100.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_225" bpmnElement="ExclusiveGateway_2" isMarkerVisible="true">
- <dc:Bounds height="50.0" width="50.0" x="600.0" y="213.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="625.0" y="268.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_269" bpmnElement="deleteServiceInstance">
- <dc:Bounds height="80.0" width="100.0" x="684.0" y="199.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_EndEvent_213" bpmnElement="EndEvent_1">
- <dc:Bounds height="36.0" width="36.0" x="1006.0" y="221.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="1024.0" y="262.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_SubProcess_20" bpmnElement="bpmnExceptionHandlingSubProcess" isExpanded="true">
- <dc:Bounds height="169.0" width="321.0" x="155.0" y="384.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="_BPMNShape_StartEvent_63" targetElement="_BPMNShape_ScriptTask_267">
- <di:waypoint xsi:type="dc:Point" x="120.0" y="239.0"/>
- <di:waypoint xsi:type="dc:Point" x="216.0" y="239.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="147.0" y="239.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="SequenceFlow_3" sourceElement="_BPMNShape_ScriptTask_267" targetElement="_BPMNShape_ExclusiveGateway_224">
- <di:waypoint xsi:type="dc:Point" x="316.0" y="239.0"/>
- <di:waypoint xsi:type="dc:Point" x="365.0" y="238.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="217.0" y="238.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_4" bpmnElement="no" sourceElement="_BPMNShape_ExclusiveGateway_224" targetElement="_BPMNShape_ScriptTask_268">
- <di:waypoint xsi:type="dc:Point" x="390.0" y="213.0"/>
- <di:waypoint xsi:type="dc:Point" x="390.0" y="140.0"/>
- <di:waypoint xsi:type="dc:Point" x="457.0" y="140.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="22.0" width="22.0" x="392.0" y="179.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_5" bpmnElement="SequenceFlow_5" sourceElement="_BPMNShape_ScriptTask_268" targetElement="_BPMNShape_ExclusiveGateway_241">
- <di:waypoint xsi:type="dc:Point" x="557.0" y="140.0"/>
- <di:waypoint xsi:type="dc:Point" x="600.0" y="139.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="492.0" y="140.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_6" bpmnElement="SequenceFlow_6" sourceElement="_BPMNShape_ExclusiveGateway_225" targetElement="_BPMNShape_ScriptTask_269">
- <di:waypoint xsi:type="dc:Point" x="650.0" y="238.0"/>
- <di:waypoint xsi:type="dc:Point" x="684.0" y="239.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="556.0" y="239.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_7" bpmnElement="SequenceFlow_7" sourceElement="_BPMNShape_ScriptTask_269" targetElement="_BPMNShape_ScriptTask_272">
- <di:waypoint xsi:type="dc:Point" x="784.0" y="239.0"/>
- <di:waypoint xsi:type="dc:Point" x="826.0" y="239.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="778.0" y="239.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_8" bpmnElement="yes" sourceElement="_BPMNShape_ExclusiveGateway_224" targetElement="_BPMNShape_ExclusiveGateway_225">
- <di:waypoint xsi:type="dc:Point" x="390.0" y="263.0"/>
- <di:waypoint xsi:type="dc:Point" x="390.0" y="310.0"/>
- <di:waypoint xsi:type="dc:Point" x="517.0" y="310.0"/>
- <di:waypoint xsi:type="dc:Point" x="625.0" y="310.0"/>
- <di:waypoint xsi:type="dc:Point" x="625.0" y="263.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="22.0" width="29.0" x="389.0" y="278.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_SubProcess_23" bpmnElement="javaExceptionSubProcess" isExpanded="true">
- <dc:Bounds height="157.0" width="306.0" x="163.0" y="576.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_StartEvent_65" bpmnElement="StartEvent_2">
- <dc:Bounds height="36.0" width="36.0" x="180.0" y="451.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="198.0" y="492.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_StartEvent_66" bpmnElement="StartEvent_3">
- <dc:Bounds height="36.0" width="36.0" x="192.0" y="637.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="210.0" y="678.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_EndEvent_216" bpmnElement="EndEvent_2">
- <dc:Bounds height="36.0" width="36.0" x="408.0" y="637.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="426.0" y="678.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_EndEvent_217" bpmnElement="EndEvent_3">
- <dc:Bounds height="36.0" width="36.0" x="420.0" y="451.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="438.0" y="492.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_270" bpmnElement="processError">
- <dc:Bounds height="80.0" width="100.0" x="266.0" y="429.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_271" bpmnElement="processJavaError">
- <dc:Bounds height="80.0" width="100.0" x="267.0" y="615.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_9" bpmnElement="SequenceFlow_9" sourceElement="_BPMNShape_StartEvent_65" targetElement="_BPMNShape_ScriptTask_270">
- <di:waypoint xsi:type="dc:Point" x="216.0" y="469.0"/>
- <di:waypoint xsi:type="dc:Point" x="266.0" y="469.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="232.0" y="469.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_10" bpmnElement="SequenceFlow_10" sourceElement="_BPMNShape_ScriptTask_270" targetElement="_BPMNShape_EndEvent_217">
- <di:waypoint xsi:type="dc:Point" x="366.0" y="469.0"/>
- <di:waypoint xsi:type="dc:Point" x="420.0" y="469.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="384.0" y="469.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_11" bpmnElement="SequenceFlow_11" sourceElement="_BPMNShape_StartEvent_66" targetElement="_BPMNShape_ScriptTask_271">
- <di:waypoint xsi:type="dc:Point" x="228.0" y="655.0"/>
- <di:waypoint xsi:type="dc:Point" x="267.0" y="655.0"/>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_12" bpmnElement="SequenceFlow_12" sourceElement="_BPMNShape_ScriptTask_271" targetElement="_BPMNShape_EndEvent_216">
- <di:waypoint xsi:type="dc:Point" x="367.0" y="655.0"/>
- <di:waypoint xsi:type="dc:Point" x="408.0" y="655.0"/>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_272" bpmnElement="toggleSuccess">
- <dc:Bounds height="80.0" width="100.0" x="826.0" y="199.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_13" bpmnElement="SequenceFlow_4" sourceElement="_BPMNShape_ScriptTask_272" targetElement="_BPMNShape_EndEvent_213">
- <di:waypoint xsi:type="dc:Point" x="926.0" y="239.0"/>
- <di:waypoint xsi:type="dc:Point" x="1006.0" y="239.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="828.0" y="239.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_241" bpmnElement="siExistCheck" isMarkerVisible="true">
- <dc:Bounds height="50.0" width="50.0" x="600.0" y="114.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="22.0" width="59.0" x="596.0" y="94.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_2" bpmnElement="siExistYes" sourceElement="_BPMNShape_ExclusiveGateway_241" targetElement="_BPMNShape_ExclusiveGateway_225">
- <di:waypoint xsi:type="dc:Point" x="625.0" y="164.0"/>
- <di:waypoint xsi:type="dc:Point" x="625.0" y="213.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="22.0" width="29.0" x="624.0" y="168.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_15" bpmnElement="siExistNo" sourceElement="_BPMNShape_ExclusiveGateway_241" targetElement="_BPMNShape_EndEvent_241">
- <di:waypoint xsi:type="dc:Point" x="650.0" y="139.0"/>
- <di:waypoint xsi:type="dc:Point" x="733.0" y="140.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="22.0" width="22.0" x="664.0" y="140.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_EndEvent_241" bpmnElement="EndEvent_4">
- <dc:Bounds height="36.0" width="36.0" x="733.0" y="122.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="751.0" y="163.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- </bpmndi:BPMNPlane>
- </bpmndi:BPMNDiagram>
-</bpmn2:definitions> \ No newline at end of file
+]]></bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_10" name="" sourceRef="processError" targetRef="EndEvent_3" />
+ <bpmn2:startEvent id="StartEvent_2">
+ <bpmn2:outgoing>SequenceFlow_9</bpmn2:outgoing>
+ <bpmn2:errorEventDefinition id="ErrorEventDefinition_1" />
+ </bpmn2:startEvent>
+ <bpmn2:sequenceFlow id="SequenceFlow_9" name="" sourceRef="StartEvent_2" targetRef="processError" />
+ <bpmn2:endEvent id="EndEvent_3">
+ <bpmn2:incoming>SequenceFlow_10</bpmn2:incoming>
+ <bpmn2:terminateEventDefinition id="_TerminateEventDefinition_25" />
+ </bpmn2:endEvent>
+ </bpmn2:subProcess>
+ <bpmn2:subProcess id="javaExceptionSubProcess" name="Java Exception Handling Sub Process" triggeredByEvent="true">
+ <bpmn2:endEvent id="EndEvent_2">
+ <bpmn2:incoming>SequenceFlow_12</bpmn2:incoming>
+ </bpmn2:endEvent>
+ <bpmn2:scriptTask id="processJavaError" name="Process Error">
+ <bpmn2:incoming>SequenceFlow_11</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_12</bpmn2:outgoing>
+ <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
+
+ExceptionUtil ex = new ExceptionUtil()
+ex.processJavaException(execution)
+]]></bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:startEvent id="StartEvent_3">
+ <bpmn2:outgoing>SequenceFlow_11</bpmn2:outgoing>
+ <bpmn2:errorEventDefinition id="ErrorEventDefinition_2" />
+ </bpmn2:startEvent>
+ <bpmn2:sequenceFlow id="SequenceFlow_11" name="" sourceRef="StartEvent_3" targetRef="processJavaError" />
+ <bpmn2:sequenceFlow id="SequenceFlow_12" name="" sourceRef="processJavaError" targetRef="EndEvent_2" />
+ </bpmn2:subProcess>
+ <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: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.*
+GenericDeleteService deleteService = new GenericDeleteService()
+deleteService.preProcessRequest(execution)
+]]></bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_3" name="" sourceRef="initialization" targetRef="resourceVersionCheck" />
+ <bpmn2:exclusiveGateway id="resourceVersionCheck" name="Resource Version Provided?" default="yes">
+ <bpmn2:incoming>SequenceFlow_3</bpmn2:incoming>
+ <bpmn2:outgoing>no</bpmn2:outgoing>
+ <bpmn2:outgoing>yes</bpmn2:outgoing>
+ </bpmn2:exclusiveGateway>
+ <bpmn2:sequenceFlow id="no" name="No" sourceRef="resourceVersionCheck" targetRef="queryForResourceVersion">
+ <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("GENDS_resourceVersionProvidedFlag" ) == false}]]></bpmn2:conditionExpression>
+ </bpmn2:sequenceFlow>
+ <bpmn2:sequenceFlow id="yes" name="Yes" sourceRef="resourceVersionCheck" targetRef="ExclusiveGateway_2" />
+ <bpmn2:scriptTask id="toggleSuccess" name="Toggle Success Indicator" scriptFormat="groovy">
+ <bpmn2:incoming>SequenceFlow_7</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_4</bpmn2:outgoing>
+ <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
+GenericDeleteService deleteService = new GenericDeleteService()
+deleteService.setSuccessIndicator(execution, true)
+
+execution.setVariable("WorkflowResponse", " ") //for junits
+]]></bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_4" name="" sourceRef="toggleSuccess" targetRef="EndEvent_1" />
+ <bpmn2:exclusiveGateway id="ExclusiveGateway_2">
+ <bpmn2:incoming>yes</bpmn2:incoming>
+ <bpmn2:incoming>siExistYes</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_6</bpmn2:outgoing>
+ </bpmn2:exclusiveGateway>
+ <bpmn2:sequenceFlow id="SequenceFlow_6" name="" sourceRef="ExclusiveGateway_2" targetRef="deleteServiceInstance" />
+ <bpmn2:endEvent id="EndEvent_1">
+ <bpmn2:incoming>SequenceFlow_4</bpmn2:incoming>
+ <bpmn2:terminateEventDefinition id="_TerminateEventDefinition_24" />
+ </bpmn2:endEvent>
+ <bpmn2:scriptTask id="deleteServiceInstance" name="DELETE
+&#10;Service Instance" scriptFormat="groovy">
+ <bpmn2:incoming>SequenceFlow_6</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_7</bpmn2:outgoing>
+ <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
+GenericDeleteService deleteService = new GenericDeleteService()
+deleteService.deleteServiceObject(execution)]]></bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_7" name="" sourceRef="deleteServiceInstance" targetRef="toggleSuccess" />
+ <bpmn2:scriptTask id="queryForResourceVersion" name="Query SI Resource Version" scriptFormat="groovy">
+ <bpmn2:incoming>no</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_5</bpmn2:outgoing>
+ <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
+GenericDeleteService deleteService = new GenericDeleteService()
+deleteService.getServiceResourceVersion(execution)]]></bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_5" name="" sourceRef="queryForResourceVersion" targetRef="siExistCheck" />
+ <bpmn2:exclusiveGateway id="siExistCheck" name="Service Exist?">
+ <bpmn2:incoming>SequenceFlow_5</bpmn2:incoming>
+ <bpmn2:outgoing>siExistYes</bpmn2:outgoing>
+ <bpmn2:outgoing>siExistNo</bpmn2:outgoing>
+ </bpmn2:exclusiveGateway>
+ <bpmn2:sequenceFlow id="siExistYes" name="Yes" sourceRef="siExistCheck" targetRef="ExclusiveGateway_2">
+ <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("GENDS_FoundIndicator" ) == true}]]></bpmn2:conditionExpression>
+ </bpmn2:sequenceFlow>
+ <bpmn2:sequenceFlow id="siExistNo" name="No" sourceRef="siExistCheck" targetRef="EndEvent_4" />
+ <bpmn2:endEvent id="EndEvent_4">
+ <bpmn2:incoming>siExistNo</bpmn2:incoming>
+ <bpmn2:terminateEventDefinition id="_TerminateEventDefinition_38" />
+ </bpmn2:endEvent>
+ </bpmn2:process>
+ <bpmn2:error id="Error_1" name="MSO Workflow Exception" errorCode="MSOWorkflowException" />
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="GenericDeleteService">
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_63" bpmnElement="StartEvent_1">
+ <dc:Bounds x="84" y="221" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="102" y="262" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_267" bpmnElement="initialization">
+ <dc:Bounds x="216" y="199" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_224" bpmnElement="resourceVersionCheck" isMarkerVisible="true">
+ <dc:Bounds x="365" y="213" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="401" y="243" width="169" height="22" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_268" bpmnElement="queryForResourceVersion">
+ <dc:Bounds x="457" y="100" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_225" bpmnElement="ExclusiveGateway_2" isMarkerVisible="true">
+ <dc:Bounds x="600" y="213" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="625" y="268" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_269" bpmnElement="deleteServiceInstance">
+ <dc:Bounds x="684" y="199" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_EndEvent_213" bpmnElement="EndEvent_1">
+ <dc:Bounds x="1006" y="221" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1024" y="262" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_SubProcess_20" bpmnElement="bpmnExceptionHandlingSubProcess" isExpanded="true">
+ <dc:Bounds x="155" y="384" width="321" height="169" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="_BPMNShape_StartEvent_63" targetElement="_BPMNShape_ScriptTask_267">
+ <di:waypoint xsi:type="dc:Point" x="120" y="239" />
+ <di:waypoint xsi:type="dc:Point" x="216" y="239" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="147" y="239" width="6" height="6" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="SequenceFlow_3" sourceElement="_BPMNShape_ScriptTask_267" targetElement="_BPMNShape_ExclusiveGateway_224">
+ <di:waypoint xsi:type="dc:Point" x="316" y="239" />
+ <di:waypoint xsi:type="dc:Point" x="365" y="238" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="217" y="238" width="6" height="6" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_4" bpmnElement="no" sourceElement="_BPMNShape_ExclusiveGateway_224" targetElement="_BPMNShape_ScriptTask_268">
+ <di:waypoint xsi:type="dc:Point" x="390" y="213" />
+ <di:waypoint xsi:type="dc:Point" x="390" y="140" />
+ <di:waypoint xsi:type="dc:Point" x="457" y="140" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="392" y="179" width="22" height="22" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_5" bpmnElement="SequenceFlow_5" sourceElement="_BPMNShape_ScriptTask_268" targetElement="_BPMNShape_ExclusiveGateway_241">
+ <di:waypoint xsi:type="dc:Point" x="557" y="140" />
+ <di:waypoint xsi:type="dc:Point" x="600" y="139" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="492" y="140" width="6" height="6" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_6" bpmnElement="SequenceFlow_6" sourceElement="_BPMNShape_ExclusiveGateway_225" targetElement="_BPMNShape_ScriptTask_269">
+ <di:waypoint xsi:type="dc:Point" x="650" y="238" />
+ <di:waypoint xsi:type="dc:Point" x="684" y="239" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="556" y="239" width="6" height="6" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_7" bpmnElement="SequenceFlow_7" sourceElement="_BPMNShape_ScriptTask_269" targetElement="_BPMNShape_ScriptTask_272">
+ <di:waypoint xsi:type="dc:Point" x="784" y="239" />
+ <di:waypoint xsi:type="dc:Point" x="826" y="239" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="778" y="239" width="6" height="6" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_8" bpmnElement="yes" sourceElement="_BPMNShape_ExclusiveGateway_224" targetElement="_BPMNShape_ExclusiveGateway_225">
+ <di:waypoint xsi:type="dc:Point" x="390" y="263" />
+ <di:waypoint xsi:type="dc:Point" x="390" y="310" />
+ <di:waypoint xsi:type="dc:Point" x="517" y="310" />
+ <di:waypoint xsi:type="dc:Point" x="625" y="310" />
+ <di:waypoint xsi:type="dc:Point" x="625" y="263" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="389" y="278" width="29" height="22" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_SubProcess_23" bpmnElement="javaExceptionSubProcess" isExpanded="true">
+ <dc:Bounds x="163" y="576" width="306" height="157" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_65" bpmnElement="StartEvent_2">
+ <dc:Bounds x="180" y="451" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="198" y="492" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_66" bpmnElement="StartEvent_3">
+ <dc:Bounds x="192" y="637" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="210" y="678" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_EndEvent_216" bpmnElement="EndEvent_2">
+ <dc:Bounds x="408" y="637" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="426" y="678" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_EndEvent_217" bpmnElement="EndEvent_3">
+ <dc:Bounds x="420" y="451" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="438" y="492" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_270" bpmnElement="processError">
+ <dc:Bounds x="266" y="429" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_271" bpmnElement="processJavaError">
+ <dc:Bounds x="267" y="615" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_9" bpmnElement="SequenceFlow_9" sourceElement="_BPMNShape_StartEvent_65" targetElement="_BPMNShape_ScriptTask_270">
+ <di:waypoint xsi:type="dc:Point" x="216" y="469" />
+ <di:waypoint xsi:type="dc:Point" x="266" y="469" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="232" y="469" width="6" height="6" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_10" bpmnElement="SequenceFlow_10" sourceElement="_BPMNShape_ScriptTask_270" targetElement="_BPMNShape_EndEvent_217">
+ <di:waypoint xsi:type="dc:Point" x="366" y="469" />
+ <di:waypoint xsi:type="dc:Point" x="420" y="469" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="384" y="469" width="6" height="6" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_11" bpmnElement="SequenceFlow_11" sourceElement="_BPMNShape_StartEvent_66" targetElement="_BPMNShape_ScriptTask_271">
+ <di:waypoint xsi:type="dc:Point" x="228" y="655" />
+ <di:waypoint xsi:type="dc:Point" x="267" y="655" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_12" bpmnElement="SequenceFlow_12" sourceElement="_BPMNShape_ScriptTask_271" targetElement="_BPMNShape_EndEvent_216">
+ <di:waypoint xsi:type="dc:Point" x="367" y="655" />
+ <di:waypoint xsi:type="dc:Point" x="408" y="655" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_272" bpmnElement="toggleSuccess">
+ <dc:Bounds x="826" y="199" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_13" bpmnElement="SequenceFlow_4" sourceElement="_BPMNShape_ScriptTask_272" targetElement="_BPMNShape_EndEvent_213">
+ <di:waypoint xsi:type="dc:Point" x="926" y="239" />
+ <di:waypoint xsi:type="dc:Point" x="1006" y="239" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="828" y="239" width="6" height="6" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_241" bpmnElement="siExistCheck" isMarkerVisible="true">
+ <dc:Bounds x="600" y="114" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="596" y="94" width="59" height="22" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_2" bpmnElement="siExistYes" sourceElement="_BPMNShape_ExclusiveGateway_241" targetElement="_BPMNShape_ExclusiveGateway_225">
+ <di:waypoint xsi:type="dc:Point" x="625" y="164" />
+ <di:waypoint xsi:type="dc:Point" x="625" y="213" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="624" y="168" width="29" height="22" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_15" bpmnElement="siExistNo" sourceElement="_BPMNShape_ExclusiveGateway_241" targetElement="_BPMNShape_EndEvent_241">
+ <di:waypoint xsi:type="dc:Point" x="650" y="139" />
+ <di:waypoint xsi:type="dc:Point" x="733" y="140" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="664" y="140" width="22" height="22" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_EndEvent_241" bpmnElement="EndEvent_4">
+ <dc:Bounds x="733" y="122" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="751" y="163" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn2:definitions>
diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericDeleteVnf.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericDeleteVnf.bpmn
index e68f6ec227..f46f86613f 100644
--- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericDeleteVnf.bpmn
+++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericDeleteVnf.bpmn
@@ -1,251 +1,251 @@
-<?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="_oBLSkHqWEea26OhQB97uCQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
- <bpmn2:process id="GenericDeleteVnf" name="GenericDeleteVnf" isExecutable="true">
- <bpmn2:startEvent id="StartEvent_1">
- <bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing>
- </bpmn2:startEvent>
- <bpmn2:scriptTask id="initialization" name="Initialization" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_9</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
-GenericDeleteVnf deleteVnf= new GenericDeleteVnf()
-deleteVnf.preProcessRequest(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_1" name="" sourceRef="StartEvent_1" targetRef="initialization" />
- <bpmn2:sequenceFlow id="SequenceFlow_9" name="" sourceRef="initialization" targetRef="resourceVersionCheck" />
- <bpmn2:exclusiveGateway id="resourceVersionCheck" name="Resource Version Provided?" default="resourceVersionProvided">
- <bpmn2:incoming>SequenceFlow_9</bpmn2:incoming>
- <bpmn2:outgoing>resourceVariableNotProvided</bpmn2:outgoing>
- <bpmn2:outgoing>resourceVersionProvided</bpmn2:outgoing>
- </bpmn2:exclusiveGateway>
- <bpmn2:sequenceFlow id="resourceVariableNotProvided" name="No" sourceRef="resourceVersionCheck" targetRef="queryForResourceVersion">
- <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("GENDV_resourceVersionProvided") == false}]]></bpmn2:conditionExpression>
- </bpmn2:sequenceFlow>
- <bpmn2:sequenceFlow id="resourceVersionProvided" name="Yes" sourceRef="resourceVersionCheck" targetRef="ExclusiveGateway_2" />
- <bpmn2:subProcess id="bpmnExceptionHandlingSubProcess" name="Error Handling Sub Process" triggeredByEvent="true">
- <bpmn2:scriptTask id="processBPMNError" name="Process Error" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_2</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_3</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_3" name="" sourceRef="processBPMNError" targetRef="EndEvent_2" />
- <bpmn2:startEvent id="StartEvent_2">
- <bpmn2:outgoing>SequenceFlow_2</bpmn2:outgoing>
- <bpmn2:errorEventDefinition id="ErrorEventDefinition_1" />
- </bpmn2:startEvent>
- <bpmn2:sequenceFlow id="SequenceFlow_2" name="" sourceRef="StartEvent_2" targetRef="processBPMNError" />
- <bpmn2:endEvent id="EndEvent_2">
- <bpmn2:incoming>SequenceFlow_3</bpmn2:incoming>
- <bpmn2:terminateEventDefinition id="_TerminateEventDefinition_40" />
- </bpmn2:endEvent>
- </bpmn2:subProcess>
- <bpmn2:scriptTask id="queryForResourceVersion" name="Query SI Resource Version" scriptFormat="groovy">
- <bpmn2:incoming>resourceVariableNotProvided</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_5</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
-GenericDeleteVnf deleteVnf= new GenericDeleteVnf()
-deleteVnf.getVnfResourceVersion(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_5" name="" sourceRef="queryForResourceVersion" targetRef="vnfFoundCheck" />
- <bpmn2:scriptTask id="toggleSuccess" name="Toggle Success Indicator" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_7</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_8</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
-GenericDeleteVnf deleteVnf= new GenericDeleteVnf()
-deleteVnf.setSuccessIndicator(execution, true)
-
-execution.setVariable("WorkflowResponse", " ") //for junits]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_8" name="" sourceRef="toggleSuccess" targetRef="EndEvent_1" />
- <bpmn2:scriptTask id="deleteVnf" name="DELETE
-&#10;Vnf" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_6</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_7</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
-GenericDeleteVnf deleteVnf= new GenericDeleteVnf()
-deleteVnf.deleteVnf(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_7" name="" sourceRef="deleteVnf" targetRef="toggleSuccess" />
- <bpmn2:endEvent id="EndEvent_3">
- <bpmn2:incoming>vnfFoundNo</bpmn2:incoming>
- <bpmn2:terminateEventDefinition id="_TerminateEventDefinition_41" />
- </bpmn2:endEvent>
- <bpmn2:exclusiveGateway id="vnfFoundCheck" name="Vnf Found?" default="vnfFoundNo">
- <bpmn2:incoming>SequenceFlow_5</bpmn2:incoming>
- <bpmn2:outgoing>vnfFoundYes</bpmn2:outgoing>
- <bpmn2:outgoing>vnfFoundNo</bpmn2:outgoing>
- </bpmn2:exclusiveGateway>
- <bpmn2:sequenceFlow id="vnfFoundYes" name="Yes" sourceRef="vnfFoundCheck" targetRef="ExclusiveGateway_2">
- <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("GENDV_FoundIndicator") == true}]]></bpmn2:conditionExpression>
- </bpmn2:sequenceFlow>
- <bpmn2:sequenceFlow id="vnfFoundNo" name="No" sourceRef="vnfFoundCheck" targetRef="EndEvent_3" />
- <bpmn2:exclusiveGateway id="ExclusiveGateway_2">
- <bpmn2:incoming>resourceVersionProvided</bpmn2:incoming>
- <bpmn2:incoming>vnfFoundYes</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_6</bpmn2:outgoing>
- </bpmn2:exclusiveGateway>
- <bpmn2:sequenceFlow id="SequenceFlow_6" name="" sourceRef="ExclusiveGateway_2" targetRef="deleteVnf" />
- <bpmn2:endEvent id="EndEvent_1">
- <bpmn2:incoming>SequenceFlow_8</bpmn2:incoming>
- <bpmn2:terminateEventDefinition id="_TerminateEventDefinition_39" />
- </bpmn2:endEvent>
- </bpmn2:process>
- <bpmndi:BPMNDiagram id="BPMNDiagram_1">
- <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="GenericDeleteVnf">
- <bpmndi:BPMNShape id="_BPMNShape_StartEvent_78" bpmnElement="StartEvent_1">
- <dc:Bounds x="74" y="216" width="36" height="36" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="92" y="257" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_310" bpmnElement="initialization">
- <dc:Bounds x="192" y="194" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="_BPMNShape_StartEvent_78" targetElement="_BPMNShape_ScriptTask_310">
- <di:waypoint xsi:type="dc:Point" x="110" y="234" />
- <di:waypoint xsi:type="dc:Point" x="192" y="234" />
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_239" bpmnElement="resourceVersionCheck" isMarkerVisible="true">
- <dc:Bounds x="326" y="208" width="50" height="50" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="360" y="238" width="169" height="22" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_2" bpmnElement="SequenceFlow_2" sourceElement="_BPMNShape_ScriptTask_310" targetElement="_BPMNShape_ExclusiveGateway_239">
- <di:waypoint xsi:type="dc:Point" x="236" y="476" />
- <di:waypoint xsi:type="dc:Point" x="288" y="476" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="262" y="476" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_320" bpmnElement="queryForResourceVersion">
- <dc:Bounds x="408" y="96" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_321" bpmnElement="deleteVnf">
- <dc:Bounds x="658" y="194" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_240" bpmnElement="ExclusiveGateway_2" isMarkerVisible="true">
- <dc:Bounds x="562" y="208" width="50" height="50" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="587" y="263" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_322" bpmnElement="toggleSuccess">
- <dc:Bounds x="802" y="194" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_EndEvent_240" bpmnElement="EndEvent_1">
- <dc:Bounds x="1001" y="216" width="36" height="36" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="1019" y="257" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="resourceVariableNotProvided" sourceElement="_BPMNShape_ExclusiveGateway_239" targetElement="_BPMNShape_ScriptTask_320">
- <di:waypoint xsi:type="dc:Point" x="351" y="208" />
- <di:waypoint xsi:type="dc:Point" x="351" y="136" />
- <di:waypoint xsi:type="dc:Point" x="408" y="136" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="354" y="165" width="22" height="22" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_4" bpmnElement="resourceVersionProvided" sourceElement="_BPMNShape_ExclusiveGateway_239" targetElement="_BPMNShape_ExclusiveGateway_240">
- <di:waypoint xsi:type="dc:Point" x="351" y="258" />
- <di:waypoint xsi:type="dc:Point" x="351" y="312" />
- <di:waypoint xsi:type="dc:Point" x="459" y="312" />
- <di:waypoint xsi:type="dc:Point" x="587" y="312" />
- <di:waypoint xsi:type="dc:Point" x="587" y="258" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="351" y="276" width="29" height="22" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_5" bpmnElement="SequenceFlow_5" sourceElement="_BPMNShape_ScriptTask_320" targetElement="_BPMNShape_ExclusiveGateway_242">
- <di:waypoint xsi:type="dc:Point" x="508" y="136" />
- <di:waypoint xsi:type="dc:Point" x="562" y="135" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="558" y="135" width="6" height="6" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_6" bpmnElement="SequenceFlow_6" sourceElement="_BPMNShape_ExclusiveGateway_240" targetElement="_BPMNShape_ScriptTask_321">
- <di:waypoint xsi:type="dc:Point" x="612" y="233" />
- <di:waypoint xsi:type="dc:Point" x="658" y="234" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="633" y="234" width="6" height="6" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_7" bpmnElement="SequenceFlow_7" sourceElement="_BPMNShape_ScriptTask_321" targetElement="_BPMNShape_ScriptTask_322">
- <di:waypoint xsi:type="dc:Point" x="758" y="234" />
- <di:waypoint xsi:type="dc:Point" x="802" y="234" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="777" y="234" width="6" height="6" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_8" bpmnElement="SequenceFlow_8" sourceElement="_BPMNShape_ScriptTask_322" targetElement="_BPMNShape_EndEvent_240">
- <di:waypoint xsi:type="dc:Point" x="902" y="234" />
- <di:waypoint xsi:type="dc:Point" x="1001" y="234" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="949" y="234" width="6" height="6" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_9" bpmnElement="SequenceFlow_9" sourceElement="_BPMNShape_ScriptTask_310" targetElement="_BPMNShape_ExclusiveGateway_239">
- <di:waypoint xsi:type="dc:Point" x="292" y="234" />
- <di:waypoint xsi:type="dc:Point" x="326" y="233" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="311" y="233" width="6" height="6" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_SubProcess_36" bpmnElement="bpmnExceptionHandlingSubProcess" isExpanded="true">
- <dc:Bounds x="185" y="397" width="304" height="157" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_StartEvent_82" bpmnElement="StartEvent_2">
- <dc:Bounds x="200" y="458" width="36" height="36" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="218" y="499" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_EndEvent_242" bpmnElement="EndEvent_2">
- <dc:Bounds x="440" y="458" width="36" height="36" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="458" y="499" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_323" bpmnElement="processBPMNError">
- <dc:Bounds x="288" y="436" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_10" bpmnElement="SequenceFlow_3" sourceElement="_BPMNShape_ScriptTask_323" targetElement="_BPMNShape_EndEvent_242">
- <di:waypoint xsi:type="dc:Point" x="388" y="476" />
- <di:waypoint xsi:type="dc:Point" x="440" y="476" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="414" y="476" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_242" bpmnElement="vnfFoundCheck" isMarkerVisible="true">
- <dc:Bounds x="562" y="110" width="50" height="50" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="552" y="90" width="72" height="22" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_EndEvent_243" bpmnElement="EndEvent_3">
- <dc:Bounds x="708" y="118" width="36" height="36" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="726" y="159" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_11" bpmnElement="vnfFoundYes" sourceElement="_BPMNShape_ExclusiveGateway_242" targetElement="_BPMNShape_ExclusiveGateway_240">
- <di:waypoint xsi:type="dc:Point" x="587" y="160" />
- <di:waypoint xsi:type="dc:Point" x="587" y="208" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="587" y="165" width="29" height="22" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_12" bpmnElement="vnfFoundNo" sourceElement="_BPMNShape_ExclusiveGateway_242" targetElement="_BPMNShape_EndEvent_243">
- <di:waypoint xsi:type="dc:Point" x="612" y="135" />
- <di:waypoint xsi:type="dc:Point" x="708" y="136" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="637" y="135" width="22" height="22" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- </bpmndi:BPMNPlane>
- </bpmndi:BPMNDiagram>
+<?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="_oBLSkHqWEea26OhQB97uCQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
+ <bpmn2:process id="GenericDeleteVnf" name="GenericDeleteVnf" isExecutable="true">
+ <bpmn2:startEvent id="StartEvent_1">
+ <bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing>
+ </bpmn2:startEvent>
+ <bpmn2:scriptTask id="initialization" name="Initialization" scriptFormat="groovy">
+ <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_9</bpmn2:outgoing>
+ <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
+GenericDeleteVnf deleteVnf= new GenericDeleteVnf()
+deleteVnf.preProcessRequest(execution)]]></bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_1" name="" sourceRef="StartEvent_1" targetRef="initialization" />
+ <bpmn2:sequenceFlow id="SequenceFlow_9" name="" sourceRef="initialization" targetRef="resourceVersionCheck" />
+ <bpmn2:exclusiveGateway id="resourceVersionCheck" name="Resource Version Provided?" default="resourceVersionProvided">
+ <bpmn2:incoming>SequenceFlow_9</bpmn2:incoming>
+ <bpmn2:outgoing>resourceVariableNotProvided</bpmn2:outgoing>
+ <bpmn2:outgoing>resourceVersionProvided</bpmn2:outgoing>
+ </bpmn2:exclusiveGateway>
+ <bpmn2:sequenceFlow id="resourceVariableNotProvided" name="No" sourceRef="resourceVersionCheck" targetRef="queryForResourceVersion">
+ <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("GENDV_resourceVersionProvided") == false}]]></bpmn2:conditionExpression>
+ </bpmn2:sequenceFlow>
+ <bpmn2:sequenceFlow id="resourceVersionProvided" name="Yes" sourceRef="resourceVersionCheck" targetRef="ExclusiveGateway_2" />
+ <bpmn2:subProcess id="bpmnExceptionHandlingSubProcess" name="Error Handling Sub Process" triggeredByEvent="true">
+ <bpmn2:scriptTask id="processBPMNError" name="Process Error" scriptFormat="groovy">
+ <bpmn2:incoming>SequenceFlow_2</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_3</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_3" name="" sourceRef="processBPMNError" targetRef="EndEvent_2" />
+ <bpmn2:startEvent id="StartEvent_2">
+ <bpmn2:outgoing>SequenceFlow_2</bpmn2:outgoing>
+ <bpmn2:errorEventDefinition id="ErrorEventDefinition_1" />
+ </bpmn2:startEvent>
+ <bpmn2:sequenceFlow id="SequenceFlow_2" name="" sourceRef="StartEvent_2" targetRef="processBPMNError" />
+ <bpmn2:endEvent id="EndEvent_2">
+ <bpmn2:incoming>SequenceFlow_3</bpmn2:incoming>
+ <bpmn2:terminateEventDefinition id="_TerminateEventDefinition_40" />
+ </bpmn2:endEvent>
+ </bpmn2:subProcess>
+ <bpmn2:scriptTask id="queryForResourceVersion" name="Query SI Resource Version" scriptFormat="groovy">
+ <bpmn2:incoming>resourceVariableNotProvided</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_5</bpmn2:outgoing>
+ <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
+GenericDeleteVnf deleteVnf= new GenericDeleteVnf()
+deleteVnf.getVnfResourceVersion(execution)]]></bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_5" name="" sourceRef="queryForResourceVersion" targetRef="vnfFoundCheck" />
+ <bpmn2:scriptTask id="toggleSuccess" name="Toggle Success Indicator" scriptFormat="groovy">
+ <bpmn2:incoming>SequenceFlow_7</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_8</bpmn2:outgoing>
+ <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
+GenericDeleteVnf deleteVnf= new GenericDeleteVnf()
+deleteVnf.setSuccessIndicator(execution, true)
+
+execution.setVariable("WorkflowResponse", " ") //for junits]]></bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_8" name="" sourceRef="toggleSuccess" targetRef="EndEvent_1" />
+ <bpmn2:scriptTask id="deleteVnf" name="DELETE
+&#10;Vnf" scriptFormat="groovy">
+ <bpmn2:incoming>SequenceFlow_6</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_7</bpmn2:outgoing>
+ <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
+GenericDeleteVnf deleteVnf= new GenericDeleteVnf()
+deleteVnf.deleteVnf(execution)]]></bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_7" name="" sourceRef="deleteVnf" targetRef="toggleSuccess" />
+ <bpmn2:endEvent id="EndEvent_3">
+ <bpmn2:incoming>vnfFoundNo</bpmn2:incoming>
+ <bpmn2:terminateEventDefinition id="_TerminateEventDefinition_41" />
+ </bpmn2:endEvent>
+ <bpmn2:exclusiveGateway id="vnfFoundCheck" name="Vnf Found?" default="vnfFoundNo">
+ <bpmn2:incoming>SequenceFlow_5</bpmn2:incoming>
+ <bpmn2:outgoing>vnfFoundYes</bpmn2:outgoing>
+ <bpmn2:outgoing>vnfFoundNo</bpmn2:outgoing>
+ </bpmn2:exclusiveGateway>
+ <bpmn2:sequenceFlow id="vnfFoundYes" name="Yes" sourceRef="vnfFoundCheck" targetRef="ExclusiveGateway_2">
+ <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("GENDV_FoundIndicator") == true}]]></bpmn2:conditionExpression>
+ </bpmn2:sequenceFlow>
+ <bpmn2:sequenceFlow id="vnfFoundNo" name="No" sourceRef="vnfFoundCheck" targetRef="EndEvent_3" />
+ <bpmn2:exclusiveGateway id="ExclusiveGateway_2">
+ <bpmn2:incoming>resourceVersionProvided</bpmn2:incoming>
+ <bpmn2:incoming>vnfFoundYes</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_6</bpmn2:outgoing>
+ </bpmn2:exclusiveGateway>
+ <bpmn2:sequenceFlow id="SequenceFlow_6" name="" sourceRef="ExclusiveGateway_2" targetRef="deleteVnf" />
+ <bpmn2:endEvent id="EndEvent_1">
+ <bpmn2:incoming>SequenceFlow_8</bpmn2:incoming>
+ <bpmn2:terminateEventDefinition id="_TerminateEventDefinition_39" />
+ </bpmn2:endEvent>
+ </bpmn2:process>
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="GenericDeleteVnf">
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_78" bpmnElement="StartEvent_1">
+ <dc:Bounds x="74" y="216" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="92" y="257" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_310" bpmnElement="initialization">
+ <dc:Bounds x="192" y="194" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="_BPMNShape_StartEvent_78" targetElement="_BPMNShape_ScriptTask_310">
+ <di:waypoint xsi:type="dc:Point" x="110" y="234" />
+ <di:waypoint xsi:type="dc:Point" x="192" y="234" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_239" bpmnElement="resourceVersionCheck" isMarkerVisible="true">
+ <dc:Bounds x="326" y="208" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="360" y="238" width="169" height="22" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_2" bpmnElement="SequenceFlow_2" sourceElement="_BPMNShape_ScriptTask_310" targetElement="_BPMNShape_ExclusiveGateway_239">
+ <di:waypoint xsi:type="dc:Point" x="236" y="476" />
+ <di:waypoint xsi:type="dc:Point" x="288" y="476" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="262" y="476" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_320" bpmnElement="queryForResourceVersion">
+ <dc:Bounds x="408" y="96" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_321" bpmnElement="deleteVnf">
+ <dc:Bounds x="658" y="194" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_240" bpmnElement="ExclusiveGateway_2" isMarkerVisible="true">
+ <dc:Bounds x="562" y="208" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="587" y="263" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_322" bpmnElement="toggleSuccess">
+ <dc:Bounds x="802" y="194" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_EndEvent_240" bpmnElement="EndEvent_1">
+ <dc:Bounds x="1001" y="216" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1019" y="257" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="resourceVariableNotProvided" sourceElement="_BPMNShape_ExclusiveGateway_239" targetElement="_BPMNShape_ScriptTask_320">
+ <di:waypoint xsi:type="dc:Point" x="351" y="208" />
+ <di:waypoint xsi:type="dc:Point" x="351" y="136" />
+ <di:waypoint xsi:type="dc:Point" x="408" y="136" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="354" y="165" width="22" height="22" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_4" bpmnElement="resourceVersionProvided" sourceElement="_BPMNShape_ExclusiveGateway_239" targetElement="_BPMNShape_ExclusiveGateway_240">
+ <di:waypoint xsi:type="dc:Point" x="351" y="258" />
+ <di:waypoint xsi:type="dc:Point" x="351" y="312" />
+ <di:waypoint xsi:type="dc:Point" x="459" y="312" />
+ <di:waypoint xsi:type="dc:Point" x="587" y="312" />
+ <di:waypoint xsi:type="dc:Point" x="587" y="258" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="351" y="276" width="29" height="22" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_5" bpmnElement="SequenceFlow_5" sourceElement="_BPMNShape_ScriptTask_320" targetElement="_BPMNShape_ExclusiveGateway_242">
+ <di:waypoint xsi:type="dc:Point" x="508" y="136" />
+ <di:waypoint xsi:type="dc:Point" x="562" y="135" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="558" y="135" width="6" height="6" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_6" bpmnElement="SequenceFlow_6" sourceElement="_BPMNShape_ExclusiveGateway_240" targetElement="_BPMNShape_ScriptTask_321">
+ <di:waypoint xsi:type="dc:Point" x="612" y="233" />
+ <di:waypoint xsi:type="dc:Point" x="658" y="234" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="633" y="234" width="6" height="6" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_7" bpmnElement="SequenceFlow_7" sourceElement="_BPMNShape_ScriptTask_321" targetElement="_BPMNShape_ScriptTask_322">
+ <di:waypoint xsi:type="dc:Point" x="758" y="234" />
+ <di:waypoint xsi:type="dc:Point" x="802" y="234" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="777" y="234" width="6" height="6" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_8" bpmnElement="SequenceFlow_8" sourceElement="_BPMNShape_ScriptTask_322" targetElement="_BPMNShape_EndEvent_240">
+ <di:waypoint xsi:type="dc:Point" x="902" y="234" />
+ <di:waypoint xsi:type="dc:Point" x="1001" y="234" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="949" y="234" width="6" height="6" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_9" bpmnElement="SequenceFlow_9" sourceElement="_BPMNShape_ScriptTask_310" targetElement="_BPMNShape_ExclusiveGateway_239">
+ <di:waypoint xsi:type="dc:Point" x="292" y="234" />
+ <di:waypoint xsi:type="dc:Point" x="326" y="233" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="311" y="233" width="6" height="6" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_SubProcess_36" bpmnElement="bpmnExceptionHandlingSubProcess" isExpanded="true">
+ <dc:Bounds x="185" y="397" width="304" height="157" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_82" bpmnElement="StartEvent_2">
+ <dc:Bounds x="200" y="458" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="218" y="499" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_EndEvent_242" bpmnElement="EndEvent_2">
+ <dc:Bounds x="440" y="458" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="458" y="499" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_323" bpmnElement="processBPMNError">
+ <dc:Bounds x="288" y="436" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_10" bpmnElement="SequenceFlow_3" sourceElement="_BPMNShape_ScriptTask_323" targetElement="_BPMNShape_EndEvent_242">
+ <di:waypoint xsi:type="dc:Point" x="388" y="476" />
+ <di:waypoint xsi:type="dc:Point" x="440" y="476" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="414" y="476" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_242" bpmnElement="vnfFoundCheck" isMarkerVisible="true">
+ <dc:Bounds x="562" y="110" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="552" y="90" width="72" height="22" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_EndEvent_243" bpmnElement="EndEvent_3">
+ <dc:Bounds x="708" y="118" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="726" y="159" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_11" bpmnElement="vnfFoundYes" sourceElement="_BPMNShape_ExclusiveGateway_242" targetElement="_BPMNShape_ExclusiveGateway_240">
+ <di:waypoint xsi:type="dc:Point" x="587" y="160" />
+ <di:waypoint xsi:type="dc:Point" x="587" y="208" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="587" y="165" width="29" height="22" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_12" bpmnElement="vnfFoundNo" sourceElement="_BPMNShape_ExclusiveGateway_242" targetElement="_BPMNShape_EndEvent_243">
+ <di:waypoint xsi:type="dc:Point" x="612" y="135" />
+ <di:waypoint xsi:type="dc:Point" x="708" y="136" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="637" y="135" width="22" height="22" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
</bpmn2:definitions> \ No newline at end of file
diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericGetVnf.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericGetVnf.bpmn
index db0d35d9ce..3300d86084 100644
--- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericGetVnf.bpmn
+++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericGetVnf.bpmn
@@ -1,212 +1,212 @@
-<?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" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd" id="_eb5eEHR6EeaJwpcpVN5gXw" exporter="camunda modeler" exporterVersion="2.7.0" targetNamespace="http://camunda.org/schema/1.0/bpmn">
- <bpmn2:process id="GenericGetVnf" name="GenericGetVnf" isExecutable="true">
- <bpmn2:startEvent id="StartEvent_1">
- <bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing>
- </bpmn2:startEvent>
- <bpmn2:scriptTask id="intialization" name="Intialization" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_2</bpmn2:outgoing>
+<?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" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd" id="_eb5eEHR6EeaJwpcpVN5gXw" exporter="camunda modeler" exporterVersion="2.7.0" targetNamespace="http://camunda.org/schema/1.0/bpmn">
+ <bpmn2:process id="GenericGetVnf" name="GenericGetVnf" isExecutable="true">
+ <bpmn2:startEvent id="StartEvent_1">
+ <bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing>
+ </bpmn2:startEvent>
+ <bpmn2:scriptTask id="intialization" name="Intialization" scriptFormat="groovy">
+ <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_2</bpmn2:outgoing>
<bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
GenericGetVnf genericGetVnf = new GenericGetVnf ()
genericGetVnf.preProcessRequest(execution)
-]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_1" name="" sourceRef="StartEvent_1" targetRef="intialization"/>
- <bpmn2:sequenceFlow id="SequenceFlow_2" name="" sourceRef="intialization" targetRef="vnfIdProvided"/>
- <bpmn2:exclusiveGateway id="vnfIdProvided" name="Vnf Id Provided?" default="noVnfId">
- <bpmn2:incoming>SequenceFlow_2</bpmn2:incoming>
- <bpmn2:outgoing>noVnfId</bpmn2:outgoing>
- <bpmn2:outgoing>haveVnfId</bpmn2:outgoing>
- </bpmn2:exclusiveGateway>
- <bpmn2:sequenceFlow id="noVnfId" name="No" sourceRef="vnfIdProvided" targetRef="getVnfByName"/>
- <bpmn2:sequenceFlow id="haveVnfId" name="Yes" sourceRef="vnfIdProvided" targetRef="getGenericVnf">
- <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("GENGV_getVnfByName") == false}]]></bpmn2:conditionExpression>
- </bpmn2:sequenceFlow>
- <bpmn2:scriptTask id="getVnfByName" name="GET Vnf By Name" scriptFormat="groovy">
- <bpmn2:incoming>noVnfId</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_9</bpmn2:outgoing>
+]]></bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_1" name="" sourceRef="StartEvent_1" targetRef="intialization"/>
+ <bpmn2:sequenceFlow id="SequenceFlow_2" name="" sourceRef="intialization" targetRef="vnfIdProvided"/>
+ <bpmn2:exclusiveGateway id="vnfIdProvided" name="Vnf Id Provided?" default="noVnfId">
+ <bpmn2:incoming>SequenceFlow_2</bpmn2:incoming>
+ <bpmn2:outgoing>noVnfId</bpmn2:outgoing>
+ <bpmn2:outgoing>haveVnfId</bpmn2:outgoing>
+ </bpmn2:exclusiveGateway>
+ <bpmn2:sequenceFlow id="noVnfId" name="No" sourceRef="vnfIdProvided" targetRef="getVnfByName"/>
+ <bpmn2:sequenceFlow id="haveVnfId" name="Yes" sourceRef="vnfIdProvided" targetRef="getGenericVnf">
+ <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("GENGV_getVnfByName") == false}]]></bpmn2:conditionExpression>
+ </bpmn2:sequenceFlow>
+ <bpmn2:scriptTask id="getVnfByName" name="GET Vnf By Name" scriptFormat="groovy">
+ <bpmn2:incoming>noVnfId</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_9</bpmn2:outgoing>
<bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
GenericGetVnf genericGetVnf = new GenericGetVnf()
-genericGetVnf.getVnfByName(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_9" name="" sourceRef="getVnfByName" targetRef="ExclusiveGateway_2"/>
- <bpmn2:exclusiveGateway id="ExclusiveGateway_2">
- <bpmn2:incoming>SequenceFlow_9</bpmn2:incoming>
- <bpmn2:incoming>SequenceFlow_10</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_7</bpmn2:outgoing>
- </bpmn2:exclusiveGateway>
- <bpmn2:sequenceFlow id="SequenceFlow_7" name="" sourceRef="ExclusiveGateway_2" targetRef="toggleSuccess"/>
- <bpmn2:scriptTask id="getGenericVnf" name="GET Vnf By&#xD;&#xA;Id" scriptFormat="groovy">
- <bpmn2:incoming>haveVnfId</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_10</bpmn2:outgoing>
+genericGetVnf.getVnfByName(execution)]]></bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_9" name="" sourceRef="getVnfByName" targetRef="ExclusiveGateway_2"/>
+ <bpmn2:exclusiveGateway id="ExclusiveGateway_2">
+ <bpmn2:incoming>SequenceFlow_9</bpmn2:incoming>
+ <bpmn2:incoming>SequenceFlow_10</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_7</bpmn2:outgoing>
+ </bpmn2:exclusiveGateway>
+ <bpmn2:sequenceFlow id="SequenceFlow_7" name="" sourceRef="ExclusiveGateway_2" targetRef="toggleSuccess"/>
+ <bpmn2:scriptTask id="getGenericVnf" name="GET Vnf By&#xD;&#xA;Id" scriptFormat="groovy">
+ <bpmn2:incoming>haveVnfId</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_10</bpmn2:outgoing>
<bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
GenericGetVnf genericGetVnf = new GenericGetVnf()
-genericGetVnf.getVnfById(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_10" name="" sourceRef="getGenericVnf" targetRef="ExclusiveGateway_2"/>
- <bpmn2:subProcess id="bpmnExceptionHandlingSubProcess" name="Error Handling Sub Process" triggeredByEvent="true">
- <bpmn2:endEvent id="EndEvent_3">
- <bpmn2:incoming>SequenceFlow_12</bpmn2:incoming>
- <bpmn2:terminateEventDefinition id="_TerminateEventDefinition_31"/>
- </bpmn2:endEvent>
- <bpmn2:scriptTask id="proccessBPMNError" name="Process Error" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_11</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_12</bpmn2:outgoing>
+genericGetVnf.getVnfById(execution)]]></bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_10" name="" sourceRef="getGenericVnf" targetRef="ExclusiveGateway_2"/>
+ <bpmn2:subProcess id="bpmnExceptionHandlingSubProcess" name="Error Handling Sub Process" triggeredByEvent="true">
+ <bpmn2:endEvent id="EndEvent_3">
+ <bpmn2:incoming>SequenceFlow_12</bpmn2:incoming>
+ <bpmn2:terminateEventDefinition id="_TerminateEventDefinition_31"/>
+ </bpmn2:endEvent>
+ <bpmn2:scriptTask id="proccessBPMNError" name="Process Error" scriptFormat="groovy">
+ <bpmn2:incoming>SequenceFlow_11</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_12</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_12" name="" sourceRef="proccessBPMNError" targetRef="EndEvent_3"/>
- <bpmn2:startEvent id="catchMSOWorkflowException">
- <bpmn2:outgoing>SequenceFlow_11</bpmn2:outgoing>
- <bpmn2:errorEventDefinition id="ErrorEventDefinition_1"/>
- </bpmn2:startEvent>
- <bpmn2:sequenceFlow id="SequenceFlow_11" name="" sourceRef="catchMSOWorkflowException" targetRef="proccessBPMNError"/>
- </bpmn2:subProcess>
- <bpmn2:scriptTask id="toggleSuccess" name="Toggle Success Indicator" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_7</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_8</bpmn2:outgoing>
+ex.processSubflowsBPMNException(execution)]]></bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_12" name="" sourceRef="proccessBPMNError" targetRef="EndEvent_3"/>
+ <bpmn2:startEvent id="catchMSOWorkflowException">
+ <bpmn2:outgoing>SequenceFlow_11</bpmn2:outgoing>
+ <bpmn2:errorEventDefinition id="ErrorEventDefinition_1"/>
+ </bpmn2:startEvent>
+ <bpmn2:sequenceFlow id="SequenceFlow_11" name="" sourceRef="catchMSOWorkflowException" targetRef="proccessBPMNError"/>
+ </bpmn2:subProcess>
+ <bpmn2:scriptTask id="toggleSuccess" name="Toggle Success Indicator" scriptFormat="groovy">
+ <bpmn2:incoming>SequenceFlow_7</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_8</bpmn2:outgoing>
<bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
GenericGetVnf genericGetVnf = new GenericGetVnf()
genericGetVnf.setSuccessIndicator(execution, true)
-]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_8" name="" sourceRef="toggleSuccess" targetRef="EndEvent_1"/>
- <bpmn2:endEvent id="EndEvent_1">
- <bpmn2:incoming>SequenceFlow_8</bpmn2:incoming>
- <bpmn2:terminateEventDefinition id="_TerminateEventDefinition_28"/>
- </bpmn2:endEvent>
- </bpmn2:process>
- <bpmn2:error id="Error_1" errorCode="MSOWorkflowException" name="MSO Workflow Exception"/>
- <bpmndi:BPMNDiagram id="BPMNDiagram_1">
- <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="GenericGetVnf">
- <bpmndi:BPMNShape id="_BPMNShape_StartEvent_71" bpmnElement="StartEvent_1">
- <dc:Bounds height="36.0" width="36.0" x="110.0" y="271.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="128.0" y="312.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_295" bpmnElement="intialization">
- <dc:Bounds height="80.0" width="100.0" x="228.0" y="249.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_230" bpmnElement="vnfIdProvided" isMarkerVisible="true">
- <dc:Bounds height="50.0" width="50.0" x="372.0" y="263.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="22.0" width="99.0" x="419.0" y="292.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="_BPMNShape_StartEvent_71" targetElement="_BPMNShape_ScriptTask_295">
- <di:waypoint xsi:type="dc:Point" x="146.0" y="289.0"/>
- <di:waypoint xsi:type="dc:Point" x="228.0" y="289.0"/>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_2" bpmnElement="SequenceFlow_2" sourceElement="_BPMNShape_ScriptTask_295" targetElement="_BPMNShape_ExclusiveGateway_230">
- <di:waypoint xsi:type="dc:Point" x="328.0" y="289.0"/>
- <di:waypoint xsi:type="dc:Point" x="372.0" y="288.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="347.0" y="288.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_296" bpmnElement="getVnfByName">
- <dc:Bounds height="80.0" width="100.0" x="456.0" y="156.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_231" bpmnElement="ExclusiveGateway_2" isMarkerVisible="true">
- <dc:Bounds height="50.0" width="50.0" x="600.0" y="263.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="625.0" y="318.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="noVnfId" sourceElement="_BPMNShape_ExclusiveGateway_230" targetElement="_BPMNShape_ScriptTask_296">
- <di:waypoint xsi:type="dc:Point" x="397.0" y="263.0"/>
- <di:waypoint xsi:type="dc:Point" x="397.0" y="196.0"/>
- <di:waypoint xsi:type="dc:Point" x="456.0" y="196.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="22.0" width="22.0" x="399.0" y="219.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_5" bpmnElement="haveVnfId" sourceElement="_BPMNShape_ExclusiveGateway_230" targetElement="_BPMNShape_ScriptTask_297">
- <di:waypoint xsi:type="dc:Point" x="397.0" y="313.0"/>
- <di:waypoint xsi:type="dc:Point" x="397.0" y="368.0"/>
- <di:waypoint xsi:type="dc:Point" x="456.0" y="368.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="22.0" width="29.0" x="396.0" y="328.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_297" bpmnElement="getGenericVnf">
- <dc:Bounds height="80.0" width="100.0" x="456.0" y="328.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_298" bpmnElement="toggleSuccess">
- <dc:Bounds height="80.0" width="100.0" x="696.0" y="249.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_EndEvent_226" bpmnElement="EndEvent_1">
- <dc:Bounds height="36.0" width="36.0" x="888.0" y="271.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="906.0" y="312.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_7" bpmnElement="SequenceFlow_7" sourceElement="_BPMNShape_ExclusiveGateway_231" targetElement="_BPMNShape_ScriptTask_298">
- <di:waypoint xsi:type="dc:Point" x="650.0" y="288.0"/>
- <di:waypoint xsi:type="dc:Point" x="696.0" y="289.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="673.0" y="289.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_8" bpmnElement="SequenceFlow_8" sourceElement="_BPMNShape_ScriptTask_298" targetElement="_BPMNShape_EndEvent_226">
- <di:waypoint xsi:type="dc:Point" x="796.0" y="289.0"/>
- <di:waypoint xsi:type="dc:Point" x="888.0" y="289.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="829.0" y="289.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_11" bpmnElement="SequenceFlow_9" sourceElement="_BPMNShape_ScriptTask_296" targetElement="_BPMNShape_ExclusiveGateway_231">
- <di:waypoint xsi:type="dc:Point" x="556.0" y="196.0"/>
- <di:waypoint xsi:type="dc:Point" x="625.0" y="196.0"/>
- <di:waypoint xsi:type="dc:Point" x="625.0" y="263.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="622.0" y="205.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_12" bpmnElement="SequenceFlow_10" sourceElement="_BPMNShape_ScriptTask_297" targetElement="_BPMNShape_ExclusiveGateway_231">
- <di:waypoint xsi:type="dc:Point" x="556.0" y="368.0"/>
- <di:waypoint xsi:type="dc:Point" x="625.0" y="368.0"/>
- <di:waypoint xsi:type="dc:Point" x="625.0" y="313.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="621.0" y="368.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_SubProcess_30" bpmnElement="bpmnExceptionHandlingSubProcess" isExpanded="true">
- <dc:Bounds height="169.0" width="313.0" x="168.0" y="468.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_StartEvent_74" bpmnElement="catchMSOWorkflowException">
- <dc:Bounds height="36.0" width="36.0" x="180.0" y="535.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="198.0" y="576.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_302" bpmnElement="proccessBPMNError">
- <dc:Bounds height="80.0" width="100.0" x="275.0" y="513.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_EndEvent_231" bpmnElement="EndEvent_3">
- <dc:Bounds height="36.0" width="36.0" x="432.0" y="535.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="450.0" y="576.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_13" bpmnElement="SequenceFlow_11" sourceElement="_BPMNShape_StartEvent_74" targetElement="_BPMNShape_ScriptTask_302">
- <di:waypoint xsi:type="dc:Point" x="216.0" y="553.0"/>
- <di:waypoint xsi:type="dc:Point" x="275.0" y="553.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="238.0" y="553.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_14" bpmnElement="SequenceFlow_12" sourceElement="_BPMNShape_ScriptTask_302" targetElement="_BPMNShape_EndEvent_231">
- <di:waypoint xsi:type="dc:Point" x="375.0" y="553.0"/>
- <di:waypoint xsi:type="dc:Point" x="432.0" y="553.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="402.0" y="553.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- </bpmndi:BPMNPlane>
- </bpmndi:BPMNDiagram>
+]]></bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_8" name="" sourceRef="toggleSuccess" targetRef="EndEvent_1"/>
+ <bpmn2:endEvent id="EndEvent_1">
+ <bpmn2:incoming>SequenceFlow_8</bpmn2:incoming>
+ <bpmn2:terminateEventDefinition id="_TerminateEventDefinition_28"/>
+ </bpmn2:endEvent>
+ </bpmn2:process>
+ <bpmn2:error id="Error_1" errorCode="MSOWorkflowException" name="MSO Workflow Exception"/>
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="GenericGetVnf">
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_71" bpmnElement="StartEvent_1">
+ <dc:Bounds height="36.0" width="36.0" x="110.0" y="271.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="0.0" width="0.0" x="128.0" y="312.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_295" bpmnElement="intialization">
+ <dc:Bounds height="80.0" width="100.0" x="228.0" y="249.0"/>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_230" bpmnElement="vnfIdProvided" isMarkerVisible="true">
+ <dc:Bounds height="50.0" width="50.0" x="372.0" y="263.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="22.0" width="99.0" x="419.0" y="292.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="_BPMNShape_StartEvent_71" targetElement="_BPMNShape_ScriptTask_295">
+ <di:waypoint xsi:type="dc:Point" x="146.0" y="289.0"/>
+ <di:waypoint xsi:type="dc:Point" x="228.0" y="289.0"/>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_2" bpmnElement="SequenceFlow_2" sourceElement="_BPMNShape_ScriptTask_295" targetElement="_BPMNShape_ExclusiveGateway_230">
+ <di:waypoint xsi:type="dc:Point" x="328.0" y="289.0"/>
+ <di:waypoint xsi:type="dc:Point" x="372.0" y="288.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="6.0" width="6.0" x="347.0" y="288.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_296" bpmnElement="getVnfByName">
+ <dc:Bounds height="80.0" width="100.0" x="456.0" y="156.0"/>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_231" bpmnElement="ExclusiveGateway_2" isMarkerVisible="true">
+ <dc:Bounds height="50.0" width="50.0" x="600.0" y="263.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="0.0" width="0.0" x="625.0" y="318.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="noVnfId" sourceElement="_BPMNShape_ExclusiveGateway_230" targetElement="_BPMNShape_ScriptTask_296">
+ <di:waypoint xsi:type="dc:Point" x="397.0" y="263.0"/>
+ <di:waypoint xsi:type="dc:Point" x="397.0" y="196.0"/>
+ <di:waypoint xsi:type="dc:Point" x="456.0" y="196.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="22.0" width="22.0" x="399.0" y="219.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_5" bpmnElement="haveVnfId" sourceElement="_BPMNShape_ExclusiveGateway_230" targetElement="_BPMNShape_ScriptTask_297">
+ <di:waypoint xsi:type="dc:Point" x="397.0" y="313.0"/>
+ <di:waypoint xsi:type="dc:Point" x="397.0" y="368.0"/>
+ <di:waypoint xsi:type="dc:Point" x="456.0" y="368.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="22.0" width="29.0" x="396.0" y="328.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_297" bpmnElement="getGenericVnf">
+ <dc:Bounds height="80.0" width="100.0" x="456.0" y="328.0"/>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_298" bpmnElement="toggleSuccess">
+ <dc:Bounds height="80.0" width="100.0" x="696.0" y="249.0"/>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_EndEvent_226" bpmnElement="EndEvent_1">
+ <dc:Bounds height="36.0" width="36.0" x="888.0" y="271.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="0.0" width="0.0" x="906.0" y="312.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_7" bpmnElement="SequenceFlow_7" sourceElement="_BPMNShape_ExclusiveGateway_231" targetElement="_BPMNShape_ScriptTask_298">
+ <di:waypoint xsi:type="dc:Point" x="650.0" y="288.0"/>
+ <di:waypoint xsi:type="dc:Point" x="696.0" y="289.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="6.0" width="6.0" x="673.0" y="289.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_8" bpmnElement="SequenceFlow_8" sourceElement="_BPMNShape_ScriptTask_298" targetElement="_BPMNShape_EndEvent_226">
+ <di:waypoint xsi:type="dc:Point" x="796.0" y="289.0"/>
+ <di:waypoint xsi:type="dc:Point" x="888.0" y="289.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="6.0" width="6.0" x="829.0" y="289.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_11" bpmnElement="SequenceFlow_9" sourceElement="_BPMNShape_ScriptTask_296" targetElement="_BPMNShape_ExclusiveGateway_231">
+ <di:waypoint xsi:type="dc:Point" x="556.0" y="196.0"/>
+ <di:waypoint xsi:type="dc:Point" x="625.0" y="196.0"/>
+ <di:waypoint xsi:type="dc:Point" x="625.0" y="263.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="6.0" width="6.0" x="622.0" y="205.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_12" bpmnElement="SequenceFlow_10" sourceElement="_BPMNShape_ScriptTask_297" targetElement="_BPMNShape_ExclusiveGateway_231">
+ <di:waypoint xsi:type="dc:Point" x="556.0" y="368.0"/>
+ <di:waypoint xsi:type="dc:Point" x="625.0" y="368.0"/>
+ <di:waypoint xsi:type="dc:Point" x="625.0" y="313.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="6.0" width="6.0" x="621.0" y="368.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_SubProcess_30" bpmnElement="bpmnExceptionHandlingSubProcess" isExpanded="true">
+ <dc:Bounds height="169.0" width="313.0" x="168.0" y="468.0"/>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_74" bpmnElement="catchMSOWorkflowException">
+ <dc:Bounds height="36.0" width="36.0" x="180.0" y="535.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="0.0" width="0.0" x="198.0" y="576.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_302" bpmnElement="proccessBPMNError">
+ <dc:Bounds height="80.0" width="100.0" x="275.0" y="513.0"/>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_EndEvent_231" bpmnElement="EndEvent_3">
+ <dc:Bounds height="36.0" width="36.0" x="432.0" y="535.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="0.0" width="0.0" x="450.0" y="576.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_13" bpmnElement="SequenceFlow_11" sourceElement="_BPMNShape_StartEvent_74" targetElement="_BPMNShape_ScriptTask_302">
+ <di:waypoint xsi:type="dc:Point" x="216.0" y="553.0"/>
+ <di:waypoint xsi:type="dc:Point" x="275.0" y="553.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="6.0" width="6.0" x="238.0" y="553.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_14" bpmnElement="SequenceFlow_12" sourceElement="_BPMNShape_ScriptTask_302" targetElement="_BPMNShape_EndEvent_231">
+ <di:waypoint xsi:type="dc:Point" x="375.0" y="553.0"/>
+ <di:waypoint xsi:type="dc:Point" x="432.0" y="553.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="6.0" width="6.0" x="402.0" y="553.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
</bpmn2:definitions> \ No newline at end of file
diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericNotificationService.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericNotificationService.bpmn
new file mode 100644
index 0000000000..23351eb1b1
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericNotificationService.bpmn
@@ -0,0 +1,48 @@
+<?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" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.6.0">
+ <bpmn:process id="GenericNotificationService" name="GenericNotificationService" isExecutable="true">
+ <bpmn:startEvent id="StartEvent_1">
+ <bpmn:outgoing>SequenceFlow_0zigcpk</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:endEvent id="EndEvent_0u9cxx7">
+ <bpmn:incoming>SequenceFlow_1122k97</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_0zigcpk" sourceRef="StartEvent_1" targetRef="Task_1tj48xt" />
+ <bpmn:scriptTask id="Task_1tj48xt" name="Pre Processs" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0zigcpk</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1122k97</bpmn:outgoing>
+ <bpmn:script><![CDATA[println "INSIDE --> GenericNotificationService Process"]]></bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_1122k97" sourceRef="Task_1tj48xt" targetRef="EndEvent_0u9cxx7" />
+ </bpmn:process>
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="GenericNotificationService">
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
+ <dc:Bounds x="173" y="102" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_0u9cxx7_di" bpmnElement="EndEvent_0u9cxx7">
+ <dc:Bounds x="483" y="102" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="501" y="138" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0zigcpk_di" bpmnElement="SequenceFlow_0zigcpk">
+ <di:waypoint xsi:type="dc:Point" x="209" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="300" y="120" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="255" y="105" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_1dhe9cw_di" bpmnElement="Task_1tj48xt">
+ <dc:Bounds x="300" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1122k97_di" bpmnElement="SequenceFlow_1122k97">
+ <di:waypoint xsi:type="dc:Point" x="400" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="483" y="120" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="442" y="105" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericPutService.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericPutService.bpmn
index 8c8412dcac..ca03a9560c 100644
--- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericPutService.bpmn
+++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericPutService.bpmn
@@ -1,201 +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" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd" id="_FatVcHn0EeaH6vX1RRdc_w" exporter="camunda modeler" exporterVersion="2.7.0" targetNamespace="http://camunda.org/schema/1.0/bpmn">
- <bpmn2:process id="GenericPutService" name="GenericPutService" 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 GenericPutService()
-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 GenericPutService()
-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 GenericPutService()
-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.processSubflowsJavaException(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" errorCode="MSOWorkflowException" name="MSO Workflow Exception"/>
- <bpmn2:error id="Error_2" errorCode="java.lang.Exception" name="Java Lang Exception"/>
- <bpmndi:BPMNDiagram id="BPMNDiagram_1">
- <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="GenericPutService">
- <bpmndi:BPMNShape id="_BPMNShape_StartEvent_71" bpmnElement="StartEvent_1">
- <dc:Bounds height="36.0" width="36.0" x="182.0" y="180.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="200.0" y="221.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_302" bpmnElement="Initialization">
- <dc:Bounds height="80.0" width="100.0" x="324.0" y="158.0"/>
- </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.0" y="198.0"/>
- <di:waypoint xsi:type="dc:Point" x="324.0" y="198.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="250.0" y="198.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_304" bpmnElement="putServiceInstance">
- <dc:Bounds height="80.0" width="100.0" x="528.0" y="158.0"/>
- </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.0" y="198.0"/>
- <di:waypoint xsi:type="dc:Point" x="528.0" y="198.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="446.0" y="198.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_305" bpmnElement="toggleSuccess">
- <dc:Bounds height="80.0" width="100.0" x="732.0" y="158.0"/>
- </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.0" y="198.0"/>
- <di:waypoint xsi:type="dc:Point" x="732.0" y="198.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="650.0" y="198.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_EndEvent_230" bpmnElement="EndEvent_1">
- <dc:Bounds height="36.0" width="36.0" x="908.0" y="180.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="926.0" y="221.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.0" y="198.0"/>
- <di:waypoint xsi:type="dc:Point" x="908.0" y="198.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="854.0" y="198.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_SubProcess_27" bpmnElement="bpmnExceptionHandlingSubProcess" isExpanded="true">
- <dc:Bounds height="150.0" width="418.0" x="324.0" y="312.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_StartEvent_72" bpmnElement="StartEvent_2">
- <dc:Bounds height="36.0" width="36.0" x="357.0" y="370.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="375.0" y="411.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_306" bpmnElement="processError">
- <dc:Bounds height="80.0" width="100.0" x="466.0" y="348.0"/>
- </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.0" y="388.0"/>
- <di:waypoint xsi:type="dc:Point" x="466.0" y="388.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="415.0" y="388.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_EndEvent_231" bpmnElement="EndEvent_2">
- <dc:Bounds height="36.0" width="36.0" x="615.0" y="370.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="633.0" y="411.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.0" y="388.0"/>
- <di:waypoint xsi:type="dc:Point" x="615.0" y="388.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="588.0" y="388.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_SubProcess_28" bpmnElement="javaExceptionSubProcess" isExpanded="true">
- <dc:Bounds height="150.0" width="419.0" x="323.0" y="486.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_StartEvent_73" bpmnElement="catchJavaExcep">
- <dc:Bounds height="36.0" width="36.0" x="357.0" y="538.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="375.0" y="579.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_308" bpmnElement="processJavaError">
- <dc:Bounds height="80.0" width="100.0" x="465.0" y="516.0"/>
- </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.0" y="556.0"/>
- <di:waypoint xsi:type="dc:Point" x="465.0" y="556.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="415.0" y="556.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_EndEvent_232" bpmnElement="EndEvent_3">
- <dc:Bounds height="36.0" width="36.0" x="615.0" y="538.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="633.0" y="579.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.0" y="556.0"/>
- <di:waypoint xsi:type="dc:Point" x="615.0" y="556.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="587.0" y="556.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- </bpmndi:BPMNPlane>
- </bpmndi:BPMNDiagram>
-</bpmn2:definitions> \ No newline at end of file
+<?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.4.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
+ <bpmn2:process id="GenericPutService" name="GenericPutService" 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 GenericPutService()
+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 GenericPutService()
+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 GenericPutService()
+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="GenericPutService">
+ <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/MSOCommonBPMN/src/main/resources/subprocess/GenericPutVnf.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericPutVnf.bpmn
index bb73c09619..f155783e3a 100644
--- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericPutVnf.bpmn
+++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericPutVnf.bpmn
@@ -1,135 +1,135 @@
-<?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" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd" id="_ZkRI4HntEea26OhQB97uCQ" exporter="camunda modeler" exporterVersion="2.7.0" targetNamespace="http://camunda.org/schema/1.0/bpmn">
- <bpmn2:process id="GenericPutVnf" name="GenericPutVnf" isExecutable="true">
- <bpmn2:startEvent id="StartEvent_1">
- <bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing>
- </bpmn2:startEvent>
- <bpmn2:scriptTask id="intialization" name="Intialization" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_2</bpmn2:outgoing>
+<?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" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd" id="_ZkRI4HntEea26OhQB97uCQ" exporter="camunda modeler" exporterVersion="2.7.0" targetNamespace="http://camunda.org/schema/1.0/bpmn">
+ <bpmn2:process id="GenericPutVnf" name="GenericPutVnf" isExecutable="true">
+ <bpmn2:startEvent id="StartEvent_1">
+ <bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing>
+ </bpmn2:startEvent>
+ <bpmn2:scriptTask id="intialization" name="Intialization" scriptFormat="groovy">
+ <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_2</bpmn2:outgoing>
<bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
GenericPutVnf genericPutVnf = new GenericPutVnf()
-genericPutVnf.preProcessRequest(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_1" name="" sourceRef="StartEvent_1" targetRef="intialization"/>
- <bpmn2:sequenceFlow id="SequenceFlow_2" name="" sourceRef="intialization" targetRef="putVnf"/>
- <bpmn2:subProcess id="processBPMNExceptionSubProcess" name="Error Handling Sub Process" triggeredByEvent="true">
- <bpmn2:endEvent id="EndEvent_2">
- <bpmn2:incoming>SequenceFlow_6</bpmn2:incoming>
- <bpmn2:terminateEventDefinition id="_TerminateEventDefinition_43"/>
- </bpmn2:endEvent>
- <bpmn2:startEvent id="StartEvent_2">
- <bpmn2:outgoing>SequenceFlow_5</bpmn2:outgoing>
- <bpmn2:errorEventDefinition id="_ErrorEventDefinition_96"/>
- </bpmn2:startEvent>
- <bpmn2:scriptTask id="processBPMNException" name="Process Error" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_5</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_6</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_5" name="" sourceRef="StartEvent_2" targetRef="processBPMNException"/>
- <bpmn2:sequenceFlow id="SequenceFlow_6" name="" sourceRef="processBPMNException" targetRef="EndEvent_2"/>
- </bpmn2:subProcess>
- <bpmn2:scriptTask id="putVnf" name="PUT Vnf" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_2</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_3</bpmn2:outgoing>
+genericPutVnf.preProcessRequest(execution)]]></bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_1" name="" sourceRef="StartEvent_1" targetRef="intialization"/>
+ <bpmn2:sequenceFlow id="SequenceFlow_2" name="" sourceRef="intialization" targetRef="putVnf"/>
+ <bpmn2:subProcess id="processBPMNExceptionSubProcess" name="Error Handling Sub Process" triggeredByEvent="true">
+ <bpmn2:endEvent id="EndEvent_2">
+ <bpmn2:incoming>SequenceFlow_6</bpmn2:incoming>
+ <bpmn2:terminateEventDefinition id="_TerminateEventDefinition_43"/>
+ </bpmn2:endEvent>
+ <bpmn2:startEvent id="StartEvent_2">
+ <bpmn2:outgoing>SequenceFlow_5</bpmn2:outgoing>
+ <bpmn2:errorEventDefinition id="_ErrorEventDefinition_96"/>
+ </bpmn2:startEvent>
+ <bpmn2:scriptTask id="processBPMNException" name="Process Error" scriptFormat="groovy">
+ <bpmn2:incoming>SequenceFlow_5</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_6</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_5" name="" sourceRef="StartEvent_2" targetRef="processBPMNException"/>
+ <bpmn2:sequenceFlow id="SequenceFlow_6" name="" sourceRef="processBPMNException" targetRef="EndEvent_2"/>
+ </bpmn2:subProcess>
+ <bpmn2:scriptTask id="putVnf" name="PUT Vnf" scriptFormat="groovy">
+ <bpmn2:incoming>SequenceFlow_2</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_3</bpmn2:outgoing>
<bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
GenericPutVnf genericPutVnf = new GenericPutVnf()
-genericPutVnf.putVnf(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_3" name="" sourceRef="putVnf" targetRef="toggleSuccess"/>
- <bpmn2:scriptTask id="toggleSuccess" name="Toggle Success Indicator" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_3</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_4</bpmn2:outgoing>
+genericPutVnf.putVnf(execution)]]></bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_3" name="" sourceRef="putVnf" targetRef="toggleSuccess"/>
+ <bpmn2:scriptTask id="toggleSuccess" name="Toggle Success Indicator" scriptFormat="groovy">
+ <bpmn2:incoming>SequenceFlow_3</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_4</bpmn2:outgoing>
<bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
GenericPutVnf genericPutVnf = new GenericPutVnf()
genericPutVnf.setSuccessIndicator(execution, true)
-execution.setVariable("WorkflowResponse", " ") //for junits]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_4" name="" sourceRef="toggleSuccess" targetRef="EndEvent_1"/>
- <bpmn2:endEvent id="EndEvent_1">
- <bpmn2:incoming>SequenceFlow_4</bpmn2:incoming>
- <bpmn2:terminateEventDefinition id="_TerminateEventDefinition_42"/>
- </bpmn2:endEvent>
- </bpmn2:process>
- <bpmndi:BPMNDiagram id="BPMNDiagram_1">
- <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="GenericPutVnf">
- <bpmndi:BPMNShape id="_BPMNShape_StartEvent_75" bpmnElement="StartEvent_1">
- <dc:Bounds height="36.0" width="36.0" x="116.0" y="233.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="134.0" y="274.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_305" bpmnElement="intialization">
- <dc:Bounds height="80.0" width="100.0" x="240.0" y="211.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_306" bpmnElement="putVnf">
- <dc:Bounds height="80.0" width="100.0" x="384.0" y="211.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_307" bpmnElement="toggleSuccess">
- <dc:Bounds height="80.0" width="100.0" x="528.0" y="211.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_EndEvent_233" bpmnElement="EndEvent_1">
- <dc:Bounds height="36.0" width="36.0" x="732.0" y="233.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="750.0" y="274.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="_BPMNShape_StartEvent_75" targetElement="_BPMNShape_ScriptTask_305">
- <di:waypoint xsi:type="dc:Point" x="152.0" y="251.0"/>
- <di:waypoint xsi:type="dc:Point" x="240.0" y="251.0"/>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_2" bpmnElement="SequenceFlow_2" sourceElement="_BPMNShape_ScriptTask_305" targetElement="_BPMNShape_ScriptTask_306">
- <di:waypoint xsi:type="dc:Point" x="340.0" y="251.0"/>
- <di:waypoint xsi:type="dc:Point" x="384.0" y="251.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="365.0" y="251.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="SequenceFlow_3" sourceElement="_BPMNShape_ScriptTask_306" targetElement="_BPMNShape_ScriptTask_307">
- <di:waypoint xsi:type="dc:Point" x="484.0" y="251.0"/>
- <di:waypoint xsi:type="dc:Point" x="528.0" y="251.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="513.0" y="251.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_4" bpmnElement="SequenceFlow_4" sourceElement="_BPMNShape_ScriptTask_307" targetElement="_BPMNShape_EndEvent_233">
- <di:waypoint xsi:type="dc:Point" x="628.0" y="251.0"/>
- <di:waypoint xsi:type="dc:Point" x="732.0" y="251.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="678.0" y="251.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_SubProcess_31" bpmnElement="processBPMNExceptionSubProcess" isExpanded="true">
- <dc:Bounds height="169.0" width="322.0" x="174.0" y="396.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_StartEvent_83" bpmnElement="StartEvent_2">
- <dc:Bounds height="36.0" width="36.0" x="204.0" y="463.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="222.0" y="504.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_EndEvent_244" bpmnElement="EndEvent_2">
- <dc:Bounds height="36.0" width="36.0" x="432.0" y="463.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="450.0" y="504.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_324" bpmnElement="processBPMNException">
- <dc:Bounds height="80.0" width="100.0" x="286.0" y="441.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_5" bpmnElement="SequenceFlow_5" sourceElement="_BPMNShape_StartEvent_83" targetElement="_BPMNShape_ScriptTask_324">
- <di:waypoint xsi:type="dc:Point" x="240.0" y="481.0"/>
- <di:waypoint xsi:type="dc:Point" x="286.0" y="481.0"/>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_6" bpmnElement="SequenceFlow_6" sourceElement="_BPMNShape_ScriptTask_324" targetElement="_BPMNShape_EndEvent_244">
- <di:waypoint xsi:type="dc:Point" x="386.0" y="481.0"/>
- <di:waypoint xsi:type="dc:Point" x="432.0" y="481.0"/>
- </bpmndi:BPMNEdge>
- </bpmndi:BPMNPlane>
- </bpmndi:BPMNDiagram>
+execution.setVariable("WorkflowResponse", " ") //for junits]]></bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_4" name="" sourceRef="toggleSuccess" targetRef="EndEvent_1"/>
+ <bpmn2:endEvent id="EndEvent_1">
+ <bpmn2:incoming>SequenceFlow_4</bpmn2:incoming>
+ <bpmn2:terminateEventDefinition id="_TerminateEventDefinition_42"/>
+ </bpmn2:endEvent>
+ </bpmn2:process>
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="GenericPutVnf">
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_75" bpmnElement="StartEvent_1">
+ <dc:Bounds height="36.0" width="36.0" x="116.0" y="233.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="0.0" width="0.0" x="134.0" y="274.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_305" bpmnElement="intialization">
+ <dc:Bounds height="80.0" width="100.0" x="240.0" y="211.0"/>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_306" bpmnElement="putVnf">
+ <dc:Bounds height="80.0" width="100.0" x="384.0" y="211.0"/>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_307" bpmnElement="toggleSuccess">
+ <dc:Bounds height="80.0" width="100.0" x="528.0" y="211.0"/>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_EndEvent_233" bpmnElement="EndEvent_1">
+ <dc:Bounds height="36.0" width="36.0" x="732.0" y="233.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="0.0" width="0.0" x="750.0" y="274.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="_BPMNShape_StartEvent_75" targetElement="_BPMNShape_ScriptTask_305">
+ <di:waypoint xsi:type="dc:Point" x="152.0" y="251.0"/>
+ <di:waypoint xsi:type="dc:Point" x="240.0" y="251.0"/>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_2" bpmnElement="SequenceFlow_2" sourceElement="_BPMNShape_ScriptTask_305" targetElement="_BPMNShape_ScriptTask_306">
+ <di:waypoint xsi:type="dc:Point" x="340.0" y="251.0"/>
+ <di:waypoint xsi:type="dc:Point" x="384.0" y="251.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="6.0" width="6.0" x="365.0" y="251.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="SequenceFlow_3" sourceElement="_BPMNShape_ScriptTask_306" targetElement="_BPMNShape_ScriptTask_307">
+ <di:waypoint xsi:type="dc:Point" x="484.0" y="251.0"/>
+ <di:waypoint xsi:type="dc:Point" x="528.0" y="251.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="6.0" width="6.0" x="513.0" y="251.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_4" bpmnElement="SequenceFlow_4" sourceElement="_BPMNShape_ScriptTask_307" targetElement="_BPMNShape_EndEvent_233">
+ <di:waypoint xsi:type="dc:Point" x="628.0" y="251.0"/>
+ <di:waypoint xsi:type="dc:Point" x="732.0" y="251.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="6.0" width="6.0" x="678.0" y="251.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_SubProcess_31" bpmnElement="processBPMNExceptionSubProcess" isExpanded="true">
+ <dc:Bounds height="169.0" width="322.0" x="174.0" y="396.0"/>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_83" bpmnElement="StartEvent_2">
+ <dc:Bounds height="36.0" width="36.0" x="204.0" y="463.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="0.0" width="0.0" x="222.0" y="504.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_EndEvent_244" bpmnElement="EndEvent_2">
+ <dc:Bounds height="36.0" width="36.0" x="432.0" y="463.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="0.0" width="0.0" x="450.0" y="504.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_324" bpmnElement="processBPMNException">
+ <dc:Bounds height="80.0" width="100.0" x="286.0" y="441.0"/>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_5" bpmnElement="SequenceFlow_5" sourceElement="_BPMNShape_StartEvent_83" targetElement="_BPMNShape_ScriptTask_324">
+ <di:waypoint xsi:type="dc:Point" x="240.0" y="481.0"/>
+ <di:waypoint xsi:type="dc:Point" x="286.0" y="481.0"/>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_6" bpmnElement="SequenceFlow_6" sourceElement="_BPMNShape_ScriptTask_324" targetElement="_BPMNShape_EndEvent_244">
+ <di:waypoint xsi:type="dc:Point" x="386.0" y="481.0"/>
+ <di:waypoint xsi:type="dc:Point" x="432.0" y="481.0"/>
+ </bpmndi:BPMNEdge>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
</bpmn2:definitions> \ No newline at end of file
diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/SDNCAdapterRestV1.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/SDNCAdapterRestV1.bpmn
new file mode 100644
index 0000000000..c52612bb95
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/SDNCAdapterRestV1.bpmn
@@ -0,0 +1,470 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_GraPIIyxEeWmdMDkx6Uftw" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
+ <bpmn2:process id="SDNCAdapterRestV1" name="SDNCAdapterRestV1" isExecutable="true">
+ <bpmn2:scriptTask id="ScriptTask_2" name="Log Response" scriptFormat="groovy">
+ <bpmn2:incoming>SequenceFlow_3</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_14</bpmn2:outgoing>
+ <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
+def sdncAdapterRestV1 = new SDNCAdapterRestV1()
+def statusCode = execution.getVariable('SDNCREST_sdncAdapterStatusCode')
+String response = String.valueOf(execution.getVariable('SDNCREST_sdncAdapterResponse'))
+def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+def processKey = sdncAdapterRestV1.getProcessKey(execution)
+sdncAdapterRestV1.logDebug(processKey + " received response from SDNCAdapter: statusCode=" + statusCode +
+ " response=" + (response.isEmpty() ? "" : "\n") + response, isDebugLogEnabled)]]></bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:scriptTask id="ScriptTask_3" name="Workflow Exception (no connection)" scriptFormat="groovy">
+ <bpmn2:incoming>SequenceFlow_17</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_35</bpmn2:outgoing>
+ <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
+def exceptionUtil = new ExceptionUtil()
+exceptionUtil.buildWorkflowException(execution, 5300, "Failed to communicate with SDNCAdapter")]]></bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:scriptTask id="ScriptTask_4" name="Workflow Exception (bad response)" scriptFormat="groovy">
+ <bpmn2:incoming>SequenceFlow_23</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_36</bpmn2:outgoing>
+ <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
+
+String res = execution.getVariable('SDNCREST_sdncAdapterResponse')
+
+def sdncAdapterRestV1 = new SDNCAdapterRestV1()
+sdncAdapterRestV1.sdncAdapterBuildWorkflowException(execution, res)]]></bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_14" name="" sourceRef="ScriptTask_2" targetRef="ExclusiveGateway_1" />
+ <bpmn2:exclusiveGateway id="ExclusiveGateway_1" default="SequenceFlow_23">
+ <bpmn2:incoming>SequenceFlow_14</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_17</bpmn2:outgoing>
+ <bpmn2:outgoing>SequenceFlow_23</bpmn2:outgoing>
+ <bpmn2:outgoing>SequenceFlow_24</bpmn2:outgoing>
+ </bpmn2:exclusiveGateway>
+ <bpmn2:sequenceFlow id="SequenceFlow_17" name="404" sourceRef="ExclusiveGateway_1" targetRef="ScriptTask_3">
+ <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("SDNCREST_sdncAdapterStatusCode") == '404'}]]></bpmn2:conditionExpression>
+ </bpmn2:sequenceFlow>
+ <bpmn2:sequenceFlow id="SequenceFlow_23" name="other" sourceRef="ExclusiveGateway_1" targetRef="ScriptTask_4" />
+ <bpmn2:sequenceFlow id="SequenceFlow_24" name="2xx" sourceRef="ExclusiveGateway_1" targetRef="SubProcess_2">
+ <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("SDNCREST_sdncAdapterStatusCode") == '200' || execution.getVariable("SDNCREST_sdncAdapterStatusCode") == '202'}]]></bpmn2:conditionExpression>
+ </bpmn2:sequenceFlow>
+ <bpmn2:sequenceFlow id="SequenceFlow_35" name="" sourceRef="ScriptTask_3" targetRef="EndEvent_9" />
+ <bpmn2:endEvent id="EndEvent_9">
+ <bpmn2:incoming>SequenceFlow_35</bpmn2:incoming>
+ <bpmn2:errorEventDefinition id="_ErrorEventDefinition_22" errorRef="Error_1" />
+ </bpmn2:endEvent>
+ <bpmn2:endEvent id="EndEvent_10">
+ <bpmn2:incoming>SequenceFlow_36</bpmn2:incoming>
+ <bpmn2:errorEventDefinition id="_ErrorEventDefinition_23" errorRef="Error_1" />
+ </bpmn2:endEvent>
+ <bpmn2:sequenceFlow id="SequenceFlow_36" name="" sourceRef="ScriptTask_4" targetRef="EndEvent_10" />
+ <bpmn2:scriptTask id="ScriptTask_7" name="Send Request to SDNC Adapter" scriptFormat="groovy">
+ <bpmn2:incoming>SequenceFlow_2</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_3</bpmn2:outgoing>
+ <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
+def sdncAdapterRestV1 = new SDNCAdapterRestV1()
+sdncAdapterRestV1.sendRequestToSDNCAdapter(execution)]]></bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_3" name="" sourceRef="ScriptTask_7" targetRef="ScriptTask_2" />
+ <bpmn2:scriptTask id="ScriptTask_1" name="Pre-Process Request" scriptFormat="groovy">
+ <bpmn2:incoming>SequenceFlow_9</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_2</bpmn2:outgoing>
+ <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
+def sdncAdapterRestV1 = new SDNCAdapterRestV1()
+sdncAdapterRestV1.preProcessRequest(execution)
+]]></bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_2" name="" sourceRef="ScriptTask_1" targetRef="ScriptTask_7" />
+ <bpmn2:startEvent id="StartEvent_1" name="Start">
+ <bpmn2:outgoing>SequenceFlow_9</bpmn2:outgoing>
+ </bpmn2:startEvent>
+ <bpmn2:sequenceFlow id="SequenceFlow_9" name="" sourceRef="StartEvent_1" targetRef="ScriptTask_1" />
+ <bpmn2:scriptTask id="ScriptTask_5" name="Workflow Exception (timeout)" scriptFormat="groovy">
+ <bpmn2:incoming>SequenceFlow_27</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_34</bpmn2:outgoing>
+ <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
+def exceptionUtil = new ExceptionUtil()
+exceptionUtil.buildWorkflowException(execution, 5320, "SDNCAdapter Callback Timeout Error")]]></bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_34" name="" sourceRef="ScriptTask_5" targetRef="EndEvent_8" />
+ <bpmn2:endEvent id="EndEvent_8">
+ <bpmn2:incoming>SequenceFlow_34</bpmn2:incoming>
+ <bpmn2:errorEventDefinition id="_ErrorEventDefinition_21" errorRef="Error_1" />
+ </bpmn2:endEvent>
+ <bpmn2:scriptTask id="ScriptTask_setSuccess" name="Set Success Indicator and WorkflowResponse" scriptFormat="groovy">
+ <bpmn2:incoming>SequenceFlow_44</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing>
+ <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
+def sdncAdapterRestV1 = new SDNCAdapterRestV1()
+sdncAdapterRestV1.setSuccessIndicator(execution, true)
+execution.setVariable('WorkflowResponse', sdncAdapterRestV1.getLastCallback(execution))]]></bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_1" name="" sourceRef="ScriptTask_setSuccess" targetRef="EndEvent_6" />
+ <bpmn2:endEvent id="EndEvent_6" name="End">
+ <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming>
+ </bpmn2:endEvent>
+ <bpmn2:boundaryEvent id="BoundaryEvent_1" name="Timeout" attachedToRef="SubProcess_2">
+ <bpmn2:outgoing>SequenceFlow_27</bpmn2:outgoing>
+ <bpmn2:timerEventDefinition id="TimerEventDefinition_1">
+ <bpmn2:timeDuration xsi:type="bpmn2:tFormalExpression">${SDNCREST_timeout}</bpmn2:timeDuration>
+ </bpmn2:timerEventDefinition>
+ </bpmn2:boundaryEvent>
+ <bpmn2:sequenceFlow id="SequenceFlow_27" name="" sourceRef="BoundaryEvent_1" targetRef="ScriptTask_5" />
+ <bpmn2:subProcess id="SubProcess_2" name="Wait for Callbacks">
+ <bpmn2:incoming>SequenceFlow_24</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_44</bpmn2:outgoing>
+ <bpmn2:scriptTask id="ScriptTask_6" name="Process Callback" scriptFormat="groovy">
+ <bpmn2:incoming>SequenceFlow_41</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_42</bpmn2:outgoing>
+ <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
+def sdncAdapterRestV1 = new SDNCAdapterRestV1()
+sdncAdapterRestV1.processCallback(execution)]]></bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_42" name="" sourceRef="ScriptTask_6" targetRef="ExclusiveGateway_3" />
+ <bpmn2:startEvent id="StartEvent_3">
+ <bpmn2:outgoing>SequenceFlow_25</bpmn2:outgoing>
+ </bpmn2:startEvent>
+ <bpmn2:sequenceFlow id="SequenceFlow_25" name="" sourceRef="StartEvent_3" targetRef="IntermediateCatchEvent_1" />
+ <bpmn2:exclusiveGateway id="ExclusiveGateway_7" name="ack-final-indicator" default="SequenceFlow_43">
+ <bpmn2:incoming>SequenceFlow_30</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_39</bpmn2:outgoing>
+ <bpmn2:outgoing>SequenceFlow_43</bpmn2:outgoing>
+ </bpmn2:exclusiveGateway>
+ <bpmn2:sequenceFlow id="SequenceFlow_39" name="Y" sourceRef="ExclusiveGateway_7" targetRef="EndEvent_12">
+ <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable('SDNCREST_ackFinalIndicator')=="Y"}]]></bpmn2:conditionExpression>
+ </bpmn2:sequenceFlow>
+ <bpmn2:sequenceFlow id="SequenceFlow_43" name="N" sourceRef="ExclusiveGateway_7" targetRef="IntermediateCatchEvent_1" />
+ <bpmn2:exclusiveGateway id="ExclusiveGateway_3" name="Callback &#10;Exception?" default="SequenceFlow_30">
+ <bpmn2:incoming>SequenceFlow_42</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_8</bpmn2:outgoing>
+ <bpmn2:outgoing>SequenceFlow_30</bpmn2:outgoing>
+ </bpmn2:exclusiveGateway>
+ <bpmn2:sequenceFlow id="SequenceFlow_8" name="yes" sourceRef="ExclusiveGateway_3" targetRef="EndEvent_3">
+ <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("WorkflowException") != null}]]></bpmn2:conditionExpression>
+ </bpmn2:sequenceFlow>
+ <bpmn2:sequenceFlow id="SequenceFlow_30" name="no" sourceRef="ExclusiveGateway_3" targetRef="ExclusiveGateway_7" />
+ <bpmn2:intermediateCatchEvent id="IntermediateCatchEvent_1" name="Catch Event">
+ <bpmn2:incoming>SequenceFlow_25</bpmn2:incoming>
+ <bpmn2:incoming>SequenceFlow_43</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_41</bpmn2:outgoing>
+ <bpmn2:messageEventDefinition id="MessageEventDefinition_1" messageRef="Message_1" />
+ </bpmn2:intermediateCatchEvent>
+ <bpmn2:sequenceFlow id="SequenceFlow_41" name="" sourceRef="IntermediateCatchEvent_1" targetRef="ScriptTask_6" />
+ <bpmn2:endEvent id="EndEvent_12">
+ <bpmn2:incoming>SequenceFlow_39</bpmn2:incoming>
+ </bpmn2:endEvent>
+ <bpmn2:endEvent id="EndEvent_3">
+ <bpmn2:incoming>SequenceFlow_8</bpmn2:incoming>
+ <bpmn2:errorEventDefinition id="_ErrorEventDefinition_90" errorRef="Error_1" />
+ </bpmn2:endEvent>
+ </bpmn2:subProcess>
+ <bpmn2:sequenceFlow id="SequenceFlow_44" name="" sourceRef="SubProcess_2" targetRef="ScriptTask_setSuccess" />
+ <bpmn2:subProcess id="SubProcess_1" name="Error Handling Sub Process" triggeredByEvent="true">
+ <bpmn2:startEvent id="StartEvent_2">
+ <bpmn2:outgoing>SequenceFlow_4</bpmn2:outgoing>
+ <bpmn2:errorEventDefinition id="_ErrorEventDefinition_89" />
+ </bpmn2:startEvent>
+ <bpmn2:sequenceFlow id="SequenceFlow_4" name="" sourceRef="StartEvent_2" targetRef="ScriptTask_8" />
+ <bpmn2:scriptTask id="ScriptTask_8" name="Process Error" scriptFormat="groovy">
+ <bpmn2:incoming>SequenceFlow_4</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_11</bpmn2:outgoing>
+ <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
+def exUtil = new ExceptionUtil()
+exUtil.processSubflowsBPMNException(execution)
+]]></bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_11" name="" sourceRef="ScriptTask_8" targetRef="EndEvent_2" />
+ <bpmn2:endEvent id="EndEvent_2">
+ <bpmn2:incoming>SequenceFlow_11</bpmn2:incoming>
+ </bpmn2:endEvent>
+ </bpmn2:subProcess>
+ </bpmn2:process>
+ <bpmn2:error id="Error_1" name="MSO Workflow Exception" errorCode="MSOWorkflowException" />
+ <bpmn2:message id="Message_1" name="WorkflowMessage" />
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="SDNCAdapterRestV1">
+ <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_56" bpmnElement="ScriptTask_1">
+ <dc:Bounds x="204" y="148" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_SubProcess_14" bpmnElement="SubProcess_2" isExpanded="true">
+ <dc:Bounds x="744" y="303" width="629" height="280" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_58" bpmnElement="ScriptTask_6">
+ <dc:Bounds x="948" y="404" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_59" bpmnElement="ScriptTask_5">
+ <dc:Bounds x="1418" y="624" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_BoundaryEvent_24" bpmnElement="BoundaryEvent_1">
+ <dc:Bounds x="1300" y="565" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1341" y="595" width="39" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_IntermediateCatchEvent_20" bpmnElement="IntermediateCatchEvent_1">
+ <dc:Bounds x="871" y="426" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="859" y="468" width="60" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_78" bpmnElement="ScriptTask_4">
+ <dc:Bounds x="744" y="148" width="97" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_79" bpmnElement="ScriptTask_2">
+ <dc:Bounds x="492" y="148" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_54" bpmnElement="StartEvent_1">
+ <dc:Bounds x="130" y="170" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="131" y="211" width="34" height="22" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_168" bpmnElement="ScriptTask_3">
+ <dc:Bounds x="744" y="24" width="97" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_2" bpmnElement="SequenceFlow_9" sourceElement="_BPMNShape_StartEvent_54" targetElement="_BPMNShape_ScriptTask_56">
+ <di:waypoint xsi:type="dc:Point" x="166" y="188" />
+ <di:waypoint xsi:type="dc:Point" x="204" y="188" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="176" y="188" width="6" height="6" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_105" bpmnElement="ExclusiveGateway_1" isMarkerVisible="true">
+ <dc:Bounds x="624" y="162" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="649" y="217" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_18" bpmnElement="SequenceFlow_14" sourceElement="_BPMNShape_ScriptTask_79" targetElement="_BPMNShape_ExclusiveGateway_105">
+ <di:waypoint xsi:type="dc:Point" x="592" y="188" />
+ <di:waypoint xsi:type="dc:Point" x="624" y="187" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="611" y="187" width="6" height="6" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_19" bpmnElement="SequenceFlow_17" sourceElement="_BPMNShape_ExclusiveGateway_105" targetElement="_BPMNShape_ScriptTask_168">
+ <di:waypoint xsi:type="dc:Point" x="649" y="162" />
+ <di:waypoint xsi:type="dc:Point" x="649" y="64" />
+ <di:waypoint xsi:type="dc:Point" x="744" y="64" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="688" y="64" width="27" height="22" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_20" bpmnElement="SequenceFlow_23" sourceElement="_BPMNShape_ExclusiveGateway_105" targetElement="_BPMNShape_ScriptTask_78">
+ <di:waypoint xsi:type="dc:Point" x="674" y="187" />
+ <di:waypoint xsi:type="dc:Point" x="709" y="187" />
+ <di:waypoint xsi:type="dc:Point" x="709" y="188" />
+ <di:waypoint xsi:type="dc:Point" x="744" y="188" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="684" y="188" width="35" height="22" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_25" bpmnElement="SequenceFlow_24" sourceElement="_BPMNShape_ExclusiveGateway_105" targetElement="_BPMNShape_SubProcess_14">
+ <di:waypoint xsi:type="dc:Point" x="649" y="212" />
+ <di:waypoint xsi:type="dc:Point" x="649" y="443" />
+ <di:waypoint xsi:type="dc:Point" x="744" y="443" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="689" y="443" width="18" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_55" bpmnElement="StartEvent_3">
+ <dc:Bounds x="776" y="426" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="794" y="467" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_27" bpmnElement="SequenceFlow_25" sourceElement="_BPMNShape_StartEvent_55" targetElement="_BPMNShape_IntermediateCatchEvent_20">
+ <di:waypoint xsi:type="dc:Point" x="812" y="444" />
+ <di:waypoint xsi:type="dc:Point" x="871" y="444" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1074" y="442" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_29" bpmnElement="SequenceFlow_27" sourceElement="_BPMNShape_BoundaryEvent_24" targetElement="_BPMNShape_ScriptTask_59">
+ <di:waypoint xsi:type="dc:Point" x="1318" y="601" />
+ <di:waypoint xsi:type="dc:Point" x="1318" y="664" />
+ <di:waypoint xsi:type="dc:Point" x="1418" y="664" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1153" y="655" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_EndEvent_158" bpmnElement="EndEvent_6">
+ <dc:Bounds x="1562" y="425" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1566" y="466" width="29" height="22" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_EndEvent_160" bpmnElement="EndEvent_8">
+ <dc:Bounds x="1562" y="646" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1580" y="687" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_36" bpmnElement="SequenceFlow_34" sourceElement="_BPMNShape_ScriptTask_59" targetElement="_BPMNShape_EndEvent_160">
+ <di:waypoint xsi:type="dc:Point" x="1518" y="664" />
+ <di:waypoint xsi:type="dc:Point" x="1562" y="664" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1542" y="664" width="6" height="6" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_EndEvent_161" bpmnElement="EndEvent_9">
+ <dc:Bounds x="891" y="46" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="909" y="87" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_37" bpmnElement="SequenceFlow_35" sourceElement="_BPMNShape_ScriptTask_168" targetElement="_BPMNShape_EndEvent_161">
+ <di:waypoint xsi:type="dc:Point" x="840" y="64" />
+ <di:waypoint xsi:type="dc:Point" x="891" y="64" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="865" y="64" width="6" height="6" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_EndEvent_162" bpmnElement="EndEvent_10">
+ <dc:Bounds x="892" y="170" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="910" y="211" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_38" bpmnElement="SequenceFlow_36" sourceElement="_BPMNShape_ScriptTask_78" targetElement="_BPMNShape_EndEvent_162">
+ <di:waypoint xsi:type="dc:Point" x="840" y="188" />
+ <di:waypoint xsi:type="dc:Point" x="892" y="188" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_236" bpmnElement="ScriptTask_setSuccess">
+ <dc:Bounds x="1419" y="401" width="97" height="83" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="_BPMNShape_ScriptTask_236" targetElement="_BPMNShape_EndEvent_158">
+ <di:waypoint xsi:type="dc:Point" x="1515" y="442" />
+ <di:waypoint xsi:type="dc:Point" x="1562" y="443" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1548" y="443" width="6" height="6" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_237" bpmnElement="ScriptTask_7">
+ <dc:Bounds x="360" y="146" width="97" height="83" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="SequenceFlow_2" sourceElement="_BPMNShape_ScriptTask_56" targetElement="_BPMNShape_ScriptTask_237">
+ <di:waypoint xsi:type="dc:Point" x="304" y="188" />
+ <di:waypoint xsi:type="dc:Point" x="344" y="188" />
+ <di:waypoint xsi:type="dc:Point" x="344" y="187" />
+ <di:waypoint xsi:type="dc:Point" x="360" y="187" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="317" y="188" width="6" height="6" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_4" bpmnElement="SequenceFlow_3" sourceElement="_BPMNShape_ScriptTask_237" targetElement="_BPMNShape_ScriptTask_79">
+ <di:waypoint xsi:type="dc:Point" x="456" y="187" />
+ <di:waypoint xsi:type="dc:Point" x="474" y="187" />
+ <di:waypoint xsi:type="dc:Point" x="474" y="188" />
+ <di:waypoint xsi:type="dc:Point" x="492" y="188" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_SubProcess_24" bpmnElement="SubProcess_1" isExpanded="true">
+ <dc:Bounds x="156" y="516" width="382" height="181" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_66" bpmnElement="StartEvent_2">
+ <dc:Bounds x="204" y="589" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="222" y="630" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_266" bpmnElement="ScriptTask_8">
+ <dc:Bounds x="302" y="565" width="97" height="83" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_5" bpmnElement="SequenceFlow_4" sourceElement="_BPMNShape_StartEvent_66" targetElement="_BPMNShape_ScriptTask_266">
+ <di:waypoint xsi:type="dc:Point" x="240" y="607" />
+ <di:waypoint xsi:type="dc:Point" x="302" y="606" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="280" y="630" width="6" height="6" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_107" bpmnElement="ExclusiveGateway_3" isMarkerVisible="true">
+ <dc:Bounds x="1092" y="418" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1093" y="381" width="54" height="24" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_EndEvent_215" bpmnElement="EndEvent_3">
+ <dc:Bounds x="1100" y="516" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1118" y="557" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_9" bpmnElement="SequenceFlow_8" sourceElement="_BPMNShape_ExclusiveGateway_107" targetElement="_BPMNShape_EndEvent_215">
+ <di:waypoint xsi:type="dc:Point" x="1117" y="468" />
+ <di:waypoint xsi:type="dc:Point" x="1118" y="516" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1122" y="468" width="18" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_111" bpmnElement="ExclusiveGateway_7" isMarkerVisible="true">
+ <dc:Bounds x="1204" y="418" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1192" y="472" width="86" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_26" bpmnElement="SequenceFlow_30" sourceElement="_BPMNShape_ExclusiveGateway_107" targetElement="_BPMNShape_ExclusiveGateway_111">
+ <di:waypoint xsi:type="dc:Point" x="1142" y="443" />
+ <di:waypoint xsi:type="dc:Point" x="1204" y="443" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1156" y="443" width="12" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_39" bpmnElement="SequenceFlow_39" sourceElement="_BPMNShape_ExclusiveGateway_111" targetElement="_BPMNShape_EndEvent_219">
+ <di:waypoint xsi:type="dc:Point" x="1254" y="443" />
+ <di:waypoint xsi:type="dc:Point" x="1308" y="444" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1276" y="418" width="7" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_41" bpmnElement="SequenceFlow_41" sourceElement="_BPMNShape_IntermediateCatchEvent_20" targetElement="_BPMNShape_ScriptTask_58">
+ <di:waypoint xsi:type="dc:Point" x="907" y="444" />
+ <di:waypoint xsi:type="dc:Point" x="948" y="444" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="763" y="475" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_EndEvent_219" bpmnElement="EndEvent_12">
+ <dc:Bounds x="1308" y="426" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1326" y="467" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_42" bpmnElement="SequenceFlow_42" sourceElement="_BPMNShape_ScriptTask_58" targetElement="_BPMNShape_ExclusiveGateway_107">
+ <di:waypoint xsi:type="dc:Point" x="1048" y="444" />
+ <di:waypoint xsi:type="dc:Point" x="1070" y="444" />
+ <di:waypoint xsi:type="dc:Point" x="1070" y="443" />
+ <di:waypoint xsi:type="dc:Point" x="1092" y="443" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="905" y="462" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_43" bpmnElement="SequenceFlow_43" sourceElement="_BPMNShape_ExclusiveGateway_111" targetElement="_BPMNShape_IntermediateCatchEvent_20">
+ <di:waypoint xsi:type="dc:Point" x="1229" y="418" />
+ <di:waypoint xsi:type="dc:Point" x="1229" y="351" />
+ <di:waypoint xsi:type="dc:Point" x="889" y="351" />
+ <di:waypoint xsi:type="dc:Point" x="889" y="426" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1240" y="360" width="8" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_44" bpmnElement="SequenceFlow_44" sourceElement="_BPMNShape_SubProcess_14" targetElement="_BPMNShape_ScriptTask_236">
+ <di:waypoint xsi:type="dc:Point" x="1372" y="443" />
+ <di:waypoint xsi:type="dc:Point" x="1395" y="443" />
+ <di:waypoint xsi:type="dc:Point" x="1395" y="442" />
+ <di:waypoint xsi:type="dc:Point" x="1419" y="442" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1404" y="462" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_EndEvent_220" bpmnElement="EndEvent_2">
+ <dc:Bounds x="444" y="589" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="462" y="630" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_11" bpmnElement="SequenceFlow_11" sourceElement="_BPMNShape_ScriptTask_266" targetElement="_BPMNShape_EndEvent_220">
+ <di:waypoint xsi:type="dc:Point" x="398" y="606" />
+ <di:waypoint xsi:type="dc:Point" x="444" y="607" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="412" y="606" width="6" height="6" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn2:definitions>
diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/SDNCAdapterV1.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/SDNCAdapterV1.bpmn
index c94842382b..e0fc14e933 100644
--- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/SDNCAdapterV1.bpmn
+++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/SDNCAdapterV1.bpmn
@@ -1,5 +1,5 @@
<?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="_l2hJ8CccEeW3d--PaFJMbg" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
+<bpmn2: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="_l2hJ8CccEeW3d--PaFJMbg" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.6.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
<bpmn2:process id="sdncAdapter" name="SDNC Adapter" isExecutable="true">
<bpmn2:exclusiveGateway id="isResponseOK" name="is Response Ok?" default="badSynchronousResponse">
<bpmn2:incoming>SequenceFlow_15</bpmn2:incoming>
@@ -10,7 +10,7 @@
<bpmn2:sequenceFlow id="goodSynchronousResponse" name="Good synchronous response" sourceRef="isResponseOK" targetRef="resetCallbackRequest">
<bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("SDNCA_ResponseCode")=='200'}]]></bpmn2:conditionExpression>
</bpmn2:sequenceFlow>
- <bpmn2:scriptTask id="setBadResponse" name="Set Bad Response &#10;Exception" scriptFormat="groovy">
+ <bpmn2:scriptTask id="setBadResponse" name="Set Bad Response&#10;&#10;Exception" scriptFormat="groovy">
<bpmn2:incoming>badSynchronousResponse</bpmn2:incoming>
<bpmn2:outgoing>Exception</bpmn2:outgoing>
<bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
@@ -20,7 +20,7 @@ ExceptionUtil exceptionUtil = new ExceptionUtil()
exceptionUtil.buildWorkflowException(execution, 7000, "Could not communicate with the SDNC Adapter" )]]></bpmn2:script>
</bpmn2:scriptTask>
<bpmn2:sequenceFlow id="Exception" name="Exception" sourceRef="setBadResponse" targetRef="badResponseEndFlow" />
- <bpmn2:serviceTask id="invokeSDNCAdapter" name="Invoke SDNC Adapter" camunda:class="">
+ <bpmn2:serviceTask id="invokeSDNCAdapter" name="Invoke SDNC Adapter" camunda:asyncAfter="true" camunda:class="">
<bpmn2:extensionElements>
<camunda:connector>
<camunda:inputOutput>
@@ -71,13 +71,9 @@ sdnc.preProcessRequest(execution)
]]></bpmn2:script>
</bpmn2:scriptTask>
<bpmn2:sequenceFlow id="SequenceFlow_8" sourceRef="processMessage" targetRef="invokeSDNCAdapter" />
- <bpmn2:exclusiveGateway id="timeOutCheck">
- <bpmn2:incoming>SequenceFlow_9</bpmn2:incoming>
- <bpmn2:incoming>timeOut</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_29</bpmn2:outgoing>
- </bpmn2:exclusiveGateway>
<bpmn2:scriptTask id="returnWorkflowResult" name="Return workflow result" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_29</bpmn2:incoming>
+ <bpmn2:incoming>SequenceFlow_9</bpmn2:incoming>
+ <bpmn2:incoming>SequenceFlow_11ah5pw</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_14</bpmn2:outgoing>
<bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
def sdnc= new SDNCAdapter()
@@ -91,49 +87,34 @@ sdnc.postProcessResponse(execution)
<bpmn2:outgoing>SequenceFlow_19</bpmn2:outgoing>
</bpmn2:exclusiveGateway>
<bpmn2:sequenceFlow id="noTimeoutError" name="No Timeout" sourceRef="timeoutError" targetRef="ExclusiveGateway_1" />
- <bpmn2:sequenceFlow id="SequenceFlow_19" name="Timeout" sourceRef="timeoutError" targetRef="setTimeoutEx">
+ <bpmn2:sequenceFlow id="SequenceFlow_19" name="Timeout" sourceRef="timeoutError" targetRef="endEventException">
<bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("asynchronousResponseTimeout")==true}]]></bpmn2:conditionExpression>
</bpmn2:sequenceFlow>
<bpmn2:subProcess id="SubProcess" name="Wait for asynchronous message">
<bpmn2:incoming>SequenceFlow_2</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_9</bpmn2:outgoing>
- <bpmn2:endEvent id="eEndEventSubprocess" name="End Event Subprocess">
- <bpmn2:incoming>SequenceFlow_16</bpmn2:incoming>
- <bpmn2:terminateEventDefinition id="_TerminateEventDefinition_2" />
- </bpmn2:endEvent>
<bpmn2:startEvent id="StartEvent" name="Start Event">
- <bpmn2:outgoing>SequenceFlow_18</bpmn2:outgoing>
+ <bpmn2:outgoing>SequenceFlow_1eciucn</bpmn2:outgoing>
</bpmn2:startEvent>
- <bpmn2:sequenceFlow id="SequenceFlow_18" sourceRef="StartEvent" targetRef="IntermediateCatchEvent" />
<bpmn2:intermediateCatchEvent id="IntermediateCatchEvent" name="Catch Event">
- <bpmn2:incoming>SequenceFlow_18</bpmn2:incoming>
+ <bpmn2:incoming>SequenceFlow_1eciucn</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_16</bpmn2:outgoing>
<bpmn2:messageEventDefinition id="MessageEventDefinition_2" messageRef="Message_2" />
</bpmn2:intermediateCatchEvent>
<bpmn2:sequenceFlow id="SequenceFlow_16" sourceRef="IntermediateCatchEvent" targetRef="eEndEventSubprocess" />
+ <bpmn2:sequenceFlow id="SequenceFlow_1eciucn" sourceRef="StartEvent" targetRef="IntermediateCatchEvent" />
+ <bpmn2:endEvent id="eEndEventSubprocess" name="End Event Subprocess">
+ <bpmn2:incoming>SequenceFlow_16</bpmn2:incoming>
+ </bpmn2:endEvent>
</bpmn2:subProcess>
- <bpmn2:sequenceFlow id="SequenceFlow_9" sourceRef="SubProcess" targetRef="timeOutCheck" />
- <bpmn2:boundaryEvent id="BoundaryEvent_1" name="Boundary Event" attachedToRef="SubProcess">
- <bpmn2:outgoing>timeOut</bpmn2:outgoing>
- <bpmn2:timerEventDefinition id="TimerEventDefinition_1">
- <bpmn2:timeDuration xsi:type="bpmn2:tFormalExpression">${sdncTimeoutValue}</bpmn2:timeDuration>
- </bpmn2:timerEventDefinition>
- </bpmn2:boundaryEvent>
- <bpmn2:sequenceFlow id="timeOut" name="Timed out" sourceRef="BoundaryEvent_1" targetRef="timeOutCheck" />
- <bpmn2:scriptTask id="setTimeoutEx" name="Set Timeout &#10;Exception" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_19</bpmn2:incoming>
- <bpmn2:outgoing>Error</bpmn2:outgoing>
+ <bpmn2:sequenceFlow id="SequenceFlow_9" sourceRef="SubProcess" targetRef="returnWorkflowResult" />
+ <bpmn2:scriptTask id="setTimeoutEx" name="Set Timeout&#10;and Stop Listening for Callback" scriptFormat="groovy">
+ <bpmn2:incoming>SequenceFlow_0mzs1ze</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_11ah5pw</bpmn2:outgoing>
<bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
-ExceptionUtil exceptionUtil = new ExceptionUtil()
-exceptionUtil.buildWorkflowException(execution, 500, "SDNC Callback Timeout Error" )
-
-]]></bpmn2:script>
+def sdnc= new SDNCAdapter()
+sdnc.setTimeout(execution)]]></bpmn2:script>
</bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="Error" name="Error" sourceRef="setTimeoutEx" targetRef="endEventException" />
- <bpmn2:endEvent id="endEventException" name="Timeout Exception">
- <bpmn2:incoming>Error</bpmn2:incoming>
- </bpmn2:endEvent>
- <bpmn2:sequenceFlow id="SequenceFlow_29" name="" sourceRef="timeOutCheck" targetRef="returnWorkflowResult" />
<bpmn2:scriptTask id="resetCallbackRequest" name="Reset callback request and set timer value" scriptFormat="groovy">
<bpmn2:incoming>goodSynchronousResponse</bpmn2:incoming>
<bpmn2:incoming>SequenceFlow_26</bpmn2:incoming>
@@ -198,15 +179,46 @@ sdnc.assignError(execution)]]></bpmn2:script>
</bpmn2:subProcess>
<bpmn2:scriptTask id="toggleSuccess" name="Toggle Success Indicator" scriptFormat="groovy">
<bpmn2:incoming>SequenceFlow_21</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_15c4h5f</bpmn2:outgoing>
+ <bpmn2:outgoing>SequenceFlow_31</bpmn2:outgoing>
<bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
def sdnc= new SDNCAdapter()
sdnc.toggleSuccessIndicator(execution)]]></bpmn2:script>
</bpmn2:scriptTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_31" name="" sourceRef="toggleSuccess" targetRef="ExclusiveGateway_2" />
+ <bpmn2:exclusiveGateway id="ExclusiveGateway_2" name="Service Config Activate?" default="SequenceFlow_23">
+ <bpmn2:incoming>SequenceFlow_31</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_4</bpmn2:outgoing>
+ <bpmn2:outgoing>SequenceFlow_23</bpmn2:outgoing>
+ </bpmn2:exclusiveGateway>
+ <bpmn2:sequenceFlow id="SequenceFlow_4" name="Yes" sourceRef="ExclusiveGateway_2" targetRef="CallActivity_11xgv33">
+ <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("serviceConfigActivate")==true}]]></bpmn2:conditionExpression>
+ </bpmn2:sequenceFlow>
+ <bpmn2:sequenceFlow id="SequenceFlow_23" name="No" sourceRef="ExclusiveGateway_2" targetRef="EndEvent_1" />
<bpmn2:endEvent id="EndEvent_1">
- <bpmn2:incoming>SequenceFlow_15c4h5f</bpmn2:incoming>
+ <bpmn2:incoming>SequenceFlow_23</bpmn2:incoming>
</bpmn2:endEvent>
- <bpmn2:sequenceFlow id="SequenceFlow_15c4h5f" sourceRef="toggleSuccess" targetRef="EndEvent_1" />
+ <bpmn2:boundaryEvent id="BoundaryEvent_1" name="Boundary Event" cancelActivity="false" attachedToRef="SubProcess">
+ <bpmn2:documentation>this is a non interupting time to prevent an Optimistic Locking Exception if timer expires the same time we correlate a message</bpmn2:documentation>
+ <bpmn2:outgoing>SequenceFlow_0mzs1ze</bpmn2:outgoing>
+ <bpmn2:timerEventDefinition>
+ <bpmn2:timeDuration xsi:type="bpmn2:tFormalExpression">${sdncTimeoutValue}</bpmn2:timeDuration>
+ </bpmn2:timerEventDefinition>
+ </bpmn2:boundaryEvent>
+ <bpmn2:endEvent id="endEventException" name="Timeout Exception">
+ <bpmn2:incoming>SequenceFlow_19</bpmn2:incoming>
+ <bpmn2:terminateEventDefinition />
+ </bpmn2:endEvent>
+ <bpmn2:sequenceFlow id="SequenceFlow_0mzs1ze" sourceRef="BoundaryEvent_1" targetRef="setTimeoutEx" />
+ <bpmn2:sequenceFlow id="SequenceFlow_11ah5pw" sourceRef="setTimeoutEx" targetRef="returnWorkflowResult" />
+ <bpmn2:callActivity id="CallActivity_11xgv33" name="Call Notification Service" calledElement="${URN_mso_workflow_notification_name}" camunda:calledElementBinding="deployment">
+ <bpmn2:extensionElements>
+ <camunda:in source="mso-request-id" target="mso-request-id" />
+ <camunda:in source="mso-service-instance-id" target="mso-service-instance-id" />
+ <camunda:in variables="all" />
+ <camunda:out variables="all" />
+ </bpmn2:extensionElements>
+ <bpmn2:incoming>SequenceFlow_4</bpmn2:incoming>
+ </bpmn2:callActivity>
</bpmn2:process>
<bpmn2:message id="Message_1" name="sdncAdapterWorkflowRequest" />
<bpmn2:message id="Message_2" name="sdncAdapterCallbackRequest" />
@@ -294,52 +306,25 @@ sdnc.toggleSuccessIndicator(execution)]]></bpmn2:script>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_IntermediateCatchEvent_16" bpmnElement="IntermediateCatchEvent">
- <dc:Bounds x="764" y="259" width="36" height="36" />
+ <dc:Bounds x="781" y="257" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="714" y="294" width="76" height="22" />
+ <dc:Bounds x="739" y="292" width="60" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_SubProcess_11" bpmnElement="SubProcess" isExpanded="true">
- <dc:Bounds x="624" y="228" width="314" height="97" />
+ <dc:Bounds x="619" y="209" width="379" height="137" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_38" bpmnElement="StartEvent">
- <dc:Bounds x="660" y="259" width="36" height="36" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="627" y="294" width="70" height="22" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_EndEvent_90" bpmnElement="eEndEventSubprocess">
- <dc:Bounds x="865" y="259" width="36" height="36" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="805" y="294" width="138" height="22" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_9" bpmnElement="SequenceFlow_9" sourceElement="_BPMNShape_SubProcess_11" targetElement="_BPMNShape_ExclusiveGateway_51">
- <di:waypoint xsi:type="dc:Point" x="938" y="276" />
- <di:waypoint xsi:type="dc:Point" x="996" y="276" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="967" y="254" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_BoundaryEvent_21" bpmnElement="BoundaryEvent_1">
- <dc:Bounds x="781" y="307" width="36" height="36" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="704" y="340" width="97" height="22" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_EndEvent_91" bpmnElement="endEventException">
- <dc:Bounds x="1488" y="74" width="36" height="36" />
+ <dc:Bounds x="655" y="257" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1523" y="81" width="114" height="22" />
+ <dc:Bounds x="630" y="292" width="54" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_2" bpmnElement="timeOut" sourceElement="_BPMNShape_BoundaryEvent_21" targetElement="_BPMNShape_ExclusiveGateway_51">
- <di:waypoint xsi:type="dc:Point" x="799" y="343" />
- <di:waypoint xsi:type="dc:Point" x="799" y="365" />
- <di:waypoint xsi:type="dc:Point" x="1021" y="365" />
- <di:waypoint xsi:type="dc:Point" x="1021" y="301" />
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_9" bpmnElement="SequenceFlow_9" sourceElement="_BPMNShape_SubProcess_11">
+ <di:waypoint xsi:type="dc:Point" x="998" y="278" />
+ <di:waypoint xsi:type="dc:Point" x="1104" y="277" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="874" y="340" width="63" height="22" />
+ <dc:Bounds x="1051" y="262.5" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_ScriptTask_24" bpmnElement="setBadResponse">
@@ -353,35 +338,15 @@ sdnc.toggleSuccessIndicator(execution)]]></bpmn2:script>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_ScriptTask_25" bpmnElement="setTimeoutEx">
- <dc:Bounds x="1299" y="52" width="100" height="80" />
+ <dc:Bounds x="941" y="372" width="100" height="80" />
</bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_11" bpmnElement="Error" sourceElement="_BPMNShape_ScriptTask_25" targetElement="_BPMNShape_EndEvent_91">
- <di:waypoint xsi:type="dc:Point" x="1399" y="92" />
- <di:waypoint xsi:type="dc:Point" x="1488" y="92" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="1416" y="70" width="34" height="22" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_16" bpmnElement="SequenceFlow_16" sourceElement="_BPMNShape_IntermediateCatchEvent_16" targetElement="_BPMNShape_EndEvent_90">
- <di:waypoint xsi:type="dc:Point" x="800" y="277" />
- <di:waypoint xsi:type="dc:Point" x="865" y="277" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="822" y="259" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_18" bpmnElement="SequenceFlow_18" sourceElement="_BPMNShape_StartEvent_38" targetElement="_BPMNShape_IntermediateCatchEvent_16">
- <di:waypoint xsi:type="dc:Point" x="696" y="277" />
- <di:waypoint xsi:type="dc:Point" x="764" y="277" />
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_16" bpmnElement="SequenceFlow_16" sourceElement="_BPMNShape_IntermediateCatchEvent_16">
+ <di:waypoint xsi:type="dc:Point" x="817" y="275" />
+ <di:waypoint xsi:type="dc:Point" x="926" y="275" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="718" y="259" width="0" height="0" />
+ <dc:Bounds x="872" y="260" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_51" bpmnElement="timeOutCheck" isMarkerVisible="true">
- <dc:Bounds x="996" y="251" width="50" height="50" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="982" y="228" width="81" height="22" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_53" bpmnElement="timeoutError" isMarkerVisible="true">
<dc:Bounds x="1248" y="251" width="50" height="50" />
<bpmndi:BPMNLabel>
@@ -397,16 +362,16 @@ sdnc.toggleSuccessIndicator(execution)]]></bpmn2:script>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_19" bpmnElement="SequenceFlow_19" sourceElement="_BPMNShape_ExclusiveGateway_53" targetElement="_BPMNShape_ScriptTask_25">
<di:waypoint xsi:type="dc:Point" x="1273" y="251" />
- <di:waypoint xsi:type="dc:Point" x="1273" y="92" />
- <di:waypoint xsi:type="dc:Point" x="1299" y="92" />
+ <di:waypoint xsi:type="dc:Point" x="1273" y="95" />
+ <di:waypoint xsi:type="dc:Point" x="1560" y="95" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1280" y="168" width="82" height="22" />
+ <dc:Bounds x="1301" y="169.45283018867923" width="39" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_54" bpmnElement="ExclusiveGateway_1" isMarkerVisible="true">
<dc:Bounds x="1248" y="359" width="50" height="50" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1127" y="373" width="123" height="22" />
+ <dc:Bounds x="1194" y="372" width="57" height="24" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_7" bpmnElement="Done" sourceElement="_BPMNShape_ExclusiveGateway_54" targetElement="_BPMNShape_ScriptTask_247">
@@ -421,18 +386,13 @@ sdnc.toggleSuccessIndicator(execution)]]></bpmn2:script>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_12" bpmnElement="SequenceFlow_2" sourceElement="_BPMNShape_ScriptTask_27" targetElement="_BPMNShape_SubProcess_11">
<di:waypoint xsi:type="dc:Point" x="594" y="286" />
- <di:waypoint xsi:type="dc:Point" x="609" y="286" />
- <di:waypoint xsi:type="dc:Point" x="624" y="285" />
+ <di:waypoint xsi:type="dc:Point" x="607" y="286" />
+ <di:waypoint xsi:type="dc:Point" x="607" y="275" />
+ <di:waypoint xsi:type="dc:Point" x="619" y="275" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="607" y="286" width="6" height="6" />
+ <dc:Bounds x="622" y="280.5" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_37" bpmnElement="SequenceFlow_29" sourceElement="_BPMNShape_ExclusiveGateway_51" targetElement="_BPMNShape_ServiceTask_68">
- <di:waypoint xsi:type="dc:Point" x="1046" y="276" />
- <di:waypoint xsi:type="dc:Point" x="1075" y="276" />
- <di:waypoint xsi:type="dc:Point" x="1075" y="277" />
- <di:waypoint xsi:type="dc:Point" x="1104" y="277" />
- </bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_38" bpmnElement="SequenceFlow_30" sourceElement="_BPMNShape_ExclusiveGateway_54" targetElement="_BPMNShape_ParallelGateway_14">
<di:waypoint xsi:type="dc:Point" x="1273" y="409" />
<di:waypoint xsi:type="dc:Point" x="1273" y="467" />
@@ -440,6 +400,19 @@ sdnc.toggleSuccessIndicator(execution)]]></bpmn2:script>
<dc:Bounds x="1273" y="423" width="60" height="22" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_55" bpmnElement="ExclusiveGateway_2" isMarkerVisible="true">
+ <dc:Bounds x="1248" y="663" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1105" y="678" width="145" height="22" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_13" bpmnElement="SequenceFlow_4" sourceElement="_BPMNShape_ExclusiveGateway_55" targetElement="CallActivity_11xgv33_di">
+ <di:waypoint xsi:type="dc:Point" x="1273" y="713" />
+ <di:waypoint xsi:type="dc:Point" x="1273" y="782" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1279" y="722.5754830930483" width="18" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_ParallelGateway_14" bpmnElement="ParallelGateway_3">
<dc:Bounds x="1248" y="467" width="50" height="50" />
<bpmndi:BPMNLabel>
@@ -454,17 +427,24 @@ sdnc.toggleSuccessIndicator(execution)]]></bpmn2:script>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_EndEvent_96" bpmnElement="EndEvent_1">
- <dc:Bounds x="1255" y="677" width="36" height="36" />
+ <dc:Bounds x="1444" y="671" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1273" y="718" width="0" height="0" />
+ <dc:Bounds x="1462" y="712" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_30" bpmnElement="SequenceFlow_23" sourceElement="_BPMNShape_ExclusiveGateway_55" targetElement="_BPMNShape_EndEvent_96">
+ <di:waypoint xsi:type="dc:Point" x="1298" y="688" />
+ <di:waypoint xsi:type="dc:Point" x="1444" y="689" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1320" y="688" width="22" height="22" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_33" bpmnElement="SequenceFlow_26" sourceElement="_BPMNShape_ParallelGateway_14" targetElement="_BPMNShape_ScriptTask_27">
<di:waypoint xsi:type="dc:Point" x="1248" y="492" />
<di:waypoint xsi:type="dc:Point" x="544" y="492" />
<di:waypoint xsi:type="dc:Point" x="544" y="326" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="684" y="467" width="269" height="22" />
+ <dc:Bounds x="782" y="467" width="73" height="48" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_ScriptTask_247" bpmnElement="toggleSuccessIndicator">
@@ -478,47 +458,93 @@ sdnc.toggleSuccessIndicator(execution)]]></bpmn2:script>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_SubProcess_19" bpmnElement="errorHandlingSubProcess" isExpanded="true">
- <dc:Bounds x="248" y="866" width="353" height="193" />
+ <dc:Bounds x="378" y="797" width="353" height="193" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_63" bpmnElement="catchErrors">
- <dc:Bounds x="283" y="945" width="36" height="36" />
+ <dc:Bounds x="413" y="876" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="281" y="986" width="40" height="22" />
+ <dc:Bounds x="416" y="917" width="29" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_EndEvent_213" bpmnElement="EndEvent_5">
- <dc:Bounds x="523" y="945" width="36" height="36" />
+ <dc:Bounds x="653" y="876" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="541" y="986" width="0" height="0" />
+ <dc:Bounds x="671" y="917" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_ScriptTask_249" bpmnElement="assignError">
- <dc:Bounds x="367" y="923" width="100" height="80" />
+ <dc:Bounds x="497" y="854" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_29" bpmnElement="SequenceFlow_22" sourceElement="_BPMNShape_StartEvent_63" targetElement="_BPMNShape_ScriptTask_249">
- <di:waypoint xsi:type="dc:Point" x="319" y="963" />
- <di:waypoint xsi:type="dc:Point" x="367" y="963" />
+ <di:waypoint xsi:type="dc:Point" x="449" y="894" />
+ <di:waypoint xsi:type="dc:Point" x="497" y="894" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="346" y="963" width="6" height="6" />
+ <dc:Bounds x="479" y="894" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_34" bpmnElement="SequenceFlow_27" sourceElement="_BPMNShape_ScriptTask_249" targetElement="_BPMNShape_EndEvent_213">
- <di:waypoint xsi:type="dc:Point" x="467" y="963" />
- <di:waypoint xsi:type="dc:Point" x="523" y="963" />
+ <di:waypoint xsi:type="dc:Point" x="597" y="894" />
+ <di:waypoint xsi:type="dc:Point" x="653" y="894" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="492" y="963" width="6" height="6" />
+ <dc:Bounds x="625" y="894" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_ScriptTask_255" bpmnElement="toggleSuccess">
<dc:Bounds x="1224" y="552" width="100" height="80" />
</bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_15c4h5f_di" bpmnElement="SequenceFlow_15c4h5f">
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_36" bpmnElement="SequenceFlow_31" sourceElement="_BPMNShape_ScriptTask_255" targetElement="_BPMNShape_ExclusiveGateway_55">
<di:waypoint xsi:type="dc:Point" x="1274" y="632" />
- <di:waypoint xsi:type="dc:Point" x="1273" y="677" />
+ <di:waypoint xsi:type="dc:Point" x="1274" y="646" />
+ <di:waypoint xsi:type="dc:Point" x="1273" y="646" />
+ <di:waypoint xsi:type="dc:Point" x="1273" y="663" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1271" y="646" width="6" height="6" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1eciucn_di" bpmnElement="SequenceFlow_1eciucn">
+ <di:waypoint xsi:type="dc:Point" x="691" y="275" />
+ <di:waypoint xsi:type="dc:Point" x="781" y="275" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="736" y="260" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="BoundaryEvent_1e5qjpm_di" bpmnElement="BoundaryEvent_1">
+ <dc:Bounds x="782" y="328" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="715" y="361" width="78" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_0vl0pvg_di" bpmnElement="endEventException">
+ <dc:Bounds x="1560" y="77" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1274" y="629.5" width="0" height="0" />
+ <dc:Bounds x="1607" y="84" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0mzs1ze_di" bpmnElement="SequenceFlow_0mzs1ze">
+ <di:waypoint xsi:type="dc:Point" x="800" y="364" />
+ <di:waypoint xsi:type="dc:Point" x="800" y="412" />
+ <di:waypoint xsi:type="dc:Point" x="941" y="412" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="815" y="388" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_11ah5pw_di" bpmnElement="SequenceFlow_11ah5pw">
+ <di:waypoint xsi:type="dc:Point" x="1041" y="412" />
+ <di:waypoint xsi:type="dc:Point" x="1154" y="412" />
+ <di:waypoint xsi:type="dc:Point" x="1154" y="317" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1098" y="397" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="EndEvent_0xhvk12_di" bpmnElement="eEndEventSubprocess">
+ <dc:Bounds x="926" y="257" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="905" y="292" width="59" height="24" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="CallActivity_11xgv33_di" bpmnElement="CallActivity_11xgv33">
+ <dc:Bounds x="1223" y="782" width="100" height="80" />
+ </bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn2:definitions>
diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/VnfAdapterRestV1.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/VnfAdapterRestV1.bpmn
index 90964e5466..82d89b0c64 100644
--- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/VnfAdapterRestV1.bpmn
+++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/VnfAdapterRestV1.bpmn
@@ -1,442 +1,442 @@
-<?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" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd" id="_GraPIIyxEeWmdMDkx6Uftw" exporter="camunda modeler" exporterVersion="2.7.0" targetNamespace="http://camunda.org/schema/1.0/bpmn">
- <bpmn2:process id="vnfAdapterRestV1" name="vnfAdapterRestV1" isExecutable="true">
- <bpmn2:scriptTask id="ScriptTask_2" name="Log Response" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_3</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_14</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
-def vnfAdapterRestV1 = new VnfAdapterRestV1()
-def statusCode = execution.getVariable('VNFREST_vnfAdapterStatusCode')
-String response = String.valueOf(execution.getVariable('VNFREST_vnfAdapterResponse'))
-def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
-def processKey = vnfAdapterRestV1.getProcessKey(execution)
-vnfAdapterRestV1.logDebug(processKey + " received response from VnfAdapter: statusCode=" + statusCode +
- " response=" + (response.isEmpty() ? "" : "\n") + response, isDebugLogEnabled)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:scriptTask id="ScriptTask_3" name="Workflow Exception (no connection)">
- <bpmn2:incoming>SequenceFlow_17</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_35</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
-def exceptionUtil = new ExceptionUtil()
-exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Failed to communicate with VnfAdapter")]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:scriptTask id="ScriptTask_4" name="Workflow Exception (bad response)" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_23</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_36</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
-
-String res = execution.getVariable(VNFREST_vnfAdapterResponse)
-
-def vnfAdapterRestV1 = new VnfAdapterRestV1()
-vnfAdapterRestV1.vnfAdapterWorkflowException(execution, res)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_14" name="" sourceRef="ScriptTask_2" targetRef="ExclusiveGateway_1"/>
- <bpmn2:exclusiveGateway id="ExclusiveGateway_1" default="SequenceFlow_23">
- <bpmn2:incoming>SequenceFlow_14</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_17</bpmn2:outgoing>
- <bpmn2:outgoing>SequenceFlow_23</bpmn2:outgoing>
- <bpmn2:outgoing>SequenceFlow_24</bpmn2:outgoing>
- </bpmn2:exclusiveGateway>
- <bpmn2:sequenceFlow id="SequenceFlow_17" name="404" sourceRef="ExclusiveGateway_1" targetRef="ScriptTask_3">
- <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("VNFREST_vnfAdapterStatusCode") == '404'}]]></bpmn2:conditionExpression>
- </bpmn2:sequenceFlow>
- <bpmn2:sequenceFlow id="SequenceFlow_23" name="other" sourceRef="ExclusiveGateway_1" targetRef="ScriptTask_4"/>
- <bpmn2:sequenceFlow id="SequenceFlow_24" name="2xx" sourceRef="ExclusiveGateway_1" targetRef="waitForAsyncMessage">
- <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("VNFREST_vnfAdapterStatusCode") == '200' || execution.getVariable("VNFREST_vnfAdapterStatusCode") == '202'}]]></bpmn2:conditionExpression>
- </bpmn2:sequenceFlow>
- <bpmn2:boundaryEvent id="BoundaryEvent_1" name="Timeout" attachedToRef="waitForAsyncMessage">
- <bpmn2:outgoing>SequenceFlow_27</bpmn2:outgoing>
- <bpmn2:timerEventDefinition id="TimerEventDefinition_1">
- <bpmn2:timeDuration xsi:type="bpmn2:tFormalExpression">${URN_mso_po_timeout}</bpmn2:timeDuration>
- </bpmn2:timerEventDefinition>
- </bpmn2:boundaryEvent>
- <bpmn2:subProcess id="waitForAsyncMessage" name="Wait for Callback">
- <bpmn2:incoming>SequenceFlow_24</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_28</bpmn2:outgoing>
- <bpmn2:intermediateCatchEvent id="IntermediateCatchEvent_1" name="Catch Event">
- <bpmn2:incoming>SequenceFlow_25</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_26</bpmn2:outgoing>
- <bpmn2:messageEventDefinition id="MessageEventDefinition_1" messageRef="Message_1"/>
- </bpmn2:intermediateCatchEvent>
- <bpmn2:sequenceFlow id="SequenceFlow_26" name="" sourceRef="IntermediateCatchEvent_1" targetRef="EndEvent_2"/>
- <bpmn2:startEvent id="StartEvent_3">
- <bpmn2:outgoing>SequenceFlow_25</bpmn2:outgoing>
- </bpmn2:startEvent>
- <bpmn2:sequenceFlow id="SequenceFlow_25" name="" sourceRef="StartEvent_3" targetRef="IntermediateCatchEvent_1"/>
- <bpmn2:endEvent id="EndEvent_2">
- <bpmn2:incoming>SequenceFlow_26</bpmn2:incoming>
- </bpmn2:endEvent>
- </bpmn2:subProcess>
- <bpmn2:sequenceFlow id="SequenceFlow_27" name="" sourceRef="BoundaryEvent_1" targetRef="ScriptTask_5"/>
- <bpmn2:scriptTask id="ScriptTask_5" name="Workflow Exception (timeout)" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_27</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_34</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
-def exceptionUtil = new ExceptionUtil()
-exceptionUtil.buildAndThrowWorkflowException(execution, 7010, "VnfAdapter Callback Timeout Error")]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_28" name="" sourceRef="waitForAsyncMessage" targetRef="ScriptTask_6"/>
- <bpmn2:scriptTask id="ScriptTask_6" name="Process Callback" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_28</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_33</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
-def vnfAdapterRestV1 = new VnfAdapterRestV1()
-vnfAdapterRestV1.processCallback(execution)
-]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_33" name="" sourceRef="ScriptTask_6" targetRef="ExclusiveGateway_2"/>
- <bpmn2:sequenceFlow id="SequenceFlow_34" name="" sourceRef="ScriptTask_5" targetRef="EndEvent_8"/>
- <bpmn2:endEvent id="EndEvent_8">
- <bpmn2:incoming>SequenceFlow_34</bpmn2:incoming>
- <bpmn2:errorEventDefinition id="_ErrorEventDefinition_21" errorRef="Error_1"/>
- </bpmn2:endEvent>
- <bpmn2:sequenceFlow id="SequenceFlow_35" name="" sourceRef="ScriptTask_3" targetRef="EndEvent_9"/>
- <bpmn2:endEvent id="EndEvent_9">
- <bpmn2:incoming>SequenceFlow_35</bpmn2:incoming>
- <bpmn2:errorEventDefinition id="_ErrorEventDefinition_22" errorRef="Error_1"/>
- </bpmn2:endEvent>
- <bpmn2:endEvent id="EndEvent_10">
- <bpmn2:incoming>SequenceFlow_36</bpmn2:incoming>
- <bpmn2:errorEventDefinition id="_ErrorEventDefinition_23" errorRef="Error_1"/>
- </bpmn2:endEvent>
- <bpmn2:sequenceFlow id="SequenceFlow_36" name="" sourceRef="ScriptTask_4" targetRef="EndEvent_10"/>
- <bpmn2:endEvent id="EndEvent_7">
- <bpmn2:incoming>SequenceFlow_32</bpmn2:incoming>
- <bpmn2:errorEventDefinition id="_ErrorEventDefinition_20" errorRef="Error_1"/>
- </bpmn2:endEvent>
- <bpmn2:exclusiveGateway id="ExclusiveGateway_2" name="Callback&#xD;&#xA;Exception?" default="SequenceFlow_31">
- <bpmn2:incoming>SequenceFlow_33</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_31</bpmn2:outgoing>
- <bpmn2:outgoing>SequenceFlow_32</bpmn2:outgoing>
- </bpmn2:exclusiveGateway>
- <bpmn2:sequenceFlow id="SequenceFlow_31" name="no" sourceRef="ExclusiveGateway_2" targetRef="ScriptTask_setSuccess"/>
- <bpmn2:sequenceFlow id="SequenceFlow_32" name="yes" sourceRef="ExclusiveGateway_2" targetRef="EndEvent_7">
- <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("WorkflowException") != null}]]></bpmn2:conditionExpression>
- </bpmn2:sequenceFlow>
- <bpmn2:scriptTask id="ScriptTask_setSuccess" name="Set Success Indicator" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_31</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
-def vnfAdapterRestV1 = new VnfAdapterRestV1()
-vnfAdapterRestV1.setSuccessIndicator(execution, true)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_1" name="" sourceRef="ScriptTask_setSuccess" targetRef="EndEvent_6"/>
- <bpmn2:endEvent id="EndEvent_6" name="End Flow">
- <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming>
- </bpmn2:endEvent>
- <bpmn2:scriptTask id="ScriptTask_7" name="Send Request to Vnf Adapter" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_2</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_3</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
-def vnfAdapterRestV1 = new VnfAdapterRestV1()
-vnfAdapterRestV1.sendRequestToVnfAdapter(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_3" name="" sourceRef="ScriptTask_7" targetRef="ScriptTask_2"/>
- <bpmn2:subProcess id="SubProcess_1" name="Error Handling Sub Process" triggeredByEvent="true">
- <bpmn2:scriptTask id="ScriptTask_8" name="Process Error" 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 exUtil = new ExceptionUtil()
-exUtil.processSubflowsBPMNException(execution)
-]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_5" name="" sourceRef="ScriptTask_8" targetRef="EndEvent_1"/>
- <bpmn2:endEvent id="EndEvent_1">
- <bpmn2:incoming>SequenceFlow_5</bpmn2:incoming>
- </bpmn2:endEvent>
- <bpmn2:startEvent id="StartEvent_2">
- <bpmn2:outgoing>SequenceFlow_4</bpmn2:outgoing>
- <bpmn2:errorEventDefinition id="_ErrorEventDefinition_89"/>
- </bpmn2:startEvent>
- <bpmn2:sequenceFlow id="SequenceFlow_4" name="" sourceRef="StartEvent_2" targetRef="ScriptTask_8"/>
- </bpmn2:subProcess>
- <bpmn2:scriptTask id="ScriptTask_1" name="Pre-Process Request" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_9</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_2</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
-def vnfAdapterRestV1 = new VnfAdapterRestV1()
-vnfAdapterRestV1.preProcessRequest(execution)
-]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_2" name="" sourceRef="ScriptTask_1" targetRef="ScriptTask_7"/>
- <bpmn2:startEvent id="StartEvent_1" name="Start">
- <bpmn2:outgoing>SequenceFlow_9</bpmn2:outgoing>
- </bpmn2:startEvent>
- <bpmn2:sequenceFlow id="SequenceFlow_9" name="" sourceRef="StartEvent_1" targetRef="ScriptTask_1"/>
- </bpmn2:process>
- <bpmn2:error id="Error_1" errorCode="MSOWorkflowException" name="MSO Workflow Exception"/>
- <bpmn2:message id="Message_1" name="WorkflowMessage"/>
- <bpmndi:BPMNDiagram id="BPMNDiagram_1">
- <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="vnfAdapterRestV1">
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_56" bpmnElement="ScriptTask_1">
- <dc:Bounds height="80.0" width="100.0" x="204.0" y="148.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_SubProcess_14" bpmnElement="waitForAsyncMessage" isExpanded="true">
- <dc:Bounds height="154.0" width="265.0" x="744.0" y="275.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_58" bpmnElement="ScriptTask_6">
- <dc:Bounds height="80.0" width="100.0" x="1046.0" y="311.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_59" bpmnElement="ScriptTask_5">
- <dc:Bounds height="80.0" width="100.0" x="827.0" y="492.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_BoundaryEvent_24" bpmnElement="BoundaryEvent_1">
- <dc:Bounds height="36.0" width="36.0" x="859.0" y="411.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="22.0" width="52.0" x="894.0" y="441.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_IntermediateCatchEvent_20" bpmnElement="IntermediateCatchEvent_1">
- <dc:Bounds height="36.0" width="36.0" x="863.0" y="330.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="22.0" width="76.0" x="843.0" y="371.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_78" bpmnElement="ScriptTask_4">
- <dc:Bounds height="80.0" width="97.0" x="744.0" y="148.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_79" bpmnElement="ScriptTask_2">
- <dc:Bounds height="80.0" width="100.0" x="492.0" y="148.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_StartEvent_54" bpmnElement="StartEvent_1">
- <dc:Bounds height="36.0" width="36.0" x="84.0" y="170.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="22.0" width="34.0" x="85.0" y="211.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_168" bpmnElement="ScriptTask_3">
- <dc:Bounds height="80.0" width="97.0" x="744.0" y="24.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_2" bpmnElement="SequenceFlow_9" sourceElement="_BPMNShape_StartEvent_54" targetElement="_BPMNShape_ScriptTask_56">
- <di:waypoint xsi:type="dc:Point" x="120.0" y="188.0"/>
- <di:waypoint xsi:type="dc:Point" x="204.0" y="188.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="130.0" y="188.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_105" bpmnElement="ExclusiveGateway_1" isMarkerVisible="true">
- <dc:Bounds height="50.0" width="50.0" x="624.0" y="162.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="649.0" y="217.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_18" bpmnElement="SequenceFlow_14" sourceElement="_BPMNShape_ScriptTask_79" targetElement="_BPMNShape_ExclusiveGateway_105">
- <di:waypoint xsi:type="dc:Point" x="592.0" y="188.0"/>
- <di:waypoint xsi:type="dc:Point" x="624.0" y="187.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="611.0" y="187.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_19" bpmnElement="SequenceFlow_17" sourceElement="_BPMNShape_ExclusiveGateway_105" targetElement="_BPMNShape_ScriptTask_168">
- <di:waypoint xsi:type="dc:Point" x="649.0" y="162.0"/>
- <di:waypoint xsi:type="dc:Point" x="649.0" y="64.0"/>
- <di:waypoint xsi:type="dc:Point" x="744.0" y="64.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="22.0" width="27.0" x="688.0" y="64.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_20" bpmnElement="SequenceFlow_23" sourceElement="_BPMNShape_ExclusiveGateway_105" targetElement="_BPMNShape_ScriptTask_78">
- <di:waypoint xsi:type="dc:Point" x="674.0" y="187.0"/>
- <di:waypoint xsi:type="dc:Point" x="709.0" y="187.0"/>
- <di:waypoint xsi:type="dc:Point" x="709.0" y="188.0"/>
- <di:waypoint xsi:type="dc:Point" x="744.0" y="188.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="22.0" width="35.0" x="684.0" y="188.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_25" bpmnElement="SequenceFlow_24" sourceElement="_BPMNShape_ExclusiveGateway_105" targetElement="_BPMNShape_SubProcess_14">
- <di:waypoint xsi:type="dc:Point" x="649.0" y="212.0"/>
- <di:waypoint xsi:type="dc:Point" x="649.0" y="353.0"/>
- <di:waypoint xsi:type="dc:Point" x="708.0" y="353.0"/>
- <di:waypoint xsi:type="dc:Point" x="744.0" y="353.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="22.0" width="27.0" x="688.0" y="328.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_StartEvent_55" bpmnElement="StartEvent_3">
- <dc:Bounds height="36.0" width="36.0" x="768.0" y="330.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="786.0" y="371.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_27" bpmnElement="SequenceFlow_25" sourceElement="_BPMNShape_StartEvent_55" targetElement="_BPMNShape_IntermediateCatchEvent_20">
- <di:waypoint xsi:type="dc:Point" x="804.0" y="348.0"/>
- <di:waypoint xsi:type="dc:Point" x="863.0" y="348.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="833.0" y="348.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_EndEvent_156" bpmnElement="EndEvent_2">
- <dc:Bounds height="36.0" width="36.0" x="948.0" y="330.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="966.0" y="371.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_28" bpmnElement="SequenceFlow_26" sourceElement="_BPMNShape_IntermediateCatchEvent_20" targetElement="_BPMNShape_EndEvent_156">
- <di:waypoint xsi:type="dc:Point" x="899.0" y="348.0"/>
- <di:waypoint xsi:type="dc:Point" x="929.0" y="348.0"/>
- <di:waypoint xsi:type="dc:Point" x="929.0" y="347.0"/>
- <di:waypoint xsi:type="dc:Point" x="948.0" y="348.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="926.0" y="348.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_29" bpmnElement="SequenceFlow_27" sourceElement="_BPMNShape_BoundaryEvent_24" targetElement="_BPMNShape_ScriptTask_59">
- <di:waypoint xsi:type="dc:Point" x="877.0" y="447.0"/>
- <di:waypoint xsi:type="dc:Point" x="877.0" y="492.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="874.0" y="472.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_30" bpmnElement="SequenceFlow_28" sourceElement="_BPMNShape_SubProcess_14" targetElement="_BPMNShape_ScriptTask_58">
- <di:waypoint xsi:type="dc:Point" x="1008.0" y="351.0"/>
- <di:waypoint xsi:type="dc:Point" x="1046.0" y="351.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="1023.0" y="351.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_106" bpmnElement="ExclusiveGateway_2" isMarkerVisible="true">
- <dc:Bounds height="50.0" width="50.0" x="1188.0" y="325.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="38.0" width="71.0" x="1179.0" y="288.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_EndEvent_158" bpmnElement="EndEvent_6">
- <dc:Bounds height="36.0" width="36.0" x="1463.0" y="333.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="22.0" width="60.0" x="1451.0" y="374.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_33" bpmnElement="SequenceFlow_31" sourceElement="_BPMNShape_ExclusiveGateway_106" targetElement="_BPMNShape_ScriptTask_236">
- <di:waypoint xsi:type="dc:Point" x="1238.0" y="350.0"/>
- <di:waypoint xsi:type="dc:Point" x="1308.0" y="350.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="22.0" width="20.0" x="1248.0" y="350.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_EndEvent_159" bpmnElement="EndEvent_7">
- <dc:Bounds height="36.0" width="36.0" x="1196.0" y="426.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="1214.0" y="467.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_34" bpmnElement="SequenceFlow_32" sourceElement="_BPMNShape_ExclusiveGateway_106" targetElement="_BPMNShape_EndEvent_159">
- <di:waypoint xsi:type="dc:Point" x="1213.0" y="375.0"/>
- <di:waypoint xsi:type="dc:Point" x="1213.0" y="392.0"/>
- <di:waypoint xsi:type="dc:Point" x="1214.0" y="392.0"/>
- <di:waypoint xsi:type="dc:Point" x="1214.0" y="426.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="22.0" width="27.0" x="1223.0" y="390.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_35" bpmnElement="SequenceFlow_33" sourceElement="_BPMNShape_ScriptTask_58" targetElement="_BPMNShape_ExclusiveGateway_106">
- <di:waypoint xsi:type="dc:Point" x="1146.0" y="351.0"/>
- <di:waypoint xsi:type="dc:Point" x="1173.0" y="351.0"/>
- <di:waypoint xsi:type="dc:Point" x="1173.0" y="350.0"/>
- <di:waypoint xsi:type="dc:Point" x="1188.0" y="350.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="1170.0" y="350.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_EndEvent_160" bpmnElement="EndEvent_8">
- <dc:Bounds height="36.0" width="36.0" x="974.0" y="514.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="992.0" y="555.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_36" bpmnElement="SequenceFlow_34" sourceElement="_BPMNShape_ScriptTask_59" targetElement="_BPMNShape_EndEvent_160">
- <di:waypoint xsi:type="dc:Point" x="927.0" y="532.0"/>
- <di:waypoint xsi:type="dc:Point" x="974.0" y="532.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="951.0" y="532.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_EndEvent_161" bpmnElement="EndEvent_9">
- <dc:Bounds height="36.0" width="36.0" x="891.0" y="46.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="909.0" y="87.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_37" bpmnElement="SequenceFlow_35" sourceElement="_BPMNShape_ScriptTask_168" targetElement="_BPMNShape_EndEvent_161">
- <di:waypoint xsi:type="dc:Point" x="840.0" y="64.0"/>
- <di:waypoint xsi:type="dc:Point" x="891.0" y="64.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="865.0" y="64.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_EndEvent_162" bpmnElement="EndEvent_10">
- <dc:Bounds height="36.0" width="36.0" x="892.0" y="170.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="910.0" y="211.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_38" bpmnElement="SequenceFlow_36" sourceElement="_BPMNShape_ScriptTask_78" targetElement="_BPMNShape_EndEvent_162">
- <di:waypoint xsi:type="dc:Point" x="840.0" y="188.0"/>
- <di:waypoint xsi:type="dc:Point" x="892.0" y="188.0"/>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_236" bpmnElement="ScriptTask_setSuccess">
- <dc:Bounds height="83.0" width="97.0" x="1308.0" y="309.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="_BPMNShape_ScriptTask_236" targetElement="_BPMNShape_EndEvent_158">
- <di:waypoint xsi:type="dc:Point" x="1404.0" y="350.0"/>
- <di:waypoint xsi:type="dc:Point" x="1422.0" y="350.0"/>
- <di:waypoint xsi:type="dc:Point" x="1422.0" y="351.0"/>
- <di:waypoint xsi:type="dc:Point" x="1463.0" y="351.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="1419.0" y="351.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_237" bpmnElement="ScriptTask_7">
- <dc:Bounds height="83.0" width="97.0" x="360.0" y="146.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="SequenceFlow_2" sourceElement="_BPMNShape_ScriptTask_56" targetElement="_BPMNShape_ScriptTask_237">
- <di:waypoint xsi:type="dc:Point" x="304.0" y="188.0"/>
- <di:waypoint xsi:type="dc:Point" x="344.0" y="188.0"/>
- <di:waypoint xsi:type="dc:Point" x="344.0" y="187.0"/>
- <di:waypoint xsi:type="dc:Point" x="360.0" y="187.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="317.0" y="188.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_4" bpmnElement="SequenceFlow_3" sourceElement="_BPMNShape_ScriptTask_237" targetElement="_BPMNShape_ScriptTask_79">
- <di:waypoint xsi:type="dc:Point" x="456.0" y="187.0"/>
- <di:waypoint xsi:type="dc:Point" x="474.0" y="187.0"/>
- <di:waypoint xsi:type="dc:Point" x="474.0" y="188.0"/>
- <di:waypoint xsi:type="dc:Point" x="492.0" y="188.0"/>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="_BPMNShape_SubProcess_24" bpmnElement="SubProcess_1" isExpanded="true">
- <dc:Bounds height="181.0" width="382.0" x="180.0" y="532.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_StartEvent_66" bpmnElement="StartEvent_2">
- <dc:Bounds height="36.0" width="36.0" x="225.0" y="605.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="243.0" y="646.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_EndEvent_207" bpmnElement="EndEvent_1">
- <dc:Bounds height="36.0" width="36.0" x="477.0" y="605.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="495.0" y="646.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_266" bpmnElement="ScriptTask_8">
- <dc:Bounds height="83.0" width="97.0" x="323.0" y="581.0"/>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_5" bpmnElement="SequenceFlow_4" sourceElement="_BPMNShape_StartEvent_66" targetElement="_BPMNShape_ScriptTask_266">
- <di:waypoint xsi:type="dc:Point" x="261.0" y="623.0"/>
- <di:waypoint xsi:type="dc:Point" x="323.0" y="622.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="273.0" y="623.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_6" bpmnElement="SequenceFlow_5" sourceElement="_BPMNShape_ScriptTask_266" targetElement="_BPMNShape_EndEvent_207">
- <di:waypoint xsi:type="dc:Point" x="419.0" y="622.0"/>
- <di:waypoint xsi:type="dc:Point" x="477.0" y="623.0"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="445.0" y="623.0"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- </bpmndi:BPMNPlane>
- </bpmndi:BPMNDiagram>
+<?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" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd" id="_GraPIIyxEeWmdMDkx6Uftw" exporter="camunda modeler" exporterVersion="2.7.0" targetNamespace="http://camunda.org/schema/1.0/bpmn">
+ <bpmn2:process id="vnfAdapterRestV1" name="vnfAdapterRestV1" isExecutable="true">
+ <bpmn2:scriptTask id="ScriptTask_2" name="Log Response" scriptFormat="groovy">
+ <bpmn2:incoming>SequenceFlow_3</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_14</bpmn2:outgoing>
+ <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
+def vnfAdapterRestV1 = new VnfAdapterRestV1()
+def statusCode = execution.getVariable('VNFREST_vnfAdapterStatusCode')
+String response = String.valueOf(execution.getVariable('VNFREST_vnfAdapterResponse'))
+def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+def processKey = vnfAdapterRestV1.getProcessKey(execution)
+vnfAdapterRestV1.logDebug(processKey + " received response from VnfAdapter: statusCode=" + statusCode +
+ " response=" + (response.isEmpty() ? "" : "\n") + response, isDebugLogEnabled)]]></bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:scriptTask id="ScriptTask_3" name="Workflow Exception (no connection)">
+ <bpmn2:incoming>SequenceFlow_17</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_35</bpmn2:outgoing>
+ <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
+def exceptionUtil = new ExceptionUtil()
+exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Failed to communicate with VnfAdapter")]]></bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:scriptTask id="ScriptTask_4" name="Workflow Exception (bad response)" scriptFormat="groovy">
+ <bpmn2:incoming>SequenceFlow_23</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_36</bpmn2:outgoing>
+ <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
+
+String res = execution.getVariable(VNFREST_vnfAdapterResponse)
+
+def vnfAdapterRestV1 = new VnfAdapterRestV1()
+vnfAdapterRestV1.vnfAdapterWorkflowException(execution, res)]]></bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_14" name="" sourceRef="ScriptTask_2" targetRef="ExclusiveGateway_1"/>
+ <bpmn2:exclusiveGateway id="ExclusiveGateway_1" default="SequenceFlow_23">
+ <bpmn2:incoming>SequenceFlow_14</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_17</bpmn2:outgoing>
+ <bpmn2:outgoing>SequenceFlow_23</bpmn2:outgoing>
+ <bpmn2:outgoing>SequenceFlow_24</bpmn2:outgoing>
+ </bpmn2:exclusiveGateway>
+ <bpmn2:sequenceFlow id="SequenceFlow_17" name="404" sourceRef="ExclusiveGateway_1" targetRef="ScriptTask_3">
+ <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("VNFREST_vnfAdapterStatusCode") == '404'}]]></bpmn2:conditionExpression>
+ </bpmn2:sequenceFlow>
+ <bpmn2:sequenceFlow id="SequenceFlow_23" name="other" sourceRef="ExclusiveGateway_1" targetRef="ScriptTask_4"/>
+ <bpmn2:sequenceFlow id="SequenceFlow_24" name="2xx" sourceRef="ExclusiveGateway_1" targetRef="waitForAsyncMessage">
+ <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("VNFREST_vnfAdapterStatusCode") == '200' || execution.getVariable("VNFREST_vnfAdapterStatusCode") == '202'}]]></bpmn2:conditionExpression>
+ </bpmn2:sequenceFlow>
+ <bpmn2:boundaryEvent id="BoundaryEvent_1" name="Timeout" attachedToRef="waitForAsyncMessage">
+ <bpmn2:outgoing>SequenceFlow_27</bpmn2:outgoing>
+ <bpmn2:timerEventDefinition id="TimerEventDefinition_1">
+ <bpmn2:timeDuration xsi:type="bpmn2:tFormalExpression">${URN_mso_po_timeout}</bpmn2:timeDuration>
+ </bpmn2:timerEventDefinition>
+ </bpmn2:boundaryEvent>
+ <bpmn2:subProcess id="waitForAsyncMessage" name="Wait for Callback">
+ <bpmn2:incoming>SequenceFlow_24</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_28</bpmn2:outgoing>
+ <bpmn2:intermediateCatchEvent id="IntermediateCatchEvent_1" name="Catch Event">
+ <bpmn2:incoming>SequenceFlow_25</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_26</bpmn2:outgoing>
+ <bpmn2:messageEventDefinition id="MessageEventDefinition_1" messageRef="Message_1"/>
+ </bpmn2:intermediateCatchEvent>
+ <bpmn2:sequenceFlow id="SequenceFlow_26" name="" sourceRef="IntermediateCatchEvent_1" targetRef="EndEvent_2"/>
+ <bpmn2:startEvent id="StartEvent_3">
+ <bpmn2:outgoing>SequenceFlow_25</bpmn2:outgoing>
+ </bpmn2:startEvent>
+ <bpmn2:sequenceFlow id="SequenceFlow_25" name="" sourceRef="StartEvent_3" targetRef="IntermediateCatchEvent_1"/>
+ <bpmn2:endEvent id="EndEvent_2">
+ <bpmn2:incoming>SequenceFlow_26</bpmn2:incoming>
+ </bpmn2:endEvent>
+ </bpmn2:subProcess>
+ <bpmn2:sequenceFlow id="SequenceFlow_27" name="" sourceRef="BoundaryEvent_1" targetRef="ScriptTask_5"/>
+ <bpmn2:scriptTask id="ScriptTask_5" name="Workflow Exception (timeout)" scriptFormat="groovy">
+ <bpmn2:incoming>SequenceFlow_27</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_34</bpmn2:outgoing>
+ <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
+def exceptionUtil = new ExceptionUtil()
+exceptionUtil.buildAndThrowWorkflowException(execution, 7010, "VnfAdapter Callback Timeout Error")]]></bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_28" name="" sourceRef="waitForAsyncMessage" targetRef="ScriptTask_6"/>
+ <bpmn2:scriptTask id="ScriptTask_6" name="Process Callback" scriptFormat="groovy">
+ <bpmn2:incoming>SequenceFlow_28</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_33</bpmn2:outgoing>
+ <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
+def vnfAdapterRestV1 = new VnfAdapterRestV1()
+vnfAdapterRestV1.processCallback(execution)
+]]></bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_33" name="" sourceRef="ScriptTask_6" targetRef="ExclusiveGateway_2"/>
+ <bpmn2:sequenceFlow id="SequenceFlow_34" name="" sourceRef="ScriptTask_5" targetRef="EndEvent_8"/>
+ <bpmn2:endEvent id="EndEvent_8">
+ <bpmn2:incoming>SequenceFlow_34</bpmn2:incoming>
+ <bpmn2:errorEventDefinition id="_ErrorEventDefinition_21" errorRef="Error_1"/>
+ </bpmn2:endEvent>
+ <bpmn2:sequenceFlow id="SequenceFlow_35" name="" sourceRef="ScriptTask_3" targetRef="EndEvent_9"/>
+ <bpmn2:endEvent id="EndEvent_9">
+ <bpmn2:incoming>SequenceFlow_35</bpmn2:incoming>
+ <bpmn2:errorEventDefinition id="_ErrorEventDefinition_22" errorRef="Error_1"/>
+ </bpmn2:endEvent>
+ <bpmn2:endEvent id="EndEvent_10">
+ <bpmn2:incoming>SequenceFlow_36</bpmn2:incoming>
+ <bpmn2:errorEventDefinition id="_ErrorEventDefinition_23" errorRef="Error_1"/>
+ </bpmn2:endEvent>
+ <bpmn2:sequenceFlow id="SequenceFlow_36" name="" sourceRef="ScriptTask_4" targetRef="EndEvent_10"/>
+ <bpmn2:endEvent id="EndEvent_7">
+ <bpmn2:incoming>SequenceFlow_32</bpmn2:incoming>
+ <bpmn2:errorEventDefinition id="_ErrorEventDefinition_20" errorRef="Error_1"/>
+ </bpmn2:endEvent>
+ <bpmn2:exclusiveGateway id="ExclusiveGateway_2" name="Callback&#xD;&#xA;Exception?" default="SequenceFlow_31">
+ <bpmn2:incoming>SequenceFlow_33</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_31</bpmn2:outgoing>
+ <bpmn2:outgoing>SequenceFlow_32</bpmn2:outgoing>
+ </bpmn2:exclusiveGateway>
+ <bpmn2:sequenceFlow id="SequenceFlow_31" name="no" sourceRef="ExclusiveGateway_2" targetRef="ScriptTask_setSuccess"/>
+ <bpmn2:sequenceFlow id="SequenceFlow_32" name="yes" sourceRef="ExclusiveGateway_2" targetRef="EndEvent_7">
+ <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("WorkflowException") != null}]]></bpmn2:conditionExpression>
+ </bpmn2:sequenceFlow>
+ <bpmn2:scriptTask id="ScriptTask_setSuccess" name="Set Success Indicator" scriptFormat="groovy">
+ <bpmn2:incoming>SequenceFlow_31</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing>
+ <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
+def vnfAdapterRestV1 = new VnfAdapterRestV1()
+vnfAdapterRestV1.setSuccessIndicator(execution, true)]]></bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_1" name="" sourceRef="ScriptTask_setSuccess" targetRef="EndEvent_6"/>
+ <bpmn2:endEvent id="EndEvent_6" name="End Flow">
+ <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming>
+ </bpmn2:endEvent>
+ <bpmn2:scriptTask id="ScriptTask_7" name="Send Request to Vnf Adapter" scriptFormat="groovy">
+ <bpmn2:incoming>SequenceFlow_2</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_3</bpmn2:outgoing>
+ <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
+def vnfAdapterRestV1 = new VnfAdapterRestV1()
+vnfAdapterRestV1.sendRequestToVnfAdapter(execution)]]></bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_3" name="" sourceRef="ScriptTask_7" targetRef="ScriptTask_2"/>
+ <bpmn2:subProcess id="SubProcess_1" name="Error Handling Sub Process" triggeredByEvent="true">
+ <bpmn2:scriptTask id="ScriptTask_8" name="Process Error" 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 exUtil = new ExceptionUtil()
+exUtil.processSubflowsBPMNException(execution)
+]]></bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_5" name="" sourceRef="ScriptTask_8" targetRef="EndEvent_1"/>
+ <bpmn2:endEvent id="EndEvent_1">
+ <bpmn2:incoming>SequenceFlow_5</bpmn2:incoming>
+ </bpmn2:endEvent>
+ <bpmn2:startEvent id="StartEvent_2">
+ <bpmn2:outgoing>SequenceFlow_4</bpmn2:outgoing>
+ <bpmn2:errorEventDefinition id="_ErrorEventDefinition_89"/>
+ </bpmn2:startEvent>
+ <bpmn2:sequenceFlow id="SequenceFlow_4" name="" sourceRef="StartEvent_2" targetRef="ScriptTask_8"/>
+ </bpmn2:subProcess>
+ <bpmn2:scriptTask id="ScriptTask_1" name="Pre-Process Request" scriptFormat="groovy">
+ <bpmn2:incoming>SequenceFlow_9</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_2</bpmn2:outgoing>
+ <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
+def vnfAdapterRestV1 = new VnfAdapterRestV1()
+vnfAdapterRestV1.preProcessRequest(execution)
+]]></bpmn2:script>
+ </bpmn2:scriptTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_2" name="" sourceRef="ScriptTask_1" targetRef="ScriptTask_7"/>
+ <bpmn2:startEvent id="StartEvent_1" name="Start">
+ <bpmn2:outgoing>SequenceFlow_9</bpmn2:outgoing>
+ </bpmn2:startEvent>
+ <bpmn2:sequenceFlow id="SequenceFlow_9" name="" sourceRef="StartEvent_1" targetRef="ScriptTask_1"/>
+ </bpmn2:process>
+ <bpmn2:error id="Error_1" errorCode="MSOWorkflowException" name="MSO Workflow Exception"/>
+ <bpmn2:message id="Message_1" name="WorkflowMessage"/>
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="vnfAdapterRestV1">
+ <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_56" bpmnElement="ScriptTask_1">
+ <dc:Bounds height="80.0" width="100.0" x="204.0" y="148.0"/>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_SubProcess_14" bpmnElement="waitForAsyncMessage" isExpanded="true">
+ <dc:Bounds height="154.0" width="265.0" x="744.0" y="275.0"/>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_58" bpmnElement="ScriptTask_6">
+ <dc:Bounds height="80.0" width="100.0" x="1046.0" y="311.0"/>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_59" bpmnElement="ScriptTask_5">
+ <dc:Bounds height="80.0" width="100.0" x="827.0" y="492.0"/>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_BoundaryEvent_24" bpmnElement="BoundaryEvent_1">
+ <dc:Bounds height="36.0" width="36.0" x="859.0" y="411.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="22.0" width="52.0" x="894.0" y="441.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_IntermediateCatchEvent_20" bpmnElement="IntermediateCatchEvent_1">
+ <dc:Bounds height="36.0" width="36.0" x="863.0" y="330.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="22.0" width="76.0" x="843.0" y="371.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_78" bpmnElement="ScriptTask_4">
+ <dc:Bounds height="80.0" width="97.0" x="744.0" y="148.0"/>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_79" bpmnElement="ScriptTask_2">
+ <dc:Bounds height="80.0" width="100.0" x="492.0" y="148.0"/>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_54" bpmnElement="StartEvent_1">
+ <dc:Bounds height="36.0" width="36.0" x="84.0" y="170.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="22.0" width="34.0" x="85.0" y="211.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_168" bpmnElement="ScriptTask_3">
+ <dc:Bounds height="80.0" width="97.0" x="744.0" y="24.0"/>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_2" bpmnElement="SequenceFlow_9" sourceElement="_BPMNShape_StartEvent_54" targetElement="_BPMNShape_ScriptTask_56">
+ <di:waypoint xsi:type="dc:Point" x="120.0" y="188.0"/>
+ <di:waypoint xsi:type="dc:Point" x="204.0" y="188.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="6.0" width="6.0" x="130.0" y="188.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_105" bpmnElement="ExclusiveGateway_1" isMarkerVisible="true">
+ <dc:Bounds height="50.0" width="50.0" x="624.0" y="162.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="0.0" width="0.0" x="649.0" y="217.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_18" bpmnElement="SequenceFlow_14" sourceElement="_BPMNShape_ScriptTask_79" targetElement="_BPMNShape_ExclusiveGateway_105">
+ <di:waypoint xsi:type="dc:Point" x="592.0" y="188.0"/>
+ <di:waypoint xsi:type="dc:Point" x="624.0" y="187.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="6.0" width="6.0" x="611.0" y="187.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_19" bpmnElement="SequenceFlow_17" sourceElement="_BPMNShape_ExclusiveGateway_105" targetElement="_BPMNShape_ScriptTask_168">
+ <di:waypoint xsi:type="dc:Point" x="649.0" y="162.0"/>
+ <di:waypoint xsi:type="dc:Point" x="649.0" y="64.0"/>
+ <di:waypoint xsi:type="dc:Point" x="744.0" y="64.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="22.0" width="27.0" x="688.0" y="64.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_20" bpmnElement="SequenceFlow_23" sourceElement="_BPMNShape_ExclusiveGateway_105" targetElement="_BPMNShape_ScriptTask_78">
+ <di:waypoint xsi:type="dc:Point" x="674.0" y="187.0"/>
+ <di:waypoint xsi:type="dc:Point" x="709.0" y="187.0"/>
+ <di:waypoint xsi:type="dc:Point" x="709.0" y="188.0"/>
+ <di:waypoint xsi:type="dc:Point" x="744.0" y="188.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="22.0" width="35.0" x="684.0" y="188.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_25" bpmnElement="SequenceFlow_24" sourceElement="_BPMNShape_ExclusiveGateway_105" targetElement="_BPMNShape_SubProcess_14">
+ <di:waypoint xsi:type="dc:Point" x="649.0" y="212.0"/>
+ <di:waypoint xsi:type="dc:Point" x="649.0" y="353.0"/>
+ <di:waypoint xsi:type="dc:Point" x="708.0" y="353.0"/>
+ <di:waypoint xsi:type="dc:Point" x="744.0" y="353.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="22.0" width="27.0" x="688.0" y="328.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_55" bpmnElement="StartEvent_3">
+ <dc:Bounds height="36.0" width="36.0" x="768.0" y="330.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="0.0" width="0.0" x="786.0" y="371.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_27" bpmnElement="SequenceFlow_25" sourceElement="_BPMNShape_StartEvent_55" targetElement="_BPMNShape_IntermediateCatchEvent_20">
+ <di:waypoint xsi:type="dc:Point" x="804.0" y="348.0"/>
+ <di:waypoint xsi:type="dc:Point" x="863.0" y="348.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="6.0" width="6.0" x="833.0" y="348.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_EndEvent_156" bpmnElement="EndEvent_2">
+ <dc:Bounds height="36.0" width="36.0" x="948.0" y="330.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="0.0" width="0.0" x="966.0" y="371.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_28" bpmnElement="SequenceFlow_26" sourceElement="_BPMNShape_IntermediateCatchEvent_20" targetElement="_BPMNShape_EndEvent_156">
+ <di:waypoint xsi:type="dc:Point" x="899.0" y="348.0"/>
+ <di:waypoint xsi:type="dc:Point" x="929.0" y="348.0"/>
+ <di:waypoint xsi:type="dc:Point" x="929.0" y="347.0"/>
+ <di:waypoint xsi:type="dc:Point" x="948.0" y="348.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="6.0" width="6.0" x="926.0" y="348.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_29" bpmnElement="SequenceFlow_27" sourceElement="_BPMNShape_BoundaryEvent_24" targetElement="_BPMNShape_ScriptTask_59">
+ <di:waypoint xsi:type="dc:Point" x="877.0" y="447.0"/>
+ <di:waypoint xsi:type="dc:Point" x="877.0" y="492.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="6.0" width="6.0" x="874.0" y="472.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_30" bpmnElement="SequenceFlow_28" sourceElement="_BPMNShape_SubProcess_14" targetElement="_BPMNShape_ScriptTask_58">
+ <di:waypoint xsi:type="dc:Point" x="1008.0" y="351.0"/>
+ <di:waypoint xsi:type="dc:Point" x="1046.0" y="351.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="6.0" width="6.0" x="1023.0" y="351.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_106" bpmnElement="ExclusiveGateway_2" isMarkerVisible="true">
+ <dc:Bounds height="50.0" width="50.0" x="1188.0" y="325.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="38.0" width="71.0" x="1179.0" y="288.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_EndEvent_158" bpmnElement="EndEvent_6">
+ <dc:Bounds height="36.0" width="36.0" x="1463.0" y="333.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="22.0" width="60.0" x="1451.0" y="374.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_33" bpmnElement="SequenceFlow_31" sourceElement="_BPMNShape_ExclusiveGateway_106" targetElement="_BPMNShape_ScriptTask_236">
+ <di:waypoint xsi:type="dc:Point" x="1238.0" y="350.0"/>
+ <di:waypoint xsi:type="dc:Point" x="1308.0" y="350.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="22.0" width="20.0" x="1248.0" y="350.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_EndEvent_159" bpmnElement="EndEvent_7">
+ <dc:Bounds height="36.0" width="36.0" x="1196.0" y="426.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="0.0" width="0.0" x="1214.0" y="467.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_34" bpmnElement="SequenceFlow_32" sourceElement="_BPMNShape_ExclusiveGateway_106" targetElement="_BPMNShape_EndEvent_159">
+ <di:waypoint xsi:type="dc:Point" x="1213.0" y="375.0"/>
+ <di:waypoint xsi:type="dc:Point" x="1213.0" y="392.0"/>
+ <di:waypoint xsi:type="dc:Point" x="1214.0" y="392.0"/>
+ <di:waypoint xsi:type="dc:Point" x="1214.0" y="426.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="22.0" width="27.0" x="1223.0" y="390.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_35" bpmnElement="SequenceFlow_33" sourceElement="_BPMNShape_ScriptTask_58" targetElement="_BPMNShape_ExclusiveGateway_106">
+ <di:waypoint xsi:type="dc:Point" x="1146.0" y="351.0"/>
+ <di:waypoint xsi:type="dc:Point" x="1173.0" y="351.0"/>
+ <di:waypoint xsi:type="dc:Point" x="1173.0" y="350.0"/>
+ <di:waypoint xsi:type="dc:Point" x="1188.0" y="350.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="6.0" width="6.0" x="1170.0" y="350.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_EndEvent_160" bpmnElement="EndEvent_8">
+ <dc:Bounds height="36.0" width="36.0" x="974.0" y="514.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="0.0" width="0.0" x="992.0" y="555.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_36" bpmnElement="SequenceFlow_34" sourceElement="_BPMNShape_ScriptTask_59" targetElement="_BPMNShape_EndEvent_160">
+ <di:waypoint xsi:type="dc:Point" x="927.0" y="532.0"/>
+ <di:waypoint xsi:type="dc:Point" x="974.0" y="532.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="6.0" width="6.0" x="951.0" y="532.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_EndEvent_161" bpmnElement="EndEvent_9">
+ <dc:Bounds height="36.0" width="36.0" x="891.0" y="46.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="0.0" width="0.0" x="909.0" y="87.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_37" bpmnElement="SequenceFlow_35" sourceElement="_BPMNShape_ScriptTask_168" targetElement="_BPMNShape_EndEvent_161">
+ <di:waypoint xsi:type="dc:Point" x="840.0" y="64.0"/>
+ <di:waypoint xsi:type="dc:Point" x="891.0" y="64.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="6.0" width="6.0" x="865.0" y="64.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_EndEvent_162" bpmnElement="EndEvent_10">
+ <dc:Bounds height="36.0" width="36.0" x="892.0" y="170.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="0.0" width="0.0" x="910.0" y="211.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_38" bpmnElement="SequenceFlow_36" sourceElement="_BPMNShape_ScriptTask_78" targetElement="_BPMNShape_EndEvent_162">
+ <di:waypoint xsi:type="dc:Point" x="840.0" y="188.0"/>
+ <di:waypoint xsi:type="dc:Point" x="892.0" y="188.0"/>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_236" bpmnElement="ScriptTask_setSuccess">
+ <dc:Bounds height="83.0" width="97.0" x="1308.0" y="309.0"/>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="_BPMNShape_ScriptTask_236" targetElement="_BPMNShape_EndEvent_158">
+ <di:waypoint xsi:type="dc:Point" x="1404.0" y="350.0"/>
+ <di:waypoint xsi:type="dc:Point" x="1422.0" y="350.0"/>
+ <di:waypoint xsi:type="dc:Point" x="1422.0" y="351.0"/>
+ <di:waypoint xsi:type="dc:Point" x="1463.0" y="351.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="6.0" width="6.0" x="1419.0" y="351.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_237" bpmnElement="ScriptTask_7">
+ <dc:Bounds height="83.0" width="97.0" x="360.0" y="146.0"/>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="SequenceFlow_2" sourceElement="_BPMNShape_ScriptTask_56" targetElement="_BPMNShape_ScriptTask_237">
+ <di:waypoint xsi:type="dc:Point" x="304.0" y="188.0"/>
+ <di:waypoint xsi:type="dc:Point" x="344.0" y="188.0"/>
+ <di:waypoint xsi:type="dc:Point" x="344.0" y="187.0"/>
+ <di:waypoint xsi:type="dc:Point" x="360.0" y="187.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="6.0" width="6.0" x="317.0" y="188.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_4" bpmnElement="SequenceFlow_3" sourceElement="_BPMNShape_ScriptTask_237" targetElement="_BPMNShape_ScriptTask_79">
+ <di:waypoint xsi:type="dc:Point" x="456.0" y="187.0"/>
+ <di:waypoint xsi:type="dc:Point" x="474.0" y="187.0"/>
+ <di:waypoint xsi:type="dc:Point" x="474.0" y="188.0"/>
+ <di:waypoint xsi:type="dc:Point" x="492.0" y="188.0"/>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_SubProcess_24" bpmnElement="SubProcess_1" isExpanded="true">
+ <dc:Bounds height="181.0" width="382.0" x="180.0" y="532.0"/>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_66" bpmnElement="StartEvent_2">
+ <dc:Bounds height="36.0" width="36.0" x="225.0" y="605.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="0.0" width="0.0" x="243.0" y="646.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_EndEvent_207" bpmnElement="EndEvent_1">
+ <dc:Bounds height="36.0" width="36.0" x="477.0" y="605.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="0.0" width="0.0" x="495.0" y="646.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_ScriptTask_266" bpmnElement="ScriptTask_8">
+ <dc:Bounds height="83.0" width="97.0" x="323.0" y="581.0"/>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_5" bpmnElement="SequenceFlow_4" sourceElement="_BPMNShape_StartEvent_66" targetElement="_BPMNShape_ScriptTask_266">
+ <di:waypoint xsi:type="dc:Point" x="261.0" y="623.0"/>
+ <di:waypoint xsi:type="dc:Point" x="323.0" y="622.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="6.0" width="6.0" x="273.0" y="623.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_6" bpmnElement="SequenceFlow_5" sourceElement="_BPMNShape_ScriptTask_266" targetElement="_BPMNShape_EndEvent_207">
+ <di:waypoint xsi:type="dc:Point" x="419.0" y="622.0"/>
+ <di:waypoint xsi:type="dc:Point" x="477.0" y="623.0"/>
+ <bpmndi:BPMNLabel>
+ <dc:Bounds height="6.0" width="6.0" x="445.0" y="623.0"/>
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
</bpmn2:definitions> \ No newline at end of file
diff --git a/bpmn/MSOCommonBPMN/src/main/webapp/WEB-INF/jboss-deployment-structure.xml b/bpmn/MSOCommonBPMN/src/main/webapp/WEB-INF/jboss-deployment-structure.xml
index 130f95e171..3dbfcce36f 100644
--- a/bpmn/MSOCommonBPMN/src/main/webapp/WEB-INF/jboss-deployment-structure.xml
+++ b/bpmn/MSOCommonBPMN/src/main/webapp/WEB-INF/jboss-deployment-structure.xml
@@ -1,31 +1,31 @@
-<!--
- ============LICENSE_START=======================================================
- ECOMP 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=========================================================
- -->
-
-<jboss-deployment-structure>
- <deployment>
- <!-- Exclusions allow you to prevent the server from automatically adding some dependencies -->
- <exclusions>
- <module name="org.apache.log4j" />
- <module name="org.slf4j" />
- <module name="org.slf4j.impl" />
- </exclusions>
- </deployment>
-</jboss-deployment-structure>
-
+<!--
+ ============LICENSE_START=======================================================
+ ECOMP 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=========================================================
+ -->
+
+<jboss-deployment-structure>
+ <deployment>
+ <!-- Exclusions allow you to prevent the server from automatically adding some dependencies -->
+ <exclusions>
+ <module name="org.apache.log4j" />
+ <module name="org.slf4j" />
+ <module name="org.slf4j.impl" />
+ </exclusions>
+ </deployment>
+</jboss-deployment-structure>
+
diff --git a/bpmn/MSOCommonBPMN/src/main/webapp/WEB-INF/jboss-web.xml b/bpmn/MSOCommonBPMN/src/main/webapp/WEB-INF/jboss-web.xml
index f15ade0a70..a9a263b684 100644
--- a/bpmn/MSOCommonBPMN/src/main/webapp/WEB-INF/jboss-web.xml
+++ b/bpmn/MSOCommonBPMN/src/main/webapp/WEB-INF/jboss-web.xml
@@ -1,26 +1,26 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ============LICENSE_START=======================================================
- ECOMP 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=========================================================
- -->
-
-<!DOCTYPE jboss-web PUBLIC "-//JBoss//DTD Web Application 5.0//EN" "http://www.jboss.org/j2ee/dtd/jboss-web_5_0.dtd">
-<jboss-web>
- <security-domain>other</security-domain>
- <context-root>/mso/common</context-root>
-</jboss-web>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ============LICENSE_START=======================================================
+ ECOMP 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=========================================================
+ -->
+
+<!DOCTYPE jboss-web PUBLIC "-//JBoss//DTD Web Application 5.0//EN" "http://www.jboss.org/j2ee/dtd/jboss-web_5_0.dtd">
+<jboss-web>
+ <security-domain>other</security-domain>
+ <context-root>/mso/common</context-root>
+</jboss-web>
diff --git a/bpmn/MSOCommonBPMN/src/main/webapp/WEB-INF/web.xml b/bpmn/MSOCommonBPMN/src/main/webapp/WEB-INF/web.xml
index 0b3e4cf10b..6c822a9be5 100644
--- a/bpmn/MSOCommonBPMN/src/main/webapp/WEB-INF/web.xml
+++ b/bpmn/MSOCommonBPMN/src/main/webapp/WEB-INF/web.xml
@@ -1,74 +1,74 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ============LICENSE_START=======================================================
- ECOMP 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=========================================================
- -->
-<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
- <display-name>MSO Common BPMN Workflow Servlet</display-name>
- <servlet>
- <servlet-name>resteasy-servlet</servlet-name>
- <servlet-class>org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher</servlet-class>
- <init-param>
- <param-name>javax.ws.rs.Application</param-name>
- <param-value>org.openecomp.mso.bpmn.common.workflow.service.WorkflowResourceApplication</param-value>
- </init-param>
- </servlet>
- <servlet-mapping>
- <servlet-name>resteasy-servlet</servlet-name>
- <url-pattern>/*</url-pattern>
- </servlet-mapping>
- <context-param>
- <param-name>mso.configuration</param-name>
- <param-value>MSO_PROP_TOPOLOGY=topology.properties</param-value>
- </context-param>
- <context-param>
- <param-name>log.configuration</param-name>
- <param-value>logback.bpmn.xml</param-value>
- </context-param>
- <context-param>
- <param-name>resteasy.resources</param-name>
- <param-value>org.openecomp.mso.logger.MsoLoggingServlet,org.openecomp.mso.bpmn.core.HealthCheckHandler</param-value>
- </context-param>
- <filter>
- <filter-name>LogFilter</filter-name>
- <filter-class>org.openecomp.mso.logger.LogFilter</filter-class>
- </filter>
- <filter-mapping>
- <filter-name>LogFilter</filter-name>
- <url-pattern>/*</url-pattern>
- </filter-mapping>
- <security-constraint>
- <web-resource-collection>
- <web-resource-name>HTTPBasicAuth</web-resource-name>
- <description>Authentication for Client Apps</description>
- <url-pattern>/workflow/*</url-pattern>
- <http-method>GET</http-method>
- <http-method>POST</http-method>
- </web-resource-collection>
- <auth-constraint>
- <role-name>BPMN-Client</role-name>
- </auth-constraint>
- </security-constraint>
- <login-config>
- <auth-method>BASIC</auth-method>
- <realm-name>ApplicationRealm</realm-name>
- </login-config>
- <security-role>
- <role-name>BPMN-Client</role-name>
- </security-role>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ============LICENSE_START=======================================================
+ ECOMP 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=========================================================
+ -->
+<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
+ <display-name>MSO Common BPMN Workflow Servlet</display-name>
+ <servlet>
+ <servlet-name>resteasy-servlet</servlet-name>
+ <servlet-class>org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher</servlet-class>
+ <init-param>
+ <param-name>javax.ws.rs.Application</param-name>
+ <param-value>org.openecomp.mso.bpmn.common.workflow.service.WorkflowResourceApplication</param-value>
+ </init-param>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>resteasy-servlet</servlet-name>
+ <url-pattern>/*</url-pattern>
+ </servlet-mapping>
+ <context-param>
+ <param-name>mso.configuration</param-name>
+ <param-value>MSO_PROP_TOPOLOGY=topology.properties</param-value>
+ </context-param>
+ <context-param>
+ <param-name>log.configuration</param-name>
+ <param-value>logback.bpmn.xml</param-value>
+ </context-param>
+ <context-param>
+ <param-name>resteasy.resources</param-name>
+ <param-value>org.openecomp.mso.logger.MsoLoggingServlet,org.openecomp.mso.bpmn.core.HealthCheckHandler</param-value>
+ </context-param>
+ <filter>
+ <filter-name>LogFilter</filter-name>
+ <filter-class>org.openecomp.mso.logger.LogFilter</filter-class>
+ </filter>
+ <filter-mapping>
+ <filter-name>LogFilter</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+ <security-constraint>
+ <web-resource-collection>
+ <web-resource-name>HTTPBasicAuth</web-resource-name>
+ <description>Authentication for Client Apps</description>
+ <url-pattern>/workflow/*</url-pattern>
+ <http-method>GET</http-method>
+ <http-method>POST</http-method>
+ </web-resource-collection>
+ <auth-constraint>
+ <role-name>BPMN-Client</role-name>
+ </auth-constraint>
+ </security-constraint>
+ <login-config>
+ <auth-method>BASIC</auth-method>
+ <realm-name>ApplicationRealm</realm-name>
+ </login-config>
+ <security-role>
+ <role-name>BPMN-Client</role-name>
+ </security-role>
</web-app> \ No newline at end of file