InitServiceOperationStatus for UpdateE2ESVCInst 13/39513/2
authorYulian Han <elaine.hanyulian@huawei.com>
Wed, 28 Mar 2018 07:21:52 +0000 (15:21 +0800)
committerYulian Han <elaine.hanyulian@huawei.com>
Wed, 28 Mar 2018 09:12:38 +0000 (09:12 +0000)
Change-Id: Idaa55084f5ecb0dd3636c232cebc14fa5f0641f6
Issue-ID: SO-419
Signed-off-by: Yulian Han <elaine.hanyulian@huawei.com>
bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy

index 1c87c11..240b8d0 100644 (file)
@@ -138,6 +138,61 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor
                }
                utils.log("INFO"," ***** Exit preProcessRequest *****",  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 = execution.getVariable("operationType")
+                       String userId = ""
+                       String result = "processing"
+                       String progress = "0"
+                       String reason = ""
+                       String operationContent = "Prepare service updating"
+                       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)
+       }
 
        public void sendSyncResponse (DelegateExecution execution) {
                def isDebugEnabled=execution.getVariable("isDebugLogEnabled")