diff options
Diffstat (limited to 'adapters/mso-openstack-adapters/src/main/java/org')
5 files changed, 18 insertions, 9 deletions
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 32cd92d70e..53736e912f 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 @@ -145,7 +145,7 @@ public class HeatBridgeImpl implements HeatBridgeApi { logger.trace("Keystone Version: {} ", keystoneVersion); this.osClient = new MsoCloudClientFactoryImpl(new OpenstackClientFactoryImpl()).getOpenstackClient( cloudIdentity.getIdentityUrl(), cloudIdentity.getMsoId(), cloudIdentity.getMsoPass(), regionId, - tenantId, keystoneVersion); + tenantId, keystoneVersion, cloudIdentity.getUserDomainName(), cloudIdentity.getProjectDomainName()); logger.trace("Successfully authenticated with keystone for tenant: {} and region: {}", tenantId, 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 a9a63b312d..3c209314f3 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 @@ -55,5 +55,5 @@ public interface MsoCloudClientFactory { OpenstackClient getOpenstackClient(String url, String msoId, String msoPass, String regionId, String tenantId, - String keystoneVersion) throws HeatBridgeException; + String keystoneVersion, String userDomainName, String projectDomainName) 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 88a7d3dbbc..e299f6ffb8 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 @@ -64,21 +64,26 @@ public class MsoCloudClientFactoryImpl implements MsoCloudClientFactory { @Override public OpenstackClient getOpenstackClient(@Nonnull String url, @Nonnull String msoId, @Nonnull String msoPass, - @Nonnull String regionId, @Nonnull String tenantId, @Nonnull String keystoneVersion) - throws HeatBridgeException { + @Nonnull String regionId, @Nonnull String tenantId, @Nonnull String keystoneVersion, String userDomainName, + String projectDomainName) throws HeatBridgeException { Objects.requireNonNull(url, "Null openstack url!"); Objects.requireNonNull(msoId, "Null openstack user id!"); Objects.requireNonNull(msoPass, "Null openstack password!"); Objects.requireNonNull(regionId, "Null regionId ID!"); Objects.requireNonNull(tenantId, "Null tenant ID!"); - Objects.requireNonNull(tenantId, "Null keystone version"); + Objects.requireNonNull(keystoneVersion, "Null keystone version"); + if (userDomainName == null) { + userDomainName = HeatBridgeConstants.OS_DEFAULT_DOMAIN_NAME; + } + if (projectDomainName == null) { + projectDomainName = HeatBridgeConstants.OS_DEFAULT_DOMAIN_NAME; + } try { final OpenstackAccess osAccess = new OpenstackAccessBuilder().setBaseUrl(url) // keystone URL .setUser(msoId) // keystone username .setPassword(CryptoUtils.decryptCloudConfigPassword(msoPass)) // keystone decrypted password .setRegion(regionId) // openstack region - .setDomainName(HeatBridgeConstants.OS_DEFAULT_DOMAIN_NAME) // hardcode to "default" - .setTenantId(tenantId) // tenantId + .setDomainName(userDomainName).setProjectName(projectDomainName).setTenantId(tenantId) // tenantId .build(); // Identify the Keystone version diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackAccess.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackAccess.java index 69c76fad84..d8f2ee7273 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackAccess.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackAccess.java @@ -88,6 +88,10 @@ public class OpenstackAccess { return projectName; } + public Identifier getProjectNameIdentifier() { + return Identifier.byName(projectName); + } + public static class OpenstackAccessBuilder { private String baseUrl; diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/factory/OpenstackClientFactoryImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/factory/OpenstackClientFactoryImpl.java index bbcd54e6f8..8829c702cf 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/factory/OpenstackClientFactoryImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/factory/OpenstackClientFactoryImpl.java @@ -62,8 +62,8 @@ public class OpenstackClientFactoryImpl implements OpenstackClientFactory { try { client = OSFactory.builderV3().endpoint(osAccess.getUrl()) .credentials(osAccess.getUser(), osAccess.getPassword(), osAccess.getDomainNameIdentifier()) - .scopeToProject(Identifier.byId(osAccess.getTenantId())).authenticate() - .useRegion(osAccess.getRegion()); + .scopeToProject(Identifier.byId(osAccess.getTenantId()), osAccess.getProjectNameIdentifier()) + .authenticate().useRegion(osAccess.getRegion()); return new OpenstackV3ClientImpl(client); } catch (AuthenticationException exception) { throw new OpenstackClientException("Failed to authenticate with Keystone-v3: " + osAccess.getUrl(), |