aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp')
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstance.groovy642
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateGenericALaCarteServiceInstance.groovy96
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateNetworkInstance.groovy24
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy8
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy31
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy27
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVfModuleVolumeInfraV1.groovy28
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVnfInfra.groovy81
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteCustomE2EServiceInstance.groovy96
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteGenericALaCarteServiceInstance.groovy18
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteNetworkInstance.groovy22
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteVfModuleInfra.groovy21
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteVfModuleVolumeInfraV1.groovy28
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteVnfInfra.groovy10
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCompareModelVersions.groovy256
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy22
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceRollback.groovy12
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstanceV2.groovy57
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy74
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollback.groovy12
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateServiceInstance.groovy290
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateServiceInstanceRollback.groovy12
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateServiceInstanceRollbackV2.groovy51
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateServiceInstanceV2.groovy101
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVfModule.groovy316
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVfModuleRollback.groovy50
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeRollback.groovy12
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVfModuleVolumeV2.groovy84
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVnf.groovy67
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVnfAndModules.groovy21
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVnfAndModulesRollback.groovy25
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstance.groovy20
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy66
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy44
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteNetworkInstanceRollback.groovy10
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy100
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy22
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVfModule.groovy112
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnf.groovy28
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2.groovy16
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVnf.groovy6
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVnfAndModules.groovy94
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy24
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateNetworkInstance.groovy62
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceRollback.groovy10
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateVfModule.groovy78
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy39
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/HealchCheckActivate.groovy6
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/ReplaceVnfInfra.groovy380
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/RollbackVnf.groovy153
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy12
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateNetworkInstance.groovy24
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateVfModule.groovy16
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateVfModuleInfra.groovy20
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateVfModuleInfraV2.groovy41
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy20
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1.groovy28
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateVnfInfra.groovy395
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/VnfCmBase.groovy806
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/VnfConfigUpdate.groovy503
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/VnfInPlaceUpdate.groovy622
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy1482
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy26
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy36
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollback.groovy16
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy36
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollback.groovy16
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRG.groovy26
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXC.groovy26
69 files changed, 5504 insertions, 2511 deletions
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 <class>CreateServiceInstance.bpmn</class> process.
- * AlaCarte flow for 1702 ServiceInstance Create
- *
- */
-public class CreateCustomE2EServiceInstance extends AbstractServiceTaskProcessor {
- String Prefix="CRESI_"
- ExceptionUtil exceptionUtil = new ExceptionUtil()
- JsonUtils jsonUtil = new JsonUtils()
-
-
- 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<String> 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 <class>CreateServiceInstance.bpmn</class> process.
+ * AlaCarte flow for 1702 ServiceInstance Create
+ *
+ */
+public class CreateCustomE2EServiceInstance extends AbstractServiceTaskProcessor {
+ String Prefix="CRESI_"
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+ JsonUtils jsonUtil = new JsonUtils()
+
+
+ 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<String, String> 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 =
"""<aetgt:WorkflowException xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1">
- <aetgt:ErrorMessage>${errorMessage}</aetgt:ErrorMessage>
- <aetgt:ErrorCode>7000</aetgt:ErrorCode>
- </aetgt:WorkflowException>"""
-
- utils.logAudit(buildworkflowException)
- sendWorkflowResponse(execution, 500, buildworkflowException)
-
- } catch (Exception ex) {
- utils.log("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 =
+ <aetgt:ErrorMessage>${errorMessage}</aetgt:ErrorMessage>
+ <aetgt:ErrorCode>7000</aetgt:ErrorCode>
+ </aetgt:WorkflowException>"""
+
+ utils.logAudit(buildworkflowException)
+ sendWorkflowResponse(execution, 500, buildworkflowException)
+
+ } catch (Exception ex) {
+ utils.log("DEBUG", " Sending Sync Error Activity Failed. " + "\n" + ex.getMessage(), isDebugEnabled)
+ }
+
+ }
+
+ public void prepareCompletionRequest (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 =
"""<aetgt:MsoCompletionRequest xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1"
xmlns:ns="http://org.openecomp/mso/request/types/v1">
<request-info xmlns="http://org.openecomp/mso/infra/vnf-request/v1">
- <request-id>${requestId}</request-id>
- <action>CREATE</action>
- <source>${source}</source>
- </request-info>
- <status-message>Service Instance was created successfully.</status-message>
- <serviceInstanceId>${serviceInstanceId}</serviceInstanceId>
- <mso-bpel-name>CreateGenericALaCarteServiceInstance</mso-bpel-name>
- </aetgt:MsoCompletionRequest>"""
-
- // Format Response
- String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest)
-
- execution.setVariable("completionRequest", xmlMsoCompletionRequest)
- utils.log("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 =
+ <request-id>${requestId}</request-id>
+ <action>CREATE</action>
+ <source>${source}</source>
+ </request-info>
+ <status-message>Service Instance was created successfully.</status-message>
+ <serviceInstanceId>${serviceInstanceId}</serviceInstanceId>
+ <mso-bpel-name>CreateGenericALaCarteServiceInstance</mso-bpel-name>
+ </aetgt:MsoCompletionRequest>"""
+
+ // Format Response
+ String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest)
+
+ execution.setVariable("completionRequest", xmlMsoCompletionRequest)
+ utils.log("DEBUG", " Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest, isDebugEnabled)
+
+ } catch (Exception ex) {
+ String msg = " Exception in prepareCompletion:" + ex.getMessage()
+ utils.log("DEBUG", msg, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ utils.log("DEBUG", "*** Exit prepareCompletionRequest ***", isDebugEnabled)
+ }
+
+ public void prepareFalloutRequest(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 =
"""<request-info xmlns="http://org.openecomp/mso/infra/vnf-request/v1">
- <request-id>${requestId}</request-id>
- <action>CREATE</action>
- <source>${source}</source>
- </request-info>"""
-
- String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo)
- execution.setVariable("falloutRequest", falloutRequest)
- } catch (Exception ex) {
- utils.log("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 =
+ <request-id>${requestId}</request-id>
+ <action>CREATE</action>
+ <source>${source}</source>
+ </request-info>"""
+
+ String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo)
+ execution.setVariable("falloutRequest", falloutRequest)
+ } catch (Exception ex) {
+ utils.log("DEBUG", "Exception prepareFalloutRequest:" + ex.getMessage(), isDebugEnabled)
+ String errorException = " Bpmn error encountered in CreateGenericALaCarteServiceInstance flow. FalloutHandlerRequest, buildErrorResponse() - " + ex.getMessage()
+ String requestId = execution.getVariable("msoRequestId")
+ String falloutRequest =
"""<aetgt:FalloutHandlerRequest xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1"
xmlns:ns="http://org.openecomp/mso/request/types/v1"
xmlns:wfsch="http://org.openecomp/mso/workflow/schema/v1">
<request-info xmlns="http://org.openecomp/mso/infra/vnf-request/v1">
- <request-id>${requestId}</request-id>
- <action>CREATE</action>
- <source>UUI</source>
- </request-info>
+ <request-id>${requestId}</request-id>
+ <action>CREATE</action>
+ <source>UUI</source>
+ </request-info>
<aetgt:WorkflowException xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1">
- <aetgt:ErrorMessage>${errorException}</aetgt:ErrorMessage>
- <aetgt:ErrorCode>7000</aetgt:ErrorCode>
- </aetgt:WorkflowException>
- </aetgt:FalloutHandlerRequest>"""
-
- execution.setVariable("falloutRequest", falloutRequest)
- }
- utils.log("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 =
- """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
- xmlns:ns="http://org.openecomp.mso/requestsdb">
- <soapenv:Header/>
- <soapenv:Body>
- <ns:updateServiceOperationStatus xmlns:ns="http://org.openecomp.mso/requestsdb">
- <serviceId>${serviceId}</serviceId>
- <operationId>${operationId}</operationId>
- <serviceName>${serviceName}</serviceName>
- <operationType>${operationType}</operationType>
- <userId>${userId}</userId>
- <result>${result}</result>
- <operationContent>${operationContent}</operationContent>
- <progress>${progress}</progress>
- <reason>${reason}</reason>
- </ns:updateServiceOperationStatus>
- </soapenv:Body>
- </soapenv:Envelope>"""
-
- 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)
- }
-
-}
+ <aetgt:ErrorMessage>${errorException}</aetgt:ErrorMessage>
+ <aetgt:ErrorCode>7000</aetgt:ErrorCode>
+ </aetgt:WorkflowException>
+ </aetgt:FalloutHandlerRequest>"""
+
+ 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 =
+ """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
+ xmlns:ns="http://org.openecomp.mso/requestsdb">
+ <soapenv:Header/>
+ <soapenv:Body>
+ <ns:updateServiceOperationStatus xmlns:ns="http://org.openecomp.mso/requestsdb">
+ <serviceId>${serviceId}</serviceId>
+ <operationId>${operationId}</operationId>
+ <operationType>${operationType}</operationType>
+ <userId>${userId}</userId>
+ <result>${result}</result>
+ <operationContent>${operationContent}</operationContent>
+ <progress>${progress}</progress>
+ <reason>${reason}</reason>
+ </ns:updateServiceOperationStatus>
+ </soapenv:Body>
+ </soapenv:Envelope>"""
+
+ 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<String, String> 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<String, String> 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 <class>CreateNetworkInstance.bpmn</class> 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<String, String> 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<String, String> 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<String, String> 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<String, String> 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 <class>DeleteVfModuleVolume.bpmn</class> 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 <class>DeleteVfModuleVolume.bpmn</class> 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/DoCompareModelVersions.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCompareModelVersions.groovy
new file mode 100644
index 0000000000..291df4608d
--- /dev/null
+++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCompareModelVersions.groovy
@@ -0,0 +1,256 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 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.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.domain.Resource
+import org.openecomp.mso.bpmn.core.domain.AllottedResource
+import org.openecomp.mso.bpmn.core.domain.NetworkResource
+import org.openecomp.mso.bpmn.core.domain.VnfResource
+import org.openecomp.mso.bpmn.common.recipe.ResourceInput
+import org.openecomp.mso.bpmn.common.recipe.BpmnRestClient
+import org.openecomp.mso.bpmn.core.json.JsonUtils
+import org.openecomp.mso.bpmn.common.scripts.AaiUtil
+import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil
+import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils
+import org.openecomp.mso.bpmn.common.scripts.CatalogDbUtils;
+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.List;
+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.*
+import org.apache.commons.codec.binary.Base64;
+import org.springframework.web.util.UriUtils;
+
+/**
+ * This groovy class supports the <class>DoCompareModelVersions.bpmn</class> process.
+ *
+ * Inputs:
+ * @param - model-invariant-id-target
+ * @param - model-version-id-target
+ * @param - model-invariant-id-original
+ * @param - model-version-id-original
+ *
+ * Outputs:
+ * @param - addResourceList
+ * @param - delResourceList
+ *
+ */
+public class DoCompareModelVersions extends AbstractServiceTaskProcessor {
+
+ String Prefix="DCMPMDV_"
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+ JsonUtils jsonUtil = new JsonUtils()
+ CatalogDbUtils cutils = new CatalogDbUtils()
+
+ public void preProcessRequest (DelegateExecution execution) {
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ String msg = ""
+ utils.log("INFO"," ***** preProcessRequest *****", isDebugEnabled)
+
+ try {
+ execution.setVariable("prefix", Prefix)
+
+ //Inputs
+ String modelInvariantUuid_target = execution.getVariable("model-invariant-id-target")
+ if (isBlank(modelInvariantUuid_target)) {
+ msg = "Input model-invariant-id-target is null"
+ utils.log("INFO", msg, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ }
+
+ String modelUuid_target = execution.getVariable("model-version-id-target")
+ if (isBlank(modelUuid_target)) {
+ msg = "Input model-version-id-target is null"
+ utils.log("INFO", msg, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ }
+
+ String modelInvariantUuid_original = execution.getVariable("model-invariant-id-original")
+ if (isBlank(modelInvariantUuid_original)) {
+ msg = "Input model-invariant-id-original is null"
+ utils.log("INFO", msg, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ }
+
+ String modelUuid_original = execution.getVariable("model-version-id-original")
+ if (isBlank(modelUuid_original)) {
+ msg = "Input model-version-id-original is null"
+ utils.log("INFO", msg, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ }
+
+ // Target and original modelInvariantUuid must to be the same
+ if(modelInvariantUuid_target != modelInvariantUuid_original){
+ msg = "Input model-invariant-id-target and model-invariant-id-original must to be the same"
+ utils.log("INFO", msg, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ }
+
+ // Target and original modelUuid must not to be the same
+ if(modelUuid_target == modelUuid_original){
+ msg = "Input model-version-id-target and model-version-id-original must not to be the same"
+ utils.log("INFO", msg, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ }
+
+ } 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 prepareDecomposeService_Target(Execution execution) {
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+
+ try {
+ utils.log("DEBUG", " ***** Inside prepareDecomposeService_Target of update generic e2e service ***** ", isDebugEnabled)
+ String modelInvariantUuid = execution.getVariable("model-invariant-id-target")
+ String modelUuid = execution.getVariable("model-version-id-target")
+ //here modelVersion is not set, we use modelUuid to decompose the service.
+ String serviceModelInfo = """{
+ "modelInvariantUuid":"${modelInvariantUuid}",
+ "modelUuid":"${modelUuid}",
+ "modelVersion":""
+ }"""
+ execution.setVariable("serviceModelInfo", serviceModelInfo)
+ execution.setVariable("serviceModelInfo_Target", serviceModelInfo)
+
+ utils.log("DEBUG", " ***** Completed prepareDecomposeService_Target of update generic e2e service ***** ", isDebugEnabled)
+ } catch (Exception ex) {
+ // try error in method block
+ String exceptionMessage = "Bpmn error encountered in update generic e2e service flow. Unexpected Error from method prepareDecomposeService_Target() - " + ex.getMessage()
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
+ }
+ }
+
+ public void processDecomposition_Target(Execution execution) {
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+
+ utils.log("DEBUG", " ***** Inside processDecomposition_Target() of update generic e2e service flow ***** ", isDebugEnabled)
+ try {
+ ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
+ execution.setVariable("serviceDecomposition_Target", serviceDecomposition)
+ } catch (Exception ex) {
+ String exceptionMessage = "Bpmn error encountered in update generic e2e service flow. Unexpected Error from method processDecomposition_Target() - " + ex.getMessage()
+ utils.log("DEBUG", exceptionMessage, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
+ }
+ }
+
+ public void prepareDecomposeService_Original(Execution execution) {
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+
+ try {
+ utils.log("DEBUG", " ***** Inside prepareDecomposeService_Original of update generic e2e service ***** ", isDebugEnabled)
+ String modelInvariantUuid = execution.getVariable("model-invariant-id-original")
+ String modelUuid = execution.getVariable("model-version-id-original")
+ //here modelVersion is not set, we use modelUuid to decompose the service.
+ String serviceModelInfo = """{
+ "modelInvariantUuid":"${modelInvariantUuid}",
+ "modelUuid":"${modelUuid}",
+ "modelVersion":""
+ }"""
+ execution.setVariable("serviceModelInfo", serviceModelInfo)
+ execution.setVariable("serviceModelInfo_Original", serviceModelInfo)
+
+ utils.log("DEBUG", " ***** Completed prepareDecomposeService_Original of update generic e2e service ***** ", isDebugEnabled)
+ } catch (Exception ex) {
+ // try error in method block
+ String exceptionMessage = "Bpmn error encountered in update generic e2e service flow. Unexpected Error from method prepareDecomposeService_Original() - " + ex.getMessage()
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
+ }
+ }
+
+ public void processDecomposition_Original(Execution execution) {
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+
+ utils.log("DEBUG", " ***** Inside processDecomposition_Original() of update generic e2e service flow ***** ", isDebugEnabled)
+ try {
+ ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
+ execution.setVariable("serviceDecomposition_Original", serviceDecomposition)
+ } catch (Exception ex) {
+ String exceptionMessage = "Bpmn error encountered in update generic e2e service flow. processDecomposition_Original() - " + ex.getMessage()
+ utils.log("DEBUG", exceptionMessage, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
+ }
+ }
+
+ public void doCompareModelVersions(execution){
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ utils.log("INFO", "======== Start doCompareModelVersions Process ======== ", isDebugEnabled)
+
+ ServiceDecomposition serviceDecomposition_Target = execution.getVariable("serviceDecomposition_Target")
+ ServiceDecomposition serviceDecomposition_Original = execution.getVariable("serviceDecomposition_Original")
+
+ List<Resource> allSR_target = serviceDecomposition_Target.getServiceResources();
+ List<Resource> allSR_original = serviceDecomposition_Original.getServiceResources();
+
+ List<Resource> addedResource = new ArrayList<String>()
+ List<Resource> delResource = new ArrayList<String>()
+
+ addResourceList.addAll(allSR_target)
+ delResourceList.addAll(allSR_original)
+
+ //Compare
+ for (Resource rc_t : allSR_target){
+ String muuid = rc_t.getModelInfo().getModelUuid()
+ String mIuuid = rc_t.getModelInfo().getModelInvariantUuid()
+ String mCuuid = rc_t.getModelInfo().getModelCustomizationUuid()
+ for (Resource rc_o : allSR_original){
+ if(rc_o.getModelInfo().getModelUuid() == muuid
+ && rc_o.getModelInfo().getModelInvariantUuid() == mIuuid
+ && rc_o.getModelInfo().getModelCustomizationUuid() == mCuuid) {
+ addResourceList.remove(rc_t);
+ delResourceList.remove(rc_o);
+ }
+ }
+ }
+
+ execution.setVariable("addResourceList", addResourceList)
+ execution.setVariable("delResourceList", delResourceList)
+ utils.log("INFO", "addResourceList: " + addResourceList, isDebugEnabled)
+ utils.log("INFO", "delResourceList: " + delResourceList, isDebugEnabled)
+
+ utils.log("INFO", "======== COMPLETED doCompareModelVersions Process ======== ", isDebugEnabled)
+ }
+
+}
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 586364e46d..b0630b04d6 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
@@ -53,7 +53,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.*
@@ -92,7 +92,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)
@@ -187,7 +187,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 {
@@ -210,7 +210,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)
@@ -223,11 +223,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 = ""
@@ -269,7 +269,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 = ""
@@ -307,7 +307,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 = ""
@@ -350,7 +350,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 {
@@ -371,7 +371,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 = ""
@@ -392,7 +392,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 <class>DoCreateServiceInstance.bpmn</class> 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 <class>DoCreateNetworkInstance.bpmn</class> 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 <class>DoCreateNetworkInstance.bpmn</class> 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 += "<routeTargets>" + routeTarget + "</routeTargets>" + '\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 += "<routeTargets>" + '\n' +
+ " <routeTarget>" + routeTarget + "</routeTarget>" + '\n' +
+ " <routeTargetRole>" + routeRole + "</routeTargetRole>" + '\n' +
+ "</routeTargets>" + '\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 <class>DoCreateNetworkInstanceRollback.bpmn</class> 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 <class>DoCreateNetworkInstanceRollback.bpmn</class> 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<String> 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<String, String> 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) ? "" : "<service-type>${serviceType}</service-type>"
String serviceRoleLine = isBlank(serviceRole) ? "" : "<service-role>${serviceRole}</service-role>"
+ //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}
<model-invariant-id>${modelInvariantUuid}</model-invariant-id>
<model-version-id>${modelUuid}</model-version-id>
+ <environment-context>${environmentContext}</environment-context>
+ <workload-context>${workloadContext}</workload-context>
</service-instance>""".trim()
execution.setVariable("serviceInstanceData", serviceInstanceData)
utils.logAudit(serviceInstanceData)
utils.log("DEBUG", " 'payload' to create Service Instance in AAI - " + "\n" + serviceInstanceData, isDebugEnabled)
-
+
} catch (BpmnError e) {
throw e;
} catch (Exception ex){
@@ -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 =
"""<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.openecomp/mso/request/types/v1"
xmlns:sdncadapterworkflow="http://org.openecomp/mso/workflow/schema/v1"
@@ -474,7 +530,7 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
<sdncadapter:SvcAction>assign</sdncadapter:SvcAction>
<sdncadapter:SvcOperation>service-topology-operation</sdncadapter:SvcOperation>
<sdncadapter:CallbackUrl>${callbackURL}</sdncadapter:CallbackUrl>
- <sdncadapter:MsoAction>${serviceType}</sdncadapter:MsoAction>
+ <sdncadapter:MsoAction>${msoAction}</sdncadapter:MsoAction>
</sdncadapter:RequestHeader>
<sdncadapterworkflow:SDNCRequestData>
<request-information>
@@ -488,12 +544,12 @@ public class DoCreateServiceInstance extends AbstractServiceTaskProcessor {
<service-information>
<service-id>${serviceId}</service-id>
<subscription-service-type>${subscriptionServiceType}</subscription-service-type>
- <onap-model-information>
+ <ecomp-model-information>
<model-invariant-uuid>${modelInvariantUuid}</model-invariant-uuid>
<model-uuid>${modelUuid}</model-uuid>
<model-version>${modelVersion}</model-version>
<model-name>${modelName}</model-name>
- </onap-model-information>
+ </ecomp-model-information>
<service-instance-id>${serviceInstanceId}</service-instance-id>
<subscriber-name/>
<global-customer-id>${globalSubscriberId}</global-customer-id>
@@ -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 <class>DoCreateServiceInstanceV2.bpmn</class> 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<String, Object> 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 = "<orchestration-status>Created</orchestration-status>"
+ orchestrationStatusString = "<orchestration-status>" + execution.getVariable("DCVFM_orchestrationStatus") + "</orchestration-status>"
}
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 = """<UpdateAAIVfModuleRequest>
+ <vnf-id>${vnfId}</vnf-id>
+ <vf-module-id>${vfModuleId}</vf-module-id>
+ <heat-stack-id></heat-stack-id>
+ <orchestration-status>Assigned</orchestration-status>
+ </UpdateAAIVfModuleRequest>""" 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 <class>DoCreateVfModuleVolumeRollback.bpmn</class> 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 <class>DoCreateVfModuleVolumeRollback.bpmn</class> 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 =
- """<rollbackVolumeGroupRequest>
- <cloudSiteId>${cloudSiteId}</cloudSiteId>
- <tenantId>${tenantId}</tenantId>
- <volumeGroupId>${volumeGroupId}</volumeGroupId>
- <skipAAI>true</skipAAI>
- <volumeGroupCreated>true</volumeGroupCreated>
- <msoRequest>
- <requestId>${requestId}</requestId>
- <serviceInstanceId>${serviceId}</serviceInstanceId>
- </msoRequest>
- <messageId>${messageId}</messageId>
- <notificationUrl>${notificationUrl}</notificationUrl>
- </rollbackVolumeGroupRequest>"""
+ 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 = """
+ <rollbackVolumeGroupRequest>
+ <volumeGroupRollback>
+ <volumeGroupId>${volumeGroupId}</volumeGroupId>
+ <volumeGroupStackId>{{VOLUMEGROUPSTACKID}}</volumeGroupStackId>
+ <tenantId>${tenantId}</tenantId>
+ <cloudSiteId>${cloudSiteId}</cloudSiteId>
+ <volumeGroupCreated>true</volumeGroupCreated>
+ <msoRequest>
+ <requestId>${requestId}</requestId>
+ <serviceInstanceId>${serviceId}</serviceInstanceId>
+ </msoRequest>
+ <messageId>${messageId}</messageId>
+ </volumeGroupRollback>
+ <skipAAI>true</skipAAI>
+ <notificationUrl>${notificationUrl}</notificationUrl>
+ </rollbackVolumeGroupRequest>
+ """
+
+ 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 =
"""<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy
index 4c3f6bc73c..03ba10a0c0 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy
+++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceV2.groovy
@@ -20,40 +20,22 @@
*/
package org.openecomp.mso.bpmn.infrastructure.scripts
-import org.json.JSONArray;
-
import static org.apache.commons.lang3.StringUtils.*;
-import groovy.xml.XmlUtil
-import groovy.json.*
-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.WorkflowException
+import org.openecomp.mso.bpmn.core.json.JsonUtils
import org.openecomp.mso.rest.APIResponse;
-import org.openecomp.mso.rest.RESTClient
-import org.openecomp.mso.rest.RESTConfig
-
-import org.openecomp.mso.bpmn.common.scripts.AaiUtil
-
-import java.util.UUID;
-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.json.JSONObject;
-import org.apache.commons.lang3.*
-import org.apache.commons.codec.binary.Base64;
import org.springframework.web.util.UriUtils;
-import org.w3c.dom.Document
-import org.w3c.dom.Element
-import org.w3c.dom.Node
-import org.w3c.dom.NodeList
-import org.xml.sax.InputSource
-import com.fasterxml.jackson.jaxrs.json.annotation.JSONP.Def;
+import groovy.json.*
/**
* This groovy class supports the <class>DoDeleteE2EServiceInstance.bpmn</class> 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 <class>DoDeleteNetworkInstanceRollback.bpmn</class> 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 <class>DoDeleteNetworkInstanceRollback.bpmn</class> 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 {
<sdncadapter:SvcAction>delete</sdncadapter:SvcAction>
<sdncadapter:SvcOperation>service-topology-operation</sdncadapter:SvcOperation>
<sdncadapter:CallbackUrl>${callbackURL}</sdncadapter:CallbackUrl>
- <sdncadapter:MsoAction>${serviceType}</sdncadapter:MsoAction>
+ <sdncadapter:MsoAction>${msoAction}</sdncadapter:MsoAction>
</sdncadapter:RequestHeader>
<sdncadapterworkflow:SDNCRequestData>
<request-information>
@@ -229,12 +212,12 @@ public class DoDeleteServiceInstance extends AbstractServiceTaskProcessor {
<service-information>
<service-id>${serviceId}</service-id>
<subscription-service-type>${subscriptionServiceType}</subscription-service-type>
- <onap-model-information>
+ <ecomp-model-information>
<model-invariant-uuid>${modelInvariantUuid}</model-invariant-uuid>
<model-uuid>${modelUuid}</model-uuid>
<model-version>${modelVersion}</model-version>
<model-name>${modelName}</model-name>
- </onap-model-information>
+ </ecomp-model-information>
<service-instance-id>${serviceInstanceId}</service-instance-id>
<subscriber-name/>
<global-customer-id>${globalSubscriberId}</global-customer-id>
@@ -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<String> 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<VnfResource> 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<ModuleResource> 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<String, String>[] vfModules = new HashMap<String,String>[]
+ List<ModuleResource> vfModulesFromDecomposition = execution.getVariable("DDVAM_vfModulesFromDecomposition")
def vfModulesList = new ArrayList<Map<String,String>>()
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<String, String> vfModuleEntry = new HashMap<String, String>()
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 <class>DoUpdateNetworkInstance.bpmn</class> 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 <class>DoUpdateNetworkInstance.bpmn</class> 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 += "<routeTargets>" + routeTarget + "</routeTargets>" + '\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 += "<routeTargets>" + '\n' +
+ " <routeTarget>" + routeTarget + "</routeTarget>" + '\n' +
+ " <routeTargetRole>" + routeRole + "</routeTargetRole>" + '\n' +
+ "</routeTargets>" + '\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 <class>DoUpdateNetworkInstanceRollback.bpmn</class> 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 <class>DoUpdateNetworkInstanceRollback.bpmn</class> 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<String,String> 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<String, Object> 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<String, String> 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<String, String> 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>${source}</source>
</request-info>"""
- 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<VnfResource> 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 = """
- <sdncadapterworkflow:MsoCompletionRequest xmlns:sdncadapterworkflow="http://org.openecomp/mso/workflow/schema/v1"
- xmlns:reqtype="http://org.openecomp/mso/request/types/v1">
- ${requestInfo}
- <sdncadapterworkflow:mso-bpel-name>MSO_ACTIVATE_BPEL</sdncadapterworkflow:mso-bpel-name>
- </sdncadapterworkflow:MsoCompletionRequest>
- """
-
- 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("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;")
- }
-
- String content = """
- <sdncadapterworkflow:FalloutHandlerRequest xmlns:sdncadapterworkflow="http://org.openecomp/mso/workflow/schema/v1"
- xmlns:reqtype="http://org.openecomp/mso/request/types/v1"
- xmlns:msoservtypes="http://org.openecomp/mso/request/types/v1"
- xmlns:structuredtypes="http://org.openecomp/mso/structured/types/v1">
- ${requestInformation}
- <sdncadapterworkflow:WorkflowException>
- <sdncadapterworkflow:ErrorMessage>${encErrorResponseMsg}</sdncadapterworkflow:ErrorMessage>
- <sdncadapterworkflow:ErrorCode>${errorResponseCode}</sdncadapterworkflow:ErrorCode>
- </sdncadapterworkflow:WorkflowException>
- </sdncadapterworkflow:FalloutHandlerRequest>
- """
- 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 <class>UpdateNetworkInstance.bpmn</class> 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<String, String> 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<String, String> 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 = """
<aetgt:MsoCompletionRequest xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1"
@@ -486,7 +486,7 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase {
* Build a "FalloutHandler" request.
* @param execution The flow's execution instance.
*/
- public void prepFalloutHandler(Execution execution, isDebugLogEnabled) {
+ public void prepFalloutHandler(DelegateExecution execution, isDebugLogEnabled) {
def requestId = execution.getVariable('UPDVfModVol_requestId')
def source = execution.getVariable('UPDVfModVol_source')
@@ -527,7 +527,7 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase {
* AAI did not match the Tenant Id in the incoming request.
* @param execution The flow's execution instance.
*/
- public void handleTenantIdMismatch(Execution execution, isDebugLogEnabled) {
+ public void handleTenantIdMismatch(DelegateExecution execution, isDebugLogEnabled) {
def volumeGroupId = execution.getVariable('UPDVfModVol_volumeGroupId')
def aicCloudRegion = execution.getVariable('UPDVfModVol_aicCloudRegion')
@@ -547,7 +547,7 @@ class UpdateVfModuleVolumeInfraV1 extends VfModuleBase {
* AAI did not match the model invariant ID in the incoming request.
* @param execution The flow's execution instance.
*/
- public void handlePersonaModelIdMismatch(Execution execution, isDebugLogEnabled) {
+ public void handlePersonaModelIdMismatch(DelegateExecution execution, isDebugLogEnabled) {
def modelInvariantId = execution.getVariable('UPDVfModVol_modelInvariantId')
def personaModelId = execution.getVariable('UPDVfModVol_personaModelId')
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateVnfInfra.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateVnfInfra.groovy
index 4f574c42ba..0db7616d3d 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateVnfInfra.groovy
+++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateVnfInfra.groovy
@@ -31,7 +31,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
@@ -46,25 +46,23 @@ 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.StopInput
+import org.onap.appc.client.lcm.model.Flags
+import org.onap.appc.client.lcm.model.Status
-public class UpdateVnfInfra extends AbstractServiceTaskProcessor {
+public class UpdateVnfInfra extends VnfCmBase {
ExceptionUtil exceptionUtil = new ExceptionUtil()
- JsonUtils jsonUtils = new JsonUtils()
- ApplicationControllerClient appcClient = new ApplicationControllerClient()
+ JsonUtils jsonUtils = new JsonUtils()
def prefix = "UPDVnfI_"
/**
@@ -72,25 +70,28 @@ public class UpdateVnfInfra extends AbstractServiceTaskProcessor {
*
* @param execution The flow's execution instance.
*/
- public void initProcessVariables(Execution execution) {
+ public void initProcessVariables(DelegateExecution execution) {
execution.setVariable('prefix', 'UPDVnfI_')
- execution.setVariable('UPDVnfI_Request', null)
- execution.setVariable('UPDVnfI_requestInfo', null)
- execution.setVariable('UPDVnfI_requestId', null)
- execution.setVariable('UPDVnfI_source', null)
- execution.setVariable('UPDVnfI_vnfInputs', null)
- execution.setVariable('UPDVnfI_vnfId', null)
- execution.setVariable('UPDVnfI_tenantId', null)
- execution.setVariable('UPDVnfI_vnfParams', null)
+ execution.setVariable('Request', null)
+ execution.setVariable('source', null)
+ execution.setVariable('vnfInputs', null)
+ execution.setVariable('tenantId', null)
+ execution.setVariable('vnfParams', null)
execution.setVariable('UpdateVnfSuccessIndicator', false)
- execution.setVariable('UPDVnfI_serviceType', null)
- execution.setVariable('UPDVnfI_nfRole', null)
- execution.setVariable('UPDVnfI_currentActivity', 'UPDVnfI')
- execution.setVariable('UPDVnfI_workStep', null)
- execution.setVariable('UPDVnfI_failedActivity', null)
- execution.setVariable('UPDVnfI_errorCode', "0")
- execution.setVariable('UPDVnfI_errorText', null)
- execution.setVariable('UPDVnfI_healthCheckIndex', 1)
+ execution.setVariable('serviceType', null)
+ execution.setVariable('nfRole', null)
+ execution.setVariable('currentActivity', 'UPDVnfI')
+ 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("rollbackSetClosedLoopDisabledFlag", false)
+ execution.setVariable("rollbackVnfStop", false)
+ execution.setVariable("rollbackVnfLock", false)
+ execution.setVariable("rollbackQuiesceTraffic", false)
+ execution.setVariable("rollbackSetVnfInMaintenanceFlag", false)
}
/**
@@ -98,7 +99,7 @@ public class UpdateVnfInfra 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() +
')'
@@ -116,13 +117,14 @@ public class UpdateVnfInfra extends AbstractServiceTaskProcessor {
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(prefix + 'serviceInstanceId', serviceInstanceId)
- execution.setVariable(prefix + 'vnfId', vnfId)
- execution.setVariable("isVidRequest", "true")
+ execution.setVariable("isVidRequest", "true")
+ execution.setVariable('serviceType', 'Mobility')
+ 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 +145,61 @@ public class UpdateVnfInfra 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<String, String> 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>${source}</source>
</request-info>"""
- 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<VnfResource> 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 = """
- <sdncadapterworkflow:MsoCompletionRequest xmlns:sdncadapterworkflow="http://org.openecomp/mso/workflow/schema/v1"
- xmlns:reqtype="http://org.openecomp/mso/request/types/v1">
- ${requestInfo}
- <sdncadapterworkflow:mso-bpel-name>MSO_ACTIVATE_BPEL</sdncadapterworkflow:mso-bpel-name>
- </sdncadapterworkflow:MsoCompletionRequest>
- """
-
- 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("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;")
- }
-
- String content = """
- <sdncadapterworkflow:FalloutHandlerRequest xmlns:sdncadapterworkflow="http://org.openecomp/mso/workflow/schema/v1"
- xmlns:reqtype="http://org.openecomp/mso/request/types/v1"
- xmlns:msoservtypes="http://org.openecomp/mso/request/types/v1"
- xmlns:structuredtypes="http://org.openecomp/mso/structured/types/v1">
- ${requestInformation}
- <sdncadapterworkflow:WorkflowException>
- <sdncadapterworkflow:ErrorMessage>${encErrorResponseMsg}</sdncadapterworkflow:ErrorMessage>
- <sdncadapterworkflow:ErrorCode>${errorResponseCode}</sdncadapterworkflow:ErrorCode>
- </sdncadapterworkflow:WorkflowException>
- </sdncadapterworkflow:FalloutHandlerRequest>
- """
- 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<VnfResource> 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<String, Object> 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<AAIResourceUri> 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<String, Object> 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<String, Object> 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<String, Boolean> 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 = """
+ <sdncadapterworkflow:MsoCompletionRequest xmlns:sdncadapterworkflow="http://org.openecomp/mso/workflow/schema/v1"
+ xmlns:reqtype="http://org.openecomp/mso/request/types/v1">
+ ${requestInfo}
+ <sdncadapterworkflow:status-message>Vnf has been updated successfully.</sdncadapterworkflow:status-message>
+ <sdncadapterworkflow:mso-bpel-name>MSO_ACTIVATE_BPEL</sdncadapterworkflow:mso-bpel-name>
+ </sdncadapterworkflow:MsoCompletionRequest>
+ """
+
+ 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("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;")
+ }
+
+ String content = """
+ <sdncadapterworkflow:FalloutHandlerRequest xmlns:sdncadapterworkflow="http://org.openecomp/mso/workflow/schema/v1"
+ xmlns:reqtype="http://org.openecomp/mso/request/types/v1"
+ xmlns:msoservtypes="http://org.openecomp/mso/request/types/v1"
+ xmlns:structuredtypes="http://org.openecomp/mso/structured/types/v1">
+ ${requestInformation}
+ <sdncadapterworkflow:WorkflowException>
+ <sdncadapterworkflow:ErrorMessage>${encErrorResponseMsg}</sdncadapterworkflow:ErrorMessage>
+ <sdncadapterworkflow:ErrorCode>${errorResponseCode}</sdncadapterworkflow:ErrorCode>
+ </sdncadapterworkflow:WorkflowException>
+ </sdncadapterworkflow:FalloutHandlerRequest>
+ """
+ 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 =
+ """<request-info xmlns="http://org.openecomp/mso/infra/vnf-request/v1">
+ <request-id>${requestId}</request-id>
+ <action>UPDATE</action>
+ <source>${source}</source>
+ </request-info>"""
+
+ 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<String, Object> 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<String, Boolean> 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 =
+ """<request-info xmlns="http://org.openecomp/mso/infra/vnf-request/v1">
+ <request-id>${requestId}</request-id>
+ <action>UPDATE</action>
+ <source>${source}</source>
+ </request-info>"""
+
+ 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<String, Object> 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<String, Boolean> 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
- * <class>CreateServiceInstance.bpmn</class> 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
- * <class>CreateServiceInstance.bpmn</class> 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 <class>CreateServiceInstance.bpmn</class> 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 <class>CreateServiceInstance.bpmn</class> 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<String, String> 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 =
- """<request-info xmlns="http://org.openecomp/mso/infra/vnf-request/v1">
- <request-id>${requestId}</request-id>
- <action>CREATE</action>
- <source>${source}</source>
- </request-info>"""
-
- 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 = """
- <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
-xmlns:req="http://org.openecomp.mso/requestsdb">
- <soapenv:Header/>
- <soapenv:Body>
- <req:updateInfraRequest>
- <requestId>${requestId}</requestId>
- <lastModifiedBy>BPEL</lastModifiedBy>
- <serviceInstanceId>${serviceInstanceId}</serviceInstanceId>
- <serviceInstanceName>${serviceInstanceName}</serviceInstanceName>
- </req:updateInfraRequest>
- </soapenv:Body>
- </soapenv:Envelope>
- """
- 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<VnfResource> 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<VnfResource> vnfList) {
- if(vnfList == null) {
- return
- }
-
- // remove BRG & TXC from VNF list
-
- Iterator<VnfResource> 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<AllottedResource> 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<AllottedResource> 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<VnfResource> 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 =
- """<aetgt:MsoCompletionRequest xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1"
- xmlns:ns="http://org.openecomp/mso/request/types/v1">
- <request-info xmlns="http://org.openecomp/mso/infra/vnf-request/v1">
- <request-id>${requestId}</request-id>
- <action>CREATE</action>
- <source>${source}</source>
- </request-info>
- <status-message>Service Instance has been created successfully via macro orchestration</status-message>
- <serviceInstanceId>${serviceInstanceId}</serviceInstanceId>
- <mso-bpel-name>BPMN macro create</mso-bpel-name>
- </aetgt:MsoCompletionRequest>"""
-
- // 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 =
- """<aetgt:WorkflowException xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1">
- <aetgt:ErrorMessage>${errorMessage}</aetgt:ErrorMessage>
- <aetgt:ErrorCode>7000</aetgt:ErrorCode>
- </aetgt:WorkflowException>"""
-
- utils.logAudit(buildworkflowException)
- sendWorkflowResponse(execution, 500, buildworkflowException)
- } catch (Exception ex) {
- utils.log("DEBUG", " Sending Sync Error Activity Failed. " + "\n" + ex.getMessage(), isDebugEnabled)
- }
- }
-
- public void 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<String, String> 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 =
+ """<request-info xmlns="http://org.openecomp/mso/infra/vnf-request/v1">
+ <request-id>${requestId}</request-id>
+ <action>CREATE</action>
+ <source>${source}</source>
+ </request-info>"""
+
+ 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 = """
+ <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://org.openecomp.mso/requestsdb">
+ <soapenv:Header/>
+ <soapenv:Body>
+ <req:updateInfraRequest>
+ <requestId>${requestId}</requestId>
+ <lastModifiedBy>BPEL</lastModifiedBy>
+ <serviceInstanceId>${serviceInstanceId}</serviceInstanceId>
+ <serviceInstanceName>${serviceInstanceName}</serviceInstanceName>
+ </req:updateInfraRequest>
+ </soapenv:Body>
+ </soapenv:Envelope>
+ """
+ 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<VnfResource> 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<VnfResource> vnfList) {
+ if(vnfList == null) {
+ return
+ }
+
+ // remove BRG & TXC from VNF list
+
+ Iterator<VnfResource> 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<AllottedResource> 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<AllottedResource> 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<VnfResource> 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 =
+ """<aetgt:MsoCompletionRequest xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1"
+ xmlns:ns="http://org.openecomp/mso/request/types/v1">
+ <request-info xmlns="http://org.openecomp/mso/infra/vnf-request/v1">
+ <request-id>${requestId}</request-id>
+ <action>CREATE</action>
+ <source>${source}</source>
+ </request-info>
+ <status-message>Service Instance has been created successfully via macro orchestration</status-message>
+ <serviceInstanceId>${serviceInstanceId}</serviceInstanceId>
+ <mso-bpel-name>BPMN macro create</mso-bpel-name>
+ </aetgt:MsoCompletionRequest>"""
+
+ // 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 =
+ """<aetgt:WorkflowException xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1">
+ <aetgt:ErrorMessage>${errorMessage}</aetgt:ErrorMessage>
+ <aetgt:ErrorCode>7000</aetgt:ErrorCode>
+ </aetgt:WorkflowException>"""
+
+ utils.logAudit(buildworkflowException)
+ sendWorkflowResponse(execution, 500, buildworkflowException)
+ } catch (Exception ex) {
+ utils.log("DEBUG", " Sending Sync Error Activity Failed. " + "\n" + ex.getMessage(), isDebugEnabled)
+ }
+ }
+
+ public void 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 <class>DeleteVcpeResCustService.bpmn</class> 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 <class>CreateServiceInstance.bpmn</class> 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{
<service-information>
<service-id></service-id>
<subscription-service-type>${subscriptionServiceType}</subscription-service-type>
- <onap-model-information></onap-model-information>
+ <ecomp-model-information></ecomp-model-information>
<service-instance-id>${serviceInstanceId}</service-instance-id>
<subscriber-name/>
<global-customer-id>${globalCustomerId}</global-customer-id>
@@ -388,13 +388,13 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{
<allotted-resource-id>${allottedResourceId}</allotted-resource-id>
<allotted-resource-type>brg</allotted-resource-type>
<parent-service-instance-id>${parentServiceInstanceId}</parent-service-instance-id>
- <onap-model-information>
+ <ecomp-model-information>
<model-invariant-uuid>${modelInvariantId}</model-invariant-uuid>
<model-uuid>${modelUUId}</model-uuid>
<model-customization-uuid>${modelCustomizationId}</model-customization-uuid>
<model-version>${modelVersion}</model-version>
<model-name>${modelName}</model-name>
- </onap-model-information>
+ </ecomp-model-information>
</allotted-resource-information>
<brg-request-input>
<brg-wan-mac-address>${brgWanMacAddress}</brg-wan-mac-address>
@@ -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 =
"""<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.openecomp/mso/request/types/v1"
@@ -601,7 +601,7 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{
utils.log("DEBUG", "*** Exit preProcessSDNCGet *** ", isDebugLogEnabled)
}
- public void updateAaiAROrchStatus(Execution execution, String status){
+ public void updateAaiAROrchStatus(DelegateExecution execution, String status){
def isDebugEnabled = execution.getVariable(DebugFlag)
utils.log("DEBUG", " *** updateAaiAROrchStatus *** ", isDebugEnabled)
String aaiARPath = execution.getVariable("aaiARPath") //set during query (existing AR) or create
@@ -610,7 +610,7 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{
utils.log("DEBUG", " *** Exit updateAaiAROrchStatus *** ", isDebugEnabled)
}
- public void generateOutputs(Execution execution)
+ public void generateOutputs(DelegateExecution execution)
{
def isDebugEnabled=execution.getVariable(DebugFlag)
utils.log("DEBUG"," ***** generateOutputs ***** ", isDebugEnabled)
@@ -633,7 +633,7 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{
}
- public void preProcessRollback (Execution execution) {
+ public void preProcessRollback (DelegateExecution execution) {
def isDebugEnabled=execution.getVariable(DebugFlag)
utils.log("DEBUG"," ***** preProcessRollback ***** ", isDebugEnabled)
try {
@@ -654,7 +654,7 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{
utils.log("DEBUG"," *** Exit preProcessRollback *** ", isDebugEnabled)
}
- public void postProcessRollback (Execution execution) {
+ public void postProcessRollback (DelegateExecution execution) {
def isDebugEnabled=execution.getVariable(DebugFlag)
utils.log("DEBUG"," ***** postProcessRollback ***** ", isDebugEnabled)
String msg = ""
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollback.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollback.groovy
index cac2ad871a..4d27b82287 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollback.groovy
+++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollback.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.*
@@ -58,7 +58,7 @@ public class DoCreateAllottedResourceBRGRollback extends AbstractServiceTaskProc
String Prefix="DCARBRGRB_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
- public void preProcessRequest (Execution execution) {
+ public void preProcessRequest (DelegateExecution execution) {
def isDebugEnabled = execution.getVariable(DebugFlag)
String msg = ""
@@ -131,7 +131,7 @@ public class DoCreateAllottedResourceBRGRollback extends AbstractServiceTaskProc
}
// 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)
String msg = null;
utils.log("DEBUG", " *** updateAaiAROrchStatus ***", isDebugEnabled)
@@ -153,7 +153,7 @@ public class DoCreateAllottedResourceBRGRollback extends AbstractServiceTaskProc
utils.log("DEBUG", " *** Exit updateAaiAROrchStatus *** ", 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)
@@ -194,7 +194,7 @@ public class DoCreateAllottedResourceBRGRollback extends AbstractServiceTaskProc
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)
@@ -215,7 +215,7 @@ public class DoCreateAllottedResourceBRGRollback extends AbstractServiceTaskProc
utils.log("DEBUG", " *** Exit deleteAaiAR *** ", isDebugLogEnabled)
}
- public void postProcessRequest(Execution execution) {
+ public void postProcessRequest(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable(DebugFlag)
utils.log("DEBUG"," ***** postProcessRequest ***** ", isDebugEnabled)
String msg = ""
@@ -239,7 +239,7 @@ public class DoCreateAllottedResourceBRGRollback extends AbstractServiceTaskProc
}
- public void processRollbackException(Execution execution){
+ public void processRollbackException(DelegateExecution execution){
def isDebugEnabled=execution.getVariable(DebugFlag)
utils.log("DEBUG"," ***** processRollbackException ***** ", isDebugEnabled)
try{
@@ -258,7 +258,7 @@ public class DoCreateAllottedResourceBRGRollback extends AbstractServiceTaskProc
utils.log("DEBUG", " Exit processRollbackException", isDebugEnabled)
}
- public void processRollbackJavaException(Execution execution){
+ public void processRollbackJavaException(DelegateExecution execution){
def isDebugEnabled=execution.getVariable(DebugFlag)
utils.log("DEBUG"," ***** processRollbackJavaException ***** ", isDebugEnabled)
try{
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy
index 602df6bc1f..2240c605af 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy
+++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.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.*
@@ -73,7 +73,7 @@ public class DoCreateAllottedResourceTXC 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 = ""
@@ -146,7 +146,7 @@ public class DoCreateAllottedResourceTXC 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)
@@ -184,7 +184,7 @@ public class DoCreateAllottedResourceTXC 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)
@@ -307,7 +307,7 @@ public class DoCreateAllottedResourceTXC 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 = ""
@@ -373,7 +373,7 @@ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{
<service-information>
<service-id></service-id>
<subscription-service-type>${subscriptionServiceType}</subscription-service-type>
- <onap-model-information></onap-model-information>
+ <ecomp-model-information></ecomp-model-information>
<service-instance-id>${serviceInstanceId}</service-instance-id>
<subscriber-name/>
<global-customer-id>${globalCustomerId}</global-customer-id>
@@ -382,13 +382,13 @@ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{
<allotted-resource-id>${allottedResourceId}</allotted-resource-id>
<allotted-resource-type>tunnelxconn</allotted-resource-type>
<parent-service-instance-id>${parentServiceInstanceId}</parent-service-instance-id>
- <onap-model-information>
+ <ecomp-model-information>
<model-invariant-uuid>${modelInvariantId}</model-invariant-uuid>
<model-uuid>${modelUUId}</model-uuid>
<model-customization-uuid>${modelCustomizationId}</model-customization-uuid>
<model-version>${modelVersion}</model-version>
<model-name>${modelName}</model-name>
- </onap-model-information>
+ </ecomp-model-information>
</allotted-resource-information>
<tunnelxconn-request-input>
<brg-wan-mac-address>${brgWanMacAddress}</brg-wan-mac-address>
@@ -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 =
"""<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.openecomp/mso/request/types/v1"
@@ -593,7 +593,7 @@ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{
utils.log("DEBUG", "*** Exit preProcessSDNCGet *** ", isDebugLogEnabled)
}
- public void updateAaiAROrchStatus(Execution execution, String status){
+ public void updateAaiAROrchStatus(DelegateExecution execution, String status){
def isDebugEnabled = execution.getVariable(DebugFlag)
utils.log("DEBUG", " *** updateAaiAROrchStatus *** ", isDebugEnabled)
String aaiARPath = execution.getVariable("aaiARPath") //set during query (existing AR) or create
@@ -602,7 +602,7 @@ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{
utils.log("DEBUG", " *** Exit updateAaiAROrchStatus *** ", isDebugEnabled)
}
- public void generateOutputs(Execution execution)
+ public void generateOutputs(DelegateExecution execution)
{
def isDebugEnabled=execution.getVariable(DebugFlag)
utils.log("DEBUG"," ***** generateOutputs ***** ", isDebugEnabled)
@@ -629,7 +629,7 @@ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{
}
- public void preProcessRollback (Execution execution) {
+ public void preProcessRollback (DelegateExecution execution) {
def isDebugEnabled=execution.getVariable(DebugFlag)
utils.log("DEBUG"," ***** preProcessRollback ***** ", isDebugEnabled)
try {
@@ -650,7 +650,7 @@ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{
utils.log("DEBUG"," *** Exit preProcessRollback *** ", isDebugEnabled)
}
- public void postProcessRollback (Execution execution) {
+ public void postProcessRollback (DelegateExecution execution) {
def isDebugEnabled=execution.getVariable(DebugFlag)
utils.log("DEBUG"," ***** postProcessRollback ***** ", isDebugEnabled)
String msg = ""
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollback.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollback.groovy
index 08f2df2d09..b6efced8fe 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollback.groovy
+++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollback.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.*
@@ -58,7 +58,7 @@ public class DoCreateAllottedResourceTXCRollback extends AbstractServiceTaskProc
String Prefix="DCARTXCRB_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
- public void preProcessRequest (Execution execution) {
+ public void preProcessRequest (DelegateExecution execution) {
def isDebugEnabled = execution.getVariable(DebugFlag)
String msg = ""
@@ -131,7 +131,7 @@ public class DoCreateAllottedResourceTXCRollback extends AbstractServiceTaskProc
}
// 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)
String msg = null;
utils.log("DEBUG", " *** updateAaiAROrchStatus ***", isDebugEnabled)
@@ -153,7 +153,7 @@ public class DoCreateAllottedResourceTXCRollback extends AbstractServiceTaskProc
utils.log("DEBUG", " *** Exit updateAaiAROrchStatus *** ", 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)
@@ -194,7 +194,7 @@ public class DoCreateAllottedResourceTXCRollback extends AbstractServiceTaskProc
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)
@@ -215,7 +215,7 @@ public class DoCreateAllottedResourceTXCRollback extends AbstractServiceTaskProc
utils.log("DEBUG", " *** Exit deleteAaiAR *** ", isDebugLogEnabled)
}
- public void postProcessRequest(Execution execution) {
+ public void postProcessRequest(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable(DebugFlag)
utils.log("DEBUG"," ***** postProcessRequest ***** ", isDebugEnabled)
String msg = ""
@@ -239,7 +239,7 @@ public class DoCreateAllottedResourceTXCRollback extends AbstractServiceTaskProc
}
- public void processRollbackException(Execution execution){
+ public void processRollbackException(DelegateExecution execution){
def isDebugEnabled=execution.getVariable(DebugFlag)
utils.log("DEBUG"," ***** processRollbackException ***** ", isDebugEnabled)
try{
@@ -258,7 +258,7 @@ public class DoCreateAllottedResourceTXCRollback extends AbstractServiceTaskProc
utils.log("DEBUG", " Exit processRollbackException", isDebugEnabled)
}
- public void processRollbackJavaException(Execution execution){
+ public void processRollbackJavaException(DelegateExecution execution){
def isDebugEnabled=execution.getVariable(DebugFlag)
utils.log("DEBUG"," ***** processRollbackJavaException ***** ", isDebugEnabled)
try{
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRG.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRG.groovy
index 38ac23e5a1..839766eabc 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRG.groovy
+++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRG.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 DoDeleteAllottedResourceBRG extends AbstractServiceTaskProcessor{
String Prefix="DDARBRG_"
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 DoDeleteAllottedResourceBRG 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 DoDeleteAllottedResourceBRG 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 DoDeleteAllottedResourceBRG 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 DoDeleteAllottedResourceBRG extends AbstractServiceTaskProcessor{
<service-information>
<service-id></service-id>
<subscription-service-type>${subscriptionServiceType}</subscription-service-type>
- <onap-model-information></onap-model-information>
+ <ecomp-model-information></ecomp-model-information>
<service-instance-id>${serviceInstanceId}</service-instance-id>
<subscriber-name/>
<global-customer-id>${globalCustomerId}</global-customer-id>
@@ -209,13 +209,13 @@ public class DoDeleteAllottedResourceBRG extends AbstractServiceTaskProcessor{
<allotted-resource-id>${allottedResourceId}</allotted-resource-id>
<allotted-resource-type>brg</allotted-resource-type>
<parent-service-instance-id>${parentServiceInstanceId}</parent-service-instance-id>
- <onap-model-information>
+ <ecomp-model-information>
<model-invariant-uuid>${modelInvariantId}</model-invariant-uuid>
<model-uuid>${modelUUId}</model-uuid>
<model-customization-uuid>${modelCustomizationId}</model-customization-uuid>
<model-version>${modelVersion}</model-version>
<model-name>${modelName}</model-name>
- </onap-model-information>
+ </ecomp-model-information>
</allotted-resource-information>
<brg-request-input>
</brg-request-input>
@@ -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{
<service-information>
<service-id></service-id>
<subscription-service-type>${subscriptionServiceType}</subscription-service-type>
- <onap-model-information></onap-model-information>
+ <ecomp-model-information></ecomp-model-information>
<service-instance-id>${serviceInstanceId}</service-instance-id>
<subscriber-name/>
<global-customer-id>${globalCustomerId}</global-customer-id>
@@ -209,13 +209,13 @@ public class DoDeleteAllottedResourceTXC extends AbstractServiceTaskProcessor{
<allotted-resource-id>${allottedResourceId}</allotted-resource-id>
<allotted-resource-type>tunnelxconn</allotted-resource-type>
<parent-service-instance-id>${parentServiceInstanceId}</parent-service-instance-id>
- <onap-model-information>
+ <ecomp-model-information>
<model-invariant-uuid>${modelInvariantId}</model-invariant-uuid>
<model-uuid>${modelUUId}</model-uuid>
<model-customization-uuid>${modelCustomizationId}</model-customization-uuid>
<model-version>${modelVersion}</model-version>
<model-name>${modelName}</model-name>
- </onap-model-information>
+ </ecomp-model-information>
</allotted-resource-information>
<tunnelxconn-request-input>
</tunnelxconn-request-input>
@@ -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)