From a81aef2172c2cb4c6735f6018aee7deb04140b5d Mon Sep 17 00:00:00 2001 From: "Benjamin, Max (mb388a)" Date: Mon, 13 Aug 2018 09:48:57 -0400 Subject: 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) --- .../src/main/java/db/migration/CloudConfig.java | 67 +++++++++ .../java/db/migration/R__CloudConfigMigration.java | 167 +++++++++++++++++++++ .../java/db/migration/V4_2__DummyMigration.java | 12 ++ .../so/adapters/network/MsoNetworkAdapterImpl.java | 8 +- .../openstack/MsoOpenstackAdaptersApplication.java | 4 +- .../onap/so/adapters/vnf/MsoVnfAdapterImpl.java | 10 +- .../so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java | 6 +- .../so/adapters/vnf/MsoVnfPluginAdapterImpl.java | 6 +- .../onap/so/adapters/vnf/VnfAdapterRestUtils.java | 2 +- .../src/main/resources/application-local.yaml | 20 +-- .../src/main/resources/application.yaml | 4 + 11 files changed, 271 insertions(+), 35 deletions(-) create mode 100644 adapters/mso-openstack-adapters/src/main/java/db/migration/CloudConfig.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/db/migration/R__CloudConfigMigration.java create mode 100644 adapters/mso-openstack-adapters/src/main/java/db/migration/V4_2__DummyMigration.java (limited to 'adapters/mso-openstack-adapters/src/main') 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 identityServices = new HashMap<>(); + + @JsonProperty("cloud_sites") + private Map cloudSites = new HashMap<>(); + + @JsonProperty("cloudify_managers") + private Map cloudifyManagers = new HashMap<>(); + + + public Map getIdentityServices() { + return identityServices; + } + + public void setIdentityServices(Map identityServices) { + this.identityServices = identityServices; + } + + public Map getCloudSites() { + return cloudSites; + } + + public void setCloudSites(Map cloudSites) { + this.cloudSites = cloudSites; + } + + public Map getCloudifyManagers() { + return cloudifyManagers; + } + + public void setCloudifyManagers(Map cloudifyManagers) { + this.cloudifyManagers = cloudifyManagers; + } + + public void populateId(){ + for (Map.Entry entry : identityServices.entrySet()) { + entry.getValue().setId(entry.getKey()); + } + + for (Map.Entry entry : cloudSites.entrySet()) { + entry.getValue().setId(entry.getKey()); + } + + for (Map.Entry 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 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 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 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 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 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; diff --git a/adapters/mso-openstack-adapters/src/main/resources/application-local.yaml b/adapters/mso-openstack-adapters/src/main/resources/application-local.yaml index fa6078689e..469744d2de 100644 --- a/adapters/mso-openstack-adapters/src/main/resources/application-local.yaml +++ b/adapters/mso-openstack-adapters/src/main/resources/application-local.yaml @@ -114,21 +114,7 @@ spring: management: context-path: /manage -cloud_config: - identity_services: - MTN13: - identity_url: "http://localhost:5000/v2.0" - mso_id: "m93945" - mso_pass: "93937EA01B94A10A49279D4572B48369" - admin_tenant: "admin" - member_role: "admin" - tenant_metadata: true - identity_server_type: "KEYSTONE" - identity_authentication_type: "USERNAME_PASSWORD" - cloud_sites: - mtn13: - region_id: "mtn13" - clli: "MDT13" - aic_version: "3.0" - identity_service_id: "MTN13" +flyway: + outOfOrder: true + ignoreMissingMigrations: true diff --git a/adapters/mso-openstack-adapters/src/main/resources/application.yaml b/adapters/mso-openstack-adapters/src/main/resources/application.yaml index faca1a3056..4a4c83e4a5 100644 --- a/adapters/mso-openstack-adapters/src/main/resources/application.yaml +++ b/adapters/mso-openstack-adapters/src/main/resources/application.yaml @@ -38,3 +38,7 @@ spring: #Actuator management: context-path: /manage + +flyway: + outOfOrder: true + ignoreMissingMigrations: true \ No newline at end of file -- cgit 1.2.3-korg