diff options
author | Elaine_Han <elaine.hanyulian@huawei.com> | 2018-08-10 15:43:04 +0800 |
---|---|---|
committer | Yulian Han <elaine.hanyulian@huawei.com> | 2018-08-16 09:19:06 +0000 |
commit | 1bda61168585eaa76a03a16f5e5ec215c4c9ab18 (patch) | |
tree | be6683cdcc2fcf4dbd3f7a70c81936451fa0d0cf /bpmn/so-bpmn-infrastructure-common/src/main/groovy | |
parent | de219ee3299c434260b38bb1d4f6421b23cac930 (diff) |
Site service process with location
Delete real existing resources
Change-Id: Idaa55084f5ecb0dd3636c232cebc14fa70000006
Issue-ID: SO-683
Signed-off-by: Yulian Han <elaine.hanyulian@huawei.com>
Diffstat (limited to 'bpmn/so-bpmn-infrastructure-common/src/main/groovy')
3 files changed, 29 insertions, 4 deletions
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy index 80e6e758c0..1eb626101e 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy @@ -164,7 +164,8 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso //uuiRequest String incomingRequest = resourceInputObj.getRequestsInputs() String serviceParameters = jsonUtil.getJsonValue(incomingRequest, "service.parameters") - JSONObject inputParameters = new JSONObject(customizeResourceParam(serviceParameters)) + String requestInputs = JsonUtils.getJsonValue(serviceParameters, "requestInputs") + JSONObject inputParameters = new JSONObject(customizeResourceParam(requestInputs)) execution.setVariable(Prefix + "ServiceParameters", inputParameters) // CallSource is added only when ONAP SO calling 3rdONAP(External API) SO(Remote call) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy index b5d196181b..4939173d65 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy @@ -466,6 +466,19 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { msoLogger.trace("COMPLETED preInitResourcesOperStatus Process ") } + // if site location is in local Operator, create all resources in local ONAP; + // if site location is in 3rd Operator, only process sp-partner to create all resources in 3rd ONAP + public void doProcessSiteLocation(DelegateExecution execution){ + + msoLogger.trace("======== Start doProcessSiteLocation Process ======== ") + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + String uuiRequest = execution.getVariable("uuiRequest") + ServiceDecomposition serviceDecompositionforLocal = ServicePluginFactory.getInstance().doProcessSiteLocation(serviceDecomposition, uuiRequest); + execution.setVariable("serviceDecomposition", serviceDecompositionforLocal) + + msoLogger.trace("======== COMPLETED doProcessSiteLocation Process ======== ") + } + // prepare input param for using DoCreateResources.bpmn public void preProcessForAddResource(DelegateExecution execution) { msoLogger.trace("STARTED preProcessForAddResource Process ") diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy index 6d23ae7c65..827d44726b 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy @@ -336,6 +336,11 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { String sppartnerName = "sp-partner" + eValue jObj.put("resourceType", sppartnerName) } + else if(eKey.equals(rt + ".id")){ + jObj.put("resourceInstanceId", eValue) + String resourceName = rt + eValue; + jObj.put("resourceType", resourceName) + } } def rl_props = utils.getIdenticalChildren(node, "related-to-property") @@ -412,6 +417,8 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { if (serviceRelationShip != null) { relationShipList = jsonSlurper.parseText(serviceRelationShip) } + + List<Resource> deleteRealResourceList = new ArrayList<Resource>(); //Set the real resource instance id to the decomosed resource list for (Resource resource: deleteResourceList) { @@ -421,13 +428,17 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { if (relationShipList != null) { relationShipList.each { if (StringUtils.containsIgnoreCase(it.resourceType, resource.getModelInfo().getModelName())) { - resource.setResourceId(it.resourceInstanceId); + resource.setResourceId(it.resourceInstanceId) + deleteRealResourceList.add(resource) } } } } - execution.setVariable("deleteResourceList", deleteResourceList) - utils.log("DEBUG", "delete resource list : " + deleteResourceList, isDebugEnabled) + + // only delete real existing resources + execution.setVariable("deleteResourceList", deleteRealResourceList) + + utils.log("DEBUG", "delete resource list : " + deleteRealResourceList, isDebugEnabled) } catch (Exception ex) { String exceptionMessage = "Bpmn error encountered in create generic e2e service flow. processDecomposition() - " + ex.getMessage() utils.log("DEBUG", exceptionMessage, isDebugEnabled) |