diff options
Diffstat (limited to 'adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoNeutronUtils.java')
-rw-r--r-- | adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoNeutronUtils.java | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoNeutronUtils.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoNeutronUtils.java index 9eba799e18..df769ec0c2 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoNeutronUtils.java +++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/openstack/utils/MsoNeutronUtils.java @@ -65,8 +65,7 @@ public class MsoNeutronUtils extends MsoCommonUtils // The cache key is "tenantId:cloudId" private static Map<String,NeutronCacheEntry> neutronClientCache = new HashMap<>(); - // Fetch cloud configuration each time (may be cached in CloudConfig class) - private CloudConfig cloudConfig; + private CloudConfigFactory cloudConfigFactory; private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); private String msoPropID; @@ -76,9 +75,13 @@ public class MsoNeutronUtils extends MsoCommonUtils }; public MsoNeutronUtils(String msoPropID, CloudConfigFactory cloudConfigFactory) { - cloudConfig = cloudConfigFactory.getCloudConfig(); + this.cloudConfigFactory = cloudConfigFactory; this.msoPropID = msoPropID; } + + protected CloudConfigFactory getCloudConfigFactory() { + return cloudConfigFactory; + } /** * Create a network with the specified parameters in the given cloud/tenant. @@ -101,7 +104,7 @@ public class MsoNeutronUtils extends MsoCommonUtils throws MsoException { // Obtain the cloud site information where we will create the stack - CloudSite cloudSite = cloudConfig.getCloudSite(cloudSiteId).orElseThrow( + CloudSite cloudSite = getCloudConfigFactory().getCloudConfig().getCloudSite(cloudSiteId).orElseThrow( () -> new MsoCloudSiteNotFound(cloudSiteId)); Quantum neutronClient = getNeutronClient (cloudSite, tenantId); @@ -179,7 +182,7 @@ public class MsoNeutronUtils extends MsoCommonUtils LOGGER.debug("In queryNetwork"); // Obtain the cloud site information - CloudSite cloudSite = cloudConfig.getCloudSite(cloudSiteId).orElseThrow( + CloudSite cloudSite = getCloudConfigFactory().getCloudConfig().getCloudSite(cloudSiteId).orElseThrow( () -> new MsoCloudSiteNotFound(cloudSiteId)); Quantum neutronClient = getNeutronClient (cloudSite, tenantId); @@ -219,7 +222,7 @@ public class MsoNeutronUtils extends MsoCommonUtils public boolean deleteNetwork(String networkId, String tenantId, String cloudSiteId) throws MsoException { // Obtain the cloud site information where we will create the stack - CloudSite cloudSite = cloudConfig.getCloudSite(cloudSiteId).orElseThrow( + CloudSite cloudSite = getCloudConfigFactory().getCloudConfig().getCloudSite(cloudSiteId).orElseThrow( () -> new MsoCloudSiteNotFound(cloudSiteId)); Quantum neutronClient = getNeutronClient (cloudSite, tenantId); try { @@ -276,7 +279,7 @@ public class MsoNeutronUtils extends MsoCommonUtils throws MsoException { // Obtain the cloud site information where we will create the stack - CloudSite cloudSite = cloudConfig.getCloudSite(cloudSiteId).orElseThrow( + CloudSite cloudSite = getCloudConfigFactory().getCloudConfig().getCloudSite(cloudSiteId).orElseThrow( () -> new MsoCloudSiteNotFound(cloudSiteId)); Quantum neutronClient = getNeutronClient (cloudSite, tenantId); // Check that the network exists |