aboutsummaryrefslogtreecommitdiffstats
path: root/adapters/mso-adapter-utils/src/main/java
diff options
context:
space:
mode:
authorEric Multanen <eric.w.multanen@intel.com>2019-03-30 02:20:01 -0700
committerEric Multanen <eric.w.multanen@intel.com>2019-04-02 18:44:18 -0700
commita0b95750675d602db85191e0875b4e41734db960 (patch)
tree2812c3fc1c7824660a245b6bfb9f2a976b88635b /adapters/mso-adapter-utils/src/main/java
parent4a74d94ea4604504325b320d499e2f3708ef1514 (diff)
Construct multicloud infra_workload endpoint
Use the cloudOwner and cloudRegion to construct the multicloud endpoint for the multicloud VNF plugin adapter. Use configuration to obtain the MSB IP and port number. Stop using the cloud sites catalog DB since there is only a single endpoint required talking to multicloud. Change-Id: I0e9b45a51b6e36f4782226f851e7d01de7f1b133 Issue-ID: SO-1447 Signed-off-by: Eric Multanen <eric.w.multanen@intel.com>
Diffstat (limited to 'adapters/mso-adapter-utils/src/main/java')
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java14
1 files changed, 11 insertions, 3 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 fec4a1d16c..f39962b2ce 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
@@ -33,6 +33,7 @@ import java.util.List;
import java.util.Map;
import java.util.Scanner;
import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriBuilder;
import javax.ws.rs.core.UriBuilderException;
import org.onap.so.adapters.vdu.CloudInfo;
import org.onap.so.adapters.vdu.PluginAction;
@@ -46,7 +47,6 @@ import org.onap.so.adapters.vdu.VduStateType;
import org.onap.so.adapters.vdu.VduStatus;
import org.onap.so.client.HttpClientFactory;
import org.onap.so.client.RestClient;
-import org.onap.so.db.catalog.beans.CloudSite;
import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.onap.so.openstack.beans.HeatStatus;
@@ -77,6 +77,9 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{
private static final Logger logger = LoggerFactory.getLogger(MsoMulticloudUtils.class);
private static final ObjectMapper JSON_MAPPER = new ObjectMapper();
+ private static final Integer DEFAULT_MSB_PORT = 80;
+ private static final String DEFAULT_MSB_IP = "127.0.0.1";
+ private static final String ONAP_IP = "ONAP_IP";
private final HttpClientFactory httpClientFactory = new HttpClientFactory();
@Autowired
@@ -594,10 +597,15 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{
}
private String getMulticloudEndpoint(String cloudSiteId, String cloudOwner, String workloadId) throws MsoCloudSiteNotFound {
+ String msbIp = System.getenv().get(ONAP_IP);
+ if (null == msbIp || msbIp.isEmpty()) {
+ msbIp = environment.getProperty("mso.msb-ip", DEFAULT_MSB_IP);
+ }
+ Integer msbPort = environment.getProperty("mso.msb-port", Integer.class, DEFAULT_MSB_PORT);
- CloudSite cloudSite = cloudConfig.getCloudSite(cloudSiteId).orElseThrow(() -> new MsoCloudSiteNotFound(cloudSiteId));
- String endpoint = cloudSite.getIdentityService().getIdentityUrl();
+ String path = "/api/multicloud/v1/" + cloudOwner + "/" + cloudSiteId + "/infra_workload";
+ String endpoint = UriBuilder.fromPath(path).host(msbIp).port(msbPort).scheme("http").build().toString();
if (workloadId != null) {
if (logger.isDebugEnabled()) {
logger.debug(String.format("Multicloud Endpoint is: %s/%s", endpoint, workloadId));