From cd07d118b4e65998bd0d18b842b9abc6a6eecf50 Mon Sep 17 00:00:00 2001 From: Yulian Han Date: Wed, 28 Mar 2018 15:21:52 +0800 Subject: InitResourcesOperStatus for UpdateE2ESVCInst Change-Id: Idaa55084f5ecb0dd3636c232cebc14fa5f0641f7 Issue-ID: SO-419 Signed-off-by: Yulian Han --- .../scripts/DoUpdateE2EServiceInstance.groovy | 58 +++++++++++----------- 1 file changed, 30 insertions(+), 28 deletions(-) (limited to 'bpmn/MSOInfrastructureBPMN') 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 d2c784db21..44e3b73697 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 @@ -26,6 +26,7 @@ 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.json.JsonUtils import org.openecomp.mso.bpmn.common.scripts.AaiUtil import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor @@ -388,7 +389,7 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor { String operationType = execution.getVariable("operationType") String resourceTemplateUUIDs = "" String result = "processing" - String progress = "0" + String progress = "10" String reason = "" String operationContent = "Prepare service updating" utils.log("INFO", "Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId + " operationType:" + operationType, isDebugEnabled) @@ -396,38 +397,38 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor { execution.setVariable("serviceInstanceId", serviceId) execution.setVariable("operationId", operationId) execution.setVariable("operationType", operationType) - - 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 + ":" - } - } - execution.setVariable("URN_mso_openecomp_adapters_db_endpoint","http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter") - String payload = - """ resourceList = new ArrayList() + List addResourceList = execution.getVariable("addResourceList") + List delResourceList = execution.setVariable("delResourceList") + resourceList.addAll(addResourceList) + resourceList.addAll(delResourceList) + for(Resource resource : resourceList){ + resourceTemplateUUIDs = resourceTemplateUUIDs + resource.getModelInfo().getModelCustomizationUuid() + ":" + } + + def dbAdapterEndpoint = "http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter" + execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) + utils.log("INFO", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled) + + String payload = + """ - ${serviceId} - ${operationId} - ${operationType} - ${resourceTemplateUUIDs} - - - """ - - payload = utils.formatXml(payload) - execution.setVariable("CVFMI_initResOperStatusRequest", payload) - utils.log("INFO", "Outgoing initResourceOperationStatus: \n" + payload, isDebugEnabled) - utils.logAudit("CreateVfModuleInfra Outgoing initResourceOperationStatus Request: " + payload) + ${serviceId} + ${operationId} + ${operationType} + ${resourceTemplateUUIDs} + + + """ + + payload = utils.formatXml(payload) + execution.setVariable("CVFMI_initResOperStatusRequest", payload) + utils.log("INFO", "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) @@ -447,6 +448,7 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor { try{ String serviceId = execution.getVariable("serviceInstanceId") String operationId = execution.getVariable("operationId") + String operationType = execution.getVariable("operationType") String serviceName = execution.getVariable("serviceInstanceName") String userId = "" String result = "processing" -- cgit 1.2.3-korg