From 38f720752af4d4aad8c4e467a288d9048659f688 Mon Sep 17 00:00:00 2001 From: Rob Daugherty Date: Wed, 14 Mar 2018 02:07:32 -0400 Subject: AT&T 1712 and 1802 release code This is code from AT&T's 1712 and 1802 releases. Change-Id: Ie1e85851e94bc66c4d9514a0226c221939531a04 Issue-ID: SO-425 Signed-off-by: Rob Daugherty --- .../scripts/CreateCustomE2EServiceInstance.groovy | 642 +++--- .../CreateGenericALaCarteServiceInstance.groovy | 96 +- .../scripts/CreateNetworkInstance.groovy | 24 +- .../scripts/CreateSDNCNetworkResource.groovy | 8 +- .../scripts/CreateVFCNSResource.groovy | 31 +- .../scripts/CreateVfModuleInfra.groovy | 27 +- .../scripts/CreateVfModuleVolumeInfraV1.groovy | 28 +- .../infrastructure/scripts/CreateVnfInfra.groovy | 81 +- .../scripts/DeleteCustomE2EServiceInstance.groovy | 96 +- .../DeleteGenericALaCarteServiceInstance.groovy | 18 +- .../scripts/DeleteNetworkInstance.groovy | 22 +- .../scripts/DeleteVfModuleInfra.groovy | 21 +- .../scripts/DeleteVfModuleVolumeInfraV1.groovy | 28 +- .../infrastructure/scripts/DeleteVnfInfra.groovy | 10 +- .../scripts/DoCreateE2EServiceInstance.groovy | 22 +- .../DoCreateE2EServiceInstanceRollback.groovy | 12 +- .../scripts/DoCreateE2EServiceInstanceV2.groovy | 57 +- .../scripts/DoCreateNetworkInstance.groovy | 74 +- .../scripts/DoCreateNetworkInstanceRollback.groovy | 12 +- .../scripts/DoCreateServiceInstance.groovy | 290 ++- .../scripts/DoCreateServiceInstanceRollback.groovy | 12 +- .../DoCreateServiceInstanceRollbackV2.groovy | 51 + .../scripts/DoCreateServiceInstanceV2.groovy | 101 + .../infrastructure/scripts/DoCreateVfModule.groovy | 316 ++- .../scripts/DoCreateVfModuleRollback.groovy | 50 +- .../scripts/DoCreateVfModuleVolumeRollback.groovy | 12 +- .../scripts/DoCreateVfModuleVolumeV2.groovy | 84 +- .../bpmn/infrastructure/scripts/DoCreateVnf.groovy | 67 +- .../scripts/DoCreateVnfAndModules.groovy | 21 +- .../scripts/DoCreateVnfAndModulesRollback.groovy | 25 +- .../DoCustomDeleteE2EServiceInstance.groovy | 20 +- .../DoCustomDeleteE2EServiceInstanceV2.groovy | 66 +- .../scripts/DoDeleteNetworkInstance.groovy | 44 +- .../scripts/DoDeleteNetworkInstanceRollback.groovy | 10 +- .../scripts/DoDeleteServiceInstance.groovy | 100 +- .../DoDeleteVFCNetworkServiceInstance.groovy | 22 +- .../infrastructure/scripts/DoDeleteVfModule.groovy | 112 +- .../scripts/DoDeleteVfModuleFromVnf.groovy | 28 +- .../scripts/DoDeleteVfModuleVolumeV2.groovy | 16 +- .../bpmn/infrastructure/scripts/DoDeleteVnf.groovy | 6 +- .../scripts/DoDeleteVnfAndModules.groovy | 94 +- .../scripts/DoUpdateE2EServiceInstance.groovy | 24 +- .../scripts/DoUpdateNetworkInstance.groovy | 62 +- .../scripts/DoUpdateNetworkInstanceRollback.groovy | 10 +- .../infrastructure/scripts/DoUpdateVfModule.groovy | 78 +- .../scripts/DoUpdateVnfAndModules.groovy | 39 +- .../scripts/HealchCheckActivate.groovy | 6 +- .../infrastructure/scripts/ReplaceVnfInfra.groovy | 380 ++-- .../bpmn/infrastructure/scripts/RollbackVnf.groovy | 153 ++ .../scripts/UpdateCustomE2EServiceInstance.groovy | 12 +- .../scripts/UpdateNetworkInstance.groovy | 24 +- .../infrastructure/scripts/UpdateVfModule.groovy | 16 +- .../scripts/UpdateVfModuleInfra.groovy | 20 +- .../scripts/UpdateVfModuleInfraV2.groovy | 41 +- .../scripts/UpdateVfModuleVolume.groovy | 20 +- .../scripts/UpdateVfModuleVolumeInfraV1.groovy | 28 +- .../infrastructure/scripts/UpdateVnfInfra.groovy | 395 +--- .../bpmn/infrastructure/scripts/VnfCmBase.groovy | 806 +++++++ .../infrastructure/scripts/VnfConfigUpdate.groovy | 503 +++++ .../infrastructure/scripts/VnfInPlaceUpdate.groovy | 622 ++++++ .../vcpe/scripts/CreateVcpeResCustService.groovy | 1482 ++++++------- .../vcpe/scripts/DeleteVcpeResCustService.groovy | 26 +- .../scripts/DoCreateAllottedResourceBRG.groovy | 36 +- .../DoCreateAllottedResourceBRGRollback.groovy | 16 +- .../scripts/DoCreateAllottedResourceTXC.groovy | 36 +- .../DoCreateAllottedResourceTXCRollback.groovy | 16 +- .../scripts/DoDeleteAllottedResourceBRG.groovy | 26 +- .../scripts/DoDeleteAllottedResourceTXC.groovy | 26 +- .../AAITasks/AAICreateOwningEntity.java | 50 + .../infrastructure/AAITasks/AAICreateProject.java | 50 + .../AAITasks/AAICreateServiceInstance.java | 50 + .../RollbackAAIServiceInstance.java | 56 + .../DoCreateServiceInstance/RollbackError.java | 38 + .../SetupServiceDecomp.java | 112 + .../MSOInfrastructureApplication.java | 2 +- .../SDNCTasks/SDNCCreateServiceInstance.java | 49 + .../infrastructure/aai/AAICreateResources.java | 84 + .../aai/AAIDeleteServiceInstance.java | 49 + .../infrastructure/aai/AAIServiceInstance.java | 94 + .../SdncNetworkTopologyOperationTask.java | 4 +- .../SdncServiceTopologyOperationTask.java | 11 +- .../serviceTask/SdncUnderlayVpnPreprocessTask.java | 2 +- .../src/main/resources/META-INF/persistence.xml | 2 +- .../process/CreateCustomE2EServiceInstance.bpmn | 9 +- .../CreateGenericALaCarteServiceInstance.bpmn | 281 ++- .../resources/process/CreateNetworkInstance.bpmn | 55 +- .../resources/process/CreateVFCNSResource.bpmn | 8 +- .../process/CreateVcpeResCustService.bpmn | 3 +- .../resources/process/CreateVfModuleInfra.bpmn | 1 + .../src/main/resources/process/CreateVnfInfra.bpmn | 78 +- .../process/DeleteCustomE2EServiceInstance.bpmn | 74 +- .../resources/process/DeleteNetworkInstance.bpmn | 264 +-- .../resources/process/DeleteVfModuleInfra.bpmn | 1 + .../main/resources/process/ReplaceVnfInfra.bpmn | 1705 ++++++++++----- .../src/main/resources/process/UpdateVnfInfra.bpmn | 1563 ++++++++----- .../main/resources/process/VnfConfigUpdate.bpmn | 1631 ++++++++++++++ .../main/resources/process/VnfInPlaceUpdate.bpmn | 2290 ++++++++++++++++++++ .../subprocess/CreateServiceInstanceV3.bpmn | 146 ++ .../CreateServiceInstanceV3Rollback.bpmn | 97 + .../subprocess/DoCreateServiceInstance.bpmn | 252 ++- .../DoCreateServiceInstanceRollback.bpmn | 68 +- .../DoCreateServiceInstanceRollbackV2.bpmn | 103 + .../subprocess/DoCreateServiceInstanceV2.bpmn | 197 ++ .../resources/subprocess/DoCreateVfModule.bpmn | 856 ++++++-- .../subprocess/DoCreateVfModuleRollback.bpmn | 255 ++- .../subprocess/DoCreateVfModuleVolumeV2.bpmn | 4 +- .../src/main/resources/subprocess/DoCreateVnf.bpmn | 1 + .../subprocess/DoCreateVnfAndModules.bpmn | 4 +- .../subprocess/DoCreateVnfAndModulesRollback.bpmn | 3 +- .../DoCustomDeleteE2EServiceInstance.bpmn | 2 +- .../subprocess/DoDeleteServiceInstance.bpmn | 14 +- .../resources/subprocess/DoDeleteVfModule.bpmn | 228 +- .../subprocess/DoDeleteVnfAndModules.bpmn | 2 + .../subprocess/DoUpdateVnfAndModules.bpmn | 1 + .../src/main/resources/subprocess/RollbackVnf.bpmn | 343 +++ .../subprocess/SetRefactorServiceDecomp.bpmn | 68 + .../src/main/webapp/WEB-INF/web.xml | 9 +- 117 files changed, 14598 insertions(+), 4430 deletions(-) create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateServiceInstanceRollbackV2.groovy create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateServiceInstanceV2.groovy create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/RollbackVnf.groovy create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/VnfCmBase.groovy create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/VnfConfigUpdate.groovy create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/VnfInPlaceUpdate.groovy create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/AAITasks/AAICreateOwningEntity.java create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/AAITasks/AAICreateProject.java create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/AAITasks/AAICreateServiceInstance.java create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/DoCreateServiceInstance/RollbackAAIServiceInstance.java create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/DoCreateServiceInstance/RollbackError.java create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/DoCreateServiceInstance/SetupServiceDecomp.java create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/SDNCTasks/SDNCCreateServiceInstance.java create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/aai/AAICreateResources.java create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/aai/AAIDeleteServiceInstance.java create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/aai/AAIServiceInstance.java create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/process/VnfConfigUpdate.bpmn create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/process/VnfInPlaceUpdate.bpmn create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/CreateServiceInstanceV3.bpmn create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/CreateServiceInstanceV3Rollback.bpmn create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateServiceInstanceRollbackV2.bpmn create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateServiceInstanceV2.bpmn create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/RollbackVnf.bpmn create mode 100644 bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/SetRefactorServiceDecomp.bpmn (limited to 'bpmn/MSOInfrastructureBPMN/src/main') diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy index 450c5b1147..1464aedc5c 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy @@ -1,321 +1,341 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.mso.bpmn.infrastructure.scripts; - -import static org.apache.commons.lang3.StringUtils.*; -import groovy.xml.XmlUtil -import groovy.json.* -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil - -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.rest.APIResponse - -import java.util.List; -import java.util.UUID; - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.runtime.Execution -import org.apache.commons.lang3.* -import org.apache.commons.codec.binary.Base64; -import org.springframework.web.util.UriUtils - -/** - * This groovy class supports the CreateServiceInstance.bpmn process. - * AlaCarte flow for 1702 ServiceInstance Create - * - */ -public class CreateCustomE2EServiceInstance extends AbstractServiceTaskProcessor { - String Prefix="CRESI_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtil = new JsonUtils() - - - public void preProcessRequest (Execution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - execution.setVariable("prefix",Prefix) - String msg = "" - utils.log("INFO", " *** preProcessRequest() *** ", isDebugEnabled) - - try { - - String siRequest = execution.getVariable("bpmnRequest") - utils.logAudit(siRequest) - - String requestId = execution.getVariable("mso-request-id") - execution.setVariable("msoRequestId", requestId) - utils.log("INFO", "Input Request:" + siRequest + " reqId:" + requestId, isDebugEnabled) - - String serviceInstanceId = execution.getVariable("serviceInstanceId") - if (isBlank(serviceInstanceId)) { - serviceInstanceId = UUID.randomUUID().toString() - } - utils.log("INFO", "Generated new Service Instance:" + serviceInstanceId, isDebugEnabled) - serviceInstanceId = UriUtils.encode(serviceInstanceId,"UTF-8") - execution.setVariable("serviceInstanceId", serviceInstanceId) - - //subscriberInfo - String globalSubscriberId = jsonUtil.getJsonValue(siRequest, "requestDetails.subscriberInfo.globalSubscriberId") - if (isBlank(globalSubscriberId)) { - msg = "Input globalSubscriberId' is null" - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } else { - execution.setVariable("globalSubscriberId", globalSubscriberId) - } - - //requestInfo - execution.setVariable("source", jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.source")) - execution.setVariable("serviceInstanceName", jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.instanceName")) - execution.setVariable("disableRollback", jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.suppressRollback")) - String productFamilyId = jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.productFamilyId") - if (isBlank(productFamilyId)) - { - msg = "Input productFamilyId is null" - utils.log("INFO", msg, isDebugEnabled) - //exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } else { - execution.setVariable("productFamilyId", productFamilyId) - } - String userParams = jsonUtil.getJsonValue(siRequest, "requestDetails.requestParameters.userParams") - utils.log("INFO", "userParams:" + userParams, isDebugEnabled) - List paramList = jsonUtil.StringArrayToList(execution, userParams) - String uuiRequest = jsonUtil.getJsonValue(paramList.get(0), "UUIRequest") - //modelInfo - if (isBlank(uuiRequest)) { - msg = "Input uuiRequest is null" - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } else - { - execution.setVariable("uuiRequest", uuiRequest) - } - - utils.log("INFO", "uuiRequest:\n" + uuiRequest, isDebugEnabled) - - //requestParameters - String serviceType = jsonUtil.getJsonValue(uuiRequest, "service.parameters.serviceType") - if (isBlank(serviceType)) { - msg = "Input serviceType is null" - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } else { - execution.setVariable("serviceType", serviceType) - } - execution.setVariable("URN_mso_adapters_openecomp_db_endpoint","http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter") - - } catch (BpmnError e) { - throw e; - } catch (Exception ex){ - msg = "Exception in preProcessRequest " + ex.getMessage() - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("INFO"," ***** Exit preProcessRequest *****", isDebugEnabled) - } - - public void sendSyncResponse (Execution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO", " *** sendSyncResponse *** ", isDebugEnabled) - - try { - String operationId = execution.getVariable("operationId") - String serviceInstanceId = execution.getVariable("serviceInstanceId") - // RESTResponse for API Handler (APIH) Reply Task - String createServiceRestRequest = """{"service":{"serviceId":"${serviceInstanceId}","operationId":"${operationId}"}}""".trim() - utils.log("INFO", " sendSyncResponse to APIH:" + "\n" + createServiceRestRequest, isDebugEnabled) - sendWorkflowResponse(execution, 202, createServiceRestRequest) - execution.setVariable("sentSyncResponse", true) - - } catch (Exception ex) { - String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage() - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("INFO"," ***** Exit sendSyncResopnse *****", isDebugEnabled) - } - - - public void sendSyncError (Execution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO", " *** sendSyncError *** ", isDebugEnabled) - - try { - String errorMessage = "" - if (execution.getVariable("WorkflowException") instanceof WorkflowException) { - WorkflowException wfe = execution.getVariable("WorkflowException") - errorMessage = wfe.getErrorMessage() - } else { - errorMessage = "Sending Sync Error." - } - - String buildworkflowException = +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.infrastructure.scripts; + +import static org.apache.commons.lang3.StringUtils.*; +import groovy.xml.XmlUtil +import groovy.json.* +import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil + +import org.openecomp.mso.bpmn.core.WorkflowException +import org.openecomp.mso.bpmn.core.json.JsonUtils +import org.openecomp.mso.rest.APIResponse + +import java.util.UUID; + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.apache.commons.lang3.* +import org.apache.commons.codec.binary.Base64; +import org.springframework.web.util.UriUtils + +/** + * This groovy class supports the CreateServiceInstance.bpmn process. + * AlaCarte flow for 1702 ServiceInstance Create + * + */ +public class CreateCustomE2EServiceInstance extends AbstractServiceTaskProcessor { + String Prefix="CRESI_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + + + public void preProcessRequest (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + String msg = "" + utils.log("DEBUG", " *** preProcessRequest() *** ", isDebugEnabled) + + try { + + String siRequest = execution.getVariable("bpmnRequest") + utils.logAudit(siRequest) + + String requestId = execution.getVariable("mso-request-id") + execution.setVariable("msoRequestId", requestId) + utils.log("DEBUG", "Input Request:" + siRequest + " reqId:" + requestId, isDebugEnabled) + + String serviceInstanceId = execution.getVariable("serviceInstanceId") + if (isBlank(serviceInstanceId)) { + serviceInstanceId = UUID.randomUUID().toString() + } + utils.log("DEBUG", "Generated new Service Instance:" + serviceInstanceId, isDebugEnabled) + serviceInstanceId = UriUtils.encode(serviceInstanceId,"UTF-8") + execution.setVariable("serviceInstanceId", serviceInstanceId) + + //subscriberInfo + String globalSubscriberId = jsonUtil.getJsonValue(siRequest, "requestDetails.subscriberInfo.globalSubscriberId") + if (isBlank(globalSubscriberId)) { + msg = "Input globalSubscriberId' is null" + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } else { + execution.setVariable("globalSubscriberId", globalSubscriberId) + } + + //requestInfo + execution.setVariable("source", jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.source")) + execution.setVariable("serviceInstanceName", jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.instanceName")) + execution.setVariable("disableRollback", jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.suppressRollback")) + String productFamilyId = jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.productFamilyId") + if (isBlank(productFamilyId)) + { + msg = "Input productFamilyId is null" + utils.log("DEBUG", msg, isDebugEnabled) + //exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } else { + execution.setVariable("productFamilyId", productFamilyId) + } + + //modelInfo + String serviceModelInfo = jsonUtil.getJsonValue(siRequest, "requestDetails.modelInfo") + if (isBlank(serviceModelInfo)) { + msg = "Input serviceModelInfo is null" + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } else + { + execution.setVariable("serviceModelInfo", serviceModelInfo) + } + + utils.log("DEBUG", "modelInfo" + serviceModelInfo, isDebugEnabled) + + //requestParameters + String subscriptionServiceType = jsonUtil.getJsonValue(siRequest, "requestDetails.requestParameters.subscriptionServiceType") + if (isBlank(subscriptionServiceType)) { + msg = "Input subscriptionServiceType is null" + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } else { + execution.setVariable("subscriptionServiceType", subscriptionServiceType) + } + + + /* + * Extracting User Parameters from incoming Request and converting into a Map + */ + def jsonSlurper = new JsonSlurper() + def jsonOutput = new JsonOutput() + + Map reqMap = jsonSlurper.parseText(siRequest) + + //InputParams + def userParams = reqMap.requestDetails?.requestParameters?.userParams + + Map inputMap = [:] + if (userParams) { + userParams.each { + userParam -> inputMap.put(userParam.name, userParam.value.toString()) + } + } + + utils.log("DEBUG", "User Input Parameters map: " + userParams.toString(), isDebugEnabled) + execution.setVariable("serviceInputParams", inputMap) + execution.setVariable("URN_mso_adapters_openecomp_db_endpoint","http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter") + //TODO + //execution.setVariable("serviceInputParams", jsonUtil.getJsonValue(siRequest, "requestDetails.requestParameters.userParams")) + //execution.setVariable("failExists", true) + + } catch (BpmnError e) { + throw e; + } catch (Exception ex){ + msg = "Exception in preProcessRequest " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("DEBUG"," ***** Exit preProcessRequest *****", isDebugEnabled) + } + + public void sendSyncResponse (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG", " *** sendSyncResponse *** ", isDebugEnabled) + + try { + String operationId = execution.getVariable("operationId") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + // RESTResponse for API Handler (APIH) Reply Task + String createServiceRestRequest = """{"service":{"serviceId":"${serviceInstanceId}","operationId":"${operationId}"}}""".trim() + utils.log("DEBUG", " sendSyncResponse to APIH:" + "\n" + createServiceRestRequest, isDebugEnabled) + sendWorkflowResponse(execution, 202, createServiceRestRequest) + execution.setVariable("sentSyncResponse", true) + + } catch (Exception ex) { + String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("DEBUG"," ***** Exit sendSyncResopnse *****", isDebugEnabled) + } + + + public void sendSyncError (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG", " *** sendSyncError *** ", isDebugEnabled) + + try { + String errorMessage = "" + if (execution.getVariable("WorkflowException") instanceof WorkflowException) { + WorkflowException wfe = execution.getVariable("WorkflowException") + errorMessage = wfe.getErrorMessage() + } else { + errorMessage = "Sending Sync Error." + } + + String buildworkflowException = """ - ${errorMessage} - 7000 - """ - - utils.logAudit(buildworkflowException) - sendWorkflowResponse(execution, 500, buildworkflowException) - - } catch (Exception ex) { - utils.log("INFO", " Sending Sync Error Activity Failed. " + "\n" + ex.getMessage(), isDebugEnabled) - } - - } - - public void prepareCompletionRequest (Execution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO", " *** prepareCompletion *** ", isDebugEnabled) - - try { - String requestId = execution.getVariable("msoRequestId") - String serviceInstanceId = execution.getVariable("serviceInstanceId") - String source = execution.getVariable("source") - - String msoCompletionRequest = + ${errorMessage} + 7000 + """ + + utils.logAudit(buildworkflowException) + sendWorkflowResponse(execution, 500, buildworkflowException) + + } catch (Exception ex) { + utils.log("DEBUG", " Sending Sync Error Activity Failed. " + "\n" + ex.getMessage(), isDebugEnabled) + } + + } + + public void prepareCompletionRequest (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG", " *** prepareCompletion *** ", isDebugEnabled) + + try { + String requestId = execution.getVariable("msoRequestId") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String source = execution.getVariable("source") + + String msoCompletionRequest = """ - ${requestId} - CREATE - ${source} - - Service Instance was created successfully. - ${serviceInstanceId} - CreateGenericALaCarteServiceInstance - """ - - // Format Response - String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest) - - execution.setVariable("completionRequest", xmlMsoCompletionRequest) - utils.log("INFO", " Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest, isDebugEnabled) - - } catch (Exception ex) { - String msg = " Exception in prepareCompletion:" + ex.getMessage() - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("INFO", "*** Exit prepareCompletionRequest ***", isDebugEnabled) - } - - public void prepareFalloutRequest(Execution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO", " *** prepareFalloutRequest *** ", isDebugEnabled) - - try { - WorkflowException wfex = execution.getVariable("WorkflowException") - utils.log("INFO", " Input Workflow Exception: " + wfex.toString(), isDebugEnabled) - String requestId = execution.getVariable("msoRequestId") - String source = execution.getVariable("source") - String requestInfo = + ${requestId} + CREATE + ${source} + + Service Instance was created successfully. + ${serviceInstanceId} + CreateGenericALaCarteServiceInstance + """ + + // Format Response + String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest) + + execution.setVariable("completionRequest", xmlMsoCompletionRequest) + utils.log("DEBUG", " Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest, isDebugEnabled) + + } catch (Exception ex) { + String msg = " Exception in prepareCompletion:" + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("DEBUG", "*** Exit prepareCompletionRequest ***", isDebugEnabled) + } + + public void prepareFalloutRequest(DelegateExecution execution){ + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG", " *** prepareFalloutRequest *** ", isDebugEnabled) + + try { + WorkflowException wfex = execution.getVariable("WorkflowException") + utils.log("DEBUG", " Input Workflow Exception: " + wfex.toString(), isDebugEnabled) + String requestId = execution.getVariable("msoRequestId") + String source = execution.getVariable("source") + String requestInfo = """ - ${requestId} - CREATE - ${source} - """ - - String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo) - execution.setVariable("falloutRequest", falloutRequest) - } catch (Exception ex) { - utils.log("INFO", "Exception prepareFalloutRequest:" + ex.getMessage(), isDebugEnabled) - String errorException = " Bpmn error encountered in CreateGenericALaCarteServiceInstance flow. FalloutHandlerRequest, buildErrorResponse() - " + ex.getMessage() - String requestId = execution.getVariable("msoRequestId") - String falloutRequest = + ${requestId} + CREATE + ${source} + """ + + String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo) + execution.setVariable("falloutRequest", falloutRequest) + } catch (Exception ex) { + utils.log("DEBUG", "Exception prepareFalloutRequest:" + ex.getMessage(), isDebugEnabled) + String errorException = " Bpmn error encountered in CreateGenericALaCarteServiceInstance flow. FalloutHandlerRequest, buildErrorResponse() - " + ex.getMessage() + String requestId = execution.getVariable("msoRequestId") + String falloutRequest = """ - ${requestId} - CREATE - UUI - + ${requestId} + CREATE + UUI + - ${errorException} - 7000 - - """ - - execution.setVariable("falloutRequest", falloutRequest) - } - utils.log("INFO", "*** Exit prepareFalloutRequest ***", isDebugEnabled) - } - - /** - * Init the service Operation Status - */ - public void prepareInitServiceOperationStatus(Execution execution){ - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO", " ======== STARTED prepareInitServiceOperationStatus Process ======== ", isDebugEnabled) - try{ - String serviceId = execution.getVariable("serviceInstanceId") - String operationId = UUID.randomUUID().toString() - String serviceName = execution.getVariable("serviceInstanceName") - String operationType = "CREATE" - String userId = "" - String result = "processing" - String progress = "0" - String reason = "" - String operationContent = "Prepare service creation" - utils.log("INFO", "Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId, isDebugEnabled) - serviceId = UriUtils.encode(serviceId,"UTF-8") - execution.setVariable("serviceInstanceId", serviceId) - execution.setVariable("operationId", operationId) - execution.setVariable("operationType", operationType) - - def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint") - execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) - utils.log("INFO", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled) - - String payload = - """ - - - - ${serviceId} - ${operationId} - ${serviceName} - ${operationType} - ${userId} - ${result} - ${operationContent} - ${progress} - ${reason} - - - """ - - payload = utils.formatXml(payload) - execution.setVariable("CVFMI_updateServiceOperStatusRequest", payload) - utils.log("INFO", "Outgoing updateServiceOperStatusRequest: \n" + payload, isDebugEnabled) - utils.logAudit("CreateVfModuleInfra Outgoing updateServiceOperStatusRequest Request: " + payload) - - }catch(Exception e){ - utils.log("ERROR", "Exception Occured Processing prepareInitServiceOperationStatus. Exception is:\n" + e, isDebugEnabled) - execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during prepareInitServiceOperationStatus Method:\n" + e.getMessage()) - } - utils.log("INFO", "======== COMPLETED prepareInitServiceOperationStatus Process ======== ", isDebugEnabled) - } - -} + ${errorException} + 7000 + + """ + + execution.setVariable("falloutRequest", falloutRequest) + } + utils.log("DEBUG", "*** Exit prepareFalloutRequest ***", isDebugEnabled) + } + + /** + * Init the service Operation Status + */ + public void prepareInitServiceOperationStatus(DelegateExecution execution){ + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG", " ======== STARTED prepareInitServiceOperationStatus Process ======== ", isDebugEnabled) + try{ + String serviceId = execution.getVariable("serviceInstanceId") + String operationId = UUID.randomUUID().toString() + String operationType = "CREATE" + String userId = "" + String result = "processing" + String progress = "0" + String reason = "" + String operationContent = "Prepare service creation" + utils.log("DEBUG", "Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId, isDebugEnabled) + serviceId = UriUtils.encode(serviceId,"UTF-8") + execution.setVariable("serviceInstanceId", serviceId) + execution.setVariable("operationId", operationId) + execution.setVariable("operationType", operationType) + + def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint") + execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) + utils.log("DEBUG", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled) + + String payload = + """ + + + + ${serviceId} + ${operationId} + ${operationType} + ${userId} + ${result} + ${operationContent} + ${progress} + ${reason} + + + """ + + payload = utils.formatXml(payload) + execution.setVariable("CVFMI_updateServiceOperStatusRequest", payload) + utils.log("DEBUG", "Outgoing updateServiceOperStatusRequest: \n" + payload, isDebugEnabled) + utils.logAudit("CreateVfModuleInfra Outgoing updateServiceOperStatusRequest Request: " + payload) + + }catch(Exception e){ + utils.log("ERROR", "Exception Occured Processing prepareInitServiceOperationStatus. Exception is:\n" + e, isDebugEnabled) + execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during prepareInitServiceOperationStatus Method:\n" + e.getMessage()) + } + utils.log("DEBUG", "======== COMPLETED prepareInitServiceOperationStatus Process ======== ", isDebugEnabled) + } + +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateGenericALaCarteServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateGenericALaCarteServiceInstance.groovy index 80d714893d..0de28f77ce 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateGenericALaCarteServiceInstance.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateGenericALaCarteServiceInstance.groovy @@ -25,7 +25,7 @@ import groovy.xml.XmlUtil import groovy.json.* import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.openecomp.mso.bpmn.common.scripts.VidUtils +import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition import org.openecomp.mso.bpmn.core.WorkflowException import org.openecomp.mso.bpmn.core.json.JsonUtils import org.openecomp.mso.rest.APIResponse @@ -33,7 +33,7 @@ import org.openecomp.mso.rest.APIResponse import java.util.UUID; import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.runtime.Execution +import org.camunda.bpm.engine.delegate.DelegateExecution import org.apache.commons.lang3.* import org.apache.commons.codec.binary.Base64; import org.springframework.web.util.UriUtils @@ -48,13 +48,12 @@ public class CreateGenericALaCarteServiceInstance extends AbstractServiceTaskPro String Prefix="CRESI_" ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() - VidUtils vidUtils = new VidUtils() - public void preProcessRequest (Execution execution) { + public void preProcessRequest (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) String msg = "" - utils.log("DEBUG", " *** preProcessRequest() *** ", isDebugEnabled) + utils.log("DEBUG", " *** preProcessRequest() of CreateGenericALaCarteServiceInstance *** ", isDebugEnabled) try { @@ -68,8 +67,11 @@ public class CreateGenericALaCarteServiceInstance extends AbstractServiceTaskPro String serviceInstanceId = execution.getVariable("serviceInstanceId") if (isBlank(serviceInstanceId)) { serviceInstanceId = UUID.randomUUID().toString() + utils.log("DEBUG", "Generated new Service Instance ID:" + serviceInstanceId, isDebugEnabled) + } else { + utils.log("DEBUG", "Using provided Service Instance ID:" + serviceInstanceId, isDebugEnabled) } - utils.log("DEBUG", "Generated new Service Instance:" + serviceInstanceId, isDebugEnabled) + serviceInstanceId = UriUtils.encode(serviceInstanceId,"UTF-8") execution.setVariable("serviceInstanceId", serviceInstanceId) @@ -113,7 +115,7 @@ public class CreateGenericALaCarteServiceInstance extends AbstractServiceTaskPro } utils.log("DEBUG", "modelInfo" + serviceModelInfo, isDebugEnabled) - + //requestParameters String subscriptionServiceType = jsonUtil.getJsonValue(siRequest, "requestDetails.requestParameters.subscriptionServiceType") if (isBlank(subscriptionServiceType)) { @@ -139,7 +141,7 @@ public class CreateGenericALaCarteServiceInstance extends AbstractServiceTaskPro Map inputMap = [:] if (userParams) { userParams.each { - userParam -> inputMap.put(userParam.name, userParam.value) + userParam -> inputMap.put(userParam.name, userParam.value.toString()) } } @@ -156,10 +158,10 @@ public class CreateGenericALaCarteServiceInstance extends AbstractServiceTaskPro utils.log("DEBUG", msg, isDebugEnabled) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - utils.log("DEBUG"," ***** Exit preProcessRequest *****", isDebugEnabled) + utils.log("DEBUG"," ***** Exit preProcessRequest of CreateGenericALaCarteServiceInstance *****", isDebugEnabled) } - public void sendSyncResponse (Execution execution) { + public void sendSyncResponse (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("DEBUG", " *** sendSyncResponse *** ", isDebugEnabled) @@ -181,7 +183,7 @@ public class CreateGenericALaCarteServiceInstance extends AbstractServiceTaskPro } - public void sendSyncError (Execution execution) { + public void sendSyncError (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("DEBUG", " *** sendSyncError *** ", isDebugEnabled) @@ -209,7 +211,75 @@ public class CreateGenericALaCarteServiceInstance extends AbstractServiceTaskPro } - public void prepareCompletionRequest (Execution execution) { + // ******************************* + // + // ******************************* + public void prepareDecomposeService(DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG", " ***** Inside prepareDecomposeService of CreateGenericALaCarteServiceInstance ***** ", isDebugEnabled) + try { + String siRequest = execution.getVariable("bpmnRequest") + String serviceModelInfo = jsonUtil.getJsonValue(siRequest, "requestDetails.modelInfo") + execution.setVariable("serviceModelInfo", serviceModelInfo) + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in CreateGenericALaCarteServiceInstance flow. Unexpected Error from method prepareDecomposeService() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + utils.log("DEBUG", " ***** Completed prepareDecomposeService of CreateGenericALaCarteServiceInstance ***** ", isDebugEnabled) + } + + + // ******************************* + // + // ******************************* + public void prepareCreateServiceInstance(DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + + try { + utils.log("DEBUG", " ***** Inside prepareCreateServiceInstance of CreateGenericALaCarteServiceInstance ***** ", isDebugEnabled) + + /* + * Extracting User Parameters from incoming Request and converting into a Map + */ + def jsonSlurper = new JsonSlurper() + def jsonOutput = new JsonOutput() + def siRequest = execution.getVariable("bpmnRequest") + Map reqMap = jsonSlurper.parseText(siRequest) + //InputParams + def userParams = reqMap.requestDetails?.requestParameters?.userParams + Map inputMap = [:] + if (userParams != null) { + userParams.each { + userParam -> inputMap.put(userParam.name, userParam.value) + } + } + + utils.log("DEBUG", "User Input Parameters map: " + userParams.toString(), isDebugEnabled) + execution.setVariable("serviceInputParams", inputMap) + + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + + String serviceInstanceId = execution.getVariable("serviceInstanceId") + serviceDecomposition.getServiceInstance().setInstanceId(serviceInstanceId) + + String serviceInstanceName = jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.instanceName") + serviceDecomposition.getServiceInstance().setInstanceName(serviceInstanceName) + execution.setVariable("serviceInstanceName", serviceInstanceName) + execution.setVariable("serviceDecomposition", serviceDecomposition) + execution.setVariable("serviceDecompositionString", serviceDecomposition.toJsonString()) + utils.log("DEBUG", "serviceDecomposition.serviceInstanceName: " + serviceDecomposition.getServiceInstance().getInstanceName(), isDebugEnabled) + + utils.log("DEBUG", " ***** Completed prepareCreateServiceInstance of CreateGenericALaCarteServiceInstance ***** ", isDebugEnabled) + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in CreateGenericALaCarteServiceInstance flow. Unexpected Error from method prepareCreateServiceInstance() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + + public void prepareCompletionRequest (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("DEBUG", " *** prepareCompletion *** ", isDebugEnabled) @@ -245,7 +315,7 @@ public class CreateGenericALaCarteServiceInstance extends AbstractServiceTaskPro utils.log("DEBUG", "*** Exit prepareCompletionRequest ***", isDebugEnabled) } - public void prepareFalloutRequest(Execution execution){ + public void prepareFalloutRequest(DelegateExecution execution){ def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("DEBUG", " *** prepareFalloutRequest *** ", isDebugEnabled) diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateNetworkInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateNetworkInstance.groovy index c37355ef3d..5f7d1e3452 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateNetworkInstance.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateNetworkInstance.groovy @@ -31,7 +31,7 @@ import org.openecomp.mso.rest.APIResponse import java.util.UUID; import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.runtime.Execution +import org.camunda.bpm.engine.delegate.DelegateExecution import org.apache.commons.lang3.* import org.apache.commons.codec.binary.Base64; import org.springframework.web.util.UriUtils @@ -45,7 +45,7 @@ public class CreateNetworkInstance extends AbstractServiceTaskProcessor { ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() - public InitializeProcessVariables(Execution execution){ + public InitializeProcessVariables(DelegateExecution execution){ execution.setVariable(Prefix + "source", "") execution.setVariable(Prefix + "Success", false) @@ -69,7 +69,7 @@ public class CreateNetworkInstance extends AbstractServiceTaskProcessor { * This method is executed during the preProcessRequest task of the CreateNetworkInstance.bpmn process. * @param execution */ - public void preProcessRequest (Execution execution) { + public void preProcessRequest (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) @@ -154,7 +154,7 @@ public class CreateNetworkInstance extends AbstractServiceTaskProcessor { } } - public void sendSyncResponse (Execution execution) { + public void sendSyncResponse (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) @@ -178,7 +178,7 @@ public class CreateNetworkInstance extends AbstractServiceTaskProcessor { } - public void getNetworkModelInfo (Execution execution) { + public void getNetworkModelInfo (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix", Prefix) @@ -203,7 +203,7 @@ public class CreateNetworkInstance extends AbstractServiceTaskProcessor { } - public void sendSyncError (Execution execution) { + public void sendSyncError (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix", Prefix) @@ -224,7 +224,7 @@ public class CreateNetworkInstance extends AbstractServiceTaskProcessor { } - public void prepareDBRequestError (Execution execution) { + public void prepareDBRequestError (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) @@ -272,7 +272,7 @@ public class CreateNetworkInstance extends AbstractServiceTaskProcessor { } - public void prepareCompletion (Execution execution) { + public void prepareCompletion (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) @@ -320,7 +320,7 @@ public class CreateNetworkInstance extends AbstractServiceTaskProcessor { // Post or Validate Response Section // ************************************************** - public void postProcessResponse (Execution execution) { + public void postProcessResponse (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix", Prefix) @@ -354,7 +354,7 @@ public class CreateNetworkInstance extends AbstractServiceTaskProcessor { // Build Error Section // ******************************* - public void processRollbackData (Execution execution) { + public void processRollbackData (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix", Prefix) @@ -375,7 +375,7 @@ public class CreateNetworkInstance extends AbstractServiceTaskProcessor { } // Prepare for FalloutHandler - public void buildErrorResponse (Execution execution) { + public void buildErrorResponse (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix", Prefix) @@ -436,7 +436,7 @@ public class CreateNetworkInstance extends AbstractServiceTaskProcessor { } - public void processJavaException(Execution execution){ + public void processJavaException(DelegateExecution execution){ def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) try{ diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy index 400b0d40d5..d2d93d5568 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy @@ -32,7 +32,7 @@ import org.openecomp.mso.rest.APIResponse import java.util.UUID; import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.runtime.Execution +import org.camunda.bpm.engine.delegate.DelegateExecution import org.apache.commons.lang3.* import org.apache.commons.codec.binary.Base64; import org.springframework.web.util.UriUtils @@ -60,7 +60,7 @@ public class CreateSDNCCNetworkResource extends AbstractServiceTaskProcessor { * generate the nsOperationKey * generate the nsParameters */ - public void preProcessRequest (Execution execution) { + public void preProcessRequest (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") String msg = "" utils.log("INFO", " *** preProcessRequest() *** ", isDebugEnabled) @@ -120,7 +120,7 @@ public class CreateSDNCCNetworkResource extends AbstractServiceTaskProcessor { * url: the url of the request * requestBody: the body of the request */ - private APIResponse postRequest(Execution execution, String url, String requestBody){ + private APIResponse postRequest(DelegateExecution execution, String url, String requestBody){ def isDebugEnabled = execution.getVariable("isDebugLogEnabled") utils.log("INFO"," ***** Started Execute VFC adapter Post Process *****", isDebugEnabled) utils.log("INFO","url:"+url +"\nrequestBody:"+ requestBody, isDebugEnabled) @@ -138,7 +138,7 @@ public class CreateSDNCCNetworkResource extends AbstractServiceTaskProcessor { return apiResponse } - public void postCreateSDNCCall(Execution execution){ + public void postCreateSDNCCall(DelegateExecution execution){ } } diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy index 970a4f7d07..0279c2cbc8 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy @@ -32,7 +32,7 @@ import org.openecomp.mso.rest.APIResponse import java.util.UUID; import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.runtime.Execution +import org.camunda.bpm.engine.delegate.DelegateExecution import org.apache.commons.lang3.* import org.apache.commons.codec.binary.Base64; import org.springframework.web.util.UriUtils @@ -47,20 +47,21 @@ import org.openecomp.mso.rest.APIResponse; public class CreateVFCNSResource extends AbstractServiceTaskProcessor { String vfcUrl = "/vfc/rest/v1/vfcadapter" - + String host = "http://mso.mso.testlab.openecomp.org:8080" ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() - - /**CreateVFCNSResource + + /** + * CreateVFCNSResource * Pre Process the BPMN Flow Request * Inclouds: * generate the nsOperationKey * generate the nsParameters */ - public void preProcessRequest (Execution execution) { + public void preProcessRequest (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") String msg = "" utils.log("INFO", " *** preProcessRequest() *** ", isDebugEnabled) @@ -117,7 +118,7 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor { /** * create NS task */ - public void createNetworkService(Execution execution) { + public void createNetworkService(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("INFO"," ***** createNetworkService *****", isDebugEnabled) String nsOperationKey = execution.getVariable("nsOperationKey"); @@ -144,8 +145,8 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor { /** * instantiate NS task */ - public void instantiateNetworkService(Execution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + public void instantiateNetworkService(DelegateExecution execution) { + def isDebugEnabled= execution.getVariable("isDebugLogEnabled") utils.log("INFO"," ***** instantiateNetworkService *****", isDebugEnabled) String nsOperationKey = execution.getVariable("nsOperationKey"); String nsParameters = execution.getVariable("nsParameters"); @@ -173,7 +174,7 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor { /** * query NS task */ - public void queryNSProgress(Execution execution) { + public void queryNSProgress(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("INFO"," ***** queryNSProgress *****", isDebugEnabled) String jobId = execution.getVariable("jobId") @@ -193,8 +194,8 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor { /** * delay 5 sec */ - public void timeDelay(Execution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + public void timeDelay(DelegateExecution execution) { + def isDebugEnabled= execution.getVariable("isDebugLogEnabled") try { Thread.sleep(5000); } catch(InterruptedException e) { @@ -205,7 +206,7 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor { /** * finish NS task */ - public void addNSRelationship(Execution execution) { + public void addNSRelationship(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("INFO"," ***** addNSRelationship *****", isDebugEnabled) String nsInstanceId = execution.getVariable("nsInstanceId") @@ -241,7 +242,7 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor { utils.log("INFO"," *****Exit addNSRelationship *****", isDebugEnabled) } - public APIResponse executeAAIPutCall(Execution execution, String url, String payload){ + public APIResponse executeAAIPutCall(DelegateExecution execution, String url, String payload){ def isDebugEnabled = execution.getVariable("isDebugLogEnabled") utils.log("INFO", " ======== Started Execute AAI Put Process ======== ", isDebugEnabled) APIResponse apiResponse = null @@ -265,13 +266,13 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor { } return apiResponse } - + /** * post request * url: the url of the request * requestBody: the body of the request */ - private APIResponse postRequest(Execution execution, String url, String requestBody){ + private APIResponse postRequest(DelegateExecution execution, String url, String requestBody){ def isDebugEnabled = execution.getVariable("isDebugLogEnabled") utils.log("INFO"," ***** Started Execute VFC adapter Post Process *****", isDebugEnabled) utils.log("INFO","url:"+url +"\nrequestBody:"+ requestBody, isDebugEnabled) diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy index 37ff4944ff..3b2c4ea2f8 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy @@ -24,7 +24,7 @@ import groovy.json.JsonSlurper import groovy.json.JsonOutput import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.runtime.Execution +import org.camunda.bpm.engine.delegate.DelegateExecution import org.apache.commons.lang3.* import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor; import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil; @@ -44,7 +44,7 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor { * Validates the request message and sets up the workflow. * @param execution the execution */ - public void preProcessRequest(Execution execution) { + public void preProcessRequest(DelegateExecution execution) { def method = getClass().getSimpleName() + '.preProcessRequest(' + 'execution=' + execution.getId() + ')' @@ -127,7 +127,7 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor { Map userParamsMap = [:] if (userParams != null) { userParams.each { userParam -> - userParamsMap.put(userParam.name, userParam.value) + userParamsMap.put(userParam.name, jsonOutput.toJson(userParam.value).toString()) } } @@ -171,6 +171,9 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor { def usePreload = reqMap.requestDetails?.requestParameters?.usePreload execution.setVariable(prefix + 'usePreload', usePreload) + // This is aLaCarte flow, so aLaCarte flag is always on + execution.setVariable(prefix + 'aLaCarte', true) + def cloudConfiguration = reqMap.requestDetails?.cloudConfiguration def lcpCloudRegionId = cloudConfiguration.lcpCloudRegionId execution.setVariable(prefix + 'lcpCloudRegionId', lcpCloudRegionId) @@ -239,7 +242,7 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor { * @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 validateWorkflowResponse(Execution execution, String responseVar, + public void validateWorkflowResponse(DelegateExecution execution, String responseVar, String responseCodeVar, String errorResponseVar) { SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) sdncAdapterUtils.validateSDNCResponse(execution, responseVar, responseCodeVar, errorResponseVar) @@ -250,7 +253,7 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor { * Sends the empty, synchronous response back to the API Handler. * @param execution the execution */ - public void sendResponse(Execution execution) { + public void sendResponse(DelegateExecution execution) { def method = getClass().getSimpleName() + '.sendResponse(' + 'execution=' + execution.getId() + ')' @@ -283,7 +286,7 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor { * * @param execution the execution */ - public void postProcessResponse(Execution execution){ + public void postProcessResponse(DelegateExecution execution){ def isDebugEnabled = execution.getVariable("isDebugLogEnabled") utils.log("DEBUG", " ======== STARTED PostProcessResponse Process ======== ", isDebugEnabled) @@ -329,7 +332,7 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor { * @param execution the execution * @return the validated request */ - public String validateInfraRequest(Execution execution) { + public String validateInfraRequest(DelegateExecution execution) { def method = getClass().getSimpleName() + '.validateInfraRequest(' + 'execution=' + execution.getId() + ')' @@ -392,7 +395,7 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor { } } - public void prepareUpdateInfraRequest(Execution execution){ + public void prepareUpdateInfraRequest(DelegateExecution execution){ def isDebugEnabled = execution.getVariable("isDebugLogEnabled") utils.log("DEBUG", " ======== STARTED prepareUpdateInfraRequest Process ======== ", isDebugEnabled) @@ -449,7 +452,7 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor { * @param execution the execution * @param resultVar the execution variable in which the result will be stored */ - public void falloutHandlerPrep(Execution execution, String resultVar) { + public void falloutHandlerPrep(DelegateExecution execution, String resultVar) { def method = getClass().getSimpleName() + '.falloutHandlerPrep(' + 'execution=' + execution.getId() + ', resultVar=' + resultVar + @@ -496,7 +499,7 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor { } } - public void logAndSaveOriginalException(Execution execution) { + public void logAndSaveOriginalException(DelegateExecution execution) { def method = getClass().getSimpleName() + '.validateRollbackResponse(' + 'execution=' + execution.getId() + ')' @@ -507,7 +510,7 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor { saveWorkflowException(execution, 'CVFMI_originalWorkflowException') } - public void validateRollbackResponse(Execution execution) { + public void validateRollbackResponse(DelegateExecution execution) { def method = getClass().getSimpleName() + '.validateRollbackResponse(' + 'execution=' + execution.getId() + ')' @@ -521,7 +524,7 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor { } - public void sendErrorResponse(Execution execution){ + public void sendErrorResponse(DelegateExecution execution){ def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("DEBUG", " *** STARTED CreateVfModulenfra sendErrorResponse Process *** ", isDebugEnabled) diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1.groovy index a881ed228b..49d67cb097 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1.groovy @@ -32,7 +32,7 @@ import groovy.json.JsonOutput import groovy.json.JsonSlurper import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.runtime.Execution; +import org.camunda.bpm.engine.delegate.DelegateExecution; import org.apache.commons.lang3.* class CreateVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { @@ -43,7 +43,7 @@ class CreateVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { * Perform initial processing, such as request validation, initialization of variables, etc. * * @param execution */ - public void preProcessRequest (Execution execution) { + public void preProcessRequest (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") setBasicDBAuthHeader(execution, isDebugEnabled) preProcessRequest(execution, isDebugEnabled) @@ -55,7 +55,7 @@ class CreateVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { * @param execution * @param isDebugEnabled */ - public void preProcessRequest (Execution execution, isDebugEnabled) { + public void preProcessRequest (DelegateExecution execution, isDebugEnabled) { execution.setVariable("prefix",prefix) setSuccessIndicator(execution, false) @@ -87,7 +87,7 @@ class CreateVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { * @param serviceInstanceId * @param isDebugLogEnabled */ - public void setupVariables(Execution execution, Map requestMap, isDebugLogEnabled) { + public void setupVariables(DelegateExecution execution, Map requestMap, isDebugLogEnabled) { def jsonOutput = new JsonOutput() @@ -142,7 +142,7 @@ class CreateVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { Map vfModuleInputMap = [:] userParams.each { userParam -> - vfModuleInputMap.put(userParam.name, userParam.value) + vfModuleInputMap.put(userParam.name, userParam.value.toString()) } execution.setVariable('vfModuleInputParams', vfModuleInputMap) @@ -155,7 +155,7 @@ class CreateVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { - public void sendSyncResponse (Execution execution, isDebugEnabled) { + public void sendSyncResponse (DelegateExecution execution, isDebugEnabled) { def volumeGroupId = execution.getVariable('volumeGroupId') def requestId = execution.getVariable("mso-request-id") def serviceInstanceId = execution.getVariable("serviceInstanceId") @@ -169,7 +169,7 @@ class CreateVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { } - public void sendSyncError (Execution execution, isDebugEnabled) { + public void sendSyncError (DelegateExecution execution, isDebugEnabled) { WorkflowException we = execution.getVariable('WorkflowException') def errorCode = we?.getErrorCode() def errorMessage = we?.getErrorMessage() @@ -183,7 +183,7 @@ class CreateVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { * @param execution * @param isDebugEnabled */ - public void buildWorkflowException(Execution execution, int errorCode, errorMessage, isDebugEnabled) { + public void buildWorkflowException(DelegateExecution execution, int errorCode, errorMessage, isDebugEnabled) { utils.log("DEBUG", errorMessage, isDebugEnabled) (new ExceptionUtil()).buildWorkflowException(execution, 2500, errorMessage) } @@ -194,7 +194,7 @@ class CreateVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { * @param execution * @param isDebugEnabled */ - public void prepareDbInfraSuccessRequest(Execution execution, isDebugEnabled) { + public void prepareDbInfraSuccessRequest(DelegateExecution execution, isDebugEnabled) { def dbVnfOutputs = execution.getVariable(prefix+'volumeOutputs') def requestId = execution.getVariable('mso-request-id') def statusMessage = "VolumeGroup successfully created." @@ -237,7 +237,7 @@ class CreateVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { * @param execution * @param isDebugEnabled */ - public void postProcessResponse (Execution execution, isDebugEnabled) { + public void postProcessResponse (DelegateExecution execution, isDebugEnabled) { def dbReturnCode = execution.getVariable(prefix+'dbReturnCode') def createDBResponse = execution.getVariable(prefix+'createDBResponse') @@ -270,7 +270,7 @@ class CreateVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { } - public void prepareFalloutHandlerRequest(Execution execution, isDebugEnabled) { + public void prepareFalloutHandlerRequest(DelegateExecution execution, isDebugEnabled) { WorkflowException we = execution.getVariable('WorkflowException') def errorCode = we?.getErrorCode() @@ -309,7 +309,7 @@ class CreateVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { * @param execution * @param isDebugEnabled */ - public void callRESTQueryAAIServiceInstance(Execution execution, isDebugEnabled) { + public void callRESTQueryAAIServiceInstance(DelegateExecution execution, isDebugEnabled) { def request = execution.getVariable(prefix+"Request") def serviceInstanceId = utils.getNodeText1(request, "service-instance-id") @@ -348,12 +348,12 @@ class CreateVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { } } - public void logAndSaveOriginalException(Execution execution, isDebugLogEnabled) { + public void logAndSaveOriginalException(DelegateExecution execution, isDebugLogEnabled) { logWorkflowException(execution, 'CreateVfModuleVolumeInfraV1 caught an event') saveWorkflowException(execution, 'CVMVINFRAV1_originalWorkflowException') } - public void validateRollbackResponse(Execution execution, isDebugLogEnabled) { + public void validateRollbackResponse(DelegateExecution execution, isDebugLogEnabled) { def originalException = execution.getVariable("CVMVINFRAV1_originalWorkflowException") execution.setVariable("WorkflowException", originalException) diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVnfInfra.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVnfInfra.groovy index 1c98b87027..24487d5013 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVnfInfra.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVnfInfra.groovy @@ -23,7 +23,7 @@ package org.openecomp.mso.bpmn.infrastructure.scripts import java.util.UUID; import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.runtime.Execution; +import org.camunda.bpm.engine.delegate.DelegateExecution; import static org.apache.commons.lang3.StringUtils.*; import org.openecomp.mso.bpmn.common.scripts.CatalogDbUtils; @@ -38,6 +38,7 @@ import org.openecomp.mso.bpmn.common.scripts.VidUtils; import org.openecomp.mso.bpmn.core.WorkflowException import org.openecomp.mso.bpmn.core.domain.VnfResource import org.openecomp.mso.bpmn.core.json.JsonUtils; +import org.openecomp.mso.bpmn.infrastructure.aai.AAICreateResources; /** @@ -52,6 +53,7 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor { JsonUtils jsonUtil = new JsonUtils() VidUtils vidUtils = new VidUtils(this) CatalogDbUtils cutils = new CatalogDbUtils() + AAICreateResources aaiCR = new AAICreateResources() /** * This method gets and validates the incoming @@ -60,7 +62,7 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor { * @param - execution * */ - public void preProcessRequest(Execution execution) { + public void preProcessRequest(DelegateExecution execution) { def isDebugEnabled = execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) utils.log("DEBUG", " *** STARTED CreateVnfInfra PreProcessRequest Process*** ", isDebugEnabled) @@ -191,7 +193,7 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor { utils.log("DEBUG", "*** COMPLETED CreateVnfInfra PreProcessRequest Process ***", isDebugEnabled) } - public void sendSyncResponse (Execution execution) { + public void sendSyncResponse (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) @@ -218,7 +220,7 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor { } - public void preProcessSDNCAssignRequest(Execution execution){ + public void preProcessSDNCAssignRequest(DelegateExecution execution){ def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix", Prefix) logDebug(" ======== STARTED preProcessSDNCAssignRequest ======== ", isDebugLogEnabled) @@ -244,7 +246,7 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor { logDebug("======== COMPLETED preProcessSDNCAssignRequest ======== ", isDebugLogEnabled) } - public void preProcessSDNCActivateRequest(Execution execution) { + public void preProcessSDNCActivateRequest(DelegateExecution execution) { def method = getClass().getSimpleName() + '.preProcessSDNCActivateRequest(' + 'execution=' + execution.getId() + ')' @@ -269,7 +271,7 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor { logDebug("======== COMPLETED preProcessSDNCActivateRequest Process ======== ", isDebugLogEnabled) } - public String buildSDNCRequest(Execution execution, String svcInstId, String action){ + public String buildSDNCRequest(DelegateExecution execution, String svcInstId, String action){ String uuid = execution.getVariable('testReqId') // for junits if(uuid==null){ @@ -332,7 +334,7 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor { return sdncRequest } - public void validateSDNCResponse(Execution execution, String response, String method){ + public void validateSDNCResponse(DelegateExecution execution, String response, String method){ def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) logDebug(" *** STARTED ValidateSDNCResponse Process*** ", isDebugLogEnabled) @@ -358,7 +360,7 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor { logDebug(" *** COMPLETED ValidateSDNCResponse Process*** ", isDebugLogEnabled) } - public void prepareCompletionHandlerRequest(Execution execution){ + public void prepareCompletionHandlerRequest(DelegateExecution execution){ def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) @@ -391,7 +393,7 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor { utils.log("DEBUG", "*** COMPLETED CreateVnfInfra PrepareCompletionHandlerRequest Process ***", isDebugEnabled) } - public void sendErrorResponse(Execution execution){ + public void sendErrorResponse(DelegateExecution execution){ def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) @@ -416,7 +418,7 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor { utils.log("DEBUG", "*** COMPLETED CreateVnfInfra sendErrorResponse Process ***", isDebugEnabled) } - public void prepareFalloutRequest(Execution execution){ + public void prepareFalloutRequest(DelegateExecution execution){ def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) @@ -442,7 +444,7 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor { } - public void queryCatalogDB (Execution execution) { + public void queryCatalogDB (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) @@ -455,8 +457,7 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor { JSONArray vnfs = cutils.getAllVnfsByVnfModelCustomizationUuid(execution, vnfModelCustomizationUuid, "v2") - utils.log("DEBUG", "obtained VNF list: " + vnfs, isDebugEnabled) - execution.setVariable("CREVI_vnfs", vnfs) + utils.log("DEBUG", "obtained VNF list: " + vnfs, isDebugEnabled) if (vnfs == null) { utils.log("ERROR", "No matching VNFs in Catalog DB for vnfModelCustomizationUuid=" + vnfModelCustomizationUuid, isDebugEnabled) @@ -493,4 +494,58 @@ class CreateVnfInfra extends AbstractServiceTaskProcessor { utils.log("DEBUG", "*** COMPLETED CreateVnfInfra QueryCatalogDb Process ***", isDebugEnabled) } + public void createPlatform (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG"," ***** START createPlatform *****", isDebugEnabled) + + String request = execution.getVariable("bpmnRequest") + String platformName = jsonUtil.getJsonValue(request, "requestDetails.platform.platformName") + String vnfId = execution.getVariable("CREVI_vnfId") + + utils.log("DEBUG","Platform NAME: " + platformName, isDebugEnabled) + utils.log("DEBUG","VnfID: " + vnfId, isDebugEnabled) + + if(platformName == null||platformName.equals("")){ + String msg = "Exception in createPlatform. platformName was not found in the request."; + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + }else{ + utils.log("DEBUG", "platformName was found.", isDebugEnabled) + try{ + AAICreateResources aaiCR = new AAICreateResources() + aaiCR.createAAIPlatform(platformName, vnfId) + }catch(Exception ex){ + String msg = "Exception in createPlatform. " + ex.getMessage(); + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + } + utils.log("DEBUG"," *** Exit createPlatform *** ", isDebugEnabled) + } + public void createLineOfBusiness (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG"," ***** START createLineOfBusiness *****", isDebugEnabled) + + String request = execution.getVariable("bpmnRequest") + String lineOfBusiness = jsonUtil.getJsonValue(request, "requestDetails.lineOfBusiness.lineOfBusinessName") + String vnfId = execution.getVariable("CREVI_vnfId") + + utils.log("DEBUG","LineOfBusiness NAME: " + lineOfBusiness, isDebugEnabled) + utils.log("DEBUG","VnfID: " + vnfId, isDebugEnabled) + + if(lineOfBusiness == null || lineOfBusiness.equals("")){ + utils.log("DEBUG", "LineOfBusiness was not found. Continuing on with flow...", isDebugEnabled) + }else{ + utils.log("DEBUG", "LineOfBusiness was found.", isDebugEnabled) + try{ + AAICreateResources aaiCR = new AAICreateResources() + aaiCR.createAAILineOfBusiness(lineOfBusiness, vnfId) + }catch(Exception ex){ + String msg = "Exception in LineOfBusiness. " + ex.getMessage(); + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + } + utils.log("DEBUG"," *** Exit createLineOfBusiness *** ", isDebugEnabled) + } } diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteCustomE2EServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteCustomE2EServiceInstance.groovy index 49e4cc9257..d4b853179c 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteCustomE2EServiceInstance.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteCustomE2EServiceInstance.groovy @@ -35,7 +35,7 @@ import javax.xml.parsers.DocumentBuilder import javax.xml.parsers.DocumentBuilderFactory import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.runtime.Execution +import org.camunda.bpm.engine.delegate.DelegateExecution import org.json.JSONObject; import org.apache.commons.lang3.* import org.apache.commons.codec.binary.Base64; @@ -59,7 +59,7 @@ public class DeleteCustomE2EServiceInstance extends AbstractServiceTaskProcessor JsonUtils jsonUtil = new JsonUtils() VidUtils vidUtils = new VidUtils() - public void preProcessRequest (Execution execution) { + public void preProcessRequest (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) String msg = "" @@ -81,17 +81,36 @@ public class DeleteCustomE2EServiceInstance extends AbstractServiceTaskProcessor msg = "Input serviceInstanceId' is null" exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } - - String serviceType = execution.getVariable("serviceType") - if (isBlank(serviceType)) { - msg = "Input serviceType' is null" + + //String xmlRequestDetails = vidUtils.getJsonRequestDetailstoXml(siRequest) + //execution.setVariable("requestDetails", xmlRequestDetails) + + //modelInfo + String serviceModelInfo = jsonUtil.getJsonValue(siRequest, "requestDetails.modelInfo") + if (isBlank(serviceModelInfo)) { + msg = "Input serviceModelInfo is null" + utils.log("DEBUG", msg, isDebugEnabled) + } else + { + execution.setVariable("serviceModelInfo", serviceModelInfo) + //utils.log("DEBUG", "modelInfo" + serviceModelInfo, isDebugEnabled) + } + + //requestInfo + String productFamilyId = jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.productFamilyId") + if (isBlank(productFamilyId)) + { + msg = "Input productFamilyId is null" utils.log("INFO", msg, isDebugEnabled) + //exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } else { - execution.setVariable("serviceType", serviceType) + execution.setVariable("productFamilyId", productFamilyId) } + String source = jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.source") + execution.setVariable("source", source) //subscriberInfo - String globalSubscriberId = jsonUtil.getJsonValue(siRequest, "globalSubscriberId") + String globalSubscriberId = jsonUtil.getJsonValue(siRequest, "requestDetails.subscriberInfo.globalSubscriberId") if (isBlank(globalSubscriberId)) { msg = "Input globalSubscriberId' is null" utils.log("INFO", msg, isDebugEnabled) @@ -99,16 +118,38 @@ public class DeleteCustomE2EServiceInstance extends AbstractServiceTaskProcessor execution.setVariable("globalSubscriberId", globalSubscriberId) } - //operationId - String operationId = jsonUtil.getJsonValue(siRequest, "operationId") - if (isBlank(operationId)) { - operationId = UUID.randomUUID().toString() - } - execution.setVariable("operationId", operationId) - execution.setVariable("operationType", "DELETE") + //requestParameters + String subscriptionServiceType = jsonUtil.getJsonValue(siRequest, "requestDetails.requestParameters.subscriptionServiceType") + if (isBlank(subscriptionServiceType)) { + msg = "Input subscriptionServiceType is null" + utils.log("DEBUG", msg, isDebugEnabled) + //exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } else { + execution.setVariable("subscriptionServiceType", subscriptionServiceType) + } - execution.setVariable("URN_mso_adapters_openecomp_db_endpoint","http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter") + /* + * Extracting User Parameters from incoming Request and converting into a Map + */ + def jsonSlurper = new JsonSlurper() + def jsonOutput = new JsonOutput() + + Map reqMap = jsonSlurper.parseText(siRequest) + + //InputParams + def userParams = reqMap.requestDetails?.requestParameters?.userParams + + Map inputMap = [:] + if (userParams) { + userParams.each { + userParam -> inputMap.put(userParam.name, userParam.value.toString()) + } + } + execution.setVariable("operationType", "DELETE") + utils.log("DEBUG", "User Input Parameters map: " + userParams.toString(), isDebugEnabled) + execution.setVariable("serviceInputParams", inputMap) + } catch (BpmnError e) { throw e; } catch (Exception ex){ @@ -119,15 +160,16 @@ public class DeleteCustomE2EServiceInstance extends AbstractServiceTaskProcessor utils.log("INFO"," ***** Exit preProcessRequest *****", isDebugEnabled) } - public void sendSyncResponse (Execution execution) { + public void sendSyncResponse (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("INFO", " *** sendSyncResponse *** ", isDebugEnabled) try { - String operationId = execution.getVariable("operationId") - - // RESTResponse (for API Handler (APIH) Reply Task) : : - String syncResponse = """{"operationId":"${operationId}"}""".trim() + String requestId = execution.getVariable("msoRequestId") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + + // RESTResponse (for API Handler (APIH) Reply Task) + String syncResponse = """{"requestReferences":{"instanceId":"${serviceInstanceId}","requestId":"${requestId}"}}""".trim() utils.log("INFO", " sendSynchResponse: xmlSyncResponse - " + "\n" + syncResponse, isDebugEnabled) sendWorkflowResponse(execution, 202, syncResponse) @@ -138,7 +180,7 @@ public class DeleteCustomE2EServiceInstance extends AbstractServiceTaskProcessor utils.log("INFO"," ***** Exit sendSyncResopnse *****", isDebugEnabled) } - public void sendSyncError (Execution execution) { + public void sendSyncError (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("INFO", " *** sendSyncError *** ", isDebugEnabled) @@ -166,7 +208,7 @@ public class DeleteCustomE2EServiceInstance extends AbstractServiceTaskProcessor } - public void prepareCompletionRequest (Execution execution) { + public void prepareCompletionRequest (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("INFO", " *** prepareCompletion *** ", isDebugEnabled) @@ -199,7 +241,7 @@ public class DeleteCustomE2EServiceInstance extends AbstractServiceTaskProcessor utils.log("INFO", "*** Exit prepareCompletionRequest ***", isDebugEnabled) } - public void prepareFalloutRequest(Execution execution){ + public void prepareFalloutRequest(DelegateExecution execution){ def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("INFO", " *** prepareFalloutRequest *** ", isDebugEnabled) @@ -245,7 +287,7 @@ public class DeleteCustomE2EServiceInstance extends AbstractServiceTaskProcessor // ******************************* // Build DB request Section // ******************************* - public void prepareDBRequest (Execution execution) { + public void prepareDBRequest (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix", Prefix) @@ -287,7 +329,7 @@ public class DeleteCustomE2EServiceInstance extends AbstractServiceTaskProcessor // ******************************* // Build Error Section // ******************************* - public void prepareDBRequestError (Execution execution) { + public void prepareDBRequestError (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix", Prefix) @@ -332,7 +374,7 @@ public class DeleteCustomE2EServiceInstance extends AbstractServiceTaskProcessor } - public void processJavaException(Execution execution) { + public void processJavaException(DelegateExecution execution) { //TODO: } } diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteGenericALaCarteServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteGenericALaCarteServiceInstance.groovy index abf949e8e8..c731a613cc 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteGenericALaCarteServiceInstance.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteGenericALaCarteServiceInstance.groovy @@ -34,7 +34,7 @@ import javax.xml.parsers.DocumentBuilder import javax.xml.parsers.DocumentBuilderFactory import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.runtime.Execution +import org.camunda.bpm.engine.delegate.DelegateExecution import org.json.JSONObject; import org.apache.commons.lang3.* import org.apache.commons.codec.binary.Base64; @@ -58,7 +58,7 @@ public class DeleteGenericALaCarteServiceInstance extends AbstractServiceTaskPro JsonUtils jsonUtil = new JsonUtils() VidUtils vidUtils = new VidUtils() - public void preProcessRequest (Execution execution) { + public void preProcessRequest (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) String msg = "" @@ -141,7 +141,7 @@ public class DeleteGenericALaCarteServiceInstance extends AbstractServiceTaskPro Map inputMap = [:] if (userParams) { userParams.each { - userParam -> inputMap.put(userParam.name, userParam.value) + userParam -> inputMap.put(userParam.name, userParam.value.toString()) } } @@ -158,7 +158,7 @@ public class DeleteGenericALaCarteServiceInstance extends AbstractServiceTaskPro utils.log("DEBUG"," ***** Exit preProcessRequest *****", isDebugEnabled) } - public void sendSyncResponse (Execution execution) { + public void sendSyncResponse (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("DEBUG", " *** sendSyncResponse *** ", isDebugEnabled) @@ -178,7 +178,7 @@ public class DeleteGenericALaCarteServiceInstance extends AbstractServiceTaskPro utils.log("DEBUG"," ***** Exit sendSyncResopnse *****", isDebugEnabled) } - public void sendSyncError (Execution execution) { + public void sendSyncError (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("DEBUG", " *** sendSyncError *** ", isDebugEnabled) @@ -206,7 +206,7 @@ public class DeleteGenericALaCarteServiceInstance extends AbstractServiceTaskPro } - public void prepareCompletionRequest (Execution execution) { + public void prepareCompletionRequest (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("DEBUG", " *** prepareCompletion *** ", isDebugEnabled) @@ -239,7 +239,7 @@ public class DeleteGenericALaCarteServiceInstance extends AbstractServiceTaskPro utils.log("DEBUG", "*** Exit prepareCompletionRequest ***", isDebugEnabled) } - public void prepareFalloutRequest(Execution execution){ + public void prepareFalloutRequest(DelegateExecution execution){ def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("DEBUG", " *** prepareFalloutRequest *** ", isDebugEnabled) @@ -285,7 +285,7 @@ public class DeleteGenericALaCarteServiceInstance extends AbstractServiceTaskPro // ******************************* // Build DB request Section // ******************************* - public void prepareDBRequest (Execution execution) { + public void prepareDBRequest (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix", Prefix) @@ -327,7 +327,7 @@ public class DeleteGenericALaCarteServiceInstance extends AbstractServiceTaskPro // ******************************* // Build Error Section // ******************************* - public void prepareDBRequestError (Execution execution) { + public void prepareDBRequestError (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix", Prefix) diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteNetworkInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteNetworkInstance.groovy index dab189241c..a9aef7f3ee 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteNetworkInstance.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteNetworkInstance.groovy @@ -29,7 +29,7 @@ import org.openecomp.mso.bpmn.core.json.JsonUtils; import org.openecomp.mso.rest.APIResponse import java.util.UUID; import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.runtime.Execution +import org.camunda.bpm.engine.delegate.DelegateExecution import org.apache.commons.lang3.* import org.apache.commons.codec.binary.Base64; import org.springframework.web.util.UriUtils @@ -45,7 +45,7 @@ public class DeleteNetworkInstance extends AbstractServiceTaskProcessor { NetworkUtils networkUtils = new NetworkUtils() - public InitializeProcessVariables(Execution execution){ + public InitializeProcessVariables(DelegateExecution execution){ execution.setVariable(Prefix + "Success", false) @@ -59,7 +59,7 @@ public class DeleteNetworkInstance extends AbstractServiceTaskProcessor { // Pre or Prepare Request Section // ************************************************** - public void preProcessRequest (Execution execution) { + public void preProcessRequest (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) @@ -145,7 +145,7 @@ public class DeleteNetworkInstance extends AbstractServiceTaskProcessor { } - public void getNetworkModelInfo (Execution execution) { + public void getNetworkModelInfo (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix", Prefix) @@ -169,7 +169,7 @@ public class DeleteNetworkInstance extends AbstractServiceTaskProcessor { } - public void sendSyncResponse (Execution execution) { + public void sendSyncResponse (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) @@ -196,7 +196,7 @@ public class DeleteNetworkInstance extends AbstractServiceTaskProcessor { } - public void prepareCompletion (Execution execution) { + public void prepareCompletion (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) @@ -236,7 +236,7 @@ public class DeleteNetworkInstance extends AbstractServiceTaskProcessor { } - public void prepareDBRequestError (Execution execution) { + public void prepareDBRequestError (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix", Prefix) @@ -284,7 +284,7 @@ public class DeleteNetworkInstance extends AbstractServiceTaskProcessor { // Post or Validate Response Section // ************************************************** - public void postProcessResponse (Execution execution) { + public void postProcessResponse (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix", Prefix) @@ -318,7 +318,7 @@ public class DeleteNetworkInstance extends AbstractServiceTaskProcessor { // ******************************* // Prepare for FalloutHandler - public void buildErrorResponse (Execution execution) { + public void buildErrorResponse (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix", Prefix) @@ -380,7 +380,7 @@ public class DeleteNetworkInstance extends AbstractServiceTaskProcessor { } - public void sendSyncError (Execution execution) { + public void sendSyncError (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix", Prefix) @@ -400,7 +400,7 @@ public class DeleteNetworkInstance extends AbstractServiceTaskProcessor { } } - public void processJavaException(Execution execution){ + public void processJavaException(DelegateExecution execution){ def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) try{ diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteVfModuleInfra.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteVfModuleInfra.groovy index c4c151f01f..0aef81770f 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteVfModuleInfra.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteVfModuleInfra.groovy @@ -27,7 +27,7 @@ import groovy.xml.QName import java.io.Serializable; import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.runtime.Execution +import org.camunda.bpm.engine.delegate.DelegateExecution import groovy.json.JsonSlurper @@ -49,7 +49,7 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor { * * @param execution The flow's execution instance. */ - public void initProcessVariables(Execution execution) { + public void initProcessVariables(DelegateExecution execution) { execution.setVariable('prefix', 'DELVfModI_') execution.setVariable('DELVfModI_requestInfo', null) execution.setVariable('DELVfModI_requestId', null) @@ -70,7 +70,7 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor { * * @param execution The flow's execution instance. */ - public void preProcessRequest(Execution execution) { + public void preProcessRequest(DelegateExecution execution) { def method = getClass().getSimpleName() + '.preProcessRequest(' + 'execution=' + execution.getId() + ')' @@ -103,7 +103,10 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor { execution.setVariable("vfModuleModelInfo", vfModuleModelInfo) utils.log("DEBUG", "VfModuleModelInfo is: " + vfModuleModelInfo, isDebugLogEnabled) - + + // This is aLaCarte flow, so aLaCarte flag is always on + execution.setVariable('aLaCarte', true) + def vidUtils = new VidUtils(this) String requestInXmlFormat = vidUtils.createXmlVfModuleRequest(execution, reqMap, 'DELETE_VF_MODULE', serviceInstanceId) @@ -165,7 +168,7 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor { * * @param execution The flow's execution instance. */ - public void sendSynchResponse(Execution execution) { + public void sendSynchResponse(DelegateExecution execution) { def method = getClass().getSimpleName() + '.sendResponse(' + 'execution=' + execution.getId() + ')' @@ -208,7 +211,7 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor { * * @param execution The flow's execution instance. */ - public void prepDoDeleteVfModule(Execution execution) { + public void prepDoDeleteVfModule(DelegateExecution execution) { def method = getClass().getSimpleName() + '.prepDoDeleteVfModule(' + 'execution=' + execution.getId() + ')' @@ -231,7 +234,7 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor { * * @param execution The flow's execution instance. */ - public void prepUpdateInfraRequest(Execution execution) { + public void prepUpdateInfraRequest(DelegateExecution execution) { def method = getClass().getSimpleName() + '.prepUpdateInfraRequest(' + 'execution=' + execution.getId() + ')' @@ -280,7 +283,7 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor { * @param execution the execution * @param resultVar the execution variable in which the result will be stored */ - public void completionHandlerPrep(Execution execution, String resultVar) { + public void completionHandlerPrep(DelegateExecution execution, String resultVar) { def method = getClass().getSimpleName() + '.completionHandlerPrep(' + 'execution=' + execution.getId() + ', resultVar=' + resultVar + @@ -324,7 +327,7 @@ public class DeleteVfModuleInfra extends AbstractServiceTaskProcessor { * @param execution the execution * @param resultVar the execution variable in which the result will be stored */ - public void falloutHandlerPrep(Execution execution, String resultVar) { + public void falloutHandlerPrep(DelegateExecution execution, String resultVar) { def method = getClass().getSimpleName() + '.falloutHandlerPrep(' + 'execution=' + execution.getId() + ', resultVar=' + resultVar + diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy index 77a8f8e9c0..5a38d9f011 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy @@ -26,7 +26,7 @@ import java.util.concurrent.ExecutionException; import org.springframework.web.util.UriUtils import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.runtime.Execution +import org.camunda.bpm.engine.delegate.DelegateExecution import org.apache.commons.lang3.* import org.openecomp.mso.bpmn.common.scripts.AaiUtil; import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor; @@ -45,7 +45,7 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { * This method is executed during the preProcessRequest task of the DeleteVfModuleVolume.bpmn process. * @param execution */ - public InitializeProcessVariables(Execution execution){ + public InitializeProcessVariables(DelegateExecution execution){ execution.setVariable('prefix', 'DELVfModVol_') execution.setVariable("DELVfModVol_volumeRequest", null) execution.setVariable('DELVfModVol_requestInfo', null) @@ -76,7 +76,7 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { * Perform initial processing, such as request validation, initialization of variables, etc. * * @param execution */ - public void preProcessRequest (Execution execution) { + public void preProcessRequest (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") preProcessRequest(execution, isDebugEnabled) } @@ -85,7 +85,7 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { * This method is executed during the preProcessRequest task of the DeleteVfModuleVolume.bpmn process. * @param execution */ - public void preProcessRequest (Execution execution, isDebugLogEnabled) { + public void preProcessRequest (DelegateExecution execution, isDebugLogEnabled) { InitializeProcessVariables(execution) @@ -137,7 +137,7 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { logDebug('Request: ' + createVolumeIncoming, isDebugLogEnabled) } - public void sendSyncResponse (Execution execution, isDebugEnabled) { + public void sendSyncResponse (DelegateExecution execution, isDebugEnabled) { String volumeRequest = execution.getVariable("DELVfModVol_volumeRequest") utils.log("DEBUG", " DELVfModVol_volumeRequest - " + "\n" + volumeRequest, isDebugEnabled) @@ -169,7 +169,7 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { } - public void sendSyncError (Execution execution, isDebugEnabled) { + public void sendSyncError (DelegateExecution execution, isDebugEnabled) { WorkflowException we = execution.getVariable('WorkflowException') def errorCode = we?.getErrorCode() def errorMessage = we?.getErrorMessage() @@ -178,7 +178,7 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { } - public void callRESTQueryAAICloudRegion (Execution execution, isDebugEnabled) { + public void callRESTQueryAAICloudRegion (DelegateExecution execution, isDebugEnabled) { String cloudRegion = execution.getVariable('DELVfModVol_cloudRegion') @@ -216,7 +216,7 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { * Query volume group by id * @param execution */ - public void queryAAIForVolumeGroup(Execution execution, isDebugLogEnabled) { + public void queryAAIForVolumeGroup(DelegateExecution execution, isDebugLogEnabled) { ExceptionUtil exceptionUtil = new ExceptionUtil() @@ -343,7 +343,7 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { return false } - public void prepareVnfAdapterDeleteRequest(Execution execution, isDebugLogEnabled) { + public void prepareVnfAdapterDeleteRequest(DelegateExecution execution, isDebugLogEnabled) { def cloudRegion = execution.getVariable('DELVfModVol_cloudRegion') def tenantId = execution.getVariable('DELVfModVol_tenantId') def volumeGroupId = execution.getVariable('DELVfModVol_volumeGroupId') @@ -379,7 +379,7 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { } - public void deleteVolGrpId(Execution execution, isDebugEnabled) { + public void deleteVolGrpId(DelegateExecution execution, isDebugEnabled) { // get variables String queryAAIVolGrpIdResponse = execution.getVariable("DELVfModVol_queryAAIVolGrpResponse") @@ -422,7 +422,7 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { } - public void prepareDBRequest (Execution execution, isDebugLogEnabled) { + public void prepareDBRequest (DelegateExecution execution, isDebugLogEnabled) { WorkflowException workflowExceptionObj = execution.getVariable("WorkflowException") ExceptionUtil exceptionUtil = new ExceptionUtil(); @@ -464,7 +464,7 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { } - public void prepareCompletionHandlerRequest (Execution execution, isDebugLogEnabled) { + public void prepareCompletionHandlerRequest (DelegateExecution execution, isDebugLogEnabled) { def requestId = execution.getVariable("mso-request-id") def source = execution.getVariable("DELVfModVol_source") @@ -488,7 +488,7 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { - public void prepareFalloutHandler (Execution execution, isDebugEnabled) { + public void prepareFalloutHandler (DelegateExecution execution, isDebugEnabled) { execution.setVariable("DELVfModVol_Success", false) String requestId = execution.getVariable("DELVfModVol_requestId") @@ -529,7 +529,7 @@ public class DeleteVfModuleVolumeInfraV1 extends AbstractServiceTaskProcessor { * * @param execution The flow's execution instance. */ - public void handleTenantIdMismatch(Execution execution, isDebugLogEnabled) { + public void handleTenantIdMismatch(DelegateExecution execution, isDebugLogEnabled) { def volumeGroupId = execution.getVariable('DELVfModVol_volumeGroupId') def aicCloudRegion = execution.getVariable('DELVfModVol_aicCloudRegion') diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteVnfInfra.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteVnfInfra.groovy index f1911accd7..c789769131 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteVnfInfra.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteVnfInfra.groovy @@ -26,7 +26,7 @@ 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.camunda.bpm.engine.delegate.DelegateExecution import org.w3c.dom.Document import org.w3c.dom.Element import org.w3c.dom.Node @@ -59,7 +59,7 @@ class DeleteVnfInfra extends AbstractServiceTaskProcessor { * * @param - execution */ - public void preProcessRequest(Execution execution) { + public void preProcessRequest(DelegateExecution execution) { def isDebugEnabled = execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) utils.log("DEBUG", " *** STARTED DeleteVnfInfra PreProcessRequest Process*** ", isDebugEnabled) @@ -129,7 +129,7 @@ class DeleteVnfInfra extends AbstractServiceTaskProcessor { utils.log("DEBUG", "*** COMPLETED DeleteVnfInfra PreProcessRequest Process ***", isDebugEnabled) } - public void sendSyncResponse (Execution execution) { + public void sendSyncResponse (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) @@ -154,7 +154,7 @@ class DeleteVnfInfra extends AbstractServiceTaskProcessor { utils.log("DEBUG", "*** COMPLETED DeleteVnfInfra SendSyncResponse Process ***", isDebugEnabled) } - public void prepareCompletionHandlerRequest(Execution execution){ + public void prepareCompletionHandlerRequest(DelegateExecution execution){ def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) @@ -187,7 +187,7 @@ class DeleteVnfInfra extends AbstractServiceTaskProcessor { utils.log("DEBUG", "*** COMPLETED DeleteVnfInfra PrepareCompletionHandlerRequest Process ***", isDebugEnabled) } - public void sendErrorResponse(Execution execution){ + public void sendErrorResponse(DelegateExecution execution){ def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy index fd9b6d42e8..1f632162ff 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy @@ -51,7 +51,7 @@ import java.util.UUID; import javax.mail.Quota.Resource; import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.runtime.Execution +import org.camunda.bpm.engine.delegate.DelegateExecution import org.json.JSONObject; import org.json.JSONArray; import org.apache.commons.lang3.* @@ -90,7 +90,7 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { JsonUtils jsonUtil = new JsonUtils() CatalogDbUtils cutils = new CatalogDbUtils() - public void preProcessRequest (Execution execution) { + public void preProcessRequest (DelegateExecution execution) { def isDebugEnabled = execution.getVariable("isDebugLogEnabled") String msg = "" utils.log("INFO"," ***** preProcessRequest *****", isDebugEnabled) @@ -185,7 +185,7 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { utils.log("INFO"," ***** Exit preProcessRequest *****", isDebugEnabled) } - public void prepareDecomposeService(Execution execution) { + public void prepareDecomposeService(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") try { @@ -208,7 +208,7 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { } } - public void processDecomposition (Execution execution) { + public void processDecomposition(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("DEBUG", " ***** Inside processDecomposition() of create generic e2e service flow ***** ", isDebugEnabled) @@ -221,11 +221,11 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { } } - public void doServiceHoming(Execution execution) { + public void doServiceHoming(DelegateExecution execution) { //Now Homing is not clear. So to be implemented. } - public void postProcessAAIGET(Execution execution) { + public void postProcessAAIGET(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("INFO"," ***** postProcessAAIGET ***** ", isDebugEnabled) String msg = "" @@ -267,7 +267,7 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { utils.log("INFO"," *** Exit postProcessAAIGET *** ", isDebugEnabled) } - public void postProcessAAIPUT(Execution execution) { + public void postProcessAAIPUT(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("INFO"," ***** postProcessAAIPUT ***** ", isDebugEnabled) String msg = "" @@ -305,7 +305,7 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { utils.log("INFO"," *** Exit postProcessAAIPUT *** ", isDebugEnabled) } - public void postProcessAAIGET2(Execution execution) { + public void postProcessAAIGET2(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("INFO"," ***** postProcessAAIGET2 ***** ", isDebugEnabled) String msg = "" @@ -348,7 +348,7 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { utils.log("INFO"," *** Exit postProcessAAIGET2 *** ", isDebugEnabled) } - public void preProcessRollback (Execution execution) { + public void preProcessRollback (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("INFO"," ***** preProcessRollback ***** ", isDebugEnabled) try { @@ -369,7 +369,7 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { utils.log("INFO"," *** Exit preProcessRollback *** ", isDebugEnabled) } - public void postProcessRollback (Execution execution) { + public void postProcessRollback (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("INFO"," ***** postProcessRollback ***** ", isDebugEnabled) String msg = "" @@ -390,7 +390,7 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { utils.log("INFO"," *** Exit postProcessRollback *** ", isDebugEnabled) } - public void preInitResourcesOperStatus(Execution execution){ + public void preInitResourcesOperStatus(DelegateExecution execution){ def isDebugEnabled = execution.getVariable("isDebugLogEnabled") utils.log("INFO", " ======== STARTED preInitResourcesOperStatus Process ======== ", isDebugEnabled) diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceRollback.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceRollback.groovy index 743eb1a46e..84dd0e4d73 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceRollback.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceRollback.groovy @@ -37,7 +37,7 @@ import org.openecomp.mso.rest.RESTConfig import java.util.UUID; import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.runtime.Execution +import org.camunda.bpm.engine.delegate.DelegateExecution import org.json.JSONObject; import org.apache.commons.lang3.* import org.apache.commons.codec.binary.Base64; @@ -66,7 +66,7 @@ public class DoCreateE2EServiceInstanceRollback extends AbstractServiceTaskProce String Prefix="DCRESIRB_" - public void preProcessRequest(Execution execution) { + public void preProcessRequest(DelegateExecution execution) { def isDebugEnabled = execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) String msg = "" @@ -136,7 +136,7 @@ public class DoCreateE2EServiceInstanceRollback extends AbstractServiceTaskProce utils.log("DEBUG"," ***** Exit preProcessRequest *****", isDebugEnabled) } - public void validateSDNCResponse(Execution execution, String response, String method) { + public void validateSDNCResponse(DelegateExecution execution, String response, String method) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("DEBUG"," ***** validateSDNCResponse ***** ", isDebugEnabled) String msg = "" @@ -169,7 +169,7 @@ public class DoCreateE2EServiceInstanceRollback extends AbstractServiceTaskProce utils.log("DEBUG"," ***** Exit validateSDNCResponse ***** ", isDebugEnabled) } - public void postProcessRequest(Execution execution) { + public void postProcessRequest(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("DEBUG"," ***** postProcessRequest ***** ", isDebugEnabled) String msg = "" @@ -203,7 +203,7 @@ public class DoCreateE2EServiceInstanceRollback extends AbstractServiceTaskProce } - public void processRollbackException(Execution execution){ + public void processRollbackException(DelegateExecution execution){ def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("DEBUG"," ***** processRollbackException ***** ", isDebugEnabled) try{ @@ -221,7 +221,7 @@ public class DoCreateE2EServiceInstanceRollback extends AbstractServiceTaskProce utils.log("DEBUG", " Exit processRollbackException", isDebugEnabled) } - public void processRollbackJavaException(Execution execution){ + public void processRollbackJavaException(DelegateExecution execution){ def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("DEBUG"," ***** processRollbackJavaException ***** ", isDebugEnabled) try{ diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceV2.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceV2.groovy index ea29de94d7..2d96ac771a 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceV2.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceV2.groovy @@ -21,33 +21,22 @@ package org.openecomp.mso.bpmn.infrastructure.scripts; import static org.apache.commons.lang3.StringUtils.*; -import groovy.xml.XmlUtil -import groovy.json.* -import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition -import org.openecomp.mso.bpmn.core.domain.ServiceInstance -import org.openecomp.mso.bpmn.core.domain.ModelInfo -import org.openecomp.mso.bpmn.core.json.JsonUtils +import org.apache.commons.lang3.* +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.json.JSONArray; +import org.json.JSONObject; import org.openecomp.mso.bpmn.common.scripts.AaiUtil import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil -import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils import org.openecomp.mso.bpmn.core.RollbackData import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.rest.APIResponse; -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig - -import java.util.UUID; - -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.runtime.Execution -import org.json.JSONObject; -import org.json.JSONArray; -import org.apache.commons.lang3.* -import org.apache.commons.codec.binary.Base64; +import org.openecomp.mso.bpmn.core.json.JsonUtils import org.springframework.web.util.UriUtils; +import groovy.json.* + /** * This groovy class supports the DoCreateServiceInstance.bpmn process. * @@ -81,7 +70,7 @@ public class DoCreateE2EServiceInstanceV2 extends AbstractServiceTaskProcessor { ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() - public void preProcessRequest (Execution execution) { + public void preProcessRequest (DelegateExecution execution) { //only for dug execution.setVariable("isDebugLogEnabled","true") execution.setVariable("unit_test", "true") @@ -217,7 +206,7 @@ public class DoCreateE2EServiceInstanceV2 extends AbstractServiceTaskProcessor { utils.log("INFO", "Exited " + method, isDebugEnabled) } - public void postProcessAAIGET(Execution execution) { + public void postProcessAAIGET(DelegateExecution execution) { def method = getClass().getSimpleName() + '.postProcessAAIGET(' +'execution=' + execution.getId() +')' def isDebugEnabled = execution.getVariable("isDebugLogEnabled") utils.log("INFO","Entered " + method, isDebugEnabled) @@ -261,7 +250,7 @@ public class DoCreateE2EServiceInstanceV2 extends AbstractServiceTaskProcessor { utils.log("INFO", "Exited " + method, isDebugEnabled) } - public void postProcessAAIPUT(Execution execution) { + public void postProcessAAIPUT(DelegateExecution execution) { def method = getClass().getSimpleName() + '.postProcessAAIPUT(' +'execution=' + execution.getId() +')' def isDebugEnabled = execution.getVariable("isDebugLogEnabled") utils.log("INFO","Entered " + method, isDebugEnabled) @@ -301,7 +290,7 @@ public class DoCreateE2EServiceInstanceV2 extends AbstractServiceTaskProcessor { utils.log("INFO", "Exited " + method, isDebugEnabled) } - public void postProcessAAIGET2(Execution execution) { + public void postProcessAAIGET2(DelegateExecution execution) { def method = getClass().getSimpleName() + '.postProcessAAIGET2(' +'execution=' + execution.getId() +')' def isDebugEnabled = execution.getVariable("isDebugLogEnabled") utils.log("INFO","Entered " + method, isDebugEnabled) @@ -346,7 +335,7 @@ public class DoCreateE2EServiceInstanceV2 extends AbstractServiceTaskProcessor { utils.log("INFO", "Exited " + method, isDebugEnabled) } - public void preProcessRollback (Execution execution) { + public void preProcessRollback (DelegateExecution execution) { def method = getClass().getSimpleName() + '.preProcessRollback(' +'execution=' + execution.getId() +')' def isDebugEnabled = execution.getVariable("isDebugLogEnabled") utils.log("INFO","Entered " + method, isDebugEnabled) @@ -369,7 +358,7 @@ public class DoCreateE2EServiceInstanceV2 extends AbstractServiceTaskProcessor { utils.log("INFO", "Exited " + method, isDebugEnabled) } - public void postProcessRollback (Execution execution) { + public void postProcessRollback (DelegateExecution execution) { def method = getClass().getSimpleName() + '.postProcessRollback(' +'execution=' + execution.getId() +')' def isDebugEnabled = execution.getVariable("isDebugLogEnabled") utils.log("INFO","Entered " + method, isDebugEnabled) @@ -395,7 +384,7 @@ public class DoCreateE2EServiceInstanceV2 extends AbstractServiceTaskProcessor { /** * Init the service Operation Status */ - public void preUpdateServiceOperationStatus(Execution execution){ + public void preUpdateServiceOperationStatus(DelegateExecution execution){ def method = getClass().getSimpleName() + '.preUpdateServiceOperationStatus(' +'execution=' + execution.getId() +')' def isDebugEnabled = execution.getVariable("isDebugLogEnabled") utils.log("INFO","Entered " + method, isDebugEnabled) @@ -460,7 +449,7 @@ public class DoCreateE2EServiceInstanceV2 extends AbstractServiceTaskProcessor { } - public void preInitResourcesOperStatus(Execution execution){ + public void preInitResourcesOperStatus(DelegateExecution execution){ def method = getClass().getSimpleName() + '.preInitResourcesOperStatus(' +'execution=' + execution.getId() +')' def isDebugEnabled = execution.getVariable("isDebugLogEnabled") utils.log("INFO","Entered " + method, isDebugEnabled) @@ -576,7 +565,7 @@ public class DoCreateE2EServiceInstanceV2 extends AbstractServiceTaskProcessor { /***********************************************************************************************/ - private void loadResourcesProperties(Execution execution) { + private void loadResourcesProperties(DelegateExecution execution) { def method = getClass().getSimpleName() + '.loadResourcesProperties(' +'execution=' + execution.getId() +')' def isDebugEnabled = execution.getVariable("isDebugEnabled") utils.log("INFO","Entered " + method, isDebugEnabled) @@ -610,7 +599,7 @@ public class DoCreateE2EServiceInstanceV2 extends AbstractServiceTaskProcessor { } utils.log("INFO", "Exited " + method, isDebugEnabled) } - private sortCreateResource(Execution execution) { + private sortCreateResource(DelegateExecution execution) { def method = getClass().getSimpleName() + '.sortCreateResource(' +'execution=' + execution.getId() +')' def isDebugEnabled = execution.getVariable("isDebugEnabled") utils.log("INFO","Entered " + method, isDebugEnabled) @@ -714,7 +703,7 @@ public class DoCreateE2EServiceInstanceV2 extends AbstractServiceTaskProcessor { /** * get service resources */ - public void getServiceResources(Execution execution){ + public void getServiceResources(DelegateExecution execution){ def method = getClass().getSimpleName() + '.getServiceResources(' +'execution=' + execution.getId() +')' def isDebugEnabled = execution.getVariable("isDebugLogEnabled") utils.log("INFO","Entered " + method, isDebugEnabled) @@ -758,7 +747,7 @@ public class DoCreateE2EServiceInstanceV2 extends AbstractServiceTaskProcessor { /** * prepare Decompose next resource to create request */ - public void preProcessDecomposeNextResource(Execution execution){ + public void preProcessDecomposeNextResource(DelegateExecution execution){ def method = getClass().getSimpleName() + '.preProcessDecomposeNextResource(' +'execution=' + execution.getId() +')' def isDebugEnabled = execution.getVariable("isDebugLogEnabled") utils.log("INFO","Entered " + method, isDebugEnabled) @@ -808,7 +797,7 @@ public class DoCreateE2EServiceInstanceV2 extends AbstractServiceTaskProcessor { /** * post Decompose next resource to create request */ - public void postProcessDecomposeNextResource(Execution execution){ + public void postProcessDecomposeNextResource(DelegateExecution execution){ def method = getClass().getSimpleName() + '.postProcessDecomposeNextResource(' +'execution=' + execution.getId() +')' def isDebugEnabled = execution.getVariable("isDebugLogEnabled") utils.log("INFO","Entered " + method, isDebugEnabled) @@ -849,7 +838,7 @@ public class DoCreateE2EServiceInstanceV2 extends AbstractServiceTaskProcessor { /** * prepare check Resource Type */ - public void checkResourceType(Execution execution){ + public void checkResourceType(DelegateExecution execution){ def method = getClass().getSimpleName() + '.checkResourceType(' +'execution=' + execution.getId() +')' def isDebugEnabled = execution.getVariable("isDebugLogEnabled") utils.log("INFO","Entered " + method, isDebugEnabled) @@ -966,7 +955,7 @@ public class DoCreateE2EServiceInstanceV2 extends AbstractServiceTaskProcessor { /** * prepare post Unkown Resource Type */ - public void postOtherControllerType(Execution execution){ + public void postOtherControllerType(DelegateExecution execution){ def method = getClass().getSimpleName() + '.postOtherControllerType(' +'execution=' + execution.getId() +')' def isDebugEnabled = execution.getVariable("isDebugLogEnabled") utils.log("INFO","Entered " + method, isDebugEnabled) diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy index e2bd1ddf04..7d21a06971 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy @@ -38,7 +38,7 @@ import java.util.Map; import java.util.UUID; import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.runtime.Execution +import org.camunda.bpm.engine.delegate.DelegateExecution import org.apache.commons.lang3.* import org.apache.commons.codec.binary.Base64; import org.springframework.web.util.UriUtils @@ -61,7 +61,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { * This method is executed during the preProcessRequest task of the DoCreateNetworkInstance.bpmn process. * @param execution */ - public InitializeProcessVariables(Execution execution){ + public InitializeProcessVariables(DelegateExecution execution){ /* Initialize all the process variables in this block */ execution.setVariable(Prefix + "networkRequest", "") @@ -174,7 +174,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { * This method is executed during the preProcessRequest task of the DoCreateNetworkInstance.bpmn process. * @param execution */ - public void preProcessRequest (Execution execution) { + public void preProcessRequest (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) @@ -312,7 +312,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { } - public void callRESTQueryAAINetworkName (Execution execution) { + public void callRESTQueryAAINetworkName (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) @@ -388,7 +388,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { } - public void callRESTQueryAAICloudRegion (Execution execution) { + public void callRESTQueryAAICloudRegion (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) @@ -438,7 +438,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { } - public void callRESTQueryAAINetworkId(Execution execution) { + public void callRESTQueryAAINetworkId(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) @@ -481,7 +481,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { String aai_endpoint = execution.getVariable("URN_aai_endpoint") AaiUtil aaiUriUtil = new AaiUtil(this) String aai_uri = aaiUriUtil.getNetworkL3NetworkUri(execution) - String queryIdAAIRequest = "${aai_endpoint}${aai_uri}/" + networkId + "?depth=1" + String queryIdAAIRequest = "${aai_endpoint}${aai_uri}/" + networkId + "?depth=all" utils.logAudit(queryIdAAIRequest) execution.setVariable(Prefix + "queryIdAAIRequest", queryIdAAIRequest) utils.log("DEBUG", Prefix + "queryIdAAIRequest - " + "\n" + queryIdAAIRequest, isDebugEnabled) @@ -538,7 +538,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { } - public void callRESTReQueryAAINetworkId(Execution execution) { + public void callRESTReQueryAAINetworkId(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) @@ -554,7 +554,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { String aai_endpoint = execution.getVariable("URN_aai_endpoint") AaiUtil aaiUriUtil = new AaiUtil(this) String aai_uri = aaiUriUtil.getNetworkL3NetworkUri(execution) - String requeryIdAAIRequest = "${aai_endpoint}${aai_uri}/" + networkId + "?depth=1" + String requeryIdAAIRequest = "${aai_endpoint}${aai_uri}/" + networkId + "?depth=all" utils.logAudit(requeryIdAAIRequest) execution.setVariable(Prefix + "requeryIdAAIRequest", requeryIdAAIRequest) utils.log("DEBUG", Prefix + "requeryIdAAIRequest - " + "\n" + requeryIdAAIRequest, isDebugEnabled) @@ -614,7 +614,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { } - public void callRESTQueryAAINetworkVpnBinding(Execution execution) { + public void callRESTQueryAAINetworkVpnBinding(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) @@ -686,9 +686,19 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { utils.log("DEBUG", " AAI Query Vpn Binding Success REST Response, , vpnBinding #" + counting + " : " + "\n" + aaiResponseAsString, isDebugEnabled) String routeTarget = "" - if (utils.nodeExists(aaiResponseAsString, "global-route-target")) { - routeTarget = utils.getNodeText1(aaiResponseAsString, "global-route-target") - routeTargets += "" + routeTarget + "" + '\n' + String routeRole = "" + if (utils.nodeExists(aaiResponseAsString, "route-targets")) { + String aaiRouteTargets = utils.getNodeXml(aaiResponseAsString, "route-targets", false) + def aaiRouteTargetsXml = new XmlSlurper().parseText(aaiRouteTargets) + def aaiRouteTarget = aaiRouteTargetsXml.'**'.findAll {it.name() == "route-target"} + for (j in 0..aaiRouteTarget.size()-1) { + routeTarget = utils.getNodeText1(XmlUtil.serialize(aaiRouteTarget[j]), "global-route-target") + routeRole = utils.getNodeText1(XmlUtil.serialize(aaiRouteTarget[j]), "route-target-role") + routeTargets += "" + '\n' + + " " + routeTarget + "" + '\n' + + " " + routeRole + "" + '\n' + + "" + '\n' + } } } else { @@ -748,7 +758,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { } - public void callRESTQueryAAINetworkPolicy(Execution execution) { + public void callRESTQueryAAINetworkPolicy(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) @@ -884,7 +894,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { } - public void callRESTQueryAAINetworkTableRef(Execution execution) { + public void callRESTQueryAAINetworkTableRef(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) @@ -1021,7 +1031,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { } - public void callRESTUpdateContrailAAINetwork(Execution execution) { + public void callRESTUpdateContrailAAINetwork(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) @@ -1038,7 +1048,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { String aai_endpoint = execution.getVariable("URN_aai_endpoint") AaiUtil aaiUriUtil = new AaiUtil(this) String aai_uri = aaiUriUtil.getNetworkL3NetworkUri(execution) - String updateContrailAAIUrlRequest = "${aai_endpoint}${aai_uri}/" + networkId + "?depth=1" + String updateContrailAAIUrlRequest = "${aai_endpoint}${aai_uri}/" + networkId + "?depth=all" utils.logAudit(updateContrailAAIUrlRequest) execution.setVariable(Prefix + "updateContrailAAIUrlRequest", updateContrailAAIUrlRequest) @@ -1103,7 +1113,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { } - public void prepareCreateNetworkRequest (Execution execution) { + public void prepareCreateNetworkRequest (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) @@ -1146,7 +1156,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { } - public void prepareSDNCRequest (Execution execution) { + public void prepareSDNCRequest (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) @@ -1188,7 +1198,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { } - public void prepareRpcSDNCRequest (Execution execution) { + public void prepareRpcSDNCRequest (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) @@ -1221,7 +1231,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { } - public void prepareRpcSDNCActivateRequest (Execution execution) { + public void prepareRpcSDNCActivateRequest (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) @@ -1260,7 +1270,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { // Post or Validate Response Section // ************************************************** - public void validateCreateNetworkResponse (Execution execution) { + public void validateCreateNetworkResponse (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) @@ -1333,7 +1343,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { } - public void validateSDNCResponse (Execution execution) { + public void validateSDNCResponse (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) @@ -1361,7 +1371,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { } - public void validateRpcSDNCActivateResponse (Execution execution) { + public void validateRpcSDNCActivateResponse (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) @@ -1390,7 +1400,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { } - public void prepareSDNCRollbackRequest (Execution execution) { + public void prepareSDNCRollbackRequest (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) @@ -1422,7 +1432,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { } - public void prepareRpcSDNCRollbackRequest (Execution execution) { + public void prepareRpcSDNCRollbackRequest (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) @@ -1454,7 +1464,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { } - public void prepareRpcSDNCActivateRollback(Execution execution) { + public void prepareRpcSDNCActivateRollback(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) @@ -1487,7 +1497,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { } - public void prepareRollbackData(Execution execution) { + public void prepareRollbackData(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) @@ -1529,7 +1539,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { } - public void postProcessResponse(Execution execution) { + public void postProcessResponse(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) @@ -1590,7 +1600,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { } - public void prepareSuccessRollbackData(Execution execution) { + public void prepareSuccessRollbackData(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) @@ -1639,7 +1649,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { } - public void setExceptionFlag(Execution execution){ + public void setExceptionFlag(DelegateExecution execution){ def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) @@ -1671,7 +1681,7 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor { - public void processJavaException(Execution execution){ + public void processJavaException(DelegateExecution execution){ def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollback.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollback.groovy index 0bd5893cf5..760389ef43 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollback.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollback.groovy @@ -36,7 +36,7 @@ import org.openecomp.mso.rest.RESTConfig import java.util.UUID; import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.runtime.Execution +import org.camunda.bpm.engine.delegate.DelegateExecution import org.apache.commons.lang3.* import org.apache.commons.codec.binary.Base64; import org.springframework.web.util.UriUtils @@ -59,7 +59,7 @@ public class DoCreateNetworkInstanceRollback extends AbstractServiceTaskProcesso * This method is executed during the preProcessRequest task of the DoCreateNetworkInstanceRollback.bpmn process. * @param execution */ - public InitializeProcessVariables(Execution execution){ + public InitializeProcessVariables(DelegateExecution execution){ /* Initialize all the process variables in this block */ execution.setVariable(Prefix + "rollbackNetworkRequest", null) @@ -93,7 +93,7 @@ public class DoCreateNetworkInstanceRollback extends AbstractServiceTaskProcesso * This method is executed during the preProcessRequest task of the DoCreateNetworkInstanceRollback.bpmn process. * @param execution */ - public void preProcessRequest (Execution execution) { + public void preProcessRequest (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) @@ -180,7 +180,7 @@ public class DoCreateNetworkInstanceRollback extends AbstractServiceTaskProcesso } - public void callPONetworkAdapter (Execution execution) { + public void callPONetworkAdapter (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) @@ -222,7 +222,7 @@ public class DoCreateNetworkInstanceRollback extends AbstractServiceTaskProcesso } - public void validateRollbackResponses (Execution execution) { + public void validateRollbackResponses (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) @@ -365,7 +365,7 @@ public class DoCreateNetworkInstanceRollback extends AbstractServiceTaskProcesso - public void processJavaException(Execution execution){ + public void processJavaException(DelegateExecution execution){ def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy index 91ecabcec3..5789e710e7 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy @@ -19,28 +19,38 @@ */ package org.openecomp.mso.bpmn.infrastructure.scripts; -import static org.apache.commons.lang3.StringUtils.*; -import groovy.xml.XmlUtil -import groovy.json.* - -import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition -import org.openecomp.mso.bpmn.core.domain.ServiceInstance -import org.openecomp.mso.bpmn.core.domain.ModelInfo -import org.openecomp.mso.bpmn.core.json.JsonUtils +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution import org.openecomp.mso.bpmn.common.scripts.AaiUtil import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.openecomp.mso.bpmn.common.scripts.CatalogDbUtils import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils import org.openecomp.mso.bpmn.core.RollbackData import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.rest.APIResponse; +import org.openecomp.mso.bpmn.core.domain.ModelInfo +import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition +import org.openecomp.mso.bpmn.core.domain.ServiceInstance +import org.openecomp.mso.bpmn.core.json.JsonUtils +import org.openecomp.mso.bpmn.infrastructure.aai.AAICreateResources +import org.openecomp.mso.rest.APIResponse +import org.springframework.web.util.UriUtils + +import static org.apache.commons.lang3.StringUtils.*; +import groovy.xml.XmlUtil +import groovy.json.* + import org.openecomp.mso.rest.RESTClient import org.openecomp.mso.rest.RESTConfig +import org.openecomp.mso.client.aai.AAIResourcesClient + +import java.util.logging.Logger; +import java.net.URI; import java.util.UUID; import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.runtime.Execution +import org.camunda.bpm.engine.delegate.DelegateExecution import org.json.JSONObject; import org.apache.commons.lang3.* import org.apache.commons.codec.binary.Base64; @@ -70,14 +80,16 @@ import org.springframework.web.util.UriUtils; * @param - WorkflowException * @param - serviceInstanceName - (GET from AAI if null in input) * + * This BB processes Macros(except TRANSPORT all sent to sdnc) and Alacartes(sdncSvcs && nonSdncSvcs) */ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { String Prefix="DCRESI_" ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() + CatalogDbUtils cutils = new CatalogDbUtils() - public void preProcessRequest (Execution execution) { + public void preProcessRequest (DelegateExecution execution) { def isDebugEnabled = execution.getVariable("isDebugLogEnabled") String msg = "" utils.log("DEBUG"," ***** preProcessRequest *****", isDebugEnabled) @@ -131,31 +143,19 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { String serviceInstanceId = "" String serviceType = "" String serviceRole = "" - + ServiceDecomposition serviceDecomp = (ServiceDecomposition) execution.getVariable("serviceDecomposition") if (serviceDecomp != null) { - serviceType = serviceDecomp.getServiceType() - if (serviceType == null) - { - utils.log("DEBUG", "null serviceType", isDebugEnabled) - serviceType = "" - } - else - { - utils.log("DEBUG", "serviceType:" + serviceType, isDebugEnabled) - } - serviceRole = serviceDecomp.getServiceRole() - if (serviceRole == null) - { - serviceRole = "" - } + serviceType = serviceDecomp.getServiceType() ?: "" + utils.log("DEBUG", "serviceType:" + serviceType, isDebugEnabled) + serviceRole = serviceDecomp.getServiceRole() ?: "" ServiceInstance serviceInstance = serviceDecomp.getServiceInstance() if (serviceInstance != null) { - serviceInstanceId = serviceInstance.getInstanceId() - serviceInstanceName = serviceInstance.getInstanceName() + serviceInstanceId = serviceInstance.getInstanceId() ?: "" + serviceInstanceName = serviceInstance.getInstanceName() ?: "" execution.setVariable("serviceInstanceId", serviceInstanceId) execution.setVariable("serviceInstanceName", serviceInstanceName) } @@ -163,10 +163,10 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { ModelInfo modelInfo = serviceDecomp.getModelInfo() if (modelInfo != null) { - modelInvariantUuid = modelInfo.getModelInvariantUuid() - modelVersion = modelInfo.getModelVersion() - modelUuid = modelInfo.getModelUuid() - modelName = modelInfo.getModelName() + modelInvariantUuid = modelInfo.getModelInvariantUuid() ?: "" + modelVersion = modelInfo.getModelVersion() ?: "" + modelUuid = modelInfo.getModelUuid() ?: "" + modelName = modelInfo.getModelName() ?: "" } else { @@ -178,52 +178,78 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { else { //requestDetails.requestInfo. for AAI GET/PUT serviceInstanceData & SDNC assignToplology - serviceInstanceName = execution.getVariable("serviceInstanceName") - serviceInstanceId = execution.getVariable("serviceInstanceId") + serviceInstanceName = execution.getVariable("serviceInstanceName") ?: "" + serviceInstanceId = execution.getVariable("serviceInstanceId") ?: "" String serviceModelInfo = execution.getVariable("serviceModelInfo") if (isBlank(serviceModelInfo)) { msg = "Input serviceModelInfo is null" utils.log("DEBUG", msg, isDebugEnabled) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - modelInvariantUuid = jsonUtil.getJsonValue(serviceModelInfo, "modelInvariantUuid") - modelVersion = jsonUtil.getJsonValue(serviceModelInfo, "modelVersion") - modelUuid = jsonUtil.getJsonValue(serviceModelInfo, "modelUuid") - modelName = jsonUtil.getJsonValue(serviceModelInfo, "modelName") + } + modelInvariantUuid = jsonUtil.getJsonValue(serviceModelInfo, "modelInvariantUuid") ?: "" + modelVersion = jsonUtil.getJsonValue(serviceModelInfo, "modelVersion") ?: "" + modelUuid = jsonUtil.getJsonValue(serviceModelInfo, "modelUuid") ?: "" + modelName = jsonUtil.getJsonValue(serviceModelInfo, "modelName") ?: "" //modelCustomizationUuid NA for SI } + execution.setVariable("serviceType", serviceType) execution.setVariable("serviceRole", serviceRole) + execution.setVariable("serviceInstanceName", serviceInstanceName) + + execution.setVariable("modelInvariantUuid", modelInvariantUuid) + execution.setVariable("modelVersion", modelVersion) + execution.setVariable("modelUuid", modelUuid) + execution.setVariable("modelName", modelName) - if (serviceInstanceName == null) { - execution.setVariable("serviceInstanceName", "") - serviceInstanceName = "" + //alacarte SIs are NOT sent to sdnc. exceptions are listed in config variable + String svcTypes = execution.getVariable("URN_sdnc_si_svc_types") ?: "" + utils.log("DEBUG", "SDNC SI serviceTypes:" + svcTypes, isDebugEnabled) + List svcList = Arrays.asList(svcTypes.split("\\s*,\\s*")); + boolean isSdncService= false + for (String listEntry : svcList){ + if (listEntry.equalsIgnoreCase(serviceType)){ + isSdncService = true + break; + } } + + //All Macros are sent to SDNC, TRANSPORT(Macro) is sent to SDNW + //Alacartes are sent to SDNC if they are listed in config variable above + execution.setVariable("sendToSDNC", true) + if(execution.getVariable("sdncVersion").equals("1610")) //alacarte + { + if(!isSdncService){ + execution.setVariable("sendToSDNC", false) + //alacarte non-sdnc svcs must provide name (sdnc provides name for rest) + if (isBlank(execution.getVariable("serviceInstanceName" ))) + { + msg = "Input serviceInstanceName must be provided for alacarte" + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + } + } + + utils.log("DEBUG", "isSdncService: " + isSdncService, isDebugEnabled) + utils.log("DEBUG", "Send To SDNC: " + execution.getVariable("sendToSDNC"), isDebugEnabled) + utils.log("DEBUG", "Service Type: " + execution.getVariable("serviceType"), isDebugEnabled) + + //macro may provide name and alacarte-portm may provide name + execution.setVariable("checkAAI", false) + if (!isBlank(execution.getVariable("serviceInstanceName" ))) + { + execution.setVariable("checkAAI", true) + } + if (isBlank(serviceInstanceId)){ msg = "Input serviceInstanceId is null" utils.log("DEBUG", msg, isDebugEnabled) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } - if (modelInvariantUuid == null) { - modelInvariantUuid = "" - } - if (modelUuid == null) { - modelUuid = "" - } - if (modelVersion == null) { - modelVersion = "" - } - if (modelName == null) { - modelName = "" - } - - execution.setVariable("modelInvariantUuid", modelInvariantUuid) - execution.setVariable("modelVersion", modelVersion) - execution.setVariable("modelUuid", modelUuid) - execution.setVariable("modelName", modelName) StringBuilder sbParams = new StringBuilder() Map paramsMap = execution.getVariable("serviceInputParams") @@ -250,7 +276,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { execution.setVariable("siParamsXml", siParamsXml) //AAI PUT - String oStatus = execution.getVariable("initialStatus") ?: "" + String oStatus = execution.getVariable("initialStatus") ?: "Active" if ("TRANSPORT".equalsIgnoreCase(serviceType)) { oStatus = "Created" @@ -260,6 +286,28 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { String serviceTypeLine = isBlank(serviceType) ? "" : "${serviceType}" String serviceRoleLine = isBlank(serviceRole) ? "" : "${serviceRole}" + //QUERY CATALOG DB AND GET WORKLOAD / ENVIRONMENT CONTEXT + String environmentContext = "" + String workloadContext ="" + + try{ + String json = cutils.getServiceResourcesByServiceModelInvariantUuidString(execution,modelInvariantUuid ) + + utils.log("DEBUG", "JSON IS: "+json, isDebugEnabled) + + environmentContext = jsonUtil.getJsonValue(json, "serviceResources.environmentContext") ?: "" + workloadContext = jsonUtil.getJsonValue(json, "serviceResources.workloadContext") ?: "" + utils.log("DEBUG", "Env Context is: "+ environmentContext, isDebugEnabled) + utils.log("DEBUG", "Workload Context is: "+ workloadContext, isDebugEnabled) + }catch(BpmnError e){ + throw e + } catch (Exception ex){ + msg = "Exception in preProcessRequest " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + + //Create AAI Payload AaiUtil aaiUriUtil = new AaiUtil(this) String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution) String namespace = aaiUriUtil.getNamespaceFromUri(aai_uri) @@ -271,12 +319,14 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { ${statusLine} ${modelInvariantUuid} ${modelUuid} + ${environmentContext} + ${workloadContext} """.trim() execution.setVariable("serviceInstanceData", serviceInstanceData) utils.logAudit(serviceInstanceData) utils.log("DEBUG", " 'payload' to create Service Instance in AAI - " + "\n" + serviceInstanceData, isDebugEnabled) - + } catch (BpmnError e) { throw e; } catch (Exception ex){ @@ -288,7 +338,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { } //TODO: Will be able to replace with call to GenericGetService - public void getAAICustomerById (Execution execution) { + public void getAAICustomerById (DelegateExecution execution) { // https://{aaiEP}/aai/v8/business/customers/customer/{globalCustomerId} def isDebugEnabled = execution.getVariable("isDebugLogEnabled") String msg = "" @@ -360,7 +410,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { } - public void postProcessAAIGET(Execution execution) { + public void postProcessAAIGET(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("DEBUG"," ***** postProcessAAIGET ***** ", isDebugEnabled) String msg = "" @@ -402,7 +452,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { utils.log("DEBUG"," *** Exit postProcessAAIGET *** ", isDebugEnabled) } - public void postProcessAAIPUT(Execution execution) { + public void postProcessAAIPUT(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("DEBUG"," ***** postProcessAAIPUT ***** ", isDebugEnabled) String msg = "" @@ -440,7 +490,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { utils.log("DEBUG"," *** Exit postProcessAAIPUT *** ", isDebugEnabled) } - public void preProcessSDNCAssignRequest(Execution execution) { + public void preProcessSDNCAssignRequest(DelegateExecution execution) { def isDebugEnabled = execution.getVariable("isDebugLogEnabled") String msg = "" utils.log("DEBUG"," ***** preProcessSDNCAssignRequest *****", isDebugEnabled) @@ -453,7 +503,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { def serviceId = execution.getVariable("productFamilyId") def subscriptionServiceType = execution.getVariable("subscriptionServiceType") def globalSubscriberId = execution.getVariable("globalSubscriberId") //globalCustomerId - def serviceType = execution.getVariable("serviceType") + def msoAction = "" def modelInvariantUuid = execution.getVariable("modelInvariantUuid") def modelVersion = execution.getVariable("modelVersion") @@ -464,6 +514,12 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { def siParamsXml = execution.getVariable("siParamsXml") + // special URL for SDNW, msoAction helps set diff url in SDNCA + if("TRANSPORT".equalsIgnoreCase(execution.getVariable("serviceType"))) + { + msoAction = "TRANSPORT" + } + String sdncAssignRequest = """assign service-topology-operation ${callbackURL} - ${serviceType} + ${msoAction} @@ -488,12 +544,12 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { ${serviceId} ${subscriptionServiceType} - + ${modelInvariantUuid} ${modelUuid} ${modelVersion} ${modelName} - + ${serviceInstanceId} ${globalSubscriberId} @@ -531,7 +587,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { utils.log("DEBUG"," *****Exit preProcessSDNCAssignRequest *****", isDebugEnabled) } - public void postProcessSDNCAssign (Execution execution) { + public void postProcessSDNCAssign (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("DEBUG"," ***** postProcessSDNCAssign ***** ", isDebugEnabled) try { @@ -568,7 +624,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { utils.log("DEBUG"," *** Exit postProcessSDNCAssign *** ", isDebugEnabled) } - public void postProcessAAIGET2(Execution execution) { + public void postProcessAAIGET2(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("DEBUG"," ***** postProcessAAIGET2 ***** ", isDebugEnabled) String msg = "" @@ -611,7 +667,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { utils.log("DEBUG"," *** Exit postProcessAAIGET2 *** ", isDebugEnabled) } - public void preProcessRollback (Execution execution) { + public void preProcessRollback (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("DEBUG"," ***** preProcessRollback ***** ", isDebugEnabled) try { @@ -632,7 +688,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { utils.log("DEBUG"," *** Exit preProcessRollback *** ", isDebugEnabled) } - public void postProcessRollback (Execution execution) { + public void postProcessRollback (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("DEBUG"," ***** postProcessRollback ***** ", isDebugEnabled) String msg = "" @@ -652,5 +708,91 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor { } utils.log("DEBUG"," *** Exit postProcessRollback *** ", isDebugEnabled) } + + public void createProject(DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG", " ***** createProject ***** ", isDebugEnabled) + + String bpmnRequest = execution.getVariable("requestJson") + String projectName = jsonUtil.getJsonValue(bpmnRequest, "requestDetails.project.projectName") + String serviceInstance = execution.getVariable("serviceInstanceId") + + utils.log("DEBUG", "BPMN REQUEST IS: "+ bpmnRequest, isDebugEnabled) + utils.log("DEBUG","PROJECT NAME: " + projectName, isDebugEnabled) + utils.log("DEBUG","Service Instance: " + serviceInstance, isDebugEnabled) + + if(projectName == null||projectName.equals("")){ + utils.log("DEBUG", "Project Name was not found in input. Skipping task...", isDebugEnabled) + }else{ + try{ + AAICreateResources aaiCR = new AAICreateResources() + aaiCR.createAAIProject(projectName, serviceInstance) + }catch(Exception ex){ + String msg = "Exception in createProject. " + ex.getMessage(); + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + } + utils.log("DEBUG"," *** Exit createProject *** ", isDebugEnabled) + } + + public void createOwningEntity(DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG", " ***** createOwningEntity ***** ", isDebugEnabled) + String msg = ""; + String bpmnRequest = execution.getVariable("requestJson") + String owningEntityId = jsonUtil.getJsonValue(bpmnRequest, "requestDetails.owningEntity.owningEntityId") + String owningEntityName = jsonUtil.getJsonValue(bpmnRequest,"requestDetails.owningEntity.owningEntityName"); + String serviceInstance = execution.getVariable("serviceInstanceId") + + utils.log("DEBUG","owningEntity: " + owningEntityId, isDebugEnabled) + utils.log("DEBUG", "OwningEntityName: "+ owningEntityName, isDebugEnabled) + utils.log("DEBUG","Service Instance: " + serviceInstance, isDebugEnabled) + + try{ + AAICreateResources aaiCR = new AAICreateResources() + if(owningEntityId==null||owningEntityId.equals("")){ + msg = "Exception in createOwningEntity. OwningEntityId is null in input."; + throw new IllegalStateException(); + }else{ + if(aaiCR.existsOwningEntity(owningEntityId)){ + aaiCR.connectOwningEntityandServiceInstance(owningEntityId,serviceInstance) + }else{ + if(owningEntityName==null||owningEntityName.equals("")){ + msg = "Exception in createOwningEntity. Can't create an owningEntity without an owningEntityName in input."; + throw new IllegalStateException(); + }else{ + aaiCR.createAAIOwningEntity(owningEntityId, owningEntityName, serviceInstance) + } + } + } + }catch(Exception ex){ + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("DEBUG"," *** Exit createOwningEntity *** ", isDebugEnabled) + } + + // ******************************* + // Build Error Section + // ******************************* + + public void processJavaException(DelegateExecution execution){ + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + + try{ + utils.log("DEBUG", "Caught a Java Exception in DoCreateServiceInstance", isDebugEnabled) + utils.log("DEBUG", "Started processJavaException Method", isDebugEnabled) + utils.log("DEBUG", "Variables List: " + execution.getVariables(), isDebugEnabled) + execution.setVariable("UnexpectedError", "Caught a Java Lang Exception in DoCreateServiceInstance") // Adding this line temporarily until this flows error handling gets updated + exceptionUtil.buildWorkflowException(execution, 500, "Caught a Java Lang Exception in DoCreateServiceInstance") + + }catch(Exception e){ + utils.log("DEBUG", "Caught Exception during processJavaException Method: " + e, isDebugEnabled) + execution.setVariable("UnexpectedError", "Exception in processJavaException") // Adding this line temporarily until this flows error handling gets updated + exceptionUtil.buildWorkflowException(execution, 500, "Exception in processJavaException method") + } + utils.log("DEBUG", "Completed processJavaException Method in DoCreateServiceInstance", isDebugEnabled) + } } diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateServiceInstanceRollback.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateServiceInstanceRollback.groovy index 9a84c6b7b8..cb69121e4e 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateServiceInstanceRollback.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateServiceInstanceRollback.groovy @@ -36,7 +36,7 @@ import org.openecomp.mso.rest.RESTConfig import java.util.UUID; import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.runtime.Execution +import org.camunda.bpm.engine.delegate.DelegateExecution import org.json.JSONObject; import org.apache.commons.lang3.* import org.apache.commons.codec.binary.Base64; @@ -65,7 +65,7 @@ public class DoCreateServiceInstanceRollback extends AbstractServiceTaskProcesso String Prefix="DCRESIRB_" - public void preProcessRequest(Execution execution) { + public void preProcessRequest(DelegateExecution execution) { def isDebugEnabled = execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) String msg = "" @@ -135,7 +135,7 @@ public class DoCreateServiceInstanceRollback extends AbstractServiceTaskProcesso utils.log("DEBUG"," ***** Exit preProcessRequest *****", isDebugEnabled) } - public void validateSDNCResponse(Execution execution, String response, String method) { + public void validateSDNCResponse(DelegateExecution execution, String response, String method) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("DEBUG"," ***** validateSDNCResponse ***** ", isDebugEnabled) String msg = "" @@ -168,7 +168,7 @@ public class DoCreateServiceInstanceRollback extends AbstractServiceTaskProcesso utils.log("DEBUG"," ***** Exit validateSDNCResponse ***** ", isDebugEnabled) } - public void postProcessRequest(Execution execution) { + public void postProcessRequest(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("DEBUG"," ***** postProcessRequest ***** ", isDebugEnabled) String msg = "" @@ -202,7 +202,7 @@ public class DoCreateServiceInstanceRollback extends AbstractServiceTaskProcesso } - public void processRollbackException(Execution execution){ + public void processRollbackException(DelegateExecution execution){ def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("DEBUG"," ***** processRollbackException ***** ", isDebugEnabled) try{ @@ -220,7 +220,7 @@ public class DoCreateServiceInstanceRollback extends AbstractServiceTaskProcesso utils.log("DEBUG", " Exit processRollbackException", isDebugEnabled) } - public void processRollbackJavaException(Execution execution){ + public void processRollbackJavaException(DelegateExecution execution){ def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("DEBUG"," ***** processRollbackJavaException ***** ", isDebugEnabled) try{ diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateServiceInstanceRollbackV2.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateServiceInstanceRollbackV2.groovy new file mode 100644 index 0000000000..fa4250df13 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateServiceInstanceRollbackV2.groovy @@ -0,0 +1,51 @@ +package org.openecomp.mso.bpmn.infrastructure.scripts + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition +import org.openecomp.mso.client.orchestration.AAIOrchestrator +import org.openecomp.mso.client.orchestration.SDNCOrchestrator + +public class DoCreateServiceInstanceRollbackV2 extends AbstractServiceTaskProcessor{ + + @Override + public void preProcessRequest(DelegateExecution execution) { + + } + + public void aaiServiceInstanceRollback (DelegateExecution execution) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + def aaiServiceInstanceRollback = execution.getVariable("aaiServiceInstanceRollback") + if(aaiServiceInstanceRollback){ + utils.log("DEBUG"," ***** Started aaiServiceInstanceRollback *****", isDebugEnabled) + try{ + ServiceDecomposition serviceDecomp = execution.getVariable("ServiceDecomposition") + AAIOrchestrator aaiO = new AAIOrchestrator() + aaiO.deleteServiceInstance(serviceDecomp) + }catch (Exception ex) { + String msg = "Error Response from AAI for aaiServiceInstanceRollback" + execution.setVariable("rollbackError", msg) + utils.log("DEBUG", msg, isDebugEnabled) + throw new BpmnError("MSOWorkflowException") + } + utils.log("DEBUG"," ***** Completed aaiServiceInstanceRollback *****", isDebugEnabled) + }else{ + utils.log("DEBUG", "***** SKIPPING A&AI ROLLBACK *****", isDebugEnabled) + } + } + + public void rollbackError (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG"," ***** rollbackError ***** ", isDebugEnabled) + try{ + utils.log("DEBUG", "Caught an Exception in DoCreateServiceInstanceRollbackV2", isDebugEnabled) + }catch(BpmnError b){ + utils.log("DEBUG", "BPMN Error during rollbackError: " + b.getMessage(), isDebugEnabled) + }catch(Exception e){ + utils.log("DEBUG", "Caught Exception during rollbackError: " + e.getMessage(), isDebugEnabled) + } + utils.log("DEBUG", " Exit processRollbackException", isDebugEnabled) + } + +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateServiceInstanceV2.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateServiceInstanceV2.groovy new file mode 100644 index 0000000000..c55ce547c2 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateServiceInstanceV2.groovy @@ -0,0 +1,101 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.openecomp.mso.bpmn.infrastructure.scripts; + +import static org.apache.commons.lang3.StringUtils.*; + +import org.apache.commons.lang3.* +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition +import org.openecomp.mso.client.orchestration.AAIOrchestrator +import org.openecomp.mso.client.orchestration.SDNCOrchestrator + +import groovy.json.* + +/** + * This groovy class supports the DoCreateServiceInstanceV2.bpmn process. + * +*/ + +public class DoCreateServiceInstanceV2 extends AbstractServiceTaskProcessor { + + AAIOrchestrator aaiO = new AAIOrchestrator() + SDNCOrchestrator sdncO = new SDNCOrchestrator() + + @Override + public void preProcessRequest(DelegateExecution execution) { + } + + public void createServiceInstance(DelegateExecution execution) { + execution.setVariable("callSDNC",true) + if(execution.getVariable("serviceType").equalsIgnoreCase("PORT-MIRROR")== false){ + if(execution.getVariable("sdncVersion").equals("1610")){ + execution.setVariable("callSDNC",false); + } + } + ServiceDecomposition serviceDecomp = (ServiceDecomposition) execution.getVariable("serviceDecomposition") + try{ + aaiO.createServiceInstance(serviceDecomp) + } catch (BpmnError e) { + throw e + } + } + + public void createProject(DelegateExecution execution) { + ServiceDecomposition serviceDecomp = (ServiceDecomposition) execution.getVariable("serviceDecomposition") + if (serviceDecomp.getServiceInstance() != null && serviceDecomp.getProject() != null) { + try{ + aaiO.createProjectandConnectServiceInstance(serviceDecomp) + } catch (BpmnError e) { + throw e + } + } + } + + public void createOwningEntity(DelegateExecution execution) { + ServiceDecomposition serviceDecomp = (ServiceDecomposition) execution.getVariable("serviceDecomposition") + if (serviceDecomp.getServiceInstance() != null && serviceDecomp.getOwningEntity() != null) { + try{ + aaiO.createOwningEntityandConnectServiceInstance(serviceDecomp) + } catch (BpmnError e) { + throw e + } + } + } + + public void sdncAssignRequest(DelegateExecution execution) { + ServiceDecomposition serviceDecomp = (ServiceDecomposition) execution.getVariable("serviceDecomposition") + if (serviceDecomp != null) { + try { + sdncO.sendSyncResponse(serviceDecomp) + } catch (BpmnError e) { + throw e + } + } + + } + + public void rollback(DelegateExecution execution) { + //TODO + } + +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVfModule.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVfModule.groovy index 7f30fe25c7..b9319466d9 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVfModule.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVfModule.groovy @@ -20,20 +20,31 @@ package org.openecomp.mso.bpmn.infrastructure.scripts; +import java.util.Map +import java.util.Currency.CurrencyNameGetter + 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.camunda.bpm.engine.delegate.DelegateExecution +import org.json.JSONArray +import org.json.JSONObject import org.openecomp.mso.bpmn.common.scripts.AaiUtil +import org.openecomp.mso.bpmn.common.scripts.CatalogDbUtils import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil import org.openecomp.mso.bpmn.common.scripts.NetworkUtils import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils import org.openecomp.mso.bpmn.common.scripts.VfModuleBase import org.openecomp.mso.bpmn.core.RollbackData import org.openecomp.mso.bpmn.core.WorkflowException +import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition +import org.openecomp.mso.bpmn.core.domain.VnfResource +import org.openecomp.mso.bpmn.core.json.DecomposeJsonUtil import org.openecomp.mso.bpmn.core.json.JsonUtils +import org.openecomp.mso.client.aai.entities.AAIResultWrapper +import org.openecomp.mso.client.aai.entities.uri.AAIUri import org.openecomp.mso.rest.APIResponse import org.openecomp.mso.rest.RESTClient import org.openecomp.mso.rest.RESTConfig @@ -44,6 +55,13 @@ import org.w3c.dom.NamedNodeMap import org.w3c.dom.Node import org.w3c.dom.NodeList import org.xml.sax.InputSource +import com.fasterxml.jackson.databind.ObjectMapper + +import com.fasterxml.jackson.databind.DeserializationFeature +import com.fasterxml.jackson.databind.ObjectMapper +import org.openecomp.mso.client.aai.AAIObjectType; +import org.openecomp.mso.client.aai.AAIResourcesClient +import org.openecomp.mso.client.aai.entities.uri.AAIUriFactory; @@ -53,12 +71,14 @@ public class DoCreateVfModule extends VfModuleBase { ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) + CatalogDbUtils catalog = new CatalogDbUtils() + DecomposeJsonUtil decomposeJsonUtils = new DecomposeJsonUtil() /** * Validates the request message and sets up the workflow. * @param execution the execution */ - public void preProcessRequest(Execution execution) { + public void preProcessRequest(DelegateExecution execution) { def method = getClass().getSimpleName() + '.preProcessRequest(' + 'execution=' + execution.getId() + ')' @@ -85,8 +105,10 @@ public class DoCreateVfModule extends VfModuleBase { def serviceModelInfo = execution.getVariable("serviceModelInfo") logDebug("serviceModelInfo: " + serviceModelInfo, isDebugLogEnabled) - def vnfModelInfo = execution.getVariable("vnfModelInfo") + String modelInvariantUuid = jsonUtil.getJsonValue(serviceModelInfo, "modelInvariantUuid") + logDebug("modelInvariantUuid: " + modelInvariantUuid, isDebugLogEnabled) + def vnfModelInfo = execution.getVariable("vnfModelInfo") //tenantId def tenantId = execution.getVariable("tenantId") @@ -174,7 +196,7 @@ public class DoCreateVfModule extends VfModuleBase { execution.setVariable("DCVFM_asdcServiceModelVersion", asdcServiceModelVersion) logDebug("asdcServiceModelVersion: " + asdcServiceModelVersion, isDebugLogEnabled) //personaModelId - execution.setVariable("DCVFM_personaModelId", jsonUtil.getJsonValue(vfModuleModelInfo, "modelInvariantUuid")) + execution.setVariable("DCVFM_personaModelId", jsonUtil.getJsonValue(vfModuleModelInfo, "modelInvariantUuid")) //personaModelVersion execution.setVariable("DCVFM_personaModelVersion", jsonUtil.getJsonValue(vfModuleModelInfo, "modelUuid")) //vfModuleLabel @@ -210,7 +232,42 @@ public class DoCreateVfModule extends VfModuleBase { def usePreload = execution.getVariable("usePreload") execution.setVariable("DCVFM_usePreload", usePreload) logDebug("usePreload: " + usePreload, isDebugLogEnabled) - + //aLaCarte + def aLaCarte = execution.getVariable("aLaCarte") + execution.setVariable("DCVFM_aLaCarte", aLaCarte) + logDebug("aLaCarte: " + aLaCarte, isDebugLogEnabled) + + //get workload and environment context from parent SI + String environmentContext = "" + String workloadContext ="" + String serviceType ="" + + try{ + String json = catalog.getServiceResourcesByServiceModelInvariantUuidString(execution,modelInvariantUuid ) + serviceType = jsonUtil.getJsonValue(json, "serviceResources.serviceType") + }catch(BpmnError e){ + throw e + } catch (Exception ex){ + String msg = "Exception in preProcessRequest " + ex.getMessage() + utils.log("DEBUG", msg, isDebugLogEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + + try{ + AAIUri serviceInstanceURI = AAIUriFactory.create(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId,serviceType,serviceInstanceId) + AAIResourcesClient aaiRC = new AAIResourcesClient() + AAIResultWrapper aaiRW = aaiRC.get(serviceInstanceURI) + Map aaiJson = aaiRW.asMap() + environmentContext = aaiJson.getOrDefault("environment-context","") + workloadContext = aaiJson.getOrDefault("workload-context","") + + }catch (Exception ex) { + utils.log("DEBUG","Error retreiving parent service instance information", isDebugLogEnabled) + } + + execution.setVariable("DCVFM_environmentContext",environmentContext) + execution.setVariable("DCVFM_workloadContext",workloadContext) + } else { // The info is inside the request - DEAD CODE @@ -338,8 +395,7 @@ public class DoCreateVfModule extends VfModuleBase { isBaseVfModule = utils.getNodeText(request, "is-base-vf-module") } execution.setVariable("DCVFM_isBaseVfModule", isBaseVfModule) - logDebug("isBaseVfModule: " + isBaseVfModule, isDebugLogEnabled) - + logDebug("isBaseVfModule: " + isBaseVfModule, isDebugLogEnabled) //asdcServiceModelVersion def asdcServiceModelVersion = "" if (utils.nodeExists(request, "asdc-service-model-version")) { @@ -426,6 +482,7 @@ public class DoCreateVfModule extends VfModuleBase { rollbackData.put("VFMODULE", "rollbackCreateAAIVfModule", "false") rollbackData.put("VFMODULE", "rollbackCreateNetworkPoliciesAAI", "false") rollbackData.put("VFMODULE", "rollbackUpdateVnfAAI", "false") + rollbackData.put("VFMODULE", "heatstackid", "") String sdncCallbackUrl = (String) execution.getVariable('URN_mso_workflow_sdncadapter_callback') if (sdncCallbackUrl == null || sdncCallbackUrl.trim().isEmpty()) { @@ -455,7 +512,7 @@ public class DoCreateVfModule extends VfModuleBase { * @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 validateWorkflowResponse(Execution execution, String responseVar, + public void validateWorkflowResponse(DelegateExecution execution, String responseVar, String responseCodeVar, String errorResponseVar) { SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) sdncAdapterUtils.validateSDNCResponse(execution, responseVar, responseCodeVar, errorResponseVar) @@ -466,7 +523,7 @@ public class DoCreateVfModule extends VfModuleBase { * Sends the empty, synchronous response back to the API Handler. * @param execution the execution */ - public void sendResponse(Execution execution) { + public void sendResponse(DelegateExecution execution) { def method = getClass().getSimpleName() + '.sendResponse(' + 'execution=' + execution.getId() + ')' @@ -491,7 +548,7 @@ public class DoCreateVfModule extends VfModuleBase { * * @param execution The flow's execution instance. */ - public void postProcessCreateAAIVfModule(Execution execution) { + public void postProcessCreateAAIVfModule(DelegateExecution execution) { def method = getClass().getSimpleName() + '.getVfModule(' + 'execution=' + execution.getId() + ')' @@ -538,7 +595,7 @@ public class DoCreateVfModule extends VfModuleBase { * * @param execution The flow's execution instance. */ - public void queryAAIVfModule(Execution execution) { + public void queryAAIVfModule(DelegateExecution execution) { def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled") def method = getClass().getSimpleName() + '.getVfModule(' + 'execution=' + execution.getId() + @@ -618,9 +675,95 @@ public class DoCreateVfModule extends VfModuleBase { exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIVfModule(): ' + e.getMessage()) } } + + /** + * Using the vnfId and vfModuleName provided in the inputs, + * query AAI to get the corresponding VF Module info. + * A 200 response is expected with the VF Module info in the response body, + * or a 404 response if the module does not exist yet. Will determine VF Module's + * orchestration status if one exists + * + * @param execution The flow's execution instance. + */ + public void queryAAIVfModuleForStatus(DelegateExecution execution) { + def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled") + def method = getClass().getSimpleName() + '.queryAAIVfModuleForStatus(' + + 'execution=' + execution.getId() + + ')' + logDebug('Entered ' + method, isDebugLogEnabled) + + execution.setVariable('DCVFM_orchestrationStatus', '') + + try { + def vnfId = execution.getVariable('DCVFM_vnfId') + def vfModuleName = execution.getVariable('DCVFM_vfModuleName') + + 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") + + "/vf-modules/vf-module?vf-module-name=" + UriUtils.encode(vfModuleName, "UTF-8") + 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("createVfModule - invoking httpGet() to AAI") + + responseData = response.getResponseBodyAsString() + if (responseData != null) { + logDebug("Received generic VNF data: " + responseData, isDebugLogEnabled) + + } + + utils.logAudit("createVfModule - queryAAIVfModule Response: " + responseData) + utils.logAudit("createVfModule - queryAAIVfModule ResponseCode: " + response.getStatusCode()) + + execution.setVariable('DCVFM_queryAAIVfModuleForStatusResponseCode', response.getStatusCode()) + execution.setVariable('DCVFM_queryAAIVfModuleForStatusResponse', responseData) + logDebug('Response code:' + response.getStatusCode(), isDebugLogEnabled) + logDebug('Response:' + System.lineSeparator() + responseData, isDebugLogEnabled) + // Retrieve VF Module info and its orchestration status; if not found, do nothing + if (response.getStatusCode() == 200) { + // Parse the VNF record from A&AI to find base module info + logDebug('Parsing the VNF data to find orchestration status', isDebugLogEnabled) + if (responseData != null) { + def vfModuleText = utils.getNodeXml(responseData, "vf-module") + //def xmlVfModule= new XmlSlurper().parseText(vfModuleText) + def orchestrationStatus = utils.getNodeText1(vfModuleText, "orchestration-status") + execution.setVariable("DCVFM_orchestrationStatus", orchestrationStatus) + // Also retrieve vfModuleId + def vfModuleId = utils.getNodeText1(vfModuleText, "vf-module-id") + execution.setVariable("DCVFM_vfModuleId", vfModuleId) + logDebug("Received orchestration status from A&AI: " + orchestrationStatus, isDebugLogEnabled) + + } + } + } 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 queryAAIVfModuleForStatus(): ' + e.getMessage()) + } + } - public void preProcessSDNCAssignRequest(Execution execution){ + public void preProcessSDNCAssignRequest(DelegateExecution execution){ def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix", Prefix) logDebug(" ======== STARTED preProcessSDNCAssignRequest ======== ", isDebugLogEnabled) @@ -656,7 +799,7 @@ public class DoCreateVfModule extends VfModuleBase { logDebug("======== COMPLETED preProcessSDNCAssignRequest ======== ", isDebugLogEnabled) } - public void preProcessSDNCGetRequest(Execution execution, String element){ + public void preProcessSDNCGetRequest(DelegateExecution execution, String element){ def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled") String sdncVersion = execution.getVariable("DCVFM_sdncVersion") execution.setVariable("prefix", Prefix) @@ -749,7 +892,7 @@ public class DoCreateVfModule extends VfModuleBase { } - public void preProcessVNFAdapterRequest(Execution execution) { + public void preProcessVNFAdapterRequest(DelegateExecution execution) { def method = getClass().getSimpleName() + '.VNFAdapterCreateVfModule(' + 'execution=' + execution.getId() + ')' @@ -798,7 +941,13 @@ public class DoCreateVfModule extends VfModuleBase { def volumeGroupStackId = execution.getVariable("DCVFM_volumeGroupStackId") //modelCustomizationUuid def modelCustomizationUuid = execution.getVariable("DCVFM_modelCustomizationUuid") - + //environmentContext + String environmentContext = execution.getVariable("DCVFM_environmentContext") + //workloadContext + String workloadContext = execution.getVariable("DCVFM_workloadContext") + logDebug("workloadContext: " + workloadContext, isDebugLogEnabled) + logDebug("environmentContext: " + environmentContext, isDebugLogEnabled) + def messageId = execution.getVariable('mso-request-id') + '-' + System.currentTimeMillis() @@ -822,7 +971,7 @@ public class DoCreateVfModule extends VfModuleBase { if (!sdncVersion.equals("1707")) { vfModuleParams = buildVfModuleParams(vnfParamsMap, vfModuleSdncGetResponse, vnfId, vnfName, - vfModuleId, vfModuleName, vfModuleIndex) + vfModuleId, vfModuleName, vfModuleIndex, environmentContext, workloadContext) } else { //Get SDNC Response Data for Vnf Topology @@ -830,7 +979,7 @@ public class DoCreateVfModule extends VfModuleBase { utils.logAudit("vnfSdncGetResponse: " + vnfSdncGetResponse) vfModuleParams = buildVfModuleParamsFromCombinedTopologies(vnfParamsMap, vnfSdncGetResponse, vfModuleSdncGetResponse, vnfId, vnfName, - vfModuleId, vfModuleName, vfModuleIndex) + vfModuleId, vfModuleName, vfModuleIndex, environmentContext, workloadContext) } def svcInstId = "" @@ -884,7 +1033,7 @@ public class DoCreateVfModule extends VfModuleBase { * @param execution the execution * @return the validated request */ - public String validateInfraRequest(Execution execution) { + public String validateInfraRequest(DelegateExecution execution) { def method = getClass().getSimpleName() + '.validateInfraRequest(' + 'execution=' + execution.getId() + ')' @@ -945,7 +1094,7 @@ public class DoCreateVfModule extends VfModuleBase { } } - public boolean isVolumeGroupIdPresent(Execution execution) { + public boolean isVolumeGroupIdPresent(DelegateExecution execution) { def method = getClass().getSimpleName() + '.isVolumeGroupIdPresent(' + 'execution=' + execution.getId() + @@ -966,7 +1115,7 @@ public class DoCreateVfModule extends VfModuleBase { } - public boolean isVolumeGroupNamePresent(Execution execution) { + public boolean isVolumeGroupNamePresent(DelegateExecution execution) { def method = getClass().getSimpleName() + '.isVolumeGroupNamePresent(' + 'execution=' + execution.getId() + @@ -987,7 +1136,7 @@ public class DoCreateVfModule extends VfModuleBase { } - public String buildSDNCRequest(Execution execution, String svcInstId, String action){ + public String buildSDNCRequest(DelegateExecution execution, String svcInstId, String action){ String uuid = execution.getVariable('testReqId') // for junits if(uuid==null){ @@ -1176,7 +1325,7 @@ public class DoCreateVfModule extends VfModuleBase { } - public void preProcessSDNCActivateRequest(Execution execution) { + public void preProcessSDNCActivateRequest(DelegateExecution execution) { def method = getClass().getSimpleName() + '.preProcessSDNCActivateRequest(' + 'execution=' + execution.getId() + ')' @@ -1209,7 +1358,7 @@ public class DoCreateVfModule extends VfModuleBase { logDebug("======== COMPLETED preProcessSDNCActivateRequest Process ======== ", isDebugLogEnabled) } - public void postProcessVNFAdapterRequest(Execution execution) { + public void postProcessVNFAdapterRequest(DelegateExecution execution) { def method = getClass().getSimpleName() + '.postProcessVNFAdapterRequest(' + 'execution=' + execution.getId() + ')' @@ -1298,7 +1447,7 @@ public class DoCreateVfModule extends VfModuleBase { } - public void preProcessUpdateAAIVfModuleRequestOrch(Execution execution) { + public void preProcessUpdateAAIVfModuleRequestOrch(DelegateExecution execution) { def method = getClass().getSimpleName() + '.preProcessUpdateAAIVfModuleRequestOrch(' + 'execution=' + execution.getId() + ')' @@ -1315,6 +1464,8 @@ public class DoCreateVfModule extends VfModuleBase { if (!contrailServiceInstanceFqdn.equals("")) { setContrailServiceInstanceFqdn = true } + + execution.setVariable("DCVFM_orchestrationStatus", "Created") String updateAAIVfModuleRequest = buildUpdateAAIVfModuleRequest(execution, false, true, true, setContrailServiceInstanceFqdn) @@ -1330,8 +1481,38 @@ public class DoCreateVfModule extends VfModuleBase { logDebug("======== COMPLETED preProcessUpdateAAIVfModuleRequestOrch ======== ", isDebugLogEnabled) } + + public void preProcessUpdateAAIVfModuleRequestStatus(DelegateExecution execution, String status) { + def method = getClass().getSimpleName() + '.preProcessUpdateAAIVfModuleStatus(' + + 'execution=' + execution.getId() + + ')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + logDebug('Entered ' + method, isDebugLogEnabled) + execution.setVariable("prefix", Prefix) + logDebug(" ======== STARTED preProcessUpdateAAIVfModuleStatus ======== ", isDebugLogEnabled) + + try{ + + //Build UpdateAAIVfModule Request + execution.setVariable("DCVFM_orchestrationStatus", status) + + String updateAAIVfModuleRequest = buildUpdateAAIVfModuleRequest(execution, false, true, false, false) + + updateAAIVfModuleRequest = utils.formatXml(updateAAIVfModuleRequest) + execution.setVariable("DCVFM_updateAAIVfModuleRequest", updateAAIVfModuleRequest) + logDebug("Outgoing UpdateAAIVfModuleRequest is: \n" + updateAAIVfModuleRequest, isDebugLogEnabled) + utils.logAudit("Outgoing UpdateAAIVfModuleRequest is: \n" + updateAAIVfModuleRequest) + + }catch(Exception e){ + utils.log("ERROR", "Exception Occured Processing preProcessUpdateAAIVfModuleStatus. Exception is:\n" + e, isDebugLogEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during preProcessUpdateAAIVfModuleStatus Method:\n" + e.getMessage()) + } + logDebug("======== COMPLETED preProcessUpdateAAIVfModuleStatus ======== ", isDebugLogEnabled) + + } - public void preProcessUpdateAAIVfModuleRequestGroup(Execution execution) { + + public void preProcessUpdateAAIVfModuleRequestGroup(DelegateExecution execution) { def method = getClass().getSimpleName() + '.preProcessUpdateAAIVfModuleRequestGroup(' + 'execution=' + execution.getId() + ')' @@ -1359,7 +1540,7 @@ public class DoCreateVfModule extends VfModuleBase { } - public void validateSDNCResponse(Execution execution, String response, String method){ + public void validateSDNCResponse(DelegateExecution execution, String response, String method){ def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) logDebug(" *** STARTED ValidateSDNCResponse Process*** ", isDebugLogEnabled) @@ -1394,7 +1575,7 @@ public class DoCreateVfModule extends VfModuleBase { logDebug(" *** COMPLETED ValidateSDNCResponse Process*** ", isDebugLogEnabled) } - public void preProcessUpdateAfterCreateRequest(Execution execution){ + public void preProcessUpdateAfterCreateRequest(DelegateExecution execution){ def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix", Prefix) utils.log("DEBUG", " ======== STARTED preProcessRequest Process ======== ", isDebugLogEnabled) @@ -1441,7 +1622,7 @@ public class DoCreateVfModule extends VfModuleBase { utils.log("DEBUG", "======== COMPLETED preProcessSDNCGetRequest Process ======== ", isDebugLogEnabled) } - public String buildUpdateAAIVfModuleRequest(Execution execution, boolean updateVolumeGroupId, + public String buildUpdateAAIVfModuleRequest(DelegateExecution execution, boolean updateVolumeGroupId, boolean updateOrchestrationStatus, boolean updateHeatStackId, boolean updateContrailFqdn){ def vnfId = execution.getVariable("DCVFM_vnfId") @@ -1453,7 +1634,7 @@ public class DoCreateVfModule extends VfModuleBase { } def orchestrationStatusString = "" if (updateOrchestrationStatus) { - orchestrationStatusString = "Created" + orchestrationStatusString = "" + execution.getVariable("DCVFM_orchestrationStatus") + "" } def heatStackIdString = "" if (updateHeatStackId) { @@ -1480,7 +1661,7 @@ public class DoCreateVfModule extends VfModuleBase { } - public String buildSDNCParamsXml(Execution execution){ + public String buildSDNCParamsXml(DelegateExecution execution){ String params = "" StringBuilder sb = new StringBuilder() @@ -1505,7 +1686,7 @@ public class DoCreateVfModule extends VfModuleBase { return params } - public void queryCloudRegion (Execution execution) { + public void queryCloudRegion (DelegateExecution execution) { def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix", Prefix) utils.log("DEBUG", " ======== STARTED queryCloudRegion ======== ", isDebugLogEnabled) @@ -1557,7 +1738,7 @@ public class DoCreateVfModule extends VfModuleBase { *variables and ensures that the "WorkflowException" Variable is set. * */ - public void processBPMNException(Execution execution){ + public void processBPMNException(DelegateExecution execution){ def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) try{ @@ -1574,7 +1755,7 @@ public class DoCreateVfModule extends VfModuleBase { utils.log("DEBUG", "Completed processBPMNException Method", isDebugEnabled) } - public void prepareCreateAAIVfModuleVolumeGroupRequest(Execution execution) { + public void prepareCreateAAIVfModuleVolumeGroupRequest(DelegateExecution execution) { def method = getClass().getSimpleName() + '.prepareCreateAAIVfModuleVolumeGroupRequest(' + 'execution=' + execution.getId() + ')' @@ -1613,7 +1794,7 @@ public class DoCreateVfModule extends VfModuleBase { } - public void createNetworkPoliciesInAAI(Execution execution) { + public void createNetworkPoliciesInAAI(DelegateExecution execution) { def method = getClass().getSimpleName() + '.createNetworkPoliciesInAAI(' + 'execution=' + execution.getId() + ')' @@ -1763,7 +1944,7 @@ public class DoCreateVfModule extends VfModuleBase { * * @param execution The flow's execution instance. */ - public void prepUpdateAAIGenericVnf(Execution execution) { + public void prepUpdateAAIGenericVnf(DelegateExecution execution) { def method = getClass().getSimpleName() + '.prepUpdateAAIGenericVnf(' + 'execution=' + execution.getId() + ')' @@ -1816,7 +1997,7 @@ public class DoCreateVfModule extends VfModuleBase { * * @param execution The flow's execution instance. */ - public void postProcessUpdateAAIGenericVnf(Execution execution) { + public void postProcessUpdateAAIGenericVnf(DelegateExecution execution) { def method = getClass().getSimpleName() + '.postProcessUpdateAAIGenericVnf(' + 'execution=' + execution.getId() + ')' @@ -1824,7 +2005,7 @@ public class DoCreateVfModule extends VfModuleBase { logDebug('Entered ' + method, isDebugLogEnabled) try { - def rollbackData = execution.getVariable("RollbackData") + def rollbackData = execution.getVariable("rollbackData") rollbackData.put("VFMODULE", "rollbackUpdateVnfAAI", "true") @@ -1842,7 +2023,7 @@ public class DoCreateVfModule extends VfModuleBase { rollbackData.put("VFMODULE", "oamManagementV6Address", oamManagementV6Address) } - execution.setVariable("RollbackData", rollbackData) + execution.setVariable("rollbackData", rollbackData) logDebug('Exited ' + method, isDebugLogEnabled) } catch (BpmnError e) { @@ -1853,7 +2034,62 @@ public class DoCreateVfModule extends VfModuleBase { } } - public void preProcessRollback (Execution execution) { + public void queryCatalogDB (DelegateExecution execution) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + String msg = "" + utils.log("DEBUG"," ***** queryCatalogDB *****", isDebugEnabled) + + try { + boolean twoPhaseDesign = false + // check for input + + String vfModuleModelName = execution.getVariable("DCVFM_vfModuleModelName") + utils.log("DEBUG", "vfModuleModelName: " + vfModuleModelName, isDebugEnabled) + def vnfModelInfo = execution.getVariable("vnfModelInfo") + def vnfModelCustomizationUuid = jsonUtil.getJsonValue(vnfModelInfo, "modelCustomizationUuid") + + utils.log("DEBUG", "vnfModelCustomizationUuid: " + vnfModelCustomizationUuid, isDebugEnabled) + + JSONArray vnfs = catalog.getAllVnfsByVnfModelCustomizationUuid(execution, vnfModelCustomizationUuid, "v2") + + utils.log("DEBUG", "Incoming Query Catalog DB for Vnf Response is: " + vnfModelCustomizationUuid, isDebugEnabled) + utils.logAudit("Incoming Query Catalog DB for Vf Module Response is: " + vnfModelCustomizationUuid) + + utils.log("DEBUG", "obtained VNF list") + // Only one match here + if (vnfs != null) { + JSONObject vnfObject = vnfs.get(0) + if (vnfObject != null) { + String vnfJson = vnfObject.toString() + // + ObjectMapper om = new ObjectMapper(); + VnfResource vnf = om.readValue(vnfJson, VnfResource.class); + + // Get multiStageDesign flag + + String multiStageDesignValue = vnf.getMultiStageDesign() + utils.log("DEBUG", "multiStageDesign value from Catalog DB is: " + multiStageDesignValue, isDebugEnabled) + if (multiStageDesignValue != null) { + if (multiStageDesignValue.equalsIgnoreCase("true")) { + twoPhaseDesign = true + } + } + } + } + + utils.log("DEBUG", "setting twoPhaseDesign flag to: " + twoPhaseDesign, isDebugEnabled) + + execution.setVariable("DCVFM_twoPhaseDesign", twoPhaseDesign) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + logError('Caught exception in queryCatalogDB()', e) + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryCatalogDB(): ' + e.getMessage()) + } + } + + + public void preProcessRollback (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("DEBUG"," ***** preProcessRollback ***** ", isDebugEnabled) try { @@ -1874,7 +2110,7 @@ public class DoCreateVfModule extends VfModuleBase { utils.log("DEBUG"," *** Exit preProcessRollback *** ", isDebugEnabled) } - public void postProcessRollback (Execution execution) { + public void postProcessRollback (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("DEBUG"," ***** postProcessRollback ***** ", isDebugEnabled) String msg = "" diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy index 3ed768aa54..f862a00ac2 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy @@ -20,7 +20,7 @@ package org.openecomp.mso.bpmn.infrastructure.scripts import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.runtime.Execution +import org.camunda.bpm.engine.delegate.DelegateExecution import org.openecomp.mso.bpmn.common.scripts.AaiUtil import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil @@ -36,13 +36,13 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{ def Prefix="DCVFMR_" ExceptionUtil exceptionUtil = new ExceptionUtil() - public void initProcessVariables(Execution execution) { + public void initProcessVariables(DelegateExecution execution) { execution.setVariable("prefix",Prefix) } // parse the incoming DELETE_VF_MODULE request for the Generic Vnf and Vf Module Ids // and formulate the outgoing request for PrepareUpdateAAIVfModuleRequest - public void preProcessRequest(Execution execution) { + public void preProcessRequest(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") initProcessVariables(execution) @@ -141,7 +141,7 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{ // build a SDNC vnf-topology-operation request for the specified action // (note: the action passed is expected to be 'changedelete' or 'delete') - public void prepSDNCAdapterRequest(Execution execution) { + public void prepSDNCAdapterRequest(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") String srvInstId = execution.getVariable("DCVFMR_serviceInstanceId") @@ -232,7 +232,7 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{ execution.setVariable("sdncAdapterWorkflowRequest", request) } - public void preProcessSDNCDeactivateRequest(Execution execution){ + public void preProcessSDNCDeactivateRequest(DelegateExecution execution){ def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix", Prefix) logDebug(" ======== STARTED preProcessSDNCDeactivateRequest ======== ", isDebugLogEnabled) @@ -256,7 +256,7 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{ logDebug("======== COMPLETED preProcessSDNCDeactivateRequest ======== ", isDebugLogEnabled) } - public void preProcessSDNCUnassignRequest(Execution execution) { + public void preProcessSDNCUnassignRequest(DelegateExecution execution) { def method = getClass().getSimpleName() + '.preProcessSDNCUnassignRequest(' + 'execution=' + execution.getId() + ')' @@ -280,7 +280,7 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{ logDebug("======== COMPLETED preProcessSDNCUnassignRequest Process ======== ", isDebugLogEnabled) } - public String buildSDNCRequest(Execution execution, String svcInstId, String action){ + public String buildSDNCRequest(DelegateExecution execution, String svcInstId, String action){ String uuid = execution.getVariable('testReqId') // for junits if(uuid==null){ @@ -340,7 +340,7 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{ // parse the incoming DELETE_VF_MODULE request // and formulate the outgoing VnfAdapterDeleteV1 request - public void prepVNFAdapterRequest(Execution execution) { + public void prepVNFAdapterRequest(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") String requestId = UUID.randomUUID().toString() String origRequestId = execution.getVariable("DCVFMR_requestId") @@ -382,7 +382,7 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{ // parse the incoming DELETE_VF_MODULE request // and formulate the outgoing UpdateAAIVfModuleRequest request - public void prepUpdateAAIVfModule(Execution execution) { + public void prepUpdateAAIVfModule(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") String vnfId = execution.getVariable("DCVFMR_vnfId") String vfModuleId = execution.getVariable("DCVFMR_vfModuleId") @@ -397,10 +397,28 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{ utils.logAudit("UpdateAAIVfModule Request: " + request) execution.setVariable("UpdateAAIVfModuleRequest", request) } + + // parse the incoming DELETE_VF_MODULE request + // and formulate the outgoing UpdateAAIVfModuleRequest request + public void prepUpdateAAIVfModuleToAssigned(DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + String vnfId = execution.getVariable("DCVFMR_vnfId") + String vfModuleId = execution.getVariable("DCVFMR_vfModuleId") + // formulate the request for UpdateAAIVfModule + String request = """ + ${vnfId} + ${vfModuleId} + + Assigned + """ as String + utils.log("DEBUG", "UpdateAAIVfModuleRequest :" + request, isDebugEnabled) + utils.logAudit("UpdateAAIVfModule Request: " + request) + execution.setVariable("UpdateAAIVfModuleRequest", request) + } // parse the incoming DELETE_VF_MODULE request // and formulate the outgoing DeleteAAIVfModuleRequest request - public void prepDeleteAAIVfModule(Execution execution) { + public void prepDeleteAAIVfModule(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") String vnfId = execution.getVariable("DCVFMR_vnfId") String vfModuleId = execution.getVariable("DCVFMR_vfModuleId") @@ -416,7 +434,7 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{ // generates a WorkflowException if // - - public void handleDoDeleteVfModuleFailure(Execution execution) { + public void handleDoDeleteVfModuleFailure(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("ERROR", "AAI error occurred deleting the Generic Vnf: " + execution.getVariable("DoDVfMod_deleteGenericVnfResponse"), isDebugEnabled) @@ -425,7 +443,7 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{ } - public void sdncValidateResponse(Execution execution, String response){ + public void sdncValidateResponse(DelegateExecution execution, String response){ def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) @@ -442,7 +460,7 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{ } } - public void deleteNetworkPoliciesFromAAI(Execution execution) { + public void deleteNetworkPoliciesFromAAI(DelegateExecution execution) { def method = getClass().getSimpleName() + '.deleteNetworkPoliciesFromAAI(' + 'execution=' + execution.getId() + ')' @@ -576,7 +594,7 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{ * * @param execution The flow's execution instance. */ - public void preProcessUpdateAAIGenericVnf(Execution execution) { + public void preProcessUpdateAAIGenericVnf(DelegateExecution execution) { def method = getClass().getSimpleName() + '.preProcessUpdateAAIGenericVnf((' + 'execution=' + execution.getId() + ')' @@ -621,7 +639,7 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{ } } - public void setSuccessfulRollbackStatus (Execution execution){ + public void setSuccessfulRollbackStatus (DelegateExecution execution){ def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix", Prefix) logDebug(" ======== STARTED setSuccessfulRollbackStatus ======== ", isDebugLogEnabled) @@ -638,7 +656,7 @@ public class DoCreateVfModuleRollback extends AbstractServiceTaskProcessor{ logDebug("======== COMPLETED setSuccessfulRollbackStatus ======== ", isDebugLogEnabled) } - public void setFailedRollbackStatus (Execution execution){ + public void setFailedRollbackStatus (DelegateExecution execution){ def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix", Prefix) logDebug(" ======== STARTED setFailedRollbackStatus ======== ", isDebugLogEnabled) diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeRollback.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeRollback.groovy index 0cbcfabddd..e903a547f7 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeRollback.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeRollback.groovy @@ -26,7 +26,7 @@ import groovy.json.* import java.util.UUID; import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.runtime.Execution +import org.camunda.bpm.engine.delegate.DelegateExecution import org.apache.commons.lang3.* import org.apache.commons.codec.binary.Base64; import org.openecomp.mso.bpmn.common.scripts.AaiUtil @@ -52,7 +52,7 @@ public class DoCreateVfModuleVolumeRollback extends AbstractServiceTaskProcessor * This method is executed during the preProcessRequest task of the DoCreateVfModuleVolumeRollback.bpmn process. * @param execution */ - public InitializeProcessVariables(Execution execution){ + public InitializeProcessVariables(DelegateExecution execution){ /* Initialize all the process variables in this block */ execution.setVariable(Prefix + "volumeGroupName", null) @@ -68,7 +68,7 @@ public class DoCreateVfModuleVolumeRollback extends AbstractServiceTaskProcessor * This method is executed during the preProcessRequest task of the DoCreateVfModuleVolumeRollback.bpmn process. * @param execution */ - public void preProcessRequest (Execution execution) { + public void preProcessRequest (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") InitializeProcessVariables(execution) @@ -120,7 +120,7 @@ public class DoCreateVfModuleVolumeRollback extends AbstractServiceTaskProcessor * @param execution * @param isDebugEnabled */ - public void callRESTQueryAAIVolGrpName(Execution execution, isDebugEnabled) { + public void callRESTQueryAAIVolGrpName(DelegateExecution execution, isDebugEnabled) { def volumeGroupName = execution.getVariable('DCVFMODVOLRBK_volumeGroupName') def cloudRegion = execution.getVariable('DCVFMODVOLRBK_lcpCloudRegionId') @@ -169,7 +169,7 @@ public class DoCreateVfModuleVolumeRollback extends AbstractServiceTaskProcessor - public void callRESTDeleteAAIVolumeGroup(Execution execution, isDebugEnabled) { + public void callRESTDeleteAAIVolumeGroup(DelegateExecution execution, isDebugEnabled) { callRESTQueryAAIVolGrpName(execution, isDebugEnabled) @@ -216,7 +216,7 @@ public class DoCreateVfModuleVolumeRollback extends AbstractServiceTaskProcessor - public void processJavaException(Execution execution){ + public void processJavaException(DelegateExecution execution){ def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2.groovy index 2d004b88ac..13a7ffa498 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2.groovy @@ -21,7 +21,7 @@ import org.springframework.web.util.UriUtils import java.util.UUID; import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.runtime.Execution +import org.camunda.bpm.engine.delegate.DelegateExecution import org.apache.commons.lang3.* import org.apache.commons.codec.binary.Base64; @@ -35,12 +35,12 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase { * Perform initial processing, such as request validation, initialization of variables, etc. * * @param execution */ - public void preProcessRequest(Execution execution) { + public void preProcessRequest(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") preProcessRequest(execution, isDebugEnabled) } - public void preProcessRequest(Execution execution, isDebugLogEnabled) { + public void preProcessRequest(DelegateExecution execution, isDebugLogEnabled) { execution.setVariable("prefix",prefix) execution.setVariable(prefix+'SuccessIndicator', false) @@ -88,7 +88,7 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase { * @param execution * @param isDebugLogEnabled */ - public void displayInput(Execution execution, isDebugLogEnabled) { + public void displayInput(DelegateExecution execution, isDebugLogEnabled) { def input = ['mso-request-id', 'msoRequestId', 'isDebugLogEnabled', 'disableRollback', 'failIfExists', 'serviceInstanceId', 'vnfId', 'vnfName', 'tenantId', 'volumeGroupId', 'volumeGroupName', 'lcpCloudRegionId', 'vnfType', 'vfModuleModelInfo', 'asdcServiceModelVersion', 'test-volume-group-name', 'test-volume-group-id', 'vfModuleInputParams'] @@ -106,7 +106,7 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase { * @param execution * @param isDebugEnabled */ - public void setRollbackData(Execution execution, isDebugEnabled) { + public void setRollbackData(DelegateExecution execution, isDebugEnabled) { def rollbackData = execution.getVariable("rollbackData") if (rollbackData == null) { rollbackData = new RollbackData() @@ -122,7 +122,7 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase { * @param execution * @param isDebugEnabled */ - public void validateGetServiceInstanceCall(Execution execution, isDebugEnabled) { + public void validateGetServiceInstanceCall(DelegateExecution execution, isDebugEnabled) { def found = execution.getVariable('GENGS_FoundIndicator') def success = execution.getVariable('GENGS_SuccessIndicator') def serviceInstanceId = execution.getVariable('serviceInstanceId') @@ -141,7 +141,7 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase { * @param execution * @param isDebugEnabled */ - public void callRESTQueryAAICloudRegion (Execution execution, isDebugEnabled) { + public void callRESTQueryAAICloudRegion (DelegateExecution execution, isDebugEnabled) { def cloudRegion = execution.getVariable("lcpCloudRegionId") utils.log("DEBUG", 'Request cloud region is: ' + cloudRegion, isDebugEnabled) @@ -184,7 +184,7 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase { * @param execution * @param isDebugEnabled */ - public void callRESTQueryAAIVolGrpName(Execution execution, isDebugEnabled) { + public void callRESTQueryAAIVolGrpName(DelegateExecution execution, isDebugEnabled) { def volumeGroupName = execution.getVariable('volumeGroupName') def cloudRegion = execution.getVariable('lcpCloudRegionId') @@ -235,7 +235,7 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase { * @param execution * @param isDebugEnabled */ - public void buildWorkflowException(Execution execution, int errorCode, errorMessage, isDebugEnabled) { + public void buildWorkflowException(DelegateExecution execution, int errorCode, errorMessage, isDebugEnabled) { utils.log("DEBUG", errorMessage, isDebugEnabled) (new ExceptionUtil()).buildWorkflowException(execution, 2500, errorMessage) } @@ -246,7 +246,7 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase { * @param execution * @param isDebugEnabled */ - public void handleError(Execution execution, isDebugEnabled) { + public void handleError(DelegateExecution execution, isDebugEnabled) { WorkflowException we = execution.getVariable('WorkflowException') if (we == null) { (new ExceptionUtil()).buildWorkflowException(execution, 2500, "Enexpected error encountered!") @@ -260,7 +260,7 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase { * @param execution * @param isDebugEnabled */ - public void callRESTCreateAAIVolGrpName(Execution execution, isDebugEnabled) { + public void callRESTCreateAAIVolGrpName(DelegateExecution execution, isDebugEnabled) { def vnfId = execution.getVariable('vnfId') def volumeGroupId = execution.getVariable('volumeGroupId') @@ -329,7 +329,7 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase { * Prepare VNF adapter create request XML * @param execution */ - public void prepareVnfAdapterCreateRequest(Execution execution, isDebugEnabled) { + public void prepareVnfAdapterCreateRequest(DelegateExecution execution, isDebugEnabled) { def aaiGenericVnfResponse = execution.getVariable(prefix+'AAIQueryGenericVfnResponse') def vnfId = utils.getNodeText1(aaiGenericVnfResponse, 'vnf-id') @@ -448,44 +448,60 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase { execution.setVariable(prefix+"createVnfARequest", vnfSubCreateWorkflowRequestAsString) // build rollback request for use later if needed - - String vnfSubRollbackWorkflowRequest = - """ - ${cloudSiteId} - ${tenantId} - ${volumeGroupId} - true - true - - ${requestId} - ${serviceId} - - ${messageId} - ${notificationUrl} - """ + String vnfSubRollbackWorkflowRequest = buildRollbackVolumeGroupRequestXml(volumeGroupId, cloudSiteId, tenantId, requestId, serviceId, messageId, notificationUrl) utils.log("DEBUG", "Sub Vnf flow rollback request: vnfSubRollbackWorkflowRequest " + "\n" + vnfSubRollbackWorkflowRequest, isDebugEnabled) String vnfSubRollbackWorkflowRequestAsString = utils.formatXml(vnfSubRollbackWorkflowRequest) execution.setVariable(prefix+"rollbackVnfARequest", vnfSubRollbackWorkflowRequestAsString) } + + public String buildRollbackVolumeGroupRequestXml(volumeGroupId, cloudSiteId, tenantId, requestId, serviceId, messageId, notificationUrl) { + + def request = """ + + + ${volumeGroupId} + {{VOLUMEGROUPSTACKID}} + ${tenantId} + ${cloudSiteId} + true + + ${requestId} + ${serviceId} + + ${messageId} + + true + ${notificationUrl} + + """ + + return request + } + public String updateRollbackVolumeGroupRequestXml(String rollabackRequest, String heatStackId) { + String newRequest = rollabackRequest.replace("{{VOLUMEGROUPSTACKID}}", heatStackId) + return newRequest + } /** * Validate VNF adapter response * @param execution */ - public void validateVnfResponse(Execution execution, isDebugEnabled) { + public void validateVnfResponse(DelegateExecution execution, isDebugEnabled) { def vnfSuccess = execution.getVariable('VNFREST_SuccessIndicator') utils.log("DEBUG", "vnfAdapterSuccessIndicator: "+ vnfSuccess, isDebugEnabled) if(vnfSuccess==true) { - def vnfRollbackRequest = execution.getVariable(prefix+"rollbackVnfARequest") - utils.log("DEBUG", "vnfAdapter rollback request: "+ vnfRollbackRequest, isDebugEnabled) + String createVnfAResponse = execution.getVariable(prefix+"createVnfAResponse") + String heatStackID = utils.getNodeText1(createVnfAResponse, "volumeGroupStackId") + String vnfRollbackRequest = execution.getVariable(prefix+"rollbackVnfARequest") + String updatedVnfRollbackRequest = updateRollbackVolumeGroupRequestXml(vnfRollbackRequest, heatStackID) + utils.log("DEBUG", "vnfAdapter rollback request: "+ updatedVnfRollbackRequest, isDebugEnabled) RollbackData rollbackData = execution.getVariable("rollbackData") - rollbackData.put("DCVFMODULEVOL", "rollbackVnfARequest", vnfRollbackRequest) + rollbackData.put("DCVFMODULEVOL", "rollbackVnfARequest", updatedVnfRollbackRequest) rollbackData.put("DCVFMODULEVOL", "isCreateVnfRollbackNeeded", "true") } - } @@ -495,7 +511,7 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase { * @param execution * @param isDebugEnabled */ - public void callRESTUpdateCreatedVolGrpName(Execution execution, isDebugEnabled) { + public void callRESTUpdateCreatedVolGrpName(DelegateExecution execution, isDebugEnabled) { String requeryAAIVolGrpNameResponse = execution.getVariable(prefix+"queryAAIVolGrpNameResponse") String volumeGroupId = utils.getNodeText1(requeryAAIVolGrpNameResponse, "volume-group-id") @@ -554,7 +570,7 @@ class DoCreateVfModuleVolumeV2 extends VfModuleBase { * @param execution * @param isDebugEnabled */ - public void callRESTQueryAAIGenericVnf(Execution execution, isDebugEnabled) { + public void callRESTQueryAAIGenericVnf(DelegateExecution execution, isDebugEnabled) { def vnfId = execution.getVariable('vnfId') diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVnf.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVnf.groovy index 6b98782527..adc2b695ef 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVnf.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVnf.groovy @@ -20,9 +20,10 @@ package org.openecomp.mso.bpmn.infrastructure.scripts import static org.apache.commons.lang3.StringUtils.* + import org.openecomp.mso.bpmn.core.RollbackData import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.runtime.Execution +import org.camunda.bpm.engine.delegate.DelegateExecution import org.springframework.web.util.UriUtils import org.openecomp.mso.bpmn.common.scripts.AaiUtil import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor @@ -55,7 +56,7 @@ class DoCreateVnf extends AbstractServiceTaskProcessor { * @param - execution * */ - public void preProcessRequest(Execution execution) { + public void preProcessRequest(DelegateExecution execution) { def isDebugEnabled = execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) utils.log("DEBUG", " *** STARTED DoCreateVnf PreProcessRequest Process*** ", isDebugEnabled) @@ -201,9 +202,9 @@ class DoCreateVnf extends AbstractServiceTaskProcessor { utils.logAudit("SDNC Callback URL: " + sdncCallbackUrl) logDebug("SDNC Callback URL is: " + sdncCallbackUrl, isDebugEnabled) - VnfResource vnfResource = (VnfResource) execution.getVariable("vnfResourceDecomposition") - + VnfResource vnfResource = (VnfResource) execution.getVariable((String)"vnfResourceDecomposition") String nfRole = vnfResource.getNfRole() + execution.setVariable("DoCVNF_nfRole", nfRole) logDebug("NF Role is: " + nfRole, isDebugEnabled) @@ -235,37 +236,45 @@ class DoCreateVnf extends AbstractServiceTaskProcessor { } utils.log("DEBUG", "*** COMPLETED DoCreateVnf PreProcessRequest Process ***", isDebugEnabled) } - - public void prepareCreateGenericVnf (Execution execution) { + private Object getVariableEnforced(DelegateExecution execution, String name){ + Object enforced = execution.getVariable(name) + if(!enforced){ + return ""; + } + return enforced; + } + + public void prepareCreateGenericVnf (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) utils.log("DEBUG", " *** STARTED DoCreateVnf PrepareCreateGenericVnf Process *** ", isDebugEnabled) try { //Get Vnf Info - String vnfId = execution.getVariable("DoCVNF_vnfId") - def vnfName = execution.getVariable("DoCVNF_vnfName") + String vnfId = getVariableEnforced(execution, "DoCVNF_vnfId") + String vnfName = getVariableEnforced(execution, "DoCVNF_vnfName") if (vnfName == null) { vnfName = "sdncGenerated" utils.log("DEBUG", "Sending a dummy VNF name to AAI - the name will be generated by SDNC: " + vnfName, isDebugEnabled) } - def vnfType = execution.getVariable("DoCVNF_vnfType") - def serviceId = execution.getVariable("DoCVNF_serviceId") - def orchStatus = execution.getVariable("DoCVNF_orchStatus") - def modelInvariantId = execution.getVariable("DoCVNF_modelInvariantId") - def modelVersionId = execution.getVariable("DoCVNF_modelVersionId") - def modelCustomizationId = execution.getVariable("DoCVNF_modelCustomizationId") + String vnfType = getVariableEnforced(execution, "DoCVNF_vnfType") + utils.log("DEBUG", "WE ARE HERE:" + vnfType, isDebugEnabled) + String serviceId = getVariableEnforced(execution, "DoCVNF_serviceId") + String orchStatus = getVariableEnforced(execution, "DoCVNF_orchStatus") + String modelInvariantId = getVariableEnforced(execution, "DoCVNF_modelInvariantId") + String modelVersionId = getVariableEnforced(execution, "DoCVNF_modelVersionId") + String modelCustomizationId = getVariableEnforced(execution, "DoCVNF_modelCustomizationId") // TODO: 1702 Variable - def equipmentRole = execution.getVariable("DoCVNF_equipmentRole") - def nfType = execution.getVariable("DoCVNF_nfType") - def nfRole = execution.getVariable("DoCVNF_nfRole") - def nfFunction = execution.getVariable("DoCVNF_nfFunction") - def nfNamingCode = execution.getVariable("DoCVNF_nfNamingCode") - + String equipmentRole = getVariableEnforced(execution, "DoCVNF_equipmentRole") + String nfType = getVariableEnforced(execution, "DoCVNF_nfType") + String nfRole = getVariableEnforced(execution, "DoCVNF_nfRole") + String nfFunction = getVariableEnforced(execution, "DoCVNF_nfFunction") + String nfNamingCode = getVariableEnforced(execution, "DoCVNF_nfNamingCode") + //Get Service Instance Info - def serviceInstanceId = execution.getVariable("DoCVNF_serviceInstanceId") - String siRelatedLink = execution.getVariable("GENGS_siResourceLink") + String serviceInstanceId = getVariableEnforced(execution, "DoCVNF_serviceInstanceId") + String siRelatedLink = getVariableEnforced(execution, "GENGS_siResourceLink") int custStart = siRelatedLink.indexOf("customer/") int custEnd = siRelatedLink.indexOf("/service-subscriptions") @@ -324,7 +333,7 @@ class DoCreateVnf extends AbstractServiceTaskProcessor { utils.log("DEBUG", "*** COMPLETED DoCreateVnf PrepareCreateGenericVnf Process ***", isDebugEnabled) } - public void postProcessCreateGenericVnf (Execution execution) { + public void postProcessCreateGenericVnf (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) @@ -344,7 +353,7 @@ class DoCreateVnf extends AbstractServiceTaskProcessor { } - public void preProcessSDNCAssignRequest(Execution execution){ + public void preProcessSDNCAssignRequest(DelegateExecution execution){ def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix", Prefix) logDebug(" ======== STARTED preProcessSDNCAssignRequest ======== ", isDebugLogEnabled) @@ -370,7 +379,7 @@ class DoCreateVnf extends AbstractServiceTaskProcessor { logDebug("======== COMPLETED preProcessSDNCAssignRequest ======== ", isDebugLogEnabled) } - public void preProcessSDNCActivateRequest(Execution execution) { + public void preProcessSDNCActivateRequest(DelegateExecution execution) { def method = getClass().getSimpleName() + '.preProcessSDNCActivateRequest(' + 'execution=' + execution.getId() + ')' @@ -395,7 +404,7 @@ class DoCreateVnf extends AbstractServiceTaskProcessor { logDebug("======== COMPLETED preProcessSDNCActivateRequest Process ======== ", isDebugLogEnabled) } - public String buildSDNCRequest(Execution execution, String svcInstId, String action){ + public String buildSDNCRequest(DelegateExecution execution, String svcInstId, String action){ String uuid = execution.getVariable('testReqId') // for junits if(uuid==null){ @@ -477,7 +486,7 @@ class DoCreateVnf extends AbstractServiceTaskProcessor { return sdncRequest } - public void validateSDNCResponse(Execution execution, String response, String method){ + public void validateSDNCResponse(DelegateExecution execution, String response, String method){ def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) logDebug(" *** STARTED ValidateSDNCResponse Process*** ", isDebugLogEnabled) @@ -523,7 +532,7 @@ class DoCreateVnf extends AbstractServiceTaskProcessor { logDebug(" *** COMPLETED ValidateSDNCResponse Process*** ", isDebugLogEnabled) } - public void preProcessSDNCGetRequest(Execution execution){ + public void preProcessSDNCGetRequest(DelegateExecution execution){ def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix", Prefix) utils.log("DEBUG", " ======== STARTED preProcessSDNCGetRequest Process ======== ", isDebugLogEnabled) @@ -596,7 +605,7 @@ class DoCreateVnf extends AbstractServiceTaskProcessor { * * @param execution The flow's execution instance. */ - public void prepUpdateAAIGenericVnf(Execution execution) { + public void prepUpdateAAIGenericVnf(DelegateExecution execution) { def method = getClass().getSimpleName() + '.prepUpdateAAIGenericVnf(' + 'execution=' + execution.getId() + ')' diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy index 308834038e..4e570f87a9 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy @@ -37,7 +37,7 @@ import org.openecomp.mso.bpmn.core.domain.VnfResource import org.openecomp.mso.bpmn.core.json.DecomposeJsonUtil import org.openecomp.mso.bpmn.core.json.JsonUtils import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.runtime.Execution; +import org.camunda.bpm.engine.delegate.DelegateExecution; import static org.apache.commons.lang3.StringUtils.*; @@ -61,7 +61,7 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor { * * @param - execution */ - public void preProcessRequest(Execution execution) { + public void preProcessRequest(DelegateExecution execution) { def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) utils.log("DEBUG", " *** STARTED DoCreateVnfAndModules PreProcessRequest Process*** ", isDebugLogEnabled) @@ -114,6 +114,9 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor { } } execution.setVariable("vnfId", vnfId) + + // Set aLaCarte to false + execution.setVariable("aLaCarte", false) def rollbackData = execution.getVariable("rollbackData") if (rollbackData == null) { @@ -145,7 +148,7 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor { } - public void queryCatalogDB (Execution execution) { + public void queryCatalogDB (DelegateExecution execution) { def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) @@ -251,7 +254,7 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor { utils.log("DEBUG", "*** COMPLETED DoCreateVnfAndModules QueryCatalogDB Process ***", isDebugLogEnabled) } - public void preProcessAddOnModule(Execution execution){ + public void preProcessAddOnModule(DelegateExecution execution){ def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix", Prefix) logDebug(" ======== STARTED preProcessAddOnModule ======== ", isDebugLogEnabled) @@ -289,7 +292,7 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor { logDebug("======== COMPLETED preProcessAddOnModule ======== ", isDebugLogEnabled) } - public void postProcessAddOnModule(Execution execution){ + public void postProcessAddOnModule(DelegateExecution execution){ def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix", Prefix) logDebug(" ======== STARTED postProcessAddOnModule ======== ", isDebugLogEnabled) @@ -305,7 +308,7 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor { logDebug("======== COMPLETED postProcessAddOnModule ======== ", isDebugLogEnabled) } - public void validateBaseModule(Execution execution){ + public void validateBaseModule(DelegateExecution execution){ def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix", Prefix) logDebug(" ======== STARTED validateBaseModule ======== ", isDebugLogEnabled) @@ -333,7 +336,7 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor { logDebug("======== COMPLETED validateBaseModule ======== ", isDebugLogEnabled) } - public void validateAddOnModule(Execution execution){ + public void validateAddOnModule(DelegateExecution execution){ def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix", Prefix) logDebug(" ======== STARTED validateAddOnModule ======== ", isDebugLogEnabled) @@ -362,7 +365,7 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor { logDebug("======== COMPLETED validateAddOnModule ======== ", isDebugLogEnabled) } - public void preProcessRollback (Execution execution) { + public void preProcessRollback (DelegateExecution execution) { def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled") utils.log("DEBUG"," ***** preProcessRollback ***** ", isDebugLogEnabled) try { @@ -383,7 +386,7 @@ class DoCreateVnfAndModules extends AbstractServiceTaskProcessor { utils.log("DEBUG"," *** Exit preProcessRollback *** ", isDebugLogEnabled) } - public void postProcessRollback (Execution execution) { + public void postProcessRollback (DelegateExecution execution) { def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled") utils.log("DEBUG"," ***** postProcessRollback ***** ", isDebugLogEnabled) String msg = "" diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVnfAndModulesRollback.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVnfAndModulesRollback.groovy index c5d87d817a..e931903ea5 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVnfAndModulesRollback.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVnfAndModulesRollback.groovy @@ -25,7 +25,7 @@ import org.json.JSONObject; import org.json.JSONArray; import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.runtime.Execution; +import org.camunda.bpm.engine.delegate.DelegateExecution; import static org.apache.commons.lang3.StringUtils.*; @@ -55,7 +55,7 @@ class DoCreateVnfAndModulesRollback extends AbstractServiceTaskProcessor { * @param - execution * */ - public void preProcessRequest(Execution execution) { + public void preProcessRequest(DelegateExecution execution) { def isDebugEnabled = execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) utils.log("DEBUG", " *** STARTED DoCreateVnfAndModulesRollback PreProcessRequest Process*** ", isDebugEnabled) @@ -117,7 +117,10 @@ class DoCreateVnfAndModulesRollback extends AbstractServiceTaskProcessor { } else { execution.setVariable("DCVAMR_numOfModulesToDelete", numOfAddOnModules + 1) - } + } + + // Set aLaCarte to false + execution.setVariable("DCVAMR_aLaCarte", false) }catch(BpmnError b){ utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled) @@ -132,7 +135,7 @@ class DoCreateVnfAndModulesRollback extends AbstractServiceTaskProcessor { - public void preProcessCreateVfModuleRollback(Execution execution){ + public void preProcessCreateVfModuleRollback(DelegateExecution execution){ def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix", Prefix) logDebug(" ======== STARTED preProcessCreateVfModuleRollback ======== ", isDebugLogEnabled) @@ -167,7 +170,7 @@ class DoCreateVnfAndModulesRollback extends AbstractServiceTaskProcessor { } - public void postProcessCreateVfModuleRollback(Execution execution){ + public void postProcessCreateVfModuleRollback(DelegateExecution execution){ def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix", Prefix) logDebug(" ======== STARTED postProcessCreateVfModuleRollback ======== ", isDebugLogEnabled) @@ -190,7 +193,7 @@ class DoCreateVnfAndModulesRollback extends AbstractServiceTaskProcessor { } - public void preProcessSDNCDeactivateRequest(Execution execution){ + public void preProcessSDNCDeactivateRequest(DelegateExecution execution){ def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix", Prefix) logDebug(" ======== STARTED preProcessSDNCDeactivateRequest ======== ", isDebugLogEnabled) @@ -214,7 +217,7 @@ class DoCreateVnfAndModulesRollback extends AbstractServiceTaskProcessor { logDebug("======== COMPLETED preProcessSDNCDeactivateRequest ======== ", isDebugLogEnabled) } - public void preProcessSDNCUnassignRequest(Execution execution) { + public void preProcessSDNCUnassignRequest(DelegateExecution execution) { def method = getClass().getSimpleName() + '.preProcessSDNCUnassignRequest(' + 'execution=' + execution.getId() + ')' @@ -239,7 +242,7 @@ class DoCreateVnfAndModulesRollback extends AbstractServiceTaskProcessor { logDebug("======== COMPLETED preProcessSDNCUnassignRequest Process ======== ", isDebugLogEnabled) } - public String buildSDNCRequest(Execution execution, String svcInstId, String action){ + public String buildSDNCRequest(DelegateExecution execution, String svcInstId, String action){ String uuid = execution.getVariable('testReqId') // for junits if(uuid==null){ @@ -296,7 +299,7 @@ class DoCreateVnfAndModulesRollback extends AbstractServiceTaskProcessor { return sdncRequest } - public void validateSDNCResponse(Execution execution, String response, String method){ + public void validateSDNCResponse(DelegateExecution execution, String response, String method){ def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) logDebug(" *** STARTED ValidateSDNCResponse Process*** ", isDebugLogEnabled) @@ -321,7 +324,7 @@ class DoCreateVnfAndModulesRollback extends AbstractServiceTaskProcessor { logDebug(" *** COMPLETED ValidateSDNCResponse Process*** ", isDebugLogEnabled) } - public void setSuccessfulRollbackStatus (Execution execution){ + public void setSuccessfulRollbackStatus (DelegateExecution execution){ def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix", Prefix) logDebug(" ======== STARTED setSuccessfulRollbackStatus ======== ", isDebugLogEnabled) @@ -338,7 +341,7 @@ class DoCreateVnfAndModulesRollback extends AbstractServiceTaskProcessor { logDebug("======== COMPLETED setSuccessfulRollbackStatus ======== ", isDebugLogEnabled) } - public void setFailedRollbackStatus (Execution execution){ + public void setFailedRollbackStatus (DelegateExecution execution){ def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix", Prefix) logDebug(" ======== STARTED setFailedRollbackStatus ======== ", isDebugLogEnabled) diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy index 40e2baab7f..a32fd7b538 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy @@ -41,7 +41,7 @@ import javax.xml.parsers.DocumentBuilder import javax.xml.parsers.DocumentBuilderFactory import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.runtime.Execution +import org.camunda.bpm.engine.delegate.DelegateExecution import org.json.JSONObject; import org.apache.commons.lang3.* import org.apache.commons.codec.binary.Base64; @@ -79,7 +79,7 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() - public void preProcessRequest (Execution execution) { + public void preProcessRequest (DelegateExecution execution) { def isDebugEnabled = execution.getVariable("isDebugLogEnabled") utils.log("INFO"," ***** preProcessRequest *****", isDebugEnabled) String msg = "" @@ -155,13 +155,13 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess } - public void preProcessVFCDelete (Execution execution) { + public void preProcessVFCDelete (DelegateExecution execution) { } - public void postProcessVFCDelete(Execution execution, String response, String method) { + public void postProcessVFCDelete(DelegateExecution execution, String response, String method) { } - public void preProcessSDNCDelete (Execution execution) { + public void preProcessSDNCDelete (DelegateExecution execution) { def isDebugEnabled = execution.getVariable("isDebugLogEnabled") utils.log("INFO"," ***** preProcessSDNCDelete *****", isDebugEnabled) String msg = "" @@ -275,7 +275,7 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess utils.log("INFO"," *****Exit preProcessSDNCDelete *****", isDebugEnabled) } - public void postProcessSDNCDelete(Execution execution, String response, String method) { + public void postProcessSDNCDelete(DelegateExecution execution, String response, String method) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("INFO"," ***** postProcessSDNC " + method + " *****", isDebugEnabled) @@ -307,7 +307,7 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess utils.log("INFO"," *** Exit postProcessSDNC " + method + " ***", isDebugEnabled) } - public void postProcessAAIGET(Execution execution) { + public void postProcessAAIGET(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("INFO"," ***** postProcessAAIGET ***** ", isDebugEnabled) String msg = "" @@ -439,7 +439,7 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess utils.log("INFO"," *** Exit postProcessAAIGET *** ", isDebugEnabled) } - public void postProcessAAIDEL(Execution execution) { + public void postProcessAAIDEL(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("INFO"," ***** postProcessAAIDEL ***** ", isDebugEnabled) String msg = "" @@ -469,7 +469,7 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess utils.log("INFO"," *** Exit postProcessAAIDEL *** ", isDebugEnabled) } - public void preInitResourcesOperStatus(Execution execution){ + public void preInitResourcesOperStatus(DelegateExecution execution){ def isDebugEnabled = execution.getVariable("isDebugLogEnabled") utils.log("INFO", " ======== STARTED preInitResourcesOperStatus Process ======== ", isDebugEnabled) @@ -517,7 +517,7 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess resourceTemplateUUIDs = resourceTemplateUUIDs + it.resourceInstanceId + ":" } } - execution.setVariable("URN_mso_openecomp_adapters_db_endpoint","http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter") + execution.setVariable("URN_mso_adapters_openecomp_db_endpoint","http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter") String payload = """DoDeleteE2EServiceInstance.bpmn process. @@ -81,7 +63,7 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() - public void preProcessRequest (Execution execution) { + public void preProcessRequest (DelegateExecution execution) { def method = getClass().getSimpleName() + '.buildAPPCRequest(' +'execution=' + execution.getId() +')' def isDebugEnabled = execution.getVariable("isDebugLogEnabled") @@ -163,7 +145,7 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce - public void postProcessAAIGET(Execution execution) { + public void postProcessAAIGET(DelegateExecution execution) { def method = getClass().getSimpleName() + '.postProcessAAIGET(' +'execution=' + execution.getId() +')' def isDebugEnabled = execution.getVariable("isDebugLogEnabled") utils.log("INFO","Entered " + method, isDebugEnabled) @@ -221,7 +203,7 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce utils.log("INFO", "Exited " + method, isDebugEnabled) } - private void loadResourcesProperties(Execution execution) { + private void loadResourcesProperties(DelegateExecution execution) { def method = getClass().getSimpleName() + '.loadResourcesProperties(' +'execution=' + execution.getId() +')' def isDebugEnabled = execution.getVariable("isDebugEnabled") utils.log("INFO","Entered " + method, isDebugEnabled) @@ -255,7 +237,7 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce } utils.log("INFO", "Exited " + method, isDebugEnabled) } - private void sortDeleteResource(Execution execution) { + private void sortDeleteResource(DelegateExecution execution) { def method = getClass().getSimpleName() + '.sortDeleteResource(' +'execution=' + execution.getId() +')' def isDebugEnabled = execution.getVariable("isDebugEnabled") utils.log("INFO","Entered " + method, isDebugEnabled) @@ -339,7 +321,7 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce utils.log("INFO", "Exited " + method, isDebugEnabled) } - public void prepareServiceDeleteResource(Execution execution) { + public void prepareServiceDeleteResource(DelegateExecution execution) { def method = getClass().getSimpleName() + '.prepareServiceDeleteResource(' +'execution=' + execution.getId() +')' def isDebugEnabled = execution.getVariable("isDebugLogEnabled") utils.log("INFO","Entered " + method, isDebugEnabled) @@ -624,7 +606,7 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce utils.log("INFO", "Exited " + method, isDebugEnabled) } - private String getAaiAr(Execution execution, String relink) { + private String getAaiAr(DelegateExecution execution, String relink) { def method = getClass().getSimpleName() + '.getAaiAr(' +'execution=' + execution.getId() +')' def isDebugEnabled = execution.getVariable("isDebugLogEnabled") utils.log("INFO","Entered " + method, isDebugEnabled) @@ -650,7 +632,7 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce /** * prepare Decompose next resource to create request */ - public void preProcessDecomposeNextResource(Execution execution){ + public void preProcessDecomposeNextResource(DelegateExecution execution){ def method = getClass().getSimpleName() + '.getAaiAr(' +'execution=' + execution.getId() +')' def isDebugEnabled = execution.getVariable("isDebugLogEnabled") utils.log("INFO","Entered " + method, isDebugEnabled) @@ -708,7 +690,7 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce /** * post Decompose next resource to create request */ - public void postProcessDecomposeNextResource(Execution execution){ + public void postProcessDecomposeNextResource(DelegateExecution execution){ def method = getClass().getSimpleName() + '.postProcessDecomposeNextResource(' +'execution=' + execution.getId() +')' def isDebugEnabled = execution.getVariable("isDebugLogEnabled") utils.log("INFO","Entered " + method, isDebugEnabled) @@ -750,7 +732,7 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce /** * prepare post Unkown Resource Type */ - public void postOtherControllerType(Execution execution){ + public void postOtherControllerType(DelegateExecution execution){ def method = getClass().getSimpleName() + '.postOtherControllerType(' +'execution=' + execution.getId() +')' def isDebugEnabled = execution.getVariable("isDebugEnabled") utils.log("INFO","Entered " + method, isDebugEnabled) @@ -805,7 +787,7 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce } utils.log("INFO", "Exited " + method, isDebugEnabled) } - public void preProcessSDNCDelete (Execution execution) { + public void preProcessSDNCDelete (DelegateExecution execution) { def method = getClass().getSimpleName() + '.preProcessSDNCDelete(' +'execution=' + execution.getId() +')' def isDebugEnabled = execution.getVariable("isDebugLogEnabled") utils.log("INFO","Entered " + method, isDebugEnabled) @@ -921,7 +903,7 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce utils.log("INFO", "Exited " + method, isDebugEnabled) } - public void postProcessSDNCDelete(Execution execution, String response, String action) { + public void postProcessSDNCDelete(DelegateExecution execution, String response, String action) { def method = getClass().getSimpleName() + '.postProcessSDNCDelete(' +'execution=' + execution.getId() +')' def isDebugEnabled = execution.getVariable("isDebugLogEnabled") @@ -955,7 +937,7 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce utils.log("INFO", "Exited " + method, isDebugEnabled) } - public void postProcessAAIDEL(Execution execution) { + public void postProcessAAIDEL(DelegateExecution execution) { def method = getClass().getSimpleName() + '.postProcessAAIDEL(' +'execution=' + execution.getId() +')' def isDebugEnabled = execution.getVariable("isDebugLogEnabled") utils.log("INFO","Entered " + method, isDebugEnabled) @@ -989,7 +971,7 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce /** * Init the service Operation Status */ - public void preUpdateServiceOperationStatus(Execution execution){ + public void preUpdateServiceOperationStatus(DelegateExecution execution){ def method = getClass().getSimpleName() + '.preUpdateServiceOperationStatus(' +'execution=' + execution.getId() +')' def isDebugEnabled = execution.getVariable("isDebugLogEnabled") utils.log("INFO","Entered " + method, isDebugEnabled) @@ -1053,7 +1035,7 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce utils.log("INFO", "Exited " + method, isDebugEnabled) } - public void preInitResourcesOperStatus(Execution execution){ + public void preInitResourcesOperStatus(DelegateExecution execution){ def method = getClass().getSimpleName() + '.preInitResourcesOperStatus(' +'execution=' + execution.getId() +')' def isDebugEnabled = execution.getVariable("isDebugLogEnabled") utils.log("INFO","Entered " + method, isDebugEnabled) @@ -1166,7 +1148,7 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce utils.log("INFO", "Exited " + method, isDebugEnabled) } - public void postProcessVFCDelete(Execution execution, String response, String action) { + public void postProcessVFCDelete(DelegateExecution execution, String response, String action) { def method = getClass().getSimpleName() + '.postProcessVFCDelete(' +'execution=' + execution.getId() +')' def isDebugEnabled = execution.getVariable("isDebugLogEnabled") utils.log("INFO","Entered " + method, isDebugEnabled) @@ -1184,4 +1166,4 @@ public class DoCustomDeleteE2EServiceInstanceV2 extends AbstractServiceTaskProce utils.log("INFO", "Exited " + method, isDebugEnabled) } } - \ No newline at end of file + diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy index a3407553c8..7ded1946b4 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy @@ -34,7 +34,7 @@ import org.openecomp.mso.rest.RESTConfig import java.util.UUID; import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.runtime.Execution +import org.camunda.bpm.engine.delegate.DelegateExecution import org.apache.commons.lang3.* import org.apache.commons.codec.binary.Base64; import org.springframework.web.util.UriUtils @@ -51,7 +51,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { NetworkUtils networkUtils = new NetworkUtils() SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils() - public InitializeProcessVariables(Execution execution){ + public InitializeProcessVariables(DelegateExecution execution){ /* Initialize all the process variables in this block */ execution.setVariable(Prefix + "networkRequest", "") @@ -102,7 +102,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { // Pre or Prepare Request Section // ************************************************** - public void preProcessRequest (Execution execution) { + public void preProcessRequest (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) @@ -229,7 +229,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { } - public void callRESTQueryAAI (Execution execution) { + public void callRESTQueryAAI (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) @@ -244,7 +244,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { String aai_endpoint = execution.getVariable("URN_aai_endpoint") AaiUtil aaiUriUtil = new AaiUtil(this) String aai_uri = aaiUriUtil.getNetworkL3NetworkUri(execution) - String queryAAIRequest = "${aai_endpoint}${aai_uri}/" + networkId + "?depth=1" + String queryAAIRequest = "${aai_endpoint}${aai_uri}/" + networkId + "?depth=all" utils.logAudit(queryAAIRequest) execution.setVariable(Prefix + "queryAAIRequest", queryAAIRequest) utils.log("DEBUG", Prefix + "AAIRequest - " + "\n" + queryAAIRequest, isDebugEnabled) @@ -328,7 +328,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { } - public void callRESTQueryAAICloudRegion (Execution execution) { + public void callRESTQueryAAICloudRegion (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix", Prefix) @@ -375,7 +375,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { } - public void prepareNetworkRequest (Execution execution) { + public void prepareNetworkRequest (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix", Prefix) @@ -463,7 +463,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { * 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) { + public void sendRequestToVnfAdapter(DelegateExecution execution) { def method = getClass().getSimpleName() + '.sendRequestToVnfAdapter(' + 'execution=' + execution.getId() + ')' @@ -498,7 +498,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { } - public void prepareSDNCRequest (Execution execution) { + public void prepareSDNCRequest (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix", Prefix) @@ -548,7 +548,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { } - public void prepareRpcSDNCRequest (Execution execution) { + public void prepareRpcSDNCRequest (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix", Prefix) @@ -588,7 +588,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { } - public void prepareRpcSDNCDeactivate(Execution execution) { + public void prepareRpcSDNCDeactivate(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) @@ -626,7 +626,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { // Post or Validate Response Section // ************************************************** - public void validateNetworkResponse (Execution execution) { + public void validateNetworkResponse (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix", Prefix) @@ -700,7 +700,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { } - public void validateSDNCResponse (Execution execution) { + public void validateSDNCResponse (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix", Prefix) @@ -728,7 +728,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { } - public void validateRpcSDNCDeactivateResponse (Execution execution) { + public void validateRpcSDNCDeactivateResponse (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) @@ -756,7 +756,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { } - public void prepareRpcSDNCDeactivateRollback(Execution execution) { + public void prepareRpcSDNCDeactivateRollback(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) @@ -789,7 +789,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { } - public void prepareRollbackData(Execution execution) { + public void prepareRollbackData(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) @@ -825,7 +825,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { } - public void postProcessResponse (Execution execution) { + public void postProcessResponse (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix", Prefix) @@ -886,7 +886,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { } - public void prepareSuccessRollbackData(Execution execution) { + public void prepareSuccessRollbackData(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) @@ -935,7 +935,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { } - public void prepareRpcSDNCUnassignRollback(Execution execution) { + public void prepareRpcSDNCUnassignRollback(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) @@ -972,7 +972,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { } - public void prepareSDNCRollback (Execution execution) { + public void prepareSDNCRollback (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix", Prefix) @@ -1025,7 +1025,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { } - public void setExceptionFlag(Execution execution){ + public void setExceptionFlag(DelegateExecution execution){ def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) @@ -1055,7 +1055,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { // Build Error Section // ******************************* - public void processJavaException(Execution execution){ + public void processJavaException(DelegateExecution execution){ def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) try{ diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceRollback.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceRollback.groovy index 4c455e743f..c45b90f953 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceRollback.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceRollback.groovy @@ -36,7 +36,7 @@ import org.openecomp.mso.rest.RESTConfig import java.util.UUID; import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.runtime.Execution +import org.camunda.bpm.engine.delegate.DelegateExecution import org.apache.commons.lang3.* import org.apache.commons.codec.binary.Base64; import org.springframework.web.util.UriUtils @@ -59,7 +59,7 @@ public class DoDeleteNetworkInstanceRollback extends AbstractServiceTaskProcesso * This method is executed during the preProcessRequest task of the DoDeleteNetworkInstanceRollback.bpmn process. * @param execution */ - public InitializeProcessVariables(Execution execution){ + public InitializeProcessVariables(DelegateExecution execution){ /* Initialize all the process variables in this block */ execution.setVariable(Prefix + "WorkflowException", null) @@ -88,7 +88,7 @@ public class DoDeleteNetworkInstanceRollback extends AbstractServiceTaskProcesso * This method is executed during the preProcessRequest task of the DoDeleteNetworkInstanceRollback.bpmn process. * @param execution */ - public void preProcessRequest (Execution execution) { + public void preProcessRequest (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) @@ -174,7 +174,7 @@ public class DoDeleteNetworkInstanceRollback extends AbstractServiceTaskProcesso } - public void validateRollbackResponses (Execution execution) { + public void validateRollbackResponses (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) @@ -313,7 +313,7 @@ public class DoDeleteNetworkInstanceRollback extends AbstractServiceTaskProcesso - public void processJavaException(Execution execution){ + public void processJavaException(DelegateExecution execution){ def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy index fd4162fa5c..8fc1f41569 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy @@ -37,7 +37,7 @@ import javax.xml.parsers.DocumentBuilder import javax.xml.parsers.DocumentBuilderFactory import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.runtime.Execution +import org.camunda.bpm.engine.delegate.DelegateExecution import org.json.JSONObject; import org.apache.commons.lang3.* import org.apache.commons.codec.binary.Base64; @@ -75,7 +75,7 @@ public class DoDeleteServiceInstance extends AbstractServiceTaskProcessor { ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() - public void preProcessRequest (Execution execution) { + public void preProcessRequest (DelegateExecution execution) { def isDebugEnabled = execution.getVariable("isDebugLogEnabled") utils.log("DEBUG"," ***** preProcessRequest *****", isDebugEnabled) String msg = "" @@ -83,7 +83,7 @@ public class DoDeleteServiceInstance extends AbstractServiceTaskProcessor { try { String requestId = execution.getVariable("msoRequestId") execution.setVariable("prefix",Prefix) - + //Inputs //requestDetails.subscriberInfo. for AAI GET & PUT & SDNC assignToplology String globalSubscriberId = execution.getVariable("globalSubscriberId") //globalCustomerId @@ -150,57 +150,40 @@ public class DoDeleteServiceInstance extends AbstractServiceTaskProcessor { utils.log("DEBUG"," ***** Exit preProcessRequest *****", isDebugEnabled) } - public void preProcessSDNCDelete (Execution execution) { + public void preProcessSDNCDelete (DelegateExecution execution) { def isDebugEnabled = execution.getVariable("isDebugLogEnabled") utils.log("DEBUG"," ***** preProcessSDNCDelete *****", isDebugEnabled) String msg = "" try { - def serviceInstanceId = execution.getVariable("serviceInstanceId") - def serviceInstanceName = execution.getVariable("serviceInstanceName") - def callbackURL = execution.getVariable("sdncCallbackUrl") - def requestId = execution.getVariable("msoRequestId") - def serviceId = execution.getVariable("productFamilyId") - def subscriptionServiceType = execution.getVariable("subscriptionServiceType") - def globalSubscriberId = execution.getVariable("globalSubscriberId") //globalCustomerId - - String serviceModelInfo = execution.getVariable("serviceModelInfo") + def serviceInstanceId = execution.getVariable("serviceInstanceId") ?: "" + def serviceInstanceName = execution.getVariable("serviceInstanceName") ?: "" + def callbackURL = execution.getVariable("sdncCallbackUrl") ?: "" + def requestId = execution.getVariable("msoRequestId") ?: "" + def serviceId = execution.getVariable("productFamilyId") ?: "" + def subscriptionServiceType = execution.getVariable("subscriptionServiceType") ?: "" + def globalSubscriberId = execution.getVariable("globalSubscriberId") ?: "" //globalCustomerId + + String serviceModelInfo = execution.getVariable("serviceModelInfo") ?: "" def modelInvariantUuid = "" def modelVersion = "" def modelUuid = "" def modelName = "" if (!isBlank(serviceModelInfo)) { - modelInvariantUuid = jsonUtil.getJsonValue(serviceModelInfo, "modelInvariantUuid") - modelVersion = jsonUtil.getJsonValue(serviceModelInfo, "modelVersion") - modelUuid = jsonUtil.getJsonValue(serviceModelInfo, "modelUuid") - modelName = jsonUtil.getJsonValue(serviceModelInfo, "modelName") + modelInvariantUuid = jsonUtil.getJsonValue(serviceModelInfo, "modelInvariantUuid") ?: "" + modelVersion = jsonUtil.getJsonValue(serviceModelInfo, "modelVersion") ?: "" + modelUuid = jsonUtil.getJsonValue(serviceModelInfo, "modelUuid") ?: "" + modelName = jsonUtil.getJsonValue(serviceModelInfo, "modelName") ?: "" - if (modelInvariantUuid == null) { - modelInvariantUuid = "" - } - if (modelVersion == null) { - modelVersion = "" - } - if (modelUuid == null) { - modelUuid = "" - } - if (modelName == null) { - modelName = "" - } - } - if (serviceInstanceName == null) { - serviceInstanceName = "" - } - if (serviceId == null) { - serviceId = "" } - def siParamsXml = execution.getVariable("siParamsXml") - def serviceType = execution.getVariable("serviceType") - if (serviceType == null) + def siParamsXml = execution.getVariable("siParamsXml") ?: "" + def msoAction = "" + // special URL for SDNW, msoAction helps set diff url in SDNCA + if("TRANSPORT".equalsIgnoreCase(execution.getVariable("serviceType"))) { - serviceType = "" + msoAction = "TRANSPORT" } def sdncRequestId = UUID.randomUUID().toString() @@ -215,7 +198,7 @@ public class DoDeleteServiceInstance extends AbstractServiceTaskProcessor { delete service-topology-operation ${callbackURL} - ${serviceType} + ${msoAction} @@ -229,12 +212,12 @@ public class DoDeleteServiceInstance extends AbstractServiceTaskProcessor { ${serviceId} ${subscriptionServiceType} - + ${modelInvariantUuid} ${modelUuid} ${modelVersion} ${modelName} - + ${serviceInstanceId} ${globalSubscriberId} @@ -264,7 +247,7 @@ public class DoDeleteServiceInstance extends AbstractServiceTaskProcessor { utils.log("DEBUG"," *****Exit preProcessSDNCDelete *****", isDebugEnabled) } - public void postProcessSDNCDelete(Execution execution, String response, String method) { + public void postProcessSDNCDelete(DelegateExecution execution, String response, String method) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("DEBUG"," ***** postProcessSDNC " + method + " *****", isDebugEnabled) @@ -297,7 +280,7 @@ public class DoDeleteServiceInstance extends AbstractServiceTaskProcessor { utils.log("DEBUG"," *** Exit postProcessSDNC " + method + " ***", isDebugEnabled) } - public void postProcessAAIGET(Execution execution) { + public void postProcessAAIGET(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("DEBUG"," ***** postProcessAAIGET ***** ", isDebugEnabled) String msg = "" @@ -406,6 +389,33 @@ public class DoDeleteServiceInstance extends AbstractServiceTaskProcessor { } } + + //alacarte SIs are NOT sent to sdnc. exceptions are listed in config variable + String svcTypes = execution.getVariable("URN_sdnc_si_svc_types") ?: "" + utils.log("DEBUG", "SDNC SI serviceTypes:" + svcTypes, isDebugEnabled) + List svcList = Arrays.asList(svcTypes.split("\\s*,\\s*")); + boolean isSdncService= false + for (String listEntry : svcList){ + if (listEntry.equalsIgnoreCase(serviceType)){ + isSdncService = true + break; + } + } + + //All Macros are sent to SDNC, TRANSPORT(Macro) is sent to SDNW + //Alacartes are sent to SDNC if they are listed in config variable above + execution.setVariable("sendToSDNC", true) + if(execution.getVariable("sdncVersion").equals("1610")) //alacarte + { + if(!isSdncService){ + execution.setVariable("sendToSDNC", false) + } + } + + utils.log("DEBUG", "isSdncService: " + isSdncService, isDebugEnabled) + utils.log("DEBUG", "Send To SDNC: " + execution.getVariable("sendToSDNC"), isDebugEnabled) + utils.log("DEBUG", "Service Type: " + execution.getVariable("serviceType"), isDebugEnabled) + } }else{ boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator") @@ -436,7 +446,7 @@ public class DoDeleteServiceInstance extends AbstractServiceTaskProcessor { utils.log("DEBUG"," *** Exit postProcessAAIGET *** ", isDebugEnabled) } - public void postProcessAAIDEL(Execution execution) { + public void postProcessAAIDEL(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("DEBUG"," ***** postProcessAAIDEL ***** ", isDebugEnabled) String msg = "" diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy index 7e957be00a..c71cb0521e 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy @@ -32,7 +32,7 @@ import org.openecomp.mso.rest.APIResponse import java.util.UUID; import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.runtime.Execution +import org.camunda.bpm.engine.delegate.DelegateExecution import org.apache.commons.lang3.* import org.apache.commons.codec.binary.Base64; import org.springframework.web.util.UriUtils @@ -46,7 +46,7 @@ import org.openecomp.mso.rest.APIResponse; */ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProcessor { - + String vfcUrl = "/vfc/rest/v1/vfcadapter" String host = "http://mso.mso.testlab.openecomp.org:8080" @@ -60,7 +60,7 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces * Inclouds: * generate the nsOperationKey */ - public void preProcessRequest (Execution execution) { + public void preProcessRequest (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") String msg = "" utils.log("INFO", " *** preProcessRequest() *** ", isDebugEnabled) @@ -101,7 +101,7 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces /** * delete NS task */ - public void deleteNetworkService(Execution execution) { + public void deleteNetworkService(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("INFO", " *** deleteNetworkService start *** ", isDebugEnabled) String nsOperationKey = execution.getVariable("nsOperationKey"); @@ -121,7 +121,7 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces /** * instantiate NS task */ - public void terminateNetworkService(Execution execution) { + public void terminateNetworkService(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("INFO", " *** terminateNetworkService start *** ", isDebugEnabled) String nsOperationKey = execution.getVariable("nsOperationKey") @@ -140,7 +140,7 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces /** * query NS task */ - public void queryNSProgress(Execution execution) { + public void queryNSProgress(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("INFO", " *** queryNSProgress start *** ", isDebugEnabled) String jobId = execution.getVariable("jobId") @@ -160,10 +160,10 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces /** * delay 5 sec */ - public void timeDelay(Execution execution) { + public void timeDelay(DelegateExecution execution) { try { Thread.sleep(5000); - } catch(InterruptedException e) { + } catch(InterruptedException e) { utils.log("INFO", "Time Delay exception" + e, isDebugEnabled) } } @@ -171,7 +171,7 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces /** * finish NS task */ - public void finishNSDelete(Execution execution) { + public void finishNSDelete(DelegateExecution execution) { //no need to do anything util now } @@ -180,7 +180,7 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces * url: the url of the request * requestBody: the body of the request */ - private APIResponse postRequest(Execution execution, String url, String requestBody){ + private APIResponse postRequest(DelegateExecution execution, String url, String requestBody){ def isDebugEnabled = execution.getVariable("isDebugLogEnabled") utils.log("INFO", " ======== Started Execute VFC adapter Post Process ======== ", isDebugEnabled) utils.log("INFO", "url:"+url +"\nrequestBody:"+ requestBody, isDebugEnabled) @@ -202,7 +202,7 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces * url: the url of the request * requestBody: the body of the request */ - private APIResponse deleteRequest(Execution execution, String url, String requestBody){ + private APIResponse deleteRequest(DelegateExecution execution, String url, String requestBody){ def isDebugEnabled = execution.getVariable("isDebugLogEnabled") utils.log("INFO", " ======== Started Execute VFC adapter Delete Process ======== ", isDebugEnabled) utils.log("INFO", "url:"+url +"\nrequestBody:"+ requestBody, isDebugEnabled) diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy index 70a78f4837..a5c39b6998 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy @@ -23,7 +23,7 @@ import javax.xml.parsers.DocumentBuilder import javax.xml.parsers.DocumentBuilderFactory import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.runtime.Execution +import org.camunda.bpm.engine.delegate.DelegateExecution import org.openecomp.mso.bpmn.common.scripts.AaiUtil import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil @@ -38,6 +38,8 @@ import org.w3c.dom.Element import org.xml.sax.InputSource import org.w3c.dom.Node import org.w3c.dom.NodeList; +import org.openecomp.mso.rest.RESTClient +import org.openecomp.mso.rest.RESTConfig /* Subflow for Delete VF Module. When no DoDeleteVfModuleRequest is specified on input, @@ -54,6 +56,7 @@ import org.w3c.dom.NodeList; * @param - cloudConfiguration* * @param - sdncVersion ("1610") * @param - retainResources +* @param - aLaCarte * * Outputs: * @param - WorkflowException @@ -66,7 +69,7 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{ ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() - public void initProcessVariables(Execution execution) { + public void initProcessVariables(DelegateExecution execution) { execution.setVariable("prefix",Prefix) execution.setVariable("DoDVfMod_contrailNetworkPolicyFqdnList", null) execution.setVariable("DoDVfMod_oamManagementV4Address", null) @@ -76,7 +79,7 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{ // parse the incoming DELETE_VF_MODULE request for the Generic Vnf and Vf Module Ids // and formulate the outgoing request for PrepareUpdateAAIVfModuleRequest - public void preProcessRequest(Execution execution) { + public void preProcessRequest(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") initProcessVariables(execution) @@ -122,7 +125,7 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{ if (retainResources == null) { retainResources = false } - execution.setVariable("retainResources", retainResources) + execution.setVariable("retainResources", retainResources) } else { @@ -184,7 +187,7 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{ // build a SDNC vnf-topology-operation request for the specified action // (note: the action passed is expected to be 'changedelete' or 'delete') - public void prepSDNCAdapterRequest(Execution execution, String action) { + public void prepSDNCAdapterRequest(DelegateExecution execution, String action) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") String uuid = execution.getVariable('testReqId') // for junits @@ -262,7 +265,7 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{ // parse the incoming DELETE_VF_MODULE request // and formulate the outgoing VnfAdapterDeleteV1 request - public void prepVNFAdapterRequest(Execution execution) { + public void prepVNFAdapterRequest(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") def requestId = UUID.randomUUID().toString() def origRequestId = execution.getVariable('requestId') @@ -304,7 +307,7 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{ // parse the incoming DELETE_VF_MODULE request // and formulate the outgoing UpdateAAIVfModuleRequest request - public void prepUpdateAAIVfModule(Execution execution) { + public void prepUpdateAAIVfModule(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") def vnfId = execution.getVariable("vnfId") def vfModuleId = execution.getVariable("vfModuleId") @@ -322,7 +325,7 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{ // parse the incoming DELETE_VF_MODULE request // and formulate the outgoing DeleteAAIVfModuleRequest request - public void prepDeleteAAIVfModule(Execution execution) { + public void prepDeleteAAIVfModule(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") def vnfId = execution.getVariable("vnfId") @@ -339,7 +342,7 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{ // generates a WorkflowException if // - - public void handleDoDeleteVfModuleFailure(Execution execution) { + public void handleDoDeleteVfModuleFailure(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("ERROR", "AAI error occurred deleting the Generic Vnf: " + execution.getVariable("DoDVfMod_deleteGenericVnfResponse"), isDebugEnabled) @@ -349,7 +352,7 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{ execution.setVariable("WorkflowException", exception) } - public void sdncValidateResponse(Execution execution, String response){ + public void sdncValidateResponse(DelegateExecution execution, String response){ def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) @@ -366,7 +369,7 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{ } } - public void postProcessVNFAdapterRequest(Execution execution) { + public void postProcessVNFAdapterRequest(DelegateExecution execution) { def method = getClass().getSimpleName() + '.postProcessVNFAdapterRequest(' + 'execution=' + execution.getId() + ')' @@ -443,7 +446,7 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{ logDebug(" *** COMPLETED postProcessVnfAdapterResponse Process*** ", isDebugLogEnabled) } - public void deleteNetworkPoliciesFromAAI(Execution execution) { + public void deleteNetworkPoliciesFromAAI(DelegateExecution execution) { def method = getClass().getSimpleName() + '.deleteNetworkPoliciesFromAAI(' + 'execution=' + execution.getId() + ')' @@ -571,7 +574,7 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{ * * @param execution The flow's execution instance. */ - public void prepUpdateAAIGenericVnf(Execution execution) { + public void prepUpdateAAIGenericVnf(DelegateExecution execution) { def method = getClass().getSimpleName() + '.prepUpdateAAIGenericVnf(' + 'execution=' + execution.getId() + ')' @@ -615,6 +618,89 @@ public class DoDeleteVfModule extends AbstractServiceTaskProcessor{ exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in prepUpdateAAIGenericVnf(): ' + e.getMessage()) } } + + /** + * Using the vnfId and vfModuleId provided in the inputs, + * query AAI to get the corresponding VF Module info. + * A 200 response is expected with the VF Module info in the response body, + * Will determine VF Module's orchestration status if one exists + * + * @param execution The flow's execution instance. + */ + public void queryAAIVfModuleForStatus(DelegateExecution execution) { + def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled") + def method = getClass().getSimpleName() + '.queryAAIVfModuleForStatus(' + + 'execution=' + execution.getId() + + ')' + logDebug('Entered ' + method, isDebugLogEnabled) + + execution.setVariable(Prefix + 'orchestrationStatus', '') + + try { + def vnfId = execution.getVariable('vnfId') + def vfModuleId = execution.getVariable('vfModuleId') + + 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") + + "/vf-modules/vf-module/" + UriUtils.encode(vfModuleId, "UTF-8") + 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("createVfModule - invoking httpGet() to AAI") + + responseData = response.getResponseBodyAsString() + if (responseData != null) { + logDebug("Received generic VNF data: " + responseData, isDebugLogEnabled) + + } + + utils.logAudit("deleteVfModule - queryAAIVfModule Response: " + responseData) + utils.logAudit("deleteVfModule - queryAAIVfModule ResponseCode: " + response.getStatusCode()) + + execution.setVariable(Prefix + 'queryAAIVfModuleForStatusResponseCode', response.getStatusCode()) + execution.setVariable(Prefix + 'queryAAIVfModuleForStatusResponse', responseData) + logDebug('Response code:' + response.getStatusCode(), isDebugLogEnabled) + logDebug('Response:' + System.lineSeparator() + responseData, isDebugLogEnabled) + // Retrieve VF Module info and its orchestration status; if not found, do nothing + if (response.getStatusCode() == 200) { + // Parse the VNF record from A&AI to find base module info + logDebug('Parsing the VNF data to find orchestration status', isDebugLogEnabled) + if (responseData != null) { + def vfModuleText = utils.getNodeXml(responseData, "vf-module") + //def xmlVfModule= new XmlSlurper().parseText(vfModuleText) + def orchestrationStatus = utils.getNodeText1(vfModuleText, "orchestration-status") + execution.setVariable(Prefix + "orchestrationStatus", orchestrationStatus) + logDebug("Received orchestration status from A&AI: " + orchestrationStatus, isDebugLogEnabled) + + } + } + } 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 queryAAIVfModuleForStatus(): ' + e.getMessage()) + } + } + diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy index 9d9f0bb25a..428f9aa1d9 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy @@ -4,7 +4,7 @@ import javax.xml.parsers.DocumentBuilder import javax.xml.parsers.DocumentBuilderFactory import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.runtime.Execution +import org.camunda.bpm.engine.delegate.DelegateExecution import org.openecomp.mso.bpmn.common.scripts.AaiUtil import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils @@ -27,13 +27,13 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase { ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() - public void initProcessVariables(Execution execution) { + public void initProcessVariables(DelegateExecution execution) { execution.setVariable("prefix",Prefix) execution.setVariable("DDVFMV_contrailNetworkPolicyFqdnList", null) } // parse the incoming request - public void preProcessRequest(Execution execution) { + public void preProcessRequest(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") initProcessVariables(execution) @@ -100,7 +100,7 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase { } } - public void queryAAIForVfModule(Execution execution) { + public void queryAAIForVfModule(DelegateExecution execution) { def method = getClass().getSimpleName() + '.queryAAIForVfModule(' + 'execution=' + execution.getId() + ')' @@ -155,7 +155,7 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase { * * @param execution The flow's execution instance. */ - public void validateVfModule(Execution execution) { + public void validateVfModule(DelegateExecution execution) { def method = getClass().getSimpleName() + '.validateVfModule(' + 'execution=' + execution.getId() + ')' @@ -200,7 +200,7 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase { } - public void preProcessSDNCDeactivateRequest(Execution execution){ + public void preProcessSDNCDeactivateRequest(DelegateExecution execution){ def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix", Prefix) logDebug(" ======== STARTED preProcessSDNCDeactivateRequest ======== ", isDebugLogEnabled) @@ -224,7 +224,7 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase { logDebug("======== COMPLETED preProcessSDNCDeactivateRequest ======== ", isDebugLogEnabled) } - public void preProcessSDNCUnassignRequest(Execution execution) { + public void preProcessSDNCUnassignRequest(DelegateExecution execution) { def method = getClass().getSimpleName() + '.preProcessSDNCUnassignRequest(' + 'execution=' + execution.getId() + ')' @@ -248,7 +248,7 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase { logDebug("======== COMPLETED preProcessSDNCUnassignRequest Process ======== ", isDebugLogEnabled) } - public String buildSDNCRequest(Execution execution, String svcInstId, String action){ + public String buildSDNCRequest(DelegateExecution execution, String svcInstId, String action){ String uuid = execution.getVariable('testReqId') // for junits if(uuid==null){ @@ -306,7 +306,7 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase { return sdncRequest } - public void validateSDNCResponse(Execution execution, String response, String method){ + public void validateSDNCResponse(DelegateExecution execution, String response, String method){ def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) logDebug(" *** STARTED ValidateSDNCResponse Process*** ", isDebugLogEnabled) @@ -334,7 +334,7 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase { // parse the incoming DELETE_VF_MODULE request // and formulate the outgoing VnfAdapterDeleteV1 request - public void prepVNFAdapterRequest(Execution execution) { + public void prepVNFAdapterRequest(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") def requestId = UUID.randomUUID().toString() def origRequestId = execution.getVariable('requestId') @@ -377,7 +377,7 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase { // generates a WorkflowException if // - - public void handleDoDeleteVfModuleFailure(Execution execution) { + public void handleDoDeleteVfModuleFailure(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("ERROR", "AAI error occurred deleting the Generic Vnf: " + execution.getVariable("DDVFMV_deleteGenericVnfResponse"), isDebugEnabled) @@ -387,7 +387,7 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase { execution.setVariable("WorkflowException", exception) } - public void postProcessVNFAdapterRequest(Execution execution) { + public void postProcessVNFAdapterRequest(DelegateExecution execution) { def method = getClass().getSimpleName() + '.postProcessVNFAdapterRequest(' + 'execution=' + execution.getId() + ')' @@ -455,7 +455,7 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase { logDebug(" *** COMPLETED postProcessVnfAdapterResponse Process*** ", isDebugLogEnabled) } - public void deleteNetworkPoliciesFromAAI(Execution execution) { + public void deleteNetworkPoliciesFromAAI(DelegateExecution execution) { def method = getClass().getSimpleName() + '.deleteNetworkPoliciesFromAAI(' + 'execution=' + execution.getId() + ')' @@ -579,7 +579,7 @@ public class DoDeleteVfModuleFromVnf extends VfModuleBase { } // and formulate the outgoing DeleteAAIVfModuleRequest request - public void prepDeleteAAIVfModule(Execution execution) { + public void prepDeleteAAIVfModule(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") def vnfId = execution.getVariable("vnfId") diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2.groovy index c303faafbe..7784e08958 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2.groovy @@ -27,7 +27,7 @@ import java.util.concurrent.ExecutionException; import org.springframework.web.util.UriUtils import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.runtime.Execution +import org.camunda.bpm.engine.delegate.DelegateExecution import org.openecomp.mso.bpmn.common.scripts.AaiUtil import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil @@ -44,7 +44,7 @@ class DoDeleteVfModuleVolumeV2 extends AbstractServiceTaskProcessor { JsonUtils jsonUtil = new JsonUtils() @Override - public void preProcessRequest(Execution execution) { + public void preProcessRequest(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") preProcessRequest(execution, isDebugEnabled) } @@ -54,7 +54,7 @@ class DoDeleteVfModuleVolumeV2 extends AbstractServiceTaskProcessor { * @param execution * @param isDebugLogEnabled */ - public void preProcessRequest (Execution execution, isDebugEnabled) { + public void preProcessRequest (DelegateExecution execution, isDebugEnabled) { //Input: // msoRequestId @@ -96,7 +96,7 @@ class DoDeleteVfModuleVolumeV2 extends AbstractServiceTaskProcessor { * @param execution * @param isDebugLogEnabled */ - public void postProcess(Execution execution, isDebugLogEnabled) { + public void postProcess(DelegateExecution execution, isDebugLogEnabled) { execution.setVariable('wasDeleted', 'true') } @@ -107,7 +107,7 @@ class DoDeleteVfModuleVolumeV2 extends AbstractServiceTaskProcessor { * @param execution * @param isDebugEnabled */ - public void callRESTQueryAAICloudRegion(Execution execution, isDebugEnabled) { + public void callRESTQueryAAICloudRegion(DelegateExecution execution, isDebugEnabled) { String cloudRegion = execution.getVariable('lcpCloudRegionId') String aai_endpoint = execution.getVariable("URN_aai_endpoint") @@ -140,7 +140,7 @@ class DoDeleteVfModuleVolumeV2 extends AbstractServiceTaskProcessor { * @param execution * @param isDebugLogEnabled */ - public void callRESTQueryAAIForVolumeGroup(Execution execution, isDebugLogEnabled) { + public void callRESTQueryAAIForVolumeGroup(DelegateExecution execution, isDebugLogEnabled) { def tenantId = execution.getVariable('tenantId') def volumeGroupId = execution.getVariable('volumeGroupId') @@ -215,7 +215,7 @@ class DoDeleteVfModuleVolumeV2 extends AbstractServiceTaskProcessor { * @param execution * @param isDebugLogEnabled */ - public void prepareVnfAdapterDeleteRequest(Execution execution, isDebugLogEnabled) { + public void prepareVnfAdapterDeleteRequest(DelegateExecution execution, isDebugLogEnabled) { def cloudRegion = execution.getVariable(prefix+'aicCloudRegion') def tenantId = execution.getVariable('tenantId') // input parameter (optional) - see preProcessRequest def volumeGroupId = execution.getVariable('volumeGroupId') // input parameter (required) @@ -256,7 +256,7 @@ class DoDeleteVfModuleVolumeV2 extends AbstractServiceTaskProcessor { * @param execution * @param isDebugEnabled */ - public void callRESTDeleteAAIVolumeGroup(Execution execution, isDebugEnabled) { + public void callRESTDeleteAAIVolumeGroup(DelegateExecution execution, isDebugEnabled) { // get variables String queryAAIVolGrpIdResponse = execution.getVariable(prefix+"queryAAIVolGrpResponse") diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVnf.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVnf.groovy index fbbb07ec4d..5e6fff2fd4 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVnf.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVnf.groovy @@ -25,7 +25,7 @@ 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.camunda.bpm.engine.delegate.DelegateExecution import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil import org.openecomp.mso.bpmn.common.scripts.VidUtils @@ -57,7 +57,7 @@ class DoDeleteVnf extends AbstractServiceTaskProcessor { * @param - execution * */ - public void preProcessRequest(Execution execution) { + public void preProcessRequest(DelegateExecution execution) { def isDebugEnabled = execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) utils.log("DEBUG", " *** STARTED DoDeleteVnf PreProcessRequest Process*** ", isDebugEnabled) @@ -86,7 +86,7 @@ class DoDeleteVnf extends AbstractServiceTaskProcessor { } - public void processGetVnfResponse(Execution execution){ + public void processGetVnfResponse(DelegateExecution execution){ def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) utils.log("DEBUG", " *** STARTED DoDeleteVnf processGetVnfResponse Process *** ", isDebugEnabled) diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy index 3f7ffbf28c..7074df5a91 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy @@ -19,12 +19,13 @@ */ package org.openecomp.mso.bpmn.infrastructure.scripts +import java.awt.Component.BaselineResizeBehavior import java.util.UUID; import org.json.JSONObject; import org.json.JSONArray; import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.runtime.Execution; +import org.camunda.bpm.engine.delegate.DelegateExecution; import static org.apache.commons.lang3.StringUtils.*; @@ -37,6 +38,10 @@ import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils import org.openecomp.mso.bpmn.common.scripts.VidUtils +import org.openecomp.mso.bpmn.core.domain.ModelInfo +import org.openecomp.mso.bpmn.core.domain.ModuleResource +import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition +import org.openecomp.mso.bpmn.core.domain.VnfResource import org.openecomp.mso.bpmn.core.RollbackData import org.openecomp.mso.bpmn.core.WorkflowException import org.springframework.web.util.UriUtils; @@ -60,7 +65,7 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor { * @param - execution * */ - public void preProcessRequest(Execution execution) { + public void preProcessRequest(DelegateExecution execution) { def isDebugEnabled = execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) utils.log("DEBUG", " *** STARTED DoDeleteVnfAndModules PreProcessRequest Process*** ", isDebugEnabled) @@ -95,6 +100,9 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor { execution.setVariable("DDVAM_sdncVersion", sdncVersion) utils.log("DEBUG", "Incoming Sdnc Version is: " + sdncVersion, isDebugEnabled) + // Set aLaCarte flag to false + execution.setVariable("aLaCarte", false) + String sdncCallbackUrl = (String) execution.getVariable('URN_mso_workflow_sdncadapter_callback') if (sdncCallbackUrl == null || sdncCallbackUrl.trim().isEmpty()) { def msg = 'Required variable \'URN_mso_workflow_sdncadapter_callback\' is missing' @@ -103,7 +111,8 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor { } execution.setVariable("sdncCallbackUrl", sdncCallbackUrl) utils.logAudit("SDNC Callback URL: " + sdncCallbackUrl) - logDebug("SDNC Callback URL is: " + sdncCallbackUrl, isDebugEnabled) + logDebug("SDNC Callback URL is: " + sdncCallbackUrl, isDebugEnabled) + if (!sdncVersion.equals("1702")) { //String vnfModelInfo = execution.getVariable("vnfModelInfo") @@ -153,8 +162,32 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor { globalSubscriberId = "" } execution.setVariable("DDVAM_globalSubscriberId", globalSubscriberId) - utils.log("DEBUG", "Incoming Global Subscriber Id is: " + globalSubscriberId, isDebugEnabled) + utils.log("DEBUG", "Incoming Global Subscriber Id is: " + globalSubscriberId, isDebugEnabled) + + } + execution.setVariable("DDVAM_vfModulesFromDecomposition", null) + // Retrieve serviceDecomposition if present + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + if (serviceDecomposition != null) { + utils.log("DEBUG", "Getting Catalog DB data from ServiceDecomposition object: " + serviceDecomposition.toJsonString(), isDebugEnabled) + List vnfs = serviceDecomposition.getServiceVnfs() + utils.log("DEBUG", "Read vnfs", isDebugEnabled) + if (vnfs == null) { + utils.log("DEBUG", "Error - vnfs are empty in serviceDecomposition object", isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in preProcessRequest - vnfs are empty") + } + VnfResource vnf = vnfs[0] + + if (vnf == null) { + utils.log("DEBUG", "Error - vnf is empty in serviceDecomposition object", isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in preProcessRequest - vnf is empty") + } + + List vfModules = vnf.getAllVfModuleObjects() + + execution.setVariable("DDVAM_vfModulesFromDecomposition", vfModules) } + execution.setVariable("DDVAM_moduleCount", 0) execution.setVariable("DDVAM_nextModule", 0) @@ -172,7 +205,7 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor { - public void preProcessAddOnModule(Execution execution){ + public void preProcessAddOnModule(DelegateExecution execution){ def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix", Prefix) logDebug(" ======== STARTED preProcessAddOnModule ======== ", isDebugLogEnabled) @@ -212,7 +245,7 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor { * * @param execution The flow's execution instance. */ - public void queryAAIVfModule(Execution execution) { + public void queryAAIVfModule(DelegateExecution execution) { def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled") def method = getClass().getSimpleName() + '.queryAAIVfModule(' + 'execution=' + execution.getId() + @@ -247,6 +280,7 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor { logDebug('Response code:' + response.getStatusCode(), isDebugLogEnabled) logDebug('Response:' + System.lineSeparator() + responseData, isDebugLogEnabled) //Map[] vfModules = new HashMap[] + List vfModulesFromDecomposition = execution.getVariable("DDVAM_vfModulesFromDecomposition") def vfModulesList = new ArrayList>() def vfModules = null def vfModuleBaseEntry = null @@ -261,15 +295,44 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor { vfModules = xmlVfModules.'**'.findAll {it.name() == "vf-module"} execution.setVariable("DDVAM_moduleCount", vfModules.size()) int vfModulesSize = 0 + ModelInfo vfModuleModelInfo = null for (i in 0..vfModules.size()-1) { def vfModuleXml = groovy.xml.XmlUtil.serialize(vfModules[i]) Map vfModuleEntry = new HashMap() def vfModuleId = utils.getNodeText1(vfModuleXml, "vf-module-id") vfModuleEntry.put("vfModuleId", vfModuleId) - def vfModuleName = utils.getNodeText1(vfModuleXml, "vf-module-name") + def vfModuleName = utils.getNodeText1(vfModuleXml, "vf-module-name") vfModuleEntry.put("vfModuleName", vfModuleName) + // Find the model for this vf module in decomposition if specified + if (vfModulesFromDecomposition != null) { + logDebug("vfModulesFromDecomposition is not null", isDebugLogEnabled) + def vfModuleUuid = utils.getNodeText1(vfModuleXml, "model-version-id") + if (vfModuleUuid == null) { + vfModuleUuid = utils.getNodeText1(vfModuleXml, "persona-model-version") + } + logDebug("vfModule UUID is: " + vfModuleUuid, isDebugLogEnabled) + for (j in 0..vfModulesFromDecomposition.size()-1) { + ModuleResource mr = vfModulesFromDecomposition[j] + if (mr.getModelInfo().getModelUuid() == vfModuleUuid) { + logDebug("Found modelInfo", isDebugLogEnabled) + vfModuleModelInfo = mr.getModelInfo() + break + } + + } + } + if (vfModuleModelInfo != null) { + String vfModuleModelInfoString = vfModuleModelInfo.toString() + def vfModuleModelInfoValue = jsonUtil.getJsonValue(vfModuleModelInfoString, "modelInfo") + vfModuleEntry.put("vfModuleModelInfo", vfModuleModelInfoValue) + } + else { + vfModuleEntry.put("vfModuleModelInfo", null) + } + + def isBaseVfModule = utils.getNodeText(vfModuleXml, "is-base-vf-module") // Save base vf module for last if (isBaseVfModule == "true") { @@ -301,7 +364,7 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor { } } - public void prepareNextModuleToDelete(Execution execution){ + public void prepareNextModuleToDelete(DelegateExecution execution){ def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix", Prefix) logDebug(" ======== STARTED prepareNextModuleToDelete ======== ", isDebugLogEnabled) @@ -315,11 +378,10 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor { execution.setVariable("DDVAM_vfModuleId", vfModuleId) def vfModuleName = vfModule.get("vfModuleName") - execution.setVariable("DDVAM_vfModuleName", vfModuleName) - + execution.setVariable("DDVAM_vfModuleName", vfModuleName) - // HARDCODED FOR NOW - def vfModuleModelInfo = "" + def vfModuleModelInfo = vfModule.get("vfModuleModelInfo") + logDebug("vfModuleModelInfo for module delete: " + vfModuleModelInfo, isDebugLogEnabled) execution.setVariable("DDVAM_vfModuleModelInfo", vfModuleModelInfo) }catch(Exception e){ @@ -329,7 +391,7 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor { logDebug("======== COMPLETED prepareNextModuleToDelete ======== ", isDebugLogEnabled) } - public void preProcessSDNCDeactivateRequest(Execution execution){ + public void preProcessSDNCDeactivateRequest(DelegateExecution execution){ def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix", Prefix) logDebug(" ======== STARTED preProcessSDNCDeactivateRequest ======== ", isDebugLogEnabled) @@ -353,7 +415,7 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor { logDebug("======== COMPLETED preProcessSDNCDeactivateRequest ======== ", isDebugLogEnabled) } - public void preProcessSDNCUnassignRequest(Execution execution) { + public void preProcessSDNCUnassignRequest(DelegateExecution execution) { def method = getClass().getSimpleName() + '.preProcessSDNCUnassignRequest(' + 'execution=' + execution.getId() + ')' @@ -378,7 +440,7 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor { logDebug("======== COMPLETED preProcessSDNCUnassignRequest Process ======== ", isDebugLogEnabled) } - public String buildSDNCRequest(Execution execution, String svcInstId, String action){ + public String buildSDNCRequest(DelegateExecution execution, String svcInstId, String action){ String uuid = execution.getVariable('testReqId') // for junits if(uuid==null){ @@ -443,7 +505,7 @@ class DoDeleteVnfAndModules extends AbstractServiceTaskProcessor { return sdncRequest } - public void validateSDNCResponse(Execution execution, String response, String method){ + public void validateSDNCResponse(DelegateExecution execution, String response, String method){ def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) logDebug(" *** STARTED ValidateSDNCResponse Process*** ", isDebugLogEnabled) diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy index 857ed8d21a..0372d955b5 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy @@ -42,7 +42,7 @@ import javax.xml.parsers.DocumentBuilder import javax.xml.parsers.DocumentBuilderFactory import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.runtime.Execution +import org.camunda.bpm.engine.delegate.DelegateExecution import org.json.JSONObject; import org.json.JSONArray; import org.apache.commons.lang3.* @@ -87,7 +87,7 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor { ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() - public void preProcessRequest (Execution execution) { + public void preProcessRequest (DelegateExecution execution) { //only for dug execution.setVariable("isDebugLogEnabled","true") execution.setVariable("unit_test", "true") @@ -231,7 +231,7 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor { utils.log("INFO", "Exited " + method, isDebugEnabled) } - public void postProcessAAIGET(Execution execution) { + public void postProcessAAIGET(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("INFO"," ***** postProcessAAIGET ***** ", isDebugEnabled) String msg = "" @@ -378,7 +378,7 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor { } - public void preInitResourcesOperStatus(Execution execution){ + public void preInitResourcesOperStatus(DelegateExecution execution){ def isDebugEnabled = execution.getVariable("isDebugLogEnabled") utils.log("INFO", " ======== STARTED preInitResourcesOperStatus Process ======== ", isDebugEnabled) @@ -439,7 +439,7 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor { /** * Init the service Operation Status */ - public void preUpdateServiceOperationStatus(Execution execution){ + public void preUpdateServiceOperationStatus(DelegateExecution execution){ def method = getClass().getSimpleName() + '.preUpdateServiceOperationStatus(' +'execution=' + execution.getId() +')' def isDebugEnabled = execution.getVariable("isDebugLogEnabled") utils.log("INFO","Entered " + method, isDebugEnabled) @@ -502,36 +502,36 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor { utils.log("INFO", "Exited " + method, isDebugEnabled) } - public void postResourcesOperStatus(Execution execution) { + public void postResourcesOperStatus(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") } - public void preCompareModelVersions(Execution execution) { + public void preCompareModelVersions(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") } - public void postCompareModelVersions(Execution execution) { + public void postCompareModelVersions(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") } - public void preProcessForAddResource(Execution execution) { + public void preProcessForAddResource(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") } - public void postProcessForAddResource(Execution execution) { + public void postProcessForAddResource(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") } - public void preProcessForDeleteResource(Execution execution) { + public void preProcessForDeleteResource(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") } - public void postProcessForDeleteResource(Execution execution) { + public void postProcessForDeleteResource(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") } diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateNetworkInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateNetworkInstance.groovy index 36f2d9fa1f..829e4d9d4b 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateNetworkInstance.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateNetworkInstance.groovy @@ -34,7 +34,7 @@ import org.openecomp.mso.rest.APIResponse import java.util.UUID; import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.runtime.Execution +import org.camunda.bpm.engine.delegate.DelegateExecution import org.apache.commons.lang3.* import org.apache.commons.codec.binary.Base64; import org.springframework.web.util.UriUtils @@ -55,7 +55,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { * This method is executed during the preProcessRequest task of the DoUpdateNetworkInstance.bpmn process. * @param execution */ - public InitializeProcessVariables(Execution execution){ + public InitializeProcessVariables(DelegateExecution execution){ /* Initialize all the process variables in this block */ execution.setVariable(Prefix + "messageId", "") @@ -146,7 +146,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { * This method is executed during the preProcessRequest task of the DoUpdateNetworkInstance.bpmn process. * @param execution */ - public void preProcessRequest (Execution execution) { + public void preProcessRequest (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) @@ -303,7 +303,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { } } - public void callRESTQueryAAICloudRegion (Execution execution) { + public void callRESTQueryAAICloudRegion (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix", Prefix) @@ -353,7 +353,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { } - public void callRESTQueryAAINetworkId(Execution execution) { + public void callRESTQueryAAINetworkId(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix", Prefix) @@ -370,7 +370,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { String aai_endpoint = execution.getVariable("URN_aai_endpoint") AaiUtil aaiUriUtil = new AaiUtil(this) String aai_uri = aaiUriUtil.getNetworkL3NetworkUri(execution) - String queryIdAAIRequest = "${aai_endpoint}${aai_uri}/" + networkId + "?depth=1" + String queryIdAAIRequest = "${aai_endpoint}${aai_uri}/" + networkId + "?depth=all" utils.logAudit(queryIdAAIRequest) execution.setVariable(Prefix + "queryIdAAIRequest", queryIdAAIRequest) utils.log("DEBUG", Prefix + "queryIdAAIRequest - " + "\n" + queryIdAAIRequest, isDebugEnabled) @@ -421,7 +421,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { } - public void callRESTReQueryAAINetworkId(Execution execution) { + public void callRESTReQueryAAINetworkId(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix", Prefix) @@ -437,7 +437,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { String aai_endpoint = execution.getVariable("URN_aai_endpoint") AaiUtil aaiUriUtil = new AaiUtil(this) String aai_uri = aaiUriUtil.getNetworkL3NetworkUri(execution) - String requeryIdAAIRequest = "${aai_endpoint}${aai_uri}/" + networkId + "?depth=1" + String requeryIdAAIRequest = "${aai_endpoint}${aai_uri}/" + networkId + "?depth=all" utils.logAudit(requeryIdAAIRequest) execution.setVariable(Prefix + "requeryIdAAIRequest", requeryIdAAIRequest) utils.log("DEBUG", " UPDNETI_requeryIdAAIRequest - " + "\n" + requeryIdAAIRequest, isDebugEnabled) @@ -498,7 +498,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { } - public void callRESTQueryAAINetworkVpnBinding(Execution execution) { + public void callRESTQueryAAINetworkVpnBinding(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix", Prefix) @@ -570,9 +570,19 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { utils.log("DEBUG", " AAI Query Vpn Binding Success REST Response, , vpnBinding #" + counting + " : " + "\n" + aaiResponseAsString, isDebugEnabled) String routeTarget = "" - if (utils.nodeExists(aaiResponseAsString, "global-route-target")) { - routeTarget = utils.getNodeText1(aaiResponseAsString, "global-route-target") - routeTargets += "" + routeTarget + "" + '\n' + String routeRole = "" + if (utils.nodeExists(aaiResponseAsString, "route-targets")) { + String aaiRouteTargets = utils.getNodeXml(aaiResponseAsString, "route-targets", false) + def aaiRouteTargetsXml = new XmlSlurper().parseText(aaiRouteTargets) + def aaiRouteTarget = aaiRouteTargetsXml.'**'.findAll {it.name() == "route-target"} + for (j in 0..aaiRouteTarget.size()-1) { + routeTarget = utils.getNodeText1(XmlUtil.serialize(aaiRouteTarget[j]), "global-route-target") + routeRole = utils.getNodeText1(XmlUtil.serialize(aaiRouteTarget[j]), "route-target-role") + routeTargets += "" + '\n' + + " " + routeTarget + "" + '\n' + + " " + routeRole + "" + '\n' + + "" + '\n' + } } } else { @@ -632,7 +642,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { } - public void callRESTQueryAAINetworkPolicy(Execution execution) { + public void callRESTQueryAAINetworkPolicy(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix", Prefix) @@ -768,7 +778,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { } - public void callRESTQueryAAINetworkTableRef(Execution execution) { + public void callRESTQueryAAINetworkTableRef(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix", Prefix) @@ -904,7 +914,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { } - public void callRESTUpdateContrailAAINetwork(Execution execution) { + public void callRESTUpdateContrailAAINetwork(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix", Prefix) @@ -922,7 +932,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { String aai_endpoint = execution.getVariable("URN_aai_endpoint") AaiUtil aaiUriUtil = new AaiUtil(this) String aai_uri = aaiUriUtil.getNetworkL3NetworkUri(execution) - String updateContrailAAIUrlRequest = "${aai_endpoint}${aai_uri}/" + networkId + "?depth=1" + String updateContrailAAIUrlRequest = "${aai_endpoint}${aai_uri}/" + networkId + "?depth=all" utils.logAudit(updateContrailAAIUrlRequest) execution.setVariable(Prefix + "updateContrailAAIUrlRequest", updateContrailAAIUrlRequest) @@ -984,7 +994,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { } - public void prepareUpdateNetworkRequest (Execution execution) { + public void prepareUpdateNetworkRequest (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix", Prefix) @@ -1024,7 +1034,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { } - public void prepareSDNCRequest (Execution execution) { + public void prepareSDNCRequest (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix", Prefix) @@ -1069,7 +1079,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { // Post or Validate Response Section // ************************************************** - public void validateUpdateNetworkResponse (Execution execution) { + public void validateUpdateNetworkResponse (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix", Prefix) @@ -1142,7 +1152,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { } - public void validateSDNCResponse (Execution execution) { + public void validateSDNCResponse (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix", Prefix) @@ -1178,7 +1188,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { } - public void postProcessResponse (Execution execution) { + public void postProcessResponse (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix", Prefix) @@ -1230,7 +1240,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { } - public void prepareSDNCRollbackRequest (Execution execution) { + public void prepareSDNCRollbackRequest (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix", Prefix) @@ -1264,7 +1274,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { } - public void prepareRollbackData(Execution execution) { + public void prepareRollbackData(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) @@ -1300,7 +1310,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { } - public void prepareSuccessRollbackData(Execution execution) { + public void prepareSuccessRollbackData(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) @@ -1342,7 +1352,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { } - public void setExceptionFlag(Execution execution){ + public void setExceptionFlag(DelegateExecution execution){ def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) @@ -1372,7 +1382,7 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor { // Build Error Section // ******************************* - public void processJavaException(Execution execution){ + public void processJavaException(DelegateExecution execution){ def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) try{ diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceRollback.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceRollback.groovy index 760b76ad10..7d326382cb 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceRollback.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceRollback.groovy @@ -35,7 +35,7 @@ import org.openecomp.mso.rest.APIResponse import java.util.UUID; import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.runtime.Execution +import org.camunda.bpm.engine.delegate.DelegateExecution import org.apache.commons.lang3.* import org.apache.commons.codec.binary.Base64; import org.springframework.web.util.UriUtils @@ -58,7 +58,7 @@ public class DoUpdateNetworkInstanceRollback extends AbstractServiceTaskProcesso * This method is executed during the preProcessRequest task of the DoUpdateNetworkInstanceRollback.bpmn process. * @param execution */ - public InitializeProcessVariables(Execution execution){ + public InitializeProcessVariables(DelegateExecution execution){ /* Initialize all the process variables in this block */ execution.setVariable(Prefix + "rollbackNetworkRequest", null) @@ -85,7 +85,7 @@ public class DoUpdateNetworkInstanceRollback extends AbstractServiceTaskProcesso * This method is executed during the preProcessRequest task of the DoUpdateNetworkInstanceRollback.bpmn process. * @param execution */ - public void preProcessRequest (Execution execution) { + public void preProcessRequest (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) @@ -166,7 +166,7 @@ public class DoUpdateNetworkInstanceRollback extends AbstractServiceTaskProcesso } - public void validateRollbackResponses (Execution execution) { + public void validateRollbackResponses (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) @@ -282,7 +282,7 @@ public class DoUpdateNetworkInstanceRollback extends AbstractServiceTaskProcesso - public void processJavaException(Execution execution){ + public void processJavaException(DelegateExecution execution){ def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy index f41c8bb876..a9a657eea1 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy @@ -21,8 +21,9 @@ package org.openecomp.mso.bpmn.infrastructure.scripts import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.runtime.Execution +import org.camunda.bpm.engine.delegate.DelegateExecution import org.openecomp.mso.bpmn.common.scripts.AaiUtil +import org.openecomp.mso.bpmn.common.scripts.CatalogDbUtils import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil import org.openecomp.mso.bpmn.common.scripts.NetworkUtils import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils @@ -30,20 +31,27 @@ import org.openecomp.mso.bpmn.common.scripts.VfModule import org.openecomp.mso.bpmn.common.scripts.VfModuleBase import org.openecomp.mso.bpmn.core.WorkflowException import org.openecomp.mso.bpmn.core.json.JsonUtils; +import org.openecomp.mso.client.aai.AAIResourcesClient +import org.openecomp.mso.client.aai.entities.AAIResultWrapper +import org.openecomp.mso.client.aai.entities.uri.AAIUri import org.openecomp.mso.rest.APIResponse import org.springframework.web.util.UriUtils +import org.openecomp.mso.client.aai.AAIObjectType; +import org.openecomp.mso.client.aai.entities.uri.AAIUriFactory; + public class DoUpdateVfModule extends VfModuleBase { ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() + CatalogDbUtils catalog = new CatalogDbUtils() /** * Initialize the flow's variables. * * @param execution The flow's execution instance. */ - public void initProcessVariables(Execution execution) { + public void initProcessVariables(DelegateExecution execution) { execution.setVariable('prefix', 'DOUPVfMod_') execution.setVariable('DOUPVfMod_requestInfo', null) execution.setVariable('DOUPVfMod_serviceInstanceId', null) @@ -87,7 +95,7 @@ public class DoUpdateVfModule extends VfModuleBase { * * @param execution The flow's execution instance. */ - public void preProcessRequest(Execution execution) { + public void preProcessRequest(DelegateExecution execution) { def method = getClass().getSimpleName() + '.preProcessRequest(' + 'execution=' + execution.getId() + ')' @@ -108,9 +116,10 @@ public class DoUpdateVfModule extends VfModuleBase { def serviceModelInfo = execution.getVariable("serviceModelInfo") logDebug("serviceModelInfo: " + serviceModelInfo, isDebugLogEnabled) + String modelInvariantUuid = jsonUtil.getJsonValue(serviceModelInfo, "modelInvariantUuid") + logDebug("modelInvariantUuid: " + modelInvariantUuid, isDebugLogEnabled) def vnfModelInfo = execution.getVariable("vnfModelInfo") - //tenantId def tenantId = execution.getVariable("tenantId") execution.setVariable("DOUPVfMod_tenantId", tenantId) @@ -230,7 +239,37 @@ public class DoUpdateVfModule extends VfModuleBase { Map vfModuleInputParams = execution.getVariable("vfModuleInputParams") if (vfModuleInputParams != null) { execution.setVariable("DOUPVfMod_vnfParamsMap", vfModuleInputParams) - } + } + //get workload and environment context from parent SI + String environmentContext = "" + String workloadContext ="" + String serviceType ="" + + try{ + String json = catalog.getServiceResourcesByServiceModelInvariantUuidString(execution,modelInvariantUuid ) + serviceType = jsonUtil.getJsonValue(json, "serviceResources.serviceType") + }catch(BpmnError e){ + throw e + } catch (Exception ex){ + String msg = "Exception in preProcessRequest " + ex.getMessage() + utils.log("DEBUG", msg, isDebugLogEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + + try{ + AAIUri serviceInstanceURI = AAIUriFactory.create(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId,serviceType,serviceInstanceId) + AAIResourcesClient aaiRC = new AAIResourcesClient() + AAIResultWrapper aaiRW = aaiRC.get(serviceInstanceURI) + Map aaiJson = aaiRW.asMap() + environmentContext = aaiJson.getOrDefault("environment-context","") + workloadContext = aaiJson.getOrDefault("workload-context","") + + }catch (Exception ex) { + utils.log("DEBUG","Error retreiving parent service instance information", isDebugLogEnabled) + } + + execution.setVariable("DCVFM_environmentContext",environmentContext) + execution.setVariable("DCVFM_workloadContext",workloadContext) } else { @@ -296,7 +335,7 @@ public class DoUpdateVfModule extends VfModuleBase { * * @param execution The flow's execution instance. */ - public void prepPrepareUpdateAAIVfModule(Execution execution) { + public void prepPrepareUpdateAAIVfModule(DelegateExecution execution) { def method = getClass().getSimpleName() + '.preparePrepareUpdateAAIVfModule(' + 'execution=' + execution.getId() + ')' @@ -335,7 +374,7 @@ public class DoUpdateVfModule extends VfModuleBase { * * @param execution The flow's execution instance. */ - public void prepConfirmVolumeGroupTenant(Execution execution) { + public void prepConfirmVolumeGroupTenant(DelegateExecution execution) { def method = getClass().getSimpleName() + '.prepConfirmVolumeGroupTenant(' + 'execution=' + execution.getId() + ')' @@ -393,7 +432,7 @@ public class DoUpdateVfModule extends VfModuleBase { * * @param execution The flow's execution instance. */ - public void prepSDNCTopologyChg(Execution execution) { + public void prepSDNCTopologyChg(DelegateExecution execution) { def method = getClass().getSimpleName() + '.prepSDNCTopologyChg(' + 'execution=' + execution.getId() + ')' @@ -493,7 +532,7 @@ public class DoUpdateVfModule extends VfModuleBase { * * @param execution The flow's execution instance. */ - public void prepSDNCTopologyQuery(Execution execution) { + public void prepSDNCTopologyQuery(DelegateExecution execution) { def method = getClass().getSimpleName() + '.prepSDNCTopologyQuery(' + 'execution=' + execution.getId() + ')' @@ -554,7 +593,7 @@ public class DoUpdateVfModule extends VfModuleBase { * * @param execution The flow's execution instance. */ - public void prepVnfAdapterRest(Execution execution) { + public void prepVnfAdapterRest(DelegateExecution execution) { def method = getClass().getSimpleName() + '.prepVnfAdapterRest(' + 'execution=' + execution.getId() + ')' @@ -590,12 +629,17 @@ public class DoUpdateVfModule extends VfModuleBase { notificationUrl = utils.getQualifiedHostNameForCallback(notificationUrl) } + String environmentContext = execution.getVariable("DOUPVEnvironment_context") + String workloadContext = execution.getVariable("DOUPVWorkload_context") + logDebug("workloadContext: " + workloadContext, isDebugLogEnabled) + logDebug("environmentContext: " + environmentContext, isDebugLogEnabled) + Map vnfParamsMap = execution.getVariable("DOUPVfMod_vnfParamsMap") String sdncGetResponse = execution.getVariable('DOUPVfMod_sdncTopologyResponse') String vfModuleParams = buildVfModuleParams(vnfParamsMap, sdncGetResponse, vnfId, vnfName, - vfModuleId, vfModuleName, null) + vfModuleId, vfModuleName, null, environmentContext, workloadContext) String vnfAdapterRestRequest = """ @@ -646,7 +690,7 @@ public class DoUpdateVfModule extends VfModuleBase { * * @param execution The flow's execution instance. */ - public void prepUpdateAAIGenericVnf(Execution execution) { + public void prepUpdateAAIGenericVnf(DelegateExecution execution) { def method = getClass().getSimpleName() + '.prepUpdateAAIGenericVnf(' + 'execution=' + execution.getId() + ')' @@ -694,7 +738,7 @@ public class DoUpdateVfModule extends VfModuleBase { * * @param execution The flow's execution instance. */ - public void prepUpdateAAIVfModule(Execution execution) { + public void prepUpdateAAIVfModule(DelegateExecution execution) { def method = getClass().getSimpleName() + '.prepUpdateAAIVfModule(' + 'execution=' + execution.getId() + ')' @@ -767,7 +811,7 @@ public class DoUpdateVfModule extends VfModuleBase { * * @param execution The flow's execution instance. */ - public void prepSDNCTopologyAct(Execution execution) { + public void prepSDNCTopologyAct(DelegateExecution execution) { def method = getClass().getSimpleName() + '.prepSDNCTopologyAct(' + 'execution=' + execution.getId() + ')' @@ -864,7 +908,7 @@ public class DoUpdateVfModule extends VfModuleBase { * * @param execution The flow's execution instance. */ - public void handleWorkflowException(Execution execution) { + public void handleWorkflowException(DelegateExecution execution) { def method = getClass().getSimpleName() + '.handleWorkflowException(' + 'execution=' + execution.getId() + ')' @@ -884,7 +928,7 @@ public class DoUpdateVfModule extends VfModuleBase { } } - public void validateSDNCResponse(Execution execution, String response, String method){ + public void validateSDNCResponse(DelegateExecution execution, String response, String method){ def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled") def prefix = execution.getVariable("prefix") @@ -916,7 +960,7 @@ public class DoUpdateVfModule extends VfModuleBase { * * @param execution The flow's execution instance. */ - public void queryAAIVfModule(Execution execution) { + public void queryAAIVfModule(DelegateExecution execution) { def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled") def method = getClass().getSimpleName() + '.getVfModule(' + 'execution=' + execution.getId() + diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy index 7aa2ec696e..5d1bc01f1e 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy @@ -25,7 +25,7 @@ import java.util.UUID; import org.json.JSONObject; import org.json.JSONArray; import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.runtime.Execution; +import org.camunda.bpm.engine.delegate.DelegateExecution; import org.hibernate.jpa.criteria.predicate.IsEmptyPredicate import static org.apache.commons.lang3.StringUtils.*; @@ -60,7 +60,7 @@ class DoUpdateVnfAndModules extends AbstractServiceTaskProcessor { * @param - execution * */ - public void preProcessRequest(Execution execution) { + public void preProcessRequest(DelegateExecution execution) { def isDebugEnabled = execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) utils.log("DEBUG", " *** STARTED DoUpdateVnfAndModules PreProcessRequest Process*** ", isDebugEnabled) @@ -143,7 +143,7 @@ class DoUpdateVnfAndModules extends AbstractServiceTaskProcessor { * * @param execution The flow's execution instance. */ - public void queryAAIVfModule(Execution execution) { + public void queryAAIVfModule(DelegateExecution execution) { def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled") def method = getClass().getSimpleName() + '.queryAAIVfModule(' + 'execution=' + execution.getId() + @@ -218,6 +218,29 @@ class DoUpdateVnfAndModules extends AbstractServiceTaskProcessor { def isBaseVfModule = utils.getNodeText(vfModuleXml, "is-base-vf-module") vfModuleEntry.put("isBaseVfModule", isBaseVfModule) + + String volumeGroupId = '' + + logDebug("Next module!", isDebugLogEnabled) + def vfModuleRelationships = vfModules[i].'**'.findAll {it.name() == 'relationship-data'} + if (vfModuleRelationships.size() > 0) { + for (j in 0..vfModuleRelationships.size()-1) { + if (vfModuleRelationships[j] != null) { + + def relationshipKey = vfModuleRelationships[j].'**'.findAll {it.name() == 'relationship-key'} + + if (relationshipKey[0] == 'volume-group.volume-group-id') { + def relationshipValue = vfModuleRelationships[j].'**'.findAll {it.name() == 'relationship-value'} + volumeGroupId = relationshipValue[0] + break + } + } + } + } + + vfModuleEntry.put("volumeGroupId", volumeGroupId) + logDebug("volumeGroupId is: " + volumeGroupId, isDebugLogEnabled) + // Save base vf module to add it to the start of the list later if (isBaseVfModule == "true") { vfModuleBaseEntry = vfModuleEntry @@ -253,7 +276,7 @@ class DoUpdateVnfAndModules extends AbstractServiceTaskProcessor { } } - public void prepareNextModuleToUpdate(Execution execution){ + public void prepareNextModuleToUpdate(DelegateExecution execution){ def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix", Prefix) logDebug(" ======== STARTED prepareNextModuleToUpdate ======== ", isDebugLogEnabled) @@ -275,7 +298,9 @@ class DoUpdateVnfAndModules extends AbstractServiceTaskProcessor { String modelInvariantUuid = vfModule.get("modelInvariantUuid") logDebug("ModelInvariantUuid: " + modelInvariantUuid, isDebugLogEnabled) - execution.setVariable("DUVAM_volumeGroupId", "") + def volumeGroupId = vfModule.get("volumeGroupId") + execution.setVariable("DUVAM_volumeGroupId", volumeGroupId) + execution.setVariable("DUVAM_volumeGroupName", "") VnfResource vnfResource = (VnfResource) execution.getVariable("vnfResourceDecomposition") @@ -309,7 +334,7 @@ class DoUpdateVnfAndModules extends AbstractServiceTaskProcessor { * * @param execution The flow's execution instance. */ - public void prepUpdateAAIGenericVnf(Execution execution) { + public void prepUpdateAAIGenericVnf(DelegateExecution execution) { def method = getClass().getSimpleName() + '.prepUpdateAAIGenericVnf(' + 'execution=' + execution.getId() + ')' @@ -381,7 +406,7 @@ class DoUpdateVnfAndModules extends AbstractServiceTaskProcessor { * * @param execution The flow's execution instance. */ - public void callAppCf(Execution execution) { + public void callAppCf(DelegateExecution execution) { def method = getClass().getSimpleName() + '.callAppC(' + 'execution=' + execution.getId() + ')' diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/HealchCheckActivate.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/HealchCheckActivate.groovy index a2d192f6f3..3ab1b17392 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/HealchCheckActivate.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/HealchCheckActivate.groovy @@ -21,7 +21,7 @@ package org.openecomp.mso.bpmn.infrastructure.scripts; import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.runtime.Execution +import org.camunda.bpm.engine.delegate.DelegateExecution import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor; import org.apache.commons.lang3.* @@ -32,7 +32,7 @@ public class HealthCheckActivate extends AbstractServiceTaskProcessor { * Validates the request message and sets up the workflow. * @param execution the execution */ - public void preProcessRequest(Execution execution) { + public void preProcessRequest(DelegateExecution execution) { } @@ -41,7 +41,7 @@ public class HealthCheckActivate extends AbstractServiceTaskProcessor { * Sends the synchronous response back to the API Handler. * @param execution the execution */ - public void sendResponse(Execution execution) { + public void sendResponse(DelegateExecution execution) { def status = execution.getVariable("healthyStatus") def healthcheckmessage = execution.getVariable("healthcheckmessage") if (status == "true") { diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/ReplaceVnfInfra.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/ReplaceVnfInfra.groovy index 3a5a3b7e7b..c84c73cb96 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/ReplaceVnfInfra.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/ReplaceVnfInfra.groovy @@ -30,7 +30,7 @@ import java.util.UUID; import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.impl.cmd.AbstractSetVariableCmd -import org.camunda.bpm.engine.runtime.Execution +import org.camunda.bpm.engine.delegate.DelegateExecution import org.openecomp.mso.rest.APIResponse import org.openecomp.mso.rest.RESTClient import org.openecomp.mso.rest.RESTConfig @@ -45,25 +45,22 @@ import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition import org.openecomp.mso.bpmn.core.domain.VnfResource import org.openecomp.mso.client.aai.* -import org.openecomp.mso.client.appc.ApplicationControllerClient; -import org.openecomp.mso.client.appc.ApplicationControllerSupport; -import org.openecomp.appc.client.lcm.model.Action; -import org.openecomp.appc.client.lcm.model.ActionIdentifiers; -import org.openecomp.appc.client.lcm.model.LockInput -import org.openecomp.appc.client.lcm.model.UnlockInput -import org.openecomp.appc.client.lcm.model.HealthCheckInput -import org.openecomp.appc.client.lcm.model.StartInput -import org.openecomp.appc.client.lcm.model.StopInput -import org.openecomp.appc.client.lcm.model.Flags -import org.openecomp.appc.client.lcm.model.Status +import org.openecomp.mso.client.appc.ApplicationControllerOrchestrator +import org.onap.appc.client.lcm.model.Action; +import org.onap.appc.client.lcm.model.ActionIdentifiers; +import org.onap.appc.client.lcm.model.LockInput +import org.onap.appc.client.lcm.model.UnlockInput +import org.onap.appc.client.lcm.model.HealthCheckInput +import org.onap.appc.client.lcm.model.StartInput +import org.onap.appc.client.lcm.model.Flags +import org.onap.appc.client.lcm.model.Status -public class ReplaceVnfInfra extends AbstractServiceTaskProcessor { +public class ReplaceVnfInfra extends VnfCmBase { ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtils = new JsonUtils() - ApplicationControllerClient appcClient = new ApplicationControllerClient() + JsonUtils jsonUtils = new JsonUtils() def prefix = "RPLVnfI_" /** @@ -71,26 +68,33 @@ public class ReplaceVnfInfra extends AbstractServiceTaskProcessor { * * @param execution The flow's execution instance. */ - public void initProcessVariables(Execution execution) { + public void initProcessVariables(DelegateExecution execution) { execution.setVariable('prefix', 'RPLVnfI_') - execution.setVariable('RPLVnfI_Request', null) - execution.setVariable('RPLVnfI_requestInfo', null) - execution.setVariable('RPLVnfI_requestId', null) - execution.setVariable('RPLVnfI_source', null) - execution.setVariable('RPLVnfI_vnfInputs', null) - execution.setVariable('RPLVnfI_vnfId', null) - execution.setVariable('RPLVnfI_tenantId', null) - execution.setVariable('RPLVnfI_vnfParams', null) - execution.setVariable('RPLVnfI_cloudConfiguration', null) + execution.setVariable('Request', null) + execution.setVariable('requestInfo', null) + execution.setVariable('source', null) + execution.setVariable('vnfInputs', null) + execution.setVariable('tenantId', null) + execution.setVariable('vnfParams', null) + execution.setVariable('cloudConfiguration', null) execution.setVariable('ReplaceVnfSuccessIndicator', false) - execution.setVariable('RPLVnfI_serviceType', null) - execution.setVariable('RPLVnfI_nfRole', null) - execution.setVariable('RPLVnfI_currentActivity', 'RPLVnfI') - execution.setVariable('RPLVnfI_workStep', null) - execution.setVariable('RPLVnfI_failedActivity', null) - execution.setVariable('RPLVnfI_errorCode', "0") - execution.setVariable('RPLVnfI_errorText', null) - execution.setVariable('RPLVnfI_healthCheckIndex', 1) + execution.setVariable('serviceType', null) + execution.setVariable('nfRole', null) + execution.setVariable('currentActivity', 'RPLVnfI') + execution.setVariable('workStep', null) + execution.setVariable('failedActivity', null) + execution.setVariable('errorCode', "0") + execution.setVariable('errorText', null) + execution.setVariable('healthCheckIndex', 1) + execution.setVariable('retainResources', true) + execution.setVariable('productFamilyId', null) + execution.setVariable('healthCheckIndex0', 0) + execution.setVariable('healthCheckIndex1', 1) + execution.setVariable("rollbackSetClosedLoopDisabledFlag", false) + execution.setVariable("rollbackVnfStop", false) + execution.setVariable("rollbackVnfLock", false) + execution.setVariable("rollbackQuiesceTraffic", false) + execution.setVariable("rollbackSetVnfInMaintenanceFlag", false) } /** @@ -98,7 +102,7 @@ public class ReplaceVnfInfra extends AbstractServiceTaskProcessor { * * @param execution The flow's execution instance. */ - public void preProcessRequest(Execution execution) { + public void preProcessRequest(DelegateExecution execution) { def method = getClass().getSimpleName() + '.preProcessRequest(' + 'execution=' + execution.getId() + ')' @@ -120,9 +124,17 @@ public class ReplaceVnfInfra extends AbstractServiceTaskProcessor { def serviceInstanceId = execution.getVariable('serviceInstanceId') def vnfId = execution.getVariable('vnfId') - execution.setVariable(prefix + 'serviceInstanceId', serviceInstanceId) - execution.setVariable(prefix + 'vnfId', vnfId) - execution.setVariable("isVidRequest", "true") + execution.setVariable('serviceInstanceId', serviceInstanceId) + execution.setVariable("isVidRequest", "true") + execution.setVariable('serviceType', 'Mobility') + execution.setVariable('retainResources', true) + execution.setVariable('disableRollback', true) + execution.setVariable('payload', "") + execution.setVariable('actionLock', Action.Lock) + execution.setVariable('actionUnlock', Action.Unlock) + execution.setVariable('actionHealthCheck', Action.HealthCheck) + execution.setVariable('actionStart', Action.Start) + execution.setVariable('actionStop', Action.Stop) def asdcServiceModelVersion = '' def serviceModelInfo = null @@ -143,61 +155,64 @@ public class ReplaceVnfInfra extends AbstractServiceTaskProcessor { } } - execution.setVariable(prefix + 'asdcServiceModelVersion', asdcServiceModelVersion) - execution.setVariable(prefix + 'serviceModelInfo', serviceModelInfo) + execution.setVariable('asdcServiceModelVersion', asdcServiceModelVersion) + execution.setVariable('serviceModelInfo', serviceModelInfo) def vnfModelInfo = jsonOutput.toJson(reqMap.requestDetails?.modelInfo) - execution.setVariable(prefix + 'vnfModelInfo', vnfModelInfo) + execution.setVariable('vnfModelInfo', vnfModelInfo) def vnfModelInvariantUuid = jsonUtils.getJsonValue(vnfModelInfo, "modelInvariantUuid") - execution.setVariable(prefix + 'vnfModelInvariantUuid', vnfModelInvariantUuid) + execution.setVariable('vnfModelInvariantUuid', vnfModelInvariantUuid) logDebug("vnfModelInvariantUuid: " + vnfModelInvariantUuid, isDebugLogEnabled) def vnfType = execution.getVariable('vnfType') - execution.setVariable(prefix + 'vnfType', vnfType) + execution.setVariable('vnfType', vnfType) def userParams = reqMap.requestDetails?.requestParameters?.userParams Map userParamsMap = [:] if (userParams != null) { userParams.each { userParam -> - userParamsMap.put(userParam.name, userParam.value) + userParamsMap.put(userParam.name, userParam.value.toString()) } } utils.log("DEBUG", 'Processed user params: ' + userParamsMap, isDebugLogEnabled) - execution.setVariable(prefix + 'vfModuleInputParams', userParamsMap) + execution.setVariable('vfModuleInputParams', userParamsMap) - def requestId = execution.getVariable("mso-request-id") - execution.setVariable(prefix + 'requestId', requestId) - + def requestId = execution.getVariable("requestId") + execution.setVariable('msoRequestId', requestId) + utils.log("DEBUG", "requestId is: " + requestId, isDebugLogEnabled) def vnfName = reqMap.requestDetails?.requestInfo?.instanceName ?: null - execution.setVariable(prefix + 'vnfName', vnfName) + execution.setVariable('vnfName', vnfName) def requestorId = reqMap.requestDetails?.requestInfo?.requestorId ?: null - execution.setVariable(prefix + 'requestorId', requestorId) + execution.setVariable('requestorId', requestorId) def usePreload = reqMap.requestDetails?.requestParameters?.usePreload - execution.setVariable(prefix + 'usePreload', usePreload) + execution.setVariable('usePreload', usePreload) + + def productFamilyId = reqMap.requestDetails?.requestInfo?.productFamilyId ?: null + execution.setVariable('productFamilyId', productFamilyId) def cloudConfiguration = jsonOutput.toJson(reqMap.requestDetails?.cloudConfiguration) - execution.setVariable(prefix + 'cloudConfiguration', cloudConfiguration) + execution.setVariable('cloudConfiguration', cloudConfiguration) def lcpCloudRegionId = jsonUtils.getJsonValue(cloudConfiguration, "lcpCloudRegionId") - execution.setVariable(prefix + 'lcpCloudRegionId', lcpCloudRegionId) + execution.setVariable('lcpCloudRegionId', lcpCloudRegionId) def tenantId = jsonUtils.getJsonValue(cloudConfiguration, "tenantId") - execution.setVariable(prefix + 'tenantId', tenantId) + execution.setVariable('tenantId', tenantId) def globalSubscriberId = reqMap.requestDetails?.subscriberInfo?.globalSubscriberId ?: '' - execution.setVariable(prefix + 'globalSubscriberId', globalSubscriberId) + execution.setVariable('globalSubscriberId', globalSubscriberId) - execution.setVariable(prefix + 'sdncVersion', '1702') + execution.setVariable('sdncVersion', '1702') execution.setVariable("ReplaceVnfInfraSuccessIndicator", false) execution.setVariable("isDebugLogEnabled", isDebugLogEnabled) def source = reqMap.requestDetails?.requestInfo?.source - execution.setVariable(prefix + "source", source) + execution.setVariable("source", source) //For Completion Handler & Fallout Handler String requestInfo = @@ -207,9 +222,9 @@ public class ReplaceVnfInfra extends AbstractServiceTaskProcessor { ${source} """ - execution.setVariable(prefix + "requestInfo", requestInfo) + execution.setVariable("requestInfo", requestInfo) - logDebug('RequestInfo: ' + execution.getVariable(prefix + "requestInfo"), isDebugLogEnabled) + logDebug('RequestInfo: ' + execution.getVariable("requestInfo"), isDebugLogEnabled) logDebug('Exited ' + method, isDebugLogEnabled) @@ -231,7 +246,7 @@ public class ReplaceVnfInfra extends AbstractServiceTaskProcessor { * * @param execution The flow's execution instance. */ - public void sendSynchResponse(Execution execution) { + public void sendSynchResponse(DelegateExecution execution) { def method = getClass().getSimpleName() + '.sendSynchResponse(' + 'execution=' + execution.getId() + ')' @@ -240,9 +255,9 @@ public class ReplaceVnfInfra extends AbstractServiceTaskProcessor { try { - def requestInfo = execution.getVariable('RPLVnfI_requestInfo') - def requestId = execution.getVariable('RPLVnfI_requestId') - def source = execution.getVariable('RPLVnfI_source') + def requestInfo = execution.getVariable('requestInfo') + def requestId = execution.getVariable('requestId') + def source = execution.getVariable('source') def progress = getNodeTextForce(requestInfo, 'progress') if (progress.isEmpty()) { progress = '0' @@ -275,7 +290,7 @@ public class ReplaceVnfInfra extends AbstractServiceTaskProcessor { * * @param execution The flow's execution instance. */ - public void getVnfResourceDecomposition(Execution execution) { + public void getVnfResourceDecomposition(DelegateExecution execution) { def method = getClass().getSimpleName() + '.getVnfResourceDecomposition(' + 'execution=' + execution.getId() + ')' @@ -284,7 +299,7 @@ public class ReplaceVnfInfra extends AbstractServiceTaskProcessor { try { ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") - String vnfModelInvariantUuid = execution.getVariable(prefix + 'vnfModelInvariantUuid') + String vnfModelInvariantUuid = execution.getVariable('vnfModelInvariantUuid') logDebug("vnfModelInvariantUuid: " + vnfModelInvariantUuid, isDebugLogEnabled) List vnfResources = serviceDecomposition.getServiceVnfs() @@ -295,9 +310,9 @@ public class ReplaceVnfInfra extends AbstractServiceTaskProcessor { if (vnfModelInvariantUuid.equals(modelInvariantUuidFromDecomposition)) { VnfResource vnfResourceDecomposition = vnfResources[i] - execution.setVariable(prefix + 'vnfResourceDecomposition', vnfResourceDecomposition) + execution.setVariable('vnfResourceDecomposition', vnfResourceDecomposition) def nfRole = vnfResourceDecomposition.getNfRole() - execution.setVariable(prefix + 'nfRole', nfRole) + execution.setVariable('nfRole', nfRole) logDebug("vnfResourceDecomposition: " + vnfResourceDecomposition.toJsonString(), isDebugLogEnabled) break } @@ -322,13 +337,13 @@ public class ReplaceVnfInfra extends AbstractServiceTaskProcessor { * * @param execution The flow's execution instance. */ - public void checkIfVnfInMaintInAAI(Execution execution) { + public void checkIfVnfInMaintInAAI(DelegateExecution execution) { def method = getClass().getSimpleName() + '.checkIfVnfInMaintInAAI(' + 'execution=' + execution.getId() + ')' def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - execution.setVariable(prefix + 'errorCode', "0") - execution.setVariable(prefix + "workStep", "checkIfVnfInMaintInAAI") + execution.setVariable('errorCode', "0") + execution.setVariable("workStep", "checkIfVnfInMaintInAAI") execution.setVariable("failedActivity", "AAI") logDebug('Entered ' + method, isDebugLogEnabled) @@ -340,15 +355,21 @@ public class ReplaceVnfInfra extends AbstractServiceTaskProcessor { def vnfId = execution.getVariable("vnfId") boolean isInMaint = aaiValidator.isVNFLocked(vnfId, transactionLoggingUuid) logDebug("isInMaint result: " + isInMaint, isDebugLogEnabled) - execution.setVariable(prefix + 'isVnfInMaintenance', isInMaint) + execution.setVariable('isVnfInMaintenance', isInMaint) + + if (isInMaint) { + execution.setVariable("errorCode", "1003") + execution.setVariable("errorText", "VNF is in maintenance in A&AI") + } + logDebug('Exited ' + method, isDebugLogEnabled) } catch (BpmnError e) { throw e; } catch (Exception e) { logError('Caught exception in ' + method, e) - execution.setVariable(prefix + "errorCode", "1002") - execution.setVariable(prefix + "errorText", e.getMessage()) + execution.setVariable("errorCode", "1002") + execution.setVariable("errorText", e.getMessage()) //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfVnfInMaintInAAI(): ' + e.getMessage()) } } @@ -360,14 +381,14 @@ public class ReplaceVnfInfra extends AbstractServiceTaskProcessor { * * @param execution The flow's execution instance. */ - public void checkIfPserversInMaintInAAI(Execution execution) { + public void checkIfPserversInMaintInAAI(DelegateExecution execution) { def method = getClass().getSimpleName() + '.checkIfPserversInMaintInAAI(' + 'execution=' + execution.getId() + ')' def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - execution.setVariable(prefix + 'errorCode', "0") + execution.setVariable('errorCode', "0") logDebug('Entered ' + method, isDebugLogEnabled) - execution.setVariable(prefix + "workStep", "checkIfPserversInMaintInAAI") + execution.setVariable("workStep", "checkIfPserversInMaintInAAI") execution.setVariable("failedActivity", "AAI") try { @@ -378,15 +399,20 @@ public class ReplaceVnfInfra extends AbstractServiceTaskProcessor { def vnfId = execution.getVariable("vnfId") boolean areLocked = aaiValidator.isPhysicalServerLocked(vnfId, transactionLoggingUuid) logDebug("areLocked result: " + areLocked, isDebugLogEnabled) - execution.setVariable(prefix + 'arePserversLocked', areLocked) + execution.setVariable('arePserversLocked', areLocked) + + if (areLocked) { + execution.setVariable("errorCode", "1003") + execution.setVariable("errorText", "pServers are locked in A&AI") + } logDebug('Exited ' + method, isDebugLogEnabled) } catch (BpmnError e) { throw e; } catch (Exception e) { logError('Caught exception in ' + method, e) - execution.setVariable(prefix + "errorCode", "1002") - execution.setVariable(prefix + "errorText", e.getMessage()) + execution.setVariable("errorCode", "1002") + execution.setVariable("errorText", e.getMessage()) //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfPserversInMaintInAAI(): ' + e.getMessage()) } } @@ -398,18 +424,18 @@ public class ReplaceVnfInfra extends AbstractServiceTaskProcessor { * @param execution The flow's execution instance. * @param inMaint The boolean value of the flag to set */ - public void setVnfInMaintFlagInAAI(Execution execution, boolean inMaint) { + public void setVnfInMaintFlagInAAI(DelegateExecution execution, boolean inMaint) { def method = getClass().getSimpleName() + '.setVnfInMaintFlagInAAI(' + 'execution=' + execution.getId() + ')' def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - execution.setVariable(prefix + 'errorCode', "0") + execution.setVariable('errorCode', "0") logDebug('Entered ' + method, isDebugLogEnabled) if (inMaint) { - execution.setVariable(prefix + "workStep", "setVnfInMaintFlagInAAI") + execution.setVariable("workStep", "setVnfInMaintFlagInAAI") } else { - execution.setVariable(prefix + "workStep", "unsetVnfInMaintFlagInAAI") + execution.setVariable("workStep", "unsetVnfInMaintFlagInAAI") } execution.setVariable("failedActivity", "AAI") @@ -421,6 +447,7 @@ public class ReplaceVnfInfra extends AbstractServiceTaskProcessor { def vnfId = execution.getVariable("vnfId") if (inMaint) { aaiUpdator.updateVnfToLocked(vnfId, transactionLoggingUuid) + execution.setVariable("rollbackSetVnfInMaintenanceFlag", true) } else { aaiUpdator.updateVnfToUnLocked(vnfId, transactionLoggingUuid) @@ -431,8 +458,8 @@ public class ReplaceVnfInfra extends AbstractServiceTaskProcessor { throw e; } catch (Exception e) { logError('Caught exception in ' + method, e) - execution.setVariable(prefix + "errorCode", "1002") - execution.setVariable(prefix + "errorText", e.getMessage()) + execution.setVariable("errorCode", "1002") + execution.setVariable("errorText", e.getMessage()) //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in setVnfInMaintFlagInAAI(): ' + e.getMessage()) } } @@ -444,50 +471,46 @@ public class ReplaceVnfInfra extends AbstractServiceTaskProcessor { * @param execution The flow's execution instance. * @param action The action to take in APP-C. */ - public void runAppcCommand(Execution execution, Action action) { + public void runAppcCommand(DelegateExecution execution, Action action) { def method = getClass().getSimpleName() + '.runAppcCommand(' + 'execution=' + execution.getId() + ')' def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - execution.setVariable(prefix + 'errorCode', "0") - logDebug('Entered ' + method, isDebugLogEnabled) + execution.setVariable('errorCode', "0") + logDebug('Entered ' + method, isDebugLogEnabled) try { logDebug("Running APP-C action: " + action.toString(), isDebugLogEnabled) String vnfId = execution.getVariable('vnfId') - String msoRequestId = execution.getVariable(prefix + 'requestId') + String msoRequestId = execution.getVariable('requestId') execution.setVariable('msoRequestId', msoRequestId) - execution.setVariable(prefix + "failedActivity", "APP-C") - - ApplicationControllerSupport support = new ApplicationControllerSupport() - appcClient.appCSupport=support - org.springframework.test.util.ReflectionTestUtils.setField(support, "lcmModelPackage", "org.openecomp.appc.client.lcm.model"); - Flags flags = new Flags(); - ActionIdentifiers actionIdentifiers = new ActionIdentifiers(); - actionIdentifiers.setVnfId(vnfId); - Status appcStatus + execution.setVariable("failedActivity", "APP-C") + execution.setVariable("workStep", action.toString() + "VNF") + + ApplicationControllerOrchestrator appcClient = new ApplicationControllerOrchestrator() + Status appcStatus = null switch(action) { case Action.Lock: - execution.setVariable(prefix + 'workStep', "LockVNF") - appcStatus = appcClient.runCommand(Action.Lock,actionIdentifiers,flags,null,msoRequestId) + execution.setVariable('workStep', "LockVNF") + appcStatus = appcClient.runCommand(Action.Lock,msoRequestId,vnfId,null) break case Action.Unlock: - execution.setVariable(prefix + 'workStep', "UnlockVNF") - appcStatus = appcClient.runCommand(Action.Unlock,actionIdentifiers,flags,null,msoRequestId) + execution.setVariable('workStep', "UnlockVNF") + appcStatus = appcClient.runCommand(Action.Unlock,msoRequestId,vnfId,null) break case Action.HealthCheck: - def healthCheckIndex = execution.getVariable(prefix + 'healthCheckIndex') - execution.setVariable(prefix + 'workStep', "HealthCheckVNF" + healthCheckIndex) - execution.setVariable(prefix + 'healthCheckIndex', healthCheckIndex + 1) - appcStatus = appcClient.runCommand(Action.HealthCheck,actionIdentifiers,flags,null,msoRequestId) + def healthCheckIndex = execution.getVariable('healthCheckIndex') + execution.setVariable('workStep', "HealthCheckVNF" + healthCheckIndex) + execution.setVariable('healthCheckIndex', healthCheckIndex + 1) + appcStatus = appcClient.runCommand(Action.HealthCheck,msoRequestId,vnfId,null) break case Action.Start: - execution.setVariable(prefix + 'workStep', "StartVNF") - appcStatus = appcClient.runCommand(Action.Start,actionIdentifiers,flags,null,msoRequestId) + execution.setVariable('workStep', "StartVNF") + appcStatus = appcClient.runCommand(Action.Start,msoRequestId,vnfId,null) break case Action.Stop: - execution.setVariable(prefix + 'workStep', "StopVNF") - appcStatus = appcClient.runCommand(Action.Stop,actionIdentifiers,flags,null,msoRequestId) + execution.setVariable('workStep', "StopVNF") + appcStatus = appcClient.runCommand(Action.Stop,msoRequestId,vnfId,null) break default: break @@ -497,86 +520,42 @@ public class ReplaceVnfInfra extends AbstractServiceTaskProcessor { logDebug("AppC status code is: " + appcCode, isDebugLogEnabled) logDebug("AppC status message is: " + appcStatus.getMessage(), isDebugLogEnabled) if (support.getCategoryOf(appcStatus) == ApplicationControllerSupport.StatusCategory.ERROR) { - execution.setVariable(prefix + "errorCode", Integer.toString(appcCode)) - execution.setVariable(prefix + "errorText", appcStatus.getMessage()) + execution.setVariable("errorCode", Integer.toString(appcCode)) + execution.setVariable("errorText", appcStatus.getMessage()) } + logDebug('Exited ' + method, isDebugLogEnabled) } catch (BpmnError e) { logError('Caught exception in ' + method, e) - execution.setVariable(prefix + "errorCode", "1002") - execution.setVariable(prefix + "errorText", e.getMessage()) - //throw e; + execution.setVariable("errorCode", "1002") + execution.setVariable("errorText", e.getMessage()) } catch (java.lang.NoSuchMethodError e) { logError('Caught exception in ' + method, e) - execution.setVariable(prefix + "errorCode", "1002") - execution.setVariable(prefix + "errorText", e.getMessage()) - //throw e; + execution.setVariable("errorCode", "1002") + execution.setVariable("errorText", e.getMessage()) } catch (Exception e) { logError('Caught exception in ' + method, e) - execution.setVariable(prefix + "errorCode", "1002") - execution.setVariable(prefix + "errorText", e.getMessage()) - - //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in ' + method + ': ' + e.getMessage()) + execution.setVariable("errorCode", "1002") + execution.setVariable("errorText", e.getMessage()) } } - - /** - * Builds a "CompletionHandler" 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 completionHandlerPrep(Execution execution, String resultVar) { - def method = getClass().getSimpleName() + '.completionHandlerPrep(' + - 'execution=' + execution.getId() + - ', resultVar=' + resultVar + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - def requestInfo = getVariable(execution, 'RPLVnfI_requestInfo') - - appcClient.shutdownclient() - - String content = """ - - ${requestInfo} - MSO_ACTIVATE_BPEL - - """ - - content = utils.formatXml(content) - logDebug(resultVar + ' = ' + System.lineSeparator() + content, isDebugLogEnabled) - execution.setVariable(resultVar, content) - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, 'Internal Error') - } - } - /** * Prepare DoDeleteVnfAndModules call. * * * @param execution The flow's execution instance. */ - public void prepDoDeleteVnfAndModules(Execution execution) { + public void prepDoDeleteVnfAndModules(DelegateExecution execution) { def method = getClass().getSimpleName() + '.prepDoDeleteVnfAndModules(' + 'execution=' + execution.getId() + ')' def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - execution.setVariable(prefix + 'errorCode', "0") + execution.setVariable('errorCode', "0") logDebug('Entered ' + method, isDebugLogEnabled) - execution.setVariable(prefix + "workStep", "doDeleteVnfAndModules") + execution.setVariable("workStep", "doDeleteVnfAndModules") execution.setVariable("failedActivity", "MSO Delete VNF") logDebug('Exited ' + method, isDebugLogEnabled) @@ -588,87 +567,34 @@ public class ReplaceVnfInfra extends AbstractServiceTaskProcessor { * * @param execution The flow's execution instance. */ - public void prepDoCreateVnfAndModules(Execution execution) { + public void prepDoCreateVnfAndModules(DelegateExecution execution) { def method = getClass().getSimpleName() + '.prepDoReplaceVnfAndModules(' + 'execution=' + execution.getId() + ')' def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - execution.setVariable(prefix + 'errorCode', "0") + execution.setVariable('errorCode', "0") logDebug('Entered ' + method, isDebugLogEnabled) - execution.setVariable(prefix + "workStep", "doReplaceVnfAndModules") - execution.setVariable("failedActivity", "MSO Replace VNF") + execution.setVariable("workStep", "doCreateVnfAndModules") + execution.setVariable("failedActivity", "MSO Create VNF") logDebug('Exited ' + method, isDebugLogEnabled) } - /** - * Builds a "FalloutHandler" 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 falloutHandlerPrep(Execution execution, String resultVar) { - def method = getClass().getSimpleName() + '.falloutHandlerPrep(' + - 'execution=' + execution.getId() + - ', resultVar=' + resultVar + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - def prefix = execution.getVariable('prefix') - def request = getVariable(execution, prefix+'Request') - def requestInformation = execution.getVariable(prefix + "requestInfo") - - appcClient.shutdownclient() - - def WorkflowException workflowException = execution.getVariable("WorkflowException") - def errorResponseCode = workflowException.getErrorCode() - def errorResponseMsg = workflowException.getErrorMessage() - def encErrorResponseMsg = "" - if (errorResponseMsg != null) { - encErrorResponseMsg = errorResponseMsg.replace("&", "&").replace("<", "<").replace(">", ">") - } - - String content = """ - - ${requestInformation} - - ${encErrorResponseMsg} - ${errorResponseCode} - - - """ - content = utils.formatXml(content) - logDebug(resultVar + ' = ' + System.lineSeparator() + content, isDebugLogEnabled) - execution.setVariable(resultVar, content) - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildWorkflowException(execution, 2000, 'Internal Error') - } - } /** * Handle Abort disposition from RainyDayHandler * * @param execution The flow's execution instance. */ - public void abortProcessing(Execution execution) { + public void abortProcessing(DelegateExecution execution) { def method = getClass().getSimpleName() + '.abortProcessing(' + 'execution=' + execution.getId() + ')' def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') logDebug('Entered ' + method, isDebugLogEnabled) - def errorText = execution.getVariable(prefix + "errorText") - def errorCode = execution.getVariable(prefix + "errorCode") + def errorText = execution.getVariable("errorText") + def errorCode = execution.getVariable("errorCode") exceptionUtil.buildAndThrowWorkflowException(execution, errorCode as Integer, errorText) } @@ -678,14 +604,14 @@ public class ReplaceVnfInfra extends AbstractServiceTaskProcessor { * * @param execution The flow's execution instance. */ - public void manualProcessing(Execution execution) { + public void manualProcessing(DelegateExecution execution) { def method = getClass().getSimpleName() + '.manualProcessing(' + 'execution=' + execution.getId() + ')' def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') logDebug('Entered ' + method, isDebugLogEnabled) - def taskId = execution.getVariable("RPLVnfI_taskId") + def taskId = execution.getVariable("taskId") exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Processing halted - manual task created: " + taskId) } diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/RollbackVnf.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/RollbackVnf.groovy new file mode 100644 index 0000000000..b3ac195c7d --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/RollbackVnf.groovy @@ -0,0 +1,153 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.infrastructure.scripts + +import groovy.json.JsonOutput +import groovy.json.JsonSlurper +import groovy.util.Node +import groovy.util.XmlParser; +import groovy.xml.QName + +import java.beans.MetaData.java_lang_Class_PersistenceDelegate +import java.io.Serializable; +import java.util.UUID; +import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.impl.cmd.AbstractSetVariableCmd +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.openecomp.mso.rest.APIResponse +import org.openecomp.mso.rest.RESTClient +import org.openecomp.mso.rest.RESTConfig +import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor; +import org.openecomp.mso.bpmn.common.scripts.VidUtils; +import org.openecomp.mso.bpmn.core.RollbackData +import org.openecomp.mso.bpmn.core.WorkflowException +import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil +import org.openecomp.mso.bpmn.core.json.JsonUtils +import org.openecomp.mso.bpmn.core.domain.ModelInfo +import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition +import org.openecomp.mso.bpmn.core.domain.VnfResource +import org.openecomp.mso.client.aai.* + +import org.openecomp.mso.client.appc.ApplicationControllerClient; +import org.openecomp.mso.client.appc.ApplicationControllerSupport; +import org.openecomp.mso.client.aai.AAIResourcesClient +import org.openecomp.mso.client.aai.entities.AAIResultWrapper +import org.openecomp.mso.client.aai.entities.uri.AAIUri +import org.openecomp.mso.client.aai.entities.uri.AAIUriFactory +import org.onap.appc.client.lcm.model.Action; +import org.onap.appc.client.lcm.model.ActionIdentifiers; +import org.onap.appc.client.lcm.model.LockInput +import org.onap.appc.client.lcm.model.UnlockInput +import org.onap.appc.client.lcm.model.HealthCheckInput +import org.onap.appc.client.lcm.model.StartInput +import org.onap.appc.client.lcm.model.StopInput +import org.onap.appc.client.lcm.model.Flags +import org.onap.appc.client.lcm.model.Status + + + +public class RollbackVnf extends VnfCmBase { + + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtils = new JsonUtils() + def prefix = "VnfIPU_" + + /** + * Initialize the flow's variables. + * + * @param execution The flow's execution instance. + */ + public void initProcessVariables(DelegateExecution execution) { + execution.setVariable('prefix', 'RVnf_') + + execution.setVariable('rollbackSuccessful', false) + execution.setVariable('currentActivity', 'RVnf') + execution.setVariable('workStep', null) + execution.setVariable('failedActivity', null) + execution.setVariable('errorCode', "0") + execution.setVariable('actionUnlock', Action.Unlock) + execution.setVariable('actionStart', Action.Start) + execution.setVariable('actionResumeTraffic', Action.ResumeTraffic) + + } + + /** + * Check for missing elements in the received request. + * + * @param execution The flow's execution instance. + */ + public void preProcessRequest(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.preProcessRequest(' + + 'execution=' + execution.getId() + + ')' + initProcessVariables(execution) + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + logDebug('Entered ' + method, isDebugLogEnabled) + + initProcessVariables(execution) + + try { + + execution.setVariable("rollbackErrorCode", "0") + + if (execution.getVariable("rollbackSetClosedLoopDisabledFlag") == true) { + logDebug("Will call setClosedLoopDisabledFlag", isDebugLogEnabled) + } + + + logDebug('Exited ' + method, isDebugLogEnabled) + + } + catch(Exception e) { + String restFaultMessage = e.getMessage() + utils.log("ERROR", " Exception Encountered - " + "\n" + restFaultMessage, isDebugLogEnabled) + execution.setVariable("rollbackErrorCode", "1") + } + } + + /** + * Determine success of rollback execution. + * + * @param execution The flow's execution instance. + */ + public void setRollbackResult(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.setRollbackResult(' + + 'execution=' + execution.getId() + + ')' + initProcessVariables(execution) + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + logDebug('Entered ' + method, isDebugLogEnabled) + + def rollbackErrorCode = execution.getVariable('rollbackErrorCode') + if (rollbackErrorCode == "0") { + execution.setVariable('rollbackSuccessful', true) + logDebug("rollback successful", isDebugLogEnabled) + } + else { + execution.setVariable('rollbackSuccessful', false) + logDebug("rollback unsuccessful", isDebugLogEnabled) + } + + logDebug('Exited ' + method, isDebugLogEnabled) + + } + +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy index 44eaa349b6..1c87c11ff3 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy @@ -34,7 +34,7 @@ import java.util.List; import java.util.UUID; import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.runtime.Execution +import org.camunda.bpm.engine.delegate.DelegateExecution import org.apache.commons.lang3.* import org.apache.commons.codec.binary.Base64; import org.springframework.web.util.UriUtils @@ -50,7 +50,7 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor JsonUtils jsonUtil = new JsonUtils() - public void preProcessRequest (Execution execution) { + public void preProcessRequest (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) String msg = "" @@ -139,7 +139,7 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor utils.log("INFO"," ***** Exit preProcessRequest *****", isDebugEnabled) } - public void sendSyncResponse (Execution execution) { + public void sendSyncResponse (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("INFO", " *** sendSyncResponse *** ", isDebugEnabled) @@ -161,7 +161,7 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor } - public void sendSyncError (Execution execution) { + public void sendSyncError (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("INFO", " *** sendSyncError *** ", isDebugEnabled) @@ -189,7 +189,7 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor } - public void prepareCompletionRequest (Execution execution) { + public void prepareCompletionRequest (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("INFO", " *** prepareCompletion *** ", isDebugEnabled) @@ -225,7 +225,7 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor utils.log("INFO", "*** Exit prepareCompletionRequest ***", isDebugEnabled) } - public void prepareFalloutRequest(Execution execution){ + public void prepareFalloutRequest(DelegateExecution execution){ def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("INFO", " *** prepareFalloutRequest *** ", isDebugEnabled) diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateNetworkInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateNetworkInstance.groovy index 05fde9d39f..33eb4f90bf 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateNetworkInstance.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateNetworkInstance.groovy @@ -30,7 +30,7 @@ import org.openecomp.mso.rest.APIResponse import java.util.UUID; import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.runtime.Execution +import org.camunda.bpm.engine.delegate.DelegateExecution import org.apache.commons.lang3.* import org.apache.commons.codec.binary.Base64; import org.springframework.web.util.UriUtils @@ -44,7 +44,7 @@ public class UpdateNetworkInstance extends AbstractServiceTaskProcessor { ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() - public InitializeProcessVariables(Execution execution){ + public InitializeProcessVariables(DelegateExecution execution){ execution.setVariable(Prefix + "source", "") execution.setVariable(Prefix + "Success", false) @@ -67,7 +67,7 @@ public class UpdateNetworkInstance extends AbstractServiceTaskProcessor { * This method is executed during the preProcessRequest task of the UpdateNetworkInstance.bpmn process. * @param execution */ - public void preProcessRequest (Execution execution) { + public void preProcessRequest (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) @@ -150,7 +150,7 @@ public class UpdateNetworkInstance extends AbstractServiceTaskProcessor { } } - public void sendSyncResponse (Execution execution) { + public void sendSyncResponse (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) @@ -175,7 +175,7 @@ public class UpdateNetworkInstance extends AbstractServiceTaskProcessor { } - public void getNetworkModelInfo (Execution execution) { + public void getNetworkModelInfo (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix", Prefix) @@ -200,7 +200,7 @@ public class UpdateNetworkInstance extends AbstractServiceTaskProcessor { } - public void sendSyncError (Execution execution) { + public void sendSyncError (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix", Prefix) @@ -222,7 +222,7 @@ public class UpdateNetworkInstance extends AbstractServiceTaskProcessor { } - public void prepareDBRequestError (Execution execution) { + public void prepareDBRequestError (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) @@ -270,7 +270,7 @@ public class UpdateNetworkInstance extends AbstractServiceTaskProcessor { } - public void prepareCompletion (Execution execution) { + public void prepareCompletion (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) @@ -318,7 +318,7 @@ public class UpdateNetworkInstance extends AbstractServiceTaskProcessor { // Post or Validate Response Section // ************************************************** - public void postProcessResponse (Execution execution) { + public void postProcessResponse (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix", Prefix) @@ -352,7 +352,7 @@ public class UpdateNetworkInstance extends AbstractServiceTaskProcessor { // Build Error Section // ******************************* - public void processRollbackData (Execution execution) { + public void processRollbackData (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix", Prefix) @@ -373,7 +373,7 @@ public class UpdateNetworkInstance extends AbstractServiceTaskProcessor { } // Prepare for FalloutHandler - public void buildErrorResponse (Execution execution) { + public void buildErrorResponse (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix", Prefix) @@ -434,7 +434,7 @@ public class UpdateNetworkInstance extends AbstractServiceTaskProcessor { } - public void processJavaException(Execution execution){ + public void processJavaException(DelegateExecution execution){ def isDebugEnabled=execution.getVariable("isDebugLogEnabled") execution.setVariable("prefix",Prefix) try{ diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateVfModule.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateVfModule.groovy index 4fddced3f9..2acc550318 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateVfModule.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateVfModule.groovy @@ -27,7 +27,7 @@ import groovy.xml.QName import java.io.Serializable; import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.runtime.Execution +import org.camunda.bpm.engine.delegate.DelegateExecution import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil import org.openecomp.mso.bpmn.core.WorkflowException import org.openecomp.mso.bpmn.core.json.JsonUtils; @@ -45,7 +45,7 @@ public class UpdateVfModule extends AbstractServiceTaskProcessor { * * @param execution The flow's execution instance. */ - public void initProcessVariables(Execution execution) { + public void initProcessVariables(DelegateExecution execution) { execution.setVariable('prefix', 'UPDVfMod_') execution.setVariable('UPDVfMod_Request', null) execution.setVariable('UPDVfMod_requestInfo', null) @@ -66,7 +66,7 @@ public class UpdateVfModule extends AbstractServiceTaskProcessor { * * @param execution The flow's execution instance. */ - public void preProcessRequest(Execution execution) { + public void preProcessRequest(DelegateExecution execution) { def method = getClass().getSimpleName() + '.preProcessRequest(' + 'execution=' + execution.getId() + ')' @@ -107,7 +107,7 @@ public class UpdateVfModule extends AbstractServiceTaskProcessor { * * @param execution The flow's execution instance. */ - public void sendSynchResponse(Execution execution) { + public void sendSynchResponse(DelegateExecution execution) { def method = getClass().getSimpleName() + '.sendSynchResponse(' + 'execution=' + execution.getId() + ')' @@ -165,7 +165,7 @@ public class UpdateVfModule extends AbstractServiceTaskProcessor { * * @param execution The flow's execution instance. */ - public void prepDoUpdateVfModule(Execution execution) { + public void prepDoUpdateVfModule(DelegateExecution execution) { def method = getClass().getSimpleName() + '.prepDoUpdateVfModule(' + 'execution=' + execution.getId() + ')' @@ -188,7 +188,7 @@ public class UpdateVfModule extends AbstractServiceTaskProcessor { * * @param execution The flow's execution instance. */ - public void prepUpdateInfraRequest(Execution execution) { + public void prepUpdateInfraRequest(DelegateExecution execution) { def method = getClass().getSimpleName() + '.prepUpdateInfraRequest(' + 'execution=' + execution.getId() + ')' @@ -243,7 +243,7 @@ public class UpdateVfModule extends AbstractServiceTaskProcessor { * @param execution the execution * @param resultVar the execution variable in which the result will be stored */ - public void completionHandlerPrep(Execution execution, String resultVar) { + public void completionHandlerPrep(DelegateExecution execution, String resultVar) { def method = getClass().getSimpleName() + '.completionHandlerPrep(' + 'execution=' + execution.getId() + ', resultVar=' + resultVar + @@ -282,7 +282,7 @@ public class UpdateVfModule extends AbstractServiceTaskProcessor { * @param execution the execution * @param resultVar the execution variable in which the result will be stored */ - public void falloutHandlerPrep(Execution execution, String resultVar) { + public void falloutHandlerPrep(DelegateExecution execution, String resultVar) { def method = getClass().getSimpleName() + '.falloutHandlerPrep(' + 'execution=' + execution.getId() + ', resultVar=' + resultVar + diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateVfModuleInfra.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateVfModuleInfra.groovy index 6ac35261c4..60e8ca4b88 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateVfModuleInfra.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateVfModuleInfra.groovy @@ -29,7 +29,7 @@ import groovy.xml.QName import java.io.Serializable; import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.runtime.Execution +import org.camunda.bpm.engine.delegate.DelegateExecution import org.openecomp.mso.rest.APIResponse import org.openecomp.mso.rest.RESTClient import org.openecomp.mso.rest.RESTConfig @@ -48,7 +48,7 @@ public class UpdateVfModuleInfra extends AbstractServiceTaskProcessor { * * @param execution The flow's execution instance. */ - public void initProcessVariables(Execution execution) { + public void initProcessVariables(DelegateExecution execution) { execution.setVariable('prefix', 'UPDVfModI_') execution.setVariable('UPDVfModI_Request', null) execution.setVariable('UPDVfModI_requestInfo', null) @@ -69,7 +69,7 @@ public class UpdateVfModuleInfra extends AbstractServiceTaskProcessor { * * @param execution The flow's execution instance. */ - public void preProcessRequest(Execution execution) { + public void preProcessRequest(DelegateExecution execution) { def method = getClass().getSimpleName() + '.preProcessRequest(' + 'execution=' + execution.getId() + @@ -134,7 +134,7 @@ public class UpdateVfModuleInfra extends AbstractServiceTaskProcessor { Map userParamsMap = [:] if (userParams != null) { userParams.each { userParam -> - userParamsMap.put(userParam.name, userParam.value) + userParamsMap.put(userParam.name, userParam.value.toString()) } } @@ -231,7 +231,7 @@ public class UpdateVfModuleInfra extends AbstractServiceTaskProcessor { * * @param execution The flow's execution instance. */ - public void sendSynchResponse(Execution execution) { + public void sendSynchResponse(DelegateExecution execution) { def method = getClass().getSimpleName() + '.sendSynchResponse(' + 'execution=' + execution.getId() + ')' @@ -277,7 +277,7 @@ public class UpdateVfModuleInfra extends AbstractServiceTaskProcessor { * * @param execution The flow's execution instance. */ - public void prepDoUpdateVfModule(Execution execution) { + public void prepDoUpdateVfModule(DelegateExecution execution) { def method = getClass().getSimpleName() + '.prepDoUpdateVfModule(' + 'execution=' + execution.getId() + ')' @@ -300,7 +300,7 @@ public class UpdateVfModuleInfra extends AbstractServiceTaskProcessor { * * @param execution The flow's execution instance. */ - public void prepUpdateInfraRequest(Execution execution) { + public void prepUpdateInfraRequest(DelegateExecution execution) { def method = getClass().getSimpleName() + '.prepUpdateInfraRequest(' + 'execution=' + execution.getId() + ')' @@ -354,7 +354,7 @@ public class UpdateVfModuleInfra extends AbstractServiceTaskProcessor { * @param execution the execution * @param resultVar the execution variable in which the result will be stored */ - public void completionHandlerPrep(Execution execution, String resultVar) { + public void completionHandlerPrep(DelegateExecution execution, String resultVar) { def method = getClass().getSimpleName() + '.completionHandlerPrep(' + 'execution=' + execution.getId() + ', resultVar=' + resultVar + @@ -392,7 +392,7 @@ public class UpdateVfModuleInfra extends AbstractServiceTaskProcessor { * @param execution the execution * @param resultVar the execution variable in which the result will be stored */ - public void falloutHandlerPrep(Execution execution, String resultVar) { + public void falloutHandlerPrep(DelegateExecution execution, String resultVar) { def method = getClass().getSimpleName() + '.falloutHandlerPrep(' + 'execution=' + execution.getId() + ', resultVar=' + resultVar + @@ -445,7 +445,7 @@ public class UpdateVfModuleInfra extends AbstractServiceTaskProcessor { * @param execution the execution * @return the validated request */ - public String validateInfraRequest(Execution execution) { + public String validateInfraRequest(DelegateExecution execution) { def method = getClass().getSimpleName() + '.validateInfraRequest(' + 'execution=' + execution.getId() + ')' diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateVfModuleInfraV2.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateVfModuleInfraV2.groovy index bdb89f0ec2..18f36b879b 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateVfModuleInfraV2.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateVfModuleInfraV2.groovy @@ -26,13 +26,10 @@ import groovy.json.JsonSlurper import groovy.util.Node import groovy.util.XmlParser; import groovy.xml.QName -import inventory.aai.att.com.v10.GenericVnf -import inventory.aai.att.com.v10.GenericVnfs -import inventory.aai.att.com.v10.Pserver import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.impl.cmd.AbstractSetVariableCmd -import org.camunda.bpm.engine.runtime.Execution +import org.camunda.bpm.engine.delegate.DelegateExecution import java.io.Serializable; import java.util.List @@ -76,7 +73,7 @@ public class UpdateVfModuleInfraV2 { - public void initProcessVariables(Execution execution) { + public void initProcessVariables(DelegateExecution execution) { execution.setVariable('prefix', 'UPDVfModI_') execution.setVariable('UPDVfModI_Request', null) execution.setVariable('UPDVfModI_requestInfo', null) @@ -98,7 +95,7 @@ public class UpdateVfModuleInfraV2 { * * @param execution The flow's execution instance. */ - public void preProcessRequest(Execution execution) { + public void preProcessRequest(DelegateExecution execution) { System.out.print("*****************************PreProcessRequest**************************") def method = getClass().getSimpleName() + '.preProcessRequest(' + @@ -164,7 +161,7 @@ public class UpdateVfModuleInfraV2 { Map userParamsMap = [:] if (userParams != null) { userParams.each { userParam -> - userParamsMap.put(userParam.name, userParam.value) + userParamsMap.put(userParam.name, userParam.value.toString()) } } @@ -260,7 +257,7 @@ public class UpdateVfModuleInfraV2 { * * @param execution The flow's execution instance. */ - public void sendSynchResponse(Execution execution) { + public void sendSynchResponse(DelegateExecution execution) { System.out.print("*****************************SendSynchResponse**************************") def method = getClass().getSimpleName() + '.sendSynchResponse(' + @@ -297,7 +294,7 @@ public class UpdateVfModuleInfraV2 { } //check to see if the Pserver Flag is locked - public void checkPserverFlag(Execution execution) { + public void checkPserverFlag(DelegateExecution execution) { System.out.println("*****************************CheckingPserverFlag*************************") String vnfId = (String)execution.getVariable('vnfId') @@ -307,7 +304,7 @@ public class UpdateVfModuleInfraV2 { } //check to see if the VFFlag is locked - public void vfFlagCheck(Execution execution) { + public void vfFlagCheck(DelegateExecution execution) { System.out.print("*****************************VfFlagCheck*************************") String vnfId = (String)execution.getVariable('vnfId') @@ -317,7 +314,7 @@ public class UpdateVfModuleInfraV2 { } //lock the VF Flag - public void vfFlagSet(Execution execution) { + public void vfFlagSet(DelegateExecution execution) { System.out.print("*****************************VfFlagSet*************************") String vnfId = (String)execution.getVariable('vnfId') @@ -328,7 +325,7 @@ public class UpdateVfModuleInfraV2 { } //Lock AppC - public void lockAppC(Execution execution) { + public void lockAppC(DelegateExecution execution) { System.out.print("*****************************lockAppC*************************") def vfModuleId = "" @@ -338,7 +335,7 @@ public class UpdateVfModuleInfraV2 { } //run health check - public void healthCheckAppC(Execution execution) { + public void healthCheckAppC(DelegateExecution execution) { System.out.print("*****************************healthCheckAppC*************************") def vfModuleId = "" @@ -347,14 +344,14 @@ public class UpdateVfModuleInfraV2 { } //SDNO health diagnostic - public void healthDiagnosticSDNO(Execution execution) { + public void healthDiagnosticSDNO(DelegateExecution execution) { System.out.print("*****************************healthDiagnosticSDNO is currently ignored*************************") //SDNOValidatorImpl.healthDiagnostic("",""); } //stop VF module controller - public void stopVfModuleController(Execution execution) { + public void stopVfModuleController(DelegateExecution execution) { System.out.print("*****************************stopVfModuleController*************************") def vfModuleId = "" @@ -364,7 +361,7 @@ public class UpdateVfModuleInfraV2 { } - public void doUpdateVfModulePrep(Execution execution) { + public void doUpdateVfModulePrep(DelegateExecution execution) { System.out.print("*****************************doUpdateVfModulePrep*************************") def method = getClass().getSimpleName() + '.prepDoUpdateVfModule(' + @@ -386,7 +383,7 @@ public class UpdateVfModuleInfraV2 { } - public void completionHandlerPrep(Execution execution,String resultVar) { + public void completionHandlerPrep(DelegateExecution execution,String resultVar) { System.out.print("*****************************completionHandlerPrep*************************") def method = getClass().getSimpleName() + '.completionHandlerPrep(' + @@ -422,7 +419,7 @@ public class UpdateVfModuleInfraV2 { } - public void healthCheckController(Execution execution) { + public void healthCheckController(DelegateExecution execution) { System.out.print("*****************************healthCheckController*************************") def vfModuleId = "" @@ -431,7 +428,7 @@ public class UpdateVfModuleInfraV2 { } - public void startVfModuleController(Execution execution) { + public void startVfModuleController(DelegateExecution execution) { System.out.print("*****************************startVfModuleController*************************") def vfModuleId = "" @@ -440,7 +437,7 @@ public class UpdateVfModuleInfraV2 { } - public void vFFlagUnset(Execution execution) { + public void vFFlagUnset(DelegateExecution execution) { System.out.print("*****************************vFFlagUnset*************************") String vnfId = (String)execution.getVariable('vnfId') @@ -451,7 +448,7 @@ public class UpdateVfModuleInfraV2 { } - public void unlockAppC(Execution execution) { + public void unlockAppC(DelegateExecution execution) { System.out.print("*****************************unlockAppC*************************") def vfModuleId = "" @@ -460,7 +457,7 @@ public class UpdateVfModuleInfraV2 { } - public void postUpgradeHealthCheckController(Execution execution) { + public void postUpgradeHealthCheckController(DelegateExecution execution) { System.out.print("*****************************postUpgradeHealthCheckController*************************") def vfModuleId = "" diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy index 9dca8df108..c68b04f3b1 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy @@ -23,7 +23,7 @@ package org.openecomp.mso.bpmn.infrastructure.scripts import java.util.concurrent.ExecutionException; import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.runtime.Execution +import org.camunda.bpm.engine.delegate.DelegateExecution import org.apache.commons.lang3.* import org.springframework.web.util.UriUtils import org.openecomp.mso.bpmn.common.scripts.AaiUtil @@ -42,7 +42,7 @@ class UpdateVfModuleVolume extends VfModuleBase { * * @param execution The flow's execution instance. */ - private void initProcessVariables(Execution execution) { + private void initProcessVariables(DelegateExecution execution) { execution.setVariable('prefix', 'UPDVfModVol_') execution.setVariable('UPDVfModVol_Request', null) execution.setVariable('UPDVfModVol_requestInfo', null) @@ -66,7 +66,7 @@ class UpdateVfModuleVolume extends VfModuleBase { * @param execution The flow's execution instance. */ @Override - public void preProcessRequest(Execution execution) { + public void preProcessRequest(DelegateExecution execution) { def method = getClass().getSimpleName() + '.preProcessRequest(' + 'execution=' + execution.getId() + ')' @@ -108,7 +108,7 @@ class UpdateVfModuleVolume extends VfModuleBase { * * @param execution The flow's execution instance. */ - public void sendSynchResponse(Execution execution) { + public void sendSynchResponse(DelegateExecution execution) { def method = getClass().getSimpleName() + '.sendSynchResponse(' + 'execution=' + execution.getId() + ')' @@ -160,7 +160,7 @@ class UpdateVfModuleVolume extends VfModuleBase { * * @param execution The flow's execution instance. */ - public void queryAAIForVolumeGroup(Execution execution) { + public void queryAAIForVolumeGroup(DelegateExecution execution) { def method = getClass().getSimpleName() + '.queryAAIForVolumeGroup(' + 'execution=' + execution.getId() + ')' @@ -218,7 +218,7 @@ class UpdateVfModuleVolume extends VfModuleBase { * * @param execution The flow's execution instance. */ - public void prepVnfAdapterRest(Execution execution) { + public void prepVnfAdapterRest(DelegateExecution execution) { def method = getClass().getSimpleName() + '.prepVnfAdapterRest(' + 'execution=' + execution.getId() + ')' @@ -285,7 +285,7 @@ class UpdateVfModuleVolume extends VfModuleBase { * * @param execution The flow's execution instance. */ - public void prepDbInfraDbRequest(Execution execution) { + public void prepDbInfraDbRequest(DelegateExecution execution) { def method = getClass().getSimpleName() + '.prepDbInfraDbRequest(' + 'execution=' + execution.getId() + ')' @@ -329,7 +329,7 @@ class UpdateVfModuleVolume extends VfModuleBase { * * @param execution The flow's execution instance. */ - public void prepCompletionHandlerRequest(Execution execution) { + public void prepCompletionHandlerRequest(DelegateExecution execution) { def method = getClass().getSimpleName() + '.prepCompletionHandlerRequest(' + 'execution=' + execution.getId() + ')' @@ -366,7 +366,7 @@ class UpdateVfModuleVolume extends VfModuleBase { * * @param execution The flow's execution instance. */ - public void prepFalloutHandler(Execution execution) { + public void prepFalloutHandler(DelegateExecution execution) { def method = getClass().getSimpleName() + '.prepFalloutHandler(' + 'execution=' + execution.getId() + ')' @@ -416,7 +416,7 @@ class UpdateVfModuleVolume extends VfModuleBase { * * @param execution The flow's execution instance. */ - public void handleTenantIdMismatch(Execution execution) { + public void handleTenantIdMismatch(DelegateExecution execution) { def method = getClass().getSimpleName() + '.handleTenantIdMismatch(' + 'execution=' + execution.getId() + ')' diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy index 3d5a31c6e2..913046b247 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy @@ -25,7 +25,7 @@ import groovy.json.JsonSlurper import java.util.concurrent.ExecutionException; import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.runtime.Execution +import org.camunda.bpm.engine.delegate.DelegateExecution import org.apache.commons.lang3.* import org.springframework.web.util.UriUtils import org.openecomp.mso.bpmn.common.scripts.AaiUtil; @@ -44,7 +44,7 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase { * * @param execution The flow's execution instance. */ - private void initProcessVariables(Execution execution) { + private void initProcessVariables(DelegateExecution execution) { execution.setVariable('prefix', 'UPDVfModVol_') execution.setVariable('UPDVfModVol_Request', null) execution.setVariable('UPDVfModVol_requestInfo', null) @@ -67,12 +67,12 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase { * Perform initial processing, such as request validation, initialization of variables, etc. * * @param execution */ - public void preProcessRequest (Execution execution) { + public void preProcessRequest (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") preProcessRequest(execution, isDebugEnabled) } - public void preProcessRequest(Execution execution, isDebugLogEnabled) { + public void preProcessRequest(DelegateExecution execution, isDebugLogEnabled) { initProcessVariables(execution) String jsonRequest = validateRequest(execution) @@ -135,7 +135,7 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase { * * @param execution The flow's execution instance. */ - public void sendSynchResponse(Execution execution, isDebugLogEnabled) { + public void sendSynchResponse(DelegateExecution execution, isDebugLogEnabled) { def requestInfo = execution.getVariable('UPDVfModVol_requestInfo') def requestId = execution.getVariable('UPDVfModVol_requestId') @@ -185,7 +185,7 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase { * Volume Group Id and Aic Cloud Region. * @param execution The flow's execution instance. */ - public void queryAAIForVolumeGroup(Execution execution, isDebugLogEnabled) { + public void queryAAIForVolumeGroup(DelegateExecution execution, isDebugLogEnabled) { def volumeGroupId = execution.getVariable('UPDVfModVol_volumeGroupId') def aicCloudRegion = execution.getVariable('UPDVfModVol_aicCloudRegion') @@ -244,7 +244,7 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase { * @param execution * @param isDebugEnabled */ - public void queryAAIForGenericVnf(Execution execution, isDebugEnabled) { + public void queryAAIForGenericVnf(DelegateExecution execution, isDebugEnabled) { def vnfId = execution.getVariable('vnfId') @@ -285,7 +285,7 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase { * @param execution * @param isDebugLogEnabled */ - public void queryAAIForVfModule(Execution execution, isDebugLogEnabled) { + public void queryAAIForVfModule(DelegateExecution execution, isDebugLogEnabled) { AaiUtil aaiUtil = new AaiUtil(this) String queryAAIVfModuleRequest = execution.getVariable('UPDVfModVol_relatedVfModuleLink') @@ -346,7 +346,7 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase { * * @param execution The flow's execution instance. */ - public void prepVnfAdapterRest(Execution execution, isDebugLogEnabled) { + public void prepVnfAdapterRest(DelegateExecution execution, isDebugLogEnabled) { def aicCloudRegion = execution.getVariable('UPDVfModVol_aicCloudRegion') def tenantId = execution.getVariable('UPDVfModVol_tenantId') @@ -433,7 +433,7 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase { * * @param execution The flow's execution instance. */ - public void prepDbInfraDbRequest(Execution execution, isDebugLogEnabled) { + public void prepDbInfraDbRequest(DelegateExecution execution, isDebugLogEnabled) { def requestId = execution.getVariable('UPDVfModVol_requestId') ExceptionUtil exceptionUtil = new ExceptionUtil(); @@ -462,7 +462,7 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase { * Build a "CompletionHandler" request. * @param execution The flow's execution instance. */ - public void prepCompletionHandlerRequest(Execution execution, requestId, action, source, isDebugLogEnabled) { + public void prepCompletionHandlerRequest(DelegateExecution execution, requestId, action, source, isDebugLogEnabled) { String content = """ userParamsMap = [:] if (userParams != null) { userParams.each { userParam -> - userParamsMap.put(userParam.name, userParam.value) + userParamsMap.put(userParam.name, userParam.value.toString()) } } utils.log("DEBUG", 'Processed user params: ' + userParamsMap, isDebugLogEnabled) - execution.setVariable(prefix + 'vfModuleInputParams', userParamsMap) + execution.setVariable('vfModuleInputParams', userParamsMap) def requestId = execution.getVariable("mso-request-id") - execution.setVariable(prefix + 'requestId', requestId) + execution.setVariable('requestId', requestId) execution.setVariable('msoRequestId', requestId) def vnfName = reqMap.requestDetails?.requestInfo?.instanceName ?: null - execution.setVariable(prefix + 'vnfName', vnfName) + execution.setVariable('vnfName', vnfName) def requestorId = reqMap.requestDetails?.requestInfo?.requestorId ?: null - execution.setVariable(prefix + 'requestorId', requestorId) + execution.setVariable('requestorId', requestorId) def usePreload = reqMap.requestDetails?.requestParameters?.usePreload - execution.setVariable(prefix + 'usePreload', usePreload) + execution.setVariable('usePreload', usePreload) def cloudConfiguration = reqMap.requestDetails?.cloudConfiguration def lcpCloudRegionId = cloudConfiguration.lcpCloudRegionId - execution.setVariable(prefix + 'lcpCloudRegionId', lcpCloudRegionId) + execution.setVariable('lcpCloudRegionId', lcpCloudRegionId) def tenantId = cloudConfiguration.tenantId - execution.setVariable(prefix + 'tenantId', tenantId) + execution.setVariable('tenantId', tenantId) def globalSubscriberId = reqMap.requestDetails?.subscriberInfo?.globalSubscriberId ?: '' - execution.setVariable(prefix + 'globalSubscriberId', globalSubscriberId) + execution.setVariable('globalSubscriberId', globalSubscriberId) - execution.setVariable(prefix + 'sdncVersion', '1702') + execution.setVariable('sdncVersion', '1702') execution.setVariable("UpdateVnfInfraSuccessIndicator", false) execution.setVariable("isDebugLogEnabled", isDebugLogEnabled) def source = reqMap.requestDetails?.requestInfo?.source - execution.setVariable(prefix + "source", source) + execution.setVariable("source", source) //For Completion Handler & Fallout Handler String requestInfo = @@ -207,9 +209,9 @@ public class UpdateVnfInfra extends AbstractServiceTaskProcessor { ${source} """ - execution.setVariable(prefix + "requestInfo", requestInfo) + execution.setVariable("requestInfo", requestInfo) - logDebug('RequestInfo: ' + execution.getVariable(prefix + "requestInfo"), isDebugLogEnabled) + logDebug('RequestInfo: ' + execution.getVariable("requestInfo"), isDebugLogEnabled) logDebug('Exited ' + method, isDebugLogEnabled) @@ -231,7 +233,7 @@ public class UpdateVnfInfra extends AbstractServiceTaskProcessor { * * @param execution The flow's execution instance. */ - public void sendSynchResponse(Execution execution) { + public void sendSynchResponse(DelegateExecution execution) { def method = getClass().getSimpleName() + '.sendSynchResponse(' + 'execution=' + execution.getId() + ')' @@ -240,9 +242,9 @@ public class UpdateVnfInfra extends AbstractServiceTaskProcessor { try { - def requestInfo = execution.getVariable('UPDVnfI_requestInfo') - def requestId = execution.getVariable('UPDVnfI_requestId') - def source = execution.getVariable('UPDVnfI_source') + def requestInfo = execution.getVariable('requestInfo') + def requestId = execution.getVariable('requestId') + def source = execution.getVariable('source') def progress = getNodeTextForce(requestInfo, 'progress') if (progress.isEmpty()) { progress = '0' @@ -275,7 +277,7 @@ public class UpdateVnfInfra extends AbstractServiceTaskProcessor { * * @param execution The flow's execution instance. */ - public void getVnfResourceDecomposition(Execution execution) { + public void getVnfResourceDecomposition(DelegateExecution execution) { def method = getClass().getSimpleName() + '.getVnfResourceDecomposition(' + 'execution=' + execution.getId() + ')' @@ -284,7 +286,7 @@ public class UpdateVnfInfra extends AbstractServiceTaskProcessor { try { ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") - String vnfModelInvariantUuid = execution.getVariable(prefix + 'vnfModelInvariantUuid') + String vnfModelInvariantUuid = execution.getVariable('vnfModelInvariantUuid') logDebug("vnfModelInvariantUuid: " + vnfModelInvariantUuid, isDebugLogEnabled) List vnfResources = serviceDecomposition.getServiceVnfs() @@ -295,9 +297,9 @@ public class UpdateVnfInfra extends AbstractServiceTaskProcessor { if (vnfModelInvariantUuid.equals(modelInvariantUuidFromDecomposition)) { VnfResource vnfResourceDecomposition = vnfResources[i] - execution.setVariable(prefix + 'vnfResourceDecomposition', vnfResourceDecomposition) + execution.setVariable('vnfResourceDecomposition', vnfResourceDecomposition) def nfRole = vnfResourceDecomposition.getNfRole() - execution.setVariable(prefix + 'nfRole', nfRole) + execution.setVariable('nfRole', nfRole) logDebug("vnfResourceDecomposition: " + vnfResourceDecomposition.toJsonString(), isDebugLogEnabled) break } @@ -322,14 +324,14 @@ public class UpdateVnfInfra extends AbstractServiceTaskProcessor { * * @param execution The flow's execution instance. */ - public void checkIfVnfInMaintInAAI(Execution execution) { + public void checkIfVnfInMaintInAAI(DelegateExecution execution) { def method = getClass().getSimpleName() + '.checkIfVnfInMaintInAAI(' + 'execution=' + execution.getId() + ')' def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - execution.setVariable(prefix + 'errorCode', "0") - execution.setVariable(prefix + "workStep", "checkIfVnfInMaintInAAI") - execution.setVariable(prefix + "failedActivity", "AAI") + execution.setVariable('errorCode', "0") + execution.setVariable("workStep", "checkIfVnfInMaintInAAI") + execution.setVariable("failedActivity", "AAI") logDebug('Entered ' + method, isDebugLogEnabled) try { @@ -340,15 +342,21 @@ public class UpdateVnfInfra extends AbstractServiceTaskProcessor { def vnfId = execution.getVariable("vnfId") boolean isInMaint = aaiValidator.isVNFLocked(vnfId, transactionLoggingUuid) logDebug("isInMaint result: " + isInMaint, isDebugLogEnabled) - execution.setVariable(prefix + 'isVnfInMaintenance', isInMaint) + execution.setVariable('isVnfInMaintenance', isInMaint) + + if (isInMaint) { + execution.setVariable("errorCode", "1003") + execution.setVariable("errorText", "VNF is in maintenance in A&AI") + } + logDebug('Exited ' + method, isDebugLogEnabled) } catch (BpmnError e) { throw e; } catch (Exception e) { logError('Caught exception in ' + method, e) - execution.setVariable(prefix + "errorCode", "1002") - execution.setVariable(prefix + "errorText", e.getMessage()) + execution.setVariable("errorCode", "1002") + execution.setVariable("errorText", e.getMessage()) //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfVnfInMaintInAAI(): ' + e.getMessage()) } } @@ -360,15 +368,15 @@ public class UpdateVnfInfra extends AbstractServiceTaskProcessor { * * @param execution The flow's execution instance. */ - public void checkIfPserversInMaintInAAI(Execution execution) { + public void checkIfPserversInMaintInAAI(DelegateExecution execution) { def method = getClass().getSimpleName() + '.checkIfPserversInMaintInAAI(' + 'execution=' + execution.getId() + ')' def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - execution.setVariable(prefix + 'errorCode', "0") + execution.setVariable('errorCode', "0") logDebug('Entered ' + method, isDebugLogEnabled) - execution.setVariable(prefix + "workStep", "checkIfPserversInMaintInAAI") - execution.setVariable(prefix + "failedActivity", "AAI") + execution.setVariable("workStep", "checkIfPserversInMaintInAAI") + execution.setVariable("failedActivity", "AAI") try { def transactionLoggingUuid = UUID.randomUUID().toString() @@ -378,15 +386,20 @@ public class UpdateVnfInfra extends AbstractServiceTaskProcessor { def vnfId = execution.getVariable("vnfId") boolean areLocked = aaiValidator.isPhysicalServerLocked(vnfId, transactionLoggingUuid) logDebug("areLocked result: " + areLocked, isDebugLogEnabled) - execution.setVariable(prefix + 'arePserversLocked', areLocked) + execution.setVariable('arePserversLocked', areLocked) + + if (areLocked) { + execution.setVariable("errorCode", "1003") + execution.setVariable("errorText", "pServers are locked in A&AI") + } logDebug('Exited ' + method, isDebugLogEnabled) } catch (BpmnError e) { throw e; } catch (Exception e) { logError('Caught exception in ' + method, e) - execution.setVariable(prefix + "errorCode", "1002") - execution.setVariable(prefix + "errorText", e.getMessage()) + execution.setVariable("errorCode", "1002") + execution.setVariable("errorText", e.getMessage()) //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfPserversInMaintInAAI(): ' + e.getMessage()) } } @@ -398,20 +411,20 @@ public class UpdateVnfInfra extends AbstractServiceTaskProcessor { * @param execution The flow's execution instance. * @param inMaint The boolean value of the flag to set */ - public void setVnfInMaintFlagInAAI(Execution execution, boolean inMaint) { + public void setVnfInMaintFlagInAAI(DelegateExecution execution, boolean inMaint) { def method = getClass().getSimpleName() + '.setVnfInMaintFlagInAAI(' + 'execution=' + execution.getId() + ')' def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - execution.setVariable(prefix + 'errorCode', "0") + execution.setVariable('errorCode', "0") logDebug('Entered ' + method, isDebugLogEnabled) if (inMaint) { - execution.setVariable(prefix + "workStep", "setVnfInMaintFlagInAAI") + execution.setVariable("workStep", "setVnfInMaintFlagInAAI") } else { - execution.setVariable(prefix + "workStep", "unsetVnfInMaintFlagInAAI") + execution.setVariable("workStep", "unsetVnfInMaintFlagInAAI") } - execution.setVariable(prefix + "failedActivity", "AAI") + execution.setVariable("failedActivity", "AAI") try { def transactionLoggingUuid = UUID.randomUUID().toString() @@ -421,6 +434,7 @@ public class UpdateVnfInfra extends AbstractServiceTaskProcessor { def vnfId = execution.getVariable("vnfId") if (inMaint) { aaiUpdator.updateVnfToLocked(vnfId, transactionLoggingUuid) + execution.setVariable("rollbackSetVnfInMaintenanceFlag", true) } else { aaiUpdator.updateVnfToUnLocked(vnfId, transactionLoggingUuid) @@ -431,246 +445,53 @@ public class UpdateVnfInfra extends AbstractServiceTaskProcessor { throw e; } catch (Exception e) { logError('Caught exception in ' + method, e) - execution.setVariable(prefix + "errorCode", "1002") - execution.setVariable(prefix + "errorText", e.getMessage()) + execution.setVariable("errorCode", "1002") + execution.setVariable("errorText", e.getMessage()) //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in setVnfInMaintFlagInAAI(): ' + e.getMessage()) } } - /** - * Call APP-C client to execute specified APP-C command for this VNF. - * - * - * @param execution The flow's execution instance. - * @param action The action to take in APP-C. - */ - public void runAppcCommand(Execution execution, Action action) { - def method = getClass().getSimpleName() + '.runAppcCommand(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - execution.setVariable(prefix + 'errorCode', "0") - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - logDebug("Running APP-C action: " + action.toString(), isDebugLogEnabled) - String vnfId = execution.getVariable('vnfId') - String msoRequestId = execution.getVariable(prefix + 'requestId') - execution.setVariable('msoRequestId', msoRequestId) - execution.setVariable(prefix + "failedActivity", "APP-C") - - ApplicationControllerSupport support = new ApplicationControllerSupport() - appcClient.appCSupport=support - org.springframework.test.util.ReflectionTestUtils.setField(support, "lcmModelPackage", "org.openecomp.appc.client.lcm.model"); - Flags flags = new Flags(); - ActionIdentifiers actionIdentifiers = new ActionIdentifiers(); - actionIdentifiers.setVnfId(vnfId); - Status appcStatus - switch(action) { - case Action.Lock: - execution.setVariable(prefix + 'workStep', "LockVNF") - appcStatus = appcClient.runCommand(Action.Lock,actionIdentifiers,flags,null,msoRequestId) - break - case Action.Unlock: - execution.setVariable(prefix + 'workStep', "UnlockVNF") - appcStatus = appcClient.runCommand(Action.Unlock,actionIdentifiers,flags,null,msoRequestId) - break - case Action.HealthCheck: - def healthCheckIndex = execution.getVariable(prefix + 'healthCheckIndex') - execution.setVariable(prefix + 'workStep', "HealthCheckVNF" + healthCheckIndex) - execution.setVariable(prefix + 'healthCheckIndex', healthCheckIndex + 1) - appcStatus = appcClient.runCommand(Action.HealthCheck,actionIdentifiers,flags,null,msoRequestId) - break - case Action.Start: - execution.setVariable(prefix + 'workStep', "StartVNF") - appcStatus = appcClient.runCommand(Action.Start,actionIdentifiers,flags,null,msoRequestId) - break - case Action.Stop: - execution.setVariable(prefix + 'workStep', "StopVNF") - appcStatus = appcClient.runCommand(Action.Stop,actionIdentifiers,flags,null,msoRequestId) - break - default: - break - } - logDebug("Completed AppC request", isDebugLogEnabled) - int appcCode = appcStatus.getCode() - logDebug("AppC status code is: " + appcCode, isDebugLogEnabled) - logDebug("AppC status message is: " + appcStatus.getMessage(), isDebugLogEnabled) - if (support.getCategoryOf(appcStatus) == ApplicationControllerSupport.StatusCategory.ERROR) { - execution.setVariable(prefix + "errorCode", Integer.toString(appcCode)) - execution.setVariable(prefix + "errorText", appcStatus.getMessage()) - } - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - logError('Caught exception in ' + method, e) - execution.setVariable(prefix + "errorCode", "1002") - execution.setVariable(prefix + "errorText", e.getMessage()) - //throw e; - } catch (java.lang.NoSuchMethodError e) { - logError('Caught exception in ' + method, e) - execution.setVariable(prefix + "errorCode", "1002") - execution.setVariable(prefix + "errorText", e.getMessage()) - //throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - execution.setVariable(prefix + "errorCode", "1002") - execution.setVariable(prefix + "errorText", e.getMessage()) - - //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in ' + method + ': ' + e.getMessage()) - } - } - - - - /** - * Builds a "CompletionHandler" 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 completionHandlerPrep(Execution execution, String resultVar) { - def method = getClass().getSimpleName() + '.completionHandlerPrep(' + - 'execution=' + execution.getId() + - ', resultVar=' + resultVar + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - - try { - appcClient.shutdownclient() - def requestInfo = getVariable(execution, 'UPDVnfI_requestInfo') - - String content = """ - - ${requestInfo} - MSO_ACTIVATE_BPEL - - """ - - content = utils.formatXml(content) - logDebug(resultVar + ' = ' + System.lineSeparator() + content, isDebugLogEnabled) - execution.setVariable(resultVar, content) - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, 'Internal Error') - } - } - /** * Prepare DoUpdateVnfAndModules call. * * * @param execution The flow's execution instance. */ - public void prepDoUpdateVnfAndModules(Execution execution) { + public void prepDoUpdateVnfAndModules(DelegateExecution execution) { def method = getClass().getSimpleName() + '.prepDoUpdateVnfAndModules(' + 'execution=' + execution.getId() + ')' def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - execution.setVariable(prefix + 'errorCode', "0") + execution.setVariable('errorCode', "0") logDebug('Entered ' + method, isDebugLogEnabled) - execution.setVariable(prefix + "workStep", "doUpdateVnfAndModules") - execution.setVariable(prefix + "failedActivity", "MSO Update VNF") + execution.setVariable("workStep", "doUpdateVnfAndModules") + execution.setVariable("failedActivity", "MSO Update VNF") logDebug('Exited ' + method, isDebugLogEnabled) } - /** - * Builds a "FalloutHandler" 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 falloutHandlerPrep(Execution execution, String resultVar) { - def method = getClass().getSimpleName() + '.falloutHandlerPrep(' + - 'execution=' + execution.getId() + - ', resultVar=' + resultVar + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - try { - def prefix = execution.getVariable('prefix') - def request = getVariable(execution, prefix+'Request') - def requestInformation = execution.getVariable(prefix + "requestInfo") - - appcClient.shutdownclient() - - def WorkflowException workflowException = execution.getVariable("WorkflowException") - def errorResponseCode = workflowException.getErrorCode() - def errorResponseMsg = workflowException.getErrorMessage() - def encErrorResponseMsg = "" - if (errorResponseMsg != null) { - encErrorResponseMsg = errorResponseMsg.replace("&", "&").replace("<", "<").replace(">", ">") - } - - String content = """ - - ${requestInformation} - - ${encErrorResponseMsg} - ${errorResponseCode} - - - """ - content = utils.formatXml(content) - logDebug(resultVar + ' = ' + System.lineSeparator() + content, isDebugLogEnabled) - execution.setVariable(resultVar, content) - - logDebug('Exited ' + method, isDebugLogEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildWorkflowException(execution, 2000, 'Internal Error') - } - } /** * Handle Abort disposition from RainyDayHandler * * @param execution The flow's execution instance. */ - public void abortProcessing(Execution execution) { + public void abortProcessing(DelegateExecution execution) { def method = getClass().getSimpleName() + '.abortProcessing(' + 'execution=' + execution.getId() + ')' def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') logDebug('Entered ' + method, isDebugLogEnabled) - def errorText = execution.getVariable(prefix + "errorText") - def errorCode = execution.getVariable(prefix + "errorCode") + def errorText = execution.getVariable("errorText") + def errorCode = execution.getVariable("errorCode") exceptionUtil.buildAndThrowWorkflowException(execution, errorCode as Integer, errorText) } - /** - * Handle Manual disposition from RainyDayHandler - * - * @param execution The flow's execution instance. - */ - public void manualProcessing(Execution execution) { - def method = getClass().getSimpleName() + '.manualProcessing(' + - 'execution=' + execution.getId() + - ')' - def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') - logDebug('Entered ' + method, isDebugLogEnabled) - - def taskId = execution.getVariable("UPDVnfI_taskId") - - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Processing halted - manual task created: " + taskId) - } + } diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/VnfCmBase.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/VnfCmBase.groovy new file mode 100644 index 0000000000..c588d38946 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/VnfCmBase.groovy @@ -0,0 +1,806 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.infrastructure.scripts + +import groovy.json.JsonOutput +import groovy.json.JsonSlurper +import groovy.util.Node +import groovy.util.XmlParser; +import groovy.xml.QName + +import org.json.JSONArray +import org.json.JSONObject + +import java.beans.MetaData.java_lang_Class_PersistenceDelegate +import java.io.Serializable; +import java.util.List +import java.util.UUID; +import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.impl.cmd.AbstractSetVariableCmd +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.openecomp.mso.rest.APIResponse +import org.openecomp.mso.rest.RESTClient +import org.openecomp.mso.rest.RESTConfig +import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor; +import org.openecomp.mso.bpmn.common.scripts.VidUtils; +import org.openecomp.mso.bpmn.core.RollbackData +import org.openecomp.mso.bpmn.core.WorkflowException +import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil +import org.openecomp.mso.bpmn.core.json.JsonUtils +import org.openecomp.mso.bpmn.core.domain.ModelInfo +import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition +import org.openecomp.mso.bpmn.core.domain.VnfResource +import org.openecomp.mso.client.aai.* + +import org.openecomp.mso.client.appc.ApplicationControllerClient; +import org.openecomp.mso.client.appc.ApplicationControllerSupport; +import org.openecomp.mso.client.aai.entities.AAIResultWrapper +import org.openecomp.mso.client.aai.entities.Relationships +import org.openecomp.mso.client.aai.entities.uri.AAIResourceUri +import org.openecomp.mso.client.aai.entities.uri.AAIUri +import org.openecomp.mso.client.aai.entities.uri.AAIUriFactory +import org.onap.appc.client.lcm.model.Action; +import org.onap.appc.client.lcm.model.ActionIdentifiers; +import org.onap.appc.client.lcm.model.LockInput +import org.onap.appc.client.lcm.model.UnlockInput +import org.onap.appc.client.lcm.model.HealthCheckInput +import org.onap.appc.client.lcm.model.StartInput +import org.onap.appc.client.lcm.model.StopInput +import org.onap.appc.client.lcm.model.Flags +import org.onap.appc.client.lcm.model.Status + + + +public abstract class VnfCmBase extends AbstractServiceTaskProcessor { + + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtils = new JsonUtils() + def prefix = "VnfIPU_" + + /** + * Initialize the flow's variables. + * + * @param execution The flow's execution instance. + */ + + /** + * Prepare and send the sychronous response for this flow. + * + * @param execution The flow's execution instance. + */ + public void sendSynchResponse(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.sendSynchResponse(' + + 'execution=' + execution.getId() + + ')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + logDebug('Entered ' + method, isDebugLogEnabled) + + + try { + def requestInfo = execution.getVariable('requestInfo') + def requestId = execution.getVariable('requestId') + def source = execution.getVariable('source') + def progress = getNodeTextForce(requestInfo, 'progress') + if (progress.isEmpty()) { + progress = '0' + } + def startTime = getNodeTextForce(requestInfo, 'start-time') + if (startTime.isEmpty()) { + startTime = System.currentTimeMillis() + } + + // RESTResponse (for API Handler (APIH) Reply Task) + def vnfId = execution.getVariable("vnfId") + String synchResponse = """{"requestReferences":{"instanceId":"${vnfId}","requestId":"${requestId}"}}""".trim() + + sendWorkflowResponse(execution, 200, synchResponse) + + logDebug('Exited ' + method, isDebugLogEnabled) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + logError('Caught exception in ' + method, e) + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage()) + } + } + + + + /** + * Get VnfResource decomposition object for this VNF. + * + * + * @param execution The flow's execution instance. + */ + public void getVnfResourceDecomposition(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.getVnfResourceDecomposition(' + + 'execution=' + execution.getId() + + ')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + logDebug('Entered ' + method, isDebugLogEnabled) + + try { + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + String vnfModelInvariantUuid = execution.getVariable('vnfModelInvariantUuid') + logDebug("vnfModelInvariantUuid: " + vnfModelInvariantUuid, isDebugLogEnabled) + List vnfResources = serviceDecomposition.getServiceVnfs() + + for (i in 0..vnfResources.size()-1) { + ModelInfo modelInfo = vnfResources[i].getModelInfo() + String modelInvariantUuidFromDecomposition = modelInfo.getModelInvariantUuid() + logDebug("modelInvariantUuidFromDecomposition: " + modelInvariantUuidFromDecomposition, isDebugLogEnabled) + + if (vnfModelInvariantUuid.equals(modelInvariantUuidFromDecomposition)) { + VnfResource vnfResourceDecomposition = vnfResources[i] + execution.setVariable('vnfResourceDecomposition', vnfResourceDecomposition) + def nfRole = vnfResourceDecomposition.getNfRole() + execution.setVariable('nfRole', nfRole) + logDebug("vnfResourceDecomposition: " + vnfResourceDecomposition.toJsonString(), isDebugLogEnabled) + break + } + else { + //exception! + } + + } + + logDebug('Exited ' + method, isDebugLogEnabled) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + logError('Caught exception in ' + method, e) + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in getVnfResourceDecomposition(): ' + e.getMessage()) + } + } + + /** + * Check if this VNF is already in maintenance in A&AI. + * + * + * @param execution The flow's execution instance. + */ + public void checkIfVnfInMaintInAAI(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.checkIfVnfInMaintInAAI(' + + 'execution=' + execution.getId() + + ')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + execution.setVariable('errorCode', "0") + execution.setVariable("workStep", "checkIfVnfInMaintInAAI") + execution.setVariable("failedActivity", "AAI") + logDebug('Entered ' + method, isDebugLogEnabled) + + try { + def transactionLoggingUuid = UUID.randomUUID().toString() + AAIRestClientImpl client = new AAIRestClientImpl() + AAIValidatorImpl aaiValidator = new AAIValidatorImpl() + aaiValidator.setClient(client) + def vnfId = execution.getVariable("vnfId") + boolean isInMaint = aaiValidator.isVNFLocked(vnfId, transactionLoggingUuid) + logDebug("isInMaint result: " + isInMaint, isDebugLogEnabled) + execution.setVariable('isVnfInMaintenance', isInMaint) + + if (isInMaint) { + execution.setVariable("errorCode", "1003") + execution.setVariable("errorText", "VNF is in maintenance in A&AI") + } + + + logDebug('Exited ' + method, isDebugLogEnabled) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + logError('Caught exception in ' + method, e) + execution.setVariable("errorCode", "1002") + execution.setVariable("errorText", e.getMessage()) + //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfVnfInMaintInAAI(): ' + e.getMessage()) + } + } + + /** + * Get VNF info from A&AI. + * + * + * @param execution The flow's execution instance. + */ + public void queryAAIForVnf(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.queryAAIForVnf(' + + 'execution=' + execution.getId() + + ')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + logDebug('Entered ' + method, isDebugLogEnabled) + + try { + def transactionLoggingUuid = UUID.randomUUID().toString() + def vnfId = execution.getVariable("vnfId") + logDebug("vnfId is: " + vnfId, isDebugLogEnabled) + def cloudRegionId = execution.getVariable("lcpCloudRegionId") + logDebug("cloudRegionId is: " + cloudRegionId, isDebugLogEnabled) + + AAIResourcesClient client = new AAIResourcesClient() + + AAIUri genericVnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId) + // Check if this VNF exists + if (!client.exists(genericVnfUri)) { + logDebug("VNF with vnfId " + vnfId + " does not exist in A&AI", isDebugLogEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 404, "VNF with vnfId " + vnfId + " does not exist in A&AI") + } + + AAIResultWrapper aaiRW = client.get(genericVnfUri) + + Map result = aaiRW.asMap() + + String vnfName = result.get("vnf-name") + logDebug("vnfName from A&AI is: " + vnfName, isDebugLogEnabled) + execution.setVariable("vnfName", vnfName) + String nfRole = result.get("nf-role") + logDebug("nfRole from A&AI is: " + nfRole, isDebugLogEnabled) + execution.setVariable("nfRole", nfRole) + String vnfHostIpAddress = result.get("ipv4-oam-address") + logDebug("vnfHostIpAddress from A&AI is: " + vnfHostIpAddress, isDebugLogEnabled) + execution.setVariable("vnfHostIpAddress", vnfHostIpAddress) + execution.setVariable("vmIdList", null) + if (aaiRW.getRelationships() != null) { + Relationships relationships = aaiRW.getRelationships().get() + if (relationships != null) { + + List vserverUris = relationships.getRelatedAAIUris(AAIObjectType.VSERVER) + JSONArray vserverIds = new JSONArray() + + for (AAIResourceUri j in vserverUris) { + + String vserverId = j.getURIKeys().get('vserver-id') + vserverIds.put(vserverId) + } + + JSONObject vmidsArray = new JSONObject() + vmidsArray.put("vmIds", vserverIds.toString()) + + logDebug("vmidsArray is: " + vmidsArray.toString(), isDebugLogEnabled) + + execution.setVariable("vmIdList", vmidsArray.toString()) + } + } + + if (cloudRegionId != null) { + AAIUri cloudRegionUri = AAIUriFactory.createResourceUri(AAIObjectType.DEFAULT_CLOUD_REGION, cloudRegionId) + // Check if this client region exists + if (!client.exists(cloudRegionUri)) { + logDebug("Cloud Region with cloudRegionId " + cloudRegionId + " does not exist in A&AI", isDebugLogEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 404, "Cloud Region with cloudRegionId " + cloudRegionId + " does not exist in A&AI") + } + + AAIResultWrapper aaiRWCloud = client.get(cloudRegionUri) + + Map resultCloud = aaiRWCloud.asMap() + + String aicIdentity = resultCloud.get("identity-url") + logDebug("aicIdentity from A&AI is: " + aicIdentity, isDebugLogEnabled) + execution.setVariable("aicIdentity", aicIdentity) + } + + logDebug('Exited ' + method, isDebugLogEnabled) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + logError('Caught exception in ' + method, e) + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in queryAAIForVnf(): ' + e.getMessage()) + } + } + + + + /** + * Check if this VNF's pservers are locked in A&AI. + * + * + * @param execution The flow's execution instance. + */ + public void checkIfPserversInMaintInAAI(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.checkIfPserversInMaintInAAI(' + + 'execution=' + execution.getId() + + ')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + execution.setVariable('errorCode', "0") + logDebug('Entered ' + method, isDebugLogEnabled) + execution.setVariable("workStep", "checkIfPserversInMaintInAAI") + execution.setVariable("failedActivity", "AAI") + + try { + def transactionLoggingUuid = UUID.randomUUID().toString() + AAIRestClientImpl client = new AAIRestClientImpl() + AAIValidatorImpl aaiValidator = new AAIValidatorImpl() + aaiValidator.setClient(client) + def vnfId = execution.getVariable("vnfId") + boolean areLocked = aaiValidator.isPhysicalServerLocked(vnfId, transactionLoggingUuid) + logDebug("areLocked result: " + areLocked, isDebugLogEnabled) + execution.setVariable('arePserversLocked', areLocked) + + if (areLocked) { + execution.setVariable("errorCode", "1003") + execution.setVariable("errorText", "pServers are locked in A&AI") + } + + logDebug('Exited ' + method, isDebugLogEnabled) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + logError('Caught exception in ' + method, e) + execution.setVariable("errorCode", "1002") + execution.setVariable("errorText", e.getMessage()) + //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfPserversInMaintInAAI(): ' + e.getMessage()) + } + } + + /** + * Set inMaint flag for this VNF to the specified value in A&AI. + * + * + * @param execution The flow's execution instance. + * @param inMaint The boolean value of the flag to set + */ + public void setVnfInMaintFlagInAAI(DelegateExecution execution, boolean inMaint) { + def method = getClass().getSimpleName() + '.setVnfInMaintFlagInAAI(' + + 'execution=' + execution.getId() + + ')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + execution.setVariable('errorCode', "0") + logDebug('Entered ' + method, isDebugLogEnabled) + if (inMaint) { + execution.setVariable("workStep", "setVnfInMaintFlagInAAI") + } + else { + execution.setVariable("workStep", "unsetVnfInMaintFlagInAAI") + } + execution.setVariable("failedActivity", "AAI") + + try { + def transactionLoggingUuid = UUID.randomUUID().toString() + AAIRestClientImpl client = new AAIRestClientImpl() + AAIUpdatorImpl aaiUpdator = new AAIUpdatorImpl() + aaiUpdator.setClient(client) + def vnfId = execution.getVariable("vnfId") + if (inMaint) { + aaiUpdator.updateVnfToLocked(vnfId, transactionLoggingUuid) + execution.setVariable("rollbackSetVnfInMaintenanceFlag", true) + } + else { + aaiUpdator.updateVnfToUnLocked(vnfId, transactionLoggingUuid) + execution.setVariable("rollbackSetVnfInMaintenanceFlag", false) + } + + logDebug('Exited ' + method, isDebugLogEnabled) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + logError('Caught exception in ' + method, e) + execution.setVariable("errorCode", "1002") + execution.setVariable("errorText", e.getMessage()) + //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in setVnfInMaintFlagInAAI(): ' + e.getMessage()) + } + } + + /** + * Check if VF Closed Loop Disabled in A&AI. + * + * + * @param execution The flow's execution instance. + */ + public void checkIfClosedLoopDisabledInAAI(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.checkIfClosedLoopDisabledInAAI(' + + 'execution=' + execution.getId() + + ')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + execution.setVariable('errorCode', "0") + execution.setVariable("workStep", "checkClosedLoopDisabledFlagInAAI") + execution.setVariable("failedActivity", "AAI") + logDebug('Entered ' + method, isDebugLogEnabled) + + try { + def transactionLoggingUuid = UUID.randomUUID().toString() + def vnfId = execution.getVariable("vnfId") + logDebug("vnfId is: " + vnfId, isDebugLogEnabled) + AAIResourcesClient client = new AAIResourcesClient() + AAIUri genericVnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId) + AAIResultWrapper aaiRW = client.get(genericVnfUri) + Map result = aaiRW.asMap() + boolean isClosedLoopDisabled = result.getOrDefault("is-closed-loop-disabled", false) + + logDebug("isClosedLoopDisabled result: " + isClosedLoopDisabled, isDebugLogEnabled) + execution.setVariable('isClosedLoopDisabled', isClosedLoopDisabled) + + if (isClosedLoopDisabled) { + execution.setVariable("errorCode", "1004") + execution.setVariable("errorText", "closedLoop is disabled in A&AI") + } + + logDebug('Exited ' + method, isDebugLogEnabled) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + logError('Caught exception in ' + method, e) + execution.setVariable("errorCode", "1002") + execution.setVariable("errorText", e.getMessage()) + } + } + + /** + * Set VF Closed Loop Disabled Flag in A&AI. + * + * + * @param execution The flow's execution instance. + */ + public void setClosedLoopDisabledInAAI(DelegateExecution execution, boolean setDisabled) { + def method = getClass().getSimpleName() + '.setClosedLoopDisabledInAAI(' + + 'execution=' + execution.getId() + + ')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + execution.setVariable('errorCode', "0") + if (setDisabled) { + execution.setVariable("workStep", "setClosedLoopDisabledFlagInAAI") + execution.setVariable("rollbackSetClosedLoopDisabledFlag", true) + } + else { + execution.setVariable("workStep", "unsetClosedLoopDisabledFlagInAAI") + execution.setVariable("rollbackSetClosedLoopDisabledFlag", false) + } + + execution.setVariable("failedActivity", "AAI") + logDebug('Entered ' + method, isDebugLogEnabled) + + try { + def transactionLoggingUuid = UUID.randomUUID().toString() + def vnfId = execution.getVariable("vnfId") + AAIResourcesClient client = new AAIResourcesClient() + AAIUri genericVnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId) + + Map request = new HashMap<>() + request.put("is-closed-loop-disabled", setDisabled) + client.update(genericVnfUri, request) + logDebug("set isClosedLoop to: " + setDisabled, isDebugLogEnabled) + + logDebug('Exited ' + method, isDebugLogEnabled) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + logError('Caught exception in ' + method, e) + execution.setVariable("errorCode", "1002") + execution.setVariable("errorText", e.getMessage()) + } + } + + + + + /** + * Call APP-C client to execute specified APP-C command for this VNF. + * + * + * @param execution The flow's execution instance. + * @param action The action to take in APP-C. + */ + public void runAppcCommand(DelegateExecution execution, Action action) { + def method = getClass().getSimpleName() + '.runAppcCommand(' + + 'execution=' + execution.getId() + + ')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + execution.setVariable('errorCode', "0") + logDebug('Entered ' + method, isDebugLogEnabled) + + ApplicationControllerClient appcClient = null + + try { + logDebug("Running APP-C action: " + action.toString(), isDebugLogEnabled) + String vnfId = execution.getVariable('vnfId') + String msoRequestId = execution.getVariable('requestId') + execution.setVariable('msoRequestId', msoRequestId) + execution.setVariable("failedActivity", "APP-C") + + appcClient = new ApplicationControllerClient() + ApplicationControllerSupport support = new ApplicationControllerSupport() + appcClient.appCSupport=support + org.springframework.test.util.ReflectionTestUtils.setField(support, "lcmModelPackage", "org.onap.appc.client.lcm.model"); + Flags flags = new Flags(); + ActionIdentifiers actionIdentifiers = new ActionIdentifiers(); + actionIdentifiers.setVnfId(vnfId); + Status appcStatus + switch(action) { + case Action.Lock: + execution.setVariable('workStep', "LockVNF") + appcStatus = appcClient.runCommand(Action.Lock,actionIdentifiers,null,msoRequestId) + break + case Action.Unlock: + execution.setVariable('workStep', "UnlockVNF") + appcStatus = appcClient.runCommand(Action.Unlock,actionIdentifiers,null,msoRequestId) + break + case Action.HealthCheck: + def healthCheckIndex = execution.getVariable('healthCheckIndex') + execution.setVariable('workStep', "HealthCheckVNF" + healthCheckIndex) + execution.setVariable('healthCheckIndex', healthCheckIndex + 1) + appcStatus = appcClient.runCommand(Action.HealthCheck,actionIdentifiers,null,msoRequestId) + break + case Action.Start: + execution.setVariable('workStep', "StartVNF") + appcStatus = appcClient.runCommand(Action.Start,actionIdentifiers,null,msoRequestId) + break + case Action.Stop: + execution.setVariable('workStep', "StopVNF") + appcStatus = appcClient.runCommand(Action.Stop,actionIdentifiers,null,msoRequestId) + break + default: + break + } + logDebug("Completed AppC request", isDebugLogEnabled) + int appcCode = appcStatus.getCode() + logDebug("AppC status code is: " + appcCode, isDebugLogEnabled) + logDebug("AppC status message is: " + appcStatus.getMessage(), isDebugLogEnabled) + if (support.getCategoryOf(appcStatus) == ApplicationControllerSupport.StatusCategory.ERROR) { + execution.setVariable("errorCode", Integer.toString(appcCode)) + execution.setVariable("errorText", appcStatus.getMessage()) + } + + logDebug('Exited ' + method, isDebugLogEnabled) + } catch (BpmnError e) { + logError('Caught exception in ' + method, e) + execution.setVariable("errorCode", "1002") + execution.setVariable("errorText", e.getMessage()) + + } catch (java.lang.NoSuchMethodError e) { + logError('Caught exception in ' + method, e) + execution.setVariable("errorCode", "1002") + execution.setVariable("errorText", e.getMessage()) + + } catch (Exception e) { + logError('Caught exception in ' + method, e) + execution.setVariable("errorCode", "1002") + execution.setVariable("errorText", e.getMessage()) + + } + } + + /** + * Placeholder for a call to APP-C client to execute specified APP-C command for this VNF. + * + * + * @param execution The flow's execution instance. + * @param action The action to take in APP-C. + */ + public void runAppcCommandPlaceholder(DelegateExecution execution, String action) { + def method = getClass().getSimpleName() + '.runAppcCommandPlaceholder(' + + 'execution=' + execution.getId() + + ')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + execution.setVariable('errorCode', "0") + logDebug('Entered ' + method, isDebugLogEnabled) + execution.setVariable("failedActivity", "APP-C") + execution.setVariable("workStep", action) + } + + + + + + + + /** + * Builds a "CompletionHandler" 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 completionHandlerPrep(DelegateExecution execution, String resultVar) { + def method = getClass().getSimpleName() + '.completionHandlerPrep(' + + 'execution=' + execution.getId() + + ', resultVar=' + resultVar + + ')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + logDebug('Entered ' + method, isDebugLogEnabled) + + try { + + def requestInfo = execution.getVariable('requestInfo') + + String content = """ + + ${requestInfo} + Vnf has been updated successfully. + MSO_ACTIVATE_BPEL + + """ + + content = utils.formatXml(content) + logDebug(resultVar + ' = ' + System.lineSeparator() + content, isDebugLogEnabled) + execution.setVariable(resultVar, content) + + logDebug('Exited ' + method, isDebugLogEnabled) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + logError('Caught exception in ' + method, e) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, 'Internal Error') + } + } + + /** + * Prepare DoUpdateVnfAndModules call. + * + * + * @param execution The flow's execution instance. + */ + public void prepDoUpdateVnfAndModules(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.prepDoUpdateVnfAndModules(' + + 'execution=' + execution.getId() + + ')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + execution.setVariable('errorCode', "0") + logDebug('Entered ' + method, isDebugLogEnabled) + execution.setVariable("workStep", "doUpdateVnfAndModules") + execution.setVariable("failedActivity", "MSO Update VNF") + logDebug('Exited ' + method, isDebugLogEnabled) + + } + + /** + * Builds a "FalloutHandler" 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 falloutHandlerPrep(DelegateExecution execution, String resultVar) { + def method = getClass().getSimpleName() + '.falloutHandlerPrep(' + + 'execution=' + execution.getId() + + ', resultVar=' + resultVar + + ')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + logDebug('Entered ' + method, isDebugLogEnabled) + + try { + def prefix = execution.getVariable('prefix') + def requestInformation = execution.getVariable("requestInfo") + + def WorkflowException workflowException = execution.getVariable("WorkflowException") + def errorResponseCode = workflowException.getErrorCode() + def errorResponseMsg = workflowException.getErrorMessage() + def encErrorResponseMsg = "" + if (errorResponseMsg != null) { + encErrorResponseMsg = errorResponseMsg.replace("&", "&").replace("<", "<").replace(">", ">") + } + + String content = """ + + ${requestInformation} + + ${encErrorResponseMsg} + ${errorResponseCode} + + + """ + content = utils.formatXml(content) + logDebug(resultVar + ' = ' + System.lineSeparator() + content, isDebugLogEnabled) + execution.setVariable(resultVar, content) + + logDebug('Exited ' + method, isDebugLogEnabled) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + logError('Caught exception in ' + method, e) + exceptionUtil.buildWorkflowException(execution, 2000, 'Internal Error') + } + } + + /** + * Handle Abort disposition from RainyDayHandler + * + * @param execution The flow's execution instance. + */ + public void abortProcessing(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.abortProcessing(' + + 'execution=' + execution.getId() + + ')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + logDebug('Entered ' + method, isDebugLogEnabled) + + def errorText = execution.getVariable("errorText") + def errorCode = execution.getVariable("errorCode") + + exceptionUtil.buildAndThrowWorkflowException(execution, errorCode as Integer, errorText) + } + + /** + * Increment Retry Count for Current Work Step + * + * @param execution The flow's execution instance. + */ + public void incrementRetryCount(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.incrementRetryCount(' + + 'execution=' + execution.getId() + + ')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + logDebug('Entered ' + method, isDebugLogEnabled) + + String retryCountVariableName = execution.getVariable("workStep") + "RetryCount" + execution.setVariable("retryCountVariableName", retryCountVariableName) + + def retryCountVariable = execution.getVariable(retryCountVariableName) + int retryCount = 0 + + if (retryCountVariable != null) { + retryCount = (int) retryCountVariable + } + + retryCount += 1 + + execution.setVariable(retryCountVariableName, retryCount) + + logDebug("value of " + retryCountVariableName + " is " + retryCount, isDebugLogEnabled) + logDebug('Exited ' + method, isDebugLogEnabled) + + + } + + public void preProcessRollback (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG"," ***** preProcessRollback ***** ", isDebugEnabled) + try { + + Object workflowException = execution.getVariable("WorkflowException"); + + if (workflowException instanceof WorkflowException) { + utils.log("DEBUG", "Prev workflowException: " + workflowException.getErrorMessage(), isDebugEnabled) + execution.setVariable("prevWorkflowException", workflowException); + //execution.setVariable("WorkflowException", null); + } + } catch (BpmnError e) { + utils.log("DEBUG", "BPMN Error during preProcessRollback", isDebugEnabled) + } catch(Exception ex) { + String msg = "Exception in preProcessRollback. " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + } + utils.log("DEBUG"," *** Exit preProcessRollback *** ", isDebugEnabled) + } + + public void postProcessRollback (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG"," ***** postProcessRollback ***** ", isDebugEnabled) + String msg = "" + try { + Object workflowException = execution.getVariable("prevWorkflowException"); + if (workflowException instanceof WorkflowException) { + utils.log("DEBUG", "Setting prevException to WorkflowException: ", isDebugEnabled) + execution.setVariable("WorkflowException", workflowException); + } + + } catch (BpmnError b) { + utils.log("DEBUG", "BPMN Error during postProcessRollback", isDebugEnabled) + throw b; + } catch(Exception ex) { + msg = "Exception in postProcessRollback. " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + } + utils.log("DEBUG"," *** Exit postProcessRollback *** ", isDebugEnabled) + } + + + +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/VnfConfigUpdate.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/VnfConfigUpdate.groovy new file mode 100644 index 0000000000..33aaef084c --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/VnfConfigUpdate.groovy @@ -0,0 +1,503 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.infrastructure.scripts + +import groovy.json.JsonOutput +import groovy.json.JsonSlurper +import groovy.util.Node +import groovy.util.XmlParser; +import groovy.xml.QName + +import java.beans.MetaData.java_lang_Class_PersistenceDelegate +import java.io.Serializable; +import java.util.UUID; +import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.impl.cmd.AbstractSetVariableCmd +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.openecomp.mso.rest.APIResponse +import org.openecomp.mso.rest.RESTClient +import org.openecomp.mso.rest.RESTConfig +import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor; +import org.openecomp.mso.bpmn.common.scripts.VidUtils; +import org.openecomp.mso.bpmn.core.RollbackData +import org.openecomp.mso.bpmn.core.WorkflowException +import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil +import org.openecomp.mso.bpmn.core.json.JsonUtils +import org.openecomp.mso.bpmn.core.domain.ModelInfo +import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition +import org.openecomp.mso.bpmn.core.domain.VnfResource +import org.openecomp.mso.client.aai.* + +import org.openecomp.mso.client.appc.ApplicationControllerClient; +import org.openecomp.mso.client.appc.ApplicationControllerSupport; +import org.openecomp.mso.client.aai.AAIResourcesClient +import org.openecomp.mso.client.aai.entities.AAIResultWrapper +import org.openecomp.mso.client.aai.entities.uri.AAIUri +import org.openecomp.mso.client.aai.entities.uri.AAIUriFactory +import org.onap.appc.client.lcm.model.Action; +import org.onap.appc.client.lcm.model.ActionIdentifiers; +import org.onap.appc.client.lcm.model.LockInput +import org.onap.appc.client.lcm.model.UnlockInput +import org.onap.appc.client.lcm.model.HealthCheckInput +import org.onap.appc.client.lcm.model.StartInput +import org.onap.appc.client.lcm.model.StopInput +import org.onap.appc.client.lcm.model.Flags +import org.onap.appc.client.lcm.model.Status + + +public class VnfConfigUpdate extends VnfCmBase { + + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtils = new JsonUtils() + def prefix = "VnfIPU_" + + /** + * Initialize the flow's variables. + * + * @param execution The flow's execution instance. + */ + public void initProcessVariables(DelegateExecution execution) { + execution.setVariable('prefix', 'VnfCU_') + execution.setVariable('Request', null) + execution.setVariable('source', null) + execution.setVariable('UpdateVnfSuccessIndicator', false) + execution.setVariable('serviceType', null) + execution.setVariable('nfRole', null) + execution.setVariable('currentActivity', 'VnfCU') + execution.setVariable('workStep', null) + execution.setVariable('failedActivity', null) + execution.setVariable('errorCode', "0") + execution.setVariable('errorText', null) + execution.setVariable('healthCheckIndex0', 0) + execution.setVariable('healthCheckIndex1', 1) + execution.setVariable('maxRetryCount', 3) + execution.setVariable('retryCount', 0) + execution.setVariable("lcpCloudRegionId", null) + execution.setVariable("rollbackSetClosedLoopDisabledFlag", false) + execution.setVariable("rollbackVnfStop", false) + execution.setVariable("rollbackVnfLock", false) + execution.setVariable("rollbackQuiesceTraffic", false) + execution.setVariable("rollbackSetVnfInMaintenanceFlag", false) + } + + /** + * Check for missing elements in the received request. + * + * @param execution The flow's execution instance. + */ + public void preProcessRequest(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.preProcessRequest(' + + 'execution=' + execution.getId() + + ')' + initProcessVariables(execution) + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + logDebug('Entered ' + method, isDebugLogEnabled) + + initProcessVariables(execution) + + def incomingRequest = execution.getVariable('bpmnRequest') + + utils.log("DEBUG", "Incoming Infra Request: " + incomingRequest, isDebugLogEnabled) + try { + def jsonSlurper = new JsonSlurper() + def jsonOutput = new JsonOutput() + Map reqMap = jsonSlurper.parseText(incomingRequest) + utils.log("DEBUG", " Request is in JSON format.", isDebugLogEnabled) + + def serviceInstanceId = execution.getVariable('serviceInstanceId') + def vnfId = execution.getVariable('vnfId') + + execution.setVariable('serviceInstanceId', serviceInstanceId) + execution.setVariable('vnfId', vnfId) + execution.setVariable('serviceType', 'Mobility') + execution.setVariable('payload', "") + execution.setVariable('actionHealthCheck', Action.HealthCheck) + execution.setVariable('actionConfigModify', Action.ConfigModify) + + def payload = reqMap.requestDetails?.requestParameters?.payload + execution.setVariable('payload', payload) + + utils.log("DEBUG", 'Processed payload: ' + payload, isDebugLogEnabled) + + def requestId = execution.getVariable("mso-request-id") + execution.setVariable('requestId', requestId) + execution.setVariable('msoRequestId', requestId) + + def requestorId = reqMap.requestDetails?.requestInfo?.requestorId ?: null + execution.setVariable('requestorId', requestorId) + + execution.setVariable('sdncVersion', '1702') + + execution.setVariable("UpdateVnfInfraSuccessIndicator", false) + + execution.setVariable("isDebugLogEnabled", isDebugLogEnabled) + + def source = reqMap.requestDetails?.requestInfo?.source + execution.setVariable("source", source) + + //For Completion Handler & Fallout Handler + String requestInfo = + """ + ${requestId} + UPDATE + ${source} + """ + + execution.setVariable("requestInfo", requestInfo) + + logDebug('RequestInfo: ' + execution.getVariable("requestInfo"), isDebugLogEnabled) + + logDebug('Exited ' + method, isDebugLogEnabled) + + } + catch(groovy.json.JsonException je) { + utils.log("DEBUG", " Request is not in JSON format.", isDebugLogEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Invalid request format") + + } + catch(Exception e) { + String restFaultMessage = e.getMessage() + utils.log("ERROR", " Exception Encountered - " + "\n" + restFaultMessage, isDebugLogEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 5000, restFaultMessage) + } + } + + /** + * Prepare and send the sychronous response for this flow. + * + * @param execution The flow's execution instance. + */ + public void sendSynchResponse(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.sendSynchResponse(' + + 'execution=' + execution.getId() + + ')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + logDebug('Entered ' + method, isDebugLogEnabled) + + + try { + def requestInfo = execution.getVariable('requestInfo') + def requestId = execution.getVariable('requestId') + def source = execution.getVariable('source') + def progress = getNodeTextForce(requestInfo, 'progress') + if (progress.isEmpty()) { + progress = '0' + } + def startTime = getNodeTextForce(requestInfo, 'start-time') + if (startTime.isEmpty()) { + startTime = System.currentTimeMillis() + } + + // RESTResponse (for API Handler (APIH) Reply Task) + def vnfId = execution.getVariable("vnfId") + String synchResponse = """{"requestReferences":{"instanceId":"${vnfId}","requestId":"${requestId}"}}""".trim() + + sendWorkflowResponse(execution, 200, synchResponse) + + logDebug('Exited ' + method, isDebugLogEnabled) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + logError('Caught exception in ' + method, e) + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage()) + } + } + + + /** + * Check if this VNF is already in maintenance in A&AI. + * + * + * @param execution The flow's execution instance. + */ + public void checkIfVnfInMaintInAAI(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.checkIfVnfInMaintInAAI(' + + 'execution=' + execution.getId() + + ')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + execution.setVariable('errorCode', "0") + execution.setVariable("workStep", "checkIfVnfInMaintInAAI") + execution.setVariable("failedActivity", "AAI") + logDebug('Entered ' + method, isDebugLogEnabled) + + try { + def transactionLoggingUuid = UUID.randomUUID().toString() + AAIRestClientImpl client = new AAIRestClientImpl() + AAIValidatorImpl aaiValidator = new AAIValidatorImpl() + aaiValidator.setClient(client) + def vnfId = execution.getVariable("vnfId") + boolean isInMaint = aaiValidator.isVNFLocked(vnfId, transactionLoggingUuid) + logDebug("isInMaint result: " + isInMaint, isDebugLogEnabled) + execution.setVariable('isVnfInMaintenance', isInMaint) + + if (isInMaint) { + execution.setVariable("errorCode", "1003") + execution.setVariable("errorText", "VNF is in maintenance in A&AI") + } + + logDebug('Exited ' + method, isDebugLogEnabled) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + logError('Caught exception in ' + method, e) + execution.setVariable("errorCode", "1002") + execution.setVariable("errorText", e.getMessage()) + //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfVnfInMaintInAAI(): ' + e.getMessage()) + } + } + + + /** + * Check if this VNF's pservers are locked in A&AI. + * + * + * @param execution The flow's execution instance. + */ + public void checkIfPserversInMaintInAAI(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.checkIfPserversInMaintInAAI(' + + 'execution=' + execution.getId() + + ')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + execution.setVariable('errorCode', "0") + logDebug('Entered ' + method, isDebugLogEnabled) + execution.setVariable("workStep", "checkIfPserversInMaintInAAI") + execution.setVariable("failedActivity", "AAI") + + try { + def transactionLoggingUuid = UUID.randomUUID().toString() + AAIRestClientImpl client = new AAIRestClientImpl() + AAIValidatorImpl aaiValidator = new AAIValidatorImpl() + aaiValidator.setClient(client) + def vnfId = execution.getVariable("vnfId") + boolean areLocked = aaiValidator.isPhysicalServerLocked(vnfId, transactionLoggingUuid) + logDebug("areLocked result: " + areLocked, isDebugLogEnabled) + execution.setVariable('arePserversLocked', areLocked) + + if (areLocked) { + execution.setVariable("errorCode", "1003") + execution.setVariable("errorText", "pServers are locked in A&AI") + } + + + logDebug('Exited ' + method, isDebugLogEnabled) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + logError('Caught exception in ' + method, e) + execution.setVariable("errorCode", "1002") + execution.setVariable("errorText", e.getMessage()) + //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfPserversInMaintInAAI(): ' + e.getMessage()) + } + } + + /** + * Set inMaint flag for this VNF to the specified value in A&AI. + * + * + * @param execution The flow's execution instance. + * @param inMaint The boolean value of the flag to set + */ + public void setVnfInMaintFlagInAAI(DelegateExecution execution, boolean inMaint) { + def method = getClass().getSimpleName() + '.setVnfInMaintFlagInAAI(' + + 'execution=' + execution.getId() + + ')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + execution.setVariable('errorCode', "0") + logDebug('Entered ' + method, isDebugLogEnabled) + if (inMaint) { + execution.setVariable("workStep", "setVnfInMaintFlagInAAI") + execution.setVariable("rollbackSetVnfInMaintenanceFlag", true) + } + else { + execution.setVariable("workStep", "unsetVnfInMaintFlagInAAI") + } + execution.setVariable("failedActivity", "AAI") + + try { + def transactionLoggingUuid = UUID.randomUUID().toString() + AAIRestClientImpl client = new AAIRestClientImpl() + AAIUpdatorImpl aaiUpdator = new AAIUpdatorImpl() + aaiUpdator.setClient(client) + def vnfId = execution.getVariable("vnfId") + if (inMaint) { + aaiUpdator.updateVnfToLocked(vnfId, transactionLoggingUuid) + execution.setVariable("rollbackSetVnfInMaintenanceFlag", true) + } + else { + aaiUpdator.updateVnfToUnLocked(vnfId, transactionLoggingUuid) + } + + logDebug('Exited ' + method, isDebugLogEnabled) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + logError('Caught exception in ' + method, e) + execution.setVariable("errorCode", "1002") + execution.setVariable("errorText", e.getMessage()) + //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in setVnfInMaintFlagInAAI(): ' + e.getMessage()) + } + } + + /** + * Check if VF Closed Loop Disabled in A&AI. + * + * + * @param execution The flow's execution instance. + */ + public void checkIfClosedLoopDisabledInAAI(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.checkIfClosedLoopDisabledInAAI(' + + 'execution=' + execution.getId() + + ')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + execution.setVariable('errorCode', "0") + execution.setVariable("workStep", "checkClosedLoopDisabledFlagInAAI") + execution.setVariable("failedActivity", "AAI") + logDebug('Entered ' + method, isDebugLogEnabled) + + try { + def transactionLoggingUuid = UUID.randomUUID().toString() + def vnfId = execution.getVariable("vnfId") + logDebug("vnfId is: " + vnfId, isDebugLogEnabled) + AAIResourcesClient client = new AAIResourcesClient() + AAIUri genericVnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId) + AAIResultWrapper aaiRW = client.get(genericVnfUri) + Map result = aaiRW.asMap() + boolean isClosedLoopDisabled = result.getOrDefault("is-closed-loop-disabled", false) + + logDebug("isClosedLoopDisabled result: " + isClosedLoopDisabled, isDebugLogEnabled) + execution.setVariable('isClosedLoopDisabled', isClosedLoopDisabled) + + if (isClosedLoopDisabled) { + execution.setVariable("errorCode", "1004") + execution.setVariable("errorText", "closedLoop is disabled in A&AI") + } + + logDebug('Exited ' + method, isDebugLogEnabled) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + logError('Caught exception in ' + method, e) + execution.setVariable("errorCode", "1002") + execution.setVariable("errorText", e.getMessage()) + //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfVnfInMaintInAAI(): ' + e.getMessage()) + } + } + + /** + * Set VF Closed Loop Disabled Flag in A&AI. + * + * + * @param execution The flow's execution instance. + */ + public void setClosedLoopDisabledInAAI(DelegateExecution execution, boolean setDisabled) { + def method = getClass().getSimpleName() + '.setClosedLoopDisabledInAAI(' + + 'execution=' + execution.getId() + + ')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + execution.setVariable('errorCode', "0") + if (setDisabled) { + execution.setVariable("workStep", "setClosedLoopDisabledFlagInAAI") + execution.setVariable("rollbackSetClosedLoopDisabledFlag", true) + } + else { + execution.setVariable("workStep", "unsetClosedLoopDisabledFlagInAAI") + } + + execution.setVariable("failedActivity", "AAI") + logDebug('Entered ' + method, isDebugLogEnabled) + + try { + def transactionLoggingUuid = UUID.randomUUID().toString() + def vnfId = execution.getVariable("vnfId") + AAIResourcesClient client = new AAIResourcesClient() + AAIUri genericVnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId) + + Map request = new HashMap<>() + request.put("is-closed-loop-disabled", setDisabled) + client.update(genericVnfUri, request) + logDebug("set isClosedLoop to: " + setDisabled, isDebugLogEnabled) + + + logDebug('Exited ' + method, isDebugLogEnabled) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + logError('Caught exception in ' + method, e) + execution.setVariable("errorCode", "1002") + execution.setVariable("errorText", e.getMessage()) + //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfVnfInMaintInAAI(): ' + e.getMessage()) + } + } + + + /** + * Handle Abort disposition from RainyDayHandler + * + * @param execution The flow's execution instance. + */ + public void abortProcessing(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.abortProcessing(' + + 'execution=' + execution.getId() + + ')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + logDebug('Entered ' + method, isDebugLogEnabled) + + def errorText = execution.getVariable("errorText") + def errorCode = execution.getVariable("errorCode") + + exceptionUtil.buildAndThrowWorkflowException(execution, errorCode as Integer, errorText) + } + + /** + * Increment Retry Count for Current Work Step + * + * @param execution The flow's execution instance. + */ + public void incrementRetryCount(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.incrementRetryCount(' + + 'execution=' + execution.getId() + + ')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + logDebug('Entered ' + method, isDebugLogEnabled) + + String retryCountVariableName = execution.getVariable("workStep") + "RetryCount" + execution.setVariable("retryCountVariableName", retryCountVariableName) + + def retryCountVariable = execution.getVariable(retryCountVariableName) + int retryCount = 0 + + if (retryCountVariable != null) { + retryCount = (int) retryCountVariable + } + + retryCount += 1 + + execution.setVariable(retryCountVariableName, retryCount) + + logDebug("value of " + retryCountVariableName + " is " + retryCount, isDebugLogEnabled) + logDebug('Exited ' + method, isDebugLogEnabled) + + + } + + + +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/VnfInPlaceUpdate.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/VnfInPlaceUpdate.groovy new file mode 100644 index 0000000000..2b336afa1e --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/VnfInPlaceUpdate.groovy @@ -0,0 +1,622 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.infrastructure.scripts + +import groovy.json.JsonOutput +import groovy.json.JsonSlurper +import groovy.util.Node +import groovy.util.XmlParser; +import groovy.xml.QName + +import java.beans.MetaData.java_lang_Class_PersistenceDelegate +import java.io.Serializable; +import java.util.UUID; +import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.impl.cmd.AbstractSetVariableCmd +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.openecomp.mso.rest.APIResponse +import org.openecomp.mso.rest.RESTClient +import org.openecomp.mso.rest.RESTConfig +import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor; +import org.openecomp.mso.bpmn.common.scripts.VidUtils; +import org.openecomp.mso.bpmn.core.RollbackData +import org.openecomp.mso.bpmn.core.WorkflowException +import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil +import org.openecomp.mso.bpmn.core.json.JsonUtils +import org.openecomp.mso.bpmn.core.domain.ModelInfo +import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition +import org.openecomp.mso.bpmn.core.domain.VnfResource +import org.openecomp.mso.client.aai.* + +import org.openecomp.mso.client.appc.ApplicationControllerClient; +import org.openecomp.mso.client.appc.ApplicationControllerSupport; +import org.openecomp.mso.client.aai.AAIResourcesClient +import org.openecomp.mso.client.aai.entities.AAIResultWrapper +import org.openecomp.mso.client.aai.entities.uri.AAIUri +import org.openecomp.mso.client.aai.entities.uri.AAIUriFactory +import org.onap.appc.client.lcm.model.Action; +import org.onap.appc.client.lcm.model.ActionIdentifiers; +import org.onap.appc.client.lcm.model.LockInput +import org.onap.appc.client.lcm.model.UnlockInput +import org.onap.appc.client.lcm.model.HealthCheckInput +import org.onap.appc.client.lcm.model.StartInput +import org.onap.appc.client.lcm.model.StopInput +import org.onap.appc.client.lcm.model.Flags +import org.onap.appc.client.lcm.model.Status + + + +public class VnfInPlaceUpdate extends VnfCmBase { + + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtils = new JsonUtils() + def prefix = "VnfIPU_" + + /** + * Initialize the flow's variables. + * + * @param execution The flow's execution instance. + */ + public void initProcessVariables(DelegateExecution execution) { + execution.setVariable('prefix', 'VnfIPU_') + execution.setVariable('Request', null) + execution.setVariable('requestInfo', null) + execution.setVariable('source', null) + execution.setVariable('vnfInputs', null) + execution.setVariable('tenantId', null) + execution.setVariable('vnfParams', null) + execution.setVariable('UpdateVnfSuccessIndicator', false) + execution.setVariable('serviceType', null) + execution.setVariable('nfRole', null) + execution.setVariable('currentActivity', 'VnfIPU') + execution.setVariable('workStep', null) + execution.setVariable('failedActivity', null) + execution.setVariable('errorCode', "0") + execution.setVariable('errorText', null) + execution.setVariable('healthCheckIndex0', 0) + execution.setVariable('healthCheckIndex1', 1) + execution.setVariable('maxRetryCount', 3) + execution.setVariable("rollbackSetClosedLoopDisabledFlag", false) + execution.setVariable("rollbackVnfStop", false) + execution.setVariable("rollbackVnfLock", false) + execution.setVariable("rollbackQuiesceTraffic", false) + execution.setVariable("rollbackSetVnfInMaintenanceFlag", false) + } + + /** + * Check for missing elements in the received request. + * + * @param execution The flow's execution instance. + */ + public void preProcessRequest(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.preProcessRequest(' + + 'execution=' + execution.getId() + + ')' + initProcessVariables(execution) + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + logDebug('Entered ' + method, isDebugLogEnabled) + + initProcessVariables(execution) + + def incomingRequest = execution.getVariable('bpmnRequest') + + utils.log("DEBUG", "Incoming Infra Request: " + incomingRequest, isDebugLogEnabled) + try { + def jsonSlurper = new JsonSlurper() + def jsonOutput = new JsonOutput() + Map reqMap = jsonSlurper.parseText(incomingRequest) + utils.log("DEBUG", " Request is in JSON format.", isDebugLogEnabled) + + def serviceInstanceId = execution.getVariable('serviceInstanceId') + def vnfId = execution.getVariable('vnfId') + + execution.setVariable('serviceInstanceId', serviceInstanceId) + execution.setVariable('vnfId', vnfId) + execution.setVariable("isVidRequest", "true") + execution.setVariable('serviceType', 'Mobility') + execution.setVariable('payload', "") + execution.setVariable('actionSnapshot', Action.Snapshot) + execution.setVariable('actionLock', Action.Lock) + execution.setVariable('actionUnlock', Action.Unlock) + execution.setVariable('actionUpgradePreCheck', Action.UpgradePreCheck) + execution.setVariable('actionUpgradePostCheck', Action.UpgradePostCheck) + execution.setVariable('actionQuiesceTraffic', Action.QuiesceTraffic) + execution.setVariable('actionUpgradeBackup', Action.UpgradeBackup) + execution.setVariable('actionUpgradeSoftware', Action.UpgradeSoftware) + execution.setVariable('actionResumeTraffic', Action.ResumeTraffic) + + def payload = reqMap.requestDetails?.requestParameters?.payload + execution.setVariable('payload', payload) + + utils.log("DEBUG", 'Processed payload: ' + payload, isDebugLogEnabled) + + + def requestId = execution.getVariable("mso-request-id") + execution.setVariable('requestId', requestId) + execution.setVariable('msoRequestId', requestId) + + def requestorId = reqMap.requestDetails?.requestInfo?.requestorId ?: null + execution.setVariable('requestorId', requestorId) + + def cloudConfiguration = reqMap.requestDetails?.cloudConfiguration + def lcpCloudRegionId = cloudConfiguration.lcpCloudRegionId + execution.setVariable('lcpCloudRegionId', lcpCloudRegionId) + def tenantId = cloudConfiguration.tenantId + execution.setVariable('tenantId', tenantId) + + execution.setVariable("UpdateVnfInfraSuccessIndicator", false) + + execution.setVariable("isDebugLogEnabled", isDebugLogEnabled) + + def source = reqMap.requestDetails?.requestInfo?.source + execution.setVariable("source", source) + + //For Completion Handler & Fallout Handler + String requestInfo = + """ + ${requestId} + UPDATE + ${source} + """ + + execution.setVariable("requestInfo", requestInfo) + + logDebug('RequestInfo: ' + execution.getVariable("requestInfo"), isDebugLogEnabled) + + logDebug('Exited ' + method, isDebugLogEnabled) + + } + catch(groovy.json.JsonException je) { + utils.log("DEBUG", " Request is not in JSON format.", isDebugLogEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Invalid request format") + + } + catch(Exception e) { + String restFaultMessage = e.getMessage() + utils.log("ERROR", " Exception Encountered - " + "\n" + restFaultMessage, isDebugLogEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 5000, restFaultMessage) + } + } + + /** + * Prepare and send the sychronous response for this flow. + * + * @param execution The flow's execution instance. + */ + public void sendSynchResponse(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.sendSynchResponse(' + + 'execution=' + execution.getId() + + ')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + logDebug('Entered ' + method, isDebugLogEnabled) + + + try { + def requestInfo = execution.getVariable('requestInfo') + def requestId = execution.getVariable('requestId') + def source = execution.getVariable('source') + def progress = getNodeTextForce(requestInfo, 'progress') + if (progress.isEmpty()) { + progress = '0' + } + def startTime = getNodeTextForce(requestInfo, 'start-time') + if (startTime.isEmpty()) { + startTime = System.currentTimeMillis() + } + + // RESTResponse (for API Handler (APIH) Reply Task) + def vnfId = execution.getVariable("vnfId") + String synchResponse = """{"requestReferences":{"instanceId":"${vnfId}","requestId":"${requestId}"}}""".trim() + + sendWorkflowResponse(execution, 200, synchResponse) + + logDebug('Exited ' + method, isDebugLogEnabled) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + logError('Caught exception in ' + method, e) + exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in sendResponse(): ' + e.getMessage()) + } + } + + + /** + * Check if this VNF is already in maintenance in A&AI. + * + * + * @param execution The flow's execution instance. + */ + public void checkIfVnfInMaintInAAI(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.checkIfVnfInMaintInAAI(' + + 'execution=' + execution.getId() + + ')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + execution.setVariable('errorCode', "0") + execution.setVariable("workStep", "checkIfVnfInMaintInAAI") + execution.setVariable("failedActivity", "AAI") + logDebug('Entered ' + method, isDebugLogEnabled) + + try { + def transactionLoggingUuid = UUID.randomUUID().toString() + AAIRestClientImpl client = new AAIRestClientImpl() + AAIValidatorImpl aaiValidator = new AAIValidatorImpl() + aaiValidator.setClient(client) + def vnfId = execution.getVariable("vnfId") + boolean isInMaint = aaiValidator.isVNFLocked(vnfId, transactionLoggingUuid) + logDebug("isInMaint result: " + isInMaint, isDebugLogEnabled) + execution.setVariable('isVnfInMaintenance', isInMaint) + + if (isInMaint) { + execution.setVariable("errorCode", "1003") + execution.setVariable("errorText", "VNF is in maintenance in A&AI") + } + + + logDebug('Exited ' + method, isDebugLogEnabled) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + logError('Caught exception in ' + method, e) + execution.setVariable("errorCode", "1002") + execution.setVariable("errorText", e.getMessage()) + //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfVnfInMaintInAAI(): ' + e.getMessage()) + } + } + + + /** + * Check if this VNF's pservers are locked in A&AI. + * + * + * @param execution The flow's execution instance. + */ + public void checkIfPserversInMaintInAAI(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.checkIfPserversInMaintInAAI(' + + 'execution=' + execution.getId() + + ')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + execution.setVariable('errorCode', "0") + logDebug('Entered ' + method, isDebugLogEnabled) + execution.setVariable("workStep", "checkIfPserversInMaintInAAI") + execution.setVariable("failedActivity", "AAI") + + try { + def transactionLoggingUuid = UUID.randomUUID().toString() + AAIRestClientImpl client = new AAIRestClientImpl() + AAIValidatorImpl aaiValidator = new AAIValidatorImpl() + aaiValidator.setClient(client) + def vnfId = execution.getVariable("vnfId") + boolean areLocked = aaiValidator.isPhysicalServerLocked(vnfId, transactionLoggingUuid) + logDebug("areLocked result: " + areLocked, isDebugLogEnabled) + execution.setVariable('arePserversLocked', areLocked) + + if (areLocked) { + execution.setVariable("errorCode", "1003") + execution.setVariable("errorText", "pServers are locked in A&AI") + } + + logDebug('Exited ' + method, isDebugLogEnabled) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + logError('Caught exception in ' + method, e) + execution.setVariable("errorCode", "1002") + execution.setVariable("errorText", e.getMessage()) + //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in checkIfPserversInMaintInAAI(): ' + e.getMessage()) + } + } + + /** + * Set inMaint flag for this VNF to the specified value in A&AI. + * + * + * @param execution The flow's execution instance. + * @param inMaint The boolean value of the flag to set + */ + public void setVnfInMaintFlagInAAI(DelegateExecution execution, boolean inMaint) { + def method = getClass().getSimpleName() + '.setVnfInMaintFlagInAAI(' + + 'execution=' + execution.getId() + + ')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + execution.setVariable('errorCode', "0") + logDebug('Entered ' + method, isDebugLogEnabled) + if (inMaint) { + execution.setVariable("workStep", "setVnfInMaintFlagInAAI") + } + else { + execution.setVariable("workStep", "unsetVnfInMaintFlagInAAI") + } + execution.setVariable("failedActivity", "AAI") + + try { + def transactionLoggingUuid = UUID.randomUUID().toString() + AAIRestClientImpl client = new AAIRestClientImpl() + AAIUpdatorImpl aaiUpdator = new AAIUpdatorImpl() + aaiUpdator.setClient(client) + def vnfId = execution.getVariable("vnfId") + if (inMaint) { + aaiUpdator.updateVnfToLocked(vnfId, transactionLoggingUuid) + execution.setVariable("rollbackSetVnfInMaintenanceFlag", true) + } + else { + aaiUpdator.updateVnfToUnLocked(vnfId, transactionLoggingUuid) + } + + logDebug('Exited ' + method, isDebugLogEnabled) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + logError('Caught exception in ' + method, e) + execution.setVariable("errorCode", "1002") + execution.setVariable("errorText", e.getMessage()) + //exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in setVnfInMaintFlagInAAI(): ' + e.getMessage()) + } + } + + /** + * Check if VF Closed Loop Disabled in A&AI. + * + * + * @param execution The flow's execution instance. + */ + public void checkIfClosedLoopDisabledInAAI(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.checkIfClosedLoopDisabledInAAI(' + + 'execution=' + execution.getId() + + ')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + execution.setVariable('errorCode', "0") + execution.setVariable("workStep", "checkClosedLoopDisabledFlagInAAI") + execution.setVariable("failedActivity", "AAI") + logDebug('Entered ' + method, isDebugLogEnabled) + + try { + def transactionLoggingUuid = UUID.randomUUID().toString() + def vnfId = execution.getVariable("vnfId") + logDebug("vnfId is: " + vnfId, isDebugLogEnabled) + AAIResourcesClient client = new AAIResourcesClient() + AAIUri genericVnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId) + AAIResultWrapper aaiRW = client.get(genericVnfUri) + Map result = aaiRW.asMap() + boolean isClosedLoopDisabled = result.getOrDefault("is-closed-loop-disabled", false) + + logDebug("isClosedLoopDisabled result: " + isClosedLoopDisabled, isDebugLogEnabled) + execution.setVariable('isClosedLoopDisabled', isClosedLoopDisabled) + + if (isClosedLoopDisabled) { + execution.setVariable("errorCode", "1004") + execution.setVariable("errorText", "closedLoop is disabled in A&AI") + } + + logDebug('Exited ' + method, isDebugLogEnabled) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + logError('Caught exception in ' + method, e) + execution.setVariable("errorCode", "1002") + execution.setVariable("errorText", e.getMessage()) + } + } + + /** + * Set VF Closed Loop Disabled Flag in A&AI. + * + * + * @param execution The flow's execution instance. + */ + public void setClosedLoopDisabledInAAI(DelegateExecution execution, boolean setDisabled) { + def method = getClass().getSimpleName() + '.setClosedLoopDisabledInAAI(' + + 'execution=' + execution.getId() + + ')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + execution.setVariable('errorCode', "0") + if (setDisabled) { + execution.setVariable("workStep", "setClosedLoopDisabledFlagInAAI") + execution.setVariable("rollbackSetClosedLoopDisabledFlag", true) + } + else { + execution.setVariable("workStep", "unsetClosedLoopDisabledFlagInAAI") + } + + execution.setVariable("failedActivity", "AAI") + logDebug('Entered ' + method, isDebugLogEnabled) + + try { + def transactionLoggingUuid = UUID.randomUUID().toString() + def vnfId = execution.getVariable("vnfId") + AAIResourcesClient client = new AAIResourcesClient() + AAIUri genericVnfUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId) + + Map request = new HashMap<>() + request.put("is-closed-loop-disabled", setDisabled) + client.update(genericVnfUri, request) + logDebug("set isClosedLoop to: " + setDisabled, isDebugLogEnabled) + + logDebug('Exited ' + method, isDebugLogEnabled) + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + logError('Caught exception in ' + method, e) + execution.setVariable("errorCode", "1002") + execution.setVariable("errorText", e.getMessage()) + } + } + + + + + /** + * Call APP-C client to execute specified APP-C command for this VNF. + * + * + * @param execution The flow's execution instance. + * @param action The action to take in APP-C. + */ + public void runAppcCommand(DelegateExecution execution, Action action) { + def method = getClass().getSimpleName() + '.runAppcCommand(' + + 'execution=' + execution.getId() + + ')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + execution.setVariable('errorCode', "0") + logDebug('Entered ' + method, isDebugLogEnabled) + + ApplicationControllerClient appcClient = null + + try { + logDebug("Running APP-C action: " + action.toString(), isDebugLogEnabled) + String vnfId = execution.getVariable('vnfId') + String msoRequestId = execution.getVariable('requestId') + execution.setVariable('msoRequestId', msoRequestId) + execution.setVariable("failedActivity", "APP-C") + + appcClient = new ApplicationControllerClient() + ApplicationControllerSupport support = new ApplicationControllerSupport() + appcClient.appCSupport=support + org.springframework.test.util.ReflectionTestUtils.setField(support, "lcmModelPackage", "org.onap.appc.client.lcm.model"); + Flags flags = new Flags(); + ActionIdentifiers actionIdentifiers = new ActionIdentifiers(); + actionIdentifiers.setVnfId(vnfId); + Status appcStatus + switch(action) { + case Action.Lock: + execution.setVariable('workStep', "LockVNF") + appcStatus = appcClient.runCommand(Action.Lock,actionIdentifiers,null,msoRequestId) + break + case Action.Unlock: + execution.setVariable('workStep', "UnlockVNF") + appcStatus = appcClient.runCommand(Action.Unlock,actionIdentifiers,null,msoRequestId) + break + case Action.HealthCheck: + def healthCheckIndex = execution.getVariable('healthCheckIndex') + execution.setVariable('workStep', "HealthCheckVNF" + healthCheckIndex) + execution.setVariable('healthCheckIndex', healthCheckIndex + 1) + appcStatus = appcClient.runCommand(Action.HealthCheck,actionIdentifiers,null,msoRequestId) + break + case Action.Start: + execution.setVariable('workStep', "StartVNF") + appcStatus = appcClient.runCommand(Action.Start,actionIdentifiers,null,msoRequestId) + break + case Action.Stop: + execution.setVariable('workStep', "StopVNF") + appcStatus = appcClient.runCommand(Action.Stop,actionIdentifiers,null,msoRequestId) + break + default: + break + } + logDebug("Completed AppC request", isDebugLogEnabled) + int appcCode = appcStatus.getCode() + logDebug("AppC status code is: " + appcCode, isDebugLogEnabled) + logDebug("AppC status message is: " + appcStatus.getMessage(), isDebugLogEnabled) + if (support.getCategoryOf(appcStatus) == ApplicationControllerSupport.StatusCategory.ERROR) { + execution.setVariable("errorCode", Integer.toString(appcCode)) + execution.setVariable("errorText", appcStatus.getMessage()) + } + + logDebug('Exited ' + method, isDebugLogEnabled) + } catch (BpmnError e) { + logError('Caught exception in ' + method, e) + execution.setVariable("errorCode", "1002") + execution.setVariable("errorText", e.getMessage()) + + } catch (java.lang.NoSuchMethodError e) { + logError('Caught exception in ' + method, e) + execution.setVariable("errorCode", "1002") + execution.setVariable("errorText", e.getMessage()) + + } catch (Exception e) { + logError('Caught exception in ' + method, e) + execution.setVariable("errorCode", "1002") + execution.setVariable("errorText", e.getMessage()) + + } + } + + /** + * Placeholder for a call to APP-C client to execute specified APP-C command for this VNF. + * + * + * @param execution The flow's execution instance. + * @param action The action to take in APP-C. + */ + public void runAppcCommandPlaceholder(DelegateExecution execution, String action) { + def method = getClass().getSimpleName() + '.runAppcCommandPlaceholder(' + + 'execution=' + execution.getId() + + ')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + execution.setVariable('errorCode', "0") + logDebug('Entered ' + method, isDebugLogEnabled) + execution.setVariable("failedActivity", "APP-C") + execution.setVariable("workStep", action) + } + + + + /** + * Handle Abort disposition from RainyDayHandler + * + * @param execution The flow's execution instance. + */ + public void abortProcessing(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.abortProcessing(' + + 'execution=' + execution.getId() + + ')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + logDebug('Entered ' + method, isDebugLogEnabled) + + def errorText = execution.getVariable("errorText") + def errorCode = execution.getVariable("errorCode") + + exceptionUtil.buildAndThrowWorkflowException(execution, errorCode as Integer, errorText) + } + + /** + * Increment Retry Count for Current Work Step + * + * @param execution The flow's execution instance. + */ + public void incrementRetryCount(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.incrementRetryCount(' + + 'execution=' + execution.getId() + + ')' + def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled') + logDebug('Entered ' + method, isDebugLogEnabled) + + String retryCountVariableName = execution.getVariable("workStep") + "RetryCount" + execution.setVariable("retryCountVariableName", retryCountVariableName) + + def retryCountVariable = execution.getVariable(retryCountVariableName) + int retryCount = 0 + + if (retryCountVariable != null) { + retryCount = (int) retryCountVariable + } + + retryCount += 1 + + execution.setVariable(retryCountVariableName, retryCount) + + logDebug("value of " + retryCountVariableName + " is " + retryCount, isDebugLogEnabled) + logDebug('Exited ' + method, isDebugLogEnabled) + + + } + + +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy index e1cae802e7..503cdfd034 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy @@ -34,7 +34,7 @@ import org.openecomp.mso.bpmn.core.domain.* import java.util.UUID; import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.runtime.Execution +import org.camunda.bpm.engine.delegate.DelegateExecution import org.json.JSONObject; import org.json.JSONArray; import org.apache.commons.lang3.* @@ -50,786 +50,704 @@ import static org.apache.commons.lang3.StringUtils.* */ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { - private static final String DebugFlag = "isDebugLogEnabled" - - String Prefix="CVRCS_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtil = new JsonUtils() - VidUtils vidUtils = new VidUtils() - CatalogDbUtils catalogDbUtils = new CatalogDbUtils() - - /** - * This method is executed during the preProcessRequest task of the - * CreateServiceInstance.bpmn process. - * @param execution - */ - public InitializeProcessVariables(Execution execution){ - /* Initialize all the process variables in this block */ - - execution.setVariable("createVcpeServiceRequest", "") - execution.setVariable("globalSubscriberId", "") - execution.setVariable("serviceInstanceName", "") - execution.setVariable("msoRequestId", "") - execution.setVariable(Prefix+"VnfsCreatedCount", 0) - execution.setVariable("productFamilyId", "") - execution.setVariable("brgWanMacAddress", "") - execution.setVariable("customerLocation", "") - - //TODO - execution.setVariable("sdncVersion", "1707") - } - - // ************************************************** - // Pre or Prepare Request Section - // ************************************************** - /** - * This method is executed during the preProcessRequest task of the - * CreateServiceInstance.bpmn process. - * @param execution - */ - public void preProcessRequest (Execution execution) { - def isDebugEnabled=execution.getVariable(DebugFlag) - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " ***** Inside preProcessRequest CreateVcpeResCustService Request ***** ", isDebugEnabled) - - try { - // initialize flow variables - InitializeProcessVariables(execution) - - //Config Inputs - String aaiDistDelay = execution.getVariable('URN_mso_workflow_aai_distribution_delay') - if (isBlank(aaiDistDelay)) { - msg = "URN_mso_workflow_aai_distribution_delay is null" - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - execution.setVariable("aaiDistDelay", aaiDistDelay) - utils.log("DEBUG","AAI distribution delay: " + aaiDistDelay, isDebugEnabled) - - // check for incoming json message/input - String createVcpeServiceRequest = execution.getVariable("bpmnRequest") - utils.logAudit(createVcpeServiceRequest) - execution.setVariable("createVcpeServiceRequest", createVcpeServiceRequest); - println 'createVcpeServiceRequest - ' + createVcpeServiceRequest - - // extract requestId - String requestId = execution.getVariable("mso-request-id") - execution.setVariable("msoRequestId", requestId) - - String serviceInstanceId = execution.getVariable("serviceInstanceId") - - if ((serviceInstanceId == null) || (serviceInstanceId.isEmpty())) { - serviceInstanceId = UUID.randomUUID().toString() - utils.log("DEBUG", " Generated new Service Instance: " + serviceInstanceId , isDebugEnabled) - } else { - utils.log("DEBUG", "Using provided Service Instance ID: " + serviceInstanceId , isDebugEnabled) - } - - serviceInstanceId = UriUtils.encode(serviceInstanceId,"UTF-8") - execution.setVariable("serviceInstanceId", serviceInstanceId) - - String requestAction = execution.getVariable("requestAction") - execution.setVariable("requestAction", requestAction) - - setBasicDBAuthHeader(execution, isDebugEnabled) - - String source = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestInfo.source") - if ((source == null) || (source.isEmpty())) { - source = "VID" - } - execution.setVariable("source", source) - - // extract globalSubscriberId - String globalSubscriberId = jsonUtil.getJsonValue(createVcpeServiceRequest, - "requestDetails.subscriberInfo.globalSubscriberId") - - // verify element global-customer-id is sent from JSON input, throw exception if missing - if ((globalSubscriberId == null) || (globalSubscriberId.isEmpty())) { - String dataErrorMessage = " Element 'globalSubscriberId' is missing. " - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - - } else { - execution.setVariable("globalSubscriberId", globalSubscriberId) - execution.setVariable("globalCustomerId", globalSubscriberId) - } - - // extract subscriptionServiceType - String subscriptionServiceType = jsonUtil.getJsonValue(createVcpeServiceRequest, - "requestDetails.requestParameters.subscriptionServiceType") - execution.setVariable("subscriptionServiceType", subscriptionServiceType) - utils.log("DEBUG", "Incoming subscriptionServiceType is: " + subscriptionServiceType, isDebugEnabled) - - String suppressRollback = jsonUtil.getJsonValue(createVcpeServiceRequest, - "requestDetails.requestInfo.suppressRollback") - execution.setVariable("disableRollback", suppressRollback) - utils.log("DEBUG", "Incoming Suppress/Disable Rollback is: " + suppressRollback, isDebugEnabled) - - String productFamilyId = jsonUtil.getJsonValue(createVcpeServiceRequest, - "requestDetails.requestInfo.productFamilyId") - execution.setVariable("productFamilyId", productFamilyId) - utils.log("DEBUG", "Incoming productFamilyId is: " + productFamilyId, isDebugEnabled) - - String subscriberInfo = jsonUtil.getJsonValue(createVcpeServiceRequest, - "requestDetails.subscriberInfo") - execution.setVariable("subscriberInfo", subscriberInfo) - utils.log("DEBUG", "Incoming subscriberInfo is: " + subscriberInfo, isDebugEnabled) - - /* - * Extracting User Parameters from incoming Request and converting into a Map - */ - def jsonSlurper = new JsonSlurper() - def jsonOutput = new JsonOutput() - - Map reqMap = jsonSlurper.parseText(createVcpeServiceRequest) - - - //InputParams - def userParams = reqMap.requestDetails?.requestParameters?.userParams + private static final String DebugFlag = "isDebugLogEnabled" + + String Prefix="CVRCS_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + VidUtils vidUtils = new VidUtils() + CatalogDbUtils catalogDbUtils = new CatalogDbUtils() + + /** + * This method is executed during the preProcessRequest task of the CreateServiceInstance.bpmn process. + * @param execution + */ + public InitializeProcessVariables(DelegateExecution execution){ + /* Initialize all the process variables in this block */ + + execution.setVariable("createVcpeServiceRequest", "") + execution.setVariable("globalSubscriberId", "") + execution.setVariable("serviceInstanceName", "") + execution.setVariable("msoRequestId", "") + execution.setVariable(Prefix+"VnfsCreatedCount", 0) + execution.setVariable("productFamilyId", "") + execution.setVariable("brgWanMacAddress", "") + + //TODO + execution.setVariable("sdncVersion", "1707") + } + + // ************************************************** + // Pre or Prepare Request Section + // ************************************************** + /** + * This method is executed during the preProcessRequest task of the CreateServiceInstance.bpmn process. + * @param execution + */ + public void preProcessRequest (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable(DebugFlag) + execution.setVariable("prefix",Prefix) + + utils.log("DEBUG", " ***** Inside preProcessRequest CreateVcpeResCustService Request ***** ", isDebugEnabled) + + try { + // initialize flow variables + InitializeProcessVariables(execution) + + //Config Inputs + String aaiDistDelay = execution.getVariable('URN_mso_workflow_aai_distribution_delay') + if (isBlank(aaiDistDelay)) { + msg = "URN_mso_workflow_aai_distribution_delay is null" + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + execution.setVariable("aaiDistDelay", aaiDistDelay) + utils.log("DEBUG","AAI distribution delay: " + aaiDistDelay, isDebugEnabled) + + // check for incoming json message/input + String createVcpeServiceRequest = execution.getVariable("bpmnRequest") + utils.logAudit(createVcpeServiceRequest) + execution.setVariable("createVcpeServiceRequest", createVcpeServiceRequest); + println 'createVcpeServiceRequest - ' + createVcpeServiceRequest + + // extract requestId + String requestId = execution.getVariable("mso-request-id") + execution.setVariable("msoRequestId", requestId) + + String serviceInstanceId = execution.getVariable("serviceInstanceId") + + if ((serviceInstanceId == null) || (serviceInstanceId.isEmpty())) { + serviceInstanceId = UUID.randomUUID().toString() + utils.log("DEBUG", " Generated new Service Instance: " + serviceInstanceId , isDebugEnabled) + } else { + utils.log("DEBUG", "Using provided Service Instance ID: " + serviceInstanceId , isDebugEnabled) + } + + serviceInstanceId = UriUtils.encode(serviceInstanceId,"UTF-8") + execution.setVariable("serviceInstanceId", serviceInstanceId) + + String requestAction = execution.getVariable("requestAction") + execution.setVariable("requestAction", requestAction) + + setBasicDBAuthHeader(execution, isDebugEnabled) + + String source = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestInfo.source") + if ((source == null) || (source.isEmpty())) { + source = "VID" + } + execution.setVariable("source", source) + + // extract globalSubscriberId + String globalSubscriberId = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.subscriberInfo.globalSubscriberId") + + // verify element global-customer-id is sent from JSON input, throw exception if missing + if ((globalSubscriberId == null) || (globalSubscriberId.isEmpty())) { + String dataErrorMessage = " Element 'globalSubscriberId' is missing. " + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + + } else { + execution.setVariable("globalSubscriberId", globalSubscriberId) + execution.setVariable("globalCustomerId", globalSubscriberId) + } + + // extract subscriptionServiceType + String subscriptionServiceType = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestParameters.subscriptionServiceType") + execution.setVariable("subscriptionServiceType", subscriptionServiceType) + utils.log("DEBUG", "Incoming subscriptionServiceType is: " + subscriptionServiceType, isDebugEnabled) + + String suppressRollback = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestInfo.suppressRollback") + execution.setVariable("disableRollback", suppressRollback) + utils.log("DEBUG", "Incoming Suppress/Disable Rollback is: " + suppressRollback, isDebugEnabled) + + String productFamilyId = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestInfo.productFamilyId") + execution.setVariable("productFamilyId", productFamilyId) + utils.log("DEBUG", "Incoming productFamilyId is: " + productFamilyId, isDebugEnabled) + + String subscriberInfo = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.subscriberInfo") + execution.setVariable("subscriberInfo", subscriberInfo) + utils.log("DEBUG", "Incoming subscriberInfo is: " + subscriberInfo, isDebugEnabled) + + /* + * Extracting User Parameters from incoming Request and converting into a Map + */ + def jsonSlurper = new JsonSlurper() + def jsonOutput = new JsonOutput() + + Map reqMap = jsonSlurper.parseText(createVcpeServiceRequest) + + //InputParams + def userParams = reqMap.requestDetails?.requestParameters?.userParams - Map inputMap = [:] - - - if (userParams) { - userParams.each { - userParam -> - if("BRG_WAN_MAC_Address".equals(userParam?.name)) { - execution.setVariable("brgWanMacAddress", userParam.value) - inputMap.put("BRG_WAN_MAC_Address", userParam.value) - } - if("Customer_Location".equals(userParam?.name)) { - execution.setVariable("customerLocation", userParam.value) - userParam.value.each { - customerLocParam -> - inputMap.put(customerLocParam.key, customerLocParam.value) - } - } - } - } - - utils.log("DEBUG", "User Input Parameters map: " + userParams.toString(), isDebugEnabled) - execution.setVariable("serviceInputParams", inputMap) - - utils.log("DEBUG", "Incoming brgWanMacAddress is: " + - execution.getVariable('brgWanMacAddress'), isDebugEnabled) - utils.log("DEBUG", "Incoming customerLocation is: " + - execution.getVariable('customerLocation'), isDebugEnabled) - - //For Completion Handler & Fallout Handler - String requestInfo = - """ - ${requestId} - CREATE - ${source} - """ - - execution.setVariable(Prefix+"requestInfo", requestInfo) - - utils.log("DEBUG", - " ***** Completed preProcessRequest CreateVcpeResCustService Request ***** ", isDebugEnabled) - - } catch (BpmnError e) { - throw e; - - } catch (Exception ex){ - String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow." + - " Unexpected from method preProcessRequest() - " + ex.getMessage() - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - } - - public void sendSyncResponse(Execution execution) { - def isDebugEnabled=execution.getVariable(DebugFlag) - - utils.log("DEBUG", " ***** Inside sendSyncResponse of CreateVcpeResCustService ***** ", isDebugEnabled) - - try { - String serviceInstanceId = execution.getVariable("serviceInstanceId") - String requestId = execution.getVariable("mso-request-id") - - // RESTResponse (for API Handler (APIH) Reply Task) - String syncResponse ="""{"requestReferences":{ - "instanceId":"${serviceInstanceId}", - "requestId":"${requestId}" - }}""".trim() - - utils.log("DEBUG", " sendSynchResponse: xmlSyncResponse - " + "\n" + syncResponse, isDebugEnabled) - sendWorkflowResponse(execution, 202, syncResponse) - - } catch (Exception ex) { - String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. " + - "Unexpected from method sendSyncResponse() - " + ex.getMessage() - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - } - - // ******************************* - // - // ******************************* - public void prepareDecomposeService(Execution execution) { - def isDebugEnabled=execution.getVariable(DebugFlag) - - try { - utils.log("DEBUG", - " ***** Inside prepareDecomposeService of CreateVcpeResCustService ***** ", isDebugEnabled) - - String createVcpeServiceRequest = execution.getVariable("createVcpeServiceRequest") - - //serviceModelInfo JSON string will be used as-is for DoCreateServiceInstance BB - String serviceModelInfo = jsonUtil.getJsonValue(createVcpeServiceRequest, - "requestDetails.modelInfo") - execution.setVariable("serviceModelInfo", serviceModelInfo) - - utils.log("DEBUG", - " ***** Completed prepareDecomposeService of CreateVcpeResCustService ***** ", isDebugEnabled) - } catch (Exception ex) { - // try error in method block - String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. " + - "Unexpected Error from method prepareDecomposeService() - " + ex.getMessage() - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - } - - // ******************************* - // - // ******************************* - public void prepareCreateServiceInstance(Execution execution) { - def isDebugEnabled=execution.getVariable(DebugFlag) - - try { - utils.log("DEBUG", - " ***** Inside prepareCreateServiceInstance of CreateVcpeResCustService ***** ", isDebugEnabled) - - /* - * Service modelInfo is created in earlier step. This flow can use it as-is ... or, extract from - * DecompositionObject - * ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") - * ModelInfo modelInfo = serviceDecomposition.getModelInfo() - * - */ - String createVcpeServiceRequest = execution.getVariable("createVcpeServiceRequest") -// String serviceInputParams = jsonUtil.getJsonValue(createVcpeServiceRequest, -// "requestDetails.requestParameters") -// execution.setVariable("serviceInputParams", serviceInputParams) - - - String serviceInstanceName = jsonUtil.getJsonValue(createVcpeServiceRequest, - "requestDetails.requestInfo.instanceName") - execution.setVariable("serviceInstanceName", serviceInstanceName) - - ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") - execution.setVariable("serviceDecompositionString", serviceDecomposition.toJsonStringNoRootName()) - - utils.log("DEBUG", - " ***** Completed prepareCreateServiceInstance of CreateVcpeResCustService ***** ", isDebugEnabled) - } catch (Exception ex) { - // try error in method block - String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. " + - "Unexpected Error from method prepareCreateServiceInstance() - " + ex.getMessage() - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - } - - public void postProcessServiceInstanceCreate (Execution execution){ - def method = getClass().getSimpleName() + '.postProcessServiceInstanceCreate(' + - 'execution=' + execution.getId() +')' - def isDebugLogEnabled = execution.getVariable(DebugFlag) - logDebug('Entered ' + method, isDebugLogEnabled) - - String requestId = execution.getVariable("mso-request-id") - String serviceInstanceId = execution.getVariable("serviceInstanceId") - String serviceInstanceName = execution.getVariable("serviceInstanceName") - - try { - - String payload = """ - - - - - ${requestId} - BPEL - ${serviceInstanceId} - ${serviceInstanceName} - - - - """ - execution.setVariable(Prefix+"setUpdateDbInstancePayload", payload) - utils.logAudit(Prefix+"setUpdateDbInstancePayload: " + payload) - 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) - } - } - - - public void processDecomposition (Execution execution) { - def isDebugEnabled=execution.getVariable(DebugFlag) - - utils.log("DEBUG", " ***** Inside processDecomposition() of CreateVcpeResCustService ***** ", isDebugEnabled) - - try { - - ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") - - // VNFs - List vnfList = serviceDecomposition.getServiceVnfs() - filterVnfs(vnfList) - serviceDecomposition.setServiceVnfs(vnfList) - - execution.setVariable("vnfList", vnfList) - execution.setVariable("vnfListString", vnfList.toString()) - - String vnfModelInfoString = "" - if (vnfList != null && vnfList.size() > 0) { - execution.setVariable(Prefix+"VNFsCount", vnfList.size()) - utils.log("DEBUG", "vnfs to create: "+ vnfList.size(), isDebugEnabled) - ModelInfo vnfModelInfo = vnfList[0].getModelInfo() - - vnfModelInfoString = vnfModelInfo.toString() - String vnfModelInfoWithRoot = vnfModelInfo.toString() - vnfModelInfoString = jsonUtil.getJsonValue(vnfModelInfoWithRoot, "modelInfo") - } else { - execution.setVariable(Prefix+"VNFsCount", 0) - utils.log("DEBUG", "no vnfs to create based upon serviceDecomposition content", isDebugEnabled) - } - - execution.setVariable("vnfModelInfo", vnfModelInfoString) - execution.setVariable("vnfModelInfoString", vnfModelInfoString) - utils.log("DEBUG", " vnfModelInfoString :" + vnfModelInfoString, isDebugEnabled) - - utils.log("DEBUG", - " ***** Completed processDecomposition() of CreateVcpeResCustService ***** ", isDebugEnabled) - } catch (Exception ex) { - sendSyncError(execution) - String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. " + - "processDecomposition() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - } - - private void filterVnfs(List vnfList) { - if(vnfList == null) { - return - } - - // remove BRG & TXC from VNF list - - Iterator it = vnfList.iterator() - while(it.hasNext()) { - VnfResource vr = it.next() - - String role = vr.getNfRole() - if(role == "BRG" || role == "TunnelXConn") { - it.remove() - } - } - } - - - public void prepareCreateAllottedResourceTXC(Execution execution) { - def isDebugEnabled=execution.getVariable(DebugFlag) - - try { - utils.log("DEBUG", - " ***** Inside prepareCreateAllottedResourceTXC of CreateVcpeResCustService ***** ", isDebugEnabled) - - /* - * Service modelInfo is created in earlier step. This flow can use it as-is ... or, extract from - * DecompositionObject - * ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") - * ModelInfo modelInfo = serviceDecomposition.getModelInfo() - * - */ - String createVcpeServiceRequest = execution.getVariable("createVcpeServiceRequest") - ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") - - //allottedResourceModelInfo - //allottedResourceRole - //The model Info parameters are a JSON structure as defined in the Service Instantiation API. - //It would be sufficient to only include the service model UUID (i.e. the modelVersionId), since this - //BB will query the full model from the Catalog DB. - List allottedResources = serviceDecomposition.getServiceAllottedResources() - if (allottedResources != null) { - Iterator iter = allottedResources.iterator(); - while (iter.hasNext()){ - AllottedResource allottedResource = (AllottedResource)iter.next(); - - utils.log("DEBUG", " getting model info for AllottedResource # :" + - allottedResource.toJsonStringNoRootName(), isDebugEnabled) - utils.log("DEBUG", " allottedResource.getAllottedResourceType() :" + - allottedResource.getAllottedResourceType(), isDebugEnabled) - if("TunnelXConn".equalsIgnoreCase(allottedResource.getAllottedResourceType())){ - //set create flag to true - execution.setVariable("createTXCAR", true) - ModelInfo allottedResourceModelInfo = allottedResource.getModelInfo() - execution.setVariable("allottedResourceModelInfoTXC", - allottedResourceModelInfo.toJsonStringNoRootName()) - execution.setVariable("allottedResourceRoleTXC", allottedResource.getAllottedResourceRole()) - execution.setVariable("allottedResourceTypeTXC", allottedResource.getAllottedResourceType()) - //After decomposition and homing BBs, there should be an allotted resource object in the - // decomposition that represents the TXC, - //and in its homingSolution section should be found the infraServiceInstanceId - // (i.e. infraServiceInstanceId in TXC Allotted Resource structure) (which the Homing - // BB would have populated). - execution.setVariable("parentServiceInstanceIdTXC", - allottedResource.getHomingSolution().getServiceInstanceId()) - } - } - } - - //unit test only - String allottedResourceId = execution.getVariable("allottedResourceId") - execution.setVariable("allottedResourceIdTXC", allottedResourceId) - utils.log("DEBUG", - "setting allottedResourceId CreateVcpeResCustService "+ allottedResourceId, isDebugEnabled) - - utils.log("DEBUG", - " ***** Completed prepareCreateAllottedResourceTXC of CreateVcpeResCustService ***** ", - isDebugEnabled) - } catch (Exception ex) { - // try error in method block - String exceptionMessage = "Bpmn error encountered in prepareCreateAllottedResourceTXC flow. " + - "Unexpected Error from method prepareCreateServiceInstance() - " + ex.getMessage() - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - } - public void prepareCreateAllottedResourceBRG(Execution execution) { - def isDebugEnabled=execution.getVariable(DebugFlag) - - try { - utils.log("DEBUG", - " ***** Inside prepareCreateAllottedResourceBRG of CreateVcpeResCustService ***** ", isDebugEnabled) - - /* - * Service modelInfo is created in earlier step. This flow can use it as-is ... or, extract from - * DecompositionObject - * ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") - * ModelInfo modelInfo = serviceDecomposition.getModelInfo() - * - */ - String createVcpeServiceRequest = execution.getVariable("createVcpeServiceRequest") - ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") - - //allottedResourceModelInfo - //allottedResourceRole - //The model Info parameters are a JSON structure as defined in the Service Instantiation API. - //It would be sufficient to only include the service model UUID (i.e. the modelVersionId), since this - // BB will query the full model from the Catalog DB. - List allottedResources = serviceDecomposition.getServiceAllottedResources() - if (allottedResources != null) { - Iterator iter = allottedResources.iterator(); - while (iter.hasNext()){ - AllottedResource allottedResource = (AllottedResource)iter.next(); - - utils.log("DEBUG", " getting model info for AllottedResource # :" + - allottedResource.toJsonStringNoRootName(), isDebugEnabled) - utils.log("DEBUG", " allottedResource.getAllottedResourceType() :" + - allottedResource.getAllottedResourceType(), isDebugEnabled) - if("BRG".equalsIgnoreCase(allottedResource.getAllottedResourceType())){ - //set create flag to true - execution.setVariable("createBRGAR", true) - ModelInfo allottedResourceModelInfo = allottedResource.getModelInfo() - execution.setVariable("allottedResourceModelInfoBRG", - allottedResourceModelInfo.toJsonStringNoRootName()) - execution.setVariable("allottedResourceRoleBRG", allottedResource.getAllottedResourceRole()) - execution.setVariable("allottedResourceTypeBRG", allottedResource.getAllottedResourceType()) - //After decomposition and homing BBs, there should be an allotted resource object in the - // decomposition that represents the BRG, - //and in its homingSolution section should be found the infraServiceInstanceId - // (i.e. infraServiceInstanceId in BRG Allotted Resource structure) (which the Homing - // BB would have populated). - execution.setVariable("parentServiceInstanceIdBRG", - allottedResource.getHomingSolution().getServiceInstanceId()) - } - } - } - - //unit test only - String allottedResourceId = execution.getVariable("allottedResourceId") - execution.setVariable("allottedResourceIdBRG", allottedResourceId) - utils.log("DEBUG", - "setting allottedResourceId CreateVcpeResCustService " + allottedResourceId, isDebugEnabled) - - utils.log("DEBUG", - " ***** Completed prepareCreateAllottedResourceBRG of CreateVcpeResCustService ***** ", - isDebugEnabled) - } catch (Exception ex) { - // try error in method block - String exceptionMessage = "Bpmn error encountered in prepareCreateAllottedResourceBRG flow. " + - "Unexpected Error from method prepareCreateServiceInstance() - " + ex.getMessage() - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - } - - - - // ******************************* - // Generate Network request Section - // ******************************* - public void prepareVnfAndModulesCreate (Execution execution) { - def isDebugEnabled=execution.getVariable(DebugFlag) - - try { - utils.log("DEBUG", - " ***** Inside prepareVnfAndModulesCreate of CreateVcpeResCustService ***** ", isDebugEnabled) - - // String disableRollback = execution.getVariable("disableRollback") - // def backoutOnFailure = "" - // if(disableRollback != null){ - // if ( disableRollback == true) { - // backoutOnFailure = "false" - // } else if ( disableRollback == false) { - // backoutOnFailure = "true" - // } - // } - //failIfExists - optional - - String createVcpeServiceRequest = execution.getVariable("createVcpeServiceRequest") - String productFamilyId = jsonUtil.getJsonValue(createVcpeServiceRequest, - "requestDetails.requestInfo.productFamilyId") - execution.setVariable("productFamilyId", productFamilyId) - utils.log("DEBUG","productFamilyId: "+ productFamilyId, isDebugEnabled) - - List vnfList = execution.getVariable("vnfList") - - Integer vnfsCreatedCount = execution.getVariable(Prefix+"VnfsCreatedCount") - String vnfModelInfoString = null; - - if (vnfList != null && vnfList.size() > 0 ) { - utils.log("DEBUG", "getting model info for vnf # " + vnfsCreatedCount, isDebugEnabled) - ModelInfo vnfModelInfo1 = vnfList[0].getModelInfo() - utils.log("DEBUG", "got 0 ", isDebugEnabled) - ModelInfo vnfModelInfo = vnfList[vnfsCreatedCount.intValue()].getModelInfo() - vnfModelInfoString = vnfModelInfo.toString() - } else { - //TODO: vnfList does not contain data. Need to investigate why ... . Fro VCPE use model stored - vnfModelInfoString = execution.getVariable("vnfModelInfo") - } - - utils.log("DEBUG", " vnfModelInfoString :" + vnfModelInfoString, isDebugEnabled) - - // extract cloud configuration - String lcpCloudRegionId = jsonUtil.getJsonValue(createVcpeServiceRequest, - "requestDetails.cloudConfiguration.lcpCloudRegionId") - execution.setVariable("lcpCloudRegionId", lcpCloudRegionId) - utils.log("DEBUG","lcpCloudRegionId: "+ lcpCloudRegionId, isDebugEnabled) - String tenantId = jsonUtil.getJsonValue(createVcpeServiceRequest, - "requestDetails.cloudConfiguration.tenantId") - execution.setVariable("tenantId", tenantId) - utils.log("DEBUG","tenantId: "+ tenantId, isDebugEnabled) - - String sdncVersion = execution.getVariable("sdncVersion") - utils.log("DEBUG","sdncVersion: "+ sdncVersion, isDebugEnabled) - - utils.log("DEBUG", - " ***** Completed prepareVnfAndModulesCreate of CreateVcpeResCustService ***** ", isDebugEnabled) - } catch (Exception ex) { - // try error in method block - String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. " + - "Unexpected Error from method prepareVnfAndModulesCreate() - " + ex.getMessage() - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - } - - // ******************************* - // Validate Vnf request Section -> increment count - // ******************************* - public void validateVnfCreate (Execution execution) { - def isDebugEnabled=execution.getVariable(DebugFlag) - - try { - utils.log("DEBUG", " ***** Inside validateVnfCreate of CreateVcpeResCustService ***** ", isDebugEnabled) - - Integer vnfsCreatedCount = execution.getVariable(Prefix+"VnfsCreatedCount") - vnfsCreatedCount++ - - execution.setVariable(Prefix+"VnfsCreatedCount", vnfsCreatedCount) - - utils.log("DEBUG", - " ***** Completed validateVnfCreate of CreateVcpeResCustService ***** "+" vnf # "+vnfsCreatedCount, isDebugEnabled) - } catch (Exception ex) { - // try error in method block - String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. " + - "Unexpected Error from method validateVnfCreate() - " + ex.getMessage() - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - } - - // ***************************************** - // Prepare Completion request Section - // ***************************************** - public void postProcessResponse (Execution execution) { - def isDebugEnabled=execution.getVariable(DebugFlag) - - utils.log("DEBUG", " ***** Inside postProcessResponse of CreateVcpeResCustService ***** ", isDebugEnabled) - - try { - String source = execution.getVariable("source") - String requestId = execution.getVariable("mso-request-id") - String serviceInstanceId = execution.getVariable("serviceInstanceId") - - String msoCompletionRequest = - """ - - ${requestId} - CREATE - ${source} - - Service Instance has been created successfully via macro orchestration - ${serviceInstanceId} - BPMN macro create - """ - - // Format Response - String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest) - - utils.logAudit(xmlMsoCompletionRequest) - execution.setVariable(Prefix+"Success", true) - execution.setVariable(Prefix+"CompleteMsoProcessRequest", xmlMsoCompletionRequest) - utils.log("DEBUG", " SUCCESS flow, going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest, isDebugEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception ex) { - // try error in method block - String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. " + - "Unexpected Error from method postProcessResponse() - " + ex.getMessage() - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - } - - public void preProcessRollback (Execution execution) { - def isDebugEnabled=execution.getVariable(DebugFlag) - utils.log("DEBUG"," ***** preProcessRollback of CreateVcpeResCustService ***** ", isDebugEnabled) - try { - - Object workflowException = execution.getVariable("WorkflowException"); - - if (workflowException instanceof WorkflowException) { - utils.log("DEBUG", "Prev workflowException: " + workflowException.getErrorMessage(), isDebugEnabled) - execution.setVariable("prevWorkflowException", workflowException); - //execution.setVariable("WorkflowException", null); - } - } catch (BpmnError e) { - utils.log("DEBUG", "BPMN Error during preProcessRollback", isDebugEnabled) - } catch(Exception ex) { - String msg = "Exception in preProcessRollback. " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - } - utils.log("DEBUG"," *** Exit preProcessRollback of CreateVcpeResCustService *** ", isDebugEnabled) - } - - public void postProcessRollback (Execution execution) { - def isDebugEnabled=execution.getVariable(DebugFlag) - utils.log("DEBUG"," ***** postProcessRollback of CreateVcpeResCustService ***** ", isDebugEnabled) - String msg = "" - try { - Object workflowException = execution.getVariable("prevWorkflowException"); - if (workflowException instanceof WorkflowException) { - utils.log("DEBUG", "Setting prevException to WorkflowException: ", isDebugEnabled) - execution.setVariable("WorkflowException", workflowException); - } - } catch (BpmnError b) { - utils.log("DEBUG", "BPMN Error during postProcessRollback", isDebugEnabled) - throw b; - } catch(Exception ex) { - msg = "Exception in postProcessRollback. " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - } - utils.log("DEBUG"," *** Exit postProcessRollback of CreateVcpeResCustService *** ", isDebugEnabled) - } - - public void prepareFalloutRequest(Execution execution){ - def isDebugEnabled=execution.getVariable(DebugFlag) - - utils.log("DEBUG", " *** STARTED CreateVcpeResCustService prepareFalloutRequest Process *** ", isDebugEnabled) - - try { - WorkflowException wfex = execution.getVariable("WorkflowException") - utils.log("DEBUG", " Incoming Workflow Exception: " + wfex.toString(), isDebugEnabled) - String requestInfo = execution.getVariable(Prefix+"requestInfo") - utils.log("DEBUG", " Incoming Request Info: " + requestInfo, isDebugEnabled) - - //TODO. hmmm. there is no way to UPDATE error message. -// String errorMessage = wfex.getErrorMessage() -// boolean successIndicator = execution.getVariable("DCRESI_rolledBack") -// if (successIndicator){ -// errorMessage = errorMessage + ". Rollback successful." -// } else { -// errorMessage = errorMessage + ". Rollback not completed." -// } - - String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo) - - execution.setVariable(Prefix+"falloutRequest", falloutRequest) - - } catch (Exception ex) { - utils.log("DEBUG", - "Error Occured in CreateVcpeResCustService prepareFalloutRequest Process " + ex.getMessage(), - isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, - "Internal Error - Occured in CreateVcpeResCustService prepareFalloutRequest Process") - } - utils.log("DEBUG", - "*** COMPLETED CreateVcpeResCustService prepareFalloutRequest Process ***", isDebugEnabled) - } - - - public void sendSyncError (Execution execution) { - def isDebugEnabled=execution.getVariable(DebugFlag) - execution.setVariable("prefix", Prefix) - - utils.log("DEBUG", " ***** Inside sendSyncError() of CreateVcpeResCustService ***** ", isDebugEnabled) - - try { - String errorMessage = "" - def wfe = execution.getVariable("WorkflowException") - if (wfe instanceof WorkflowException) { - errorMessage = wfe.getErrorMessage() - } else { - errorMessage = "Sending Sync Error." - } - - String buildworkflowException = - """ - ${errorMessage} - 7000 - """ - - utils.logAudit(buildworkflowException) - sendWorkflowResponse(execution, 500, buildworkflowException) - } catch (Exception ex) { - utils.log("DEBUG", " Sending Sync Error Activity Failed. " + "\n" + ex.getMessage(), isDebugEnabled) - } - } - - public void processJavaException(Execution execution){ - def isDebugEnabled=execution.getVariable(DebugFlag) - execution.setVariable("prefix",Prefix) - try{ - utils.log("DEBUG", "Caught a Java Exception", isDebugEnabled) - utils.log("DEBUG", "Started processJavaException Method", isDebugEnabled) - utils.log("DEBUG", "Variables List: " + execution.getVariables(), isDebugEnabled) - // Adding below line temporarily until this flows error handling gets updated - execution.setVariable(Prefix+"unexpectedError", "Caught a Java Lang Exception") - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Caught a Java Lang Exception") - }catch(BpmnError b){ - utils.log("ERROR", "Rethrowing MSOWorkflowException", isDebugEnabled) - throw b - }catch(Exception e){ - utils.log("DEBUG", "Caught Exception during processJavaException Method: " + e, isDebugEnabled) - // Adding below line temporarily until this flows error handling gets updated - execution.setVariable(Prefix+"unexpectedError", "Exception in processJavaException method") - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Exception in processJavaException method") - } - utils.log("DEBUG", "Completed processJavaException Method", isDebugEnabled) - } + Map inputMap = [:] + + + if (userParams) { + userParams.each { + userParam -> + if("BRG_WAN_MAC_Address".equals(userParam?.name)) { + execution.setVariable("brgWanMacAddress", userParam.value) + inputMap.put("BRG_WAN_MAC_Address", userParam.value) + } + } + } + + utils.log("DEBUG", "User Input Parameters map: " + userParams.toString(), isDebugEnabled) + execution.setVariable("serviceInputParams", inputMap) + + utils.log("DEBUG", "Incoming brgWanMacAddress is: " + execution.getVariable('brgWanMacAddress'), isDebugEnabled) + + //For Completion Handler & Fallout Handler + String requestInfo = + """ + ${requestId} + CREATE + ${source} + """ + + execution.setVariable(Prefix+"requestInfo", requestInfo) + + utils.log("DEBUG", " ***** Completed preProcessRequest CreateVcpeResCustService Request ***** ", isDebugEnabled) + + } catch (BpmnError e) { + throw e; + + } catch (Exception ex){ + String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected from method preProcessRequest() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + public void sendSyncResponse(DelegateExecution execution) { + def isDebugEnabled=execution.getVariable(DebugFlag) + + utils.log("DEBUG", " ***** Inside sendSyncResponse of CreateVcpeResCustService ***** ", isDebugEnabled) + + try { + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String requestId = execution.getVariable("mso-request-id") + + // RESTResponse (for API Handler (APIH) Reply Task) + String syncResponse ="""{"requestReferences":{"instanceId":"${serviceInstanceId}","requestId":"${requestId}"}}""".trim() + + utils.log("DEBUG", " sendSynchResponse: xmlSyncResponse - " + "\n" + syncResponse, isDebugEnabled) + sendWorkflowResponse(execution, 202, syncResponse) + + } catch (Exception ex) { + String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected from method sendSyncResponse() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + // ******************************* + // + // ******************************* + public void prepareDecomposeService(DelegateExecution execution) { + def isDebugEnabled=execution.getVariable(DebugFlag) + + try { + utils.log("DEBUG", " ***** Inside prepareDecomposeService of CreateVcpeResCustService ***** ", isDebugEnabled) + + String createVcpeServiceRequest = execution.getVariable("createVcpeServiceRequest") + + //serviceModelInfo JSON string will be used as-is for DoCreateServiceInstance BB + String serviceModelInfo = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.modelInfo") + execution.setVariable("serviceModelInfo", serviceModelInfo) + + utils.log("DEBUG", " ***** Completed prepareDecomposeService of CreateVcpeResCustService ***** ", isDebugEnabled) + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected Error from method prepareDecomposeService() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + // ******************************* + // + // ******************************* + public void prepareCreateServiceInstance(DelegateExecution execution) { + def isDebugEnabled=execution.getVariable(DebugFlag) + + try { + utils.log("DEBUG", " ***** Inside prepareCreateServiceInstance of CreateVcpeResCustService ***** ", isDebugEnabled) + + /* + * Service modelInfo is created in earlier step. This flow can use it as-is ... or, extract from DecompositionObject + * ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + * ModelInfo modelInfo = serviceDecomposition.getModelInfo() + * + */ + String createVcpeServiceRequest = execution.getVariable("createVcpeServiceRequest") +// String serviceInputParams = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestParameters") +// execution.setVariable("serviceInputParams", serviceInputParams) + + + String serviceInstanceName = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestInfo.instanceName") + execution.setVariable("serviceInstanceName", serviceInstanceName) + + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + execution.setVariable("serviceDecompositionString", serviceDecomposition.toJsonStringNoRootName()) + + utils.log("DEBUG", " ***** Completed prepareCreateServiceInstance of CreateVcpeResCustService ***** ", isDebugEnabled) + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected Error from method prepareCreateServiceInstance() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + public void postProcessServiceInstanceCreate (DelegateExecution execution){ + def method = getClass().getSimpleName() + '.postProcessServiceInstanceCreate(' +'execution=' + execution.getId() +')' + def isDebugLogEnabled = execution.getVariable(DebugFlag) + logDebug('Entered ' + method, isDebugLogEnabled) + + String requestId = execution.getVariable("mso-request-id") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String serviceInstanceName = execution.getVariable("serviceInstanceName") + + try { + + String payload = """ + + + + + ${requestId} + BPEL + ${serviceInstanceId} + ${serviceInstanceName} + + + + """ + execution.setVariable(Prefix+"setUpdateDbInstancePayload", payload) + utils.logAudit(Prefix+"setUpdateDbInstancePayload: " + payload) + 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) + } + } + + + public void processDecomposition (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable(DebugFlag) + + utils.log("DEBUG", " ***** Inside processDecomposition() of CreateVcpeResCustService ***** ", isDebugEnabled) + + try { + + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + + // VNFs + List vnfList = serviceDecomposition.getServiceVnfs() + filterVnfs(vnfList) + serviceDecomposition.setServiceVnfs(vnfList) + + execution.setVariable("vnfList", vnfList) + execution.setVariable("vnfListString", vnfList.toString()) + + String vnfModelInfoString = "" + if (vnfList != null && vnfList.size() > 0) { + execution.setVariable(Prefix+"VNFsCount", vnfList.size()) + utils.log("DEBUG", "vnfs to create: "+ vnfList.size(), isDebugEnabled) + ModelInfo vnfModelInfo = vnfList[0].getModelInfo() + + vnfModelInfoString = vnfModelInfo.toString() + String vnfModelInfoWithRoot = vnfModelInfo.toString() + vnfModelInfoString = jsonUtil.getJsonValue(vnfModelInfoWithRoot, "modelInfo") + } else { + execution.setVariable(Prefix+"VNFsCount", 0) + utils.log("DEBUG", "no vnfs to create based upon serviceDecomposition content", isDebugEnabled) + } + + execution.setVariable("vnfModelInfo", vnfModelInfoString) + execution.setVariable("vnfModelInfoString", vnfModelInfoString) + utils.log("DEBUG", " vnfModelInfoString :" + vnfModelInfoString, isDebugEnabled) + + utils.log("DEBUG", " ***** Completed processDecomposition() of CreateVcpeResCustService ***** ", isDebugEnabled) + } catch (Exception ex) { + sendSyncError(execution) + String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. processDecomposition() - " + ex.getMessage() + utils.log("DEBUG", exceptionMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + private void filterVnfs(List vnfList) { + if(vnfList == null) { + return + } + + // remove BRG & TXC from VNF list + + Iterator it = vnfList.iterator() + while(it.hasNext()) { + VnfResource vr = it.next() + + String role = vr.getNfRole() + if(role == "BRG" || role == "TunnelXConn") { + it.remove() + } + } + } + + + public void prepareCreateAllottedResourceTXC(DelegateExecution execution) { + def isDebugEnabled=execution.getVariable(DebugFlag) + + try { + utils.log("DEBUG", " ***** Inside prepareCreateAllottedResourceTXC of CreateVcpeResCustService ***** ", isDebugEnabled) + + /* + * Service modelInfo is created in earlier step. This flow can use it as-is ... or, extract from DecompositionObject + * ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + * ModelInfo modelInfo = serviceDecomposition.getModelInfo() + * + */ + String createVcpeServiceRequest = execution.getVariable("createVcpeServiceRequest") + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + + //allottedResourceModelInfo + //allottedResourceRole + //The model Info parameters are a JSON structure as defined in the Service Instantiation API. + //It would be sufficient to only include the service model UUID (i.e. the modelVersionId), since this BB will query the full model from the Catalog DB. + List allottedResources = serviceDecomposition.getServiceAllottedResources() + if (allottedResources != null) { + Iterator iter = allottedResources.iterator(); + while (iter.hasNext()){ + AllottedResource allottedResource = (AllottedResource)iter.next(); + + utils.log("DEBUG", " getting model info for AllottedResource # :" + allottedResource.toJsonStringNoRootName(), isDebugEnabled) + utils.log("DEBUG", " allottedResource.getAllottedResourceType() :" + allottedResource.getAllottedResourceType(), isDebugEnabled) + if("TunnelXConn".equalsIgnoreCase(allottedResource.getAllottedResourceType())){ + //set create flag to true + execution.setVariable("createTXCAR", true) + ModelInfo allottedResourceModelInfo = allottedResource.getModelInfo() + execution.setVariable("allottedResourceModelInfoTXC", allottedResourceModelInfo.toJsonStringNoRootName()) + execution.setVariable("allottedResourceRoleTXC", allottedResource.getAllottedResourceRole()) + execution.setVariable("allottedResourceTypeTXC", allottedResource.getAllottedResourceType()) + //After decomposition and homing BBs, there should be an allotted resource object in the decomposition that represents the TXC, + //and in its homingSolution section should be found the infraServiceInstanceId (i.e. infraServiceInstanceId in TXC Allotted Resource structure) (which the Homing BB would have populated). + execution.setVariable("parentServiceInstanceIdTXC", allottedResource.getHomingSolution().getServiceInstanceId()) + } + } + } + + //unit test only + String allottedResourceId = execution.getVariable("allottedResourceId") + execution.setVariable("allottedResourceIdTXC", allottedResourceId) + utils.log("DEBUG", "setting allottedResourceId CreateVcpeResCustService "+allottedResourceId, isDebugEnabled) + + utils.log("DEBUG", " ***** Completed prepareCreateAllottedResourceTXC of CreateVcpeResCustService ***** ", isDebugEnabled) + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in prepareCreateAllottedResourceTXC flow. Unexpected Error from method prepareCreateServiceInstance() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + public void prepareCreateAllottedResourceBRG(DelegateExecution execution) { + def isDebugEnabled=execution.getVariable(DebugFlag) + + try { + utils.log("DEBUG", " ***** Inside prepareCreateAllottedResourceBRG of CreateVcpeResCustService ***** ", isDebugEnabled) + + /* + * Service modelInfo is created in earlier step. This flow can use it as-is ... or, extract from DecompositionObject + * ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + * ModelInfo modelInfo = serviceDecomposition.getModelInfo() + * + */ + String createVcpeServiceRequest = execution.getVariable("createVcpeServiceRequest") + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + + //allottedResourceModelInfo + //allottedResourceRole + //The model Info parameters are a JSON structure as defined in the Service Instantiation API. + //It would be sufficient to only include the service model UUID (i.e. the modelVersionId), since this BB will query the full model from the Catalog DB. + List allottedResources = serviceDecomposition.getServiceAllottedResources() + if (allottedResources != null) { + Iterator iter = allottedResources.iterator(); + while (iter.hasNext()){ + AllottedResource allottedResource = (AllottedResource)iter.next(); + + utils.log("DEBUG", " getting model info for AllottedResource # :" + allottedResource.toJsonStringNoRootName(), isDebugEnabled) + utils.log("DEBUG", " allottedResource.getAllottedResourceType() :" + allottedResource.getAllottedResourceType(), isDebugEnabled) + if("BRG".equalsIgnoreCase(allottedResource.getAllottedResourceType())){ + //set create flag to true + execution.setVariable("createBRGAR", true) + ModelInfo allottedResourceModelInfo = allottedResource.getModelInfo() + execution.setVariable("allottedResourceModelInfoBRG", allottedResourceModelInfo.toJsonStringNoRootName()) + execution.setVariable("allottedResourceRoleBRG", allottedResource.getAllottedResourceRole()) + execution.setVariable("allottedResourceTypeBRG", allottedResource.getAllottedResourceType()) + //After decomposition and homing BBs, there should be an allotted resource object in the decomposition that represents the BRG, + //and in its homingSolution section should be found the infraServiceInstanceId (i.e. infraServiceInstanceId in BRG Allotted Resource structure) (which the Homing BB would have populated). + execution.setVariable("parentServiceInstanceIdBRG", allottedResource.getHomingSolution().getServiceInstanceId()) + } + } + } + + //unit test only + String allottedResourceId = execution.getVariable("allottedResourceId") + execution.setVariable("allottedResourceIdBRG", allottedResourceId) + utils.log("DEBUG", "setting allottedResourceId CreateVcpeResCustService "+allottedResourceId, isDebugEnabled) + + utils.log("DEBUG", " ***** Completed prepareCreateAllottedResourceBRG of CreateVcpeResCustService ***** ", isDebugEnabled) + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in prepareCreateAllottedResourceBRG flow. Unexpected Error from method prepareCreateServiceInstance() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + + + // ******************************* + // Generate Network request Section + // ******************************* + public void prepareVnfAndModulesCreate (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable(DebugFlag) + + try { + utils.log("DEBUG", " ***** Inside prepareVnfAndModulesCreate of CreateVcpeResCustService ***** ", isDebugEnabled) + + // String disableRollback = execution.getVariable("disableRollback") + // def backoutOnFailure = "" + // if(disableRollback != null){ + // if ( disableRollback == true) { + // backoutOnFailure = "false" + // } else if ( disableRollback == false) { + // backoutOnFailure = "true" + // } + // } + //failIfExists - optional + + String createVcpeServiceRequest = execution.getVariable("createVcpeServiceRequest") + String productFamilyId = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestInfo.productFamilyId") + execution.setVariable("productFamilyId", productFamilyId) + utils.log("DEBUG","productFamilyId: "+ productFamilyId, isDebugEnabled) + + List vnfList = execution.getVariable("vnfList") + + Integer vnfsCreatedCount = execution.getVariable(Prefix+"VnfsCreatedCount") + String vnfModelInfoString = null; + + if (vnfList != null && vnfList.size() > 0 ) { + utils.log("DEBUG", "getting model info for vnf # " + vnfsCreatedCount, isDebugEnabled) + ModelInfo vnfModelInfo1 = vnfList[0].getModelInfo() + utils.log("DEBUG", "got 0 ", isDebugEnabled) + ModelInfo vnfModelInfo = vnfList[vnfsCreatedCount.intValue()].getModelInfo() + vnfModelInfoString = vnfModelInfo.toString() + } else { + //TODO: vnfList does not contain data. Need to investigate why ... . Fro VCPE use model stored + vnfModelInfoString = execution.getVariable("vnfModelInfo") + } + + utils.log("DEBUG", " vnfModelInfoString :" + vnfModelInfoString, isDebugEnabled) + + // extract cloud configuration + String lcpCloudRegionId = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.cloudConfiguration.lcpCloudRegionId") + execution.setVariable("lcpCloudRegionId", lcpCloudRegionId) + utils.log("DEBUG","lcpCloudRegionId: "+ lcpCloudRegionId, isDebugEnabled) + String tenantId = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.cloudConfiguration.tenantId") + execution.setVariable("tenantId", tenantId) + utils.log("DEBUG","tenantId: "+ tenantId, isDebugEnabled) + + String sdncVersion = execution.getVariable("sdncVersion") + utils.log("DEBUG","sdncVersion: "+ sdncVersion, isDebugEnabled) + + utils.log("DEBUG", " ***** Completed prepareVnfAndModulesCreate of CreateVcpeResCustService ***** ", isDebugEnabled) + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected Error from method prepareVnfAndModulesCreate() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + // ******************************* + // Validate Vnf request Section -> increment count + // ******************************* + public void validateVnfCreate (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable(DebugFlag) + + try { + utils.log("DEBUG", " ***** Inside validateVnfCreate of CreateVcpeResCustService ***** ", isDebugEnabled) + + Integer vnfsCreatedCount = execution.getVariable(Prefix+"VnfsCreatedCount") + vnfsCreatedCount++ + + execution.setVariable(Prefix+"VnfsCreatedCount", vnfsCreatedCount) + + utils.log("DEBUG", " ***** Completed validateVnfCreate of CreateVcpeResCustService ***** "+" vnf # "+vnfsCreatedCount, isDebugEnabled) + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected Error from method validateVnfCreate() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + // ***************************************** + // Prepare Completion request Section + // ***************************************** + public void postProcessResponse (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable(DebugFlag) + + utils.log("DEBUG", " ***** Inside postProcessResponse of CreateVcpeResCustService ***** ", isDebugEnabled) + + try { + String source = execution.getVariable("source") + String requestId = execution.getVariable("mso-request-id") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + + String msoCompletionRequest = + """ + + ${requestId} + CREATE + ${source} + + Service Instance has been created successfully via macro orchestration + ${serviceInstanceId} + BPMN macro create + """ + + // Format Response + String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest) + + utils.logAudit(xmlMsoCompletionRequest) + execution.setVariable(Prefix+"Success", true) + execution.setVariable(Prefix+"CompleteMsoProcessRequest", xmlMsoCompletionRequest) + utils.log("DEBUG", " SUCCESS flow, going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest, isDebugEnabled) + } catch (BpmnError e) { + throw e; + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected Error from method postProcessResponse() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + public void preProcessRollback (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable(DebugFlag) + utils.log("DEBUG"," ***** preProcessRollback of CreateVcpeResCustService ***** ", isDebugEnabled) + try { + + Object workflowException = execution.getVariable("WorkflowException"); + + if (workflowException instanceof WorkflowException) { + utils.log("DEBUG", "Prev workflowException: " + workflowException.getErrorMessage(), isDebugEnabled) + execution.setVariable("prevWorkflowException", workflowException); + //execution.setVariable("WorkflowException", null); + } + } catch (BpmnError e) { + utils.log("DEBUG", "BPMN Error during preProcessRollback", isDebugEnabled) + } catch(Exception ex) { + String msg = "Exception in preProcessRollback. " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + } + utils.log("DEBUG"," *** Exit preProcessRollback of CreateVcpeResCustService *** ", isDebugEnabled) + } + + public void postProcessRollback (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable(DebugFlag) + utils.log("DEBUG"," ***** postProcessRollback of CreateVcpeResCustService ***** ", isDebugEnabled) + String msg = "" + try { + Object workflowException = execution.getVariable("prevWorkflowException"); + if (workflowException instanceof WorkflowException) { + utils.log("DEBUG", "Setting prevException to WorkflowException: ", isDebugEnabled) + execution.setVariable("WorkflowException", workflowException); + } + } catch (BpmnError b) { + utils.log("DEBUG", "BPMN Error during postProcessRollback", isDebugEnabled) + throw b; + } catch(Exception ex) { + msg = "Exception in postProcessRollback. " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + } + utils.log("DEBUG"," *** Exit postProcessRollback of CreateVcpeResCustService *** ", isDebugEnabled) + } + + public void prepareFalloutRequest(DelegateExecution execution){ + def isDebugEnabled=execution.getVariable(DebugFlag) + + utils.log("DEBUG", " *** STARTED CreateVcpeResCustService prepareFalloutRequest Process *** ", isDebugEnabled) + + try { + WorkflowException wfex = execution.getVariable("WorkflowException") + utils.log("DEBUG", " Incoming Workflow Exception: " + wfex.toString(), isDebugEnabled) + String requestInfo = execution.getVariable(Prefix+"requestInfo") + utils.log("DEBUG", " Incoming Request Info: " + requestInfo, isDebugEnabled) + + //TODO. hmmm. there is no way to UPDATE error message. +// String errorMessage = wfex.getErrorMessage() +// boolean successIndicator = execution.getVariable("DCRESI_rolledBack") +// if (successIndicator){ +// errorMessage = errorMessage + ". Rollback successful." +// } else { +// errorMessage = errorMessage + ". Rollback not completed." +// } + + String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo) + + execution.setVariable(Prefix+"falloutRequest", falloutRequest) + + } catch (Exception ex) { + utils.log("DEBUG", "Error Occured in CreateVcpeResCustService prepareFalloutRequest Process " + ex.getMessage(), isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in CreateVcpeResCustService prepareFalloutRequest Process") + } + utils.log("DEBUG", "*** COMPLETED CreateVcpeResCustService prepareFalloutRequest Process ***", isDebugEnabled) + } + + + public void sendSyncError (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable(DebugFlag) + execution.setVariable("prefix", Prefix) + + utils.log("DEBUG", " ***** Inside sendSyncError() of CreateVcpeResCustService ***** ", isDebugEnabled) + + try { + String errorMessage = "" + def wfe = execution.getVariable("WorkflowException") + if (wfe instanceof WorkflowException) { + errorMessage = wfe.getErrorMessage() + } else { + errorMessage = "Sending Sync Error." + } + + String buildworkflowException = + """ + ${errorMessage} + 7000 + """ + + utils.logAudit(buildworkflowException) + sendWorkflowResponse(execution, 500, buildworkflowException) + } catch (Exception ex) { + utils.log("DEBUG", " Sending Sync Error Activity Failed. " + "\n" + ex.getMessage(), isDebugEnabled) + } + } + + public void processJavaException(DelegateExecution execution){ + def isDebugEnabled=execution.getVariable(DebugFlag) + execution.setVariable("prefix",Prefix) + try{ + utils.log("DEBUG", "Caught a Java Exception", isDebugEnabled) + utils.log("DEBUG", "Started processJavaException Method", isDebugEnabled) + utils.log("DEBUG", "Variables List: " + execution.getVariables(), isDebugEnabled) + execution.setVariable(Prefix+"unexpectedError", "Caught a Java Lang Exception") // Adding this line temporarily until this flows error handling gets updated + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Caught a Java Lang Exception") + }catch(BpmnError b){ + utils.log("ERROR", "Rethrowing MSOWorkflowException", isDebugEnabled) + throw b + }catch(Exception e){ + utils.log("DEBUG", "Caught Exception during processJavaException Method: " + e, isDebugEnabled) + execution.setVariable(Prefix+"unexpectedError", "Exception in processJavaException method") // Adding this line temporarily until this flows error handling gets updated + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Exception in processJavaException method") + } + utils.log("DEBUG", "Completed processJavaException Method", isDebugEnabled) + } } diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy index 16fb22a6d3..aa16d3b280 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy @@ -35,7 +35,7 @@ import org.openecomp.mso.bpmn.common.scripts.AaiUtil import java.util.UUID; import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.runtime.Execution +import org.camunda.bpm.engine.delegate.DelegateExecution import org.json.JSONObject; import org.json.JSONArray; import org.apache.commons.lang3.* @@ -64,7 +64,7 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor { * This method is executed during the preProcessRequest task of the DeleteVcpeResCustService.bpmn process. * @param execution */ - public InitializeProcessVariables(Execution execution){ + public InitializeProcessVariables(DelegateExecution execution){ /* Initialize all the process variables in this block */ execution.setVariable("DeleteVcpeResCustServiceRequest", "") @@ -80,7 +80,7 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor { * This method is executed during the preProcessRequest task of the CreateServiceInstance.bpmn process. * @param execution */ - public void preProcessRequest (Execution execution) { + public void preProcessRequest (DelegateExecution execution) { def isDebugEnabled=execution.getVariable(DebugFlag) execution.setVariable("prefix",Prefix) @@ -174,7 +174,7 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor { } } - public void sendSyncResponse(Execution execution) { + public void sendSyncResponse(DelegateExecution execution) { def isDebugEnabled=execution.getVariable(DebugFlag) utils.log("DEBUG", " ***** Inside sendSyncResponse of DeleteVcpeResCustService ***** ", isDebugEnabled) @@ -189,12 +189,12 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor { utils.log("DEBUG", " sendSynchResponse: xmlSyncResponse - " + "\n" + syncResponse, isDebugEnabled) sendWorkflowResponse(execution, 202, syncResponse) } catch (Exception ex) { - String exceptionMessage = "Bpmn error encountered in DeleteVcpeResCustService flow. Unexpected from method preProcessRequest() - " + ex.getMessage() + String exceptionMessage = "Bpmn error encountered in DeleteVcpeResCustService flow. Unexpected from method preProcessRequest() - " + ex.getMessage() exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } } - public void prepareServiceDelete(Execution execution) { + public void prepareServiceDelete(DelegateExecution execution) { def isDebugEnabled=execution.getVariable(DebugFlag) utils.log("DEBUG", " ***** Inside prepareServiceDelete() of DeleteVcpeResCustService ***** ", isDebugEnabled) @@ -281,7 +281,7 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor { } } - private getAaiAr(Execution execution, String relink) { + private getAaiAr(DelegateExecution execution, String relink) { def isDebugEnabled = execution.getVariable(DebugFlag) AaiUtil aaiUtil = new AaiUtil(this) String aaiEndpoint = execution.getVariable("URN_aai_endpoint") + relink @@ -309,7 +309,7 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor { // ******************************* // // ******************************* - public void prepareVnfAndModulesDelete (Execution execution) { + public void prepareVnfAndModulesDelete (DelegateExecution execution) { def isDebugEnabled=execution.getVariable(DebugFlag) utils.log("DEBUG", " ***** Inside prepareVnfAndModulesDelete of DeleteVcpeResCustService ***** ", isDebugEnabled) @@ -336,7 +336,7 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor { // ******************************* // Validate Vnf request Section -> increment count // ******************************* - public void validateVnfDelete (Execution execution) { + public void validateVnfDelete (DelegateExecution execution) { def isDebugEnabled=execution.getVariable(DebugFlag) utils.log("DEBUG", " ***** Inside validateVnfDelete of DeleteVcpeResCustService ***** ", isDebugEnabled) @@ -358,7 +358,7 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor { // ***************************************** // Prepare Completion request Section // ***************************************** - public void postProcessResponse (Execution execution) { + public void postProcessResponse (DelegateExecution execution) { def isDebugEnabled=execution.getVariable(DebugFlag) utils.log("DEBUG", " ***** Inside postProcessResponse of DeleteVcpeResCustService ***** ", isDebugEnabled) @@ -395,7 +395,7 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor { } } - public void prepareFalloutRequest(Execution execution){ + public void prepareFalloutRequest(DelegateExecution execution){ def isDebugEnabled=execution.getVariable(DebugFlag) utils.log("DEBUG", " *** STARTED DeleteVcpeResCustService prepareFalloutRequest Process *** ", isDebugEnabled) @@ -416,7 +416,7 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor { } - public void sendSyncError (Execution execution) { + public void sendSyncError (DelegateExecution execution) { def isDebugEnabled=execution.getVariable(DebugFlag) utils.log("DEBUG", " ***** Inside sendSyncError() of DeleteVcpeResCustService ***** ", isDebugEnabled) @@ -442,7 +442,7 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor { } } - public void processJavaException(Execution execution){ + public void processJavaException(DelegateExecution execution){ def isDebugEnabled=execution.getVariable(DebugFlag) execution.setVariable("prefix",Prefix) try{ diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy index 997757aa2c..7d7c862a0b 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy @@ -28,7 +28,7 @@ import org.openecomp.mso.rest.APIResponse import java.util.UUID; import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.runtime.Execution +import org.camunda.bpm.engine.delegate.DelegateExecution import org.apache.commons.lang3.* import org.springframework.web.util.UriUtils; import static org.apache.commons.lang3.StringUtils.* @@ -72,7 +72,7 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{ ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() - public void preProcessRequest (Execution execution) { + public void preProcessRequest (DelegateExecution execution) { def isDebugEnabled = execution.getVariable(DebugFlag) String msg = "" @@ -152,7 +152,7 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{ utils.log("DEBUG"," ***** Exit preProcessRequest *****", isDebugEnabled) } - public void getAaiAR (Execution execution) { + public void getAaiAR (DelegateExecution execution) { def isDebugEnabled = execution.getVariable(DebugFlag) utils.log("DEBUG"," ***** getAaiAR ***** ", isDebugEnabled) @@ -190,7 +190,7 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{ utils.log("DEBUG"," *****Exit getAaiAR *****", isDebugEnabled) } - public void createAaiAR(Execution execution) { + public void createAaiAR(DelegateExecution execution) { def isDebugEnabled=execution.getVariable(DebugFlag) utils.log("DEBUG"," ***** createAaiAR ***** ", isDebugEnabled) @@ -312,7 +312,7 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{ utils.log("DEBUG"," *** Exit createAaiAR*** ", isDebugEnabled) } - public String buildSDNCRequest(Execution execution, String action, String sdncRequestId) { + public String buildSDNCRequest(DelegateExecution execution, String action, String sdncRequestId) { def isDebugEnabled = execution.getVariable(DebugFlag) String msg = "" @@ -379,7 +379,7 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{ ${subscriptionServiceType} - + ${serviceInstanceId} ${globalCustomerId} @@ -388,13 +388,13 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{ ${allottedResourceId} brg ${parentServiceInstanceId} - + ${modelInvariantId} ${modelUUId} ${modelCustomizationId} ${modelVersion} ${modelName} - + ${brgWanMacAddress} @@ -416,7 +416,7 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{ return sdncReq } - public void preProcessSDNCAssign(Execution execution) { + public void preProcessSDNCAssign(DelegateExecution execution) { def isDebugEnabled = execution.getVariable(DebugFlag) String msg = "" @@ -446,7 +446,7 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{ utils.log("DEBUG"," *****Exit preProcessSDNCAssign *****", isDebugEnabled) } - public void preProcessSDNCCreate(Execution execution) { + public void preProcessSDNCCreate(DelegateExecution execution) { def isDebugEnabled = execution.getVariable(DebugFlag) String msg = "" @@ -476,7 +476,7 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{ utils.log("DEBUG"," *****Exit preProcessSDNCCreate *****", isDebugEnabled) } - public void preProcessSDNCActivate(Execution execution) { + public void preProcessSDNCActivate(DelegateExecution execution) { def isDebugEnabled = execution.getVariable(DebugFlag) String msg = "" @@ -506,7 +506,7 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{ utils.log("DEBUG"," *****Exit preProcessSDNCActivate *****", isDebugEnabled) } - public void validateSDNCResp(Execution execution, String response, String method){ + public void validateSDNCResp(DelegateExecution execution, String response, String method){ def isDebugLogEnabled=execution.getVariable(DebugFlag) utils.log("DEBUG", " *** ValidateSDNCResponse Process*** ", isDebugLogEnabled) @@ -546,7 +546,7 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{ logDebug(" *** Exit ValidateSDNCResp Process*** ", isDebugLogEnabled) } - public void preProcessSDNCGet(Execution execution){ + public void preProcessSDNCGet(DelegateExecution execution){ def isDebugLogEnabled = execution.getVariable(DebugFlag) utils.log("DEBUG", "*** preProcessSDNCGet *** ", isDebugLogEnabled) try{ @@ -575,7 +575,7 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{ String serviceInstanceId = execution.getVariable("serviceInstanceId") String sdncRequestId = UUID.randomUUID().toString() - + //neeed the same url as used by vfmodules String SDNCGetRequest = """ ${subscriptionServiceType} - + ${serviceInstanceId} ${globalCustomerId} @@ -382,13 +382,13 @@ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{ ${allottedResourceId} tunnelxconn ${parentServiceInstanceId} - + ${modelInvariantId} ${modelUUId} ${modelCustomizationId} ${modelVersion} ${modelName} - + ${brgWanMacAddress} @@ -408,7 +408,7 @@ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{ return sdncReq } - public void preProcessSDNCAssign(Execution execution) { + public void preProcessSDNCAssign(DelegateExecution execution) { def isDebugEnabled = execution.getVariable(DebugFlag) String msg = "" @@ -438,7 +438,7 @@ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{ utils.log("DEBUG"," *****Exit preProcessSDNCAssign *****", isDebugEnabled) } - public void preProcessSDNCCreate(Execution execution) { + public void preProcessSDNCCreate(DelegateExecution execution) { def isDebugEnabled = execution.getVariable(DebugFlag) String msg = "" @@ -468,7 +468,7 @@ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{ utils.log("DEBUG"," *****Exit preProcessSDNCCreate *****", isDebugEnabled) } - public void preProcessSDNCActivate(Execution execution) { + public void preProcessSDNCActivate(DelegateExecution execution) { def isDebugEnabled = execution.getVariable(DebugFlag) String msg = "" @@ -498,7 +498,7 @@ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{ utils.log("DEBUG"," *****Exit preProcessSDNCActivate *****", isDebugEnabled) } - public void validateSDNCResp(Execution execution, String response, String method){ + public void validateSDNCResp(DelegateExecution execution, String response, String method){ def isDebugLogEnabled=execution.getVariable(DebugFlag) utils.log("DEBUG", " *** ValidateSDNCResponse Process*** ", isDebugLogEnabled) @@ -538,7 +538,7 @@ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{ logDebug(" *** Exit ValidateSDNCResp Process*** ", isDebugLogEnabled) } - public void preProcessSDNCGet(Execution execution){ + public void preProcessSDNCGet(DelegateExecution execution){ def isDebugLogEnabled = execution.getVariable(DebugFlag) utils.log("DEBUG", "*** preProcessSDNCGet *** ", isDebugLogEnabled) try{ @@ -567,7 +567,7 @@ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{ String serviceInstanceId = execution.getVariable("serviceInstanceId") String sdncRequestId = UUID.randomUUID().toString() - + //neeed the same url as used by vfmodules String SDNCGetRequest = """ ${subscriptionServiceType} - + ${serviceInstanceId} ${globalCustomerId} @@ -209,13 +209,13 @@ public class DoDeleteAllottedResourceBRG extends AbstractServiceTaskProcessor{ ${allottedResourceId} brg ${parentServiceInstanceId} - + ${modelInvariantId} ${modelUUId} ${modelCustomizationId} ${modelVersion} ${modelName} - + @@ -234,7 +234,7 @@ public class DoDeleteAllottedResourceBRG extends AbstractServiceTaskProcessor{ return sdncReq } - public void preProcessSDNCUnassign(Execution execution) { + public void preProcessSDNCUnassign(DelegateExecution execution) { def isDebugEnabled = execution.getVariable(DebugFlag) String msg = "" @@ -255,7 +255,7 @@ public class DoDeleteAllottedResourceBRG extends AbstractServiceTaskProcessor{ utils.log("DEBUG"," *****Exit preProcessSDNCUnassign *****", isDebugEnabled) } - public void preProcessSDNCDelete(Execution execution) { + public void preProcessSDNCDelete(DelegateExecution execution) { def isDebugEnabled = execution.getVariable(DebugFlag) String msg = "" @@ -276,7 +276,7 @@ public class DoDeleteAllottedResourceBRG extends AbstractServiceTaskProcessor{ utils.log("DEBUG"," *****Exit preProcessSDNCDelete *****", isDebugEnabled) } - public void preProcessSDNCDeactivate(Execution execution) { + public void preProcessSDNCDeactivate(DelegateExecution execution) { def isDebugEnabled = execution.getVariable(DebugFlag) String msg = "" @@ -297,7 +297,7 @@ public class DoDeleteAllottedResourceBRG extends AbstractServiceTaskProcessor{ utils.log("DEBUG"," *****Exit preProcessSDNCDeactivate *****", isDebugEnabled) } - public void validateSDNCResp(Execution execution, String response, String method){ + public void validateSDNCResp(DelegateExecution execution, String response, String method){ def isDebugLogEnabled=execution.getVariable(DebugFlag) utils.log("DEBUG", " *** ValidateSDNCResponse Process*** ", isDebugLogEnabled) @@ -348,7 +348,7 @@ public class DoDeleteAllottedResourceBRG extends AbstractServiceTaskProcessor{ logDebug(" *** Exit ValidateSDNCResp Process*** ", isDebugLogEnabled) } - public void deleteAaiAR(Execution execution){ + public void deleteAaiAR(DelegateExecution execution){ def isDebugLogEnabled = execution.getVariable(DebugFlag) try{ utils.log("DEBUG", " *** deleteAaiAR *** ", isDebugLogEnabled) diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXC.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXC.groovy index a5b7c1350d..c1b0eb5fff 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXC.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXC.groovy @@ -30,7 +30,7 @@ import org.openecomp.mso.rest.APIResponse import java.util.UUID; import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.runtime.Execution +import org.camunda.bpm.engine.delegate.DelegateExecution import org.apache.commons.lang3.* import org.springframework.web.util.UriUtils; import static org.apache.commons.lang3.StringUtils.* @@ -65,7 +65,7 @@ public class DoDeleteAllottedResourceTXC extends AbstractServiceTaskProcessor{ String Prefix="DDARTXC_" ExceptionUtil exceptionUtil = new ExceptionUtil() - public void preProcessRequest (Execution execution) { + public void preProcessRequest (DelegateExecution execution) { def isDebugEnabled = execution.getVariable(DebugFlag) String msg = "" @@ -107,7 +107,7 @@ public class DoDeleteAllottedResourceTXC extends AbstractServiceTaskProcessor{ utils.log("DEBUG"," ***** Exit preProcessRequest *****", isDebugEnabled) } - public void getAaiAR (Execution execution) { + public void getAaiAR (DelegateExecution execution) { def isDebugEnabled = execution.getVariable(DebugFlag) utils.log("DEBUG"," ***** getAaiAR ***** ", isDebugEnabled) @@ -137,7 +137,7 @@ public class DoDeleteAllottedResourceTXC extends AbstractServiceTaskProcessor{ } // aaiARPath set during query (existing AR) - public void updateAaiAROrchStatus(Execution execution, String status){ + public void updateAaiAROrchStatus(DelegateExecution execution, String status){ def isDebugEnabled = execution.getVariable(DebugFlag) utils.log("DEBUG", " *** updateAaiAROrchStatus *** ", isDebugEnabled) AllottedResourceUtils arUtils = new AllottedResourceUtils(this) @@ -146,7 +146,7 @@ public class DoDeleteAllottedResourceTXC extends AbstractServiceTaskProcessor{ utils.log("DEBUG", " *** Exit updateAaiAROrchStatus *** ", isDebugEnabled) } - public String buildSDNCRequest(Execution execution, String action, String sdncRequestId) { + public String buildSDNCRequest(DelegateExecution execution, String action, String sdncRequestId) { def isDebugEnabled = execution.getVariable(DebugFlag) String msg = "" @@ -200,7 +200,7 @@ public class DoDeleteAllottedResourceTXC extends AbstractServiceTaskProcessor{ ${subscriptionServiceType} - + ${serviceInstanceId} ${globalCustomerId} @@ -209,13 +209,13 @@ public class DoDeleteAllottedResourceTXC extends AbstractServiceTaskProcessor{ ${allottedResourceId} tunnelxconn ${parentServiceInstanceId} - + ${modelInvariantId} ${modelUUId} ${modelCustomizationId} ${modelVersion} ${modelName} - + @@ -234,7 +234,7 @@ public class DoDeleteAllottedResourceTXC extends AbstractServiceTaskProcessor{ return sdncReq } - public void preProcessSDNCUnassign(Execution execution) { + public void preProcessSDNCUnassign(DelegateExecution execution) { def isDebugEnabled = execution.getVariable(DebugFlag) String msg = "" @@ -255,7 +255,7 @@ public class DoDeleteAllottedResourceTXC extends AbstractServiceTaskProcessor{ utils.log("DEBUG"," *****Exit preProcessSDNCUnassign *****", isDebugEnabled) } - public void preProcessSDNCDelete(Execution execution) { + public void preProcessSDNCDelete(DelegateExecution execution) { def isDebugEnabled = execution.getVariable(DebugFlag) String msg = "" @@ -276,7 +276,7 @@ public class DoDeleteAllottedResourceTXC extends AbstractServiceTaskProcessor{ utils.log("DEBUG"," *****Exit preProcessSDNCDelete *****", isDebugEnabled) } - public void preProcessSDNCDeactivate(Execution execution) { + public void preProcessSDNCDeactivate(DelegateExecution execution) { def isDebugEnabled = execution.getVariable(DebugFlag) String msg = "" @@ -297,7 +297,7 @@ public class DoDeleteAllottedResourceTXC extends AbstractServiceTaskProcessor{ utils.log("DEBUG"," *****Exit preProcessSDNCDeactivate *****", isDebugEnabled) } - public void validateSDNCResp(Execution execution, String response, String method){ + public void validateSDNCResp(DelegateExecution execution, String response, String method){ def isDebugLogEnabled=execution.getVariable(DebugFlag) utils.log("DEBUG", " *** ValidateSDNCResponse Process*** ", isDebugLogEnabled) @@ -348,7 +348,7 @@ public class DoDeleteAllottedResourceTXC extends AbstractServiceTaskProcessor{ logDebug(" *** Exit ValidateSDNCResp Process*** ", isDebugLogEnabled) } - public void deleteAaiAR(Execution execution){ + public void deleteAaiAR(DelegateExecution execution){ def isDebugLogEnabled = execution.getVariable(DebugFlag) try{ utils.log("DEBUG", " *** deleteAaiAR *** ", isDebugLogEnabled) diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/AAITasks/AAICreateOwningEntity.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/AAITasks/AAICreateOwningEntity.java new file mode 100644 index 0000000000..8ba4589ebc --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/AAITasks/AAICreateOwningEntity.java @@ -0,0 +1,50 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.infrastructure.AAITasks; + +import java.util.logging.Logger; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.JavaDelegate; +import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil; +import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition; +import org.openecomp.mso.client.orchestration.AAIOrchestrator; + +public class AAICreateOwningEntity implements JavaDelegate { + private static Logger LOGGER = Logger.getLogger("AAICreateOwningEntity"); + AAIOrchestrator aaiO = new AAIOrchestrator(); + ExceptionUtil exceptionUtil = new ExceptionUtil(); + + public void execute(DelegateExecution execution) throws Exception { + LOGGER.info("**** Started AAICreateOwningEntity ****"); + ServiceDecomposition serviceDecomp = (ServiceDecomposition) execution.getVariable("serviceDecomposition"); + if (serviceDecomp.getServiceInstance() != null && serviceDecomp.getOwningEntity() != null) { + try { + aaiO.createOwningEntityandConnectServiceInstance(serviceDecomp); + } catch (Exception ex) { + String msg = "Exception in AAICreateOwningEntity. " + ex.getMessage(); + LOGGER.info(msg); + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg); + } + } + LOGGER.info("**** Finished AAICreateOwningEntity ****"); + } +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/AAITasks/AAICreateProject.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/AAITasks/AAICreateProject.java new file mode 100644 index 0000000000..fe7006f530 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/AAITasks/AAICreateProject.java @@ -0,0 +1,50 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.infrastructure.AAITasks; + +import java.util.logging.Logger; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.JavaDelegate; +import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil; +import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition; +import org.openecomp.mso.client.orchestration.AAIOrchestrator; + +public class AAICreateProject implements JavaDelegate { + private static Logger LOGGER = Logger.getLogger("AAICreateProject"); + AAIOrchestrator aaiO = new AAIOrchestrator(); + ExceptionUtil exceptionUtil = new ExceptionUtil(); + + public void execute(DelegateExecution execution) throws Exception { + LOGGER.info("**** Started AAICreateProject ****"); + ServiceDecomposition serviceDecomp = (ServiceDecomposition) execution.getVariable("serviceDecomposition"); + if (serviceDecomp.getServiceInstance() != null && serviceDecomp.getProject() != null) { + try { + aaiO.createProjectandConnectServiceInstance(serviceDecomp); + } catch (Exception ex) { + String msg = "Exception in AAICreateProject. " + ex.getMessage(); + LOGGER.info(msg); + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg); + } + } + LOGGER.info("**** Finished AAICreateProject ****"); + } +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/AAITasks/AAICreateServiceInstance.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/AAITasks/AAICreateServiceInstance.java new file mode 100644 index 0000000000..b76675d0fc --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/AAITasks/AAICreateServiceInstance.java @@ -0,0 +1,50 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.infrastructure.AAITasks; + +import java.util.logging.Logger; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.JavaDelegate; +import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil; +import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition; +import org.openecomp.mso.client.orchestration.AAIOrchestrator; + +public class AAICreateServiceInstance implements JavaDelegate { + private static Logger LOGGER = Logger.getLogger("AAICreateServiceInstance"); + AAIOrchestrator aaiO = new AAIOrchestrator(); + ExceptionUtil exceptionUtil = new ExceptionUtil(); + + public void execute(DelegateExecution execution) throws Exception { + LOGGER.info("**** Started AAICreateServiceInstance ****"); + ServiceDecomposition serviceDecomp = (ServiceDecomposition) execution.getVariable("serviceDecomposition"); + execution.setVariable("aaiServiceInstanceRollback", false); + try { + aaiO.createServiceInstance(serviceDecomp); + } catch (Exception ex) { + String msg = "Exception in AAICreateServiceInstance. " + ex.getMessage(); + LOGGER.info(msg); + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg); + } + execution.setVariable("aaiServiceInstanceRollback", true); + LOGGER.info("**** Finished AAICreateServiceInstance ****"); + } +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/DoCreateServiceInstance/RollbackAAIServiceInstance.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/DoCreateServiceInstance/RollbackAAIServiceInstance.java new file mode 100644 index 0000000000..496ad6a1ff --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/DoCreateServiceInstance/RollbackAAIServiceInstance.java @@ -0,0 +1,56 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.infrastructure.DoCreateServiceInstance; + +import java.util.logging.Logger; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.JavaDelegate; +import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil; +import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition; +import org.openecomp.mso.client.orchestration.AAIOrchestrator; + +public class RollbackAAIServiceInstance implements JavaDelegate { + private static Logger LOGGER = Logger.getLogger("RollbackAAIServiceInstance"); + ExceptionUtil exceptionUtil = new ExceptionUtil(); + + public void execute(DelegateExecution execution) throws Exception { + boolean aaiServiceInstanceRollback = (boolean) execution.getVariable("aaiServiceInstanceRollback"); + if (aaiServiceInstanceRollback) { + LOGGER.info("**** Starting RollbackAAIServiceInstance ****"); + try { + ServiceDecomposition serviceDecomp = (ServiceDecomposition) execution.getVariable("ServiceDecomposition"); + AAIOrchestrator aaiO = new AAIOrchestrator(); + aaiO.deleteServiceInstance(serviceDecomp); + } catch (Exception ex) { + String msg = "Error Response from AAI for aaiServiceInstanceRollback"; + execution.setVariable("rollbackError", msg); + LOGGER.info(msg); + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg); + } + LOGGER.info("**** Finished RollbackAAIServiceInstance ****"); + } else { + LOGGER.info("**** Skipping RollbackAAIServiceInstance ****"); + } + } + +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/DoCreateServiceInstance/RollbackError.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/DoCreateServiceInstance/RollbackError.java new file mode 100644 index 0000000000..68ea713963 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/DoCreateServiceInstance/RollbackError.java @@ -0,0 +1,38 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.infrastructure.DoCreateServiceInstance; + +import java.util.logging.Logger; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.JavaDelegate; + +public class RollbackError implements JavaDelegate { + + private static Logger LOGGER = Logger.getLogger("RollbackError"); + + @Override + public void execute(DelegateExecution execution) throws Exception { + LOGGER.info("Caught an Exception in DoCreateServiceInstanceRollbackV3"); + LOGGER.info("Unable to rollback DoCreateServiceInstanceV3"); + } + +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/DoCreateServiceInstance/SetupServiceDecomp.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/DoCreateServiceInstance/SetupServiceDecomp.java new file mode 100644 index 0000000000..4edb4058e8 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/DoCreateServiceInstance/SetupServiceDecomp.java @@ -0,0 +1,112 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.infrastructure.DoCreateServiceInstance; + +import java.util.logging.Logger; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.JavaDelegate; +import org.json.JSONObject; +import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil; +import org.openecomp.mso.bpmn.core.domain.Customer; +import org.openecomp.mso.bpmn.core.domain.ModelInfo; +import org.openecomp.mso.bpmn.core.domain.OwningEntity; +import org.openecomp.mso.bpmn.core.domain.Project; +import org.openecomp.mso.bpmn.core.domain.Request; +import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition; +import org.openecomp.mso.bpmn.core.domain.ServiceInstance; + +public class SetupServiceDecomp implements JavaDelegate { + + ExceptionUtil exceptionUtil = new ExceptionUtil(); + private static Logger LOGGER = Logger.getLogger("SetupServiceDecomp"); + + public void execute(DelegateExecution execution) throws Exception { + LOGGER.info("Starting SetupServiceDecomp"); + try { + String json = (String) execution.getVariable("bpmnRequest"); + JSONObject jsonObj = new JSONObject(json); + JSONObject jsonReq = jsonObj.getJSONObject("requestDetails"); + JSONObject jsonServ = jsonReq.getJSONObject("serviceInstance"); + String serviceInstanceId = jsonServ.getString("serviceInstanceId"); + System.out.println("servInstId: "+serviceInstanceId); + String serviceInstanceName = jsonServ.getString("serviceInstanceName"); + String serviceType = jsonServ.getString("serviceType"); + String serviceRole = jsonServ.getString("serviceRole"); + String modelInvariantUuid = jsonServ.getString("modelInvariantUuid"); + String modelUuid = jsonServ.getString("modelUuid"); + String modelVersion = jsonServ.getString("modelVersion"); + String modelName = jsonServ.getString("modelName"); + String environmentContext = jsonServ.getString("environmentContext"); + String workloadContext = jsonServ.getString("workloadContext"); + JSONObject jsonProject = jsonReq.getJSONObject("project"); + String projectName = jsonProject.getString("projectName"); + JSONObject jsonOwningEntity = jsonReq.getJSONObject("owningEntity"); + String owningEntityId = jsonOwningEntity.getString("owningEntityId"); + String owningEntityName = jsonOwningEntity.getString("owningEntityName"); + JSONObject jsonCustomer = jsonReq.getJSONObject("customer"); + String subscriptionServiceType = jsonCustomer.getString("subscriptionServiceType"); + String globalSubscriberId = jsonCustomer.getString("globalSubscriberId"); + JSONObject jsonRequest = jsonReq.getJSONObject("request"); + String sdncRequestId = jsonRequest.getString("sdncRequestId"); + String callbackURL = jsonRequest.getString("callbackURL"); + String requestId = jsonRequest.getString("requestId"); + String productFamilyId = jsonRequest.getString("productFamilyId"); + ServiceDecomposition serviceDecomp = new ServiceDecomposition("{}"); + serviceDecomp.setCallbackURN(callbackURL); + serviceDecomp.setServiceRole(serviceRole); + ModelInfo modelInfo = new ModelInfo(); + modelInfo.setModelInvariantUuid(modelInvariantUuid); + modelInfo.setModelName(modelName); + modelInfo.setModelVersion(modelVersion); + modelInfo.setModelUuid(modelUuid); + ServiceInstance serviceInstance = new ServiceInstance(); + serviceInstance.setInstanceId(serviceInstanceId); + serviceInstance.setInstanceName(serviceInstanceName); + serviceInstance.setServiceType(serviceType); + serviceInstance.setModelInfo(modelInfo); + serviceInstance.setEnvironmentContext(environmentContext); + serviceInstance.setWorkloadContext(workloadContext); + Project project = new Project(); + project.setProjectName(projectName); + OwningEntity owningEntity = new OwningEntity(); + owningEntity.setOwningEntityId(owningEntityId); + owningEntity.setOwningEntityName(owningEntityName); + Customer customer = new Customer(); + customer.setGlobalSubscriberId(globalSubscriberId); + customer.setSubscriptionServiceType(subscriptionServiceType); + Request request = new Request(); + request.setRequestId(requestId); + request.setSdncRequestId(sdncRequestId); + request.setProductFamilyId(productFamilyId); + serviceDecomp.setCustomer(customer); + serviceDecomp.setServiceInstance(serviceInstance); + serviceDecomp.setRequest(request); + serviceDecomp.setProject(project); + serviceDecomp.setOwningEntity(owningEntity); + execution.setVariable("ServiceDecomposition", serviceDecomp); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "ERROR IN SET UP SERVICE DECOMP"); + } + LOGGER.info("Finished SetupServiceDecomp"); + } + +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/MSOInfrastructureApplication.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/MSOInfrastructureApplication.java index c7420c3a03..a4a7edefe7 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/MSOInfrastructureApplication.java +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/MSOInfrastructureApplication.java @@ -35,7 +35,7 @@ import org.openecomp.mso.logger.MsoLogger; * @since Version 1.0 * */ -@ProcessApplication("MSO Infrastructure Application") +@ProcessApplication(name="MSO Infrastructure Application", deploymentDescriptors={"../processes.xml"}) public class MSOInfrastructureApplication extends ServletProcessApplication { private MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL); diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/SDNCTasks/SDNCCreateServiceInstance.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/SDNCTasks/SDNCCreateServiceInstance.java new file mode 100644 index 0000000000..549ae36612 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/SDNCTasks/SDNCCreateServiceInstance.java @@ -0,0 +1,49 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.infrastructure.SDNCTasks; + +import java.util.logging.Logger; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.JavaDelegate; +import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil; +import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition; +import org.openecomp.mso.client.orchestration.SDNCOrchestrator; + +public class SDNCCreateServiceInstance implements JavaDelegate { + private static Logger LOGGER = Logger.getLogger("SDNCCreateServiceInstance"); + SDNCOrchestrator sdncO = new SDNCOrchestrator(); + ExceptionUtil exceptionUtil = new ExceptionUtil(); + + public void execute(DelegateExecution execution) throws Exception { + LOGGER.info("**** Started SDNCCreateServiceInstance ****"); + ServiceDecomposition serviceDecomp = (ServiceDecomposition) execution.getVariable("serviceDecomposition"); + if (serviceDecomp != null) { + try { + sdncO.createServiceInstance(serviceDecomp); + } catch (Exception ex) { + String msg = "Exception in sdncCreateServiceInstance. " + ex.getMessage(); + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg); + } + } + LOGGER.info("**** Finished SDNCCreateServiceInstance ****"); + } +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/aai/AAICreateResources.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/aai/AAICreateResources.java new file mode 100644 index 0000000000..93ba0ae5a4 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/aai/AAICreateResources.java @@ -0,0 +1,84 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.infrastructure.aai; + +import java.util.HashMap; +import java.util.Map; +import java.util.Optional; + +import org.openecomp.mso.client.aai.AAIObjectType; +import org.openecomp.mso.client.aai.AAIResourcesClient; +import org.openecomp.mso.client.aai.entities.uri.AAIResourceUri; +import org.openecomp.mso.client.aai.entities.uri.AAIUriFactory; + +public class AAICreateResources { + + + public void createAAIProject (String projectName, String serviceInstance){ + AAIResourceUri projectURI = AAIUriFactory.createResourceUri(AAIObjectType.PROJECT, projectName); + AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance); + AAIResourcesClient aaiRC = new AAIResourcesClient(); + aaiRC.createIfNotExists(projectURI, Optional.empty()).connect(projectURI, serviceInstanceURI); + + } + + public void createAAIOwningEntity(String owningEntityId, String owningEntityName,String serviceInstance){ + AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntityId); + AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance); + Map hashMap= new HashMap<>(); + hashMap.put("owning-entity-name", owningEntityName); + AAIResourcesClient aaiRC = new AAIResourcesClient(); + aaiRC.createIfNotExists(owningEntityURI, Optional.of(hashMap)).connect(owningEntityURI, serviceInstanceURI); + } + + public boolean existsOwningEntity(String owningEntityId){ + AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntityId); + AAIResourcesClient aaiRC = new AAIResourcesClient(); + return aaiRC.exists(owningEntityURI); + } + + public void connectOwningEntityandServiceInstance (String owningEntityId, String serviceInstance){ + AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntityId); + AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstance); + AAIResourcesClient aaiRC = new AAIResourcesClient(); + aaiRC.connect(owningEntityURI, serviceInstanceURI); + } + + public void createAAIPlatform(String platformName,String vnfId){ + AAIResourceUri platformURI = AAIUriFactory.createResourceUri(AAIObjectType.PLATFORM, platformName); + AAIResourceUri genericVnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF,vnfId); + AAIResourcesClient aaiRC = new AAIResourcesClient(); + aaiRC.createIfNotExists(platformURI, Optional.empty()).connect(platformURI, genericVnfURI); + } + + public void createAAILineOfBusiness(String lineOfBusiness,String vnfId){ + AAIResourceUri lineOfBusinessURI = AAIUriFactory.createResourceUri(AAIObjectType.LINE_OF_BUSINESS, lineOfBusiness); + AAIResourceUri genericVnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF,vnfId); + AAIResourcesClient aaiRC = new AAIResourcesClient(); + aaiRC.createIfNotExists(lineOfBusinessURI, Optional.empty()).connect(lineOfBusinessURI, genericVnfURI); + } + public void createAAIServiceInstance(String globalCustomerId, String serviceType, String serviceInstanceId){ + AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalCustomerId,serviceType,serviceInstanceId); + AAIResourcesClient aaiRC = new AAIResourcesClient(); + aaiRC.createIfNotExists(serviceInstanceURI, Optional.empty()); + } + +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/aai/AAIDeleteServiceInstance.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/aai/AAIDeleteServiceInstance.java new file mode 100644 index 0000000000..483c057f3e --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/aai/AAIDeleteServiceInstance.java @@ -0,0 +1,49 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.infrastructure.aai; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.JavaDelegate; +import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil; +import org.openecomp.mso.client.aai.AAIObjectType; +import org.openecomp.mso.client.aai.AAIResourcesClient; +import org.openecomp.mso.client.aai.entities.uri.AAIResourceUri; +import org.openecomp.mso.client.aai.entities.uri.AAIUriFactory; + +public class AAIDeleteServiceInstance implements JavaDelegate{ + + ExceptionUtil exceptionUtil = new ExceptionUtil(); + public void execute(DelegateExecution execution) throws Exception { + try{ + String serviceInstanceId = (String) execution.getVariable("serviceInstanceId"); + AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, + serviceInstanceId); + AAIResourcesClient aaiRC = new AAIResourcesClient(); + aaiRC.delete(serviceInstanceURI); + execution.setVariable("GENDS_SuccessIndicator",true); + } catch(Exception ex){ + String msg = "Exception in Delete Serivce Instance. Service Instance could not be deleted in AAI." + ex.getMessage(); + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg); + } + + } + +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/aai/AAIServiceInstance.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/aai/AAIServiceInstance.java new file mode 100644 index 0000000000..7370208f5e --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/aai/AAIServiceInstance.java @@ -0,0 +1,94 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.infrastructure.aai; + +public class AAIServiceInstance { + String serviceInstanceName; + String serviceType; + String serviceRole; + String orchestrationStatus; + String modelInvariantUuid; + String modelVersionId; + String environmentContext; + String workloadContext; + public AAIServiceInstance(String serviceInstanceName, String serviceType, String serviceRole, + String orchestrationStatus, String modelInvariantUuid, String modelVersionId, String environmentContext, + String workloadContext) { + this.serviceInstanceName = serviceInstanceName; + this.serviceType = serviceType; + this.serviceRole = serviceRole; + this.orchestrationStatus = orchestrationStatus; + this.modelInvariantUuid = modelInvariantUuid; + this.modelVersionId = modelVersionId; + this.environmentContext = environmentContext; + this.workloadContext = workloadContext; + } + public String getServiceInstanceName() { + return serviceInstanceName; + } + public void setServiceInstanceName(String serviceInstanceName) { + this.serviceInstanceName = serviceInstanceName; + } + public String getServiceType() { + return serviceType; + } + public void setServiceType(String serviceType) { + this.serviceType = serviceType; + } + public String getServiceRole() { + return serviceRole; + } + public void setServiceRole(String serviceRole) { + this.serviceRole = serviceRole; + } + public String getOrchestrationStatus() { + return orchestrationStatus; + } + public void setOrchestrationStatus(String orchestrationStatus) { + this.orchestrationStatus = orchestrationStatus; + } + public String getModelInvariantUuid() { + return modelInvariantUuid; + } + public void setModelInvariantUuid(String modelInvariantUuid) { + this.modelInvariantUuid = modelInvariantUuid; + } + public String getModelVersionId() { + return modelVersionId; + } + public void setModelVersionId(String modelVersionId) { + this.modelVersionId = modelVersionId; + } + public String getEnvironmentContext() { + return environmentContext; + } + public void setEnvironmentContext(String environmentContext) { + this.environmentContext = environmentContext; + } + public String getWorkloadContext() { + return workloadContext; + } + public void setWorkloadContext(String workloadContext) { + this.workloadContext = workloadContext; + } + + +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncNetworkTopologyOperationTask.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncNetworkTopologyOperationTask.java index 25c85f7394..646ed92705 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncNetworkTopologyOperationTask.java +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncNetworkTopologyOperationTask.java @@ -60,8 +60,8 @@ public class SdncNetworkTopologyOperationTask extends AbstractSdncOperationTask if (!isSend2SdncDirectly()) { outputEntity = genericResourceApiClient.postNetworkTopologyOperation (HeaderUtil.DefaulAuth, inputEntity).execute().body(); - updateProgress(execution, null, null, "90", "sendRestrequestAndHandleResponse finished!"); - saveOutput(execution, outputEntity); + updateProgress(execution, null, null, "90", "sendRestrequestAndHandleResponse finished!"); + saveOutput(execution, outputEntity); } else { send2SdncDirectly(HeaderUtil.DefaulAuth, inputEntity); } diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java index 130c97e273..dab96b0613 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncServiceTopologyOperationTask.java @@ -33,6 +33,7 @@ import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.builder import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.entity.RpcServiceTopologyOperationInputEntity; import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.entity.RpcServiceTopologyOperationOutputEntity; import org.openecomp.mso.logger.MessageEnum; +import org.openecomp.mso.requestsdb.RequestsDbConstant; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -52,16 +53,16 @@ public class SdncServiceTopologyOperationTask extends AbstractSdncOperationTask Map inputs, GenericResourceApi genericResourceApiClient) throws Exception { sdncLogger.info("SdncServiceTopologyOperationTask.sendRestrequestAndHandleResponse begin!"); -// updateProgress(execution, null, null, "40", "sendRestrequestAndHandleResponse begin!"); + updateProgress(execution, null, null, "40", "sendRestrequestAndHandleResponse begin!"); ServiceRpcInputEntityBuilder builder = new ServiceRpcInputEntityBuilder(); RpcServiceTopologyOperationInputEntity inputEntity = builder.build(execution, inputs); -// updateProgress(execution, null, null, "50", "RequestBody build finished!"); + updateProgress(execution, null, null, "50", "RequestBody build finished!"); RpcServiceTopologyOperationOutputEntity outputEntity; if (!isSend2SdncDirectly()) { outputEntity = genericResourceApiClient.postServiceTopologyOperation (HeaderUtil.DefaulAuth, inputEntity).execute().body(); -// updateProgress(execution, null, null, "90", "sendRestrequestAndHandleResponse finished!"); - saveOutput(execution, outputEntity); + updateProgress(execution, null, null, "90", "sendRestrequestAndHandleResponse finished!"); + saveOutput(execution, outputEntity); } else { send2SdncDirectly(HeaderUtil.DefaulAuth, inputEntity); } @@ -92,7 +93,7 @@ public class SdncServiceTopologyOperationTask extends AbstractSdncOperationTask String errorMessage = output.getOutput().getResponseMessage(); WorkflowException workflowException = new WorkflowException(processKey, errorCode, errorMessage); execution.setVariable("SDNCA_SuccessIndicator", workflowException); -// updateProgress(execution, RequestsDbConstant.Status.ERROR, String.valueOf(errorCode), null, errorMessage); + updateProgress(execution, RequestsDbConstant.Status.ERROR, String.valueOf(errorCode), null, errorMessage); sdncLogger.info("exception: SdncServiceTopologyOperationTask.saveOutput fail!"); throw new RouteException(); } diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnPreprocessTask.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnPreprocessTask.java index 869c7783ef..90effd39e3 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnPreprocessTask.java +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnPreprocessTask.java @@ -43,7 +43,7 @@ public class SdncUnderlayVpnPreprocessTask extends BaseTask { String serviceId = (String) execution.getVariable("serviceId"); serviceId = StringUtils.isBlank(serviceId) ? (String) execution.getVariable("serviceInstanceId") : serviceId; String operationId = (String) execution.getVariable("operationId"); - String resourceTemplateUUID = (String) execution.getVariable("resourceUUID"); + String resourceTemplateUUID = (String) execution.getVariable("resourceTemplateUUID"); resourceTemplateUUID = StringUtils.isBlank(resourceTemplateUUID) ? (String) execution.getVariable("resourceTemplateId") : resourceTemplateUUID; ResourceOperationStatus resourceOperationStatus = requestsDB.getResourceOperationStatus(serviceId, operationId, resourceTemplateUUID); return resourceOperationStatus.getOperType(); diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/META-INF/persistence.xml b/bpmn/MSOInfrastructureBPMN/src/main/resources/META-INF/persistence.xml index 8e87f47ddc..3bfafacbef 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/META-INF/persistence.xml +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/META-INF/persistence.xml @@ -25,7 +25,7 @@ http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"> - + java:jboss/datasources/ProcessEngine diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateCustomE2EServiceInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateCustomE2EServiceInstance.bpmn index 8fc761c0d3..ce17615679 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateCustomE2EServiceInstance.bpmn +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateCustomE2EServiceInstance.bpmn @@ -29,18 +29,17 @@ ex.processJavaException(execution)]]> + - + - + + - - - SequenceFlow_19eilro SequenceFlow_0klbpxx diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateGenericALaCarteServiceInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateGenericALaCarteServiceInstance.bpmn index acf380f866..6088fda4a3 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateGenericALaCarteServiceInstance.bpmn +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateGenericALaCarteServiceInstance.bpmn @@ -27,9 +27,6 @@ ex.processJavaException(execution)]]> - - - @@ -39,9 +36,10 @@ ex.processJavaException(execution)]]> - + + - SequenceFlow_0eto8sn + SequenceFlow_1hjh5zy SequenceFlow_1lj31zp @@ -52,7 +50,7 @@ ex.processJavaException(execution)]]> SequenceFlow_0lp2z7l SequenceFlow_0ktadna @@ -116,10 +114,9 @@ csi.sendSyncError(execution)]]> - SequenceFlow_0ktadna - SequenceFlow_0eto8sn + SequenceFlow_16vhtu8 @@ -140,6 +137,54 @@ csi.sendSyncResponse(execution)]]> + + SequenceFlow_16vhtu8 + + + + + SequenceFlow_1tfe975 + + + + SequenceFlow_1hjh5zy + + + + SequenceFlow_14ajbme + + + + SequenceFlow_1tfe975 + SequenceFlow_0xhu1k3 + + + + + + + + + + + + SequenceFlow_0xhu1k3 + SequenceFlow_1o3ihrh + + + SequenceFlow_1o3ihrh + SequenceFlow_14ajbme + + + + + + + @@ -152,51 +197,51 @@ csi.sendSyncResponse(execution)]]> - + - + - + - + - + - + - - + + - + - - + + - + - + - + - + - - + + - + @@ -210,128 +255,198 @@ csi.sendSyncResponse(execution)]]> - + - + - - + + - + - + - + - + - + - + - + - + - - + + - + - - + + - + - - + + - + - - - - + + + + - - - - - - - - + - + - + - + - + - - - - + + + + - + - + - + - + - + - - - - + + + + - + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + \ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateNetworkInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateNetworkInstance.bpmn index 0316e26d9a..c9d4720628 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateNetworkInstance.bpmn +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateNetworkInstance.bpmn @@ -112,30 +112,8 @@ CreateNetworkInstance.prepareCompletion(execution)]]> def CreateNetworkInstance = new CreateNetworkInstance() CreateNetworkInstance.prepareDBRequestError(execution)]]> - - - - - ${URN_mso_adapters_openecomp_db_endpoint} - ${CRENI_createDBRequest} - - - application/soap+xml - #{BasicAuthHeaderValueDB} - - - POST - ${response} - ${statusCode} - - http-connector - - - SequenceFlow_1s5niqb - SequenceFlow_06s5eu4 - - SequenceFlow_06s5eu4 + SequenceFlow_1s5niqb SequenceFlow_1reso2f SequenceFlow_1reso2f SequenceFlow_1ghqolv - - + @@ -273,10 +250,7 @@ CreateNetworkInstance.sendSyncResponse(execution)]]> - - - - + @@ -286,7 +260,7 @@ CreateNetworkInstance.sendSyncResponse(execution)]]> - + @@ -307,24 +281,17 @@ CreateNetworkInstance.sendSyncResponse(execution)]]> - - - - - - - - - + + - + - + - + @@ -343,9 +310,9 @@ CreateNetworkInstance.sendSyncResponse(execution)]]> - + - + diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVFCNSResource.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVFCNSResource.bpmn index e6d4af3a6b..e4254f2d9e 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVFCNSResource.bpmn +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVFCNSResource.bpmn @@ -34,10 +34,10 @@ dcsi.instantiateNetworkService(execution)]]> createNSFailed_SequenceFlow - + - + SequenceFlow_1ywe21t @@ -80,7 +80,7 @@ dcsi.instantiateNetworkService(execution)]]> def dcsi = new CreateVFCNSResource() dcsi.queryNSProgress(execution)]]> - + operationFinished_SequenceFlow SequenceFlow_0cq2q6g - \ No newline at end of file + diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVcpeResCustService.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVcpeResCustService.bpmn index 9fe6815570..2120e120a9 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVcpeResCustService.bpmn +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVcpeResCustService.bpmn @@ -1,5 +1,5 @@ - + SequenceFlow_7 @@ -101,6 +101,7 @@ ex.processJavaException(execution)]]> + SequenceFlow_0j6sjye SequenceFlow_1ky2sv9 diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVfModuleInfra.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVfModuleInfra.bpmn index 84ab4177e2..0abbdd1c6d 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVfModuleInfra.bpmn +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVfModuleInfra.bpmn @@ -37,6 +37,7 @@ + SequenceFlow_7 SequenceFlow_4 diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVnfInfra.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVnfInfra.bpmn index e78bde6f29..441e684b89 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVnfInfra.bpmn +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVnfInfra.bpmn @@ -1,5 +1,5 @@ - + SequenceFlow_1 @@ -41,7 +41,7 @@ createVnf.sendSyncResponse(execution)]]> SequenceFlow_0ed0uiq - SequenceFlow_0lso26t + SequenceFlow_0w0m5fr @@ -100,7 +100,7 @@ createVnf.sendErrorResponse(execution)]]> - SequenceFlow_0lso26t + SequenceFlow_01mjjk3 SequenceFlow_16 SequenceFlow_17 - SequenceFlow_3 @@ -131,6 +130,23 @@ createVnf.prepareCompletionHandlerRequest(execution)]]> CreateVnfInfra createVnf = new CreateVnfInfra() createVnf.queryCatalogDB(execution)]]> + + + + + SequenceFlow_0w0m5fr + SequenceFlow_0s4i7px + + + + SequenceFlow_0s4i7px + SequenceFlow_01mjjk3 + + @@ -173,9 +189,9 @@ createVnf.queryCatalogDB(execution)]]> - + - + @@ -263,30 +279,23 @@ createVnf.queryCatalogDB(execution)]]> - + - - + + - + - + - - + + - - - - - - - - + @@ -299,6 +308,33 @@ createVnf.queryCatalogDB(execution)]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteCustomE2EServiceInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteCustomE2EServiceInstance.bpmn index 2983589699..289128d95f 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteCustomE2EServiceInstance.bpmn +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteCustomE2EServiceInstance.bpmn @@ -139,7 +139,7 @@ csi.sendSyncResponse(execution)]]> - + @@ -150,95 +150,99 @@ csi.sendSyncResponse(execution)]]> - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + + + - + diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteNetworkInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteNetworkInstance.bpmn index 3b5c629182..1e868def58 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteNetworkInstance.bpmn +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteNetworkInstance.bpmn @@ -1,113 +1,113 @@ - - - - - SequenceFlow_0lp2z7l - - - - SequenceFlow_10 - SequenceFlow_14 + + + + + SequenceFlow_0lp2z7l + + + + SequenceFlow_10 + SequenceFlow_14 - - - - SequenceFlow_10 - - - - - SequenceFlow_14 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SequenceFlow_0eto8sn - SequenceFlow_1lj31zp - - - SequenceFlow_0x3znm5 - - - SequenceFlow_095crcd - SequenceFlow_0x3znm5 +networkMod.processJavaException(execution)]]> + + + + SequenceFlow_10 + + + + + SequenceFlow_14 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_0eto8sn + SequenceFlow_1lj31zp + + + SequenceFlow_0x3znm5 + + + SequenceFlow_095crcd + SequenceFlow_0x3znm5 - - - - - SequenceFlow_0lp2z7l - SequenceFlow_1ablr60 +]]> + + + + + SequenceFlow_0lp2z7l + SequenceFlow_1ablr60 - - - - - SequenceFlow_1lj31zp - SequenceFlow_0xxvjxq +preProcess.preProcessRequest(execution)]]> + + + + + SequenceFlow_1lj31zp + SequenceFlow_0xxvjxq - - - - - - - - - - - SequenceFlow_0xxvjxq - SequenceFlow_095crcd - - - - - SequenceFlow_0n4umjf - - - - SequenceFlow_1ghqolv - - - SequenceFlow_0n4umjf - SequenceFlow_1s5niqb +DeleteNetworkInstance.prepareCompletion(execution)]]> + + + + + + + + + + + SequenceFlow_0xxvjxq + SequenceFlow_095crcd + + + + + SequenceFlow_0n4umjf + + + + SequenceFlow_1ghqolv + + + SequenceFlow_0n4umjf + SequenceFlow_1s5niqb @@ -139,39 +139,39 @@ DeleteNetworkInstance.prepareDBRequestError(execution)]]> SequenceFlow_1reso2f - - - - - - - - - - - SequenceFlow_1reso2f - SequenceFlow_1ghqolv - - - - - - - - - - - - SequenceFlow_1ablr60 - SequenceFlow_0rt8wax +DeleteNetworkInstance.buildErrorResponse(execution)]]> + + + + + + + + + + + SequenceFlow_1reso2f + SequenceFlow_1ghqolv + + + + + + + + + + + + SequenceFlow_1ablr60 + SequenceFlow_0rt8wax - - - SequenceFlow_0rt8wax - SequenceFlow_0eto8sn +DeleteNetworkInstance.getNetworkModelInfo(execution)]]> + + + SequenceFlow_0rt8wax + SequenceFlow_0eto8sn diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteVfModuleInfra.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteVfModuleInfra.bpmn index e19ea1bd86..81e759b8a9 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteVfModuleInfra.bpmn +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteVfModuleInfra.bpmn @@ -38,6 +38,7 @@ dvfm.prepDoDeleteVfModule(execution)]]> + SequenceFlow_9 SequenceFlow_8 diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/ReplaceVnfInfra.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/ReplaceVnfInfra.bpmn index 6c5e8f6522..c15c391558 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/ReplaceVnfInfra.bpmn +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/ReplaceVnfInfra.bpmn @@ -20,7 +20,7 @@ uvfm.preProcessRequest(execution) - + @@ -42,10 +42,11 @@ execution.setVariable("UpdateVfModuleInfraSuccessIndicator", true)]]> SequenceFlow_3 + SequenceFlow_19rrss6 SequenceFlow_17 @@ -54,19 +55,19 @@ uvfm.completionHandlerPrep(execution, 'RPLVnfI_CompletionHandlerRequest') SequenceFlow_1 - + - SequenceFlow_1 + SequenceFlow_0ph6862 SequenceFlow_7 - + @@ -79,6 +80,39 @@ uvfm.falloutHandlerPrep(execution, 'RPLVnfI_FalloutHandlerRequest') + + + + + SequenceFlow_1 + SequenceFlow_0msgw6c + + + + SequenceFlow_0uhssvq + SequenceFlow_0ph6862 + + + + + + + + + + + + + + + + SequenceFlow_0msgw6c + SequenceFlow_0uhssvq + SequenceFlow_12 @@ -95,13 +129,15 @@ uvfm.falloutHandlerPrep(execution, 'RPLVnfI_FalloutHandlerRequest') - + - - - - + + + + + + SequenceFlow_19ba94v SequenceFlow_0gzzeru @@ -112,7 +148,7 @@ uvfm.falloutHandlerPrep(execution, 'RPLVnfI_FalloutHandlerRequest') - + @@ -120,7 +156,7 @@ uvfm.falloutHandlerPrep(execution, 'RPLVnfI_FalloutHandlerRequest') SequenceFlow_0y0jt4l SequenceFlow_1w35ov3 - + SequenceFlow_1w35ov3 SequenceFlow_053qjfy @@ -131,7 +167,7 @@ uvfm.getVnfResourceDecomposition(execution)]]> SequenceFlow_16mo99z - SequenceFlow_193t8ts + SequenceFlow_0jph3mt SequenceFlow_2 SequenceFlow_0baosqi - SequenceFlow_18u8p2k + SequenceFlow_1nodcf9 SequenceFlow_0k3fx7p SequenceFlow_19lg15d - SequenceFlow_1lsfn19 + SequenceFlow_0usoiza SequenceFlow_12mfil6 - SequenceFlow_053qjfy + SequenceFlow_14yy8v4 SequenceFlow_0usxnlk - - SequenceFlow_1bkhs8m - SequenceFlow_0eueu1t - SequenceFlow_0xx8y1s - - - - SequenceFlow_0qy68ib - SequenceFlow_1sla5dr - SequenceFlow_0a6pdza - - - - SequenceFlow_0q0qan8 - SequenceFlow_0iektwg - SequenceFlow_13h26h9 - - - - SequenceFlow_04zwhw4 - SequenceFlow_1uno5rs - - - - SequenceFlow_162mm0m - SequenceFlow_1hx1ur7 - SequenceFlow_1c79909 - - - - SequenceFlow_197t3qk - SequenceFlow_0ukzynj - SequenceFlow_1xfbwpi - - SequenceFlow_0usxnlk SequenceFlow_16mo99z - SequenceFlow_1qmz2ez + SequenceFlow_12hm1ks SequenceFlow_2 SequenceFlow_0baosqi - SequenceFlow_03rkfbo + SequenceFlow_0etr76r - - - - - - - + + + + + + + - - - + + + + - SequenceFlow_1qmz2ez - SequenceFlow_03rkfbo - SequenceFlow_1lsm3bn - SequenceFlow_0bduwog - SequenceFlow_0uwar5b - SequenceFlow_0i7hfj2 - SequenceFlow_13yjc85 - SequenceFlow_0waedj5 - SequenceFlow_1hg9c2l - SequenceFlow_0gej71y - SequenceFlow_0pfydeg - SequenceFlow_10ek8l4 + SequenceFlow_1cezgw4 SequenceFlow_0v0u7mf - - - - - - SequenceFlow_1qr8msw - + - + SequenceFlow_0k3fx7p SequenceFlow_1bkhs8m - SequenceFlow_1lsm3bn + SequenceFlow_11b00u2 - - - SequenceFlow_0xx8y1s SequenceFlow_0qy68ib - SequenceFlow_0bduwog + SequenceFlow_1ck3v34 SequenceFlow_0a6pdza SequenceFlow_0q0qan8 - SequenceFlow_0uwar5b + SequenceFlow_079nix0 SequenceFlow_13h26h9 SequenceFlow_1c0vdki - SequenceFlow_0i7hfj2 + SequenceFlow_032i8t0 - - - - - - - - - - + SequenceFlow_0gzzeru - SequenceFlow_10ek8l4 SequenceFlow_0bxgny0 + SequenceFlow_1f0c5lj - - - SequenceFlow_1uno5rs SequenceFlow_162mm0m - SequenceFlow_0waedj5 + SequenceFlow_17vwb2h SequenceFlow_1c79909 SequenceFlow_197t3qk - SequenceFlow_1hg9c2l + SequenceFlow_0ba08lt SequenceFlow_1xfbwpi SequenceFlow_19lg15d - SequenceFlow_0gej71y + SequenceFlow_1akvi72 SequenceFlow_12mfil6 - SequenceFlow_13yjc85 SequenceFlow_3 + SequenceFlow_1sdol24 - - - - - - - - - - - - SequenceFlow_0vpd06n SequenceFlow_051zp79 @@ -381,42 +320,27 @@ uvfm.abortProcessing(execution)]]> SequenceFlow_05gpym3 - SequenceFlow_1sla5dr - SequenceFlow_0iektwg - SequenceFlow_1ttepat - SequenceFlow_1hx1ur7 - SequenceFlow_0ukzynj - SequenceFlow_1lsfn19 SequenceFlow_051zp79 - SequenceFlow_193t8ts - SequenceFlow_18u8p2k - SequenceFlow_0eueu1t + SequenceFlow_1ei7at5 + SequenceFlow_0kg02xg + SequenceFlow_1i6p53b + SequenceFlow_1yy7o24 + SequenceFlow_0sqmtpl + SequenceFlow_1shdmrj + SequenceFlow_1v1i5w4 + SequenceFlow_1h8rscx + SequenceFlow_1xzq6jb + SequenceFlow_165q14c + SequenceFlow_0wp1a6g + SequenceFlow_0vymfh9 - - - - - - - - - - - - - - - - - - - + SequenceFlow_1c0vdki - SequenceFlow_1ttepat + SequenceFlow_0aldwvz SequenceFlow_19ba94v SequenceFlow_0bxgny0 + SequenceFlow_111z6w4 SequenceFlow_1qm0ygo + + + + + + + + + + + + + + + + + SequenceFlow_1qm0ygo SequenceFlow_0he2w4b - + SequenceFlow_0he2w4b - SequenceFlow_0pfydeg SequenceFlow_04zwhw4 + SequenceFlow_0pfvulx - - - - - + + + + + + + + + + + + + SequenceFlow_1bkhs8m + SequenceFlow_1qfjlt7 + SequenceFlow_0xx8y1s + + + + + + + + + + + + + + + + + SequenceFlow_0qy68ib + SequenceFlow_0x7iupc + SequenceFlow_0a6pdza + + + + + + + + + + + + + + + SequenceFlow_0q0qan8 + SequenceFlow_0hp0w6k + SequenceFlow_13h26h9 + + + + + + + + + + + + + + + SequenceFlow_04zwhw4 + SequenceFlow_1lrbndo + SequenceFlow_1uno5rs + + + + + + + + + + + + + + + + + SequenceFlow_162mm0m + SequenceFlow_14mblvp + SequenceFlow_1c79909 + + + SequenceFlow_12hm1ks + + + + SequenceFlow_0jph3mt + + + + SequenceFlow_0etr76r + + + + SequenceFlow_1nodcf9 + + + + SequenceFlow_11b00u2 + + + + + + + + - - + + + - - + + SequenceFlow_1qfjlt7 + + + + SequenceFlow_1ck3v34 + + + + SequenceFlow_0x7iupc + + + + SequenceFlow_079nix0 + + + + SequenceFlow_0hp0w6k + + + + SequenceFlow_032i8t0 + + + + + + + + + + + + + + + SequenceFlow_0aldwvz + + + + SequenceFlow_1f0c5lj + + + + SequenceFlow_111z6w4 + + + + SequenceFlow_0pfvulx + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_197t3qk + SequenceFlow_18e0jz0 + SequenceFlow_1xfbwpi + + + SequenceFlow_1lrbndo + + + + SequenceFlow_17vwb2h + + + + SequenceFlow_14mblvp + + + + SequenceFlow_0ba08lt + + + + SequenceFlow_18e0jz0 + + + + SequenceFlow_1akvi72 + + + + SequenceFlow_0usoiza + + + + SequenceFlow_1sdol24 + + + + + + + + + + + + + + + + + + + + SequenceFlow_19rrss6 + + + + + SequenceFlow_1cezgw4 + + + + + SequenceFlow_1ei7at5 + + + + SequenceFlow_0kg02xg + + + + SequenceFlow_1i6p53b + + + + SequenceFlow_1yy7o24 + + + + SequenceFlow_0sqmtpl + + + + SequenceFlow_1shdmrj + + + + SequenceFlow_1v1i5w4 + + + + SequenceFlow_1h8rscx + + + + SequenceFlow_1xzq6jb + + + + SequenceFlow_165q14c + + + + SequenceFlow_0wp1a6g + + + + SequenceFlow_0vymfh9 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_053qjfy + SequenceFlow_14yy8v4 + + @@ -465,9 +740,9 @@ uvfm.prepDoCreateVnfAndModules(execution)]]> - + - + @@ -498,107 +773,110 @@ uvfm.prepDoCreateVnfAndModules(execution)]]> - + - - + + + + - + - + - + - - + + - + - + - + - + - + - - + + - + - - + + - + - + - + - + - + - + - + - - + + - + - + - - + + - + - - + + - + - + - - - - - + + + + + + - + @@ -613,13 +891,9 @@ uvfm.prepDoCreateVnfAndModules(execution)]]> - - - - - + - + @@ -636,102 +910,87 @@ uvfm.prepDoCreateVnfAndModules(execution)]]> - + - + - - - - - + + + + + + - + - - + + - + - + - + - + - - + + - + - - + + - + - - + + - + - - - - - - - - - - - + + + + - + - - + + - + - - - - - - - - + + - + - - - - + @@ -744,434 +1003,804 @@ uvfm.prepDoCreateVnfAndModules(execution)]]> - + - + - + - + - - - - - - - - - - - - - - - - - - - - + + - + - + - - - + + + + - + - - - - + + + + - + - + - + - - - - - - - - - + - + - + - - + + - + - + - + - - + + - + - + - + - - - - - + + + + + + - + - - - - - + + - + + + + + + + + + + + + - - - - - + + + + + + + + + + + - + - - - - + + + + + + + + + - + - - + + - + - - - - - - + + + + + - + - - - - + + - + + + + + + + + - - + + + + + - + - - - + + + + + + + + + + + - + - - + + + - + + + + - - - + + + + + + + + - + + + + + + + + - - + + + - + + + + + + + + + + + + + + + + + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + - - + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + - - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + - + - - - - - + + + + + - + - - - - - + + + - + - - - - - + + + + + - + - - + + + + + + + + + + + + - - + + - + - - + + - + - - - - - + + + + + + + + + - + - - - - + + + - + - - - - - + + + - + - - - - - + + + - + - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + - - - - - - + + + - + - - - - - - + + + + + - + - - - + + + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + - - + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - + + - + + + + + + + + + + + + + + + + + + + + - - - + + + - + - - - + + + - + - - - + + + - + - - - - - + + + - + - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - + + + - + - - - - - - + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/UpdateVnfInfra.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/UpdateVnfInfra.bpmn index 2631da1987..fa58c0b21b 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/UpdateVnfInfra.bpmn +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/UpdateVnfInfra.bpmn @@ -20,7 +20,7 @@ uvfm.preProcessRequest(execution) - + @@ -42,10 +42,11 @@ execution.setVariable("UpdateVfModuleInfraSuccessIndicator", true)]]> SequenceFlow_3 + SequenceFlow_1dqbqqx SequenceFlow_17 @@ -54,19 +55,19 @@ uvfm.completionHandlerPrep(execution, 'UPDVnfI_CompletionHandlerRequest') SequenceFlow_1 - + - SequenceFlow_1 + SequenceFlow_0slcwxc SequenceFlow_7 - + @@ -79,6 +80,39 @@ uvfm.falloutHandlerPrep(execution, 'UPDVnfI_FalloutHandlerRequest') + + + + + SequenceFlow_1 + SequenceFlow_0a0lfh8 + + + + SequenceFlow_0r0o5yt + SequenceFlow_0slcwxc + + + + + + + + + + + + + + + + SequenceFlow_0a0lfh8 + SequenceFlow_0r0o5yt + SequenceFlow_12 @@ -95,23 +129,24 @@ uvfm.falloutHandlerPrep(execution, 'UPDVnfI_FalloutHandlerRequest') - + - - - - - - - - - - - - - + + + + + + + + + + + + + + SequenceFlow_19ba94v SequenceFlow_0gzzeru @@ -122,7 +157,7 @@ uvfm.falloutHandlerPrep(execution, 'UPDVnfI_FalloutHandlerRequest') - + @@ -130,7 +165,7 @@ uvfm.falloutHandlerPrep(execution, 'UPDVnfI_FalloutHandlerRequest') SequenceFlow_0y0jt4l SequenceFlow_1w35ov3 - + SequenceFlow_1w35ov3 SequenceFlow_053qjfy @@ -141,7 +176,7 @@ uvfm.getVnfResourceDecomposition(execution)]]> SequenceFlow_16mo99z - SequenceFlow_0fxuur5 + SequenceFlow_1pj72fw SequenceFlow_2 SequenceFlow_0baosqi - SequenceFlow_1wax44p + SequenceFlow_1lmijmb SequenceFlow_0k3fx7p SequenceFlow_19lg15d - SequenceFlow_1lsfn19 + SequenceFlow_11p8elx SequenceFlow_12mfil6 - SequenceFlow_053qjfy + SequenceFlow_178fxkj SequenceFlow_0usxnlk - - SequenceFlow_1bkhs8m - SequenceFlow_1nlqlwn - SequenceFlow_0xx8y1s - - - - SequenceFlow_0qy68ib - SequenceFlow_1sla5dr - SequenceFlow_0a6pdza - - - - SequenceFlow_0q0qan8 - SequenceFlow_0iektwg - SequenceFlow_13h26h9 - - - - SequenceFlow_04zwhw4 - SequenceFlow_1uno5rs - - - - SequenceFlow_162mm0m - SequenceFlow_1hx1ur7 - SequenceFlow_1c79909 - - - - SequenceFlow_197t3qk - SequenceFlow_0ukzynj - SequenceFlow_1xfbwpi - - SequenceFlow_0usxnlk SequenceFlow_16mo99z - SequenceFlow_1qmz2ez + SequenceFlow_1esmtgy SequenceFlow_2 SequenceFlow_0baosqi - SequenceFlow_03rkfbo + SequenceFlow_1jmzl1j - - - - - - - + + + + + + + - - - + + + + - SequenceFlow_1qmz2ez - SequenceFlow_03rkfbo - SequenceFlow_1lsm3bn - SequenceFlow_0bduwog - SequenceFlow_0uwar5b - SequenceFlow_0i7hfj2 - SequenceFlow_10ek8l4 - SequenceFlow_13yjc85 - SequenceFlow_0waedj5 - SequenceFlow_1hg9c2l - SequenceFlow_0gej71y + SequenceFlow_1nplvhi SequenceFlow_0v0u7mf - - - - - - SequenceFlow_1qr8msw - + - + SequenceFlow_0k3fx7p SequenceFlow_1bkhs8m - SequenceFlow_1lsm3bn + SequenceFlow_010ynjs - - - SequenceFlow_0xx8y1s SequenceFlow_0qy68ib - SequenceFlow_0bduwog + SequenceFlow_1qsxbp4 SequenceFlow_0a6pdza SequenceFlow_0q0qan8 - SequenceFlow_0uwar5b + SequenceFlow_15bl7wd SequenceFlow_13h26h9 SequenceFlow_1c0vdki - SequenceFlow_0i7hfj2 + SequenceFlow_1m84lq5 - - - - - - - - - SequenceFlow_0gzzeru SequenceFlow_04zwhw4 - SequenceFlow_10ek8l4 + SequenceFlow_0fog99f - - - SequenceFlow_1uno5rs SequenceFlow_162mm0m - SequenceFlow_0waedj5 + SequenceFlow_12g63pl SequenceFlow_1c79909 SequenceFlow_197t3qk - SequenceFlow_1hg9c2l + SequenceFlow_0l83v2k SequenceFlow_1xfbwpi SequenceFlow_19lg15d - SequenceFlow_0gej71y + SequenceFlow_07fhkt4 SequenceFlow_12mfil6 - SequenceFlow_13yjc85 SequenceFlow_3 + SequenceFlow_0p94lgv - - - - - - - - - - - - SequenceFlow_0vpd06n SequenceFlow_1c022sy @@ -390,57 +329,358 @@ uvfm.abortProcessing(execution)]]> SequenceFlow_05gpym3 - SequenceFlow_1sla5dr - SequenceFlow_0iektwg - SequenceFlow_1ttepat - SequenceFlow_1hx1ur7 - SequenceFlow_0ukzynj - SequenceFlow_1lsfn19 - SequenceFlow_0fxuur5 - SequenceFlow_1wax44p - SequenceFlow_1nlqlwn SequenceFlow_1c022sy + SequenceFlow_0tqrgop + SequenceFlow_126nlmw + SequenceFlow_0mw3mwl + SequenceFlow_13md9cw + SequenceFlow_0xylem3 + SequenceFlow_1c5mxd5 + SequenceFlow_0u8hiu2 + SequenceFlow_0fs7ay9 + SequenceFlow_00qwx4v + SequenceFlow_14s8ji9 + SequenceFlow_0kricor - - - - - - - - - - - - - - - - - - - + SequenceFlow_1c0vdki - SequenceFlow_1ttepat + SequenceFlow_1hldqvv SequenceFlow_19ba94v - - + + + + + + + + + + + + + + SequenceFlow_1bkhs8m + SequenceFlow_0qmpjgv + SequenceFlow_0xx8y1s + + + + + + + + + + + + + + + + + SequenceFlow_0qy68ib + SequenceFlow_0tld38t + SequenceFlow_0a6pdza + + + + + + + + + + + + + + + SequenceFlow_0q0qan8 + SequenceFlow_08dyt3l + SequenceFlow_13h26h9 + + + + + + + + + + + + + + + SequenceFlow_04zwhw4 + SequenceFlow_0ye8oij + SequenceFlow_1uno5rs + + + + + + + + + + + + + + + + + SequenceFlow_162mm0m + SequenceFlow_08kn9ok + SequenceFlow_1c79909 + + + + + + + + + + + + + + SequenceFlow_197t3qk + SequenceFlow_02uiht9 + SequenceFlow_1xfbwpi + + + SequenceFlow_1esmtgy + + + + SequenceFlow_1jmzl1j + + + + - - + + - - + + SequenceFlow_1pj72fw + + + + + SequenceFlow_1lmijmb + + + + + SequenceFlow_010ynjs + + + + - + + SequenceFlow_0qmpjgv + + + + SequenceFlow_1qsxbp4 + + + + SequenceFlow_15bl7wd + + + + SequenceFlow_1m84lq5 + + + + SequenceFlow_0tld38t + + + + SequenceFlow_08dyt3l + + + + + + + + + + + + + + + + SequenceFlow_1hldqvv + + + + SequenceFlow_0fog99f + + + + SequenceFlow_0ye8oij + + + + SequenceFlow_12g63pl + + + + + + + + + + + + SequenceFlow_08kn9ok + + + + SequenceFlow_0l83v2k + + + + SequenceFlow_02uiht9 + + + + SequenceFlow_07fhkt4 + + + + SequenceFlow_11p8elx + + + + SequenceFlow_0p94lgv + + + + + + + + + + + + + + + + + SequenceFlow_1dqbqqx + + + + SequenceFlow_1nplvhi + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_0tqrgop + + + + SequenceFlow_126nlmw + + + + SequenceFlow_0mw3mwl + + + + SequenceFlow_13md9cw + + + + SequenceFlow_0xylem3 + + + + SequenceFlow_1c5mxd5 + + + + SequenceFlow_0u8hiu2 + + + + SequenceFlow_0fs7ay9 + + + + SequenceFlow_00qwx4v + + + + SequenceFlow_14s8ji9 + + + + SequenceFlow_0kricor + + + + + SequenceFlow_053qjfy + SequenceFlow_178fxkj + + @@ -452,9 +692,9 @@ uvfm.prepDoUpdateVnfAndModules(execution)]]> - + - + @@ -485,107 +725,108 @@ uvfm.prepDoUpdateVnfAndModules(execution)]]> - + - - + + - + - + - + - - + + - + - + - + - + - + - - + + - + - - + + - + - + - + - + - + - + - + - - + + - + - + - - + + - + - - + + - + - + - - - - - + + + + + + - + @@ -600,13 +841,9 @@ uvfm.prepDoUpdateVnfAndModules(execution)]]> - - - - - + - + @@ -630,95 +867,80 @@ uvfm.prepDoUpdateVnfAndModules(execution)]]> - - - - - + + + + + + - + - - + + - + - + - - + + - + - - + + - + - - + + - + - - - - - - - - - - - + + + + - + - - + + - + - - - - - - - - + + - + - - - - + @@ -731,7 +953,7 @@ uvfm.prepDoUpdateVnfAndModules(execution)]]> - + @@ -744,24 +966,6 @@ uvfm.prepDoUpdateVnfAndModules(execution)]]> - - - - - - - - - - - - - - - - - - @@ -770,29 +974,30 @@ uvfm.prepDoUpdateVnfAndModules(execution)]]> - + - - + + + - + - - - - + + + + - + - + @@ -802,322 +1007,672 @@ uvfm.prepDoUpdateVnfAndModules(execution)]]> - - - - - - - - - + - + - - + + - + - + - + - - + + - + - + - + - - - - - + + + + + + - + - - - - - + + - + + + + + + + + - - - - - + + - + + + + + + + + + + + + - - - - + + + + + + + + + + + - + - - + + - + - - - - - - + + + - + - - - - + + - + + + + + + + + - - + + + + + - + - - - + + - + + + + + + + + - - + + + + + - + + + + - - - + + + + - + - - + + + + + + + + + + + + + + + + + + + + - + - - - + + + + + + + + + - + - - + + + - + + + + + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + - - - - + + + + + - + - - - - - + + + + + - + - - - - - + + + - + - - - - - + + + + + - + - - + + + + + + + + + + + + - - + + - + - - + + - + - - - - - + + + + + + + + + - + - - - - + + + - + - - - - - + + + - + - - - - - + + + - + - - - - - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - + + + - + - - - - - - + + + - + - - - + + + - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - + + + + + + + + + - + - - - - - - + + + - + - - - - - - + + + - + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/VnfConfigUpdate.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/VnfConfigUpdate.bpmn new file mode 100644 index 0000000000..5915b9b592 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/VnfConfigUpdate.bpmn @@ -0,0 +1,1631 @@ + + + + + SequenceFlow_5 + SequenceFlow_0y0jt4l + + + + + SequenceFlow_4 + SequenceFlow_5 + + + + + + + + + + + SequenceFlow_17 + SequenceFlow_14 + + + + SequenceFlow_6 + + + + SequenceFlow_14 + SequenceFlow_6 + + + + + SequenceFlow_3 + SequenceFlow_07uuj2d + SequenceFlow_17 + + + + + + SequenceFlow_1 + + + + + SequenceFlow_0xt2xvx + SequenceFlow_7 + + + + + + + + + + + SequenceFlow_7 + SequenceFlow_19 + + + SequenceFlow_19 + + + + + + + + SequenceFlow_1 + SequenceFlow_1vxpbd0 + + + + SequenceFlow_03ayqeh + SequenceFlow_0xt2xvx + + + + + + + + + + + + + + + + SequenceFlow_1vxpbd0 + SequenceFlow_03ayqeh + + + + SequenceFlow_12 + + + + SequenceFlow_12 + + + + + SequenceFlow_4 + + + + + + SequenceFlow_0y0jt4l + SequenceFlow_053qjfy + + + + + SequenceFlow_16mo99z + SequenceFlow_09lrk4q + SequenceFlow_2 + + + + + SequenceFlow_0baosqi + SequenceFlow_1eezqx8 + SequenceFlow_0k3fx7p + + + + SequenceFlow_16ff86u + SequenceFlow_08m0j98 + SequenceFlow_12mfil6 + + + + SequenceFlow_053qjfy + SequenceFlow_179tyul + SequenceFlow_0usxnlk + + + + SequenceFlow_0usxnlk + SequenceFlow_16mo99z + SequenceFlow_06ev8or + + + + SequenceFlow_2 + SequenceFlow_0baosqi + SequenceFlow_1cdfjed + + + + + + + + + + + + + + + + + + + + SequenceFlow_0nob5cp + SequenceFlow_0v0u7mf + + + + + + + + + + SequenceFlow_0k3fx7p + SequenceFlow_17g62fl + SequenceFlow_06ajc11 + + + + SequenceFlow_1c79909 + SequenceFlow_1urpp94 + SequenceFlow_08m0j98 + + + SequenceFlow_12mfil6 + SequenceFlow_0u6ho2p + SequenceFlow_0k3zxpd + + + + SequenceFlow_0vpd06n + SequenceFlow_1c022sy + SequenceFlow_05omwbu + SequenceFlow_18lemf9 + + + + SequenceFlow_0v0u7mf + SequenceFlow_1qr8msw + SequenceFlow_05gpym3 + SequenceFlow_0vpd06n + SequenceFlow_0rlmex7 + + + SequenceFlow_05gpym3 + SequenceFlow_19myx3o + SequenceFlow_1c022sy + SequenceFlow_0ueoglv + SequenceFlow_15fqlwe + SequenceFlow_0yuj0l5 + SequenceFlow_1abb030 + SequenceFlow_0ls3ej5 + SequenceFlow_1ar6ikk + SequenceFlow_0t53vux + SequenceFlow_11ck4qe + SequenceFlow_16d2ln4 + SequenceFlow_1quapjx + SequenceFlow_101n488 + + + + + + + + + + SequenceFlow_06ev8or + + + + + + SequenceFlow_0zzwdwf + SequenceFlow_06ajc11 + SequenceFlow_076leae + + + + SequenceFlow_076leae + SequenceFlow_0du9273 + SequenceFlow_0zh8r6j + + + + SequenceFlow_0nob5cp + + + + SequenceFlow_1cdfjed + + + + + + + SequenceFlow_17g62fl + + + + + + + SequenceFlow_0zh8r6j + + + + + + + SequenceFlow_09lrk4q + + + + + + SequenceFlow_1eezqx8 + + + + SequenceFlow_0zzwdwf + + + + + + + SequenceFlow_0du9273 + SequenceFlow_032tm9y + SequenceFlow_179z9vl + + + + + SequenceFlow_032tm9y + + + + SequenceFlow_179z9vl + SequenceFlow_1cjiv6i + SequenceFlow_1q3oxtf + + + + SequenceFlow_1q3oxtf + + + + + + + SequenceFlow_1wqinjh + + + + + + + SequenceFlow_1urpp94 + + + + SequenceFlow_1colra4 + + + + SequenceFlow_1tzax6l + SequenceFlow_3 + SequenceFlow_0w8mkkn + + + + SequenceFlow_0u6ho2p + SequenceFlow_09xxorv + SequenceFlow_1tzax6l + + + + + SequenceFlow_16ff86u + + + + + + + + SequenceFlow_0k3zxpd + + + + SequenceFlow_09xxorv + + + + + + + + SequenceFlow_0w8mkkn + + + + SequenceFlow_07uuj2d + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_0ueoglv + + + + SequenceFlow_15fqlwe + + + + SequenceFlow_0yuj0l5 + + + + SequenceFlow_1abb030 + + + + SequenceFlow_0ls3ej5 + + + + SequenceFlow_1quapjx + + + + + + + SequenceFlow_1ar6ikk + + + + SequenceFlow_0t53vux + + + + SequenceFlow_11ck4qe + + + + SequenceFlow_16d2ln4 + + + + SequenceFlow_179tyul + + + + + + + + SequenceFlow_101n488 + + + + + SequenceFlow_16igl7b + + + + + + SequenceFlow_0wfzjs1 + SequenceFlow_188a7lk + SequenceFlow_12konw1 + + + SequenceFlow_0lpreg4 + SequenceFlow_0q1skau + SequenceFlow_1s3pbww + + + + + + + + + SequenceFlow_12konw1 + + + + + + + SequenceFlow_1s3pbww + + + + + + + + + + + + + + + + + + + + + SequenceFlow_1cjiv6i + SequenceFlow_1colra4 + SequenceFlow_0wfzjs1 + + + + + + + + + + + + + + + + + SequenceFlow_16igl7b + SequenceFlow_0q1skau + SequenceFlow_1c79909 + + + + + + + + + + + + + + SequenceFlow_188a7lk + SequenceFlow_1wqinjh + SequenceFlow_0lpreg4 + + + + + + SequenceFlow_0rlmex7 + SequenceFlow_1xwgemy + + + + SequenceFlow_1nm4wr1 + SequenceFlow_19myx3o + SequenceFlow_05omwbu + + + + + + + SequenceFlow_1xwgemy + SequenceFlow_1nm4wr1 + + PT1M + + + + + + + + + + + + + + + + + SequenceFlow_1qr8msw + SequenceFlow_18lemf9 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/VnfInPlaceUpdate.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/VnfInPlaceUpdate.bpmn new file mode 100644 index 0000000000..b6361aaa20 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/VnfInPlaceUpdate.bpmn @@ -0,0 +1,2290 @@ + + + + + SequenceFlow_5 + SequenceFlow_0y0jt4l + + + + + SequenceFlow_4 + SequenceFlow_5 + + + + + + + + + + + SequenceFlow_17 + SequenceFlow_14 + + + + SequenceFlow_6 + + + + SequenceFlow_14 + SequenceFlow_6 + + + + + SequenceFlow_3 + SequenceFlow_07uuj2d + SequenceFlow_17 + + + + + + SequenceFlow_1 + + + + + SequenceFlow_0ib8gb8 + SequenceFlow_7 + + + + + + + + + + + SequenceFlow_7 + SequenceFlow_19 + + + SequenceFlow_19 + + + + + + + + + + + + + + + + + + + + SequenceFlow_0hvg70o + SequenceFlow_1qnzi6i + + + + SequenceFlow_1 + SequenceFlow_0hvg70o + + + + + SequenceFlow_1qnzi6i + SequenceFlow_0ib8gb8 + + + + + SequenceFlow_12 + + + + SequenceFlow_12 + + + + + SequenceFlow_4 + + + + + + SequenceFlow_0y0jt4l + SequenceFlow_053qjfy + + + + + SequenceFlow_16mo99z + SequenceFlow_09lrk4q + SequenceFlow_2 + + + + + SequenceFlow_0baosqi + SequenceFlow_1eezqx8 + SequenceFlow_0k3fx7p + + + + SequenceFlow_1nr9o85 + SequenceFlow_16ff86u + SequenceFlow_12mfil6 + + + + SequenceFlow_053qjfy + SequenceFlow_179tyul + SequenceFlow_0usxnlk + + + + + + + + + + SequenceFlow_0usxnlk + SequenceFlow_16mo99z + SequenceFlow_06ev8or + + + + SequenceFlow_2 + SequenceFlow_0baosqi + SequenceFlow_1cdfjed + + + + + + + + + + + + + + + + + + + + SequenceFlow_0nob5cp + SequenceFlow_0v0u7mf + + + + + + + + + + SequenceFlow_0k3fx7p + SequenceFlow_17g62fl + SequenceFlow_06ajc11 + + + + + SequenceFlow_0a6pdza + SequenceFlow_0q0qan8 + SequenceFlow_02mk8vs + + + + SequenceFlow_13h26h9 + SequenceFlow_1c0vdki + SequenceFlow_11o5j55 + + + + SequenceFlow_1uno5rs + SequenceFlow_162mm0m + SequenceFlow_1gagrha + + + + SequenceFlow_1c79909 + SequenceFlow_1urpp94 + SequenceFlow_1c2xyhk + + + SequenceFlow_12mfil6 + SequenceFlow_0u6ho2p + SequenceFlow_0k3zxpd + + + + SequenceFlow_0vpd06n + SequenceFlow_1c022sy + SequenceFlow_0h64c4o + SequenceFlow_0syfgbo + + + + SequenceFlow_0v0u7mf + SequenceFlow_1qr8msw + SequenceFlow_05gpym3 + SequenceFlow_0vpd06n + SequenceFlow_1ijc733 + + + SequenceFlow_05gpym3 + SequenceFlow_1kntfys + SequenceFlow_1nlqlwn + SequenceFlow_1c022sy + SequenceFlow_0ueoglv + SequenceFlow_15fqlwe + SequenceFlow_0yuj0l5 + SequenceFlow_1abb030 + SequenceFlow_0ls3ej5 + SequenceFlow_1ar6ikk + SequenceFlow_171iq7e + SequenceFlow_1553o9f + SequenceFlow_0dmxwel + SequenceFlow_1id2p8y + SequenceFlow_0t53vux + SequenceFlow_11ck4qe + SequenceFlow_16d2ln4 + SequenceFlow_1quapjx + SequenceFlow_101n488 + SequenceFlow_021ah63 + + + + + + + + + + + + + + SequenceFlow_06ev8or + + + + + + SequenceFlow_0zzwdwf + SequenceFlow_06ajc11 + SequenceFlow_076leae + + + + SequenceFlow_076leae + SequenceFlow_0du9273 + SequenceFlow_0zh8r6j + + + + SequenceFlow_0nob5cp + + + + SequenceFlow_1cdfjed + + + + + + + SequenceFlow_17g62fl + + + + + + + SequenceFlow_0zh8r6j + + + + + + + SequenceFlow_09lrk4q + + + + + + SequenceFlow_1eezqx8 + + + + SequenceFlow_0zzwdwf + + + + + + + SequenceFlow_0du9273 + SequenceFlow_032tm9y + SequenceFlow_179z9vl + + + + + SequenceFlow_032tm9y + + + + SequenceFlow_179z9vl + SequenceFlow_1cjiv6i + SequenceFlow_1q3oxtf + + + + SequenceFlow_1q3oxtf + + + + + + + SequenceFlow_1j81s6b + + + + + + + SequenceFlow_16t9vai + + + + + SequenceFlow_02mk8vs + + + + + + + SequenceFlow_1urt6le + + + + + SequenceFlow_11o5j55 + + + + + + + SequenceFlow_19ba94v + SequenceFlow_1fuaq5k + SequenceFlow_04gth9f + + + + SequenceFlow_0if6xj4 + + + + + + + + SequenceFlow_04gth9f + + + + + SequenceFlow_1v59be9 + + + + SequenceFlow_04rprct + SequenceFlow_1uceq96 + SequenceFlow_0txgesu + + + + SequenceFlow_1uceq96 + + + + + + + + + SequenceFlow_0trguug + SequenceFlow_1q3bwlt + SequenceFlow_1xg6pwh + + + + SequenceFlow_1xfbwpi + SequenceFlow_1nr9o85 + SequenceFlow_0ttowkv + + + + SequenceFlow_1gagrha + + + + + + + + SequenceFlow_16igl7b + + + + + + + SequenceFlow_1urpp94 + + + + + SequenceFlow_0yja56j + + + + + + + + SequenceFlow_1xg6pwh + + + + SequenceFlow_1hwtq9x + + + + + + + + SequenceFlow_0ttowkv + + + + SequenceFlow_1colra4 + + + + + SequenceFlow_1tzax6l + SequenceFlow_3 + SequenceFlow_0w8mkkn + + + + SequenceFlow_0u6ho2p + SequenceFlow_09xxorv + SequenceFlow_1tzax6l + + + + + SequenceFlow_16ff86u + + + + + + + + SequenceFlow_0k3zxpd + + + + SequenceFlow_09xxorv + + + + + + + + SequenceFlow_0w8mkkn + + + + SequenceFlow_07uuj2d + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_0ueoglv + + + + SequenceFlow_15fqlwe + + + + SequenceFlow_0yuj0l5 + + + + SequenceFlow_1abb030 + + + + SequenceFlow_0ls3ej5 + + + + SequenceFlow_1quapjx + + + + + + + SequenceFlow_1ar6ikk + + + + SequenceFlow_1nlqlwn + + + + SequenceFlow_171iq7e + + + + SequenceFlow_1553o9f + + + + SequenceFlow_0dmxwel + + + + SequenceFlow_1id2p8y + + + + SequenceFlow_0t53vux + + + + SequenceFlow_11ck4qe + + + + SequenceFlow_16d2ln4 + + + + SequenceFlow_179tyul + + + + + + + + SequenceFlow_101n488 + + + + SequenceFlow_1ood2pr + + + + + + + + + + + + + + + + + + SequenceFlow_1c0vdki + SequenceFlow_0if6xj4 + SequenceFlow_19ba94v + + + + + + + + + + + + + + SequenceFlow_1cjiv6i + SequenceFlow_1ood2pr + SequenceFlow_0xx8y1s + + + + + + + + + + + + + + SequenceFlow_1q3bwlt + SequenceFlow_1hwtq9x + SequenceFlow_1xfbwpi + + + + + + + + + + + + + + + SequenceFlow_0qy68ib + SequenceFlow_16t9vai + SequenceFlow_0a6pdza + + + + + + + + + + + + + + + SequenceFlow_162mm0m + SequenceFlow_16igl7b + SequenceFlow_1c79909 + + + SequenceFlow_021ah63 + + + + + + + SequenceFlow_1ijc733 + SequenceFlow_0ai205d + + + + SequenceFlow_0a2cv6d + SequenceFlow_1kntfys + SequenceFlow_0h64c4o + + + SequenceFlow_0ai205d + SequenceFlow_0a2cv6d + + PT1M + + + + + + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_1qr8msw + SequenceFlow_0syfgbo + + + + + + + + + + + + + + + + + SequenceFlow_0q0qan8 + SequenceFlow_1urt6le + SequenceFlow_13h26h9 + + + + + + + + + + + + + + + SequenceFlow_1fuaq5k + SequenceFlow_1v59be9 + SequenceFlow_04rprct + + + + + + + + + + + + + + + SequenceFlow_0txgesu + SequenceFlow_1colra4 + SequenceFlow_1uno5rs + + + + + + + + + + + + + + + + SequenceFlow_1c2xyhk + SequenceFlow_0yja56j + SequenceFlow_0trguug + + + SequenceFlow_0xx8y1s + SequenceFlow_1j81s6b + SequenceFlow_0qy68ib + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/CreateServiceInstanceV3.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/CreateServiceInstanceV3.bpmn new file mode 100644 index 0000000000..dcb5323fa5 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/CreateServiceInstanceV3.bpmn @@ -0,0 +1,146 @@ + + + + + SequenceFlow_055igqy + + + + SequenceFlow_055igqy + SequenceFlow_0n3aqvm + + + SequenceFlow_011vkoq + + + + SequenceFlow_0n3aqvm + SequenceFlow_1knhaka + + + + + + SequenceFlow_1knhaka + SequenceFlow_1wvh54c + + + SequenceFlow_1wvh54c + SequenceFlow_011vkoq + + + + + SequenceFlow_1lli2e6 + + + + SequenceFlow_1hm0qrs + + + + + + + + SequenceFlow_1hm0qrs + SequenceFlow_1lli2e6 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/CreateServiceInstanceV3Rollback.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/CreateServiceInstanceV3Rollback.bpmn new file mode 100644 index 0000000000..392ebd7ac8 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/CreateServiceInstanceV3Rollback.bpmn @@ -0,0 +1,97 @@ + + + + + SequenceFlow_15a3kpo + + + + SequenceFlow_0dqe5xo + + + + SequenceFlow_15a3kpo + SequenceFlow_0dqe5xo + + + + SequenceFlow_10szwpv + + + + + SequenceFlow_05g9m3e + + + + SequenceFlow_10szwpv + SequenceFlow_05g9m3e + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateServiceInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateServiceInstance.bpmn index 19fd490b9f..7b2ededb6f 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateServiceInstance.bpmn +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateServiceInstance.bpmn @@ -9,7 +9,7 @@ SequenceFlow_2 SequenceFlow_3 @@ -17,8 +17,8 @@ dcsi.getAAICustomerById(execution)]]> SequenceFlow_1 SequenceFlow_2 @@ -26,14 +26,14 @@ dcsi.preProcessRequest(execution) SequenceFlow_156ih25 SequenceFlow_14 SequenceFlow_9 SequenceFlow_10 @@ -80,22 +80,21 @@ dcsi.postProcessSDNCAssign(execution)]]> SequenceFlow_1uw2p9a SequenceFlow_1w01tqs - SequenceFlow_129ih1g + SequenceFlow_1jhzmzn - - + SequenceFlow_3 SequenceFlow_11fnnkb SequenceFlow_1uw2p9a - + SequenceFlow_0tgrn11 - + SequenceFlow_1xzgv5k @@ -117,8 +116,8 @@ dcsi.postProcessSDNCAssign(execution)]]> SequenceFlow_0tgrn11 SequenceFlow_1lqktwf @@ -126,14 +125,14 @@ dcsi.preProcessRollback(execution) SequenceFlow_0eumzpf SequenceFlow_1xzgv5k - - SequenceFlow_1dd86x8 + + SequenceFlow_0w5i6vf SequenceFlow_156ih25 SequenceFlow_00v4npo @@ -142,24 +141,16 @@ dcsi.postProcessRollback(execution) SequenceFlow_00v4npo - + SequenceFlow_4 SequenceFlow_1w01tqs - - SequenceFlow_129ih1g - SequenceFlow_1dd86x8 - - - @@ -179,10 +170,53 @@ ddsi.postProcessAAIPUT(execution)]]> SequenceFlow_0tx5frq SequenceFlow_01q6pl4 - + + SequenceFlow_1jhzmzn + SequenceFlow_16sdyz9 + + + + + SequenceFlow_16sdyz9 + SequenceFlow_0k0wn03 + + + + SequenceFlow_0k0wn03 + SequenceFlow_0w5i6vf + + + + + + + + SequenceFlow_0x48any + SequenceFlow_052o4xc + + + + SequenceFlow_0x48any + + + + SequenceFlow_052o4xc + + + + @@ -215,9 +249,9 @@ dcsi.postProcessAAIGET2(execution)]]> - + - + @@ -228,13 +262,13 @@ dcsi.postProcessAAIGET2(execution)]]> - + - + - + @@ -244,28 +278,24 @@ dcsi.postProcessAAIGET2(execution)]]> - - - - + + - + - - - - + + - + - - + + - + @@ -274,17 +304,10 @@ dcsi.postProcessAAIGET2(execution)]]> - - - - - - - - + @@ -335,31 +358,31 @@ dcsi.postProcessAAIGET2(execution)]]> - + - + - - - - + + - + - + - + - - + + + + - + @@ -374,16 +397,6 @@ dcsi.postProcessAAIGET2(execution)]]> - - - - - - - - - - @@ -407,25 +420,96 @@ dcsi.postProcessAAIGET2(execution)]]> - + - - + + - + - - + + + + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateServiceInstanceRollback.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateServiceInstanceRollback.bpmn index 6c24696cbd..ef5ce351d2 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateServiceInstanceRollback.bpmn +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateServiceInstanceRollback.bpmn @@ -1,5 +1,5 @@ - + SequenceFlow_1 @@ -35,20 +35,6 @@ rbk.processRollbackException(execution)]]> - - - - - - - - - - - - SequenceFlow_1x9eh33 - SequenceFlow_05wu9i7 - SequenceFlow_06aasqh SequenceFlow_11fnnkb @@ -66,10 +52,6 @@ rbk.processRollbackException(execution)]]> SequenceFlow_1x9eh33 - - - - @@ -98,9 +80,9 @@ rbk.validateSDNCResponse(execution, response, "deactivate")]]> SequenceFlow_1rzlaoy - SequenceFlow_05wu9i7 SequenceFlow_1n7wade SequenceFlow_1rzlaoy + SequenceFlow_0h3wkj4 SequenceFlow_01l4ssl + + SequenceFlow_1x9eh33 + SequenceFlow_0h3wkj4 + + + + + @@ -208,9 +198,6 @@ rbk.validateSDNCResponse(execution, response, "delete")]]> - - - @@ -247,20 +234,6 @@ rbk.validateSDNCResponse(execution, response, "delete")]]> - - - - - - - - - - - - - - @@ -374,6 +347,27 @@ rbk.validateSDNCResponse(execution, response, "delete")]]> + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateServiceInstanceRollbackV2.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateServiceInstanceRollbackV2.bpmn new file mode 100644 index 0000000000..7853aa9586 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateServiceInstanceRollbackV2.bpmn @@ -0,0 +1,103 @@ + + + + + SequenceFlow_0r35zfs + + + + SequenceFlow_1f949uf + + + + SequenceFlow_0r35zfs + SequenceFlow_1f949uf + + + + + SequenceFlow_1tnfu1n + + + + + SequenceFlow_0hi9120 + + + + SequenceFlow_1tnfu1n + SequenceFlow_0hi9120 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateServiceInstanceV2.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateServiceInstanceV2.bpmn new file mode 100644 index 0000000000..251af54305 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateServiceInstanceV2.bpmn @@ -0,0 +1,197 @@ + + + + + SequenceFlow_0g8qp84 + + + + + SequenceFlow_0ekno6w + SequenceFlow_1t50vt9 + SequenceFlow_0xhy3o1 + + + + + + + SequenceFlow_0xhy3o1 + + + + SequenceFlow_0eryvle + + + + SequenceFlow_0g8qp84 + SequenceFlow_0651nnp + + + + SequenceFlow_0651nnp + SequenceFlow_0u0ptz7 + + + + SequenceFlow_0u0ptz7 + SequenceFlow_0ekno6w + + + + SequenceFlow_1t50vt9 + SequenceFlow_0eryvle + + + + + SequenceFlow_0mk8fd7 + + + + SequenceFlow_14mdxgk + + + + + + + + + + SequenceFlow_0mk8fd7 + SequenceFlow_14mdxgk + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateVfModule.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateVfModule.bpmn index 5383dc871e..e6d25a4b9f 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateVfModule.bpmn +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateVfModule.bpmn @@ -75,7 +75,7 @@ SequenceFlow_20 - SequenceFlow_22 + SequenceFlow_1nh92s8 - SequenceFlow_22 + SequenceFlow_0p61zug + SequenceFlow_0aegg0r SequenceFlow_23 SequenceFlow_23 SequenceFlow_24 - @@ -174,12 +174,9 @@ doCreateVfModule.validateSDNCResponse(execution, response, "activate")]]> SequenceFlow_14 - SequenceFlow_28 SequenceFlow_30 + SequenceFlow_28 - - - @@ -320,7 +317,7 @@ return doCreateVfModule.queryCloudRegion(execution)]]> def doCreateVfModule = new DoCreateVfModule() doCreateVfModule.preProcessRequest(execution)]]> - + SequenceFlow_1f53tby SequenceFlow_0270n5c @@ -453,7 +450,8 @@ doCreateVfModule.validateSDNCResponse(execution, response, "get")]]> - SequenceFlow_4 + SequenceFlow_1y1ttqe + SequenceFlow_0lilmm3 SequenceFlow_0270n5c SequenceFlow_05og7iw @@ -492,6 +490,7 @@ doCreateVfModule.validateSDNCResponse(execution, response, "get")]]> + SequenceFlow_1i1q78e SequenceFlow_0112l2c @@ -532,6 +531,174 @@ doCreateVfModule.processBPMNException(execution)]]> + + SequenceFlow_0cc17yk + SequenceFlow_17cp3tn + SequenceFlow_006rnym + + + + + + SequenceFlow_4 + SequenceFlow_1y1ttqe + SequenceFlow_1y8q87e + + + + SequenceFlow_1sf1091 + SequenceFlow_0lilmm3 + SequenceFlow_15i583d + + + + + + + + + + + SequenceFlow_00bh7m7 + + + + + + + SequenceFlow_1nh92s8 + SequenceFlow_16mgvsd + SequenceFlow_1iyt5i4 + + + + + + + + + + + + + + + + + + + SequenceFlow_0ynd0iy + SequenceFlow_1mnipp8 + + + SequenceFlow_17cp3tn + SequenceFlow_0ynd0iy + + + + SequenceFlow_16mgvsd + SequenceFlow_0cc17yk + + + + SequenceFlow_1y8q87e + SequenceFlow_1sf1091 + + + + SequenceFlow_1mnipp8 + SequenceFlow_00bh7m7 + + + + SequenceFlow_15i583d + SequenceFlow_0tfrcnc + SequenceFlow_0oadvvx + + + + + + + SequenceFlow_0tfrcnc + SequenceFlow_0c6p4aa + SequenceFlow_1qzw172 + + + + + + SequenceFlow_1qzw172 + SequenceFlow_0xed5sn + SequenceFlow_0p3cspl + + + + + + + SequenceFlow_0xed5sn + SequenceFlow_1k7xbcu + SequenceFlow_0p61zug + + + + + SequenceFlow_0oadvvx + SequenceFlow_03batve + + + + + + + + + + + + + + SequenceFlow_03batve + SequenceFlow_0c6p4aa + + + SequenceFlow_0p3cspl + SequenceFlow_1k7xbcu + + + + SequenceFlow_006rnym + SequenceFlow_1iyt5i4 + SequenceFlow_0thm33s + + + + + + + + + + SequenceFlow_0thm33s + SequenceFlow_0aegg0r + + + @@ -560,16 +727,16 @@ doCreateVfModule.processBPMNException(execution)]]> - + - + - + @@ -594,53 +761,44 @@ doCreateVfModule.processBPMNException(execution)]]> - + - + - + - + - + - + - - - - - - - - - + - + - - - - + + + + - + - - - - + + + - + @@ -693,9 +851,9 @@ doCreateVfModule.processBPMNException(execution)]]> - + - + @@ -747,134 +905,140 @@ doCreateVfModule.processBPMNException(execution)]]> - + - + - - - - - - - - - - + + + + + + + - - - - + + + + - + - + - + - + - - + + - + - - + + - + - - - - + + + + - + - - + + - + - - - - + + + + - + - + - + - - + + - + - + - + - + - + - + - - + + - + - + - + - - - - + + + + + + + - - + + + + + - - + + + + + @@ -928,13 +1092,13 @@ doCreateVfModule.processBPMNException(execution)]]> - + - - + + - + @@ -970,110 +1134,109 @@ doCreateVfModule.processBPMNException(execution)]]> - + - + - - + + - + - - - + + + - + - - + + - + - - - - + + + - + - + - + - + - + - + - - - + + + - + - - - - + + + + - + - - - + + + - + - - + + - + - - - - + + + + - + - - + + - + - + - + @@ -1133,123 +1296,406 @@ doCreateVfModule.processBPMNException(execution)]]> - - - + + + - + - + - + - - + + - + - - - + + + - + - + - + - + - + - + - + - + - + - + - - + + - + - - - - + + + + - + - - + + - + - - + + - + - + - + - - + + - + - - - + + + - + - + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - \ No newline at end of file + diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateVfModuleRollback.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateVfModuleRollback.bpmn index cb6538c73a..d9f1dc71fb 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateVfModuleRollback.bpmn +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateVfModuleRollback.bpmn @@ -10,13 +10,6 @@ SequenceFlow_6 SequenceFlow_9 - - SequenceFlow_6 - SequenceFlow_7 - - @@ -24,13 +17,12 @@ dcvfmr.preProcessRequest(execution)]]> - SequenceFlow_7 + SequenceFlow_6 SequenceFlow_8 - - + + - @@ -57,12 +49,11 @@ dcvfmr.prepVNFAdapterRequest(execution)]]> SequenceFlow_16 - SequenceFlow_11 + SequenceFlow_08aruzz - SequenceFlow_13 @@ -83,8 +74,7 @@ dcvfmr.prepUpdateAAIVfModule(execution)]]> - SequenceFlow_11 - SequenceFlow_03i4czf + SequenceFlow_1gcfdej SequenceFlow_13 SequenceFlow_17 @@ -256,7 +246,7 @@ dcvfmr.preProcessUpdateAAIGenericVnf(execution)]]> - + SequenceFlow_5 SequenceFlow_11er1t8 @@ -351,11 +341,41 @@ dcvfmr.sdncValidateResponse(execution, response)]]> SequenceFlow_21 SequenceFlow_35 + SequenceFlow_17it51d SequenceFlow_1h8ve60 + + SequenceFlow_03i4czf + SequenceFlow_08aruzz + SequenceFlow_1gcfdej + SequenceFlow_17ne2iz + + + + + + + + + + + + + + SequenceFlow_0fvuowt + SequenceFlow_17it51d + + + SequenceFlow_17ne2iz + SequenceFlow_0fvuowt + + + @@ -380,9 +400,6 @@ dcvfmr.setSuccessfulRollbackStatus(execution)]]> - - - @@ -397,10 +414,10 @@ dcvfmr.setSuccessfulRollbackStatus(execution)]]> - + - + @@ -443,9 +460,9 @@ dcvfmr.setSuccessfulRollbackStatus(execution)]]> - + - + @@ -461,19 +478,14 @@ dcvfmr.setSuccessfulRollbackStatus(execution)]]> - - - - - + + + + - + - - - - @@ -484,10 +496,10 @@ dcvfmr.setSuccessfulRollbackStatus(execution)]]> - + - + @@ -501,40 +513,31 @@ dcvfmr.setSuccessfulRollbackStatus(execution)]]> - + - + - - - - - - - - - - - - - + + + + - + - - + + - + - + - + @@ -549,28 +552,28 @@ dcvfmr.setSuccessfulRollbackStatus(execution)]]> - - + + - + - - - + + + - + - - + + - + - + @@ -580,7 +583,7 @@ dcvfmr.setSuccessfulRollbackStatus(execution)]]> - + @@ -588,7 +591,7 @@ dcvfmr.setSuccessfulRollbackStatus(execution)]]> - + @@ -627,40 +630,42 @@ dcvfmr.setSuccessfulRollbackStatus(execution)]]> - + - + - + - + - + - + - + - + - + - + - - + + + + - + @@ -743,9 +748,9 @@ dcvfmr.setSuccessfulRollbackStatus(execution)]]> - + - + @@ -756,32 +761,32 @@ dcvfmr.setSuccessfulRollbackStatus(execution)]]> - + - + - + - + - - + + - + - - + + - + @@ -907,15 +912,67 @@ dcvfmr.setSuccessfulRollbackStatus(execution)]]> - - + + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - \ No newline at end of file + diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateVfModuleVolumeV2.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateVfModuleVolumeV2.bpmn index 693fd36575..18e972c0a9 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateVfModuleVolumeV2.bpmn +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateVfModuleVolumeV2.bpmn @@ -1,5 +1,5 @@ - + SequenceFlow_1 @@ -21,7 +21,7 @@ doCreateVfModuleVolumeV2.executeMethod('callRESTQueryAAICloudRegion', execution, SequenceFlow_7 +doCreateVfModuleVolumeV2.executeMethod('buildWorkflowException', execution, 2500, "Volume group name already exists in the system.", isDebugLogEnabled)]]> diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateVnf.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateVnf.bpmn index 5aa4d22b0c..9bf3972523 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateVnf.bpmn +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateVnf.bpmn @@ -31,6 +31,7 @@ exceptionUtil.buildWorkflowException(execution, 404, "Service Instance Not Found + SequenceFlow_2 SequenceFlow_4 diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateVnfAndModules.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateVnfAndModules.bpmn index a90c816bc3..675b8fadb5 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateVnfAndModules.bpmn +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateVnfAndModules.bpmn @@ -39,6 +39,7 @@ doCreateVnfAndModules.preProcessRequest(execution)]]> + SequenceFlow_1hf7k7q SequenceFlow_1ixcnb6 @@ -73,6 +74,7 @@ doCreateVnfAndModules.preProcessRequest(execution)]]> + SequenceFlow_1lh21yl SequenceFlow_1llbx0k @@ -484,4 +486,4 @@ doCreateVnfAndModules.postProcessAddOnModule(execution)]]> - \ No newline at end of file + diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateVnfAndModulesRollback.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateVnfAndModulesRollback.bpmn index aa362021e0..57baf6ebe5 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateVnfAndModulesRollback.bpmn +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateVnfAndModulesRollback.bpmn @@ -84,6 +84,7 @@ dcvamr.preProcessCreateVfModuleRollback(execution)]]> + SequenceFlow_1ycq005 SequenceFlow_181hb2a @@ -537,4 +538,4 @@ dcvamr.setSuccessfulRollbackStatus(execution)]]> - \ No newline at end of file + diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCustomDeleteE2EServiceInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCustomDeleteE2EServiceInstance.bpmn index 095948a87c..561a84b7c4 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCustomDeleteE2EServiceInstance.bpmn +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCustomDeleteE2EServiceInstance.bpmn @@ -118,7 +118,7 @@ ddsi.preInitResourcesOperStatus(execution)]]> - ${URN_mso_openecomp_adapters_db_endpoint} + ${URN_mso_adapters_openecomp_db_endpoint} application/soap+xml diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteServiceInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteServiceInstance.bpmn index 10f688b30f..e5b18a1303 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteServiceInstance.bpmn +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteServiceInstance.bpmn @@ -74,15 +74,15 @@ ddsi.preProcessSDNCDelete(execution)]]> - + SequenceFlow_1hcfvcj SequenceFlow_0riudmc SequenceFlow_1dwch0k - - + + - + @@ -255,7 +255,7 @@ ddsi.postProcessSDNCDelete(execution, response, "delete")]]> - + @@ -264,7 +264,7 @@ ddsi.postProcessSDNCDelete(execution, response, "delete")]]> - + @@ -272,7 +272,7 @@ ddsi.postProcessSDNCDelete(execution, response, "delete")]]> - + diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteVfModule.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteVfModule.bpmn index b8c6aa32a4..f147639a59 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteVfModule.bpmn +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteVfModule.bpmn @@ -27,8 +27,8 @@ dvm.prepUpdateAAIVfModule(execution)]]> - SequenceFlow_42 - SequenceFlow_1j9dvfx + SequenceFlow_029ioyr + SequenceFlow_14xn858 @@ -46,7 +46,7 @@ dvm.prepUpdateAAIVfModule(execution)]]> - SequenceFlow_1j9dvfx + SequenceFlow_14xn858 SequenceFlow_4 SequenceFlow_4 - SequenceFlow_01cvxjf + SequenceFlow_1xruki1 SequenceFlow_35 @@ -117,7 +117,7 @@ dvm.preProcessRequest(execution)]]> def dvm = new DoDeleteVfModule() dvm.preProcessRequest(execution)]]> - + SequenceFlow_1 @@ -130,10 +130,8 @@ dvm.preProcessRequest(execution)]]> def dvm = new DoDeleteVfModule() dvm.deleteNetworkPoliciesFromAAI(execution)]]> - - - SequenceFlow_01cvxjf + SequenceFlow_1xruki1 SequenceFlow_0coa90m SequenceFlow_1a7lzhz SequenceFlow_14l7olw + + + SequenceFlow_42 + SequenceFlow_029ioyr + + + + @@ -198,7 +206,7 @@ doDeleteVfModule.prepUpdateAAIGenericVnf(execution)]]> - + @@ -211,203 +219,215 @@ doDeleteVfModule.prepUpdateAAIGenericVnf(execution)]]> - + - + - + - + - - + + - + - + - + - + - + - - - - - + + + + + - + - - - - + + + + - + - - + + - + - - + + - + - + - + - - + + - + - + - + - - - - + + - + - + - - + + - + - + - - - - - - - - - - - - - - - - - - - + - - + + + + + + - + - + - + - - + + - + - - - + + + - + - - - - + + + + - + - + - + - - + + - + - - - + + + - + - - + + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteVnfAndModules.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteVnfAndModules.bpmn index 9850552a9e..d066d1e2e9 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteVnfAndModules.bpmn +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteVnfAndModules.bpmn @@ -68,6 +68,8 @@ exceptionUtil.processJavaException(execution)]]> + + SequenceFlow_1xujrk5 SequenceFlow_1p4ycii diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoUpdateVnfAndModules.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoUpdateVnfAndModules.bpmn index c110580f5c..609d630429 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoUpdateVnfAndModules.bpmn +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoUpdateVnfAndModules.bpmn @@ -68,6 +68,7 @@ exceptionUtil.processJavaException(execution)]]> + SequenceFlow_04o61yk SequenceFlow_1p4ycii diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/RollbackVnf.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/RollbackVnf.bpmn new file mode 100644 index 0000000000..2fa1fa932c --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/RollbackVnf.bpmn @@ -0,0 +1,343 @@ + + + + + SequenceFlow_0bie3cu + + + SequenceFlow_0mpoa26 + SequenceFlow_1pirwg0 + SequenceFlow_1lne8je + SequenceFlow_0tj5bkd + + + SequenceFlow_0tj5bkd + SequenceFlow_1ney8l6 + SequenceFlow_0gsro0z + SequenceFlow_0b2y2dw + + + SequenceFlow_0b2y2dw + SequenceFlow_11556y3 + SequenceFlow_0skjb2u + SequenceFlow_0c5ovtd + + + SequenceFlow_0g18wrd + SequenceFlow_0c5ovtd + SequenceFlow_12bz15k + SequenceFlow_03qkk4e + + + + + + + + + + + + + + + + + + + + + + SequenceFlow_0bie3cu + SequenceFlow_1ix4dpf + + + + + + + + + + + + SequenceFlow_1lne8je + SequenceFlow_1ney8l6 + + + + + + + + + + SequenceFlow_0gsro0z + SequenceFlow_11556y3 + + + SequenceFlow_0skjb2u + SequenceFlow_0g18wrd + + + + SequenceFlow_12bz15k + SequenceFlow_0tkvd6f + + + + SequenceFlow_1p3pyal + + + + + SequenceFlow_03qkk4e + SequenceFlow_0tkvd6f + SequenceFlow_1p3pyal + + + + + SequenceFlow_1ix4dpf + SequenceFlow_0mpoa26 + SequenceFlow_05ihl7f + + + + + + + + + + + + + + + + + SequenceFlow_05ihl7f + SequenceFlow_1pirwg0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/SetRefactorServiceDecomp.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/SetRefactorServiceDecomp.bpmn new file mode 100644 index 0000000000..c4f107b0b5 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/SetRefactorServiceDecomp.bpmn @@ -0,0 +1,68 @@ + + + + + SequenceFlow_1aizx5q + + + + SequenceFlow_1fypndb + + + + SequenceFlow_1aizx5q + SequenceFlow_1ipdcwj + + + + + + SequenceFlow_1ipdcwj + SequenceFlow_1fypndb + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/MSOInfrastructureBPMN/src/main/webapp/WEB-INF/web.xml b/bpmn/MSOInfrastructureBPMN/src/main/webapp/WEB-INF/web.xml index 907f511551..a357c2a6f3 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/webapp/WEB-INF/web.xml +++ b/bpmn/MSOInfrastructureBPMN/src/main/webapp/WEB-INF/web.xml @@ -25,13 +25,17 @@ org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher javax.ws.rs.Application - org.openecomp.mso.bpmn.infrastructure.workflow.service.WorkflowResourceApplication + org.openecomp.mso.bpmn.common.workflow.service.WorkflowResourceApplication resteasy-servlet /* + + contextConfigLocation + /WEB-INF/applicationContext.xml + mso.configuration MSO_PROP_TOPOLOGY=topology.properties @@ -44,6 +48,9 @@ resteasy.resources org.openecomp.mso.logger.MsoLoggingServlet,org.openecomp.mso.bpmn.core.HealthCheckHandler + + org.springframework.web.context.ContextLoaderListener + LogFilter org.openecomp.mso.logger.LogFilter -- cgit 1.2.3-korg