InitResourcesOperStatus for UpdateE2ESVCInst 25/39525/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:52 +0000 (09:12 +0000)
Change-Id: Idaa55084f5ecb0dd3636c232cebc14fa5f0641f7
Issue-ID: SO-419
Signed-off-by: Yulian Han <elaine.hanyulian@huawei.com>
bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy

index d2c784d..44e3b73 100644 (file)
@@ -26,6 +26,7 @@ import groovy.json.*
 import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition\r
 import org.openecomp.mso.bpmn.core.domain.ServiceInstance\r
 import org.openecomp.mso.bpmn.core.domain.ModelInfo\r
+import org.openecomp.mso.bpmn.core.domain.Resource\r
 import org.openecomp.mso.bpmn.core.json.JsonUtils\r
 import org.openecomp.mso.bpmn.common.scripts.AaiUtil\r
 import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor\r
@@ -388,7 +389,7 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor {
             String operationType = execution.getVariable("operationType")\r
             String resourceTemplateUUIDs = ""\r
             String result = "processing"\r
-            String progress = "0"\r
+            String progress = "10"\r
             String reason = ""\r
             String operationContent = "Prepare service updating"\r
             utils.log("INFO", "Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId + " operationType:" + operationType, isDebugEnabled)\r
@@ -396,38 +397,38 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor {
             execution.setVariable("serviceInstanceId", serviceId)\r
             execution.setVariable("operationId", operationId)\r
             execution.setVariable("operationType", operationType)\r
-            \r
-            String serviceRelationShip = execution.getVariable("serviceRelationShip")\r
-            \r
-            def jsonSlurper = new JsonSlurper()\r
-            def jsonOutput = new JsonOutput()         \r
-            List relationShipList =  jsonSlurper.parseText(serviceRelationShip)\r
-                    \r
-            if (relationShipList != null) {\r
-                relationShipList.each {\r
-                    resourceTemplateUUIDs  = resourceTemplateUUIDs + it.resourceInstanceId + ":"\r
-                }\r
-            }           \r
-            execution.setVariable("URN_mso_openecomp_adapters_db_endpoint","http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter")\r
 \r
-            String payload =\r
-                """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"\r
+                       List<Resource> resourceList = new ArrayList<String>()\r
+                       List<Resource> addResourceList =  execution.getVariable("addResourceList")\r
+                       List<Resource> delResourceList =  execution.setVariable("delResourceList")\r
+                       resourceList.addAll(addResourceList)\r
+                       resourceList.addAll(delResourceList)\r
+                       for(Resource resource : resourceList){\r
+                               resourceTemplateUUIDs  = resourceTemplateUUIDs + resource.getModelInfo().getModelCustomizationUuid() + ":"\r
+                       }\r
+                       \r
+                       def dbAdapterEndpoint = "http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter"\r
+                       execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint)\r
+                       utils.log("INFO", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled)\r
+\r
+                       String payload =\r
+                               """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"\r
                         xmlns:ns="http://org.openecomp.mso/requestsdb">\r
                         <soapenv:Header/>\r
                         <soapenv:Body>\r
                             <ns:initResourceOperationStatus xmlns:ns="http://org.openecomp.mso/requestsdb">\r
-                            <serviceId>${serviceId}</serviceId>\r
-                            <operationId>${operationId}</operationId>\r
-                            <operationType>${operationType}</operationType>\r
-                            <resourceTemplateUUIDs>${resourceTemplateUUIDs}</resourceTemplateUUIDs>\r
-                        </ns:initResourceOperationStatus>\r
-                    </soapenv:Body>\r
-                </soapenv:Envelope>"""\r
-\r
-            payload = utils.formatXml(payload)\r
-            execution.setVariable("CVFMI_initResOperStatusRequest", payload)\r
-            utils.log("INFO", "Outgoing initResourceOperationStatus: \n" + payload, isDebugEnabled)\r
-            utils.logAudit("CreateVfModuleInfra Outgoing initResourceOperationStatus Request: " + payload)\r
+                                                               <serviceId>${serviceId}</serviceId>\r
+                                                               <operationId>${operationId}</operationId>\r
+                                                               <operationType>${operationType}</operationType>\r
+                                                               <resourceTemplateUUIDs>${resourceTemplateUUIDs}</resourceTemplateUUIDs>\r
+                            </ns:initResourceOperationStatus>\r
+                       </soapenv:Body>\r
+                       </soapenv:Envelope>"""\r
+\r
+                       payload = utils.formatXml(payload)\r
+                       execution.setVariable("CVFMI_initResOperStatusRequest", payload)\r
+                       utils.log("INFO", "Outgoing initResourceOperationStatus: \n" + payload, isDebugEnabled)\r
+                       utils.logAudit("CreateVfModuleInfra Outgoing initResourceOperationStatus Request: " + payload)\r
 \r
         }catch(Exception e){\r
             utils.log("ERROR", "Exception Occured Processing preInitResourcesOperStatus. Exception is:\n" + e, isDebugEnabled)\r
@@ -447,6 +448,7 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor {
         try{\r
             String serviceId = execution.getVariable("serviceInstanceId")\r
             String operationId = execution.getVariable("operationId")\r
+                       String operationType = execution.getVariable("operationType")\r
             String serviceName = execution.getVariable("serviceInstanceName")\r
             String userId = ""\r
             String result = "processing"\r