Use isolation credentials for neutron api tests
This commit just adds the use of isolated credentials to the neutron
api tests if tenant isolation is enabled. Previously the neutron
tests would all run in the same tenant regardless of the config
option.
Change-Id: Ide9c4a3ed543b917bd401561c601f9897bd7db50
diff --git a/tempest/api/network/base.py b/tempest/api/network/base.py
index b6c2679..cdb8e17 100644
--- a/tempest/api/network/base.py
+++ b/tempest/api/network/base.py
@@ -18,6 +18,7 @@
import netaddr
from tempest import clients
+from tempest.common import isolated_creds
from tempest.common.utils.data_utils import rand_name
from tempest import exceptions
from tempest.openstack.common import log as logging
@@ -51,10 +52,19 @@
@classmethod
def setUpClass(cls):
super(BaseNetworkTest, cls).setUpClass()
- os = clients.Manager(interface=cls._interface)
- cls.network_cfg = os.config.network
+ cls.isolated_creds = isolated_creds.IsolatedCreds(cls.__name__)
if not cls.config.service_available.neutron:
raise cls.skipException("Neutron support is required")
+ if cls.config.compute.allow_tenant_isolation:
+ creds = cls.isolated_creds.get_primary_creds()
+ username, tenant_name, password = creds
+ os = clients.Manager(username=username,
+ password=password,
+ tenant_name=tenant_name,
+ interface=cls._interface)
+ else:
+ os = clients.Manager(interface=cls._interface)
+ cls.network_cfg = os.config.network
cls.client = os.network_client
cls.networks = []
cls.subnets = []