Merge "Move InvalidConfiguration exception to tempest.lib"
diff --git a/tempest/api/compute/admin/test_floating_ips_bulk.py b/tempest/api/compute/admin/test_floating_ips_bulk.py
index 456363c..e207aed 100644
--- a/tempest/api/compute/admin/test_floating_ips_bulk.py
+++ b/tempest/api/compute/admin/test_floating_ips_bulk.py
@@ -17,7 +17,7 @@
 
 from tempest.api.compute import base
 from tempest import config
-from tempest import exceptions
+from tempest.lib import exceptions
 from tempest import test
 
 CONF = config.CONF
diff --git a/tempest/api/compute/images/test_list_image_filters.py b/tempest/api/compute/images/test_list_image_filters.py
index f340658..a9c2f7a 100644
--- a/tempest/api/compute/images/test_list_image_filters.py
+++ b/tempest/api/compute/images/test_list_image_filters.py
@@ -23,7 +23,7 @@
 from tempest.common.utils import data_utils
 from tempest.common import waiters
 from tempest import config
-from tempest import exceptions
+from tempest.lib import exceptions
 from tempest import test
 
 CONF = config.CONF
diff --git a/tempest/api/compute/servers/test_server_actions.py b/tempest/api/compute/servers/test_server_actions.py
index 788dd8a..9077801 100644
--- a/tempest/api/compute/servers/test_server_actions.py
+++ b/tempest/api/compute/servers/test_server_actions.py
@@ -24,7 +24,6 @@
 from tempest.common.utils.linux import remote_client
 from tempest.common import waiters
 from tempest import config
-from tempest import exceptions
 from tempest.lib import decorators
 from tempest.lib import exceptions as lib_exc
 from tempest import test
@@ -331,7 +330,7 @@
         elif CONF.image_feature_enabled.api_v2:
             glance_client = self.os.image_client_v2
         else:
-            raise exceptions.InvalidConfiguration(
+            raise lib_exc.InvalidConfiguration(
                 'Either api_v1 or api_v2 must be True in '
                 '[image-feature-enabled].')
 
diff --git a/tempest/api/image/v1/test_images.py b/tempest/api/image/v1/test_images.py
index 695efb5..269e297 100644
--- a/tempest/api/image/v1/test_images.py
+++ b/tempest/api/image/v1/test_images.py
@@ -20,7 +20,7 @@
 from tempest.common.utils import data_utils
 from tempest.common import waiters
 from tempest import config
-from tempest import exceptions
+from tempest.lib import exceptions
 from tempest import test
 
 CONF = config.CONF
diff --git a/tempest/api/network/admin/test_l3_agent_scheduler.py b/tempest/api/network/admin/test_l3_agent_scheduler.py
index d2e1492..dca4523 100644
--- a/tempest/api/network/admin/test_l3_agent_scheduler.py
+++ b/tempest/api/network/admin/test_l3_agent_scheduler.py
@@ -15,7 +15,7 @@
 from tempest.api.network import base
 from tempest.common.utils import data_utils
 from tempest import config
-from tempest import exceptions
+from tempest.lib import exceptions
 from tempest import test
 
 CONF = config.CONF
diff --git a/tempest/api/network/test_ports.py b/tempest/api/network/test_ports.py
index e5972a9..12539ba 100644
--- a/tempest/api/network/test_ports.py
+++ b/tempest/api/network/test_ports.py
@@ -23,7 +23,7 @@
 from tempest.common import custom_matchers
 from tempest.common.utils import data_utils
 from tempest import config
-from tempest import exceptions
+from tempest.lib import exceptions
 from tempest import test
 
 CONF = config.CONF
diff --git a/tempest/api/volume/base.py b/tempest/api/volume/base.py
index b49a126..e6b8234 100644
--- a/tempest/api/volume/base.py
+++ b/tempest/api/volume/base.py
@@ -17,8 +17,8 @@
 from tempest.common.utils import data_utils
 from tempest.common import waiters
 from tempest import config
-from tempest import exceptions
 from tempest.lib.common.utils import test_utils
+from tempest.lib import exceptions
 import tempest.test
 
 CONF = config.CONF
diff --git a/tempest/api/volume/test_volumes_actions.py b/tempest/api/volume/test_volumes_actions.py
index 9b48c89..83844e3 100644
--- a/tempest/api/volume/test_volumes_actions.py
+++ b/tempest/api/volume/test_volumes_actions.py
@@ -18,8 +18,8 @@
 from tempest.common.utils import data_utils
 from tempest.common import waiters
 from tempest import config
-from tempest import exceptions
 from tempest.lib.common.utils import test_utils
+from tempest.lib import exceptions
 from tempest import test
 
 CONF = config.CONF
diff --git a/tempest/clients.py b/tempest/clients.py
index 6cb6980..be6bc02 100644
--- a/tempest/clients.py
+++ b/tempest/clients.py
@@ -267,14 +267,14 @@
                     CONF.identity.uri, **self.default_params)
             else:
                 msg = 'Identity v2 API enabled, but no identity.uri set'
-                raise exceptions.InvalidConfiguration(msg)
+                raise lib_exc.InvalidConfiguration(msg)
         if CONF.identity_feature_enabled.api_v3:
             if CONF.identity.uri_v3:
                 self.token_v3_client = identity.v3.V3TokenClient(
                     CONF.identity.uri_v3, **self.default_params)
             else:
                 msg = 'Identity v3 API enabled, but no identity.uri_v3 set'
-                raise exceptions.InvalidConfiguration(msg)
+                raise lib_exc.InvalidConfiguration(msg)
 
     def _set_volume_clients(self):
         # Mandatory parameters (always defined)
diff --git a/tempest/common/credentials_factory.py b/tempest/common/credentials_factory.py
index b50869d..5634958 100644
--- a/tempest/common/credentials_factory.py
+++ b/tempest/common/credentials_factory.py
@@ -17,8 +17,8 @@
 from tempest.common import dynamic_creds
 from tempest.common import preprov_creds
 from tempest import config
-from tempest import exceptions
 from tempest.lib import auth
+from tempest.lib import exceptions
 
 CONF = config.CONF
 
diff --git a/tempest/common/dynamic_creds.py b/tempest/common/dynamic_creds.py
index d2ba28d..5c12fd8 100644
--- a/tempest/common/dynamic_creds.py
+++ b/tempest/common/dynamic_creds.py
@@ -18,7 +18,6 @@
 
 from tempest import clients
 from tempest.common import cred_client
-from tempest import exceptions
 from tempest.lib.common import cred_provider
 from tempest.lib.common.utils import data_utils
 from tempest.lib import exceptions as lib_exc
@@ -219,14 +218,14 @@
             if self.network_resources['router']:
                 if (not self.network_resources['subnet'] or
                     not self.network_resources['network']):
-                    raise exceptions.InvalidConfiguration(
+                    raise lib_exc.InvalidConfiguration(
                         'A router requires a subnet and network')
             elif self.network_resources['subnet']:
                 if not self.network_resources['network']:
-                    raise exceptions.InvalidConfiguration(
+                    raise lib_exc.InvalidConfiguration(
                         'A subnet requires a network')
             elif self.network_resources['dhcp']:
-                raise exceptions.InvalidConfiguration('DHCP requires a subnet')
+                raise lib_exc.InvalidConfiguration('DHCP requires a subnet')
 
         rand_name_root = data_utils.rand_name(
             self.name, prefix=self.resource_prefix)
diff --git a/tempest/common/preprov_creds.py b/tempest/common/preprov_creds.py
index 893b71b..5e23696 100644
--- a/tempest/common/preprov_creds.py
+++ b/tempest/common/preprov_creds.py
@@ -35,7 +35,7 @@
         with open(path, 'r') as yaml_file:
             accounts = yaml.load(yaml_file)
     except IOError:
-        raise exceptions.InvalidConfiguration(
+        raise lib_exc.InvalidConfiguration(
             'The path for the test accounts file: %s '
             'could not be found' % path)
     return accounts
diff --git a/tempest/common/utils/linux/remote_client.py b/tempest/common/utils/linux/remote_client.py
index 7cb9ebe..9ec217f 100644
--- a/tempest/common/utils/linux/remote_client.py
+++ b/tempest/common/utils/linux/remote_client.py
@@ -19,7 +19,6 @@
 from oslo_log import log as logging
 
 from tempest import config
-from tempest import exceptions
 from tempest.lib.common import ssh
 from tempest.lib.common.utils import test_utils
 import tempest.lib.exceptions
@@ -218,8 +217,8 @@
         supported_clients = ['udhcpc', 'dhclient']
         dhcp_client = CONF.scenario.dhcp_client
         if dhcp_client not in supported_clients:
-            raise exceptions.InvalidConfiguration('%s DHCP client unsupported'
-                                                  % dhcp_client)
+            raise tempest.lib.exceptions.InvalidConfiguration(
+                '%s DHCP client unsupported' % dhcp_client)
         if dhcp_client == 'udhcpc' and not fixed_ip:
             raise ValueError("need to set 'fixed_ip' for udhcpc client")
         return getattr(self, '_renew_lease_' + dhcp_client)(fixed_ip=fixed_ip)
diff --git a/tempest/exceptions.py b/tempest/exceptions.py
index da32693..727d54e 100644
--- a/tempest/exceptions.py
+++ b/tempest/exceptions.py
@@ -17,10 +17,6 @@
 from tempest.lib import exceptions
 
 
-class InvalidConfiguration(exceptions.TempestException):
-    message = "Invalid Configuration"
-
-
 class InvalidServiceTag(exceptions.TempestException):
     message = "Invalid service tag"
 
diff --git a/tempest/lib/exceptions.py b/tempest/lib/exceptions.py
index a5c6b1b..a6c01bb 100644
--- a/tempest/lib/exceptions.py
+++ b/tempest/lib/exceptions.py
@@ -149,6 +149,10 @@
     message = "Unexpected response code received"
 
 
+class InvalidConfiguration(TempestException):
+    message = "Invalid Configuration"
+
+
 class InvalidIdentityVersion(TempestException):
     message = "Invalid version %(identity_version)s of the identity service"
 
diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py
index 9559cab..54a2577 100644
--- a/tempest/scenario/manager.py
+++ b/tempest/scenario/manager.py
@@ -57,7 +57,7 @@
             elif CONF.image_feature_enabled.api_v2:
                 cls.image_client = cls.manager.image_client_v2
             else:
-                raise exceptions.InvalidConfiguration(
+                raise lib_exc.InvalidConfiguration(
                     'Either api_v1 or api_v2 must be True in '
                     '[image-feature-enabled].')
         # Compute image client
@@ -639,7 +639,7 @@
                     return address['addr']
             raise exceptions.ServerUnreachable(server_id=server['id'])
         else:
-            raise exceptions.InvalidConfiguration()
+            raise lib_exc.InvalidConfiguration()
 
 
 class NetworkScenarioTest(ScenarioTest):
@@ -1177,7 +1177,7 @@
             # https://blueprints.launchpad.net/tempest/+spec/test-accounts
             if not CONF.compute.fixed_network_name:
                 m = 'fixed_network_name must be specified in config'
-                raise exceptions.InvalidConfiguration(m)
+                raise lib_exc.InvalidConfiguration(m)
             network = self._get_network_by_name(
                 CONF.compute.fixed_network_name)
             router = None
diff --git a/tempest/scenario/test_server_multinode.py b/tempest/scenario/test_server_multinode.py
index b323d2a..333079c 100644
--- a/tempest/scenario/test_server_multinode.py
+++ b/tempest/scenario/test_server_multinode.py
@@ -15,7 +15,7 @@
 
 
 from tempest import config
-from tempest import exceptions
+from tempest.lib import exceptions
 from tempest.scenario import manager
 from tempest import test
 
diff --git a/tempest/tests/common/test_dynamic_creds.py b/tempest/tests/common/test_dynamic_creds.py
index 132f0f1..a90ca8a 100644
--- a/tempest/tests/common/test_dynamic_creds.py
+++ b/tempest/tests/common/test_dynamic_creds.py
@@ -19,7 +19,6 @@
 from tempest.common import credentials_factory as credentials
 from tempest.common import dynamic_creds
 from tempest import config
-from tempest import exceptions
 from tempest.lib.common import rest_client
 from tempest.lib import exceptions as lib_exc
 from tempest.lib.services.identity.v2 import identity_client as v2_iden_client
@@ -572,7 +571,7 @@
         self._mock_list_role()
         self._mock_user_create('1234', 'fake_prim_user')
         self._mock_tenant_create('1234', 'fake_prim_tenant')
-        self.assertRaises(exceptions.InvalidConfiguration,
+        self.assertRaises(lib_exc.InvalidConfiguration,
                           creds.get_primary_creds)
 
     @mock.patch('tempest.lib.common.rest_client.RestClient')
@@ -592,7 +591,7 @@
         self._mock_list_role()
         self._mock_user_create('1234', 'fake_prim_user')
         self._mock_tenant_create('1234', 'fake_prim_tenant')
-        self.assertRaises(exceptions.InvalidConfiguration,
+        self.assertRaises(lib_exc.InvalidConfiguration,
                           creds.get_primary_creds)
 
     @mock.patch('tempest.lib.common.rest_client.RestClient')
@@ -612,7 +611,7 @@
         self._mock_list_role()
         self._mock_user_create('1234', 'fake_prim_user')
         self._mock_tenant_create('1234', 'fake_prim_tenant')
-        self.assertRaises(exceptions.InvalidConfiguration,
+        self.assertRaises(lib_exc.InvalidConfiguration,
                           creds.get_primary_creds)