Merge "Change keypair client to return one value and update tests"
diff --git a/etc/tempest.conf.sample b/etc/tempest.conf.sample
index 949302f..0eeb738 100644
--- a/etc/tempest.conf.sample
+++ b/etc/tempest.conf.sample
@@ -439,6 +439,9 @@
# running instances? (boolean value)
#snapshot = true
+# Does the test environment have the ec2 api running? (boolean value)
+#ec2_api = true
+
[dashboard]
diff --git a/requirements.txt b/requirements.txt
index 1ce2fc5..94c6fb0 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -6,7 +6,7 @@
httplib2>=0.7.5
jsonschema>=2.0.0,<3.0.0
testtools>=0.9.36,!=1.2.0
-boto>=2.32.1,<2.35.0
+boto>=2.32.1
paramiko>=1.13.0
netaddr>=0.7.12
python-ceilometerclient>=1.0.6
diff --git a/tempest/api/compute/admin/test_flavors.py b/tempest/api/compute/admin/test_flavors.py
index 1953040..360bcf7 100644
--- a/tempest/api/compute/admin/test_flavors.py
+++ b/tempest/api/compute/admin/test_flavors.py
@@ -45,8 +45,7 @@
cls.rxtx = 2
def flavor_clean_up(self, flavor_id):
- resp, body = self.client.delete_flavor(flavor_id)
- self.assertEqual(resp.status, 202)
+ self.client.delete_flavor(flavor_id)
self.client.wait_for_resource_deletion(flavor_id)
def _create_flavor(self, flavor_id):
@@ -55,15 +54,14 @@
flavor_name = data_utils.rand_name(self.flavor_name_prefix)
# Create the flavor
- resp, flavor = self.client.create_flavor(flavor_name,
- self.ram, self.vcpus,
- self.disk,
- flavor_id,
- ephemeral=self.ephemeral,
- swap=self.swap,
- rxtx=self.rxtx)
+ flavor = self.client.create_flavor(flavor_name,
+ self.ram, self.vcpus,
+ self.disk,
+ flavor_id,
+ ephemeral=self.ephemeral,
+ swap=self.swap,
+ rxtx=self.rxtx)
self.addCleanup(self.flavor_clean_up, flavor['id'])
- self.assertEqual(200, resp.status)
self.assertEqual(flavor['name'], flavor_name)
self.assertEqual(flavor['vcpus'], self.vcpus)
self.assertEqual(flavor['disk'], self.disk)
@@ -75,8 +73,7 @@
self.assertEqual(flavor['os-flavor-access:is_public'], True)
# Verify flavor is retrieved
- resp, flavor = self.client.get_flavor_details(flavor['id'])
- self.assertEqual(resp.status, 200)
+ flavor = self.client.get_flavor_details(flavor['id'])
self.assertEqual(flavor['name'], flavor_name)
return flavor['id']
@@ -109,18 +106,17 @@
new_flavor_id = data_utils.rand_int_id(start=1000)
# Create the flavor
- resp, flavor = self.client.create_flavor(flavor_name,
- self.ram, self.vcpus,
- self.disk,
- new_flavor_id,
- ephemeral=self.ephemeral,
- swap=self.swap,
- rxtx=self.rxtx)
+ flavor = self.client.create_flavor(flavor_name,
+ self.ram, self.vcpus,
+ self.disk,
+ new_flavor_id,
+ ephemeral=self.ephemeral,
+ swap=self.swap,
+ rxtx=self.rxtx)
self.addCleanup(self.flavor_clean_up, flavor['id'])
flag = False
# Verify flavor is retrieved
- resp, flavors = self.client.list_flavors_with_detail()
- self.assertEqual(resp.status, 200)
+ flavors = self.client.list_flavors_with_detail()
for flavor in flavors:
if flavor['name'] == flavor_name:
flag = True
@@ -142,12 +138,11 @@
new_flavor_id = data_utils.rand_int_id(start=1000)
# Create the flavor
- resp, flavor = self.client.create_flavor(flavor_name,
- self.ram, self.vcpus,
- self.disk,
- new_flavor_id)
+ flavor = self.client.create_flavor(flavor_name,
+ self.ram, self.vcpus,
+ self.disk,
+ new_flavor_id)
self.addCleanup(self.flavor_clean_up, flavor['id'])
- self.assertEqual(200, resp.status)
self.assertEqual(flavor['name'], flavor_name)
self.assertEqual(flavor['ram'], self.ram)
self.assertEqual(flavor['vcpus'], self.vcpus)
@@ -156,14 +151,12 @@
verify_flavor_response_extension(flavor)
# Verify flavor is retrieved
- resp, flavor = self.client.get_flavor_details(new_flavor_id)
- self.assertEqual(resp.status, 200)
+ flavor = self.client.get_flavor_details(new_flavor_id)
self.assertEqual(flavor['name'], flavor_name)
verify_flavor_response_extension(flavor)
# Check if flavor is present in list
- resp, flavors = self.user_client.list_flavors_with_detail()
- self.assertEqual(resp.status, 200)
+ flavors = self.user_client.list_flavors_with_detail()
for flavor in flavors:
if flavor['name'] == flavor_name:
verify_flavor_response_extension(flavor)
@@ -180,16 +173,15 @@
new_flavor_id = data_utils.rand_int_id(start=1000)
# Create the flavor
- resp, flavor = self.client.create_flavor(flavor_name,
- self.ram, self.vcpus,
- self.disk,
- new_flavor_id,
- is_public="False")
+ flavor = self.client.create_flavor(flavor_name,
+ self.ram, self.vcpus,
+ self.disk,
+ new_flavor_id,
+ is_public="False")
self.addCleanup(self.flavor_clean_up, flavor['id'])
# Verify flavor is retrieved
flag = False
- resp, flavors = self.client.list_flavors_with_detail()
- self.assertEqual(resp.status, 200)
+ flavors = self.client.list_flavors_with_detail()
for flavor in flavors:
if flavor['name'] == flavor_name:
flag = True
@@ -197,8 +189,7 @@
# Verify flavor is not retrieved with other user
flag = False
- resp, flavors = self.user_client.list_flavors_with_detail()
- self.assertEqual(resp.status, 200)
+ flavors = self.user_client.list_flavors_with_detail()
for flavor in flavors:
if flavor['name'] == flavor_name:
flag = True
@@ -211,13 +202,12 @@
new_flavor_id = data_utils.rand_int_id(start=1000)
# Create the flavor
- resp, flavor = self.client.create_flavor(flavor_name,
- self.ram, self.vcpus,
- self.disk,
- new_flavor_id,
- is_public="False")
+ flavor = self.client.create_flavor(flavor_name,
+ self.ram, self.vcpus,
+ self.disk,
+ new_flavor_id,
+ is_public="False")
self.addCleanup(self.flavor_clean_up, flavor['id'])
- self.assertEqual(200, resp.status)
# Verify flavor is not used by other user
self.assertRaises(exceptions.BadRequest,
@@ -232,17 +222,16 @@
new_flavor_id = data_utils.rand_int_id(start=1000)
# Create the flavor
- resp, flavor = self.client.create_flavor(flavor_name,
- self.ram, self.vcpus,
- self.disk,
- new_flavor_id,
- is_public="True")
+ flavor = self.client.create_flavor(flavor_name,
+ self.ram, self.vcpus,
+ self.disk,
+ new_flavor_id,
+ is_public="True")
self.addCleanup(self.flavor_clean_up, flavor['id'])
flag = False
self.new_client = self.flavors_client
# Verify flavor is retrieved with new user
- resp, flavors = self.new_client.list_flavors_with_detail()
- self.assertEqual(resp.status, 200)
+ flavors = self.new_client.list_flavors_with_detail()
for flavor in flavors:
if flavor['name'] == flavor_name:
flag = True
@@ -256,19 +245,19 @@
flavor_name_public = data_utils.rand_name(self.flavor_name_prefix)
# Create a non public flavor
- resp, flavor = self.client.create_flavor(flavor_name_not_public,
- self.ram, self.vcpus,
- self.disk,
- flavor_id_not_public,
- is_public="False")
+ flavor = self.client.create_flavor(flavor_name_not_public,
+ self.ram, self.vcpus,
+ self.disk,
+ flavor_id_not_public,
+ is_public="False")
self.addCleanup(self.flavor_clean_up, flavor['id'])
# Create a public flavor
- resp, flavor = self.client.create_flavor(flavor_name_public,
- self.ram, self.vcpus,
- self.disk,
- flavor_id_public,
- is_public="True")
+ flavor = self.client.create_flavor(flavor_name_public,
+ self.ram, self.vcpus,
+ self.disk,
+ flavor_id_public,
+ is_public="True")
self.addCleanup(self.flavor_clean_up, flavor['id'])
def _flavor_lookup(flavors, flavor_name):
@@ -280,8 +269,7 @@
def _test_string_variations(variations, flavor_name):
for string in variations:
params = {'is_public': string}
- r, flavors = self.client.list_flavors_with_detail(params)
- self.assertEqual(r.status, 200)
+ flavors = self.client.list_flavors_with_detail(params)
flavor = _flavor_lookup(flavors, flavor_name)
self.assertIsNotNone(flavor)
@@ -297,12 +285,11 @@
new_flavor_id = data_utils.rand_int_id(start=1000)
ram = "1024"
- resp, flavor = self.client.create_flavor(flavor_name,
- ram, self.vcpus,
- self.disk,
- new_flavor_id)
+ flavor = self.client.create_flavor(flavor_name,
+ ram, self.vcpus,
+ self.disk,
+ new_flavor_id)
self.addCleanup(self.flavor_clean_up, flavor['id'])
- self.assertEqual(200, resp.status)
self.assertEqual(flavor['name'], flavor_name)
self.assertEqual(flavor['vcpus'], self.vcpus)
self.assertEqual(flavor['disk'], self.disk)
diff --git a/tempest/api/compute/admin/test_flavors_access.py b/tempest/api/compute/admin/test_flavors_access.py
index 19707d0..8a33ce7 100644
--- a/tempest/api/compute/admin/test_flavors_access.py
+++ b/tempest/api/compute/admin/test_flavors_access.py
@@ -49,15 +49,13 @@
# private flavor will return an empty access list
flavor_name = data_utils.rand_name(self.flavor_name_prefix)
new_flavor_id = data_utils.rand_int_id(start=1000)
- resp, new_flavor = self.client.create_flavor(flavor_name,
- self.ram, self.vcpus,
- self.disk,
- new_flavor_id,
- is_public='False')
+ new_flavor = self.client.create_flavor(flavor_name,
+ self.ram, self.vcpus,
+ self.disk,
+ new_flavor_id,
+ is_public='False')
self.addCleanup(self.client.delete_flavor, new_flavor['id'])
- self.assertEqual(resp.status, 200)
- resp, flavor_access = self.client.list_flavor_access(new_flavor_id)
- self.assertEqual(resp.status, 200)
+ flavor_access = self.client.list_flavor_access(new_flavor_id)
self.assertEqual(len(flavor_access), 0, str(flavor_access))
@test.attr(type='gate')
@@ -65,34 +63,30 @@
# Test to add and remove flavor access to a given tenant.
flavor_name = data_utils.rand_name(self.flavor_name_prefix)
new_flavor_id = data_utils.rand_int_id(start=1000)
- resp, new_flavor = self.client.create_flavor(flavor_name,
- self.ram, self.vcpus,
- self.disk,
- new_flavor_id,
- is_public='False')
+ new_flavor = self.client.create_flavor(flavor_name,
+ self.ram, self.vcpus,
+ self.disk,
+ new_flavor_id,
+ is_public='False')
self.addCleanup(self.client.delete_flavor, new_flavor['id'])
# Add flavor access to a tenant.
resp_body = {
"tenant_id": str(self.tenant_id),
"flavor_id": str(new_flavor['id']),
}
- add_resp, add_body = \
+ add_body = \
self.client.add_flavor_access(new_flavor['id'], self.tenant_id)
- self.assertEqual(add_resp.status, 200)
self.assertIn(resp_body, add_body)
# The flavor is present in list.
- resp, flavors = self.flavors_client.list_flavors_with_detail()
- self.assertEqual(resp.status, 200)
+ flavors = self.flavors_client.list_flavors_with_detail()
self.assertIn(new_flavor['id'], map(lambda x: x['id'], flavors))
# Remove flavor access from a tenant.
- remove_resp, remove_body = \
+ remove_body = \
self.client.remove_flavor_access(new_flavor['id'], self.tenant_id)
- self.assertEqual(remove_resp.status, 200)
self.assertNotIn(resp_body, remove_body)
# The flavor is not present in list.
- resp, flavors = self.flavors_client.list_flavors_with_detail()
- self.assertEqual(resp.status, 200)
+ flavors = self.flavors_client.list_flavors_with_detail()
self.assertNotIn(new_flavor['id'], map(lambda x: x['id'], flavors))
diff --git a/tempest/api/compute/admin/test_flavors_access_negative.py b/tempest/api/compute/admin/test_flavors_access_negative.py
index c49652d..4ba9eb2 100644
--- a/tempest/api/compute/admin/test_flavors_access_negative.py
+++ b/tempest/api/compute/admin/test_flavors_access_negative.py
@@ -47,13 +47,12 @@
# Test to list flavor access with exceptions by querying public flavor
flavor_name = data_utils.rand_name(self.flavor_name_prefix)
new_flavor_id = data_utils.rand_int_id(start=1000)
- resp, new_flavor = self.client.create_flavor(flavor_name,
- self.ram, self.vcpus,
- self.disk,
- new_flavor_id,
- is_public='True')
+ new_flavor = self.client.create_flavor(flavor_name,
+ self.ram, self.vcpus,
+ self.disk,
+ new_flavor_id,
+ is_public='True')
self.addCleanup(self.client.delete_flavor, new_flavor['id'])
- self.assertEqual(resp.status, 200)
self.assertRaises(exceptions.NotFound,
self.client.list_flavor_access,
new_flavor_id)
@@ -63,11 +62,11 @@
# Test to add flavor access as a user without admin privileges.
flavor_name = data_utils.rand_name(self.flavor_name_prefix)
new_flavor_id = data_utils.rand_int_id(start=1000)
- resp, new_flavor = self.client.create_flavor(flavor_name,
- self.ram, self.vcpus,
- self.disk,
- new_flavor_id,
- is_public='False')
+ new_flavor = self.client.create_flavor(flavor_name,
+ self.ram, self.vcpus,
+ self.disk,
+ new_flavor_id,
+ is_public='False')
self.addCleanup(self.client.delete_flavor, new_flavor['id'])
self.assertRaises(exceptions.Unauthorized,
self.flavors_client.add_flavor_access,
@@ -79,11 +78,11 @@
# Test to remove flavor access as a user without admin privileges.
flavor_name = data_utils.rand_name(self.flavor_name_prefix)
new_flavor_id = data_utils.rand_int_id(start=1000)
- resp, new_flavor = self.client.create_flavor(flavor_name,
- self.ram, self.vcpus,
- self.disk,
- new_flavor_id,
- is_public='False')
+ new_flavor = self.client.create_flavor(flavor_name,
+ self.ram, self.vcpus,
+ self.disk,
+ new_flavor_id,
+ is_public='False')
self.addCleanup(self.client.delete_flavor, new_flavor['id'])
# Add flavor access to a tenant.
self.client.add_flavor_access(new_flavor['id'], self.tenant_id)
@@ -99,11 +98,11 @@
# Create a new flavor.
flavor_name = data_utils.rand_name(self.flavor_name_prefix)
new_flavor_id = data_utils.rand_int_id(start=1000)
- resp, new_flavor = self.client.create_flavor(flavor_name,
- self.ram, self.vcpus,
- self.disk,
- new_flavor_id,
- is_public='False')
+ new_flavor = self.client.create_flavor(flavor_name,
+ self.ram, self.vcpus,
+ self.disk,
+ new_flavor_id,
+ is_public='False')
self.addCleanup(self.client.delete_flavor, new_flavor['id'])
# Add flavor access to a tenant.
@@ -123,11 +122,11 @@
# Create a new flavor.
flavor_name = data_utils.rand_name(self.flavor_name_prefix)
new_flavor_id = data_utils.rand_int_id(start=1000)
- resp, new_flavor = self.client.create_flavor(flavor_name,
- self.ram, self.vcpus,
- self.disk,
- new_flavor_id,
- is_public='False')
+ new_flavor = self.client.create_flavor(flavor_name,
+ self.ram, self.vcpus,
+ self.disk,
+ new_flavor_id,
+ is_public='False')
self.addCleanup(self.client.delete_flavor, new_flavor['id'])
# An exception should be raised when flavor access is not found
diff --git a/tempest/api/compute/admin/test_flavors_extra_specs.py b/tempest/api/compute/admin/test_flavors_extra_specs.py
index 5157d2e..55c3358 100644
--- a/tempest/api/compute/admin/test_flavors_extra_specs.py
+++ b/tempest/api/compute/admin/test_flavors_extra_specs.py
@@ -43,16 +43,16 @@
swap = 1024
rxtx = 1
# Create a flavor so as to set/get/unset extra specs
- resp, cls.flavor = cls.client.create_flavor(flavor_name,
- ram, vcpus,
- disk,
- cls.new_flavor_id,
- ephemeral=ephemeral,
- swap=swap, rxtx=rxtx)
+ cls.flavor = cls.client.create_flavor(flavor_name,
+ ram, vcpus,
+ disk,
+ cls.new_flavor_id,
+ ephemeral=ephemeral,
+ swap=swap, rxtx=rxtx)
@classmethod
def resource_cleanup(cls):
- resp, body = cls.client.delete_flavor(cls.flavor['id'])
+ cls.client.delete_flavor(cls.flavor['id'])
cls.client.wait_for_resource_deletion(cls.flavor['id'])
super(FlavorsExtraSpecsTestJSON, cls).resource_cleanup()
@@ -63,47 +63,34 @@
# Assigning extra specs values that are to be set
specs = {"key1": "value1", "key2": "value2"}
# SET extra specs to the flavor created in setUp
- set_resp, set_body = \
+ set_body = \
self.client.set_flavor_extra_spec(self.flavor['id'], specs)
- self.assertEqual(set_resp.status, 200)
self.assertEqual(set_body, specs)
# GET extra specs and verify
- get_resp, get_body = \
- self.client.get_flavor_extra_spec(self.flavor['id'])
- self.assertEqual(get_resp.status, 200)
+ get_body = self.client.get_flavor_extra_spec(self.flavor['id'])
self.assertEqual(get_body, specs)
# UPDATE the value of the extra specs key1
- update_resp, update_body = \
+ update_body = \
self.client.update_flavor_extra_spec(self.flavor['id'],
"key1",
key1="value")
- self.assertEqual(update_resp.status, 200)
self.assertEqual({"key1": "value"}, update_body)
# GET extra specs and verify the value of the key2
# is the same as before
- get_resp, get_body = \
- self.client.get_flavor_extra_spec(self.flavor['id'])
- self.assertEqual(get_resp.status, 200)
+ get_body = self.client.get_flavor_extra_spec(self.flavor['id'])
self.assertEqual(get_body, {"key1": "value", "key2": "value2"})
# UNSET extra specs that were set in this test
- unset_resp, _ = \
- self.client.unset_flavor_extra_spec(self.flavor['id'], "key1")
- self.assertEqual(unset_resp.status, 200)
- unset_resp, _ = \
- self.client.unset_flavor_extra_spec(self.flavor['id'], "key2")
- self.assertEqual(unset_resp.status, 200)
+ self.client.unset_flavor_extra_spec(self.flavor['id'], "key1")
+ self.client.unset_flavor_extra_spec(self.flavor['id'], "key2")
@test.attr(type='gate')
def test_flavor_non_admin_get_all_keys(self):
specs = {"key1": "value1", "key2": "value2"}
- set_resp, set_body = self.client.set_flavor_extra_spec(
- self.flavor['id'], specs)
- resp, body = self.flavors_client.get_flavor_extra_spec(
- self.flavor['id'])
- self.assertEqual(resp.status, 200)
+ self.client.set_flavor_extra_spec(self.flavor['id'], specs)
+ body = self.flavors_client.get_flavor_extra_spec(self.flavor['id'])
for key in specs:
self.assertEqual(body[key], specs[key])
@@ -111,13 +98,10 @@
@test.attr(type='gate')
def test_flavor_non_admin_get_specific_key(self):
specs = {"key1": "value1", "key2": "value2"}
- resp, body = self.client.set_flavor_extra_spec(
- self.flavor['id'], specs)
- self.assertEqual(resp.status, 200)
+ body = self.client.set_flavor_extra_spec(self.flavor['id'], specs)
self.assertEqual(body['key1'], 'value1')
self.assertIn('key2', body)
- resp, body = self.flavors_client.get_flavor_extra_spec_with_key(
+ body = self.flavors_client.get_flavor_extra_spec_with_key(
self.flavor['id'], 'key1')
- self.assertEqual(resp.status, 200)
self.assertEqual(body['key1'], 'value1')
self.assertNotIn('key2', body)
diff --git a/tempest/api/compute/admin/test_flavors_extra_specs_negative.py b/tempest/api/compute/admin/test_flavors_extra_specs_negative.py
index 20860c8..2663e25 100644
--- a/tempest/api/compute/admin/test_flavors_extra_specs_negative.py
+++ b/tempest/api/compute/admin/test_flavors_extra_specs_negative.py
@@ -44,16 +44,16 @@
swap = 1024
rxtx = 1
# Create a flavor
- resp, cls.flavor = cls.client.create_flavor(flavor_name,
- ram, vcpus,
- disk,
- cls.new_flavor_id,
- ephemeral=ephemeral,
- swap=swap, rxtx=rxtx)
+ cls.flavor = cls.client.create_flavor(flavor_name,
+ ram, vcpus,
+ disk,
+ cls.new_flavor_id,
+ ephemeral=ephemeral,
+ swap=swap, rxtx=rxtx)
@classmethod
def resource_cleanup(cls):
- resp, body = cls.client.delete_flavor(cls.flavor['id'])
+ cls.client.delete_flavor(cls.flavor['id'])
cls.client.wait_for_resource_deletion(cls.flavor['id'])
super(FlavorsExtraSpecsNegativeTestJSON, cls).resource_cleanup()
@@ -70,9 +70,8 @@
def test_flavor_non_admin_update_specific_key(self):
# non admin user is not allowed to update flavor extra spec
specs = {"key1": "value1", "key2": "value2"}
- resp, body = self.client.set_flavor_extra_spec(
+ body = self.client.set_flavor_extra_spec(
self.flavor['id'], specs)
- self.assertEqual(resp.status, 200)
self.assertEqual(body['key1'], 'value1')
self.assertRaises(exceptions.Unauthorized,
self.flavors_client.
@@ -84,8 +83,7 @@
@test.attr(type=['negative', 'gate'])
def test_flavor_non_admin_unset_keys(self):
specs = {"key1": "value1", "key2": "value2"}
- set_resp, set_body = self.client.set_flavor_extra_spec(
- self.flavor['id'], specs)
+ self.client.set_flavor_extra_spec(self.flavor['id'], specs)
self.assertRaises(exceptions.Unauthorized,
self.flavors_client.unset_flavor_extra_spec,
diff --git a/tempest/api/compute/admin/test_flavors_negative.py b/tempest/api/compute/admin/test_flavors_negative.py
index fb27360..86125fb 100644
--- a/tempest/api/compute/admin/test_flavors_negative.py
+++ b/tempest/api/compute/admin/test_flavors_negative.py
@@ -59,27 +59,23 @@
# no need to specify flavor_id, we can get the flavor_id from a
# response of create_flavor() call.
- resp, flavor = self.client.create_flavor(flavor_name,
- self.ram,
- self.vcpus, self.disk,
- None,
- ephemeral=self.ephemeral,
- swap=self.swap,
- rxtx=self.rxtx)
+ flavor = self.client.create_flavor(flavor_name,
+ self.ram,
+ self.vcpus, self.disk,
+ None,
+ ephemeral=self.ephemeral,
+ swap=self.swap,
+ rxtx=self.rxtx)
# Delete the flavor
new_flavor_id = flavor['id']
- resp_delete, body = self.client.delete_flavor(new_flavor_id)
- self.assertEqual(200, resp.status)
- self.assertEqual(202, resp_delete.status)
+ self.client.delete_flavor(new_flavor_id)
# Deleted flavors can be seen via detailed GET
- resp, flavor = self.client.get_flavor_details(new_flavor_id)
- self.assertEqual(resp.status, 200)
+ flavor = self.client.get_flavor_details(new_flavor_id)
self.assertEqual(flavor['name'], flavor_name)
# Deleted flavors should not show up in a list however
- resp, flavors = self.client.list_flavors_with_detail()
- self.assertEqual(resp.status, 200)
+ flavors = self.client.list_flavors_with_detail()
flag = True
for flavor in flavors:
if flavor['name'] == flavor_name:
diff --git a/tempest/api/compute/admin/test_quotas.py b/tempest/api/compute/admin/test_quotas.py
index fc70fdb..b0fcf94 100644
--- a/tempest/api/compute/admin/test_quotas.py
+++ b/tempest/api/compute/admin/test_quotas.py
@@ -54,9 +54,8 @@
def test_get_default_quotas(self):
# Admin can get the default resource quota set for a tenant
expected_quota_set = self.default_quota_set | set(['id'])
- resp, quota_set = self.adm_client.get_default_quota_set(
+ quota_set = self.adm_client.get_default_quota_set(
self.demo_tenant_id)
- self.assertEqual(200, resp.status)
self.assertEqual(quota_set['id'], self.demo_tenant_id)
for quota in expected_quota_set:
self.assertIn(quota, quota_set.keys())
@@ -64,7 +63,7 @@
@test.attr(type='gate')
def test_update_all_quota_resources_for_tenant(self):
# Admin can update all the resource quota limits for a tenant
- resp, default_quota_set = self.adm_client.get_default_quota_set(
+ default_quota_set = self.adm_client.get_default_quota_set(
self.demo_tenant_id)
new_quota_set = {'injected_file_content_bytes': 20480,
'metadata_items': 256, 'injected_files': 10,
@@ -73,7 +72,7 @@
'instances': 20, 'security_group_rules': 20,
'cores': 2, 'security_groups': 20}
# Update limits for all quota resources
- resp, quota_set = self.adm_client.update_quota_set(
+ quota_set = self.adm_client.update_quota_set(
self.demo_tenant_id,
force=True,
**new_quota_set)
@@ -88,7 +87,6 @@
default_quota_set.pop('server_group_members')
self.addCleanup(self.adm_client.update_quota_set,
self.demo_tenant_id, **default_quota_set)
- self.assertEqual(200, resp.status)
for quota in new_quota_set:
self.assertIn(quota, quota_set.keys())
@@ -105,8 +103,7 @@
self.addCleanup(identity_client.delete_tenant, tenant_id)
self.adm_client.update_quota_set(tenant_id, ram='5120')
- resp, quota_set = self.adm_client.get_quota_set(tenant_id)
- self.assertEqual(200, resp.status)
+ quota_set = self.adm_client.get_quota_set(tenant_id)
self.assertEqual(5120, quota_set['ram'])
# Verify that GET shows the updated quota set of user
@@ -123,9 +120,8 @@
self.adm_client.update_quota_set(tenant_id,
user_id=user_id,
ram='2048')
- resp, quota_set = self.adm_client.get_quota_set(tenant_id,
- user_id=user_id)
- self.assertEqual(200, resp.status)
+ quota_set = self.adm_client.get_quota_set(tenant_id,
+ user_id=user_id)
self.assertEqual(2048, quota_set['ram'])
@test.attr(type='gate')
@@ -138,17 +134,14 @@
description=tenant_desc)
tenant_id = tenant['id']
self.addCleanup(identity_client.delete_tenant, tenant_id)
- resp, quota_set_default = self.adm_client.get_quota_set(tenant_id)
+ quota_set_default = self.adm_client.get_quota_set(tenant_id)
ram_default = quota_set_default['ram']
- resp, body = self.adm_client.update_quota_set(tenant_id, ram='5120')
- self.assertEqual(200, resp.status)
+ self.adm_client.update_quota_set(tenant_id, ram='5120')
- resp, body = self.adm_client.delete_quota_set(tenant_id)
- self.assertEqual(202, resp.status)
+ self.adm_client.delete_quota_set(tenant_id)
- resp, quota_set_new = self.adm_client.get_quota_set(tenant_id)
- self.assertEqual(200, resp.status)
+ quota_set_new = self.adm_client.get_quota_set(tenant_id)
self.assertEqual(ram_default, quota_set_new['ram'])
@@ -169,9 +162,8 @@
def _restore_default_quotas(self, original_defaults):
LOG.debug("restoring quota class defaults")
- resp, body = self.adm_client.update_quota_class_set(
+ self.adm_client.update_quota_class_set(
'default', **original_defaults)
- self.assertEqual(200, resp.status)
# NOTE(sdague): this test is problematic as it changes
# global state, and possibly needs to be part of a set of
@@ -179,8 +171,7 @@
# 'danger' flag.
def test_update_default_quotas(self):
LOG.debug("get the current 'default' quota class values")
- resp, body = self.adm_client.get_quota_class_set('default')
- self.assertEqual(200, resp.status)
+ body = self.adm_client.get_quota_class_set('default')
self.assertIn('id', body)
self.assertEqual('default', body.pop('id'))
# restore the defaults when the test is done
@@ -192,9 +183,8 @@
# to a very small number which causes issues.
body[quota] = default + 100
LOG.debug("update limits for the default quota class set")
- resp, update_body = self.adm_client.update_quota_class_set('default',
- **body)
- self.assertEqual(200, resp.status)
+ update_body = self.adm_client.update_quota_class_set('default',
+ **body)
LOG.debug("assert that the response has all of the changed values")
self.assertThat(update_body.items(),
matchers.ContainsAll(body.items()))
diff --git a/tempest/api/compute/admin/test_quotas_negative.py b/tempest/api/compute/admin/test_quotas_negative.py
index 532f195..b24f316 100644
--- a/tempest/api/compute/admin/test_quotas_negative.py
+++ b/tempest/api/compute/admin/test_quotas_negative.py
@@ -47,13 +47,13 @@
@test.attr(type=['negative', 'gate'])
def test_create_server_when_cpu_quota_is_full(self):
# Disallow server creation when tenant's vcpu quota is full
- resp, quota_set = self.adm_client.get_quota_set(self.demo_tenant_id)
+ quota_set = self.adm_client.get_quota_set(self.demo_tenant_id)
default_vcpu_quota = quota_set['cores']
vcpu_quota = 0 # Set the quota to zero to conserve resources
- resp, quota_set = self.adm_client.update_quota_set(self.demo_tenant_id,
- force=True,
- cores=vcpu_quota)
+ quota_set = self.adm_client.update_quota_set(self.demo_tenant_id,
+ force=True,
+ cores=vcpu_quota)
self.addCleanup(self.adm_client.update_quota_set, self.demo_tenant_id,
cores=default_vcpu_quota)
@@ -63,7 +63,7 @@
@test.attr(type=['negative', 'gate'])
def test_create_server_when_memory_quota_is_full(self):
# Disallow server creation when tenant's memory quota is full
- resp, quota_set = self.adm_client.get_quota_set(self.demo_tenant_id)
+ quota_set = self.adm_client.get_quota_set(self.demo_tenant_id)
default_mem_quota = quota_set['ram']
mem_quota = 0 # Set the quota to zero to conserve resources
@@ -79,7 +79,7 @@
@test.attr(type=['negative', 'gate'])
def test_create_server_when_instances_quota_is_full(self):
# Once instances quota limit is reached, disallow server creation
- resp, quota_set = self.adm_client.get_quota_set(self.demo_tenant_id)
+ quota_set = self.adm_client.get_quota_set(self.demo_tenant_id)
default_instances_quota = quota_set['instances']
instances_quota = 0 # Set quota to zero to disallow server creation
@@ -98,11 +98,11 @@
def test_security_groups_exceed_limit(self):
# Negative test: Creation Security Groups over limit should FAIL
- resp, quota_set = self.adm_client.get_quota_set(self.demo_tenant_id)
+ quota_set = self.adm_client.get_quota_set(self.demo_tenant_id)
default_sg_quota = quota_set['security_groups']
sg_quota = 0 # Set the quota to zero to conserve resources
- resp, quota_set =\
+ quota_set =\
self.adm_client.update_quota_set(self.demo_tenant_id,
force=True,
security_groups=sg_quota)
@@ -126,11 +126,11 @@
# Negative test: Creation of Security Group Rules should FAIL
# when we reach limit maxSecurityGroupRules
- resp, quota_set = self.adm_client.get_quota_set(self.demo_tenant_id)
+ quota_set = self.adm_client.get_quota_set(self.demo_tenant_id)
default_sg_rules_quota = quota_set['security_group_rules']
sg_rules_quota = 0 # Set the quota to zero to conserve resources
- resp, quota_set =\
+ quota_set =\
self.adm_client.update_quota_set(
self.demo_tenant_id,
force=True,
@@ -142,7 +142,7 @@
s_name = data_utils.rand_name('securitygroup-')
s_description = data_utils.rand_name('description-')
- resp, securitygroup =\
+ securitygroup =\
self.sg_client.create_security_group(s_name, s_description)
self.addCleanup(self.sg_client.delete_security_group,
securitygroup['id'])
diff --git a/tempest/api/compute/admin/test_security_group_default_rules.py b/tempest/api/compute/admin/test_security_group_default_rules.py
index 4c0bd47..563d517 100644
--- a/tempest/api/compute/admin/test_security_group_default_rules.py
+++ b/tempest/api/compute/admin/test_security_group_default_rules.py
@@ -40,7 +40,7 @@
from_port=22, to_port=22,
cidr='10.10.0.0/24'):
# Create Security Group default rule
- _, rule = self.adm_client.create_security_default_group_rule(
+ rule = self.adm_client.create_security_default_group_rule(
ip_protocol,
from_port,
to_port,
@@ -68,7 +68,7 @@
ip_protocol = 'udp'
from_port = 80
to_port = 80
- _, rule = self.adm_client.create_security_default_group_rule(
+ rule = self.adm_client.create_security_default_group_rule(
ip_protocol,
from_port,
to_port)
@@ -83,7 +83,7 @@
from_port = 10
to_port = 10
cidr = ''
- _, rule = self.adm_client.create_security_default_group_rule(
+ rule = self.adm_client.create_security_default_group_rule(
ip_protocol,
from_port,
to_port,
@@ -105,7 +105,7 @@
cidr)
self.addCleanup(self.adm_client.delete_security_group_default_rule,
rule['id'])
- _, rules = self.adm_client.list_security_group_default_rules()
+ rules = self.adm_client.list_security_group_default_rules()
self.assertNotEqual(0, len(rules))
self.assertIn(rule, rules)
@@ -121,6 +121,6 @@
cidr)
self.addCleanup(self.adm_client.delete_security_group_default_rule,
rule['id'])
- _, fetched_rule = self.adm_client.get_security_group_default_rule(
+ fetched_rule = self.adm_client.get_security_group_default_rule(
rule['id'])
self.assertEqual(rule, fetched_rule)
diff --git a/tempest/api/compute/admin/test_security_groups.py b/tempest/api/compute/admin/test_security_groups.py
index b4615f2..82cb26e 100644
--- a/tempest/api/compute/admin/test_security_groups.py
+++ b/tempest/api/compute/admin/test_security_groups.py
@@ -33,11 +33,9 @@
def _delete_security_group(self, securitygroup_id, admin=True):
if admin:
- resp, _ = self.adm_client.delete_security_group(securitygroup_id)
+ self.adm_client.delete_security_group(securitygroup_id)
else:
- resp, _ = self.client.delete_security_group(securitygroup_id)
-
- self.assertEqual(202, resp.status)
+ self.client.delete_security_group(securitygroup_id)
@testtools.skipIf(CONF.service_available.neutron,
"Skipped because neutron do not support all_tenants"
@@ -52,9 +50,8 @@
for i in range(2):
name = data_utils.rand_name('securitygroup-')
description = data_utils.rand_name('description-')
- resp, securitygroup = (self.client
- .create_security_group(name, description))
- self.assertEqual(200, resp.status)
+ securitygroup = (self.client
+ .create_security_group(name, description))
self.addCleanup(self._delete_security_group,
securitygroup['id'], admin=False)
security_group_list.append(securitygroup)
@@ -64,18 +61,16 @@
for i in range(2):
name = data_utils.rand_name('securitygroup-')
description = data_utils.rand_name('description-')
- resp, adm_securitygroup = (self.adm_client
- .create_security_group(name,
- description))
- self.assertEqual(200, resp.status)
+ adm_securitygroup = (self.adm_client
+ .create_security_group(name,
+ description))
self.addCleanup(self._delete_security_group,
adm_securitygroup['id'])
security_group_list.append(adm_securitygroup)
# Fetch all security groups based on 'all_tenants' search filter
param = {'all_tenants': 'true'}
- resp, fetched_list = self.adm_client.list_security_groups(params=param)
- self.assertEqual(200, resp.status)
+ fetched_list = self.adm_client.list_security_groups(params=param)
sec_group_id_list = map(lambda sg: sg['id'], fetched_list)
# Now check if all created Security Groups are present in fetched list
for sec_group in security_group_list:
@@ -83,8 +78,7 @@
# Fetch all security groups for non-admin user with 'all_tenants'
# search filter
- resp, fetched_list = self.client.list_security_groups(params=param)
- self.assertEqual(200, resp.status)
+ fetched_list = self.client.list_security_groups(params=param)
# Now check if all created Security Groups are present in fetched list
for sec_group in fetched_list:
self.assertEqual(sec_group['tenant_id'], client_tenant_id,
diff --git a/tempest/api/compute/admin/test_servers_negative.py b/tempest/api/compute/admin/test_servers_negative.py
index 2f0af72..0dddc76 100644
--- a/tempest/api/compute/admin/test_servers_negative.py
+++ b/tempest/api/compute/admin/test_servers_negative.py
@@ -49,7 +49,7 @@
flavor_id = data_utils.rand_int_id(start=1000)
while True:
try:
- resp, body = self.flavors_client.get_flavor_details(flavor_id)
+ self.flavors_client.get_flavor_details(flavor_id)
except exceptions.NotFound:
break
flavor_id = data_utils.rand_int_id(start=1000)
@@ -63,14 +63,13 @@
self.useFixture(fixtures.LockFixture('compute_quotas'))
flavor_name = data_utils.rand_name("flavor-")
flavor_id = self._get_unused_flavor_id()
- resp, quota_set = self.quotas_client.get_default_quota_set(
- self.tenant_id)
+ quota_set = self.quotas_client.get_default_quota_set(self.tenant_id)
ram = int(quota_set['ram']) + 1
vcpus = 8
disk = 10
- resp, flavor_ref = self.flavors_client.create_flavor(flavor_name,
- ram, vcpus, disk,
- flavor_id)
+ flavor_ref = self.flavors_client.create_flavor(flavor_name,
+ ram, vcpus, disk,
+ flavor_id)
self.addCleanup(self.flavors_client.delete_flavor, flavor_id)
self.assertRaises((exceptions.Unauthorized, exceptions.OverLimit),
self.client.resize,
@@ -86,13 +85,12 @@
flavor_name = data_utils.rand_name("flavor-")
flavor_id = self._get_unused_flavor_id()
ram = 512
- resp, quota_set = self.quotas_client.get_default_quota_set(
- self.tenant_id)
+ quota_set = self.quotas_client.get_default_quota_set(self.tenant_id)
vcpus = int(quota_set['cores']) + 1
disk = 10
- resp, flavor_ref = self.flavors_client.create_flavor(flavor_name,
- ram, vcpus, disk,
- flavor_id)
+ flavor_ref = self.flavors_client.create_flavor(flavor_name,
+ ram, vcpus, disk,
+ flavor_id)
self.addCleanup(self.flavors_client.delete_flavor, flavor_id)
self.assertRaises((exceptions.Unauthorized, exceptions.OverLimit),
self.client.resize,
diff --git a/tempest/api/compute/base.py b/tempest/api/compute/base.py
index c245eb4..3e80bf2 100644
--- a/tempest/api/compute/base.py
+++ b/tempest/api/compute/base.py
@@ -159,8 +159,7 @@
str(sg['id']) for sg in cls.security_groups))
for sg in cls.security_groups:
try:
- resp, body =\
- cls.security_groups_client.delete_security_group(sg['id'])
+ cls.security_groups_client.delete_security_group(sg['id'])
except exceptions.NotFound:
# The security group may have already been deleted which is OK.
pass
@@ -235,12 +234,12 @@
name = data_utils.rand_name(cls.__name__ + "-securitygroup")
if description is None:
description = data_utils.rand_name('description-')
- resp, body = \
+ body = \
cls.security_groups_client.create_security_group(name,
description)
cls.security_groups.append(body)
- return resp, body
+ return body
@classmethod
def create_test_server_group(cls, name="", policy=None):
diff --git a/tempest/api/compute/flavors/test_flavors.py b/tempest/api/compute/flavors/test_flavors.py
index 992f86a..c91ce17 100644
--- a/tempest/api/compute/flavors/test_flavors.py
+++ b/tempest/api/compute/flavors/test_flavors.py
@@ -31,8 +31,8 @@
@test.attr(type='smoke')
def test_list_flavors(self):
# List of all flavors should contain the expected flavor
- resp, flavors = self.client.list_flavors()
- resp, flavor = self.client.get_flavor_details(self.flavor_ref)
+ flavors = self.client.list_flavors()
+ flavor = self.client.get_flavor_details(self.flavor_ref)
flavor_min_detail = {'id': flavor['id'], 'links': flavor['links'],
'name': flavor['name']}
self.assertIn(flavor_min_detail, flavors)
@@ -40,88 +40,88 @@
@test.attr(type='smoke')
def test_list_flavors_with_detail(self):
# Detailed list of all flavors should contain the expected flavor
- resp, flavors = self.client.list_flavors_with_detail()
- resp, flavor = self.client.get_flavor_details(self.flavor_ref)
+ flavors = self.client.list_flavors_with_detail()
+ flavor = self.client.get_flavor_details(self.flavor_ref)
self.assertIn(flavor, flavors)
@test.attr(type='smoke')
def test_get_flavor(self):
# The expected flavor details should be returned
- resp, flavor = self.client.get_flavor_details(self.flavor_ref)
+ flavor = self.client.get_flavor_details(self.flavor_ref)
self.assertEqual(self.flavor_ref, flavor['id'])
@test.attr(type='gate')
def test_list_flavors_limit_results(self):
# Only the expected number of flavors should be returned
params = {'limit': 1}
- resp, flavors = self.client.list_flavors(params)
+ flavors = self.client.list_flavors(params)
self.assertEqual(1, len(flavors))
@test.attr(type='gate')
def test_list_flavors_detailed_limit_results(self):
# Only the expected number of flavors (detailed) should be returned
params = {'limit': 1}
- resp, flavors = self.client.list_flavors_with_detail(params)
+ flavors = self.client.list_flavors_with_detail(params)
self.assertEqual(1, len(flavors))
@test.attr(type='gate')
def test_list_flavors_using_marker(self):
# The list of flavors should start from the provided marker
- resp, flavor = self.client.get_flavor_details(self.flavor_ref)
+ flavor = self.client.get_flavor_details(self.flavor_ref)
flavor_id = flavor['id']
params = {'marker': flavor_id}
- resp, flavors = self.client.list_flavors(params)
+ flavors = self.client.list_flavors(params)
self.assertFalse(any([i for i in flavors if i['id'] == flavor_id]),
'The list of flavors did not start after the marker.')
@test.attr(type='gate')
def test_list_flavors_detailed_using_marker(self):
# The list of flavors should start from the provided marker
- resp, flavor = self.client.get_flavor_details(self.flavor_ref)
+ flavor = self.client.get_flavor_details(self.flavor_ref)
flavor_id = flavor['id']
params = {'marker': flavor_id}
- resp, flavors = self.client.list_flavors_with_detail(params)
+ flavors = self.client.list_flavors_with_detail(params)
self.assertFalse(any([i for i in flavors if i['id'] == flavor_id]),
'The list of flavors did not start after the marker.')
@test.attr(type='gate')
def test_list_flavors_detailed_filter_by_min_disk(self):
# The detailed list of flavors should be filtered by disk space
- resp, flavor = self.client.get_flavor_details(self.flavor_ref)
+ flavor = self.client.get_flavor_details(self.flavor_ref)
flavor_id = flavor['id']
params = {self._min_disk: flavor['disk'] + 1}
- resp, flavors = self.client.list_flavors_with_detail(params)
+ flavors = self.client.list_flavors_with_detail(params)
self.assertFalse(any([i for i in flavors if i['id'] == flavor_id]))
@test.attr(type='gate')
def test_list_flavors_detailed_filter_by_min_ram(self):
# The detailed list of flavors should be filtered by RAM
- resp, flavor = self.client.get_flavor_details(self.flavor_ref)
+ flavor = self.client.get_flavor_details(self.flavor_ref)
flavor_id = flavor['id']
params = {self._min_ram: flavor['ram'] + 1}
- resp, flavors = self.client.list_flavors_with_detail(params)
+ flavors = self.client.list_flavors_with_detail(params)
self.assertFalse(any([i for i in flavors if i['id'] == flavor_id]))
@test.attr(type='gate')
def test_list_flavors_filter_by_min_disk(self):
# The list of flavors should be filtered by disk space
- resp, flavor = self.client.get_flavor_details(self.flavor_ref)
+ flavor = self.client.get_flavor_details(self.flavor_ref)
flavor_id = flavor['id']
params = {self._min_disk: flavor['disk'] + 1}
- resp, flavors = self.client.list_flavors(params)
+ flavors = self.client.list_flavors(params)
self.assertFalse(any([i for i in flavors if i['id'] == flavor_id]))
@test.attr(type='gate')
def test_list_flavors_filter_by_min_ram(self):
# The list of flavors should be filtered by RAM
- resp, flavor = self.client.get_flavor_details(self.flavor_ref)
+ flavor = self.client.get_flavor_details(self.flavor_ref)
flavor_id = flavor['id']
params = {self._min_ram: flavor['ram'] + 1}
- resp, flavors = self.client.list_flavors(params)
+ flavors = self.client.list_flavors(params)
self.assertFalse(any([i for i in flavors if i['id'] == flavor_id]))
diff --git a/tempest/api/compute/floating_ips/test_floating_ips_actions.py b/tempest/api/compute/floating_ips/test_floating_ips_actions.py
index 19f5fba..e6f4fb0 100644
--- a/tempest/api/compute/floating_ips/test_floating_ips_actions.py
+++ b/tempest/api/compute/floating_ips/test_floating_ips_actions.py
@@ -13,6 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
+from tempest_lib import exceptions as lib_exc
+
from tempest.api.compute.floating_ips import base
from tempest.common.utils import data_utils
from tempest import exceptions
@@ -135,7 +137,7 @@
# Make sure no longer associated with old server
self.assertRaises((exceptions.NotFound,
- exceptions.UnprocessableEntity,
+ lib_exc.UnprocessableEntity,
exceptions.Conflict),
self.client.disassociate_floating_ip_from_server,
self.floating_ip, self.server_id)
diff --git a/tempest/api/compute/images/test_images_oneserver.py b/tempest/api/compute/images/test_images_oneserver.py
index 6156c5a..79cd27a 100644
--- a/tempest/api/compute/images/test_images_oneserver.py
+++ b/tempest/api/compute/images/test_images_oneserver.py
@@ -63,7 +63,7 @@
cls.server_id = server['id']
def _get_default_flavor_disk_size(self, flavor_id):
- resp, flavor = self.flavors_client.get_flavor_details(flavor_id)
+ flavor = self.flavors_client.get_flavor_details(flavor_id)
return flavor['disk']
@test.attr(type='smoke')
diff --git a/tempest/api/compute/limits/test_absolute_limits.py b/tempest/api/compute/limits/test_absolute_limits.py
index 4420ac7..520dfa9 100644
--- a/tempest/api/compute/limits/test_absolute_limits.py
+++ b/tempest/api/compute/limits/test_absolute_limits.py
@@ -27,7 +27,7 @@
@test.attr(type='gate')
def test_absLimits_get(self):
# To check if all limits are present in the response
- resp, absolute_limits = self.client.get_absolute_limits()
+ absolute_limits = self.client.get_absolute_limits()
expected_elements = ['maxImageMeta', 'maxPersonality',
'maxPersonalitySize',
'maxServerMeta', 'maxTotalCores',
diff --git a/tempest/api/compute/security_groups/test_security_group_rules.py b/tempest/api/compute/security_groups/test_security_group_rules.py
index be06213..527f2dd 100644
--- a/tempest/api/compute/security_groups/test_security_group_rules.py
+++ b/tempest/api/compute/security_groups/test_security_group_rules.py
@@ -61,10 +61,10 @@
# Positive test: Creation of Security Group rule
# should be successful
# Creating a Security Group to add rules to it
- _, security_group = self.create_security_group()
+ security_group = self.create_security_group()
securitygroup_id = security_group['id']
# Adding rules to the created Security Group
- _, rule = \
+ rule = \
self.client.create_security_group_rule(securitygroup_id,
self.ip_protocol,
self.from_port,
@@ -81,12 +81,12 @@
# should be successful
# Creating a Security Group to add rules to it
- _, security_group = self.create_security_group()
+ security_group = self.create_security_group()
parent_group_id = security_group['id']
# Adding rules to the created Security Group with optional cidr
cidr = '10.2.3.124/24'
- _, rule = \
+ rule = \
self.client.create_security_group_rule(parent_group_id,
self.ip_protocol,
self.from_port,
@@ -104,16 +104,16 @@
# should be successful
# Creating a Security Group to add rules to it
- _, security_group = self.create_security_group()
+ security_group = self.create_security_group()
parent_group_id = security_group['id']
# Creating a Security Group so as to assign group_id to the rule
- _, security_group = self.create_security_group()
+ security_group = self.create_security_group()
group_id = security_group['id']
group_name = security_group['name']
# Adding rules to the created Security Group with optional group_id
- _, rule = \
+ rule = \
self.client.create_security_group_rule(parent_group_id,
self.ip_protocol,
self.from_port,
@@ -130,11 +130,11 @@
# Positive test: Created Security Group rules should be
# in the list of all rules
# Creating a Security Group to add rules to it
- resp, security_group = self.create_security_group()
+ security_group = self.create_security_group()
securitygroup_id = security_group['id']
# Add a first rule to the created Security Group
- resp, rule = \
+ rule = \
self.client.create_security_group_rule(securitygroup_id,
self.ip_protocol,
self.from_port,
@@ -145,7 +145,7 @@
ip_protocol2 = 'icmp'
from_port2 = -1
to_port2 = -1
- resp, rule = \
+ rule = \
self.client.create_security_group_rule(securitygroup_id,
ip_protocol2,
from_port2, to_port2)
@@ -154,7 +154,7 @@
self.addCleanup(self.client.delete_security_group_rule, rule2_id)
# Get rules of the created Security Group
- resp, rules = \
+ rules = \
self.client.list_security_group_rules(securitygroup_id)
self.assertTrue(any([i for i in rules if i['id'] == rule1_id]))
self.assertTrue(any([i for i in rules if i['id'] == rule2_id]))
@@ -164,25 +164,22 @@
def test_security_group_rules_delete_when_peer_group_deleted(self):
# Positive test:rule will delete when peer group deleting
# Creating a Security Group to add rules to it
- resp, security_group = self.create_security_group()
+ security_group = self.create_security_group()
sg1_id = security_group['id']
# Creating other Security Group to access to group1
- resp, security_group = self.create_security_group()
+ security_group = self.create_security_group()
sg2_id = security_group['id']
# Adding rules to the Group1
- resp, rule = \
- self.client.create_security_group_rule(sg1_id,
- self.ip_protocol,
- self.from_port,
- self.to_port,
- group_id=sg2_id)
+ self.client.create_security_group_rule(sg1_id,
+ self.ip_protocol,
+ self.from_port,
+ self.to_port,
+ group_id=sg2_id)
- self.assertEqual(200, resp.status)
# Delete group2
- resp, body = self.client.delete_security_group(sg2_id)
- self.assertEqual(202, resp.status)
+ self.client.delete_security_group(sg2_id)
# Get rules of the Group1
- resp, rules = \
+ rules = \
self.client.list_security_group_rules(sg1_id)
# The group1 has no rules because group2 has deleted
self.assertEqual(0, len(rules))
diff --git a/tempest/api/compute/security_groups/test_security_group_rules_negative.py b/tempest/api/compute/security_groups/test_security_group_rules_negative.py
index 88a99b9..d97c404 100644
--- a/tempest/api/compute/security_groups/test_security_group_rules_negative.py
+++ b/tempest/api/compute/security_groups/test_security_group_rules_negative.py
@@ -69,20 +69,19 @@
def test_create_security_group_rule_duplicate(self):
# Negative test: Create Security Group rule duplicate should fail
# Creating a Security Group to add rule to it
- resp, sg = self.create_security_group()
+ sg = self.create_security_group()
# Adding rules to the created Security Group
parent_group_id = sg['id']
ip_protocol = 'tcp'
from_port = 22
to_port = 22
- resp, rule = \
+ rule = \
self.client.create_security_group_rule(parent_group_id,
ip_protocol,
from_port,
to_port)
self.addCleanup(self.client.delete_security_group_rule, rule['id'])
- self.assertEqual(200, resp.status)
# Add the same rule to the group should fail
self.assertRaises(exceptions.BadRequest,
self.client.create_security_group_rule,
@@ -94,7 +93,7 @@
# Negative test: Creation of Security Group rule should FAIL
# with invalid ip_protocol
# Creating a Security Group to add rule to it
- resp, sg = self.create_security_group()
+ sg = self.create_security_group()
# Adding rules to the created Security Group
parent_group_id = sg['id']
ip_protocol = data_utils.rand_name('999')
@@ -111,7 +110,7 @@
# Negative test: Creation of Security Group rule should FAIL
# with invalid from_port
# Creating a Security Group to add rule to it
- resp, sg = self.create_security_group()
+ sg = self.create_security_group()
# Adding rules to the created Security Group
parent_group_id = sg['id']
ip_protocol = 'tcp'
@@ -127,7 +126,7 @@
# Negative test: Creation of Security Group rule should FAIL
# with invalid to_port
# Creating a Security Group to add rule to it
- resp, sg = self.create_security_group()
+ sg = self.create_security_group()
# Adding rules to the created Security Group
parent_group_id = sg['id']
ip_protocol = 'tcp'
@@ -143,7 +142,7 @@
# Negative test: Creation of Security Group rule should FAIL
# with invalid port range.
# Creating a Security Group to add rule to it.
- resp, sg = self.create_security_group()
+ sg = self.create_security_group()
# Adding a rule to the created Security Group
secgroup_id = sg['id']
ip_protocol = 'tcp'
diff --git a/tempest/api/compute/security_groups/test_security_groups.py b/tempest/api/compute/security_groups/test_security_groups.py
index 1cfb16b..909d444 100644
--- a/tempest/api/compute/security_groups/test_security_groups.py
+++ b/tempest/api/compute/security_groups/test_security_groups.py
@@ -33,13 +33,11 @@
# Create 3 Security Groups
security_group_list = []
for i in range(3):
- resp, body = self.create_security_group()
- self.assertEqual(200, resp.status)
+ body = self.create_security_group()
security_group_list.append(body)
# Fetch all Security Groups and verify the list
# has all created Security Groups
- resp, fetched_list = self.client.list_security_groups()
- self.assertEqual(200, resp.status)
+ fetched_list = self.client.list_security_groups()
# Now check if all the created Security Groups are in fetched list
missing_sgs = \
[sg for sg in security_group_list if sg not in fetched_list]
@@ -49,11 +47,10 @@
for m_group in missing_sgs))
# Delete all security groups
for sg in security_group_list:
- resp, _ = self.client.delete_security_group(sg['id'])
- self.assertEqual(202, resp.status)
+ self.client.delete_security_group(sg['id'])
self.client.wait_for_resource_deletion(sg['id'])
# Now check if all the created Security Groups are deleted
- resp, fetched_list = self.client.list_security_groups()
+ fetched_list = self.client.list_security_groups()
deleted_sgs = \
[sg for sg in security_group_list if sg in fetched_list]
self.assertFalse(deleted_sgs,
@@ -68,22 +65,19 @@
# with char space between name along with
# leading and trailing spaces
s_name = ' %s ' % data_utils.rand_name('securitygroup ')
- resp, securitygroup = self.create_security_group(name=s_name)
- self.assertEqual(200, resp.status)
+ securitygroup = self.create_security_group(name=s_name)
self.assertIn('name', securitygroup)
securitygroup_name = securitygroup['name']
self.assertEqual(securitygroup_name, s_name,
"The created Security Group name is "
"not equal to the requested name")
# Now fetch the created Security Group by its 'id'
- resp, fetched_group = \
+ fetched_group = \
self.client.get_security_group(securitygroup['id'])
- self.assertEqual(200, resp.status)
self.assertEqual(securitygroup, fetched_group,
"The fetched Security Group is different "
"from the created Group")
- resp, _ = self.client.delete_security_group(securitygroup['id'])
- self.assertEqual(202, resp.status)
+ self.client.delete_security_group(securitygroup['id'])
self.client.wait_for_resource_deletion(securitygroup['id'])
@test.attr(type='smoke')
@@ -93,8 +87,8 @@
# and not deleted if the server is active.
# Create a couple security groups that we will use
# for the server resource this test creates
- resp, sg = self.create_security_group()
- resp, sg2 = self.create_security_group()
+ sg = self.create_security_group()
+ sg2 = self.create_security_group()
# Create server and add the security group created
# above to the server we just created
@@ -128,30 +122,25 @@
self.servers_client.delete_server(server_id)
self.servers_client.wait_for_server_termination(server_id)
- resp, _ = self.client.delete_security_group(sg['id'])
- self.assertEqual(202, resp.status)
- resp, _ = self.client.delete_security_group(sg2['id'])
- self.assertEqual(202, resp.status)
+ self.client.delete_security_group(sg['id'])
+ self.client.delete_security_group(sg2['id'])
@test.attr(type='smoke')
@test.services('network')
def test_update_security_groups(self):
# Update security group name and description
# Create a security group
- resp, securitygroup = self.create_security_group()
- self.assertEqual(200, resp.status)
+ securitygroup = self.create_security_group()
self.assertIn('id', securitygroup)
securitygroup_id = securitygroup['id']
# Update the name and description
s_new_name = data_utils.rand_name('sg-hth-')
s_new_des = data_utils.rand_name('description-hth-')
- resp, sg_new = \
- self.client.update_security_group(securitygroup_id,
- name=s_new_name,
- description=s_new_des)
- self.assertEqual(200, resp.status)
+ self.client.update_security_group(securitygroup_id,
+ name=s_new_name,
+ description=s_new_des)
# get the security group
- resp, fetched_group = \
+ fetched_group = \
self.client.get_security_group(securitygroup_id)
self.assertEqual(s_new_name, fetched_group['name'])
self.assertEqual(s_new_des, fetched_group['description'])
diff --git a/tempest/api/compute/security_groups/test_security_groups_negative.py b/tempest/api/compute/security_groups/test_security_groups_negative.py
index ce06180..988482b 100644
--- a/tempest/api/compute/security_groups/test_security_groups_negative.py
+++ b/tempest/api/compute/security_groups/test_security_groups_negative.py
@@ -34,7 +34,7 @@
def _generate_a_non_existent_security_group_id(self):
security_group_id = []
- resp, body = self.client.list_security_groups()
+ body = self.client.list_security_groups()
for i in range(len(body)):
security_group_id.append(body[i]['id'])
# Generate a non-existent security group id
@@ -105,9 +105,7 @@
# be created
s_name = data_utils.rand_name('securitygroup-')
s_description = data_utils.rand_name('description-')
- resp, security_group =\
- self.create_security_group(s_name, s_description)
- self.assertEqual(200, resp.status)
+ self.create_security_group(s_name, s_description)
# Now try the Security Group with the same 'Name'
self.assertRaises(exceptions.BadRequest,
self.client.create_security_group, s_name,
@@ -118,7 +116,7 @@
def test_delete_the_default_security_group(self):
# Negative test:Deletion of the "default" Security Group should Fail
default_security_group_id = None
- resp, body = self.client.list_security_groups()
+ body = self.client.list_security_groups()
for i in range(len(body)):
if body[i]['name'] == 'default':
default_security_group_id = body[i]['id']
@@ -164,8 +162,7 @@
@test.services('network')
def test_update_security_group_with_invalid_sg_name(self):
# Update security_group with invalid sg_name should fail
- resp, securitygroup = self.create_security_group()
- self.assertEqual(200, resp.status)
+ securitygroup = self.create_security_group()
self.assertIn('id', securitygroup)
securitygroup_id = securitygroup['id']
# Update Security Group with group name longer than 255 chars
@@ -180,8 +177,7 @@
@test.services('network')
def test_update_security_group_with_invalid_sg_des(self):
# Update security_group with invalid sg_des should fail
- resp, securitygroup = self.create_security_group()
- self.assertEqual(200, resp.status)
+ securitygroup = self.create_security_group()
self.assertIn('id', securitygroup)
securitygroup_id = securitygroup['id']
# Update Security Group with group description longer than 255 chars
diff --git a/tempest/api/compute/servers/test_create_server.py b/tempest/api/compute/servers/test_create_server.py
index 13ec045..85eb049 100644
--- a/tempest/api/compute/servers/test_create_server.py
+++ b/tempest/api/compute/servers/test_create_server.py
@@ -89,7 +89,7 @@
def test_verify_created_server_vcpus(self):
# Verify that the number of vcpus reported by the instance matches
# the amount stated by the flavor
- resp, flavor = self.flavors_client.get_flavor_details(self.flavor_ref)
+ flavor = self.flavors_client.get_flavor_details(self.flavor_ref)
linux_client = remote_client.RemoteClient(self.server, self.ssh_user,
self.password)
self.assertEqual(flavor['vcpus'], linux_client.get_number_of_vcpus())
@@ -210,13 +210,12 @@
disk = 0
# Create a flavor with extra specs
- resp, flavor = (self.flavor_client.
- create_flavor(flavor_with_eph_disk_name,
- ram, vcpus, disk,
- flavor_with_eph_disk_id,
- ephemeral=1))
+ flavor = (self.flavor_client.
+ create_flavor(flavor_with_eph_disk_name,
+ ram, vcpus, disk,
+ flavor_with_eph_disk_id,
+ ephemeral=1))
self.addCleanup(flavor_clean_up, flavor['id'])
- self.assertEqual(200, resp.status)
return flavor['id']
@@ -229,18 +228,16 @@
disk = 0
# Create a flavor without extra specs
- resp, flavor = (self.flavor_client.
- create_flavor(flavor_no_eph_disk_name,
- ram, vcpus, disk,
- flavor_no_eph_disk_id))
+ flavor = (self.flavor_client.
+ create_flavor(flavor_no_eph_disk_name,
+ ram, vcpus, disk,
+ flavor_no_eph_disk_id))
self.addCleanup(flavor_clean_up, flavor['id'])
- self.assertEqual(200, resp.status)
return flavor['id']
def flavor_clean_up(flavor_id):
- resp, body = self.flavor_client.delete_flavor(flavor_id)
- self.assertEqual(resp.status, 202)
+ self.flavor_client.delete_flavor(flavor_id)
self.flavor_client.wait_for_resource_deletion(flavor_id)
flavor_with_eph_disk_id = create_flavor_with_extra_specs()
diff --git a/tempest/api/compute/servers/test_server_metadata_negative.py b/tempest/api/compute/servers/test_server_metadata_negative.py
index ee1e652..e193677 100644
--- a/tempest/api/compute/servers/test_server_metadata_negative.py
+++ b/tempest/api/compute/servers/test_server_metadata_negative.py
@@ -122,7 +122,7 @@
# A 403 Forbidden or 413 Overlimit (old behaviour) exception
# will be raised while exceeding metadata items limit for
# tenant.
- _, quota_set = self.quotas.get_quota_set(self.tenant_id)
+ quota_set = self.quotas.get_quota_set(self.tenant_id)
quota_metadata = quota_set['metadata_items']
if quota_metadata == -1:
raise self.skipException("No limit for metadata_items")
diff --git a/tempest/api/compute/servers/test_server_rescue.py b/tempest/api/compute/servers/test_server_rescue.py
index ee1e268..b04fe69 100644
--- a/tempest/api/compute/servers/test_server_rescue.py
+++ b/tempest/api/compute/servers/test_server_rescue.py
@@ -40,7 +40,7 @@
# Security group creation
cls.sg_name = data_utils.rand_name('sg')
cls.sg_desc = data_utils.rand_name('sg-desc')
- resp, cls.sg = \
+ cls.sg = \
cls.security_groups_client.create_security_group(cls.sg_name,
cls.sg_desc)
cls.sg_id = cls.sg['id']
@@ -58,7 +58,7 @@
def resource_cleanup(cls):
# Deleting the floating IP which is created in this method
cls.floating_ips_client.delete_floating_ip(cls.floating_ip_id)
- resp, cls.sg = cls.security_groups_client.delete_security_group(
+ cls.sg = cls.security_groups_client.delete_security_group(
cls.sg_id)
super(ServerRescueTestJSON, cls).resource_cleanup()
diff --git a/tempest/api/compute/test_authorization.py b/tempest/api/compute/test_authorization.py
index dfb3c43..cdbaee8 100644
--- a/tempest/api/compute/test_authorization.py
+++ b/tempest/api/compute/test_authorization.py
@@ -72,14 +72,14 @@
name = data_utils.rand_name('security')
description = data_utils.rand_name('description')
- resp, cls.security_group = cls.security_client.create_security_group(
+ cls.security_group = cls.security_client.create_security_group(
name, description)
parent_group_id = cls.security_group['id']
ip_protocol = 'tcp'
from_port = 22
to_port = 22
- resp, cls.rule = cls.security_client.create_security_group_rule(
+ cls.rule = cls.security_client.create_security_group_rule(
parent_group_id, ip_protocol, from_port, to_port)
@classmethod
diff --git a/tempest/api/compute/test_quotas.py b/tempest/api/compute/test_quotas.py
index 4177751..db2e281 100644
--- a/tempest/api/compute/test_quotas.py
+++ b/tempest/api/compute/test_quotas.py
@@ -43,16 +43,14 @@
def test_get_quotas(self):
# User can get the quota set for it's tenant
expected_quota_set = self.default_quota_set | set(['id'])
- resp, quota_set = self.client.get_quota_set(self.tenant_id)
- self.assertEqual(200, resp.status)
+ quota_set = self.client.get_quota_set(self.tenant_id)
self.assertEqual(quota_set['id'], self.tenant_id)
for quota in expected_quota_set:
self.assertIn(quota, quota_set.keys())
# get the quota set using user id
- resp, quota_set = self.client.get_quota_set(self.tenant_id,
- self.user_id)
- self.assertEqual(200, resp.status)
+ quota_set = self.client.get_quota_set(self.tenant_id,
+ self.user_id)
self.assertEqual(quota_set['id'], self.tenant_id)
for quota in expected_quota_set:
self.assertIn(quota, quota_set.keys())
@@ -61,8 +59,7 @@
def test_get_default_quotas(self):
# User can get the default quota set for it's tenant
expected_quota_set = self.default_quota_set | set(['id'])
- resp, quota_set = self.client.get_default_quota_set(self.tenant_id)
- self.assertEqual(200, resp.status)
+ quota_set = self.client.get_default_quota_set(self.tenant_id)
self.assertEqual(quota_set['id'], self.tenant_id)
for quota in expected_quota_set:
self.assertIn(quota, quota_set.keys())
@@ -70,9 +67,7 @@
@test.attr(type='smoke')
def test_compare_tenant_quotas_with_default_quotas(self):
# Tenants are created with the default quota values
- resp, defualt_quota_set = \
+ defualt_quota_set = \
self.client.get_default_quota_set(self.tenant_id)
- self.assertEqual(200, resp.status)
- resp, tenant_quota_set = self.client.get_quota_set(self.tenant_id)
- self.assertEqual(200, resp.status)
+ tenant_quota_set = self.client.get_quota_set(self.tenant_id)
self.assertEqual(defualt_quota_set, tenant_quota_set)
diff --git a/tempest/api/compute/test_tenant_networks.py b/tempest/api/compute/test_tenant_networks.py
new file mode 100644
index 0000000..0591acc
--- /dev/null
+++ b/tempest/api/compute/test_tenant_networks.py
@@ -0,0 +1,33 @@
+# Copyright 2015 NEC Corporation. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from tempest.api.compute import base
+from tempest import test
+
+
+class NetworksTestJSON(base.BaseV2ComputeTest):
+
+ @classmethod
+ def resource_setup(cls):
+ super(NetworksTestJSON, cls).resource_setup()
+ cls.client = cls.os.tenant_networks_client
+
+ @test.attr(type='gate')
+ def test_list_show_tenant_networks(self):
+ tenant_networks = self.client.list_tenant_networks()
+ self.assertNotEmpty(tenant_networks, "No tenant networks found.")
+
+ for net in tenant_networks:
+ tenant_network = self.client.get_tenant_network(net['id'])
+ self.assertEqual(net['id'], tenant_network['id'])
diff --git a/tempest/api/database/flavors/test_flavors.py b/tempest/api/database/flavors/test_flavors.py
index aed1abe..ed172e9 100644
--- a/tempest/api/database/flavors/test_flavors.py
+++ b/tempest/api/database/flavors/test_flavors.py
@@ -55,7 +55,7 @@
@test.services('compute')
def test_compare_db_flavors_with_os(self):
_, db_flavors = self.client.list_db_flavors()
- _, os_flavors = self.os_flavors_client.list_flavors_with_detail()
+ os_flavors = self.os_flavors_client.list_flavors_with_detail()
self.assertEqual(len(os_flavors), len(db_flavors),
"OS flavors %s do not match DB flavors %s" %
(os_flavors, db_flavors))
diff --git a/tempest/api/telemetry/base.py b/tempest/api/telemetry/base.py
index e840e3b..8885187 100644
--- a/tempest/api/telemetry/base.py
+++ b/tempest/api/telemetry/base.py
@@ -52,11 +52,11 @@
@classmethod
def create_alarm(cls, **kwargs):
- resp, body = cls.telemetry_client.create_alarm(
+ body = cls.telemetry_client.create_alarm(
name=data_utils.rand_name('telemetry_alarm'),
type='threshold', **kwargs)
cls.alarm_ids.append(body['alarm_id'])
- return resp, body
+ return body
@classmethod
def create_server(cls):
@@ -100,10 +100,9 @@
timeout = CONF.compute.build_timeout
start = timeutils.utcnow()
while timeutils.delta_seconds(start, timeutils.utcnow()) < timeout:
- resp, body = self.telemetry_client.list_samples(metric, query)
- self.assertEqual(resp.status, 200)
+ body = self.telemetry_client.list_samples(metric, query)
if body:
- return resp, body
+ return body
time.sleep(CONF.compute.build_interval)
raise exceptions.TimeoutException(
diff --git a/tempest/api/telemetry/test_telemetry_alarming_api.py b/tempest/api/telemetry/test_telemetry_alarming_api.py
index b45d545..97eb4eb 100644
--- a/tempest/api/telemetry/test_telemetry_alarming_api.py
+++ b/tempest/api/telemetry/test_telemetry_alarming_api.py
@@ -32,8 +32,7 @@
@test.attr(type="gate")
def test_alarm_list(self):
# List alarms
- resp, alarm_list = self.telemetry_client.list_alarms()
- self.assertEqual(200, resp.status)
+ alarm_list = self.telemetry_client.list_alarms()
# Verify created alarm in the list
fetched_ids = [a['alarm_id'] for a in alarm_list]
@@ -47,9 +46,8 @@
def test_create_update_get_delete_alarm(self):
# Create an alarm
alarm_name = data_utils.rand_name('telemetry_alarm')
- resp, body = self.telemetry_client.create_alarm(
+ body = self.telemetry_client.create_alarm(
name=alarm_name, type='threshold', threshold_rule=self.rule)
- self.assertEqual(201, resp.status)
self.assertEqual(alarm_name, body['name'])
alarm_id = body['alarm_id']
self.assertDictContainsSubset(self.rule, body['threshold_rule'])
@@ -59,39 +57,34 @@
'threshold': 70.0,
'period': 60}
alarm_name = data_utils.rand_name('telemetry-alarm-update')
- resp, body = self.telemetry_client.update_alarm(
+ body = self.telemetry_client.update_alarm(
alarm_id,
threshold_rule=new_rule,
name=alarm_name,
type='threshold')
- self.assertEqual(200, resp.status)
self.assertEqual(alarm_name, body['name'])
self.assertDictContainsSubset(new_rule, body['threshold_rule'])
# Get and verify details of an alarm after update
- resp, body = self.telemetry_client.get_alarm(alarm_id)
- self.assertEqual(200, resp.status)
+ body = self.telemetry_client.get_alarm(alarm_id)
self.assertEqual(alarm_name, body['name'])
self.assertDictContainsSubset(new_rule, body['threshold_rule'])
# Delete alarm and verify if deleted
- resp, _ = self.telemetry_client.delete_alarm(alarm_id)
- self.assertEqual(204, resp.status)
+ self.telemetry_client.delete_alarm(alarm_id)
self.assertRaises(exceptions.NotFound,
self.telemetry_client.get_alarm, alarm_id)
@test.attr(type="gate")
def test_set_get_alarm_state(self):
alarm_states = ['ok', 'alarm', 'insufficient data']
- _, alarm = self.create_alarm(threshold_rule=self.rule)
+ alarm = self.create_alarm(threshold_rule=self.rule)
# Set alarm state and verify
new_state =\
[elem for elem in alarm_states if elem != alarm['state']][0]
- resp, state = self.telemetry_client.alarm_set_state(alarm['alarm_id'],
- new_state)
- self.assertEqual(200, resp.status)
+ _, state = self.telemetry_client.alarm_set_state(alarm['alarm_id'],
+ new_state)
self.assertEqual(new_state, state)
# Get alarm state and verify
- resp, state = self.telemetry_client.alarm_get_state(alarm['alarm_id'])
- self.assertEqual(200, resp.status)
+ _, state = self.telemetry_client.alarm_get_state(alarm['alarm_id'])
self.assertEqual(new_state, state)
@test.attr(type="gate")
@@ -100,15 +93,13 @@
"operator": "or"}
# Verifies alarm create
alarm_name = data_utils.rand_name('combination_alarm')
- resp, body = self.telemetry_client.create_alarm(name=alarm_name,
- combination_rule=rule,
- type='combination')
- self.assertEqual(201, resp.status)
+ body = self.telemetry_client.create_alarm(name=alarm_name,
+ combination_rule=rule,
+ type='combination')
self.assertEqual(alarm_name, body['name'])
alarm_id = body['alarm_id']
self.assertDictContainsSubset(rule, body['combination_rule'])
# Verify alarm delete
- resp, _ = self.telemetry_client.delete_alarm(alarm_id)
- self.assertEqual(204, resp.status)
+ self.telemetry_client.delete_alarm(alarm_id)
self.assertRaises(exceptions.NotFound,
self.telemetry_client.get_alarm, alarm_id)
diff --git a/tempest/api_schema/response/compute/v2/tenant_networks.py b/tempest/api_schema/response/compute/v2/tenant_networks.py
new file mode 100644
index 0000000..0b2868a
--- /dev/null
+++ b/tempest/api_schema/response/compute/v2/tenant_networks.py
@@ -0,0 +1,50 @@
+# Copyright 2015 NEC Corporation. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+param_network = {
+ 'type': 'object',
+ 'properties': {
+ 'id': {'type': 'string'},
+ 'cidr': {'type': ['string', 'null']},
+ 'label': {'type': 'string'}
+ },
+ 'required': ['id', 'cidr', 'label']
+}
+
+
+list_tenant_networks = {
+ 'status_code': [200],
+ 'response_body': {
+ 'type': 'object',
+ 'properties': {
+ 'networks': {
+ 'type': 'array',
+ 'items': param_network
+ }
+ },
+ 'required': ['networks']
+ }
+}
+
+
+get_tenant_network = {
+ 'status_code': [200],
+ 'response_body': {
+ 'type': 'object',
+ 'properties': {
+ 'network': param_network
+ },
+ 'required': ['network']
+ }
+}
diff --git a/tempest/auth.py b/tempest/auth.py
index 9687905..6a92b5f 100644
--- a/tempest/auth.py
+++ b/tempest/auth.py
@@ -24,8 +24,8 @@
from tempest import config
from tempest.openstack.common import log as logging
-from tempest.services.identity.json import identity_client as json_id
-from tempest.services.identity.v3.json import identity_client as json_v3id
+from tempest.services.identity.json import token_client as json_id
+from tempest.services.identity.v3.json import token_client as json_v3id
CONF = config.CONF
diff --git a/tempest/cli/simple_read_only/compute/test_nova.py b/tempest/cli/simple_read_only/compute/test_nova.py
index 4fe4982..5efeb75 100644
--- a/tempest/cli/simple_read_only/compute/test_nova.py
+++ b/tempest/cli/simple_read_only/compute/test_nova.py
@@ -149,7 +149,7 @@
def test_admin_secgroup_list_rules(self):
self.nova('secgroup-list-rules')
- @tempest.cli.min_client_version(client='nova', version='2.18')
+ @cli.min_client_version(client='nova', version='2.18')
def test_admin_server_group_list(self):
self.nova('server-group-list')
diff --git a/tempest/clients.py b/tempest/clients.py
index 723e7b5..03928ba 100644
--- a/tempest/clients.py
+++ b/tempest/clients.py
@@ -58,6 +58,8 @@
SecurityGroupsClientJSON
from tempest.services.compute.json.servers_client import ServersClientJSON
from tempest.services.compute.json.services_client import ServicesClientJSON
+from tempest.services.compute.json.tenant_networks_client import \
+ TenantNetworksClientJSON
from tempest.services.compute.json.tenant_usages_client import \
TenantUsagesClientJSON
from tempest.services.compute.json.volumes_extensions_client import \
@@ -70,18 +72,18 @@
from tempest.services.database.json.versions_client import \
DatabaseVersionsClientJSON
from tempest.services.identity.json.identity_client import IdentityClientJSON
-from tempest.services.identity.json.identity_client import TokenClientJSON
+from tempest.services.identity.json.token_client import TokenClientJSON
from tempest.services.identity.v3.json.credentials_client import \
CredentialsClientJSON
from tempest.services.identity.v3.json.endpoints_client import \
EndPointClientJSON
from tempest.services.identity.v3.json.identity_client import \
IdentityV3ClientJSON
-from tempest.services.identity.v3.json.identity_client import V3TokenClientJSON
from tempest.services.identity.v3.json.policy_client import PolicyClientJSON
from tempest.services.identity.v3.json.region_client import RegionClientJSON
from tempest.services.identity.v3.json.service_client import \
ServiceClientJSON
+from tempest.services.identity.v3.json.token_client import V3TokenClientJSON
from tempest.services.image.v1.json.image_client import ImageClientJSON
from tempest.services.image.v2.json.image_client import ImageClientV2JSON
from tempest.services.messaging.json.messaging_client import \
@@ -263,6 +265,8 @@
**params)
self.instance_usages_audit_log_client = \
InstanceUsagesAuditLogClientJSON(self.auth_provider, **params)
+ self.tenant_networks_client = \
+ TenantNetworksClientJSON(self.auth_provider, **params)
# NOTE: The following client needs special timeout values because
# the API is a proxy for the other component.
@@ -304,35 +308,53 @@
self.credentials_client = CredentialsClientJSON(self.auth_provider)
def _set_volume_clients(self):
- self.volume_qos_client = QosSpecsClientJSON(self.auth_provider)
+ params = {
+ 'service': CONF.volume.catalog_type,
+ 'region': CONF.volume.region or CONF.identity.region,
+ 'endpoint_type': CONF.volume.endpoint_type,
+ 'build_interval': CONF.volume.build_interval,
+ 'build_timeout': CONF.volume.build_timeout
+ }
+ params.update(self.default_params)
+
+ self.volume_qos_client = QosSpecsClientJSON(self.auth_provider,
+ **params)
self.volume_qos_v2_client = QosSpecsV2ClientJSON(
- self.auth_provider)
+ self.auth_provider, **params)
self.volume_services_v2_client = VolumesServicesV2ClientJSON(
- self.auth_provider)
- self.backups_client = BackupsClientJSON(self.auth_provider)
- self.backups_v2_client = BackupsClientV2JSON(self.auth_provider)
- self.snapshots_client = SnapshotsClientJSON(self.auth_provider)
- self.snapshots_v2_client = SnapshotsV2ClientJSON(self.auth_provider)
- self.volumes_client = VolumesClientJSON(self.auth_provider)
- self.volumes_v2_client = VolumesV2ClientJSON(self.auth_provider)
- self.volume_types_client = VolumeTypesClientJSON(self.auth_provider)
+ self.auth_provider, **params)
+ self.backups_client = BackupsClientJSON(self.auth_provider, **params)
+ self.backups_v2_client = BackupsClientV2JSON(self.auth_provider,
+ **params)
+ self.snapshots_client = SnapshotsClientJSON(self.auth_provider,
+ **params)
+ self.snapshots_v2_client = SnapshotsV2ClientJSON(self.auth_provider,
+ **params)
+ self.volumes_client = VolumesClientJSON(self.auth_provider, **params)
+ self.volumes_v2_client = VolumesV2ClientJSON(self.auth_provider,
+ **params)
+ self.volume_types_client = VolumeTypesClientJSON(self.auth_provider,
+ **params)
self.volume_services_client = VolumesServicesClientJSON(
- self.auth_provider)
- self.volume_hosts_client = VolumeHostsClientJSON(self.auth_provider)
+ self.auth_provider, **params)
+ self.volume_hosts_client = VolumeHostsClientJSON(self.auth_provider,
+ **params)
self.volume_hosts_v2_client = VolumeHostsV2ClientJSON(
- self.auth_provider)
- self.volume_quotas_client = VolumeQuotasClientJSON(self.auth_provider)
- self.volume_quotas_v2_client = VolumeQuotasV2Client(self.auth_provider)
+ self.auth_provider, **params)
+ self.volume_quotas_client = VolumeQuotasClientJSON(self.auth_provider,
+ **params)
+ self.volume_quotas_v2_client = VolumeQuotasV2Client(self.auth_provider,
+ **params)
self.volumes_extension_client = VolumeExtensionClientJSON(
- self.auth_provider)
+ self.auth_provider, **params)
self.volumes_v2_extension_client = VolumeV2ExtensionClientJSON(
- self.auth_provider)
+ self.auth_provider, **params)
self.volume_availability_zone_client = \
- VolumeAvailabilityZoneClientJSON(self.auth_provider)
+ VolumeAvailabilityZoneClientJSON(self.auth_provider, **params)
self.volume_v2_availability_zone_client = \
- VolumeV2AvailabilityZoneClientJSON(self.auth_provider)
+ VolumeV2AvailabilityZoneClientJSON(self.auth_provider, **params)
self.volume_types_v2_client = VolumeTypesV2ClientJSON(
- self.auth_provider)
+ self.auth_provider, **params)
def _set_object_storage_clients(self):
params = {
diff --git a/tempest/cmd/cleanup_service.py b/tempest/cmd/cleanup_service.py
index a0931c8..9c4a5dc 100644
--- a/tempest/cmd/cleanup_service.py
+++ b/tempest/cmd/cleanup_service.py
@@ -271,7 +271,7 @@
def list(self):
client = self.client
- _, secgrps = client.list_security_groups()
+ secgrps = client.list_security_groups()
secgrp_del = [grp for grp in secgrps if grp['name'] != 'default']
LOG.debug("List count, %s Security Groups" % len(secgrp_del))
return secgrp_del
@@ -778,7 +778,7 @@
def list(self):
client = self.client
- _, alarms = client.list_alarms()
+ alarms = client.list_alarms()
LOG.debug("List count, %s Alarms" % len(alarms))
return alarms
@@ -805,7 +805,7 @@
def list(self):
client = self.client
- _, flavors = client.list_flavors({"is_public": None})
+ flavors = client.list_flavors({"is_public": None})
if not self.is_save_state:
# recreate list removing saved flavors
flavors = [flavor for flavor in flavors if flavor['id']
diff --git a/tempest/cmd/javelin.py b/tempest/cmd/javelin.py
index 9fb982c..889b2dd 100755
--- a/tempest/cmd/javelin.py
+++ b/tempest/cmd/javelin.py
@@ -195,7 +195,14 @@
CONF.identity.region,
endpoint_type=CONF.telemetry.endpoint_type,
**default_params_with_timeout_values)
- self.volumes = volumes_client.VolumesClientJSON(_auth)
+ self.volumes = volumes_client.VolumesClientJSON(
+ _auth,
+ CONF.volume.catalog_type,
+ CONF.volume.region or CONF.identity.region,
+ endpoint_type=CONF.volume.endpoint_type,
+ build_interval=CONF.volume.build_interval,
+ build_timeout=CONF.volume.build_timeout,
+ **default_params)
self.networks = network_client.NetworkClientJSON(
_auth,
CONF.network.catalog_type,
@@ -467,11 +474,10 @@
LOG.info("checking telemetry")
for server in self.res['servers']:
client = client_for_user(server['owner'])
- response, body = client.telemetry.list_samples(
+ body = client.telemetry.list_samples(
'instance',
query=('metadata.display_name', 'eq', server['name'])
)
- self.assertEqual(response.status, 200)
self.assertTrue(len(body) >= 1, 'expecting at least one sample')
self._confirm_telemetry_sample(server, body[-1])
@@ -782,7 +788,7 @@
def _get_flavor_by_name(client, name):
- r, body = client.flavors.list_flavors()
+ body = client.flavors.list_flavors()
for flavor in body:
if name == flavor['name']:
return flavor
@@ -844,17 +850,14 @@
# only create a security group if the name isn't here
# i.e. a security group may be used by another server
# only create a router if the name isn't here
- r, body = client.secgroups.list_security_groups()
+ body = client.secgroups.list_security_groups()
if any(item['name'] == secgroup['name'] for item in body):
LOG.warning("Security group '%s' already exists" %
secgroup['name'])
continue
- resp, body = client.secgroups.create_security_group(
+ body = client.secgroups.create_security_group(
secgroup['name'], secgroup['description'])
- if not resp_ok(resp):
- raise ValueError("Failed to create security group: [%s] %s" %
- (resp, body))
secgroup_id = body['id']
# for each security group, create the rules
for rule in secgroup['rules']:
diff --git a/tempest/common/glance_http.py b/tempest/common/glance_http.py
index 92ed8f1..dd1448a 100644
--- a/tempest/common/glance_http.py
+++ b/tempest/common/glance_http.py
@@ -29,6 +29,7 @@
import OpenSSL
from six import moves
+from tempest_lib import exceptions as lib_exc
from tempest import exceptions as exc
from tempest.openstack.common import log as logging
@@ -164,7 +165,7 @@
kwargs['headers'].setdefault('Content-Type', 'application/json')
if kwargs['headers']['Content-Type'] != 'application/json':
msg = "Only application/json content-type is supported."
- raise exc.InvalidContentType(msg)
+ raise lib_exc.InvalidContentType(msg)
if 'body' in kwargs:
kwargs['body'] = json.dumps(kwargs['body'])
@@ -179,7 +180,7 @@
LOG.error('Could not decode response body as JSON')
else:
msg = "Only json/application content-type is supported."
- raise exc.InvalidContentType(msg)
+ raise lib_exc.InvalidContentType(msg)
return resp, body
diff --git a/tempest/common/service_client.py b/tempest/common/service_client.py
index dc634a1..69e25e2 100644
--- a/tempest/common/service_client.py
+++ b/tempest/common/service_client.py
@@ -69,10 +69,6 @@
raise exceptions.Conflict(ex)
except lib_exceptions.OverLimit as ex:
raise exceptions.OverLimit(ex)
- except lib_exceptions.InvalidContentType as ex:
- raise exceptions.InvalidContentType(ex)
- except lib_exceptions.UnprocessableEntity as ex:
- raise exceptions.UnprocessableEntity(ex)
# TODO(oomichi): This is just a workaround for failing gate tests
# when separating Forbidden from Unauthorized in tempest-lib.
# We will need to remove this translation and replace negative tests
diff --git a/tempest/config.py b/tempest/config.py
index 70f972f..c60434a 100644
--- a/tempest/config.py
+++ b/tempest/config.py
@@ -349,7 +349,10 @@
cfg.BoolOpt('snapshot',
default=True,
help='Does the test environment support creating snapshot '
- 'images of running instances?')
+ 'images of running instances?'),
+ cfg.BoolOpt('ec2_api',
+ default=True,
+ help='Does the test environment have the ec2 api running?')
]
diff --git a/tempest/exceptions.py b/tempest/exceptions.py
index 680b92a..7ddeeff 100644
--- a/tempest/exceptions.py
+++ b/tempest/exceptions.py
@@ -163,10 +163,6 @@
message = "Bad request"
-class UnprocessableEntity(RestClientException):
- message = "Unprocessable entity"
-
-
class OverLimit(RestClientException):
message = "Quota exceeded"
@@ -189,10 +185,6 @@
message = "HTTP response header is invalid"
-class InvalidContentType(RestClientException):
- message = "Invalid content type provided"
-
-
class InvalidStructure(TempestException):
message = "Invalid structure of table with details"
diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py
index 3b56ede..b1f5cce 100644
--- a/tempest/scenario/manager.py
+++ b/tempest/scenario/manager.py
@@ -236,7 +236,7 @@
def _create_loginable_secgroup_rule(self, secgroup_id=None):
_client = self.security_groups_client
if secgroup_id is None:
- _, sgs = _client.list_security_groups()
+ sgs = _client.list_security_groups()
for sg in sgs:
if sg['name'] == 'default':
secgroup_id = sg['id']
@@ -263,8 +263,8 @@
]
rules = list()
for ruleset in rulesets:
- _, sg_rule = _client.create_security_group_rule(secgroup_id,
- **ruleset)
+ sg_rule = _client.create_security_group_rule(secgroup_id,
+ **ruleset)
self.addCleanup(self.delete_wrapper,
_client.delete_security_group_rule,
sg_rule['id'])
@@ -275,7 +275,7 @@
# Create security group
sg_name = data_utils.rand_name(self.__class__.__name__)
sg_desc = sg_name + " description"
- _, secgroup = self.security_groups_client.create_security_group(
+ secgroup = self.security_groups_client.create_security_group(
sg_name, sg_desc)
self.assertEqual(secgroup['name'], sg_name)
self.assertEqual(secgroup['description'], sg_desc)
diff --git a/tempest/scenario/test_baremetal_basic_ops.py b/tempest/scenario/test_baremetal_basic_ops.py
index d59e31e..fd4449a 100644
--- a/tempest/scenario/test_baremetal_basic_ops.py
+++ b/tempest/scenario/test_baremetal_basic_ops.py
@@ -97,7 +97,7 @@
def get_flavor_ephemeral_size(self):
"""Returns size of the ephemeral partition in GiB."""
f_id = self.instance['flavor']['id']
- _, flavor = self.flavors_client.get_flavor_details(f_id)
+ flavor = self.flavors_client.get_flavor_details(f_id)
ephemeral = flavor.get('OS-FLV-EXT-DATA:ephemeral')
if not ephemeral or ephemeral == 'N/A':
return None
diff --git a/tempest/scenario/test_large_ops.py b/tempest/scenario/test_large_ops.py
index 60fd2bd..99a2023 100644
--- a/tempest/scenario/test_large_ops.py
+++ b/tempest/scenario/test_large_ops.py
@@ -74,7 +74,7 @@
# Explicitly create secgroup to avoid cleanup at the end of testcases.
# Since no traffic is tested, we don't need to actually add rules to
# secgroup
- _, secgroup = self.security_groups_client.create_security_group(
+ secgroup = self.security_groups_client.create_security_group(
'secgroup-%s' % name, 'secgroup-desc-%s' % name)
self.addCleanupClass(self.security_groups_client.delete_security_group,
secgroup['id'])
diff --git a/tempest/scenario/test_swift_telemetry_middleware.py b/tempest/scenario/test_swift_telemetry_middleware.py
index e8eb45c..dce6023 100644
--- a/tempest/scenario/test_swift_telemetry_middleware.py
+++ b/tempest/scenario/test_swift_telemetry_middleware.py
@@ -71,7 +71,7 @@
Otherwise returning False will case _check_samples to be
called again.
"""
- _, results = self.telemetry_client.list_samples(
+ results = self.telemetry_client.list_samples(
'storage.api.request')
LOG.debug('got samples %s', results)
diff --git a/tempest/scenario/utils.py b/tempest/scenario/utils.py
index 7967949..f997a65 100644
--- a/tempest/scenario/utils.py
+++ b/tempest/scenario/utils.py
@@ -67,7 +67,7 @@
def is_flavor_enough(self, flavor_id, image_id):
_image = self.images_client.get_image(image_id)
- _, _flavor = self.flavors_client.get_flavor_details(flavor_id)
+ _flavor = self.flavors_client.get_flavor_details(flavor_id)
return self._is_flavor_enough(_flavor, _image)
@@ -134,7 +134,7 @@
:return: a scenario with name and uuid of flavors
"""
if not hasattr(self, '_scenario_flavors'):
- _, flavors = self.flavors_client.list_flavors()
+ flavors = self.flavors_client.list_flavors()
self._scenario_flavors = [
(self._normalize_name(f['name']), dict(flavor_ref=f['id']))
for f in flavors if re.search(self.flavor_pattern,
diff --git a/tempest/services/compute/json/flavors_client.py b/tempest/services/compute/json/flavors_client.py
index b42ea40..433c325 100644
--- a/tempest/services/compute/json/flavors_client.py
+++ b/tempest/services/compute/json/flavors_client.py
@@ -34,7 +34,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.validate_response(common_schema.list_flavors, resp, body)
- return resp, body['flavors']
+ return service_client.ResponseBodyList(resp, body['flavors'])
def list_flavors_with_detail(self, params=None):
url = 'flavors/detail'
@@ -44,13 +44,13 @@
resp, body = self.get(url)
body = json.loads(body)
self.validate_response(v2schema.list_flavors_details, resp, body)
- return resp, body['flavors']
+ return service_client.ResponseBodyList(resp, body['flavors'])
def get_flavor_details(self, flavor_id):
resp, body = self.get("flavors/%s" % str(flavor_id))
body = json.loads(body)
self.validate_response(v2schema.create_get_flavor_details, resp, body)
- return resp, body['flavor']
+ return service_client.ResponseBody(resp, body['flavor'])
def create_flavor(self, name, ram, vcpus, disk, flavor_id, **kwargs):
"""Creates a new flavor or instance type."""
@@ -74,19 +74,19 @@
body = json.loads(body)
self.validate_response(v2schema.create_get_flavor_details, resp, body)
- return resp, body['flavor']
+ return service_client.ResponseBody(resp, body['flavor'])
def delete_flavor(self, flavor_id):
"""Deletes the given flavor."""
resp, body = self.delete("flavors/{0}".format(flavor_id))
self.validate_response(v2schema.delete_flavor, resp, body)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def is_resource_deleted(self, id):
# Did not use get_flavor_details(id) for verification as it gives
# 200 ok even for deleted id. LP #981263
# we can remove the loop here and use get by ID when bug gets sortedout
- resp, flavors = self.list_flavors_with_detail()
+ flavors = self.list_flavors_with_detail()
for flavor in flavors:
if flavor['id'] == id:
return False
@@ -105,7 +105,7 @@
body = json.loads(body)
self.validate_response(schema_extra_specs.flavor_extra_specs,
resp, body)
- return resp, body['extra_specs']
+ return service_client.ResponseBody(resp, body['extra_specs'])
def get_flavor_extra_spec(self, flavor_id):
"""Gets extra Specs details of the mentioned flavor."""
@@ -113,7 +113,7 @@
body = json.loads(body)
self.validate_response(schema_extra_specs.flavor_extra_specs,
resp, body)
- return resp, body['extra_specs']
+ return service_client.ResponseBody(resp, body['extra_specs'])
def get_flavor_extra_spec_with_key(self, flavor_id, key):
"""Gets extra Specs key-value of the mentioned flavor and key."""
@@ -122,7 +122,7 @@
body = json.loads(body)
self.validate_response(schema_extra_specs.flavor_extra_specs_key,
resp, body)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def update_flavor_extra_spec(self, flavor_id, key, **kwargs):
"""Update specified extra Specs of the mentioned flavor and key."""
@@ -131,14 +131,14 @@
body = json.loads(body)
self.validate_response(schema_extra_specs.flavor_extra_specs_key,
resp, body)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def unset_flavor_extra_spec(self, flavor_id, key):
"""Unsets extra Specs from the mentioned flavor."""
resp, body = self.delete('flavors/%s/os-extra_specs/%s' %
(str(flavor_id), key))
self.validate_response(v2schema.unset_flavor_extra_specs, resp, body)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def list_flavor_access(self, flavor_id):
"""Gets flavor access information given the flavor id."""
@@ -146,7 +146,7 @@
body = json.loads(body)
self.validate_response(schema_access.add_remove_list_flavor_access,
resp, body)
- return resp, body['flavor_access']
+ return service_client.ResponseBodyList(resp, body['flavor_access'])
def add_flavor_access(self, flavor_id, tenant_id):
"""Add flavor access for the specified tenant."""
@@ -160,7 +160,7 @@
body = json.loads(body)
self.validate_response(schema_access.add_remove_list_flavor_access,
resp, body)
- return resp, body['flavor_access']
+ return service_client.ResponseBodyList(resp, body['flavor_access'])
def remove_flavor_access(self, flavor_id, tenant_id):
"""Remove flavor access from the specified tenant."""
@@ -174,4 +174,4 @@
body = json.loads(body)
self.validate_response(schema_access.add_remove_list_flavor_access,
resp, body)
- return resp, body['flavor_access']
+ return service_client.ResponseBody(resp, body['flavor_access'])
diff --git a/tempest/services/compute/json/limits_client.py b/tempest/services/compute/json/limits_client.py
index 3a725ae..8769906 100644
--- a/tempest/services/compute/json/limits_client.py
+++ b/tempest/services/compute/json/limits_client.py
@@ -25,7 +25,7 @@
resp, body = self.get("limits")
body = json.loads(body)
self.validate_response(schema.get_limit, resp, body)
- return resp, body['limits']['absolute']
+ return service_client.ResponseBody(resp, body['limits']['absolute'])
def get_specific_absolute_limit(self, absolute_limit):
resp, body = self.get("limits")
diff --git a/tempest/services/compute/json/quotas_client.py b/tempest/services/compute/json/quotas_client.py
index f9f02a5..ea0f423 100644
--- a/tempest/services/compute/json/quotas_client.py
+++ b/tempest/services/compute/json/quotas_client.py
@@ -32,7 +32,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.validate_response(schema.quota_set, resp, body)
- return resp, body['quota_set']
+ return service_client.ResponseBody(resp, body['quota_set'])
def get_default_quota_set(self, tenant_id):
"""List the default quota set for a tenant."""
@@ -41,7 +41,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.validate_response(schema.quota_set, resp, body)
- return resp, body['quota_set']
+ return service_client.ResponseBody(resp, body['quota_set'])
def update_quota_set(self, tenant_id, user_id=None,
force=None, injected_file_content_bytes=None,
@@ -106,13 +106,13 @@
body = json.loads(body)
self.validate_response(schema.quota_set_update, resp, body)
- return resp, body['quota_set']
+ return service_client.ResponseBody(resp, body['quota_set'])
def delete_quota_set(self, tenant_id):
"""Delete the tenant's quota set."""
resp, body = self.delete('os-quota-sets/%s' % str(tenant_id))
self.validate_response(schema.delete_quota, resp, body)
- return resp, body
+ return service_client.ResponseBody(resp, body)
class QuotaClassesClientJSON(service_client.ServiceClient):
@@ -124,7 +124,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.validate_response(classes_schema.quota_set, resp, body)
- return resp, body['quota_class_set']
+ return service_client.ResponseBody(resp, body['quota_class_set'])
def update_quota_class_set(self, quota_class_id, **kwargs):
"""
@@ -137,4 +137,4 @@
body = json.loads(body)
self.validate_response(classes_schema.quota_set_update, resp, body)
- return resp, body['quota_class_set']
+ return service_client.ResponseBody(resp, body['quota_class_set'])
diff --git a/tempest/services/compute/json/security_group_default_rules_client.py b/tempest/services/compute/json/security_group_default_rules_client.py
index 5d0c16f..b370e00 100644
--- a/tempest/services/compute/json/security_group_default_rules_client.py
+++ b/tempest/services/compute/json/security_group_default_rules_client.py
@@ -43,7 +43,8 @@
body = json.loads(body)
self.validate_response(schema.create_get_security_group_default_rule,
resp, body)
- return resp, body['security_group_default_rule']
+ rule = body['security_group_default_rule']
+ return service_client.ResponseBody(resp, rule)
def delete_security_group_default_rule(self,
security_group_default_rule_id):
@@ -52,7 +53,7 @@
security_group_default_rule_id))
self.validate_response(schema.delete_security_group_default_rule,
resp, body)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def list_security_group_default_rules(self):
"""List all Security Group default rules."""
@@ -60,7 +61,8 @@
body = json.loads(body)
self.validate_response(schema.list_security_group_default_rules,
resp, body)
- return resp, body['security_group_default_rules']
+ rules = body['security_group_default_rules']
+ return service_client.ResponseBodyList(resp, rules)
def get_security_group_default_rule(self, security_group_default_rule_id):
"""Return the details of provided Security Group default rule."""
@@ -69,4 +71,5 @@
body = json.loads(body)
self.validate_response(schema.create_get_security_group_default_rule,
resp, body)
- return resp, body['security_group_default_rule']
+ rule = body['security_group_default_rule']
+ return service_client.ResponseBody(resp, rule)
diff --git a/tempest/services/compute/json/security_groups_client.py b/tempest/services/compute/json/security_groups_client.py
index 1ac52af..410ad60 100644
--- a/tempest/services/compute/json/security_groups_client.py
+++ b/tempest/services/compute/json/security_groups_client.py
@@ -33,7 +33,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.validate_response(schema.list_security_groups, resp, body)
- return resp, body['security_groups']
+ return service_client.ResponseBodyList(resp, body['security_groups'])
def get_security_group(self, security_group_id):
"""Get the details of a Security Group."""
@@ -41,7 +41,7 @@
resp, body = self.get(url)
body = json.loads(body)
self.validate_response(schema.get_security_group, resp, body)
- return resp, body['security_group']
+ return service_client.ResponseBody(resp, body['security_group'])
def create_security_group(self, name, description):
"""
@@ -57,7 +57,7 @@
resp, body = self.post('os-security-groups', post_body)
body = json.loads(body)
self.validate_response(schema.get_security_group, resp, body)
- return resp, body['security_group']
+ return service_client.ResponseBody(resp, body['security_group'])
def update_security_group(self, security_group_id, name=None,
description=None):
@@ -77,14 +77,14 @@
post_body)
body = json.loads(body)
self.validate_response(schema.update_security_group, resp, body)
- return resp, body['security_group']
+ return service_client.ResponseBody(resp, body['security_group'])
def delete_security_group(self, security_group_id):
"""Deletes the provided Security Group."""
resp, body = self.delete(
'os-security-groups/%s' % str(security_group_id))
self.validate_response(schema.delete_security_group, resp, body)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def create_security_group_rule(self, parent_group_id, ip_proto, from_port,
to_port, **kwargs):
@@ -111,14 +111,14 @@
resp, body = self.post(url, post_body)
body = json.loads(body)
self.validate_response(schema.create_security_group_rule, resp, body)
- return resp, body['security_group_rule']
+ return service_client.ResponseBody(resp, body['security_group_rule'])
def delete_security_group_rule(self, group_rule_id):
"""Deletes the provided Security Group rule."""
resp, body = self.delete('os-security-group-rules/%s' %
str(group_rule_id))
self.validate_response(schema.delete_security_group_rule, resp, body)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def list_security_group_rules(self, security_group_id):
"""List all rules for a security group."""
@@ -127,7 +127,7 @@
self.validate_response(schema.list_security_groups, resp, body)
for sg in body['security_groups']:
if sg['id'] == security_group_id:
- return resp, sg['rules']
+ return service_client.ResponseBodyList(resp, sg['rules'])
raise exceptions.NotFound('No such Security Group')
def is_resource_deleted(self, id):
diff --git a/tempest/services/compute/json/tenant_networks_client.py b/tempest/services/compute/json/tenant_networks_client.py
new file mode 100644
index 0000000..c86c817
--- /dev/null
+++ b/tempest/services/compute/json/tenant_networks_client.py
@@ -0,0 +1,33 @@
+# Copyright 2015 NEC Corporation. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+import json
+
+from tempest.api_schema.response.compute.v2 import tenant_networks as schema
+from tempest.common import service_client
+
+
+class TenantNetworksClientJSON(service_client.ServiceClient):
+
+ def list_tenant_networks(self):
+ resp, body = self.get("os-tenant-networks")
+ body = json.loads(body)
+ self.validate_response(schema.list_tenant_networks, resp, body)
+ return service_client.ResponseBodyList(resp, body['networks'])
+
+ def get_tenant_network(self, network_id):
+ resp, body = self.get("os-tenant-networks/%s" % str(network_id))
+ body = json.loads(body)
+ self.validate_response(schema.get_tenant_network, resp, body)
+ return service_client.ResponseBody(resp, body['network'])
diff --git a/tempest/services/identity/json/identity_client.py b/tempest/services/identity/json/identity_client.py
index a6c5049..d4f57e0 100644
--- a/tempest/services/identity/json/identity_client.py
+++ b/tempest/services/identity/json/identity_client.py
@@ -279,90 +279,3 @@
body = json.loads(body)
return service_client.ResponseBodyList(resp,
body['extensions']['values'])
-
-
-class TokenClientJSON(IdentityClientJSON):
-
- def __init__(self):
- super(TokenClientJSON, self).__init__(None)
- auth_url = CONF.identity.uri
-
- # Normalize URI to ensure /tokens is in it.
- if 'tokens' not in auth_url:
- auth_url = auth_url.rstrip('/') + '/tokens'
-
- self.auth_url = auth_url
-
- def auth(self, user, password, tenant=None):
- creds = {
- 'auth': {
- 'passwordCredentials': {
- 'username': user,
- 'password': password,
- },
- }
- }
-
- if tenant:
- creds['auth']['tenantName'] = tenant
-
- body = json.dumps(creds)
- resp, body = self.post(self.auth_url, body=body)
- self.expected_success(200, resp.status)
-
- return service_client.ResponseBody(resp, body['access'])
-
- def auth_token(self, token_id, tenant=None):
- creds = {
- 'auth': {
- 'token': {
- 'id': token_id,
- },
- }
- }
-
- if tenant:
- creds['auth']['tenantName'] = tenant
-
- body = json.dumps(creds)
- resp, body = self.post(self.auth_url, body=body)
- self.expected_success(200, resp.status)
-
- return service_client.ResponseBody(resp, body['access'])
-
- def request(self, method, url, extra_headers=False, headers=None,
- body=None):
- """A simple HTTP request interface."""
- if headers is None:
- headers = self.get_headers(accept_type="json")
- elif extra_headers:
- try:
- headers.update(self.get_headers(accept_type="json"))
- except (ValueError, TypeError):
- headers = self.get_headers(accept_type="json")
-
- resp, resp_body = self.raw_request(url, method,
- headers=headers, body=body)
- self._log_request(method, url, resp)
-
- if resp.status in [401, 403]:
- resp_body = json.loads(resp_body)
- raise exceptions.Unauthorized(resp_body['error']['message'])
- elif resp.status not in [200, 201]:
- raise exceptions.IdentityError(
- 'Unexpected status code {0}'.format(resp.status))
-
- if isinstance(resp_body, str):
- resp_body = json.loads(resp_body)
- return resp, resp_body
-
- def get_token(self, user, password, tenant, auth_data=False):
- """
- Returns (token id, token data) for supplied credentials
- """
- body = self.auth(user, password, tenant)
-
- if auth_data:
- return body['token']['id'], body
- else:
- return body['token']['id']
diff --git a/tempest/services/identity/json/token_client.py b/tempest/services/identity/json/token_client.py
new file mode 100644
index 0000000..93936bc
--- /dev/null
+++ b/tempest/services/identity/json/token_client.py
@@ -0,0 +1,108 @@
+# Copyright 2015 NEC Corporation. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+import json
+
+from tempest.common import service_client
+from tempest import config
+from tempest import exceptions
+
+CONF = config.CONF
+
+
+class TokenClientJSON(service_client.ServiceClient):
+
+ def __init__(self):
+ super(TokenClientJSON, self).__init__(None, None, None)
+ auth_url = CONF.identity.uri
+
+ # Normalize URI to ensure /tokens is in it.
+ if 'tokens' not in auth_url:
+ auth_url = auth_url.rstrip('/') + '/tokens'
+
+ self.auth_url = auth_url
+
+ def auth(self, user, password, tenant=None):
+ creds = {
+ 'auth': {
+ 'passwordCredentials': {
+ 'username': user,
+ 'password': password,
+ },
+ }
+ }
+
+ if tenant:
+ creds['auth']['tenantName'] = tenant
+
+ body = json.dumps(creds)
+ resp, body = self.post(self.auth_url, body=body)
+ self.expected_success(200, resp.status)
+
+ return service_client.ResponseBody(resp, body['access'])
+
+ def auth_token(self, token_id, tenant=None):
+ creds = {
+ 'auth': {
+ 'token': {
+ 'id': token_id,
+ },
+ }
+ }
+
+ if tenant:
+ creds['auth']['tenantName'] = tenant
+
+ body = json.dumps(creds)
+ resp, body = self.post(self.auth_url, body=body)
+ self.expected_success(200, resp.status)
+
+ return service_client.ResponseBody(resp, body['access'])
+
+ def request(self, method, url, extra_headers=False, headers=None,
+ body=None):
+ """A simple HTTP request interface."""
+ if headers is None:
+ headers = self.get_headers(accept_type="json")
+ elif extra_headers:
+ try:
+ headers.update(self.get_headers(accept_type="json"))
+ except (ValueError, TypeError):
+ headers = self.get_headers(accept_type="json")
+
+ resp, resp_body = self.raw_request(url, method,
+ headers=headers, body=body)
+ self._log_request(method, url, resp)
+
+ if resp.status in [401, 403]:
+ resp_body = json.loads(resp_body)
+ raise exceptions.Unauthorized(resp_body['error']['message'])
+ elif resp.status not in [200, 201]:
+ raise exceptions.IdentityError(
+ 'Unexpected status code {0}'.format(resp.status))
+
+ if isinstance(resp_body, str):
+ resp_body = json.loads(resp_body)
+ return resp, resp_body
+
+ def get_token(self, user, password, tenant, auth_data=False):
+ """
+ Returns (token id, token data) for supplied credentials
+ """
+ body = self.auth(user, password, tenant)
+
+ if auth_data:
+ return body['token']['id'], body
+ else:
+ return body['token']['id']
diff --git a/tempest/services/identity/v3/json/identity_client.py b/tempest/services/identity/v3/json/identity_client.py
index 6010249..f3d9d2d 100644
--- a/tempest/services/identity/v3/json/identity_client.py
+++ b/tempest/services/identity/v3/json/identity_client.py
@@ -18,7 +18,6 @@
from tempest.common import service_client
from tempest import config
-from tempest import exceptions
from tempest.services.identity.v3.json import base
CONF = config.CONF
@@ -525,117 +524,3 @@
% (trust_id, role_id))
self.expected_success(200, resp.status)
return service_client.ResponseBody(resp, body)
-
-
-class V3TokenClientJSON(service_client.ServiceClient):
-
- def __init__(self):
- super(V3TokenClientJSON, self).__init__(None, None, None)
- auth_url = CONF.identity.uri_v3
- if not auth_url:
- raise exceptions.InvalidConfiguration('you must specify a v3 uri '
- 'if using the v3 identity '
- 'api')
- if 'auth/tokens' not in auth_url:
- auth_url = auth_url.rstrip('/') + '/auth/tokens'
-
- self.auth_url = auth_url
-
- def auth(self, user=None, password=None, tenant=None, user_type='id',
- domain=None, token=None):
- """
- :param user: user id or name, as specified in user_type
- :param domain: the user and tenant domain
- :param token: a token to re-scope.
-
- Accepts different combinations of credentials. Restrictions:
- - tenant and domain are only name (no id)
- - user domain and tenant domain are assumed identical
- - domain scope is not supported here
- Sample sample valid combinations:
- - token
- - token, tenant, domain
- - user_id, password
- - username, password, domain
- - username, password, tenant, domain
- Validation is left to the server side.
- """
- creds = {
- 'auth': {
- 'identity': {
- 'methods': [],
- }
- }
- }
- id_obj = creds['auth']['identity']
- if token:
- id_obj['methods'].append('token')
- id_obj['token'] = {
- 'id': token
- }
- if user and password:
- id_obj['methods'].append('password')
- id_obj['password'] = {
- 'user': {
- 'password': password,
- }
- }
- if user_type == 'id':
- id_obj['password']['user']['id'] = user
- else:
- id_obj['password']['user']['name'] = user
- if domain is not None:
- _domain = dict(name=domain)
- id_obj['password']['user']['domain'] = _domain
- if tenant is not None:
- _domain = dict(name=domain)
- project = dict(name=tenant, domain=_domain)
- scope = dict(project=project)
- creds['auth']['scope'] = scope
-
- body = json.dumps(creds)
- resp, body = self.post(self.auth_url, body=body)
- self.expected_success(201, resp.status)
- return service_client.ResponseBody(resp, body)
-
- def request(self, method, url, extra_headers=False, headers=None,
- body=None):
- """A simple HTTP request interface."""
- if headers is None:
- # Always accept 'json', for xml token client too.
- # Because XML response is not easily
- # converted to the corresponding JSON one
- headers = self.get_headers(accept_type="json")
- elif extra_headers:
- try:
- headers.update(self.get_headers(accept_type="json"))
- except (ValueError, TypeError):
- headers = self.get_headers(accept_type="json")
-
- resp, resp_body = self.raw_request(url, method,
- headers=headers, body=body)
- self._log_request(method, url, resp)
-
- if resp.status in [401, 403]:
- resp_body = json.loads(resp_body)
- raise exceptions.Unauthorized(resp_body['error']['message'])
- elif resp.status not in [200, 201, 204]:
- raise exceptions.IdentityError(
- 'Unexpected status code {0}'.format(resp.status))
-
- return resp, json.loads(resp_body)
-
- def get_token(self, user, password, tenant, domain='Default',
- auth_data=False):
- """
- :param user: username
- Returns (token id, token data) for supplied credentials
- """
- body = self.auth(user, password, tenant, user_type='name',
- domain=domain)
-
- token = body.response.get('x-subject-token')
- if auth_data:
- return token, body['token']
- else:
- return token
diff --git a/tempest/services/identity/v3/json/token_client.py b/tempest/services/identity/v3/json/token_client.py
new file mode 100644
index 0000000..14c4a0a
--- /dev/null
+++ b/tempest/services/identity/v3/json/token_client.py
@@ -0,0 +1,135 @@
+# Copyright 2015 NEC Corporation. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+import json
+
+from tempest.common import service_client
+from tempest import config
+from tempest import exceptions
+
+CONF = config.CONF
+
+
+class V3TokenClientJSON(service_client.ServiceClient):
+
+ def __init__(self):
+ super(V3TokenClientJSON, self).__init__(None, None, None)
+ auth_url = CONF.identity.uri_v3
+ if not auth_url:
+ raise exceptions.InvalidConfiguration('you must specify a v3 uri '
+ 'if using the v3 identity '
+ 'api')
+ if 'auth/tokens' not in auth_url:
+ auth_url = auth_url.rstrip('/') + '/auth/tokens'
+
+ self.auth_url = auth_url
+
+ def auth(self, user=None, password=None, tenant=None, user_type='id',
+ domain=None, token=None):
+ """
+ :param user: user id or name, as specified in user_type
+ :param domain: the user and tenant domain
+ :param token: a token to re-scope.
+
+ Accepts different combinations of credentials. Restrictions:
+ - tenant and domain are only name (no id)
+ - user domain and tenant domain are assumed identical
+ - domain scope is not supported here
+ Sample sample valid combinations:
+ - token
+ - token, tenant, domain
+ - user_id, password
+ - username, password, domain
+ - username, password, tenant, domain
+ Validation is left to the server side.
+ """
+ creds = {
+ 'auth': {
+ 'identity': {
+ 'methods': [],
+ }
+ }
+ }
+ id_obj = creds['auth']['identity']
+ if token:
+ id_obj['methods'].append('token')
+ id_obj['token'] = {
+ 'id': token
+ }
+ if user and password:
+ id_obj['methods'].append('password')
+ id_obj['password'] = {
+ 'user': {
+ 'password': password,
+ }
+ }
+ if user_type == 'id':
+ id_obj['password']['user']['id'] = user
+ else:
+ id_obj['password']['user']['name'] = user
+ if domain is not None:
+ _domain = dict(name=domain)
+ id_obj['password']['user']['domain'] = _domain
+ if tenant is not None:
+ _domain = dict(name=domain)
+ project = dict(name=tenant, domain=_domain)
+ scope = dict(project=project)
+ creds['auth']['scope'] = scope
+
+ body = json.dumps(creds)
+ resp, body = self.post(self.auth_url, body=body)
+ self.expected_success(201, resp.status)
+ return service_client.ResponseBody(resp, body)
+
+ def request(self, method, url, extra_headers=False, headers=None,
+ body=None):
+ """A simple HTTP request interface."""
+ if headers is None:
+ # Always accept 'json', for xml token client too.
+ # Because XML response is not easily
+ # converted to the corresponding JSON one
+ headers = self.get_headers(accept_type="json")
+ elif extra_headers:
+ try:
+ headers.update(self.get_headers(accept_type="json"))
+ except (ValueError, TypeError):
+ headers = self.get_headers(accept_type="json")
+
+ resp, resp_body = self.raw_request(url, method,
+ headers=headers, body=body)
+ self._log_request(method, url, resp)
+
+ if resp.status in [401, 403]:
+ resp_body = json.loads(resp_body)
+ raise exceptions.Unauthorized(resp_body['error']['message'])
+ elif resp.status not in [200, 201, 204]:
+ raise exceptions.IdentityError(
+ 'Unexpected status code {0}'.format(resp.status))
+
+ return resp, json.loads(resp_body)
+
+ def get_token(self, user, password, tenant, domain='Default',
+ auth_data=False):
+ """
+ :param user: username
+ Returns (token id, token data) for supplied credentials
+ """
+ body = self.auth(user, password, tenant, user_type='name',
+ domain=domain)
+
+ token = body.response.get('x-subject-token')
+ if auth_data:
+ return token, body['token']
+ else:
+ return token
diff --git a/tempest/services/telemetry/json/telemetry_client.py b/tempest/services/telemetry/json/telemetry_client.py
index 2967cfa..dd899e4 100644
--- a/tempest/services/telemetry/json/telemetry_client.py
+++ b/tempest/services/telemetry/json/telemetry_client.py
@@ -45,8 +45,9 @@
uri = "%s/meters/%s" % (self.uri_prefix, meter_name)
body = self.serialize(sample_list)
resp, body = self.post(uri, body)
+ self.expected_success(200, resp.status)
body = self.deserialize(body)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def helper_list(self, uri, query=None, period=None):
uri_dict = {}
@@ -59,8 +60,9 @@
if uri_dict:
uri += "?%s" % urllib.urlencode(uri_dict)
resp, body = self.get(uri)
+ self.expected_success(200, resp.status)
body = self.deserialize(body)
- return resp, body
+ return service_client.ResponseBodyList(resp, body)
def list_resources(self, query=None):
uri = '%s/resources' % self.uri_prefix
@@ -85,39 +87,45 @@
def get_resource(self, resource_id):
uri = '%s/resources/%s' % (self.uri_prefix, resource_id)
resp, body = self.get(uri)
+ self.expected_success(200, resp.status)
body = self.deserialize(body)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def get_alarm(self, alarm_id):
uri = '%s/alarms/%s' % (self.uri_prefix, alarm_id)
resp, body = self.get(uri)
+ self.expected_success(200, resp.status)
body = self.deserialize(body)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def delete_alarm(self, alarm_id):
uri = "%s/alarms/%s" % (self.uri_prefix, alarm_id)
resp, body = self.delete(uri)
+ self.expected_success(204, resp.status)
if body:
body = self.deserialize(body)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def create_alarm(self, **kwargs):
uri = "%s/alarms" % self.uri_prefix
body = self.serialize(kwargs)
resp, body = self.post(uri, body)
+ self.expected_success(201, resp.status)
body = self.deserialize(body)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def update_alarm(self, alarm_id, **kwargs):
uri = "%s/alarms/%s" % (self.uri_prefix, alarm_id)
body = self.serialize(kwargs)
resp, body = self.put(uri, body)
+ self.expected_success(200, resp.status)
body = self.deserialize(body)
- return resp, body
+ return service_client.ResponseBody(resp, body)
def alarm_get_state(self, alarm_id):
uri = "%s/alarms/%s/state" % (self.uri_prefix, alarm_id)
resp, body = self.get(uri)
+ self.expected_success(200, resp.status)
body = self.deserialize(body)
return resp, body
@@ -125,5 +133,6 @@
uri = "%s/alarms/%s/state" % (self.uri_prefix, alarm_id)
body = self.serialize(state)
resp, body = self.put(uri, body)
+ self.expected_success(200, resp.status)
body = self.deserialize(body)
return resp, body
diff --git a/tempest/services/volume/json/admin/volume_hosts_client.py b/tempest/services/volume/json/admin/volume_hosts_client.py
index cf566f2..1cd92b7 100644
--- a/tempest/services/volume/json/admin/volume_hosts_client.py
+++ b/tempest/services/volume/json/admin/volume_hosts_client.py
@@ -17,10 +17,9 @@
import urllib
from tempest.common import service_client
-from tempest.services.volume.json import base
-class BaseVolumeHostsClientJSON(base.VolumeClient):
+class BaseVolumeHostsClientJSON(service_client.ServiceClient):
"""
Client class to send CRUD Volume Hosts API requests to a Cinder endpoint
"""
diff --git a/tempest/services/volume/json/admin/volume_quotas_client.py b/tempest/services/volume/json/admin/volume_quotas_client.py
index 88df69f..19d320f 100644
--- a/tempest/services/volume/json/admin/volume_quotas_client.py
+++ b/tempest/services/volume/json/admin/volume_quotas_client.py
@@ -18,10 +18,9 @@
from tempest.common import service_client
from tempest.openstack.common import jsonutils
-from tempest.services.volume.json import base
-class BaseVolumeQuotasClientJSON(base.VolumeClient):
+class BaseVolumeQuotasClientJSON(service_client.ServiceClient):
"""
Client class to send CRUD Volume Quotas API requests to a Cinder endpoint
"""
diff --git a/tempest/services/volume/json/admin/volume_services_client.py b/tempest/services/volume/json/admin/volume_services_client.py
index d258f3d..1c4433f 100644
--- a/tempest/services/volume/json/admin/volume_services_client.py
+++ b/tempest/services/volume/json/admin/volume_services_client.py
@@ -17,10 +17,9 @@
import urllib
from tempest.common import service_client
-from tempest.services.volume.json import base
-class BaseVolumesServicesClientJSON(base.VolumeClient):
+class BaseVolumesServicesClientJSON(service_client.ServiceClient):
def list_services(self, params=None):
url = 'os-services'
diff --git a/tempest/services/volume/json/admin/volume_types_client.py b/tempest/services/volume/json/admin/volume_types_client.py
index b3b4ae6..6049eb6 100644
--- a/tempest/services/volume/json/admin/volume_types_client.py
+++ b/tempest/services/volume/json/admin/volume_types_client.py
@@ -16,12 +16,13 @@
import json
import urllib
+from tempest_lib import exceptions as lib_exc
+
from tempest.common import service_client
from tempest import exceptions
-from tempest.services.volume.json import base
-class BaseVolumeTypesClientJSON(base.VolumeClient):
+class BaseVolumeTypesClientJSON(service_client.ServiceClient):
"""
Client class to send CRUD Volume Types API requests to a Cinder endpoint
"""
@@ -40,7 +41,7 @@
return True
else:
msg = (" resource value is either not defined or incorrect.")
- raise exceptions.UnprocessableEntity(msg)
+ raise lib_exc.UnprocessableEntity(msg)
except exceptions.NotFound:
return True
return False
diff --git a/tempest/services/volume/json/availability_zone_client.py b/tempest/services/volume/json/availability_zone_client.py
index 8a0257e..bb5e39b 100644
--- a/tempest/services/volume/json/availability_zone_client.py
+++ b/tempest/services/volume/json/availability_zone_client.py
@@ -16,10 +16,9 @@
import json
from tempest.common import service_client
-from tempest.services.volume.json import base
-class BaseVolumeAvailabilityZoneClientJSON(base.VolumeClient):
+class BaseVolumeAvailabilityZoneClientJSON(service_client.ServiceClient):
def get_availability_zone_list(self):
resp, body = self.get('os-availability-zone')
diff --git a/tempest/services/volume/json/backups_client.py b/tempest/services/volume/json/backups_client.py
index 102e823..dad5aff 100644
--- a/tempest/services/volume/json/backups_client.py
+++ b/tempest/services/volume/json/backups_client.py
@@ -18,10 +18,9 @@
from tempest.common import service_client
from tempest import exceptions
-from tempest.services.volume.json import base
-class BaseBackupsClientJSON(base.VolumeClient):
+class BaseBackupsClientJSON(service_client.ServiceClient):
"""
Client class to send CRUD Volume backup API requests to a Cinder endpoint
"""
diff --git a/tempest/services/volume/json/base.py b/tempest/services/volume/json/base.py
deleted file mode 100644
index e6c72eb..0000000
--- a/tempest/services/volume/json/base.py
+++ /dev/null
@@ -1,33 +0,0 @@
-# Copyright 2014 NEC Corporation. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-from tempest.common import service_client
-from tempest import config
-
-CONF = config.CONF
-
-
-class VolumeClient(service_client.ServiceClient):
- """
- Base volume client class
- """
-
- def __init__(self, auth_provider):
- super(VolumeClient, self).__init__(
- auth_provider,
- CONF.volume.catalog_type,
- CONF.volume.region or CONF.identity.region,
- endpoint_type=CONF.volume.endpoint_type,
- build_interval=CONF.volume.build_interval,
- build_timeout=CONF.volume.build_timeout)
diff --git a/tempest/services/volume/json/extensions_client.py b/tempest/services/volume/json/extensions_client.py
index ae79dad..8a7bce7 100644
--- a/tempest/services/volume/json/extensions_client.py
+++ b/tempest/services/volume/json/extensions_client.py
@@ -16,10 +16,9 @@
import json
from tempest.common import service_client
-from tempest.services.volume.json import base
-class BaseExtensionsClientJSON(base.VolumeClient):
+class BaseExtensionsClientJSON(service_client.ServiceClient):
def list_extensions(self):
url = 'extensions'
diff --git a/tempest/services/volume/json/qos_client.py b/tempest/services/volume/json/qos_client.py
index 32555eb..6aa56f7 100644
--- a/tempest/services/volume/json/qos_client.py
+++ b/tempest/services/volume/json/qos_client.py
@@ -15,12 +15,13 @@
import json
import time
+from tempest_lib import exceptions as lib_exc
+
from tempest.common import service_client
from tempest import exceptions
-from tempest.services.volume.json import base
-class BaseQosSpecsClientJSON(base.VolumeClient):
+class BaseQosSpecsClientJSON(service_client.ServiceClient):
"""Client class to send CRUD QoS API requests"""
def is_resource_deleted(self, qos_id):
@@ -60,7 +61,7 @@
return
else:
msg = (" operation value is either not defined or incorrect.")
- raise exceptions.UnprocessableEntity(msg)
+ raise lib_exc.UnprocessableEntity(msg)
if int(time.time()) - start_time >= self.build_timeout:
raise exceptions.TimeoutException
diff --git a/tempest/services/volume/json/snapshots_client.py b/tempest/services/volume/json/snapshots_client.py
index cd115df..100b34c 100644
--- a/tempest/services/volume/json/snapshots_client.py
+++ b/tempest/services/volume/json/snapshots_client.py
@@ -17,13 +17,12 @@
from tempest.common import service_client
from tempest import exceptions
from tempest.openstack.common import log as logging
-from tempest.services.volume.json import base
LOG = logging.getLogger(__name__)
-class BaseSnapshotsClientJSON(base.VolumeClient):
+class BaseSnapshotsClientJSON(service_client.ServiceClient):
"""Base Client class to send CRUD Volume API requests."""
create_resp = 200
diff --git a/tempest/services/volume/json/volumes_client.py b/tempest/services/volume/json/volumes_client.py
index c0f81fe..d834905 100644
--- a/tempest/services/volume/json/volumes_client.py
+++ b/tempest/services/volume/json/volumes_client.py
@@ -20,12 +20,11 @@
from tempest.common import service_client
from tempest import config
from tempest import exceptions
-from tempest.services.volume.json import base
CONF = config.CONF
-class BaseVolumesClientJSON(base.VolumeClient):
+class BaseVolumesClientJSON(service_client.ServiceClient):
"""
Base client class to send CRUD Volume API requests to a Cinder endpoint
"""
diff --git a/tempest/services/volume/v2/json/admin/volume_hosts_client.py b/tempest/services/volume/v2/json/admin/volume_hosts_client.py
index d631570..b93d031 100644
--- a/tempest/services/volume/v2/json/admin/volume_hosts_client.py
+++ b/tempest/services/volume/v2/json/admin/volume_hosts_client.py
@@ -21,8 +21,4 @@
"""
Client class to send CRUD Volume V2 API requests to a Cinder endpoint
"""
-
- def __init__(self, auth_provider):
- super(VolumeHostsV2ClientJSON, self).__init__(auth_provider)
-
- self.api_version = "v2"
+ api_version = "v2"
diff --git a/tempest/services/volume/v2/json/admin/volume_quotas_client.py b/tempest/services/volume/v2/json/admin/volume_quotas_client.py
index 64f4f33..1dc48cd 100644
--- a/tempest/services/volume/v2/json/admin/volume_quotas_client.py
+++ b/tempest/services/volume/v2/json/admin/volume_quotas_client.py
@@ -20,8 +20,4 @@
"""
Client class to send CRUD Volume V2 API requests to a Cinder endpoint
"""
-
- def __init__(self, auth_provider):
- super(VolumeQuotasV2Client, self).__init__(auth_provider)
-
- self.api_version = "v2"
+ api_version = "v2"
diff --git a/tempest/services/volume/v2/json/admin/volume_services_client.py b/tempest/services/volume/v2/json/admin/volume_services_client.py
index dc3c8ea..51224c5 100644
--- a/tempest/services/volume/v2/json/admin/volume_services_client.py
+++ b/tempest/services/volume/v2/json/admin/volume_services_client.py
@@ -20,7 +20,4 @@
"""
Client class to send CRUD Volume V2 API requests to a Cinder endpoint
"""
-
- def __init__(self, auth_provider):
- super(VolumesServicesV2ClientJSON, self).__init__(auth_provider)
- self.api_version = "v2"
+ api_version = "v2"
diff --git a/tempest/services/volume/v2/json/admin/volume_types_client.py b/tempest/services/volume/v2/json/admin/volume_types_client.py
index 76fa45d..24099b2 100644
--- a/tempest/services/volume/v2/json/admin/volume_types_client.py
+++ b/tempest/services/volume/v2/json/admin/volume_types_client.py
@@ -21,8 +21,4 @@
"""
Client class to send CRUD Volume V2 API requests to a Cinder endpoint
"""
-
- def __init__(self, auth_provider):
- super(VolumeTypesV2ClientJSON, self).__init__(auth_provider)
-
- self.api_version = "v2"
+ api_version = "v2"
diff --git a/tempest/services/volume/v2/json/availability_zone_client.py b/tempest/services/volume/v2/json/availability_zone_client.py
index 047ba1b..dc85634 100644
--- a/tempest/services/volume/v2/json/availability_zone_client.py
+++ b/tempest/services/volume/v2/json/availability_zone_client.py
@@ -18,9 +18,4 @@
class VolumeV2AvailabilityZoneClientJSON(
availability_zone_client.BaseVolumeAvailabilityZoneClientJSON):
-
- def __init__(self, auth_provider):
- super(VolumeV2AvailabilityZoneClientJSON, self).__init__(
- auth_provider)
-
- self.api_version = "v2"
+ api_version = "v2"
diff --git a/tempest/services/volume/v2/json/backups_client.py b/tempest/services/volume/v2/json/backups_client.py
index 9698075..30d9e8e 100644
--- a/tempest/services/volume/v2/json/backups_client.py
+++ b/tempest/services/volume/v2/json/backups_client.py
@@ -20,7 +20,4 @@
"""
Client class to send CRUD Volume V2 API requests to a Cinder endpoint
"""
-
- def __init__(self, auth_provider):
- super(BackupsClientV2JSON, self).__init__(auth_provider)
- self.api_version = "v2"
+ api_version = "v2"
diff --git a/tempest/services/volume/v2/json/extensions_client.py b/tempest/services/volume/v2/json/extensions_client.py
index cc5244c..8dda833 100644
--- a/tempest/services/volume/v2/json/extensions_client.py
+++ b/tempest/services/volume/v2/json/extensions_client.py
@@ -17,8 +17,4 @@
class ExtensionsV2ClientJSON(extensions_client.BaseExtensionsClientJSON):
-
- def __init__(self, auth_provider):
- super(ExtensionsV2ClientJSON, self).__init__(auth_provider)
-
- self.api_version = "v2"
+ api_version = "v2"
diff --git a/tempest/services/volume/v2/json/qos_client.py b/tempest/services/volume/v2/json/qos_client.py
index a734df8..d17da6d 100644
--- a/tempest/services/volume/v2/json/qos_client.py
+++ b/tempest/services/volume/v2/json/qos_client.py
@@ -16,8 +16,4 @@
class QosSpecsV2ClientJSON(qos_client.BaseQosSpecsClientJSON):
-
- def __init__(self, auth_provider):
- super(QosSpecsV2ClientJSON, self).__init__(auth_provider)
-
- self.api_version = "v2"
+ api_version = "v2"
diff --git a/tempest/services/volume/v2/json/snapshots_client.py b/tempest/services/volume/v2/json/snapshots_client.py
index 553176b..90580f9 100644
--- a/tempest/services/volume/v2/json/snapshots_client.py
+++ b/tempest/services/volume/v2/json/snapshots_client.py
@@ -15,9 +15,5 @@
class SnapshotsV2ClientJSON(snapshots_client.BaseSnapshotsClientJSON):
"""Client class to send CRUD Volume V2 API requests."""
-
- def __init__(self, auth_provider):
- super(SnapshotsV2ClientJSON, self).__init__(auth_provider)
-
- self.api_version = "v2"
- self.create_resp = 202
+ api_version = "v2"
+ create_resp = 202
diff --git a/tempest/services/volume/v2/json/volumes_client.py b/tempest/services/volume/v2/json/volumes_client.py
index ac4342e..85ffb91 100644
--- a/tempest/services/volume/v2/json/volumes_client.py
+++ b/tempest/services/volume/v2/json/volumes_client.py
@@ -20,9 +20,5 @@
"""
Client class to send CRUD Volume V2 API requests to a Cinder endpoint
"""
-
- def __init__(self, auth_provider):
- super(VolumesV2ClientJSON, self).__init__(auth_provider)
-
- self.api_version = "v2"
- self.create_resp = 202
+ api_version = "v2"
+ create_resp = 202
diff --git a/tempest/stress/actions/ssh_floating.py b/tempest/stress/actions/ssh_floating.py
index 5bc8cac..c473df6 100644
--- a/tempest/stress/actions/ssh_floating.py
+++ b/tempest/stress/actions/ssh_floating.py
@@ -92,8 +92,8 @@
sec_grp_cli = self.manager.security_groups_client
s_name = data_utils.rand_name('sec_grp-')
s_description = data_utils.rand_name('desc-')
- _, self.sec_grp = sec_grp_cli.create_security_group(s_name,
- s_description)
+ self.sec_grp = sec_grp_cli.create_security_group(s_name,
+ s_description)
create_rule = sec_grp_cli.create_security_group_rule
create_rule(self.sec_grp['id'], 'tcp', 22, 22)
create_rule(self.sec_grp['id'], 'icmp', -1, -1)
diff --git a/tempest/stress/actions/volume_attach_verify.py b/tempest/stress/actions/volume_attach_verify.py
index 43ba939..3c052ac 100644
--- a/tempest/stress/actions/volume_attach_verify.py
+++ b/tempest/stress/actions/volume_attach_verify.py
@@ -53,8 +53,8 @@
sec_grp_cli = self.manager.security_groups_client
s_name = data_utils.rand_name('sec_grp-')
s_description = data_utils.rand_name('desc-')
- _, self.sec_grp = sec_grp_cli.create_security_group(s_name,
- s_description)
+ self.sec_grp = sec_grp_cli.create_security_group(s_name,
+ s_description)
create_rule = sec_grp_cli.create_security_group_rule
create_rule(self.sec_grp['id'], 'tcp', 22, 22)
create_rule(self.sec_grp['id'], 'icmp', -1, -1)
diff --git a/tempest/stress/actions/volume_create_delete.py b/tempest/stress/actions/volume_create_delete.py
index b1c5bb7..93402d9 100644
--- a/tempest/stress/actions/volume_create_delete.py
+++ b/tempest/stress/actions/volume_create_delete.py
@@ -20,8 +20,8 @@
name = data_utils.rand_name("volume")
self.logger.info("creating %s" % name)
volumes_client = self.manager.volumes_client
- _, volume = volumes_client.create_volume(size=1,
- display_name=name)
+ volume = volumes_client.create_volume(size=1,
+ display_name=name)
vol_id = volume['id']
volumes_client.wait_for_volume_status(vol_id, 'available')
self.logger.info("created %s" % volume['id'])
diff --git a/tempest/stress/cleanup.py b/tempest/stress/cleanup.py
index b34ea56..b52eca9 100644
--- a/tempest/stress/cleanup.py
+++ b/tempest/stress/cleanup.py
@@ -46,7 +46,7 @@
pass
secgrp_client = admin_manager.security_groups_client
- _, secgrp = secgrp_client.list_security_groups({"all_tenants": True})
+ secgrp = secgrp_client.list_security_groups({"all_tenants": True})
secgrp_del = [grp for grp in secgrp if grp['name'] != 'default']
LOG.info("Cleanup::remove %s Security Group" % len(secgrp_del))
for g in secgrp_del:
diff --git a/tempest/tests/common/test_accounts.py b/tempest/tests/common/test_accounts.py
index 0800b47..f45f2cf 100644
--- a/tempest/tests/common/test_accounts.py
+++ b/tempest/tests/common/test_accounts.py
@@ -24,7 +24,7 @@
from tempest.common import accounts
from tempest import config
from tempest import exceptions
-from tempest.services.identity.json import identity_client
+from tempest.services.identity.json import token_client
from tempest.tests import base
from tempest.tests import fake_config
from tempest.tests import fake_identity
@@ -68,7 +68,7 @@
return hash_list
def test_get_hash(self):
- self.stubs.Set(identity_client.TokenClientJSON, 'raw_request',
+ self.stubs.Set(token_client.TokenClientJSON, 'raw_request',
fake_identity._fake_v2_response)
test_account_class = accounts.Accounts('test_name')
hash_list = self._get_hash_list(self.test_accounts)
diff --git a/tempest/tests/common/test_service_clients.py b/tempest/tests/common/test_service_clients.py
index 8a2782d..2b31d6b 100644
--- a/tempest/tests/common/test_service_clients.py
+++ b/tempest/tests/common/test_service_clients.py
@@ -41,7 +41,8 @@
from tempest.services.compute.json import servers_client
from tempest.services.compute.json import services_client
from tempest.services.compute.json import tenant_usages_client
-from tempest.services.compute.json import volumes_extensions_client
+from tempest.services.compute.json import volumes_extensions_client \
+ as compute_volumes_extensions_client
from tempest.services.database.json import flavors_client as db_flavor_client
from tempest.services.database.json import versions_client as db_version_client
from tempest.services.messaging.json import messaging_client
@@ -51,6 +52,37 @@
from tempest.services.object_storage import object_client
from tempest.services.orchestration.json import orchestration_client
from tempest.services.telemetry.json import telemetry_client
+from tempest.services.volume.json.admin import volume_hosts_client
+from tempest.services.volume.json.admin import volume_quotas_client
+from tempest.services.volume.json.admin import volume_services_client
+from tempest.services.volume.json.admin import volume_types_client
+from tempest.services.volume.json import availability_zone_client \
+ as volume_az_client
+from tempest.services.volume.json import backups_client
+from tempest.services.volume.json import extensions_client \
+ as volume_extensions_client
+from tempest.services.volume.json import qos_client
+from tempest.services.volume.json import snapshots_client
+from tempest.services.volume.json import volumes_client
+from tempest.services.volume.v2.json.admin import volume_hosts_client \
+ as volume_v2_hosts_client
+from tempest.services.volume.v2.json.admin import volume_quotas_client \
+ as volume_v2_quotas_client
+from tempest.services.volume.v2.json.admin import volume_services_client \
+ as volume_v2_services_client
+from tempest.services.volume.v2.json.admin import volume_types_client \
+ as volume_v2_types_client
+from tempest.services.volume.v2.json import availability_zone_client \
+ as volume_v2_az_client
+from tempest.services.volume.v2.json import backups_client \
+ as volume_v2_backups_client
+from tempest.services.volume.v2.json import extensions_client \
+ as volume_v2_extensions_client
+from tempest.services.volume.v2.json import qos_client as volume_v2_qos_client
+from tempest.services.volume.v2.json import snapshots_client \
+ as volume_v2_snapshots_client
+from tempest.services.volume.v2.json import volumes_client as \
+ volume_v2_volumes_client
from tempest.tests import base
@@ -84,7 +116,7 @@
servers_client.ServersClientJSON,
services_client.ServicesClientJSON,
tenant_usages_client.TenantUsagesClientJSON,
- volumes_extensions_client.VolumesExtensionsClientJSON,
+ compute_volumes_extensions_client.VolumesExtensionsClientJSON,
db_flavor_client.DatabaseFlavorsClientJSON,
db_version_client.DatabaseVersionsClientJSON,
messaging_client.MessagingClientJSON,
@@ -93,7 +125,28 @@
container_client.ContainerClient,
object_client.ObjectClient,
orchestration_client.OrchestrationClient,
- telemetry_client.TelemetryClientJSON]
+ telemetry_client.TelemetryClientJSON,
+ qos_client.QosSpecsClientJSON,
+ volume_hosts_client.VolumeHostsClientJSON,
+ volume_quotas_client.VolumeQuotasClientJSON,
+ volume_services_client.VolumesServicesClientJSON,
+ volume_types_client.VolumeTypesClientJSON,
+ volume_az_client.VolumeAvailabilityZoneClientJSON,
+ backups_client.BackupsClientJSON,
+ volume_extensions_client.ExtensionsClientJSON,
+ snapshots_client.SnapshotsClientJSON,
+ volumes_client.VolumesClientJSON,
+ volume_v2_hosts_client.VolumeHostsV2ClientJSON,
+ volume_v2_quotas_client.VolumeQuotasV2Client,
+ volume_v2_services_client.VolumesServicesV2ClientJSON,
+ volume_v2_types_client.VolumeTypesV2ClientJSON,
+ volume_v2_az_client.VolumeV2AvailabilityZoneClientJSON,
+ volume_v2_backups_client.BackupsClientV2JSON,
+ volume_v2_extensions_client.ExtensionsV2ClientJSON,
+ volume_v2_qos_client.QosSpecsV2ClientJSON,
+ volume_v2_snapshots_client.SnapshotsV2ClientJSON,
+ volume_v2_volumes_client.VolumesV2ClientJSON,
+ ]
for client in test_clients:
fake_string = six.text_type(random.randint(1, 0x7fffffff))
diff --git a/tempest/tests/test_auth.py b/tempest/tests/test_auth.py
index a191781..90bb8a7 100644
--- a/tempest/tests/test_auth.py
+++ b/tempest/tests/test_auth.py
@@ -21,8 +21,8 @@
from tempest import auth
from tempest import config
from tempest import exceptions
-from tempest.services.identity.json import identity_client as v2_client
-from tempest.services.identity.v3.json import identity_client as v3_client
+from tempest.services.identity.json import token_client as v2_client
+from tempest.services.identity.v3.json import token_client as v3_client
from tempest.tests import base
from tempest.tests import fake_config
from tempest.tests import fake_credentials
diff --git a/tempest/tests/test_credentials.py b/tempest/tests/test_credentials.py
index 1abb941..6e447d6 100644
--- a/tempest/tests/test_credentials.py
+++ b/tempest/tests/test_credentials.py
@@ -21,8 +21,8 @@
from tempest.common import tempest_fixtures as fixtures
from tempest import config
from tempest import exceptions
-from tempest.services.identity.json import identity_client as v2_client
-from tempest.services.identity.v3.json import identity_client as v3_client
+from tempest.services.identity.json import token_client as v2_client
+from tempest.services.identity.v3.json import token_client as v3_client
from tempest.tests import base
from tempest.tests import fake_config
from tempest.tests import fake_identity
diff --git a/tempest/tests/test_glance_http.py b/tempest/tests/test_glance_http.py
index c92a886..852dd4b 100644
--- a/tempest/tests/test_glance_http.py
+++ b/tempest/tests/test_glance_http.py
@@ -19,6 +19,7 @@
import mock
import six
+from tempest_lib import exceptions as lib_exc
from tempest.common import glance_http
from tempest import exceptions
@@ -57,18 +58,18 @@
def test_json_request_without_content_type_header_in_response(self):
self._set_response_fixture({}, 200, 'fake_response_body')
- self.assertRaises(exceptions.InvalidContentType,
+ self.assertRaises(lib_exc.InvalidContentType,
self.client.json_request, 'GET', '/images')
def test_json_request_with_xml_content_type_header_in_request(self):
- self.assertRaises(exceptions.InvalidContentType,
+ self.assertRaises(lib_exc.InvalidContentType,
self.client.json_request, 'GET', '/images',
headers={'Content-Type': 'application/xml'})
def test_json_request_with_xml_content_type_header_in_response(self):
self._set_response_fixture({'content-type': 'application/xml'},
200, 'fake_response_body')
- self.assertRaises(exceptions.InvalidContentType,
+ self.assertRaises(lib_exc.InvalidContentType,
self.client.json_request, 'GET', '/images')
def test_json_request_with_json_content_type_header_only_in_resp(self):
diff --git a/tempest/tests/test_tenant_isolation.py b/tempest/tests/test_tenant_isolation.py
index 58a8060..6c80496 100644
--- a/tempest/tests/test_tenant_isolation.py
+++ b/tempest/tests/test_tenant_isolation.py
@@ -21,6 +21,7 @@
from tempest import exceptions
from tempest.openstack.common.fixture import mockpatch
from tempest.services.identity.json import identity_client as json_iden_client
+from tempest.services.identity.json import token_client as json_token_client
from tempest.services.network.json import network_client as json_network_client
from tempest.tests import base
from tempest.tests import fake_config
@@ -35,7 +36,7 @@
self.useFixture(fake_config.ConfigFixture())
self.stubs.Set(config, 'TempestConfigPrivate', fake_config.FakePrivate)
self.fake_http = fake_http.fake_httplib2(return_type=200)
- self.stubs.Set(json_iden_client.TokenClientJSON, 'raw_request',
+ self.stubs.Set(json_token_client.TokenClientJSON, 'raw_request',
fake_identity._fake_v2_response)
cfg.CONF.set_default('operator_role', 'FakeRole',
group='object-storage')
diff --git a/tempest/thirdparty/boto/test.py b/tempest/thirdparty/boto/test.py
index 62073bd..edd9de1 100644
--- a/tempest/thirdparty/boto/test.py
+++ b/tempest/thirdparty/boto/test.py
@@ -79,7 +79,7 @@
except keystoneclient.exceptions.Unauthorized:
EC2_CAN_CONNECT_ERROR = "AWS credentials not set," +\
- " faild to get them even by keystoneclient"
+ " failed to get them even by keystoneclient"
except Exception as exc:
EC2_CAN_CONNECT_ERROR = str(exc)
@@ -96,7 +96,7 @@
S3_CAN_CONNECT_ERROR = str(exc)
except keystoneclient.exceptions.Unauthorized:
S3_CAN_CONNECT_ERROR = "AWS credentials not set," +\
- " faild to get them even by keystoneclient"
+ " failed to get them even by keystoneclient"
boto_logger.logger.setLevel(level)
return {'A_I_IMAGES_READY': A_I_IMAGES_READY,
'S3_CAN_CONNECT_ERROR': S3_CAN_CONNECT_ERROR,
@@ -195,6 +195,12 @@
"""Recommended to use as base class for boto related test."""
@classmethod
+ def skip_checks(cls):
+ super(BotoTestCase, cls).skip_checks()
+ if not CONF.compute_feature_enabled.ec2_api:
+ raise cls.skipException("The EC2 API is not available")
+
+ @classmethod
def resource_setup(cls):
super(BotoTestCase, cls).resource_setup()
cls.conclusion = decision_maker()