aboutsummaryrefslogtreecommitdiffstats
path: root/adapters/mso-openstack-adapters/src/main/java
diff options
context:
space:
mode:
authorBenjamin, Max (mb388a) <mb388a@us.att.com>2018-08-13 09:48:57 -0400
committerBenjamin, Max (mb388a) <mb388a@us.att.com>2018-08-13 09:51:54 -0400
commita81aef2172c2cb4c6735f6018aee7deb04140b5d (patch)
tree2ef9daca8d8a075142d1f900bb8862c6ce322491 /adapters/mso-openstack-adapters/src/main/java
parentc703669697084b5bd9be0f8f016bbf8ed11213a4 (diff)
Cloud config database table support
added cloud config database entities added cloud config repository converted existing cloud config class converted all code interacting with previous cloud config object created migration to automatically load cloud config properties from application.yaml Issue-ID: SO-854 Change-Id: Icf408e5d0fcabd1b7e97298963c555fae6964930 Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'adapters/mso-openstack-adapters/src/main/java')
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/db/migration/CloudConfig.java67
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/db/migration/R__CloudConfigMigration.java167
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/db/migration/V4_2__DummyMigration.java12
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java8
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/MsoOpenstackAdaptersApplication.java4
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java10
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java6
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java6
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestUtils.java2
9 files changed, 264 insertions, 18 deletions
diff --git a/adapters/mso-openstack-adapters/src/main/java/db/migration/CloudConfig.java b/adapters/mso-openstack-adapters/src/main/java/db/migration/CloudConfig.java
new file mode 100644
index 0000000000..0309c88dac
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/main/java/db/migration/CloudConfig.java
@@ -0,0 +1,67 @@
+package db.migration;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import org.onap.so.db.catalog.beans.CloudIdentity;
+import org.onap.so.db.catalog.beans.CloudSite;
+import org.onap.so.db.catalog.beans.CloudifyManager;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @deprecated
+ * This class is introduced as deprecated as its only purpose is for migration of cloud config data. It shouldnt be used elsewhere.
+ */
+
+@Deprecated
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class CloudConfig {
+ @JsonProperty("identity_services")
+ private Map<String, CloudIdentity> identityServices = new HashMap<>();
+
+ @JsonProperty("cloud_sites")
+ private Map<String, CloudSite> cloudSites = new HashMap<>();
+
+ @JsonProperty("cloudify_managers")
+ private Map<String, CloudifyManager> cloudifyManagers = new HashMap<>();
+
+
+ public Map<String, CloudIdentity> getIdentityServices() {
+ return identityServices;
+ }
+
+ public void setIdentityServices(Map<String, CloudIdentity> identityServices) {
+ this.identityServices = identityServices;
+ }
+
+ public Map<String, CloudSite> getCloudSites() {
+ return cloudSites;
+ }
+
+ public void setCloudSites(Map<String, CloudSite> cloudSites) {
+ this.cloudSites = cloudSites;
+ }
+
+ public Map<String, CloudifyManager> getCloudifyManagers() {
+ return cloudifyManagers;
+ }
+
+ public void setCloudifyManagers(Map<String, CloudifyManager> cloudifyManagers) {
+ this.cloudifyManagers = cloudifyManagers;
+ }
+
+ public void populateId(){
+ for (Map.Entry<String, CloudIdentity> entry : identityServices.entrySet()) {
+ entry.getValue().setId(entry.getKey());
+ }
+
+ for (Map.Entry <String, CloudSite> entry : cloudSites.entrySet()) {
+ entry.getValue().setId(entry.getKey());
+ }
+
+ for (Map.Entry<String, CloudifyManager> entry : cloudifyManagers.entrySet()) {
+ entry.getValue().setId(entry.getKey());
+ }
+ }
+}
diff --git a/adapters/mso-openstack-adapters/src/main/java/db/migration/R__CloudConfigMigration.java b/adapters/mso-openstack-adapters/src/main/java/db/migration/R__CloudConfigMigration.java
new file mode 100644
index 0000000000..fd2ec179dc
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/main/java/db/migration/R__CloudConfigMigration.java
@@ -0,0 +1,167 @@
+package db.migration;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
+import org.flywaydb.core.api.MigrationVersion;
+import org.flywaydb.core.api.migration.MigrationChecksumProvider;
+import org.flywaydb.core.api.migration.MigrationInfoProvider;
+import org.flywaydb.core.api.migration.jdbc.JdbcMigration;
+import org.onap.so.db.catalog.beans.CloudIdentity;
+import org.onap.so.db.catalog.beans.CloudSite;
+import org.onap.so.db.catalog.beans.CloudifyManager;
+import org.onap.so.logger.MsoLogger;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.Statement;
+import java.util.Collection;
+
+/**
+ * Performs migration using JDBC Connection from the cloud config provided in the environment (application-{profile}.yaml) and persist data (when not already present) to the catalod database.
+ */
+@JsonIgnoreProperties(ignoreUnknown = true)
+public class R__CloudConfigMigration implements JdbcMigration , MigrationInfoProvider, MigrationChecksumProvider {
+ public static final String FLYWAY = "FLYWAY";
+
+ private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, R__CloudConfigMigration.class);
+ @JsonProperty("cloud_config")
+ private CloudConfig cloudConfig;
+
+ @Override
+ public void migrate(Connection connection) throws Exception {
+ LOGGER.debug("Starting migration for CloudConfig");
+ CloudConfig cloudConfig = loadCloudConfig();
+ if(cloudConfig == null){
+ LOGGER.debug("No CloudConfig defined in :"+getApplicationYamlName()+" exiting.");
+ }else{
+ migrateCloudIdentity(cloudConfig.getIdentityServices().values(), connection);
+ migrateCloudSite(cloudConfig.getCloudSites().values(), connection);
+ migrateCloudifyManagers(cloudConfig.getCloudifyManagers().values(), connection);
+ }
+ }
+
+ public CloudConfig getCloudConfig() {
+ return cloudConfig;
+ }
+
+ public void setCloudConfig(CloudConfig cloudConfig) {
+ this.cloudConfig = cloudConfig;
+ }
+
+ private CloudConfig loadCloudConfig() throws Exception {
+ ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
+ R__CloudConfigMigration cloudConfigMigration = mapper.readValue(R__CloudConfigMigration.class
+ .getResourceAsStream(getApplicationYamlName()), R__CloudConfigMigration.class);
+ CloudConfig cloudConfig = cloudConfigMigration.getCloudConfig();
+ if(cloudConfig != null){
+ cloudConfig.populateId();
+ }
+
+ return cloudConfig;
+ }
+
+ private String getApplicationYamlName() {
+ String profile = System.getProperty("spring.profiles.active") == null ? "" : "-" + System.getProperty("spring.profiles.active");
+ return "/application" + profile + ".yaml";
+ }
+
+ private void migrateCloudIdentity(Collection<CloudIdentity> entities, Connection connection) throws Exception {
+ LOGGER.debug("Starting migration for CloudConfig-->IdentityService");
+ String insert = "INSERT INTO `identity_services` (`ID`, `IDENTITY_URL`, `MSO_ID`, `MSO_PASS`, `ADMIN_TENANT`, `MEMBER_ROLE`, `TENANT_METADATA`, `IDENTITY_SERVER_TYPE`, `IDENTITY_AUTHENTICATION_TYPE`, `LAST_UPDATED_BY`) " +
+ "VALUES (?,?,?,?,?,?,?,?,?,?);";
+ PreparedStatement ps = connection.prepareStatement(insert);
+ try (Statement stmt = connection.createStatement()) {
+ for (CloudIdentity cloudIdentity : entities) {
+ try (ResultSet rows = stmt.executeQuery("Select count(1) from identity_services where id='" + cloudIdentity.getId() + "'")) {
+ int count = 0;
+ while (rows.next()) {
+ count = rows.getInt(1);
+ }
+ if (count == 0) {
+ ps.setString(1, cloudIdentity.getId());
+ ps.setString(2, cloudIdentity.getIdentityUrl());
+ ps.setString(3, cloudIdentity.getMsoId());
+ ps.setString(4, cloudIdentity.getMsoPass());
+ ps.setString(5, cloudIdentity.getAdminTenant());
+ ps.setString(6, cloudIdentity.getMemberRole());
+ ps.setBoolean(7, cloudIdentity.getTenantMetadata());
+ ps.setString(8, cloudIdentity.getIdentityServerType() != null ? cloudIdentity.getIdentityServerType().name() : null);
+ ps.setString(9, cloudIdentity.getIdentityAuthenticationType() != null ? cloudIdentity.getIdentityAuthenticationType().name() : null);
+ ps.setString(10, FLYWAY);
+ ps.executeUpdate();
+ }
+ }
+ }
+ }
+ }
+
+ private void migrateCloudSite(Collection<CloudSite> entities, Connection connection) throws Exception {
+ LOGGER.debug("Starting migration for CloudConfig-->CloudSite");
+ String insert = "INSERT INTO `cloud_sites` (`ID`, `REGION_ID`, `IDENTITY_SERVICE_ID`, `CLOUD_VERSION`, `CLLI`, `CLOUDIFY_ID`, `PLATFORM`, `ORCHESTRATOR`, `LAST_UPDATED_BY`) " +
+ "VALUES (?,?,?,?,?,?,?,?,?);";
+ PreparedStatement ps = connection.prepareStatement(insert);
+ try (Statement stmt = connection.createStatement()) {
+ for (CloudSite cloudSite : entities) {
+ try (ResultSet rows = stmt.executeQuery("Select count(1) from cloud_sites where id='" + cloudSite.getId() + "'")) {
+ int count = 0;
+ while (rows.next()) {
+ count = rows.getInt(1);
+ }
+ if (count == 0) {
+ ps.setString(1, cloudSite.getId());
+ ps.setString(2, cloudSite.getRegionId());
+ ps.setString(3, cloudSite.getIdentityServiceId());
+ ps.setString(4, cloudSite.getCloudVersion());
+ ps.setString(5, cloudSite.getClli());
+ ps.setString(6, cloudSite.getCloudifyId());
+ ps.setString(7, cloudSite.getPlatform());
+ ps.setString(8, cloudSite.getOrchestrator());
+ ps.setString(9, FLYWAY);
+ ps.executeUpdate();
+ }
+ }
+ }
+ }
+ }
+
+ private void migrateCloudifyManagers(Collection<CloudifyManager> entities, Connection connection) throws Exception {
+ String insert = "INSERT INTO `cloudify_managers` (`ID`, `CLOUDIFY_URL`, `USERNAME`, `PASSWORD`, `VERSION`, `LAST_UPDATED_BY`)" +
+ " VALUES (?,?,?,?,?,?);";
+ PreparedStatement ps = connection.prepareStatement(insert);
+ try (Statement stmt = connection.createStatement()) {
+ for (CloudifyManager cloudifyManager : entities) {
+ try (ResultSet rows = stmt.executeQuery("Select count(1) from cloudify_managers where id='" + cloudifyManager.getId() + "'")) {
+ int count = 0;
+ while (rows.next()) {
+ count = rows.getInt(1);
+ }
+ if (count == 0) {
+ ps.setString(1, cloudifyManager.getId());
+ ps.setString(2, cloudifyManager.getCloudifyUrl());
+ ps.setString(3, cloudifyManager.getUsername());
+ ps.setString(4, cloudifyManager.getPassword());
+ ps.setString(5, cloudifyManager.getVersion());
+ ps.setString(6, FLYWAY);
+ ps.executeUpdate();
+ }
+ }
+ }
+ }
+ }
+
+ public MigrationVersion getVersion() {
+ return null;
+ }
+
+ public String getDescription() {
+ return "R_CloudConfigMigration";
+ }
+
+ public Integer getChecksum() {
+ return Math.toIntExact(System.currentTimeMillis() / 1000);
+ }
+}
+
diff --git a/adapters/mso-openstack-adapters/src/main/java/db/migration/V4_2__DummyMigration.java b/adapters/mso-openstack-adapters/src/main/java/db/migration/V4_2__DummyMigration.java
new file mode 100644
index 0000000000..6530b7ba7c
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/main/java/db/migration/V4_2__DummyMigration.java
@@ -0,0 +1,12 @@
+package db.migration;
+
+import org.flywaydb.core.api.migration.jdbc.JdbcMigration;
+
+import java.sql.Connection;
+
+public class V4_2__DummyMigration implements JdbcMigration {
+ @Override
+ public void migrate(Connection connection) throws Exception {
+
+ }
+}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java
index f5a05b7333..e5a8d3faa1 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java
@@ -36,7 +36,7 @@ import org.onap.so.adapters.network.beans.ContrailSubnet;
import org.onap.so.adapters.network.exceptions.NetworkException;
import org.onap.so.adapters.network.mappers.ContrailSubnetMapper;
import org.onap.so.cloud.CloudConfig;
-import org.onap.so.cloud.CloudSite;
+import org.onap.so.db.catalog.beans.CloudSite;
import org.onap.so.db.catalog.beans.HeatTemplate;
import org.onap.so.db.catalog.beans.NetworkResource;
import org.onap.so.db.catalog.beans.NetworkResourceCustomization;
@@ -1167,7 +1167,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
}
MavenLikeVersioning aicV = new MavenLikeVersioning();
- aicV.setVersion(cloudSite.getAicVersion());
+ aicV.setVersion(cloudSite.getCloudVersion());
if ((aicV.isMoreRecentThan(networkResource.getAicVersionMin()) || aicV
.isTheSameVersion(networkResource.getAicVersionMin())) // aic
// >=
@@ -1181,13 +1181,13 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
+ networkResource.getAicVersionMin() + " VersionMax:"
+ networkResource.getAicVersionMax()
+ " supported on Cloud:" + cloudSiteId
- + " with AIC_Version:" + cloudSite.getAicVersion());
+ + " with AIC_Version:" + cloudSite.getCloudVersion());
} else {
String error = "Network Type:" + networkType + " Version_Min:"
+ networkResource.getAicVersionMin() + " Version_Max:"
+ networkResource.getAicVersionMax()
+ " not supported on Cloud:" + cloudSiteId
- + " with AIC_Version:" + cloudSite.getAicVersion();
+ + " with AIC_Version:" + cloudSite.getCloudVersion();
LOGGER.error(MessageEnum.RA_CONFIG_EXC, error, "OpenStack", "",
MsoLogger.ErrorCode.DataError,
"Network Type not supported on Cloud");
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/MsoOpenstackAdaptersApplication.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/MsoOpenstackAdaptersApplication.java
index d67a4b684c..02aa0843ae 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/MsoOpenstackAdaptersApplication.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/MsoOpenstackAdaptersApplication.java
@@ -34,8 +34,8 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
@SpringBootApplication(scanBasePackages = { "org.onap.so" })
@EnableAsync
@EnableJpaRepositories({ "org.onap.so.db.catalog.data.repository",
- "org.onap.so.db.request.data.repository" })
-@EntityScan({ "org.onap.so.db.catalog.beans", "org.onap.so.db.request.beans" })
+ "org.onap.so.db.request.data.repository"})
+@EntityScan({ "org.onap.so.db.catalog.beans", "org.onap.so.db.request.beans"})
public class MsoOpenstackAdaptersApplication {
@Value("${mso.async.core-pool-size}")
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java
index 8a55e0717e..29d8f297bf 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java
@@ -39,7 +39,7 @@ import org.onap.so.adapters.vnf.exceptions.VnfAlreadyExists;
import org.onap.so.adapters.vnf.exceptions.VnfException;
import org.onap.so.adapters.vnf.exceptions.VnfNotFound;
import org.onap.so.cloud.CloudConfig;
-import org.onap.so.cloud.CloudSite;
+import org.onap.so.db.catalog.beans.CloudSite;
import org.onap.so.db.catalog.beans.HeatEnvironment;
import org.onap.so.db.catalog.beans.HeatFiles;
import org.onap.so.db.catalog.beans.HeatTemplate;
@@ -859,7 +859,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
if (this.cloudConfig != null) {
Optional<CloudSite> cloudSiteOpt = this.cloudConfig.getCloudSite(cloudSiteId);
if (cloudSiteOpt.isPresent()) {
- aicV.setVersion(cloudSiteOpt.get().getAicVersion());
+ aicV.setVersion(cloudSiteOpt.get().getCloudVersion());
// Add code to handle unexpected values in here
boolean moreThanMin = true;
boolean equalToMin = true;
@@ -878,10 +878,10 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
if (!doNotTest) {
if ((moreThanMin || equalToMin) // aic >= min
&& (equalToMax || !(moreThanMax))) { //aic <= max
- LOGGER.debug("VNF Resource " + vnfResource.getModelName() + ", ModelUuid=" + vnfResource.getModelUUID() + " VersionMin=" + minVersionVnf + " VersionMax:" + maxVersionVnf + " supported on Cloud: " + cloudSiteId + " with AIC_Version:" + cloudSiteOpt.get().getAicVersion());
+ LOGGER.debug("VNF Resource " + vnfResource.getModelName() + ", ModelUuid=" + vnfResource.getModelUUID() + " VersionMin=" + minVersionVnf + " VersionMax:" + maxVersionVnf + " supported on Cloud: " + cloudSiteId + " with AIC_Version:" + cloudSiteOpt.get().getCloudVersion());
} else {
// ERROR
- String error = "VNF Resource type: " + vnfResource.getModelName() + ", ModelUuid=" + vnfResource.getModelUUID() + " VersionMin=" + minVersionVnf + " VersionMax:" + maxVersionVnf + " NOT supported on Cloud: " + cloudSiteId + " with AIC_Version:" + cloudSiteOpt.get().getAicVersion();
+ String error = "VNF Resource type: " + vnfResource.getModelName() + ", ModelUuid=" + vnfResource.getModelUUID() + " VersionMin=" + minVersionVnf + " VersionMax:" + maxVersionVnf + " NOT supported on Cloud: " + cloudSiteId + " with AIC_Version:" + cloudSiteOpt.get().getCloudVersion();
LOGGER.error(MessageEnum.RA_CONFIG_EXC, error, "OpenStack", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - setVersion");
LOGGER.debug(error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
@@ -1606,7 +1606,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
if (this.cloudConfig != null) {
Optional<CloudSite> cloudSiteOpt = this.cloudConfig.getCloudSite(cloudSiteId);
if (cloudSiteOpt.isPresent()) {
- aicV.setVersion(cloudSiteOpt.get().getAicVersion());
+ aicV.setVersion(cloudSiteOpt.get().getCloudVersion());
boolean moreThanMin = true;
boolean equalToMin = true;
boolean moreThanMax = true;
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java
index 0266e87523..1cf65cb6fc 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java
@@ -34,7 +34,7 @@ import javax.xml.ws.Holder;
import org.onap.so.adapters.vnf.exceptions.VnfAlreadyExists;
import org.onap.so.adapters.vnf.exceptions.VnfException;
import org.onap.so.cloud.CloudConfig;
-import org.onap.so.cloud.CloudSite;
+import org.onap.so.db.catalog.beans.CloudSite;
import org.onap.so.cloudify.beans.DeploymentInfo;
import org.onap.so.cloudify.beans.DeploymentStatus;
import org.onap.so.cloudify.exceptions.MsoCloudifyManagerNotFound;
@@ -663,7 +663,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
}
CloudSite cloudSite = cloudSiteOp.get();
MavenLikeVersioning aicV = new MavenLikeVersioning();
- aicV.setVersion(cloudSite.getAicVersion());
+ aicV.setVersion(cloudSite.getCloudVersion());
String vnfMin = vnfResource.getAicVersionMin();
String vnfMax = vnfResource.getAicVersionMax();
@@ -672,7 +672,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
(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.getAicVersion();
+ 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, error, "OpenStack", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - setVersion");
LOGGER.debug(error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
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 0a7b30f9ca..b440f7d521 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
@@ -59,7 +59,7 @@ import org.onap.so.adapters.vdu.mapper.VfModuleCustomizationToVduMapper;
import org.onap.so.adapters.vnf.exceptions.VnfAlreadyExists;
import org.onap.so.adapters.vnf.exceptions.VnfException;
import org.onap.so.cloud.CloudConfig;
-import org.onap.so.cloud.CloudSite;
+import org.onap.so.db.catalog.beans.CloudSite;
import org.onap.so.cloudify.utils.MsoCloudifyUtils;
import org.onap.so.db.catalog.beans.HeatEnvironment;
import org.onap.so.db.catalog.beans.HeatTemplate;
@@ -705,7 +705,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
}
CloudSite cloudSite = cloudSiteOp.get();
MavenLikeVersioning aicV = new MavenLikeVersioning();
- aicV.setVersion(cloudSite.getAicVersion());
+ aicV.setVersion(cloudSite.getCloudVersion());
String vnfMin = vnfResource.getAicVersionMin();
String vnfMax = vnfResource.getAicVersionMax();
@@ -714,7 +714,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
(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.getAicVersion();
+ 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, error, "OpenStack", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - setVersion");
LOGGER.debug(error);
throw new VnfException(error, MsoExceptionCategory.USERDATA);
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 876aae8a37..4da026f454 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
@@ -23,7 +23,7 @@ package org.onap.so.adapters.vnf;
import java.util.Optional;
import org.onap.so.cloud.CloudConfig;
-import org.onap.so.cloud.CloudSite;
+import org.onap.so.db.catalog.beans.CloudSite;
import org.onap.so.logger.MsoLogger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;