From ef58615371f366eb8415f69b73ad5e0d52910a11 Mon Sep 17 00:00:00 2001 From: Marcus G K Williams Date: Thu, 31 May 2018 03:52:10 -0700 Subject: Fix OOF serviceResourceId bug - Works around a bug in OOF where OOF does not return a serviceResourceId with homing solutions. SO uses serviceResourceId to match a homing deman to a homing request. This patch addes resourceModuleName as another way to match a demand to a request, as currently OOF needs this to be unique. - Changes SO homing processing of key cloudRegionId to key locationId as this is now the key used for cloudRegionId in solutions sent back from OOF Issue-ID: OPTFRA-249 Change-Id: I8e5d9244a227ea4d3d061a758f202144bac270ce Signed-off-by: Marcus G K Williams --- .../openecomp/mso/bpmn/common/scripts/OofHoming.groovy | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'bpmn/MSOCommonBPMN/src/main/groovy/org') diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/OofHoming.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/OofHoming.groovy index d6576b7dce..df6b27f04d 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/OofHoming.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/OofHoming.groovy @@ -28,6 +28,7 @@ import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils import org.openecomp.mso.bpmn.core.domain.CloudFlavor import org.openecomp.mso.bpmn.core.domain.InventoryType import org.openecomp.mso.bpmn.core.domain.Resource +import org.openecomp.mso.bpmn.core.domain.ResourceType import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition import org.openecomp.mso.bpmn.core.domain.Subscriber import org.openecomp.mso.bpmn.core.domain.VnfResource @@ -210,9 +211,16 @@ class OofHoming extends AbstractServiceTaskProcessor { JSONObject placement = arrSol.getJSONObject(j) utils.log("DEBUG", "****** JSONObject is: " + placement + " *****", "true") String jsonServiceResourceId = placement.getString("serviceResourceId") + String jsonResourceModuleName = placement.getString("resourceModuleName") for (Resource resource : resourceList) { String serviceResourceId = resource.getResourceId() - if (serviceResourceId.equalsIgnoreCase(jsonServiceResourceId)) { + String resourceModuleName = "" + if (resource.getResourceType() == ResourceType.ALLOTTED_RESOURCE || + resource.getResourceType() == ResourceType.VNF) { + resourceModuleName = resource.getNfFunction() + } + if (serviceResourceId.equalsIgnoreCase(jsonServiceResourceId) || + resourceModuleName.equalsIgnoreCase(jsonResourceModuleName)) { JSONObject solution = placement.getJSONObject("solution") String solutionType = solution.getString("identifierType") String inventoryType = "" @@ -249,9 +257,10 @@ class OofHoming extends AbstractServiceTaskProcessor { flavorsArrayList.add(cloudFlavor) } } - Map assignmentMap = jsonUtil.entryArrayToMap(execution, assignmentArr.toString(), "key", "value") + Map assignmentMap = jsonUtil.entryArrayToMap(execution, + assignmentArr.toString(), "key", "value") String cloudOwner = assignmentMap.get("cloudOwner") - String cloudRegionId = assignmentMap.get("cloudRegionId") + String cloudRegionId = assignmentMap.get("locationId") resource.getHomingSolution().setCloudOwner(cloudOwner) resource.getHomingSolution().setCloudRegionId(cloudRegionId) if (flavorsArrayList != null && flavorsArrayList.size != 0) { -- cgit 1.2.3-korg