diff options
author | Munir Ahmad <munir.ahmad@bell.ca> | 2019-10-29 11:17:38 -0400 |
---|---|---|
committer | Munir Ahmad <munir.ahmad@bell.ca> | 2019-12-02 12:03:45 -0500 |
commit | a849c237fe71f7dee316dd87f5d385cf4e2a38b6 (patch) | |
tree | d43eb52b3603ee74f54ed8b0aa3b488add9c56e2 /adapters | |
parent | 824b38dceab0fe94c3d80be31e48580609620641 (diff) |
Heatbridge bugfix make use of regionId instead of cloudSiteId
Issue-ID: SO-2497
Signed-off-by: Munir Ahmad <munir.ahmad@bell.ca>
Change-Id: Ic3b3fc98c6978807e198a4530974d940a7da5ff8
Diffstat (limited to 'adapters')
6 files changed, 19 insertions, 19 deletions
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 239c68abb5..fcb2d7c2bb 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 @@ -421,8 +421,8 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter { List<String> oobMgtNetNames = new ArrayList<>(); - HeatBridgeApi heatBridgeClient = - new HeatBridgeImpl(new AAIResourcesClient(), cloudIdentity, cloudOwner, cloudSiteId, tenantId); + HeatBridgeApi heatBridgeClient = new HeatBridgeImpl(new AAIResourcesClient(), cloudIdentity, cloudOwner, + cloudSiteId, cloudSite.getRegionId(), tenantId); heatBridgeClient.authenticate(); diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java index 5e3d36d0d5..e2022c9a6e 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java @@ -105,21 +105,23 @@ public class HeatBridgeImpl implements HeatBridgeApi { private AAISingleTransactionClient transaction; private String cloudOwner; private String cloudRegionId; + private String regionId; private String tenantId; private AaiHelper aaiHelper = new AaiHelper(); private CloudIdentity cloudIdentity; - public HeatBridgeImpl(AAIResourcesClient resourcesClient, final CloudIdentity cloudIdentity, - @Nonnull final String cloudOwner, @Nonnull final String cloudRegionId, @Nonnull final String tenantId) { + @Nonnull final String cloudOwner, @Nonnull final String cloudRegionId, @Nonnull final String regionId, + @Nonnull final String tenantId) { Objects.requireNonNull(cloudOwner, "Null cloud-owner value!"); Objects.requireNonNull(cloudRegionId, "Null cloud-region identifier!"); Objects.requireNonNull(tenantId, "Null tenant identifier!"); - Objects.requireNonNull(tenantId, "Null AAI actions list!"); + Objects.requireNonNull(regionId, "Null regionId identifier!"); this.cloudIdentity = cloudIdentity; this.cloudOwner = cloudOwner; this.cloudRegionId = cloudRegionId; + this.regionId = regionId; this.tenantId = tenantId; this.resourcesClient = resourcesClient; this.transaction = resourcesClient.beginSingleTransaction(); @@ -133,10 +135,9 @@ public class HeatBridgeImpl implements HeatBridgeApi { @Override public OpenstackClient authenticate() throws HeatBridgeException { this.osClient = new MsoCloudClientFactoryImpl(new OpenstackClientFactoryImpl()).getOpenstackClient( - cloudIdentity.getIdentityUrl(), cloudIdentity.getMsoId(), cloudIdentity.getMsoPass(), cloudRegionId, + cloudIdentity.getIdentityUrl(), cloudIdentity.getMsoId(), cloudIdentity.getMsoPass(), regionId, tenantId); - logger.debug("Successfully authenticated with keystone for tenant: " + tenantId + " and cloud " + "region: " - + cloudRegionId); + logger.debug("Successfully authenticated with keystone for tenant: " + tenantId + " and region: " + regionId); return osClient; } diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/factory/MsoCloudClientFactory.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/factory/MsoCloudClientFactory.java index 018a4eac8d..e1f363ca05 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/factory/MsoCloudClientFactory.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/factory/MsoCloudClientFactory.java @@ -47,13 +47,13 @@ public interface MsoCloudClientFactory { * @param url openstack url * @param msoId openstack user for mso * @param msoPass openstack password for mso user - * @param cloudRegionId cloud-region identifier + * @param regionId region identifier * @param tenantId tenant identifier * @return Openstack Client for the keystone version requested * @throws HeatBridgeException if any errors when reading cloud configuration or getting openstack client */ - OpenstackClient getOpenstackClient(String url, String msoId, String msoPass, String cloudRegionId, String tenantId) + OpenstackClient getOpenstackClient(String url, String msoId, String msoPass, String regionId, String tenantId) throws HeatBridgeException; } diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/factory/MsoCloudClientFactoryImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/factory/MsoCloudClientFactoryImpl.java index f0c5a0b434..04245899aa 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/factory/MsoCloudClientFactoryImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/factory/MsoCloudClientFactoryImpl.java @@ -61,17 +61,17 @@ public class MsoCloudClientFactoryImpl implements MsoCloudClientFactory { @Override public OpenstackClient getOpenstackClient(@Nonnull String url, @Nonnull String msoId, @Nonnull String msoPass, - @Nonnull String cloudRegionId, @Nonnull String tenantId) throws HeatBridgeException { + @Nonnull String regionId, @Nonnull String tenantId) throws HeatBridgeException { Objects.requireNonNull(url, "Null openstack url!"); Objects.requireNonNull(msoId, "Null openstack user id!"); Objects.requireNonNull(msoPass, "Null openstack password!"); - Objects.requireNonNull(cloudRegionId, "Null cloud-region ID!"); + Objects.requireNonNull(regionId, "Null regionId ID!"); Objects.requireNonNull(tenantId, "Null tenant ID!"); try { final OpenstackAccess osAccess = new OpenstackAccessBuilder().setBaseUrl(url) // keystone URL .setUser(msoId) // keystone username .setPassword(CryptoUtils.decryptCloudConfigPassword(msoPass)) // keystone decrypted password - .setRegion(cloudRegionId) // openstack region + .setRegion(regionId) // openstack region .setDomainName(HeatBridgeConstants.OS_DEFAULT_DOMAIN_NAME) // hardcode to "default" .setTenantId(tenantId) // tenantId .build(); diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java index d611322c02..e2f5531280 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java @@ -112,7 +112,7 @@ public class HeatBridgeImplTest { public void setUp() throws HeatBridgeException, OpenstackClientException, BulkProcessFailed { when(resourcesClient.beginSingleTransaction()).thenReturn(transaction); - heatbridge = new HeatBridgeImpl(resourcesClient, cloudIdentity, CLOUD_OWNER, REGION_ID, TENANT_ID); + heatbridge = new HeatBridgeImpl(resourcesClient, cloudIdentity, CLOUD_OWNER, REGION_ID, REGION_ID, TENANT_ID); } @Ignore diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/factory/MsoCloudClientFactoryImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/factory/MsoCloudClientFactoryImplTest.java index 701ed65d19..4eeb1c03a3 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/factory/MsoCloudClientFactoryImplTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/factory/MsoCloudClientFactoryImplTest.java @@ -38,7 +38,7 @@ public class MsoCloudClientFactoryImplTest { private static final String MSO_ID = "testMsoId"; private static final String ENCRYPTED_PASSWORD = CryptoUtils.encryptCloudConfigPassword("testPassword"); - private static final String CLOUD_REGION_ID = "testCloudRegionId"; + private static final String REGION_ID = "testCloudRegionId"; private static final String TENANT_ID = "testTenantId"; private MsoCloudClientFactoryImpl testedObject; @@ -52,20 +52,19 @@ public class MsoCloudClientFactoryImplTest { @Test public void getOpenstackClientWithVersion2() throws Exception { - testedObject.getOpenstackClient(URL_V2, MSO_ID, ENCRYPTED_PASSWORD, CLOUD_REGION_ID, TENANT_ID); + testedObject.getOpenstackClient(URL_V2, MSO_ID, ENCRYPTED_PASSWORD, REGION_ID, TENANT_ID); verify(openstackClientFactoryMock).createOpenstackV2Client(any(OpenstackAccess.class)); } @Test public void getOpenstackClientWithVersion3() throws Exception { - testedObject.getOpenstackClient(URL_V3, MSO_ID, ENCRYPTED_PASSWORD, CLOUD_REGION_ID, TENANT_ID); + testedObject.getOpenstackClient(URL_V3, MSO_ID, ENCRYPTED_PASSWORD, REGION_ID, TENANT_ID); verify(openstackClientFactoryMock).createOpenstackV3Client(any(OpenstackAccess.class)); } @Test(expected = HeatBridgeException.class) public void getOpenstackClient_unsupportedVersion() throws Exception { - testedObject.getOpenstackClient(URL_WITH_UNSUPPORTED_VERSION, MSO_ID, ENCRYPTED_PASSWORD, CLOUD_REGION_ID, - TENANT_ID); + testedObject.getOpenstackClient(URL_WITH_UNSUPPORTED_VERSION, MSO_ID, ENCRYPTED_PASSWORD, REGION_ID, TENANT_ID); } } |