summaryrefslogtreecommitdiffstats
path: root/adapters
diff options
context:
space:
mode:
authorMarcus Williams <marcus.williams@intel.com>2019-04-06 00:23:57 +0000
committerGerrit Code Review <gerrit@onap.org>2019-04-06 00:23:57 +0000
commitb2364f2a5d7e4c0543620792afdde129c4c56049 (patch)
treedbb6750ddc87a312816a6542ed86824e60fa78ca /adapters
parentefb92496a6f10a18e2b894b7a81eed7ce87466af (diff)
parent1db62bd999239e919c8df2625c453f74596c21dd (diff)
Merge "Add tenantId to multicloud request header"
Diffstat (limited to 'adapters')
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java16
1 files changed, 10 insertions, 6 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java
index 1fabcb279c..6d4deeb0f1 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java
@@ -45,6 +45,7 @@ import org.onap.so.adapters.vdu.VduModelInfo;
import org.onap.so.adapters.vdu.VduPlugin;
import org.onap.so.adapters.vdu.VduStateType;
import org.onap.so.adapters.vdu.VduStatus;
+import org.onap.so.client.HttpClient;
import org.onap.so.client.HttpClientFactory;
import org.onap.so.client.RestClient;
import org.onap.so.logger.ErrorCode;
@@ -207,7 +208,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{
}
String multicloudEndpoint = getMulticloudEndpoint(cloudSiteId, cloudOwner, null);
- RestClient multicloudClient = getMulticloudClient(multicloudEndpoint);
+ RestClient multicloudClient = getMulticloudClient(multicloudEndpoint, tenantId);
if (multicloudClient == null) {
MsoOpenstackException me = new MsoOpenstackException(0, "", "Multicloud client could not be initialized");
@@ -289,7 +290,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{
returnInfo.setName(stackName);
String multicloudEndpoint = getMulticloudEndpoint(cloudSiteId, cloudOwner, stackId);
- RestClient multicloudClient = getMulticloudClient(multicloudEndpoint);
+ RestClient multicloudClient = getMulticloudClient(multicloudEndpoint, tenantId);
if (multicloudClient != null) {
Response response = multicloudClient.get();
@@ -343,7 +344,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{
Response response = null;
String multicloudEndpoint = getMulticloudEndpoint(cloudSiteId, cloudOwner, stackId);
- RestClient multicloudClient = getMulticloudClient(multicloudEndpoint);
+ RestClient multicloudClient = getMulticloudClient(multicloudEndpoint, tenantId);
if (multicloudClient != null) {
response = multicloudClient.delete();
@@ -392,7 +393,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{
multicloudRequest.setVfModuleId(vfModuleId);
String multicloudEndpoint = getMulticloudEndpoint(cloudSiteId, cloudOwner, workloadId);
- RestClient multicloudClient = getMulticloudClient(multicloudEndpoint);
+ RestClient multicloudClient = getMulticloudClient(multicloudEndpoint, tenantId);
if (multicloudClient == null) {
if (logger.isDebugEnabled())
@@ -708,12 +709,15 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{
}
}
- private RestClient getMulticloudClient(String endpoint) {
- RestClient client = null;
+ private RestClient getMulticloudClient(String endpoint, String tenantId) {
+ HttpClient client = null;
try {
client = httpClientFactory.newJsonClient(
new URL(endpoint),
TargetEntity.MULTICLOUD);
+ if (tenantId != null && !tenantId.isEmpty()) {
+ client.addAdditionalHeader("Project", tenantId);
+ }
} catch (MalformedURLException e) {
logger.debug(String.format("Encountered malformed URL error getting multicloud rest client %s", e.getMessage()));
} catch (IllegalArgumentException e) {