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: I3f7b76dc273874c99147896b8c8052b75a8106b0
diff --git a/tempest/api/network/base.py b/tempest/api/network/base.py
index 1c2c4b0..b129786 100644
--- a/tempest/api/network/base.py
+++ b/tempest/api/network/base.py
@@ -49,6 +49,8 @@
         neutron as True
     """
 
+    force_tenant_isolation = False
+
     @classmethod
     def setUpClass(cls):
         # Create no network resources for these test.
@@ -57,6 +59,10 @@
         os = clients.Manager(interface=cls._interface)
         if not CONF.service_available.neutron:
             raise cls.skipException("Neutron support is required")
+
+        os = cls.get_client_manager()
+
+        cls.network_cfg = CONF.network
         cls.client = os.network_client
         cls.networks = []
         cls.subnets = []
@@ -110,6 +116,7 @@
         # Clean up networks
         for network in cls.networks:
             cls.client.delete_network(network['id'])
+        cls.clear_isolated_creds()
         super(BaseNetworkTest, cls).tearDownClass()
 
     @classmethod
@@ -269,5 +276,14 @@
             msg = ("Missing Administrative Network API credentials "
                    "in configuration.")
             raise cls.skipException(msg)
-        cls.admin_manager = clients.AdminManager(interface=cls._interface)
-        cls.admin_client = cls.admin_manager.network_client
+        if (CONF.compute.allow_tenant_isolation or
+            cls.force_tenant_isolation is True):
+            creds = cls.isolated_creds.get_admin_creds()
+            admin_username, admin_tenant_name, admin_password = creds
+            cls.os_adm = clients.Manager(username=admin_username,
+                                         password=admin_password,
+                                         tenant_name=admin_tenant_name,
+                                         interface=cls._interface)
+        else:
+            cls.os_adm = clients.ComputeAdminManager(interface=cls._interface)
+        cls.admin_client = cls.os_adm.network_client