aboutsummaryrefslogtreecommitdiffstats
path: root/adapters/mso-openstack-adapters/src/main
diff options
context:
space:
mode:
authorEric Multanen <eric.w.multanen@intel.com>2018-09-25 17:00:35 -0700
committerEric Multanen <eric.w.multanen@intel.com>2018-09-27 23:45:15 -0700
commit52a736802c707d75104dff25d551a1f8df76d100 (patch)
treed36de22097f436fe63dfb46a8a783e93a7de0eae /adapters/mso-openstack-adapters/src/main
parentf09633016b12f728d19cde29afde7b3bc22228ea (diff)
Fix calls to multicloud adapter
Fix up the json body of the POST call to multicloud. Improve checkout of responses from multicloud calls. Change-Id: I1fb47460b54e9e5b478815d3b531d5bdbe1fe3dc Issue-ID: SO-1082 Signed-off-by: Eric Multanen <eric.w.multanen@intel.com>
Diffstat (limited to 'adapters/mso-openstack-adapters/src/main')
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java49
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestUtils.java19
2 files changed, 43 insertions, 25 deletions
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java
index e9567170dd..9a64e62e57 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java
@@ -710,6 +710,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
CloudSite cloudSite = cloudSiteOp.get();
MavenLikeVersioning aicV = new MavenLikeVersioning();
aicV.setVersion(cloudSite.getCloudVersion());
+ Boolean usingMulticloud = getUsingMulticloud(cloudSite);
String vnfMin = vnfResource.getAicVersionMin();
String vnfMax = vnfResource.getAicVersionMax();
@@ -732,23 +733,25 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
// Use the VduPlugin.
VduPlugin vduPlugin = getVduPlugin(cloudSiteId);
- // First, look up to see if the VF already exists.
+ // First, look up to see if the VF already exists, unless using multicloud adapter
long subStartTime1 = System.currentTimeMillis ();
- try {
- vduInstance = vduPlugin.queryVdu (cloudInfo, vfModuleName);
- LOGGER.recordMetricEvent (subStartTime1, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from VduPlugin", "VDU", "QueryVDU", vfModuleName);
- }
- catch (VduException me) {
- // Failed to query the VDU due to a plugin exception.
- String error = "Create VF Module: Query " + vfModuleName + " in " + cloudSiteId + "/" + tenantId + ": " + me ;
- LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, vfModuleName, cloudSiteId, tenantId, "VDU", "queryVdu", MsoLogger.ErrorCode.DataError, "Exception - queryVdu", me);
- LOGGER.recordMetricEvent (subStartTime1, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "VDU", "QueryVdu", vfModuleName);
- LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
+ if (!usingMulticloud) {
+ try {
+ vduInstance = vduPlugin.queryVdu (cloudInfo, vfModuleName);
+ LOGGER.recordMetricEvent (subStartTime1, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from VduPlugin", "VDU", "QueryVDU", vfModuleName);
+ }
+ catch (VduException me) {
+ // Failed to query the VDU due to a plugin exception.
+ String error = "Create VF Module: Query " + vfModuleName + " in " + cloudSiteId + "/" + tenantId + ": " + me ;
+ LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, vfModuleName, cloudSiteId, tenantId, "VDU", "queryVdu", MsoLogger.ErrorCode.DataError, "Exception - queryVdu", me);
+ LOGGER.recordMetricEvent (subStartTime1, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "VDU", "QueryVdu", vfModuleName);
+ LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
- // Convert to a generic VnfException
- me.addContext ("CreateVFModule");
- throw new VnfException (me);
+ // Convert to a generic VnfException
+ me.addContext ("CreateVFModule");
+ throw new VnfException (me);
+ }
}
// More precise handling/messaging if the Module already exists
@@ -810,7 +813,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
Map<String, Object> volumeGroupOutputs = null;
// If a Volume Group was provided, query its outputs for inclusion in Module input parameters
- if (volumeGroupId != null) {
+ if (!usingMulticloud && volumeGroupId != null) {
long subStartTime2 = System.currentTimeMillis ();
VduInstance volumeVdu = null;
try {
@@ -858,7 +861,8 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
LOGGER.debug ("WARNING: Add-on Module request - no Base Module ID provided");
}
- if (baseVfModuleId != null) {
+ // Need to verify if multicloud needs to have the vaseVfModuleId passed to it. Ignoring this for now.
+ if (!usingMulticloud && baseVfModuleId != null) {
long subStartTime2 = System.currentTimeMillis ();
VduInstance baseVdu = null;
try {
@@ -979,9 +983,8 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
}
if (!extraInputs.isEmpty()) {
- // Add directive inputs
- String[] directives = { "oof_directives", "sdnc_directives" };
- for (String key : directives) {
+ // Add multicloud inputs
+ for (String key : MsoMulticloudUtils.MULTICLOUD_INPUTS) {
if (extraInputs.contains(key)) {
goldenInputs.put(key, inputs.get(key));
extraInputs.remove(key);
@@ -1242,4 +1245,12 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
// Default - return HEAT plugin, though will fail later
return heatUtils;
}
+
+ private Boolean getUsingMulticloud (CloudSite cloudSite) {
+ if (cloudSite.getOrchestrator().equalsIgnoreCase("MULTICLOUD")) {
+ return true;
+ } else {
+ return false;
+ }
+ }
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestUtils.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestUtils.java
index 88f102c2a5..c332c49832 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestUtils.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestUtils.java
@@ -33,6 +33,10 @@ public class VnfAdapterRestUtils
{
private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, VnfAdapterRestUtils.class);
+ private static final String HEAT_MODE = "HEAT";
+ private static final String CLOUDIFY_MODE = "CLOUDIFY";
+ private static final String MULTICLOUD_MODE = "MULTICLOUD";
+
@Autowired
private CloudConfig cloudConfig;
@@ -65,9 +69,12 @@ public class VnfAdapterRestUtils
if (cloudSite.isPresent()) {
LOGGER.debug("Got CloudSite: " + cloudSite.toString());
if (cloudConfig.getCloudifyManager(cloudSite.get().getCloudifyId()) != null) {
- mode = "CLOUDIFY";
- } else {
- mode = "HEAT";
+ mode = CLOUDIFY_MODE;
+ } else if (MULTICLOUD_MODE.equalsIgnoreCase(cloudSite.get().getOrchestrator())) {
+ mode = MULTICLOUD_MODE;
+ }
+ else {
+ mode = HEAT_MODE;
}
}
}
@@ -77,15 +84,15 @@ public class VnfAdapterRestUtils
MsoVnfAdapter vnfAdapter = null;
// TODO: Make this more dynamic (e.g. Service Loader)
- if ("CLOUDIFY".equalsIgnoreCase(mode)) {
+ if (CLOUDIFY_MODE.equalsIgnoreCase(mode)) {
LOGGER.debug ("GetVnfAdapterImpl: Return Cloudify Adapter");
vnfAdapter = cloudifyImpl;
}
- else if ("HEAT".equalsIgnoreCase(mode)) {
+ else if (HEAT_MODE.equalsIgnoreCase(mode)) {
LOGGER.debug ("GetVnfAdapterImpl: Return Heat Adapter");
vnfAdapter = vnfImpl;
}
- else if ("MULTICLOUD".equalsIgnoreCase(mode)) {
+ else if (MULTICLOUD_MODE.equalsIgnoreCase(mode)) {
LOGGER.debug ("GetVnfAdapterImpl: Return Plugin (multicloud) Adapter");
vnfAdapter = vnfPluginImpl;
}