Add admin credential config for network client.
* Supports bug 1043980 Change-Id: I5ffc2d57a19e9f3a8112308998f0b957b7d93b1f
This commit is contained in:
parent
86d51e36ca
commit
b72f37cfb4
|
@ -185,6 +185,17 @@ api_version = v1.1
|
|||
# Catalog type of the Quantum Service
|
||||
catalog_type = network
|
||||
|
||||
[network-admin]
|
||||
# This section contains configuration options for an administrative
|
||||
# user of the Network API.
|
||||
|
||||
# This should be the username of a user WITH administrative privileges
|
||||
username = admin
|
||||
# The above administrative user's password
|
||||
password = pass
|
||||
# The above administrative user's tenant name
|
||||
tenant_name = admin
|
||||
|
||||
[identity-admin]
|
||||
# This section contains configuration options for an administrative
|
||||
# user of the Compute API. These options are used in tests that stress
|
||||
|
|
|
@ -379,6 +379,26 @@ class NetworkConfig(BaseConfig):
|
|||
return self.get("api_version", "v1.1")
|
||||
|
||||
|
||||
class NetworkAdminConfig(BaseConfig):
|
||||
|
||||
SECTION_NAME = "network-admin"
|
||||
|
||||
@property
|
||||
def username(self):
|
||||
"""Administrative Username to use for Quantum API requests."""
|
||||
return self.get("username", "admin")
|
||||
|
||||
@property
|
||||
def tenant_name(self):
|
||||
"""Administrative Tenant name to use for Quantum API requests."""
|
||||
return self.get("tenant_name", "admin")
|
||||
|
||||
@property
|
||||
def password(self):
|
||||
"""API key to use when authenticating as admin."""
|
||||
return self.get("password", "pass")
|
||||
|
||||
|
||||
class VolumeConfig(BaseConfig):
|
||||
"""Provides configuration information for connecting to an OpenStack Block
|
||||
Storage Service.
|
||||
|
@ -544,6 +564,7 @@ class TempestConfig:
|
|||
self.identity_admin = IdentityAdminConfig(self._conf)
|
||||
self.images = ImagesConfig(self._conf)
|
||||
self.network = NetworkConfig(self._conf)
|
||||
self.network_admin = NetworkAdminConfig(self._conf)
|
||||
self.volume = VolumeConfig(self._conf)
|
||||
self.object_storage = ObjectStorageConfig(self._conf)
|
||||
self.boto = BotoConfig(self._conf)
|
||||
|
|
|
@ -166,10 +166,15 @@ class DefaultClientManager(Manager):
|
|||
auth_url=auth_url)
|
||||
|
||||
def _get_network_client(self):
|
||||
# TODO(mnewby) add network-specific auth configuration
|
||||
username = self.config.compute.username
|
||||
password = self.config.compute.password
|
||||
tenant_name = self.config.compute.tenant_name
|
||||
# The intended configuration is for the network client to have
|
||||
# admin privileges and indicate for whom resources are being
|
||||
# created via a 'tenant_id' parameter. This will often be
|
||||
# preferable to authenticating as a specific user because
|
||||
# working with certain resources (public routers and networks)
|
||||
# often requires admin privileges anyway.
|
||||
username = self.config.network_admin.username
|
||||
password = self.config.network_admin.password
|
||||
tenant_name = self.config.network_admin.tenant_name
|
||||
|
||||
if None in (username, password, tenant_name):
|
||||
msg = ("Missing required credentials for network client. "
|
||||
|
|
Loading…
Reference in New Issue