X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=adapters%2Fmso-adapter-utils%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fso%2Fopenstack%2Futils%2FMsoHeatUtils.java;h=20498cb694a10b7e89d621d99dd96cb055c29b42;hb=022e9a55a51e1e2fcf489986cb2152059583397f;hp=14aee2f4f21700e3abe5c4f89fa293333848b6e9;hpb=4e8b17fc758a50fcf7ec62daad9c1ac23857c65a;p=so.git diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java index 14aee2f4f2..20498cb694 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java +++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java @@ -103,13 +103,6 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ protected static final String CREATE_STACK = "CreateStack"; - // Cache Heat Clients statically. Since there is just one MSO user, there is no - // benefit to re-authentication on every request (or across different flows). The - // token will be used until it expires. - // - // The cache key is "tenantId:cloudId" - private static Map heatClientCache = new HashMap <> (); - // Fetch cloud configuration each time (may be cached in CloudConfig class) @Autowired protected CloudConfig cloudConfig; @@ -859,19 +852,6 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ String cloudId = cloudSite.getId(); // For DCP/LCP, the region should be the cloudId. String region = cloudSite.getRegionId (); - - // Check first in the cache of previously authorized clients - String cacheKey = cloudId + ":" + tenantId; - if (heatClientCache.containsKey (cacheKey)) { - if (!heatClientCache.get (cacheKey).isExpired ()) { - LOGGER.debug ("Using Cached HEAT Client for " + cacheKey); - return heatClientCache.get (cacheKey).getHeatClient (); - } else { - // Token is expired. Remove it from cache. - heatClientCache.remove (cacheKey); - LOGGER.debug ("Expired Cached HEAT Client for " + cacheKey); - } - } // Obtain an MSO token for the tenant CloudIdentity cloudIdentity = cloudSite.getIdentityService(); @@ -946,38 +926,11 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{ // Catch-all throw runtimeExceptionToMsoException (e, TOKEN_AUTH); } - Heat heatClient = new Heat (heatUrl); heatClient.token (tokenId); - - heatClientCache.put (cacheKey, - new HeatCacheEntry (heatUrl, - tokenId, - expiration)); - LOGGER.debug ("Caching HEAT Client for " + cacheKey); - return heatClient; } - /** - * Forcibly expire a HEAT client from the cache. This call is for use by - * the KeystoneClient in case where a tenant is deleted. In that case, - * all cached credentials must be purged so that fresh authentication is - * done if a similarly named tenant is re-created. - *

- * Note: This is probably only applicable to dev/test environments where - * the same Tenant Name is repeatedly used for creation/deletion. - *

- * - */ - public void expireHeatClient (String tenantId, String cloudId) { - String cacheKey = cloudId + ":" + tenantId; - if (heatClientCache.containsKey (cacheKey)) { - heatClientCache.remove (cacheKey); - LOGGER.debug ("Deleted Cached HEAT Client for " + cacheKey); - } - } - /* * Query for a Heat Stack. This function is needed in several places, so * a common method is useful. This method takes an authenticated Heat Client