diff --git a/etc/tempest.conf.sample b/etc/tempest.conf.sample index cc91716fc5..d537396221 100644 --- a/etc/tempest.conf.sample +++ b/etc/tempest.conf.sample @@ -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 diff --git a/tempest/config.py b/tempest/config.py index 25fbbb9e6f..60baa47c08 100644 --- a/tempest/config.py +++ b/tempest/config.py @@ -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) diff --git a/tempest/manager.py b/tempest/manager.py index a17aa21e83..8f8c0f89e3 100644 --- a/tempest/manager.py +++ b/tempest/manager.py @@ -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. "