diff options
author | Eric Multanen <eric.w.multanen@intel.com> | 2019-03-30 02:20:01 -0700 |
---|---|---|
committer | Eric Multanen <eric.w.multanen@intel.com> | 2019-04-02 18:44:18 -0700 |
commit | a0b95750675d602db85191e0875b4e41734db960 (patch) | |
tree | 2812c3fc1c7824660a245b6bfb9f2a976b88635b /adapters/mso-openstack-adapters/src/main/java | |
parent | 4a74d94ea4604504325b320d499e2f3708ef1514 (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-openstack-adapters/src/main/java')
-rw-r--r-- | adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java | 59 |
1 files changed, 33 insertions, 26 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 62c373bea8..0dad10b5cc 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 @@ -707,29 +707,32 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { // Perform a version check against cloudSite // Obtain the cloud site information where we will create the VF Module + Boolean usingMulticloud = false; Optional<CloudSite> cloudSiteOp = cloudConfig.getCloudSite (cloudSiteId); if (!cloudSiteOp.isPresent()) { - throw new VnfException (new MsoCloudSiteNotFound (cloudSiteId)); - } - CloudSite cloudSite = cloudSiteOp.get(); - MavenLikeVersioning aicV = new MavenLikeVersioning(); - aicV.setVersion(cloudSite.getCloudVersion()); - Boolean usingMulticloud = getUsingMulticloud(cloudSite); - - String vnfMin = vnfResource.getAicVersionMin(); - String vnfMax = vnfResource.getAicVersionMax(); - - if ((vnfMin != null && !(aicV.isMoreRecentThan(vnfMin) || aicV.isTheSameVersion(vnfMin))) || (vnfMax != null - && aicV.isMoreRecentThan(vnfMax))) { - // ERROR - String error = - "VNF Resource type: " + vnfResource.getModelName() + ", ModelUuid=" + vnfResource.getModelUUID() - + " VersionMin=" + vnfMin + " VersionMax:" + vnfMax + " NOT supported on Cloud: " + cloudSiteId - + " with AIC_Version:" + cloudSite.getCloudVersion(); - logger.error("{} {} {} {} {}", MessageEnum.RA_CONFIG_EXC.toString(), error, "OpenStack", - ErrorCode.BusinessProcesssError.getValue(), "Exception - setVersion"); - logger.debug(error); - throw new VnfException(error, MsoExceptionCategory.USERDATA); + // If cloudSiteId is not present in the catalog DB, then default to multicloud + usingMulticloud = true; + } else { + CloudSite cloudSite = cloudSiteOp.get(); + MavenLikeVersioning aicV = new MavenLikeVersioning(); + aicV.setVersion(cloudSite.getCloudVersion()); + usingMulticloud = getUsingMulticloud(cloudSite); + + String vnfMin = vnfResource.getAicVersionMin(); + String vnfMax = vnfResource.getAicVersionMax(); + + if ((vnfMin != null && !(aicV.isMoreRecentThan(vnfMin) || aicV.isTheSameVersion(vnfMin))) || (vnfMax != null + && aicV.isMoreRecentThan(vnfMax))) { + // ERROR + String error = + "VNF Resource type: " + vnfResource.getModelName() + ", ModelUuid=" + vnfResource.getModelUUID() + + " VersionMin=" + vnfMin + " VersionMax:" + vnfMax + " NOT supported on Cloud: " + cloudSiteId + + " with AIC_Version:" + cloudSite.getCloudVersion(); + logger.error("{} {} {} {} {}", MessageEnum.RA_CONFIG_EXC.toString(), error, "OpenStack", + ErrorCode.BusinessProcesssError.getValue(), "Exception - setVersion"); + logger.debug(error); + throw new VnfException(error, MsoExceptionCategory.USERDATA); + } } // End Version check @@ -1261,12 +1264,16 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter { else if (orchestrator.equalsIgnoreCase("HEAT")) { return heatUtils; } - if (orchestrator.equalsIgnoreCase("MULTICLOUD")) { - logger.debug ("Got MulticloudUtils for vduPlugin"); - return multicloudUtils; } + else if (orchestrator.equalsIgnoreCase("MULTICLOUD")) { + return multicloudUtils; + } + else { + // Default if cloudSite record exists - return HEAT plugin - will fail later + return heatUtils; + } } - // Default - return HEAT plugin, though will fail later - return heatUtils; + // Default if no cloudSite record exists - return multicloud plugin + return multicloudUtils; } private Boolean getUsingMulticloud (CloudSite cloudSite) { |