From 73bd66b7ce4bd798c33d06f8f290456d817ba81d Mon Sep 17 00:00:00 2001 From: c00149107 Date: Wed, 11 Oct 2017 16:46:50 +0800 Subject: Add progress for create workflow Add progress and operation content for create workflow operation Change-Id: Ib48ab5be7f65a039813db1da816dbe7ac4c0e6f1 Issue-ID:SO-206 Signed-off-by: c00149107 --- .../scripts/CreateCustomE2EServiceInstance.groovy | 55 +++++++++++ .../scripts/DoCreateE2EServiceInstance.groovy | 60 ++++++++++++ .../process/CreateCustomE2EServiceInstance.bpmn | 81 +++++++++++++--- .../subprocess/DoCreateE2EServiceInstance.bpmn | 105 +++++++++++++++------ 4 files changed, 259 insertions(+), 42 deletions(-) (limited to 'bpmn') 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 33bbbd8e6a..7f4f78762e 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 @@ -282,4 +282,59 @@ public class CreateCustomE2EServiceInstance extends AbstractServiceTaskProcessor } utils.log("DEBUG", "*** Exit prepareFalloutRequest ***", isDebugEnabled) } + + /** + * Init the service Operation Status + */ + public void prepareInitServiceOperationStatus(Execution 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_openecomp_adapters_db_endpoint") + execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) + utils.log("DEBUG", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled) + + String payload = + """ + + + + ${serviceId} + ${operationId} + ${operationType} + ${userId} + ${result} + ${operationContent} + ${progress} + ${reason} + + + """ + + payload = utils.formatXml(payload) + execution.setVariable("CVFMI_updateServiceOperStatusRequest", payload) + utils.log("DEBUG", "Outgoing updateServiceOperStatusRequest: \n" + payload, isDebugEnabled) + utils.logAudit("CreateVfModuleInfra Outgoing updateServiceOperStatusRequest Request: " + payload) + + }catch(Exception e){ + utils.log("ERROR", "Exception Occured Processing prepareInitServiceOperationStatus. Exception is:\n" + e, isDebugEnabled) + execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during prepareInitServiceOperationStatus Method:\n" + e.getMessage()) + } + utils.log("DEBUG", "======== COMPLETED prepareInitServiceOperationStatus Process ======== ", isDebugEnabled) + } } \ No newline at end of file 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 4129a7660a..7505eed348 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 @@ -606,4 +606,64 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { utils.log("DEBUG"," *** Exit postProcessRollback *** ", isDebugEnabled) } + public void preInitResourcesOperStatus(Execution execution){ + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + + utils.log("DEBUG", " ======== STARTED preInitResourcesOperStatus Process ======== ", isDebugEnabled) + try{ + String serviceId = execution.getVariable("serviceInstanceId") + String operationId = execution.getVariable("operationId") + String operationType = execution.getVariable("operationType") + String resourceTemplateUUIDs = "" + 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 jsonSlurper = new JsonSlurper() + def jsonOutput = new JsonOutput() + String incomingRequest = execution.getVariable("bpmnRequest") + Map serviceReq = jsonSlurper.parseText(incomingRequest) + def segmentList = serviceReq.service.parameters.segments + + if (segmentList != null) { + segmentList.each { + resourceTemplateUUIDs = resourcesUUIDs + it.resourceUUID + ":" + } + } + + def dbAdapterEndpoint = execution.getVariable("URN_mso_openecomp_adapters_db_endpoint") + execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) + utils.log("DEBUG", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled) + + String payload = + """ + + + + ${serviceId} + ${operationId} + ${operationType} + ${resourceTemplateUUIDs} + + + """ + + payload = utils.formatXml(payload) + execution.setVariable("CVFMI_initResOperStatusRequest", payload) + utils.log("DEBUG", "Outgoing initResourceOperationStatus: \n" + payload, isDebugEnabled) + utils.logAudit("CreateVfModuleInfra Outgoing initResourceOperationStatus Request: " + payload) + + }catch(Exception e){ + utils.log("ERROR", "Exception Occured Processing preInitResourcesOperStatus. Exception is:\n" + e, isDebugEnabled) + execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preInitResourcesOperStatus Method:\n" + e.getMessage()) + } + utils.log("DEBUG", "======== COMPLETED preInitResourcesOperStatus Process ======== ", isDebugEnabled) + } + } diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateCustomE2EServiceInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateCustomE2EServiceInstance.bpmn index a0a77faf0f..0a80602705 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateCustomE2EServiceInstance.bpmn +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateCustomE2EServiceInstance.bpmn @@ -1,5 +1,5 @@ - + SequenceFlow_0s2spoq @@ -113,7 +113,7 @@ csi.sendSyncError(execution)]]> - SequenceFlow_0z4faf9 + SequenceFlow_081z8l2 SequenceFlow_19eilro - + @@ -140,14 +140,45 @@ csi.sendSyncResponse(execution)]]> + + + SequenceFlow_0z4faf9 + SequenceFlow_1euqjsp + + + + + + + + ${URN_mso_openecomp_adapters_db_endpoint} + + + application/soap+xml + #{BasicAuthHeaderValueDB} + + + ${CVFMI_updateServiceOperStatusRequest} + POST + ${statusCode} + ${response} + + http-connector + + + SequenceFlow_1euqjsp + SequenceFlow_081z8l2 + - + - + @@ -163,7 +194,7 @@ csi.sendSyncResponse(execution)]]> - + @@ -175,7 +206,7 @@ csi.sendSyncResponse(execution)]]> - + @@ -190,17 +221,17 @@ csi.sendSyncResponse(execution)]]> - - + + - + - + - + @@ -218,10 +249,10 @@ csi.sendSyncResponse(execution)]]> - - + + - + @@ -331,6 +362,26 @@ csi.sendSyncResponse(execution)]]> + + + + + + + + + + + + + + + + + + + + diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn index 758de28d36..2e996e20d5 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn @@ -1,5 +1,5 @@ - + SequenceFlow_1 @@ -135,7 +135,7 @@ def csi = new DoCreateE2EServiceInstance() csi.preSDNCRequest(execution)]]> - SequenceFlow_1170ztf + SequenceFlow_05gdjox SequenceFlow_15zgrcq - + SequenceFlow_092ghvu + + + SequenceFlow_1170ztf + SequenceFlow_1qctzm0 + + + + + + + + ${URN_mso_openecomp_adapters_db_endpoint} + + + application/soap+xml + #{BasicAuthHeaderValueDB} + + + ${CVFMI_initResOperStatusRequest} + POST + ${statusCode} + ${response} + + http-connector + + + SequenceFlow_1qctzm0 + SequenceFlow_05gdjox + @@ -340,69 +371,89 @@ csi.postConfigRequest(execution)]]> - + - + - + - + - + - - + + - + - - + + - + - - + + - + - - + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + - + - + + + + -- cgit 1.2.3-korg