From 5dadc2c5790c961a74085d3d10b6f5aec6b7ba30 Mon Sep 17 00:00:00 2001 From: Marcus G K Williams Date: Thu, 1 Nov 2018 14:35:21 -0700 Subject: Fix msb url in homing cloudsite This change adds a getMsbHost method to homingUtils to enable correct configuration of the msburl used in identity_services for multicloud. Issue-ID: SO-1180 Change-Id: Ib7adecda98b1d5f5770e2d17a2e76c970619ab46 Signed-off-by: Marcus G K Williams --- .../org/onap/so/bpmn/common/scripts/OofHoming.groovy | 18 +++++++++++++----- .../org/onap/so/bpmn/common/scripts/OofUtils.groovy | 8 ++++++++ 2 files changed, 21 insertions(+), 5 deletions(-) (limited to 'bpmn/MSOCommonBPMN/src/main/groovy/org') diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy index 533df72285..c8736b8f0e 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy @@ -250,7 +250,7 @@ class OofHoming extends AbstractServiceTaskProcessor { resource.getHomingSolution().setCloudOwner(cloudOwner) resource.getHomingSolution().setCloudRegionId(cloudRegionId) - CloudSite cloudSite = new CloudSite(); + CloudSite cloudSite = new CloudSite() cloudSite.setId(cloudRegionId) cloudSite.setRegionId(cloudRegionId) String orchestrator = execution.getVariable("orchestrator") @@ -258,10 +258,18 @@ class OofHoming extends AbstractServiceTaskProcessor { cloudSite.setOrchestrator(orchestrator) } - CloudIdentity cloudIdentity = new CloudIdentity(); - cloudIdentity.setId(cloudRegionId); - cloudIdentity.setIdentityUrl("/api/multicloud /v1/" + cloudOwner + "/" + cloudRegionId + "/infra_workload") - cloudSite.setIdentityService(cloudIdentity); + CloudIdentity cloudIdentity = new CloudIdentity() + cloudIdentity.setId(cloudRegionId) + // Get MSB Url + String msbHost = oofUtils.getMsbHost(execution) + String multicloudApiEndpoint = UrnPropertiesReader + .getVariable("mso.multicloud.api.endpoint", execution, + "/api/multicloud-titaniumcloud/v1") + cloudIdentity.setIdentityUrl(msbHost + multicloudApiEndpoint + + "/" + cloudOwner + "/" + + cloudRegionId + "/infra_workload") + + cloudSite.setIdentityService(cloudIdentity) // Set cloudsite in catalog DB here oofUtils.createCloudSiteCatalogDb(cloudSite) diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy index 197589efa1..ae1079a9bf 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy @@ -526,4 +526,12 @@ class OofUtils { exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from CatalogDB.") } } + + String getMsbHost(DelegateExecution execution) { + msbHost = UrnPropertiesReader.getVariable("mso.msb.host", execution, "msb-iag.onap") + + Integer msbPort = UrnPropertiesReader.getVariable("mso.msb.port", execution, "80").toInteger() + + return UriBuilder.fromPath("").host(msbHost).port(msbPort).scheme("http").build().toString() + } } -- cgit 1.2.3-korg