From 5e83d43305c69c41d9d455a844e435501f6d3a6e Mon Sep 17 00:00:00 2001 From: seshukm Date: Thu, 26 Oct 2017 13:13:20 +0530 Subject: fix update operation Status fixing update of operation status for del e2e svc IssueId: SO-263 Change-Id: I797f36c54d4fd90f697b22d576666197b311713f Signed-off-by: seshukm --- .../scripts/DeleteCustomE2EServiceInstance.groovy | 96 +++------------------ .../DoCustomDeleteE2EServiceInstance.groovy | 79 ++++++++++++++++++ .../process/DeleteCustomE2EServiceInstance.bpmn | 84 +++++++------------ .../DoCustomDeleteE2EServiceInstance.bpmn | 97 +++++++++++++++++----- 4 files changed, 198 insertions(+), 158 deletions(-) (limited to 'bpmn/MSOInfrastructureBPMN/src') 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 7ab651c9b0..206e614630 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 @@ -81,8 +81,7 @@ 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" @@ -90,6 +89,7 @@ public class DeleteCustomE2EServiceInstance extends AbstractServiceTaskProcessor } else { execution.setVariable("serviceType", serviceType) } + //subscriberInfo String globalSubscriberId = jsonUtil.getJsonValue(siRequest, "globalSubscriberId") if (isBlank(globalSubscriberId)) { @@ -98,7 +98,16 @@ public class DeleteCustomE2EServiceInstance extends AbstractServiceTaskProcessor } else { execution.setVariable("globalSubscriberId", globalSubscriberId) } - execution.setVariable("URN_mso_adapters_openecomp_db_endpoint","http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter") + + //operationId + String operationId = jsonUtil.getJsonValue(siRequest, "operationId") + if (isBlank(operationId)) { + operationId = UUID.randomUUID().toString() + } + execution.setVariable("operationId", operationId) + + 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){ @@ -116,7 +125,7 @@ public class DeleteCustomE2EServiceInstance extends AbstractServiceTaskProcessor try { String operationId = execution.getVariable("operationId") - // RESTResponse (for API Handler (APIH) Reply Task) + // RESTResponse (for API Handler (APIH) Reply Task) : : String syncResponse = """{"operationId":"${operationId}"}""".trim() utils.log("DEBUG", " sendSynchResponse: xmlSyncResponse - " + "\n" + syncResponse, isDebugEnabled) sendWorkflowResponse(execution, 202, syncResponse) @@ -156,85 +165,6 @@ public class DeleteCustomE2EServiceInstance extends AbstractServiceTaskProcessor } - 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 = UUID.randomUUID().toString() - String operationType = "DELETE" - 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 + " operationType:" + oprationType, isDebugEnabled) - serviceId = UriUtils.encode(serviceId,"UTF-8") - execution.setVariable("serviceInstanceId", serviceId) - execution.setVariable("operationId", operationId) - execution.setVariable("operationType", operationType) - // we use resource instance ids for delete flow as resourceTemplateUUIDs - /*[ - { - "resourceInstanceId":"1111", - "resourceType":"vIMS" - }, - { - "resourceInstanceId":"222", - "resourceType":"vEPC" - }, - { - "resourceInstanceId":"3333", - "resourceType":"overlay" - }, - { - "resourceInstanceId":"4444", - "resourceType":"underlay" - } - ]*/ - String serviceRelationShip = execution.getVariable("serviceRelationShip") - - def jsonSlurper = new JsonSlurper() - def jsonOutput = new JsonOutput() - List relationShipList = jsonSlurper.parseText(serviceRelationShip) - - if (relationShipList != null) { - relationShipList.each { - resourceTemplateUUIDs = resourceTemplateUUIDs + it.resourceInstanceId + ":" - } - } - - def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint") - execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) - utils.log("DEBUG", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled) - - String payload = - """ - - - - ${serviceId} - ${operationId} - ${operationType} - ${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) - } - public void prepareCompletionRequest (Execution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("DEBUG", " *** prepareCompletion *** ", isDebugEnabled) 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 f141bbdeb0..cd0fe818bc 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 @@ -472,6 +472,85 @@ public class DoCustomDeleteE2EServiceInstance extends AbstractServiceTaskProcess utils.log("DEBUG"," *** Exit postProcessAAIDEL *** ", 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 + " operationType:" + oprationType, isDebugEnabled) + serviceId = UriUtils.encode(serviceId,"UTF-8") + execution.setVariable("serviceInstanceId", serviceId) + execution.setVariable("operationId", operationId) + execution.setVariable("operationType", operationType) + // we use resource instance ids for delete flow as resourceTemplateUUIDs + /*[ + { + "resourceInstanceId":"1111", + "resourceType":"vIMS" + }, + { + "resourceInstanceId":"222", + "resourceType":"vEPC" + }, + { + "resourceInstanceId":"3333", + "resourceType":"overlay" + }, + { + "resourceInstanceId":"4444", + "resourceType":"underlay" + } + ]*/ + String serviceRelationShip = execution.getVariable("serviceRelationShip") + + def jsonSlurper = new JsonSlurper() + def jsonOutput = new JsonOutput() + List relationShipList = jsonSlurper.parseText(serviceRelationShip) + + if (relationShipList != null) { + relationShipList.each { + resourceTemplateUUIDs = resourceTemplateUUIDs + it.resourceInstanceId + ":" + } + } + + 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) + } + /** * prepare delete parameters */ diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteCustomE2EServiceInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteCustomE2EServiceInstance.bpmn index 0273983104..c6a6d02e4c 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteCustomE2EServiceInstance.bpmn +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteCustomE2EServiceInstance.bpmn @@ -109,7 +109,7 @@ csi.sendSyncError(execution)]]> - SequenceFlow_1x62wqv + SequenceFlow_0yowshs SequenceFlow_0zf2qyk - + - - SequenceFlow_0yowshs - SequenceFlow_1x62wqv - - - @@ -156,39 +148,39 @@ ddsi.preInitResourcesOperStatus(execution)]]> - + - + - + - + - + - + - + - + - + - + @@ -199,54 +191,52 @@ ddsi.preInitResourcesOperStatus(execution)]]> - - + + - + - - + + - + - - + + - + - + - + - - + + - + - - + + - + - - - - + + - + @@ -331,16 +321,6 @@ ddsi.preInitResourcesOperStatus(execution)]]> - - - - - - - - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCustomDeleteE2EServiceInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCustomDeleteE2EServiceInstance.bpmn index ea7056d1b4..22246316d2 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCustomDeleteE2EServiceInstance.bpmn +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCustomDeleteE2EServiceInstance.bpmn @@ -112,7 +112,7 @@ ex.processJavaException(execution)]]> SequenceFlow_1wmjau1 SequenceFlow_0qquvgc - + SequenceFlow_1931m8u @@ -142,7 +142,7 @@ def ddsi = new DoCustomDeleteE2EServiceInstance() ddsi.postProcessSDNCDelete(execution, response, "delete")]]> - SequenceFlow_1av166w + SequenceFlow_0l4w9nr SequenceFlow_1dza4q4 SequenceFlow_1g4djgh SequenceFlow_0uc2beq + + SequenceFlow_1av166w + SequenceFlow_1ym9otf + + + + + + + ${URN_mso_openecomp_adapters_db_endpoint} + + + application/soap+xml + #{BasicAuthHeaderValueDB} + + + ${CVFMI_initResOperStatusRequest} + POST + ${statusCode} + ${response} + + http-connector + + + SequenceFlow_1ym9otf + SequenceFlow_0l4w9nr + + + @@ -344,9 +375,9 @@ ddsi.preResourceDelete(execution, resourceName )]]> - + - + @@ -373,20 +404,20 @@ ddsi.preResourceDelete(execution, resourceName )]]> - + - - + + - + - - + + - + @@ -432,38 +463,58 @@ ddsi.preResourceDelete(execution, resourceName )]]> - + - - + + - + - - + + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + -- cgit 1.2.3-korg