summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRob Daugherty <rd472p@att.com>2018-11-06 15:14:33 +0000
committerGerrit Code Review <gerrit@onap.org>2018-11-06 15:14:33 +0000
commit89f384164a2712f7515497fe16b55e585266c79b (patch)
tree6dc9af83cf91b5aa52d63b658dfa3107559189b6
parent5d660cbc1a5028f52d63185ab7db0b1b465a981b (diff)
parent5dadc2c5790c961a74085d3d10b6f5aec6b7ba30 (diff)
Merge "Fix msb url in homing cloudsite" into casablanca
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy18
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy8
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/UrnPropertiesReader.java4
3 files changed, 25 insertions, 5 deletions
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 c7312c453c..909683adea 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
@@ -530,4 +530,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()
+ }
}
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/UrnPropertiesReader.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/UrnPropertiesReader.java
index 968c8c1590..750cd241e8 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/UrnPropertiesReader.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/UrnPropertiesReader.java
@@ -69,6 +69,10 @@ public class UrnPropertiesReader {
return variableValue;
}
+ public static String getVariable(String variableName, DelegateExecution execution, String defaultValue) {
+ return Optional.ofNullable(getVariable(variableName, execution)).orElse(defaultValue);
+ }
+
/**
* Return the URN property value from the environment object
* @param variableName URN property name