Merge "Add script to use tempest-lib files in tempest"
diff --git a/HACKING.rst b/HACKING.rst
index 9f7487d..0962f80 100644
--- a/HACKING.rst
+++ b/HACKING.rst
@@ -330,24 +330,25 @@
# The created server should be in the detailed list of all servers
...
-Tempest includes a ``check_uuid.py`` tool that will test for the existence
-and uniqueness of idempotent_id metadata for every test. By default the
-tool runs against the Tempest package by calling::
+Tempest-lib includes a ``check-uuid`` tool that will test for the existence
+and uniqueness of idempotent_id metadata for every test. If you have
+tempest-lib installed you run the tool against Tempest by calling from the
+tempest repo::
- python check_uuid.py
+ check-uuid
It can be invoked against any test suite by passing a package name::
- python check_uuid.py --package <package_name>
+ check-uuid --package <package_name>
Tests without an ``idempotent_id`` can be automatically fixed by running
the command with the ``--fix`` flag, which will modify the source package
by inserting randomly generated uuids for every test that does not have
one::
- python check_uuid.py --fix
+ check-uuid --fix
-The ``check_uuid.py`` tool is used as part of the tempest gate job
+The ``check-uuid`` tool is used as part of the tempest gate job
to ensure that all tests have an ``idempotent_id`` decorator.
Branchless Tempest Considerations
diff --git a/requirements.txt b/requirements.txt
index ffe6f26..17d063d 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -2,7 +2,7 @@
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
pbr>=1.6
-cliff>=1.14.0 # Apache-2.0
+cliff>=1.15.0 # Apache-2.0
anyjson>=0.3.3
httplib2>=0.7.5
jsonschema!=2.5.0,<3.0.0,>=2.0.0
diff --git a/run_tempest.sh b/run_tempest.sh
index 0f32045..a704684 100755
--- a/run_tempest.sh
+++ b/run_tempest.sh
@@ -104,9 +104,9 @@
fi
if [ $serial -eq 1 ]; then
- ${wrapper} testr run --subunit $testrargs | ${wrapper} subunit-2to1 | ${wrapper} tools/colorizer.py
+ ${wrapper} testr run --subunit $testrargs | ${wrapper} subunit-trace -n -f
else
- ${wrapper} testr run --parallel --subunit $testrargs | ${wrapper} subunit-2to1 | ${wrapper} tools/colorizer.py
+ ${wrapper} testr run --parallel --subunit $testrargs | ${wrapper} subunit-trace -n -f
fi
}
diff --git a/run_tests.sh b/run_tests.sh
index 9a158e4..908056f 100755
--- a/run_tests.sh
+++ b/run_tests.sh
@@ -90,9 +90,9 @@
fi
if [ $serial -eq 1 ]; then
- ${wrapper} testr run --subunit $testrargs | ${wrapper} subunit-2to1 | ${wrapper} tools/colorizer.py
+ ${wrapper} testr run --subunit $testrargs | ${wrapper} subunit-trace -n -f
else
- ${wrapper} testr run --parallel --subunit $testrargs | ${wrapper} subunit-2to1 | ${wrapper} tools/colorizer.py
+ ${wrapper} testr run --parallel --subunit $testrargs | ${wrapper} subunit-trace -n -f
fi
}
diff --git a/tempest/api/compute/admin/test_servers.py b/tempest/api/compute/admin/test_servers.py
index 993d39e..b038c6b 100644
--- a/tempest/api/compute/admin/test_servers.py
+++ b/tempest/api/compute/admin/test_servers.py
@@ -147,7 +147,7 @@
@test.idempotent_id('31ff3486-b8a0-4f56-a6c0-aab460531db3')
def test_get_server_diagnostics_by_admin(self):
# Retrieve server diagnostics by admin user
- diagnostic = self.client.get_server_diagnostics(self.s1_id)
+ diagnostic = self.client.show_server_diagnostics(self.s1_id)
basic_attrs = ['rx_packets', 'rx_errors', 'rx_drop',
'tx_packets', 'tx_errors', 'tx_drop',
'read_req', 'write_req', 'cpu', 'memory']
diff --git a/tempest/api/compute/admin/test_servers_negative.py b/tempest/api/compute/admin/test_servers_negative.py
index 3d0ce35..7c5e8d0 100644
--- a/tempest/api/compute/admin/test_servers_negative.py
+++ b/tempest/api/compute/admin/test_servers_negative.py
@@ -130,7 +130,7 @@
def test_get_server_diagnostics_by_non_admin(self):
# Non-admin user can not view server diagnostics according to policy
self.assertRaises(lib_exc.Forbidden,
- self.non_adm_client.get_server_diagnostics,
+ self.non_adm_client.show_server_diagnostics,
self.s1_id)
@test.attr(type=['negative'])
diff --git a/tempest/api/compute/servers/test_instance_actions.py b/tempest/api/compute/servers/test_instance_actions.py
index 97d47fd..814aec7 100644
--- a/tempest/api/compute/servers/test_instance_actions.py
+++ b/tempest/api/compute/servers/test_instance_actions.py
@@ -47,7 +47,7 @@
@test.idempotent_id('aacc71ca-1d70-4aa5-bbf6-0ff71470e43c')
def test_get_instance_action(self):
# Get the action details of the provided server
- body = self.client.get_instance_action(
+ body = self.client.show_instance_action(
self.server_id, self.request_id)['instanceAction']
self.assertEqual(self.server_id, body['instance_uuid'])
self.assertEqual('create', body['action'])
diff --git a/tempest/api/compute/servers/test_instance_actions_negative.py b/tempest/api/compute/servers/test_instance_actions_negative.py
index 6567da1..ac66d05 100644
--- a/tempest/api/compute/servers/test_instance_actions_negative.py
+++ b/tempest/api/compute/servers/test_instance_actions_negative.py
@@ -46,5 +46,5 @@
@test.idempotent_id('0269f40a-6f18-456c-b336-c03623c897f1')
def test_get_instance_action_invalid_request(self):
# Get the action details of the provided server with invalid request
- self.assertRaises(lib_exc.NotFound, self.client.get_instance_action,
+ self.assertRaises(lib_exc.NotFound, self.client.show_instance_action,
self.server_id, '999')
diff --git a/tempest/api/compute/servers/test_server_metadata.py b/tempest/api/compute/servers/test_server_metadata.py
index 77ddb3b..9c07677 100644
--- a/tempest/api/compute/servers/test_server_metadata.py
+++ b/tempest/api/compute/servers/test_server_metadata.py
@@ -87,8 +87,8 @@
@test.idempotent_id('3043c57d-7e0e-49a6-9a96-ad569c265e6a')
def test_get_server_metadata_item(self):
# The value for a specific metadata key should be returned
- meta = self.client.get_server_metadata_item(self.server_id,
- 'key2')['meta']
+ meta = self.client.show_server_metadata_item(self.server_id,
+ 'key2')['meta']
self.assertEqual('value2', meta['key2'])
@test.idempotent_id('58c02d4f-5c67-40be-8744-d3fa5982eb1c')
diff --git a/tempest/api/compute/servers/test_server_metadata_negative.py b/tempest/api/compute/servers/test_server_metadata_negative.py
index cee60fb..18d80be 100644
--- a/tempest/api/compute/servers/test_server_metadata_negative.py
+++ b/tempest/api/compute/servers/test_server_metadata_negative.py
@@ -67,7 +67,7 @@
# GET on a non-existent server should not succeed
non_existent_server_id = data_utils.rand_uuid()
self.assertRaises(lib_exc.NotFound,
- self.client.get_server_metadata_item,
+ self.client.show_server_metadata_item,
non_existent_server_id,
'test2')
diff --git a/tempest/api/compute/servers/test_server_password.py b/tempest/api/compute/servers/test_server_password.py
index 35c2cfd..9b41708 100644
--- a/tempest/api/compute/servers/test_server_password.py
+++ b/tempest/api/compute/servers/test_server_password.py
@@ -32,7 +32,7 @@
@test.idempotent_id('f83b582f-62a8-4f22-85b0-0dee50ff783a')
def test_get_server_password(self):
- self.client.get_password(self.server['id'])
+ self.client.show_password(self.server['id'])
@test.idempotent_id('f8229e8b-b625-4493-800a-bde86ac611ea')
def test_delete_server_password(self):
diff --git a/tempest/api/compute/servers/test_servers.py b/tempest/api/compute/servers/test_servers.py
index d2fb652..8e2fbf1 100644
--- a/tempest/api/compute/servers/test_servers.py
+++ b/tempest/api/compute/servers/test_servers.py
@@ -71,9 +71,10 @@
server = self.client.show_server(server['id'])['server']
self.assertEqual(key_name, server['key_name'])
- def _update_server_name(self, server_id, status):
+ def _update_server_name(self, server_id, status, prefix_name='server'):
# The server name should be changed to the the provided value
- new_name = data_utils.rand_name('server')
+ new_name = data_utils.rand_name(prefix_name)
+
# Update the server with a new name
self.client.update_server(server_id,
name=new_name)
@@ -88,8 +89,9 @@
def test_update_server_name(self):
# The server name should be changed to the the provided value
server = self.create_test_server(wait_until='ACTIVE')
-
- self._update_server_name(server['id'], 'ACTIVE')
+ # Update instance name with non-ASCII characters
+ prefix_name = u'\u00CD\u00F1st\u00E1\u00F1c\u00E9'
+ self._update_server_name(server['id'], 'ACTIVE', prefix_name)
@test.idempotent_id('6ac19cb1-27a3-40ec-b350-810bdc04c08e')
def test_update_server_name_in_stop_state(self):
@@ -97,7 +99,11 @@
server = self.create_test_server(wait_until='ACTIVE')
self.client.stop_server(server['id'])
waiters.wait_for_server_status(self.client, server['id'], 'SHUTOFF')
- updated_server = self._update_server_name(server['id'], 'SHUTOFF')
+ # Update instance name with non-ASCII characters
+ prefix_name = u'\u00CD\u00F1st\u00E1\u00F1c\u00E9'
+ updated_server = self._update_server_name(server['id'],
+ 'SHUTOFF',
+ prefix_name)
self.assertNotIn('progress', updated_server)
@test.idempotent_id('89b90870-bc13-4b73-96af-f9d4f2b70077')
diff --git a/tempest/api/compute/test_authorization.py b/tempest/api/compute/test_authorization.py
index f8d0cca..436ed2f 100644
--- a/tempest/api/compute/test_authorization.py
+++ b/tempest/api/compute/test_authorization.py
@@ -400,7 +400,7 @@
self.addCleanup(self.client.delete_server_metadata_item,
self.server['id'], 'meta1')
self.assertRaises(lib_exc.NotFound,
- self.alt_client.get_server_metadata_item,
+ self.alt_client.show_server_metadata_item,
self.server['id'], 'meta1')
@test.idempotent_id('16b2d724-0d3b-4216-a9fa-97bd4d9cf670')
diff --git a/tempest/api/compute/volumes/test_attach_volume.py b/tempest/api/compute/volumes/test_attach_volume.py
index ab4ddf7..b4837f7 100644
--- a/tempest/api/compute/volumes/test_attach_volume.py
+++ b/tempest/api/compute/volumes/test_attach_volume.py
@@ -144,7 +144,7 @@
self.assertIn(self.attachment, body)
# Get Volume attachment of the server
- body = self.servers_client.get_volume_attachment(
+ body = self.servers_client.show_volume_attachment(
self.server['id'],
self.attachment['id'])['volumeAttachment']
self.assertEqual(self.server['id'], body['serverId'])
diff --git a/tempest/api/identity/admin/v2/test_roles.py b/tempest/api/identity/admin/v2/test_roles.py
index 657d72e..8702db7 100644
--- a/tempest/api/identity/admin/v2/test_roles.py
+++ b/tempest/api/identity/admin/v2/test_roles.py
@@ -95,7 +95,7 @@
user_role = self.client.assign_user_role(tenant['id'],
user['id'],
role['id'])['role']
- self.client.remove_user_role(tenant['id'], user['id'],
+ self.client.delete_user_role(tenant['id'], user['id'],
user_role['id'])
@test.idempotent_id('262e1e3e-ed71-4edd-a0e5-d64e83d66d05')
diff --git a/tempest/api/identity/admin/v2/test_roles_negative.py b/tempest/api/identity/admin/v2/test_roles_negative.py
index 5932aba..45c95df 100644
--- a/tempest/api/identity/admin/v2/test_roles_negative.py
+++ b/tempest/api/identity/admin/v2/test_roles_negative.py
@@ -177,7 +177,7 @@
user['id'],
role['id'])
self.assertRaises(lib_exc.Forbidden,
- self.non_admin_client.remove_user_role,
+ self.non_admin_client.delete_user_role,
tenant['id'], user['id'], role['id'])
@test.attr(type=['negative'])
@@ -191,7 +191,7 @@
token = self.client.auth_provider.get_token()
self.client.delete_token(token)
self.assertRaises(lib_exc.Unauthorized,
- self.client.remove_user_role, tenant['id'],
+ self.client.delete_user_role, tenant['id'],
user['id'], role['id'])
self.client.auth_provider.clear_auth()
@@ -204,7 +204,7 @@
user['id'],
role['id'])
non_existent_role = str(uuid.uuid4().hex)
- self.assertRaises(lib_exc.NotFound, self.client.remove_user_role,
+ self.assertRaises(lib_exc.NotFound, self.client.delete_user_role,
tenant['id'], user['id'], non_existent_role)
@test.attr(type=['negative'])
@@ -216,7 +216,7 @@
user['id'],
role['id'])
non_existent_tenant = str(uuid.uuid4().hex)
- self.assertRaises(lib_exc.NotFound, self.client.remove_user_role,
+ self.assertRaises(lib_exc.NotFound, self.client.delete_user_role,
non_existent_tenant, user['id'], role['id'])
@test.attr(type=['negative'])
diff --git a/tempest/api/identity/admin/v3/test_groups.py b/tempest/api/identity/admin/v3/test_groups.py
index d5af4b4..260ea54 100644
--- a/tempest/api/identity/admin/v3/test_groups.py
+++ b/tempest/api/identity/admin/v3/test_groups.py
@@ -25,7 +25,7 @@
name = data_utils.rand_name('Group')
description = data_utils.rand_name('Description')
group = self.groups_client.create_group(
- name, description=description)['group']
+ name=name, description=description)['group']
self.addCleanup(self.groups_client.delete_group, group['id'])
self.assertEqual(group['name'], name)
self.assertEqual(group['description'], description)
@@ -37,16 +37,31 @@
self.assertEqual(updated_group['name'], new_name)
self.assertEqual(updated_group['description'], new_desc)
- new_group = self.groups_client.get_group(group['id'])['group']
+ new_group = self.groups_client.show_group(group['id'])['group']
self.assertEqual(group['id'], new_group['id'])
self.assertEqual(new_name, new_group['name'])
self.assertEqual(new_desc, new_group['description'])
+ @test.idempotent_id('b66eb441-b08a-4a6d-81ab-fef71baeb26c')
+ def test_group_update_with_few_fields(self):
+ name = data_utils.rand_name('Group')
+ old_description = data_utils.rand_name('Description')
+ group = self.groups_client.create_group(
+ name=name, description=old_description)['group']
+ self.addCleanup(self.groups_client.delete_group, group['id'])
+
+ new_name = data_utils.rand_name('UpdateGroup')
+ updated_group = self.groups_client.update_group(
+ group['id'], name=new_name)['group']
+ self.assertEqual(new_name, updated_group['name'])
+ # Verify that 'description' is not being updated or deleted.
+ self.assertEqual(old_description, updated_group['description'])
+
@test.attr(type='smoke')
@test.idempotent_id('1598521a-2f36-4606-8df9-30772bd51339')
def test_group_users_add_list_delete(self):
name = data_utils.rand_name('Group')
- group = self.groups_client.create_group(name)['group']
+ group = self.groups_client.create_group(name=name)['group']
self.addCleanup(self.groups_client.delete_group, group['id'])
# add user into group
users = []
@@ -77,7 +92,7 @@
groups = []
for i in range(2):
name = data_utils.rand_name('Group')
- group = self.groups_client.create_group(name)['group']
+ group = self.groups_client.create_group(name=name)['group']
groups.append(group)
self.addCleanup(self.groups_client.delete_group, group['id'])
self.groups_client.add_group_user(group['id'], user['id'])
@@ -95,7 +110,7 @@
name = data_utils.rand_name('Group')
description = data_utils.rand_name('Description')
group = self.groups_client.create_group(
- name, description=description)['group']
+ name=name, description=description)['group']
self.addCleanup(self.groups_client.delete_group, group['id'])
group_ids.append(group['id'])
# List and Verify Groups
diff --git a/tempest/api/identity/admin/v3/test_roles.py b/tempest/api/identity/admin/v3/test_roles.py
index 524340c..3be2643 100644
--- a/tempest/api/identity/admin/v3/test_roles.py
+++ b/tempest/api/identity/admin/v3/test_roles.py
@@ -40,7 +40,7 @@
description=data_utils.rand_name('project-desc'),
domain_id=cls.domain['id'])['project']
cls.group_body = cls.groups_client.create_group(
- data_utils.rand_name('Group'), project_id=cls.project['id'],
+ name=data_utils.rand_name('Group'), project_id=cls.project['id'],
domain_id=cls.domain['id'])['group']
cls.user_body = cls.client.create_user(
u_name, description=u_desc, password=cls.u_password,
@@ -102,7 +102,7 @@
self._list_assertions(roles, self.fetched_role_ids,
self.role['id'])
- self.client.revoke_role_from_user_on_project(
+ self.client.delete_role_from_user_on_project(
self.project['id'], self.user_body['id'], self.role['id'])
@test.idempotent_id('6c9a2940-3625-43a3-ac02-5dcec62ef3bd')
@@ -119,7 +119,7 @@
self._list_assertions(roles, self.fetched_role_ids,
self.role['id'])
- self.client.revoke_role_from_user_on_domain(
+ self.client.delete_role_from_user_on_domain(
self.domain['id'], self.user_body['id'], self.role['id'])
@test.idempotent_id('cbf11737-1904-4690-9613-97bcbb3df1c4')
@@ -150,7 +150,7 @@
self.assertEqual(len(roles), 1)
self.assertEqual(roles[0]['id'], self.role['id'])
# Revoke role to group on project
- self.client.revoke_role_from_group_on_project(
+ self.client.delete_role_from_group_on_project(
self.project['id'], self.group_body['id'], self.role['id'])
@test.idempotent_id('4bf8a70b-e785-413a-ad53-9f91ce02faa7')
@@ -167,7 +167,7 @@
self._list_assertions(roles, self.fetched_role_ids,
self.role['id'])
- self.client.revoke_role_from_group_on_domain(
+ self.client.delete_role_from_group_on_domain(
self.domain['id'], self.group_body['id'], self.role['id'])
@test.idempotent_id('f5654bcc-08c4-4f71-88fe-05d64e06de94')
diff --git a/tempest/api/identity/admin/v3/test_users_negative.py b/tempest/api/identity/admin/v3/test_users_negative.py
new file mode 100644
index 0000000..d40a5b9
--- /dev/null
+++ b/tempest/api/identity/admin/v3/test_users_negative.py
@@ -0,0 +1,46 @@
+# Copyright 2015 OpenStack Foundation
+# 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_lib import exceptions as lib_exc
+
+from tempest.api.identity import base
+from tempest.common.utils import data_utils
+from tempest import test
+
+
+class UsersNegativeTest(base.BaseIdentityV3AdminTest):
+
+ @test.attr(type=['negative'])
+ @test.idempotent_id('e75f006c-89cc-477b-874d-588e4eab4b17')
+ def test_create_user_for_non_existent_domain(self):
+ # Attempt to create a user in a non-existent domain should fail
+ u_name = data_utils.rand_name('user')
+ u_email = u_name + '@testmail.tm'
+ u_password = data_utils.rand_name('pass')
+ self.assertRaises(lib_exc.NotFound, self.client.create_user,
+ u_name, u_password,
+ email=u_email,
+ domain_id=data_utils.rand_uuid_hex())
+
+ @test.attr(type=['negative'])
+ @test.idempotent_id('b3c9fccc-4134-46f5-b600-1da6fb0a3b1f')
+ def test_authentication_for_disabled_user(self):
+ # Attempt to authenticate for disabled user should fail
+ self.data.setup_test_v3_user()
+ self.disable_user(self.data.test_user)
+ self.assertRaises(lib_exc.Unauthorized, self.token.auth,
+ username=self.data.test_user,
+ password=self.data.test_password,
+ user_domain_id='default')
diff --git a/tempest/api/identity/base.py b/tempest/api/identity/base.py
index c56f4fb..0364f3a 100644
--- a/tempest/api/identity/base.py
+++ b/tempest/api/identity/base.py
@@ -170,6 +170,11 @@
if len(role) > 0:
return role[0]
+ @classmethod
+ def disable_user(cls, user_name):
+ user = cls.get_user_by_name(user_name)
+ cls.client.update_user(user['id'], user_name, enabled=False)
+
def delete_domain(self, domain_id):
# NOTE(mpavlase) It is necessary to disable the domain before deleting
# otherwise it raises Forbidden exception
diff --git a/tempest/api/identity/v2/test_users.py b/tempest/api/identity/v2/test_users.py
index 50aaa25..03c6621 100644
--- a/tempest/api/identity/v2/test_users.py
+++ b/tempest/api/identity/v2/test_users.py
@@ -55,6 +55,10 @@
new_pass=old_pass,
old_pass=new_pass)
+ # user updates own password
+ resp = self.non_admin_client.update_user_own_password(
+ user_id=user_id, new_pass=new_pass, old_pass=old_pass)['access']
+
# TODO(lbragstad): Sleeping after the response status has been checked
# and the body loaded as JSON allows requests to fail-fast. The sleep
# is necessary because keystone will err on the side of security and
@@ -64,10 +68,6 @@
# sub-second precision.
time.sleep(1)
- # user updates own password
- resp = self.non_admin_client.update_user_own_password(
- user_id=user_id, new_pass=new_pass, old_pass=old_pass)['access']
-
# check authorization with new token
self.non_admin_token_client.auth_token(resp['token']['id'])
# check authorization with new password
diff --git a/tempest/api/identity/v3/test_users.py b/tempest/api/identity/v3/test_users.py
index 14a866f..2bab5d1 100644
--- a/tempest/api/identity/v3/test_users.py
+++ b/tempest/api/identity/v3/test_users.py
@@ -54,6 +54,10 @@
password=old_pass,
original_password=new_pass)
+ # user updates own password
+ self.non_admin_client.update_user_password(
+ user_id=user_id, password=new_pass, original_password=old_pass)
+
# TODO(lbragstad): Sleeping after the response status has been checked
# and the body loaded as JSON allows requests to fail-fast. The sleep
# is necessary because keystone will err on the side of security and
@@ -63,10 +67,6 @@
# sub-second precision.
time.sleep(1)
- # user updates own password
- self.non_admin_client.update_user_password(
- user_id=user_id, password=new_pass, original_password=old_pass)
-
# check authorization with new password
self.non_admin_token.auth(user_id=self.user_id, password=new_pass)
diff --git a/tempest/api/image/admin/v2/test_images.py b/tempest/api/image/admin/v2/test_images.py
index 01838b6..b171da3 100644
--- a/tempest/api/image/admin/v2/test_images.py
+++ b/tempest/api/image/admin/v2/test_images.py
@@ -49,12 +49,12 @@
body = self.client.show_image(image_id)
self.assertEqual("deactivated", body['status'])
# non-admin user unable to download deactivated image
- self.assertRaises(lib_exc.Forbidden, self.client.load_image_file,
+ self.assertRaises(lib_exc.Forbidden, self.client.show_image_file,
image_id)
# reactivate image
self.admin_client.reactivate_image(image_id)
body = self.client.show_image(image_id)
self.assertEqual("active", body['status'])
# non-admin user able to download image after reactivation by admin
- body = self.client.load_image_file(image_id)
+ body = self.client.show_image_file(image_id)
self.assertEqual(content, body.data)
diff --git a/tempest/api/image/v2/test_images.py b/tempest/api/image/v2/test_images.py
index 936eadf..2e6c268 100644
--- a/tempest/api/image/v2/test_images.py
+++ b/tempest/api/image/v2/test_images.py
@@ -72,7 +72,7 @@
self.assertEqual(1024, body.get('size'))
# Now try get image file
- body = self.client.load_image_file(image_id)
+ body = self.client.show_image_file(image_id)
self.assertEqual(file_content, body.data)
@test.attr(type='smoke')
diff --git a/tempest/api/image/v2/test_images_member.py b/tempest/api/image/v2/test_images_member.py
index d89803d..98ff64b 100644
--- a/tempest/api/image/v2/test_images_member.py
+++ b/tempest/api/image/v2/test_images_member.py
@@ -20,14 +20,14 @@
def test_image_share_accept(self):
image_id = self._create_image()
member = self.os_img_client.add_image_member(image_id,
- self.alt_tenant_id)
+ member=self.alt_tenant_id)
self.assertEqual(member['member_id'], self.alt_tenant_id)
self.assertEqual(member['image_id'], image_id)
self.assertEqual(member['status'], 'pending')
self.assertNotIn(image_id, self._list_image_ids_as_alt())
self.alt_img_client.update_image_member(image_id,
self.alt_tenant_id,
- {'status': 'accepted'})
+ status='accepted')
self.assertIn(image_id, self._list_image_ids_as_alt())
body = self.os_img_client.list_image_members(image_id)
members = body['members']
@@ -41,24 +41,24 @@
def test_image_share_reject(self):
image_id = self._create_image()
member = self.os_img_client.add_image_member(image_id,
- self.alt_tenant_id)
+ member=self.alt_tenant_id)
self.assertEqual(member['member_id'], self.alt_tenant_id)
self.assertEqual(member['image_id'], image_id)
self.assertEqual(member['status'], 'pending')
self.assertNotIn(image_id, self._list_image_ids_as_alt())
self.alt_img_client.update_image_member(image_id,
self.alt_tenant_id,
- {'status': 'rejected'})
+ status='rejected')
self.assertNotIn(image_id, self._list_image_ids_as_alt())
@test.idempotent_id('a6ee18b9-4378-465e-9ad9-9a6de58a3287')
def test_get_image_member(self):
image_id = self._create_image()
self.os_img_client.add_image_member(image_id,
- self.alt_tenant_id)
+ member=self.alt_tenant_id)
self.alt_img_client.update_image_member(image_id,
self.alt_tenant_id,
- {'status': 'accepted'})
+ status='accepted')
self.assertIn(image_id, self._list_image_ids_as_alt())
member = self.os_img_client.show_image_member(image_id,
@@ -71,13 +71,13 @@
def test_remove_image_member(self):
image_id = self._create_image()
self.os_img_client.add_image_member(image_id,
- self.alt_tenant_id)
+ member=self.alt_tenant_id)
self.alt_img_client.update_image_member(image_id,
self.alt_tenant_id,
- {'status': 'accepted'})
+ status='accepted')
self.assertIn(image_id, self._list_image_ids_as_alt())
- self.os_img_client.remove_image_member(image_id, self.alt_tenant_id)
+ self.os_img_client.delete_image_member(image_id, self.alt_tenant_id)
self.assertNotIn(image_id, self._list_image_ids_as_alt())
@test.idempotent_id('634dcc3f-f6e2-4409-b8fd-354a0bb25d83')
@@ -94,14 +94,14 @@
def test_get_private_image(self):
image_id = self._create_image()
member = self.os_img_client.add_image_member(image_id,
- self.alt_tenant_id)
+ member=self.alt_tenant_id)
self.assertEqual(member['member_id'], self.alt_tenant_id)
self.assertEqual(member['image_id'], image_id)
self.assertEqual(member['status'], 'pending')
self.assertNotIn(image_id, self._list_image_ids_as_alt())
self.alt_img_client.update_image_member(image_id,
self.alt_tenant_id,
- {'status': 'accepted'})
+ status='accepted')
self.assertIn(image_id, self._list_image_ids_as_alt())
- self.os_img_client.remove_image_member(image_id, self.alt_tenant_id)
+ self.os_img_client.delete_image_member(image_id, self.alt_tenant_id)
self.assertNotIn(image_id, self._list_image_ids_as_alt())
diff --git a/tempest/api/image/v2/test_images_member_negative.py b/tempest/api/image/v2/test_images_member_negative.py
index ae8913c..d5ea291 100644
--- a/tempest/api/image/v2/test_images_member_negative.py
+++ b/tempest/api/image/v2/test_images_member_negative.py
@@ -23,22 +23,22 @@
def test_image_share_invalid_status(self):
image_id = self._create_image()
member = self.os_img_client.add_image_member(image_id,
- self.alt_tenant_id)
+ member=self.alt_tenant_id)
self.assertEqual(member['status'], 'pending')
self.assertRaises(lib_exc.BadRequest,
self.alt_img_client.update_image_member,
image_id, self.alt_tenant_id,
- {'status': 'notavalidstatus'})
+ status='notavalidstatus')
@test.attr(type=['negative'])
@test.idempotent_id('27002f74-109e-4a37-acd0-f91cd4597967')
def test_image_share_owner_cannot_accept(self):
image_id = self._create_image()
member = self.os_img_client.add_image_member(image_id,
- self.alt_tenant_id)
+ member=self.alt_tenant_id)
self.assertEqual(member['status'], 'pending')
self.assertNotIn(image_id, self._list_image_ids_as_alt())
self.assertRaises(lib_exc.Forbidden,
self.os_img_client.update_image_member,
- image_id, self.alt_tenant_id, {'status': 'accepted'})
+ image_id, self.alt_tenant_id, status='accepted')
self.assertNotIn(image_id, self._list_image_ids_as_alt())
diff --git a/tempest/api/image/v2/test_images_metadefs_namespaces.py b/tempest/api/image/v2/test_images_metadefs_namespaces.py
index d089c84..efb7b8b 100644
--- a/tempest/api/image/v2/test_images_metadefs_namespaces.py
+++ b/tempest/api/image/v2/test_images_metadefs_namespaces.py
@@ -29,42 +29,42 @@
resource_name = body['resource_types'][0]['name']
name = [{'name': resource_name}]
namespace_name = data_utils.rand_name('namespace')
- # create the metadef namespaces
- body = self.client.create_namespaces(namespace=namespace_name,
- visibility='public',
- description='Tempest',
- display_name=namespace_name,
- resource_type_associations=name,
- protected=True)
+ # create the metadef namespace
+ body = self.client.create_namespace(namespace=namespace_name,
+ visibility='public',
+ description='Tempest',
+ display_name=namespace_name,
+ resource_type_associations=name,
+ protected=True)
self.addCleanup(self._cleanup_namespace, namespace_name)
- # get namespaces details
- body = self.client.show_namespaces(namespace_name)
+ # get namespace details
+ body = self.client.show_namespace(namespace_name)
self.assertEqual(namespace_name, body['namespace'])
self.assertEqual('public', body['visibility'])
# unable to delete protected namespace
- self.assertRaises(lib_exc.Forbidden, self.client.delete_namespaces,
+ self.assertRaises(lib_exc.Forbidden, self.client.delete_namespace,
namespace_name)
# update the visibility to private and protected to False
- body = self.client.update_namespaces(namespace=namespace_name,
- description='Tempest',
- visibility='private',
- display_name=namespace_name,
- protected=False)
+ body = self.client.update_namespace(namespace=namespace_name,
+ description='Tempest',
+ visibility='private',
+ display_name=namespace_name,
+ protected=False)
self.assertEqual('private', body['visibility'])
self.assertEqual(False, body['protected'])
# now able to delete the non-protected namespace
- self.client.delete_namespaces(namespace_name)
+ self.client.delete_namespace(namespace_name)
def _cleanup_namespace(self, namespace_name):
# this is used to cleanup the resources
try:
- body = self.client.show_namespaces(namespace_name)
+ body = self.client.show_namespace(namespace_name)
self.assertEqual(namespace_name, body['namespace'])
- body = self.client.update_namespaces(namespace=namespace_name,
- description='Tempest',
- visibility='private',
- display_name=namespace_name,
- protected=False)
- self.client.delete_namespaces(namespace_name)
+ body = self.client.update_namespace(namespace=namespace_name,
+ description='Tempest',
+ visibility='private',
+ display_name=namespace_name,
+ protected=False)
+ self.client.delete_namespace(namespace_name)
except lib_exc.NotFound:
pass
diff --git a/tempest/api/messaging/base.py b/tempest/api/messaging/base.py
index 39dc7c3..528fbea 100644
--- a/tempest/api/messaging/base.py
+++ b/tempest/api/messaging/base.py
@@ -146,7 +146,7 @@
@classmethod
def release_claim(cls, claim_uri):
"""Wrapper utility that deletes a claim."""
- resp, body = cls.client.release_claim(claim_uri)
+ resp, body = cls.client.delete_claim(claim_uri)
return resp, body
diff --git a/tempest/api/messaging/test_claims.py b/tempest/api/messaging/test_claims.py
index e54bed1..57b8c7f 100644
--- a/tempest/api/messaging/test_claims.py
+++ b/tempest/api/messaging/test_claims.py
@@ -115,7 +115,7 @@
claim_uri = resp['location']
# Release Claim
- self.client.release_claim(claim_uri)
+ self.client.delete_claim(claim_uri)
# Delete Claimed message
# This will implicitly verify that the claim is deleted.
diff --git a/tempest/api/network/base.py b/tempest/api/network/base.py
index b798cb2..b4ea29b 100644
--- a/tempest/api/network/base.py
+++ b/tempest/api/network/base.py
@@ -105,7 +105,7 @@
# Clean up metering labels
for metering_label in cls.metering_labels:
cls._try_delete_resource(
- cls.admin_client.delete_metering_label,
+ cls.admin_metering_labels_client.delete_metering_label,
metering_label['id'])
# Clean up ports
for port in cls.ports:
@@ -272,11 +272,12 @@
cls.admin_subnets_client = cls.os_adm.subnets_client
cls.admin_ports_client = cls.os_adm.ports_client
cls.admin_floating_ips_client = cls.os_adm.floating_ips_client
+ cls.admin_metering_labels_client = cls.os_adm.metering_labels_client
@classmethod
def create_metering_label(cls, name, description):
"""Wrapper utility that returns a test metering label."""
- body = cls.admin_client.create_metering_label(
+ body = cls.admin_metering_labels_client.create_metering_label(
description=description,
name=data_utils.rand_name("metering-label"))
metering_label = body['metering_label']
diff --git a/tempest/api/network/test_dhcp_ipv6.py b/tempest/api/network/test_dhcp_ipv6.py
index ceb7906..74c1d51 100644
--- a/tempest/api/network/test_dhcp_ipv6.py
+++ b/tempest/api/network/test_dhcp_ipv6.py
@@ -126,7 +126,7 @@
):
kwargs = {'ipv6_ra_mode': ra_mode,
'ipv6_address_mode': add_mode}
- kwargs = {k: v for k, v in six.iteritems(kwargs) if v}
+ kwargs = dict((k, v) for k, v in six.iteritems(kwargs) if v)
real_ip, eui_ip = self._get_ips_from_subnet(**kwargs)
self._clean_network()
self.assertEqual(eui_ip, real_ip,
@@ -269,7 +269,7 @@
):
kwargs = {'ipv6_ra_mode': ra_mode,
'ipv6_address_mode': add_mode}
- kwargs = {k: v for k, v in six.iteritems(kwargs) if v}
+ kwargs = dict((k, v) for k, v in six.iteritems(kwargs) if v)
subnet = self.create_subnet(self.network, **kwargs)
port = self.create_port(self.network)
port_ip = next(iter(port['fixed_ips']), None)['ip_address']
@@ -291,7 +291,7 @@
):
kwargs = {'ipv6_ra_mode': ra_mode,
'ipv6_address_mode': add_mode}
- kwargs = {k: v for k, v in six.iteritems(kwargs) if v}
+ kwargs = dict((k, v) for k, v in six.iteritems(kwargs) if v)
subnet = self.create_subnet(self.network, **kwargs)
ip_range = netaddr.IPRange(subnet["allocation_pools"][0]["start"],
subnet["allocation_pools"][0]["end"])
@@ -366,7 +366,7 @@
):
kwargs = {'ipv6_ra_mode': ra_mode,
'ipv6_address_mode': add_mode}
- kwargs = {k: v for k, v in six.iteritems(kwargs) if v}
+ kwargs = dict((k, v) for k, v in six.iteritems(kwargs) if v)
subnet, port = self._create_subnet_router(kwargs)
port_ip = next(iter(port['fixed_ips']), None)['ip_address']
self._clean_network()
diff --git a/tempest/api/network/test_metering_extensions.py b/tempest/api/network/test_metering_extensions.py
index a213f92..c4021b4 100644
--- a/tempest/api/network/test_metering_extensions.py
+++ b/tempest/api/network/test_metering_extensions.py
@@ -51,9 +51,11 @@
def _delete_metering_label(self, metering_label_id):
# Deletes a label and verifies if it is deleted or not
- self.admin_client.delete_metering_label(metering_label_id)
+ self.admin_metering_labels_client.delete_metering_label(
+ metering_label_id)
# Asserting that the label is not found in list after deletion
- labels = self.admin_client.list_metering_labels(id=metering_label_id)
+ labels = self.admin_metering_labels_client.list_metering_labels(
+ id=metering_label_id)
self.assertEqual(len(labels['metering_labels']), 0)
def _delete_metering_label_rule(self, metering_label_rule_id):
@@ -68,7 +70,7 @@
@test.idempotent_id('e2fb2f8c-45bf-429a-9f17-171c70444612')
def test_list_metering_labels(self):
# Verify label filtering
- body = self.admin_client.list_metering_labels(id=33)
+ body = self.admin_metering_labels_client.list_metering_labels(id=33)
metering_labels = body['metering_labels']
self.assertEqual(0, len(metering_labels))
@@ -77,21 +79,22 @@
# Creates a label
name = data_utils.rand_name('metering-label-')
description = "label created by tempest"
- body = self.admin_client.create_metering_label(name=name,
- description=description)
+ body = self.admin_metering_labels_client.create_metering_label(
+ name=name, description=description)
metering_label = body['metering_label']
self.addCleanup(self._delete_metering_label,
metering_label['id'])
# Assert whether created labels are found in labels list or fail
# if created labels are not found in labels list
- labels = (self.admin_client.list_metering_labels(
+ labels = (self.admin_metering_labels_client.list_metering_labels(
id=metering_label['id']))
self.assertEqual(len(labels['metering_labels']), 1)
@test.idempotent_id('30abb445-0eea-472e-bd02-8649f54a5968')
def test_show_metering_label(self):
# Verifies the details of a label
- body = self.admin_client.show_metering_label(self.metering_label['id'])
+ body = self.admin_metering_labels_client.show_metering_label(
+ self.metering_label['id'])
metering_label = body['metering_label']
self.assertEqual(self.metering_label['id'], metering_label['id'])
self.assertEqual(self.metering_label['tenant_id'],
diff --git a/tempest/api/telemetry/base.py b/tempest/api/telemetry/base.py
index 81f00ec..bbd01f0 100644
--- a/tempest/api/telemetry/base.py
+++ b/tempest/api/telemetry/base.py
@@ -61,18 +61,9 @@
cls.glance_v2_notifications = ['image.download', 'image.serve']
cls.server_ids = []
- cls.alarm_ids = []
cls.image_ids = []
@classmethod
- def create_alarm(cls, **kwargs):
- body = cls.telemetry_client.create_alarm(
- name=data_utils.rand_name('telemetry_alarm'),
- type='threshold', **kwargs)
- cls.alarm_ids.append(body['alarm_id'])
- return body
-
- @classmethod
def create_server(cls):
tenant_network = cls.get_tenant_network()
body, server = compute.create_test_server(
@@ -106,7 +97,6 @@
@classmethod
def resource_cleanup(cls):
- cls.cleanup_resources(cls.telemetry_client.delete_alarm, cls.alarm_ids)
cls.cleanup_resources(cls.servers_client.delete_server, cls.server_ids)
cls.cleanup_resources(cls.image_client.delete_image, cls.image_ids)
super(BaseTelemetryTest, cls).resource_cleanup()
@@ -153,3 +143,46 @@
raise exceptions.TimeoutException(
'Event with query:%s has not been added to the '
'database within %d seconds' % (query, CONF.compute.build_timeout))
+
+
+class BaseAlarmingTest(tempest.test.BaseTestCase):
+ """Base test case class for all Alarming API tests."""
+
+ credentials = ['primary']
+
+ @classmethod
+ def skip_checks(cls):
+ super(BaseAlarmingTest, cls).skip_checks()
+ if not CONF.service_available.aodh:
+ raise cls.skipException("Aodh support is required")
+
+ @classmethod
+ def setup_clients(cls):
+ super(BaseAlarmingTest, cls).setup_clients()
+ cls.alarming_client = cls.os.alarming_client
+
+ @classmethod
+ def resource_setup(cls):
+ super(BaseAlarmingTest, cls).resource_setup()
+ cls.alarm_ids = []
+
+ @classmethod
+ def create_alarm(cls, **kwargs):
+ body = cls.alarming_client.create_alarm(
+ name=data_utils.rand_name('telemetry_alarm'),
+ type='threshold', **kwargs)
+ cls.alarm_ids.append(body['alarm_id'])
+ return body
+
+ @staticmethod
+ def cleanup_resources(method, list_of_ids):
+ for resource_id in list_of_ids:
+ try:
+ method(resource_id)
+ except lib_exc.NotFound:
+ pass
+
+ @classmethod
+ def resource_cleanup(cls):
+ cls.cleanup_resources(cls.alarming_client.delete_alarm, cls.alarm_ids)
+ super(BaseAlarmingTest, cls).resource_cleanup()
diff --git a/tempest/api/telemetry/test_telemetry_alarming_api.py b/tempest/api/telemetry/test_alarming_api.py
similarity index 80%
rename from tempest/api/telemetry/test_telemetry_alarming_api.py
rename to tempest/api/telemetry/test_alarming_api.py
index 6c84b98..daa0939 100644
--- a/tempest/api/telemetry/test_telemetry_alarming_api.py
+++ b/tempest/api/telemetry/test_alarming_api.py
@@ -17,7 +17,7 @@
from tempest import test
-class TelemetryAlarmingAPITestJSON(base.BaseTelemetryTest):
+class TelemetryAlarmingAPITestJSON(base.BaseAlarmingTest):
@classmethod
def resource_setup(cls):
@@ -32,7 +32,7 @@
@test.idempotent_id('1c918e06-210b-41eb-bd45-14676dd77cd6')
def test_alarm_list(self):
# List alarms
- alarm_list = self.telemetry_client.list_alarms()
+ alarm_list = self.alarming_client.list_alarms()
# Verify created alarm in the list
fetched_ids = [a['alarm_id'] for a in alarm_list]
@@ -46,7 +46,7 @@
def test_create_update_get_delete_alarm(self):
# Create an alarm
alarm_name = data_utils.rand_name('telemetry_alarm')
- body = self.telemetry_client.create_alarm(
+ body = self.alarming_client.create_alarm(
name=alarm_name, type='threshold', threshold_rule=self.rule)
self.assertEqual(alarm_name, body['name'])
alarm_id = body['alarm_id']
@@ -57,7 +57,7 @@
'threshold': 70.0,
'period': 60}
alarm_name_updated = data_utils.rand_name('telemetry-alarm-update')
- body = self.telemetry_client.update_alarm(
+ body = self.alarming_client.update_alarm(
alarm_id,
threshold_rule=new_rule,
name=alarm_name_updated,
@@ -65,19 +65,19 @@
self.assertEqual(alarm_name_updated, body['name'])
self.assertDictContainsSubset(new_rule, body['threshold_rule'])
# Get and verify details of an alarm after update
- body = self.telemetry_client.show_alarm(alarm_id)
+ body = self.alarming_client.show_alarm(alarm_id)
self.assertEqual(alarm_name_updated, body['name'])
self.assertDictContainsSubset(new_rule, body['threshold_rule'])
# Get history for the alarm and verify the same
- body = self.telemetry_client.show_alarm_history(alarm_id)
+ body = self.alarming_client.show_alarm_history(alarm_id)
self.assertEqual("rule change", body[0]['type'])
self.assertIn(alarm_name_updated, body[0]['detail'])
self.assertEqual("creation", body[1]['type'])
self.assertIn(alarm_name, body[1]['detail'])
# Delete alarm and verify if deleted
- self.telemetry_client.delete_alarm(alarm_id)
+ self.alarming_client.delete_alarm(alarm_id)
self.assertRaises(lib_exc.NotFound,
- self.telemetry_client.show_alarm, alarm_id)
+ self.alarming_client.show_alarm, alarm_id)
@test.idempotent_id('aca49486-70bb-4016-87e0-f6131374f741')
def test_set_get_alarm_state(self):
@@ -86,11 +86,11 @@
# Set alarm state and verify
new_state =\
[elem for elem in alarm_states if elem != alarm['state']][0]
- state = self.telemetry_client.alarm_set_state(alarm['alarm_id'],
- new_state)
+ state = self.alarming_client.alarm_set_state(alarm['alarm_id'],
+ new_state)
self.assertEqual(new_state, state.data)
# Get alarm state and verify
- state = self.telemetry_client.show_alarm_state(alarm['alarm_id'])
+ state = self.alarming_client.show_alarm_state(alarm['alarm_id'])
self.assertEqual(new_state, state.data)
@test.idempotent_id('08d7e45a-1344-4e5c-ba6f-f6cbb77f55b9')
@@ -99,13 +99,13 @@
"operator": "or"}
# Verifies alarm create
alarm_name = data_utils.rand_name('combination_alarm')
- body = self.telemetry_client.create_alarm(name=alarm_name,
- combination_rule=rule,
- type='combination')
+ body = self.alarming_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
- self.telemetry_client.delete_alarm(alarm_id)
+ self.alarming_client.delete_alarm(alarm_id)
self.assertRaises(lib_exc.NotFound,
- self.telemetry_client.show_alarm, alarm_id)
+ self.alarming_client.show_alarm, alarm_id)
diff --git a/tempest/api/telemetry/test_alarming_api_negative.py b/tempest/api/telemetry/test_alarming_api_negative.py
index 06753b0..e945556 100644
--- a/tempest/api/telemetry/test_alarming_api_negative.py
+++ b/tempest/api/telemetry/test_alarming_api_negative.py
@@ -20,7 +20,7 @@
import uuid
-class TelemetryAlarmingNegativeTest(base.BaseTelemetryTest):
+class TelemetryAlarmingNegativeTest(base.BaseAlarmingTest):
"""Negative tests for show_alarm, update_alarm, show_alarm_history tests
** show non-existent alarm
@@ -34,7 +34,7 @@
def test_get_non_existent_alarm(self):
# get the non-existent alarm
non_existent_id = str(uuid.uuid4())
- self.assertRaises(lib_exc.NotFound, self.telemetry_client.show_alarm,
+ self.assertRaises(lib_exc.NotFound, self.alarming_client.show_alarm,
non_existent_id)
@test.attr(type=['negative'])
@@ -46,14 +46,14 @@
'comparison_operator': 'eq',
'threshold': 100.0,
'period': 90}
- body = self.telemetry_client.create_alarm(
+ body = self.alarming_client.create_alarm(
name=alarm_name,
type='threshold',
threshold_rule=rule)
alarm_id = body['alarm_id']
- self.telemetry_client.delete_alarm(alarm_id)
+ self.alarming_client.delete_alarm(alarm_id)
# get the deleted alarm
- self.assertRaises(lib_exc.NotFound, self.telemetry_client.show_alarm,
+ self.assertRaises(lib_exc.NotFound, self.alarming_client.show_alarm,
alarm_id)
# update the deleted alarm
@@ -62,10 +62,10 @@
'comparison_operator': 'eq',
'threshold': 70,
'period': 50}
- self.assertRaises(lib_exc.NotFound, self.telemetry_client.update_alarm,
+ self.assertRaises(lib_exc.NotFound, self.alarming_client.update_alarm,
alarm_id, threshold_rule=updated_rule,
name=updated_alarm_name,
type='threshold')
# delete the deleted alarm
- self.assertRaises(lib_exc.NotFound, self.telemetry_client.delete_alarm,
+ self.assertRaises(lib_exc.NotFound, self.alarming_client.delete_alarm,
alarm_id)
diff --git a/tempest/api/telemetry/test_telemetry_notification_api.py b/tempest/api/telemetry/test_telemetry_notification_api.py
index 31eff9d..7511505 100644
--- a/tempest/api/telemetry/test_telemetry_notification_api.py
+++ b/tempest/api/telemetry/test_telemetry_notification_api.py
@@ -58,7 +58,7 @@
body = self.create_image(self.image_client_v2)
self.image_client_v2.store_image_file(body['id'], "file")
- self.image_client_v2.load_image_file(body['id'])
+ self.image_client_v2.show_image_file(body['id'])
query = 'resource', 'eq', body['id']
diff --git a/tempest/api/volume/admin/test_multi_backend.py b/tempest/api/volume/admin/test_multi_backend.py
index 4337922..6d2aaea 100644
--- a/tempest/api/volume/admin/test_multi_backend.py
+++ b/tempest/api/volume/admin/test_multi_backend.py
@@ -11,7 +11,7 @@
# under the License.
from oslo_log import log as logging
-
+import six
from tempest.api.volume import base
from tempest.common.utils import data_utils
from tempest import config
@@ -34,9 +34,14 @@
@classmethod
def resource_setup(cls):
super(VolumeMultiBackendV2Test, cls).resource_setup()
-
- cls.backend1_name = CONF.volume.backend1_name
- cls.backend2_name = CONF.volume.backend2_name
+ # support 2 backends names, deprecated_for_removal.
+ # keep support 2 backend names, in case they are not empty
+ if CONF.volume.backend1_name and CONF.volume.backend2_name:
+ cls.backend_names = {CONF.volume.backend1_name,
+ CONF.volume.backend2_name}
+ else:
+ # read backend name from a list .
+ cls.backend_names = set(CONF.volume.backend_names)
cls.name_field = cls.special_fields['name_field']
cls.volume_type_id_list = []
@@ -44,15 +49,15 @@
cls.volume_id_list_without_prefix = []
# Volume/Type creation (uses volume_backend_name)
- cls._create_type_and_volume(cls.backend1_name, False)
- # Volume/Type creation (uses capabilities:volume_backend_name)
- cls._create_type_and_volume(cls.backend1_name, True)
-
- if cls.backend1_name != cls.backend2_name:
- # Volume/Type creation (uses backend2_name)
- cls._create_type_and_volume(cls.backend2_name, False)
+ # It is not allowed to create the same backend name twice
+ if len(cls.backend_names) < 2:
+ raise cls.skipException("Requires at least two different "
+ "backend names")
+ for backend_name in cls.backend_names:
+ # Volume/Type creation (uses backend_name)
+ cls._create_type_and_volume(backend_name, False)
# Volume/Type creation (uses capabilities:volume_backend_name)
- cls._create_type_and_volume(cls.backend2_name, True)
+ cls._create_type_and_volume(backend_name, True)
@classmethod
def _create_type_and_volume(self, backend_name_key, with_prefix):
@@ -104,32 +109,28 @@
@test.idempotent_id('c1a41f3f-9dad-493e-9f09-3ff197d477cc')
def test_backend_name_reporting(self):
# get volume id which created by type without prefix
- volume_id = self.volume_id_list_without_prefix[0]
- self._test_backend_name_reporting_by_volume_id(volume_id)
+ for volume_id in self.volume_id_list_without_prefix:
+ self._test_backend_name_reporting_by_volume_id(volume_id)
@test.idempotent_id('f38e647f-ab42-4a31-a2e7-ca86a6485215')
def test_backend_name_reporting_with_prefix(self):
# get volume id which created by type with prefix
- volume_id = self.volume_id_list_with_prefix[0]
- self._test_backend_name_reporting_by_volume_id(volume_id)
+ for volume_id in self.volume_id_list_with_prefix:
+ self._test_backend_name_reporting_by_volume_id(volume_id)
@test.idempotent_id('46435ab1-a0af-4401-8373-f14e66b0dd58')
def test_backend_name_distinction(self):
- if self.backend1_name == self.backend2_name:
- raise self.skipException("backends configured with same name")
- # get volume id which created by type without prefix
- volume1_id = self.volume_id_list_without_prefix[0]
- volume2_id = self.volume_id_list_without_prefix[1]
- self._test_backend_name_distinction(volume1_id, volume2_id)
+ # get volume ids which created by type without prefix
+ self._test_backend_name_distinction(self.volume_id_list_without_prefix)
@test.idempotent_id('4236305b-b65a-4bfc-a9d2-69cb5b2bf2ed')
def test_backend_name_distinction_with_prefix(self):
- if self.backend1_name == self.backend2_name:
- raise self.skipException("backends configured with same name")
- # get volume id which created by type without prefix
- volume1_id = self.volume_id_list_with_prefix[0]
- volume2_id = self.volume_id_list_with_prefix[1]
- self._test_backend_name_distinction(volume1_id, volume2_id)
+ # get volume ids which created by type without prefix
+ self._test_backend_name_distinction(self.volume_id_list_with_prefix)
+
+ def _get_volume_host(self, volume_id):
+ return self.admin_volume_client.show_volume(
+ volume_id)['volume']['os-vol-host-attr:host']
def _test_backend_name_reporting_by_volume_id(self, volume_id):
# this test checks if os-vol-attr:host is populated correctly after
@@ -143,19 +144,16 @@
volume_id)
self.assertTrue(len(volume1_host.split("@")) > 1, msg)
- def _test_backend_name_distinction(self, volume1_id, volume2_id):
- # this test checks that the two volumes created at setUp don't
+ def _test_backend_name_distinction(self, volume_id_list):
+ # this test checks that the volumes created at setUp don't
# belong to the same backend (if they are, than the
# volume backend distinction is not working properly)
- volume = self.admin_volume_client.show_volume(volume1_id)['volume']
- volume1_host = volume['os-vol-host-attr:host']
-
- volume = self.admin_volume_client.show_volume(volume2_id)['volume']
- volume2_host = volume['os-vol-host-attr:host']
-
- msg = ("volumes %s and %s were created in the same backend" %
- (volume1_id, volume2_id))
- self.assertNotEqual(volume1_host, volume2_host, msg)
+ volume_hosts = [self._get_volume_host(volume) for volume in
+ volume_id_list]
+ # assert that volumes are each created on separate hosts:
+ msg = ("volumes %s were created in the same backend" % ", "
+ .join(volume_hosts))
+ six.assertCountEqual(self, volume_hosts, set(volume_hosts), msg)
class VolumeMultiBackendV1Test(VolumeMultiBackendV2Test):
diff --git a/tempest/api_schema/response/compute/v2_1/agents.py b/tempest/api_schema/response/compute/v2_1/agents.py
deleted file mode 100644
index da38198..0000000
--- a/tempest/api_schema/response/compute/v2_1/agents.py
+++ /dev/null
@@ -1,60 +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.
-
-common_agent_info = {
- 'type': 'object',
- 'properties': {
- 'agent_id': {'type': ['integer', 'string']},
- 'hypervisor': {'type': 'string'},
- 'os': {'type': 'string'},
- 'architecture': {'type': 'string'},
- 'version': {'type': 'string'},
- 'url': {'type': 'string', 'format': 'uri'},
- 'md5hash': {'type': 'string'}
- },
- 'additionalProperties': False,
- 'required': ['agent_id', 'hypervisor', 'os', 'architecture',
- 'version', 'url', 'md5hash']
-}
-
-list_agents = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'agents': {
- 'type': 'array',
- 'items': common_agent_info
- }
- },
- 'additionalProperties': False,
- 'required': ['agents']
- }
-}
-
-create_agent = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'agent': common_agent_info
- },
- 'additionalProperties': False,
- 'required': ['agent']
- }
-}
-
-delete_agent = {
- 'status_code': [200]
-}
diff --git a/tempest/api_schema/response/compute/v2_1/images.py b/tempest/api_schema/response/compute/v2_1/images.py
deleted file mode 100644
index a513dcb..0000000
--- a/tempest/api_schema/response/compute/v2_1/images.py
+++ /dev/null
@@ -1,154 +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.
-
-import copy
-
-from tempest.api_schema.response.compute.v2_1 import parameter_types
-
-image_links = copy.deepcopy(parameter_types.links)
-image_links['items']['properties'].update({'type': {'type': 'string'}})
-
-common_image_schema = {
- 'type': 'object',
- 'properties': {
- 'id': {'type': 'string'},
- 'status': {'type': 'string'},
- 'updated': {'type': 'string'},
- 'links': image_links,
- 'name': {'type': 'string'},
- 'created': {'type': 'string'},
- 'minDisk': {'type': 'integer'},
- 'minRam': {'type': 'integer'},
- 'progress': {'type': 'integer'},
- 'metadata': {'type': 'object'},
- 'server': {
- 'type': 'object',
- 'properties': {
- 'id': {'type': 'string'},
- 'links': parameter_types.links
- },
- 'additionalProperties': False,
- 'required': ['id', 'links']
- },
- 'OS-EXT-IMG-SIZE:size': {'type': 'integer'},
- 'OS-DCF:diskConfig': {'type': 'string'}
- },
- 'additionalProperties': False,
- # 'server' attributes only comes in response body if image is
- # associated with any server. 'OS-EXT-IMG-SIZE:size' & 'OS-DCF:diskConfig'
- # are API extension, So those are not defined as 'required'.
- 'required': ['id', 'status', 'updated', 'links', 'name',
- 'created', 'minDisk', 'minRam', 'progress',
- 'metadata']
-}
-
-get_image = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'image': common_image_schema
- },
- 'additionalProperties': False,
- 'required': ['image']
- }
-}
-
-list_images = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'images': {
- 'type': 'array',
- 'items': {
- 'type': 'object',
- 'properties': {
- 'id': {'type': 'string'},
- 'links': image_links,
- 'name': {'type': 'string'}
- },
- 'additionalProperties': False,
- 'required': ['id', 'links', 'name']
- }
- },
- 'images_links': parameter_types.links
- },
- 'additionalProperties': False,
- # NOTE(gmann): images_links attribute is not necessary to be
- # present always So it is not 'required'.
- 'required': ['images']
- }
-}
-
-create_image = {
- 'status_code': [202],
- 'response_header': {
- 'type': 'object',
- 'properties': parameter_types.response_header
- }
-}
-create_image['response_header']['properties'].update(
- {'location': {
- 'type': 'string',
- 'format': 'uri'}
- }
-)
-create_image['response_header']['required'] = ['location']
-
-delete = {
- 'status_code': [204]
-}
-
-image_metadata = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'metadata': {'type': 'object'}
- },
- 'additionalProperties': False,
- 'required': ['metadata']
- }
-}
-
-image_meta_item = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'meta': {'type': 'object'}
- },
- 'additionalProperties': False,
- 'required': ['meta']
- }
-}
-
-list_images_details = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'images': {
- 'type': 'array',
- 'items': common_image_schema
- },
- 'images_links': parameter_types.links
- },
- 'additionalProperties': False,
- # NOTE(gmann): images_links attribute is not necessary to be
- # present always So it is not 'required'.
- 'required': ['images']
- }
-}
diff --git a/tempest/api_schema/response/compute/v2_1/instance_usage_audit_logs.py b/tempest/api_schema/response/compute/v2_1/instance_usage_audit_logs.py
deleted file mode 100644
index c6c4deb..0000000
--- a/tempest/api_schema/response/compute/v2_1/instance_usage_audit_logs.py
+++ /dev/null
@@ -1,62 +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.
-
-common_instance_usage_audit_log = {
- 'type': 'object',
- 'properties': {
- 'hosts_not_run': {
- 'type': 'array',
- 'items': {'type': 'string'}
- },
- 'log': {'type': 'object'},
- 'num_hosts': {'type': 'integer'},
- 'num_hosts_done': {'type': 'integer'},
- 'num_hosts_not_run': {'type': 'integer'},
- 'num_hosts_running': {'type': 'integer'},
- 'overall_status': {'type': 'string'},
- 'period_beginning': {'type': 'string'},
- 'period_ending': {'type': 'string'},
- 'total_errors': {'type': 'integer'},
- 'total_instances': {'type': 'integer'}
- },
- 'additionalProperties': False,
- 'required': ['hosts_not_run', 'log', 'num_hosts', 'num_hosts_done',
- 'num_hosts_not_run', 'num_hosts_running', 'overall_status',
- 'period_beginning', 'period_ending', 'total_errors',
- 'total_instances']
-}
-
-get_instance_usage_audit_log = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'instance_usage_audit_log': common_instance_usage_audit_log
- },
- 'additionalProperties': False,
- 'required': ['instance_usage_audit_log']
- }
-}
-
-list_instance_usage_audit_log = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'instance_usage_audit_logs': common_instance_usage_audit_log
- },
- 'additionalProperties': False,
- 'required': ['instance_usage_audit_logs']
- }
-}
diff --git a/tempest/api_schema/response/compute/v2_1/limits.py b/tempest/api_schema/response/compute/v2_1/limits.py
deleted file mode 100644
index 81f175f..0000000
--- a/tempest/api_schema/response/compute/v2_1/limits.py
+++ /dev/null
@@ -1,106 +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.
-
-get_limit = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'limits': {
- 'type': 'object',
- 'properties': {
- 'absolute': {
- 'type': 'object',
- 'properties': {
- 'maxTotalRAMSize': {'type': 'integer'},
- 'totalCoresUsed': {'type': 'integer'},
- 'maxTotalInstances': {'type': 'integer'},
- 'maxTotalFloatingIps': {'type': 'integer'},
- 'totalSecurityGroupsUsed': {'type': 'integer'},
- 'maxTotalCores': {'type': 'integer'},
- 'totalFloatingIpsUsed': {'type': 'integer'},
- 'maxSecurityGroups': {'type': 'integer'},
- 'maxServerMeta': {'type': 'integer'},
- 'maxPersonality': {'type': 'integer'},
- 'maxImageMeta': {'type': 'integer'},
- 'maxPersonalitySize': {'type': 'integer'},
- 'maxSecurityGroupRules': {'type': 'integer'},
- 'maxTotalKeypairs': {'type': 'integer'},
- 'totalRAMUsed': {'type': 'integer'},
- 'totalInstancesUsed': {'type': 'integer'},
- 'maxServerGroupMembers': {'type': 'integer'},
- 'maxServerGroups': {'type': 'integer'},
- 'totalServerGroupsUsed': {'type': 'integer'}
- },
- 'additionalProperties': False,
- # NOTE(gmann): maxServerGroupMembers, maxServerGroups
- # and totalServerGroupsUsed are API extension,
- # and some environments return a response without these
- # attributes.So they are not 'required'.
- 'required': ['maxImageMeta',
- 'maxPersonality',
- 'maxPersonalitySize',
- 'maxSecurityGroupRules',
- 'maxSecurityGroups',
- 'maxServerMeta',
- 'maxTotalCores',
- 'maxTotalFloatingIps',
- 'maxTotalInstances',
- 'maxTotalKeypairs',
- 'maxTotalRAMSize',
- 'totalCoresUsed',
- 'totalFloatingIpsUsed',
- 'totalInstancesUsed',
- 'totalRAMUsed',
- 'totalSecurityGroupsUsed']
- },
- 'rate': {
- 'type': 'array',
- 'items': {
- 'type': 'object',
- 'properties': {
- 'limit': {
- 'type': 'array',
- 'items': {
- 'type': 'object',
- 'properties': {
- 'next-available':
- {'type': 'string'},
- 'remaining':
- {'type': 'integer'},
- 'unit':
- {'type': 'string'},
- 'value':
- {'type': 'integer'},
- 'verb':
- {'type': 'string'}
- },
- 'additionalProperties': False,
- }
- },
- 'regex': {'type': 'string'},
- 'uri': {'type': 'string'}
- },
- 'additionalProperties': False,
- }
- }
- },
- 'additionalProperties': False,
- 'required': ['absolute', 'rate']
- }
- },
- 'additionalProperties': False,
- 'required': ['limits']
- }
-}
diff --git a/tempest/api_schema/response/compute/v2_1/migrations.py b/tempest/api_schema/response/compute/v2_1/migrations.py
deleted file mode 100644
index b7d66ea..0000000
--- a/tempest/api_schema/response/compute/v2_1/migrations.py
+++ /dev/null
@@ -1,51 +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.
-
-list_migrations = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'migrations': {
- 'type': 'array',
- 'items': {
- 'type': 'object',
- 'properties': {
- 'id': {'type': 'integer'},
- 'status': {'type': ['string', 'null']},
- 'instance_uuid': {'type': ['string', 'null']},
- 'source_node': {'type': ['string', 'null']},
- 'source_compute': {'type': ['string', 'null']},
- 'dest_node': {'type': ['string', 'null']},
- 'dest_compute': {'type': ['string', 'null']},
- 'dest_host': {'type': ['string', 'null']},
- 'old_instance_type_id': {'type': ['integer', 'null']},
- 'new_instance_type_id': {'type': ['integer', 'null']},
- 'created_at': {'type': 'string'},
- 'updated_at': {'type': ['string', 'null']}
- },
- 'additionalProperties': False,
- 'required': [
- 'id', 'status', 'instance_uuid', 'source_node',
- 'source_compute', 'dest_node', 'dest_compute',
- 'dest_host', 'old_instance_type_id',
- 'new_instance_type_id', 'created_at', 'updated_at'
- ]
- }
- }
- },
- 'additionalProperties': False,
- 'required': ['migrations']
- }
-}
diff --git a/tempest/api_schema/response/compute/v2_1/quota_classes.py b/tempest/api_schema/response/compute/v2_1/quota_classes.py
deleted file mode 100644
index a0cdaf5..0000000
--- a/tempest/api_schema/response/compute/v2_1/quota_classes.py
+++ /dev/null
@@ -1,31 +0,0 @@
-# Copyright 2014 IBM 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 copy
-
-from tempest.api_schema.response.compute.v2_1 import quotas
-
-# NOTE(mriedem): os-quota-class-sets responses are the same as os-quota-sets
-# except for the key in the response body is quota_class_set instead of
-# quota_set, so update this copy of the schema from os-quota-sets.
-get_quota_class_set = copy.deepcopy(quotas.get_quota_set)
-get_quota_class_set['response_body']['properties']['quota_class_set'] = (
- get_quota_class_set['response_body']['properties'].pop('quota_set'))
-get_quota_class_set['response_body']['required'] = ['quota_class_set']
-
-update_quota_class_set = copy.deepcopy(quotas.update_quota_set)
-update_quota_class_set['response_body']['properties']['quota_class_set'] = (
- update_quota_class_set['response_body']['properties'].pop('quota_set'))
-update_quota_class_set['response_body']['required'] = ['quota_class_set']
diff --git a/tempest/api_schema/response/compute/v2_1/quotas.py b/tempest/api_schema/response/compute/v2_1/quotas.py
deleted file mode 100644
index 7953983..0000000
--- a/tempest/api_schema/response/compute/v2_1/quotas.py
+++ /dev/null
@@ -1,65 +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.
-
-import copy
-
-update_quota_set = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'quota_set': {
- 'type': 'object',
- 'properties': {
- 'instances': {'type': 'integer'},
- 'cores': {'type': 'integer'},
- 'ram': {'type': 'integer'},
- 'floating_ips': {'type': 'integer'},
- 'fixed_ips': {'type': 'integer'},
- 'metadata_items': {'type': 'integer'},
- 'key_pairs': {'type': 'integer'},
- 'security_groups': {'type': 'integer'},
- 'security_group_rules': {'type': 'integer'},
- 'server_group_members': {'type': 'integer'},
- 'server_groups': {'type': 'integer'},
- 'injected_files': {'type': 'integer'},
- 'injected_file_content_bytes': {'type': 'integer'},
- 'injected_file_path_bytes': {'type': 'integer'}
- },
- 'additionalProperties': False,
- # NOTE: server_group_members and server_groups are represented
- # when enabling quota_server_group extension. So they should
- # not be required.
- 'required': ['instances', 'cores', 'ram',
- 'floating_ips', 'fixed_ips',
- 'metadata_items', 'key_pairs',
- 'security_groups', 'security_group_rules',
- 'injected_files', 'injected_file_content_bytes',
- 'injected_file_path_bytes']
- }
- },
- 'additionalProperties': False,
- 'required': ['quota_set']
- }
-}
-
-get_quota_set = copy.deepcopy(update_quota_set)
-get_quota_set['response_body']['properties']['quota_set']['properties'][
- 'id'] = {'type': 'string'}
-get_quota_set['response_body']['properties']['quota_set']['required'].extend([
- 'id'])
-
-delete_quota = {
- 'status_code': [202]
-}
diff --git a/tempest/api_schema/response/compute/v2_1/security_group_default_rule.py b/tempest/api_schema/response/compute/v2_1/security_group_default_rule.py
deleted file mode 100644
index 2ec2826..0000000
--- a/tempest/api_schema/response/compute/v2_1/security_group_default_rule.py
+++ /dev/null
@@ -1,65 +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.
-
-common_security_group_default_rule_info = {
- 'type': 'object',
- 'properties': {
- 'from_port': {'type': 'integer'},
- 'id': {'type': 'integer'},
- 'ip_protocol': {'type': 'string'},
- 'ip_range': {
- 'type': 'object',
- 'properties': {
- 'cidr': {'type': 'string'}
- },
- 'additionalProperties': False,
- 'required': ['cidr'],
- },
- 'to_port': {'type': 'integer'},
- },
- 'additionalProperties': False,
- 'required': ['from_port', 'id', 'ip_protocol', 'ip_range', 'to_port'],
-}
-
-create_get_security_group_default_rule = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'security_group_default_rule':
- common_security_group_default_rule_info
- },
- 'additionalProperties': False,
- 'required': ['security_group_default_rule']
- }
-}
-
-delete_security_group_default_rule = {
- 'status_code': [204]
-}
-
-list_security_group_default_rules = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'security_group_default_rules': {
- 'type': 'array',
- 'items': common_security_group_default_rule_info
- }
- },
- 'additionalProperties': False,
- 'required': ['security_group_default_rules']
- }
-}
diff --git a/tempest/api_schema/response/compute/v2_1/servers.py b/tempest/api_schema/response/compute/v2_1/servers.py
index 9593f3c..38f7c82 100644
--- a/tempest/api_schema/response/compute/v2_1/servers.py
+++ b/tempest/api_schema/response/compute/v2_1/servers.py
@@ -291,8 +291,8 @@
'status_code': [202]
}
-get_volume_attachment = copy.deepcopy(attach_volume)
-get_volume_attachment['response_body']['properties'][
+show_volume_attachment = copy.deepcopy(attach_volume)
+show_volume_attachment['response_body']['properties'][
'volumeAttachment']['properties'].update({'serverId': {'type': 'string'}})
list_volume_attachments = {
@@ -436,7 +436,7 @@
# 'events' does not come in response body always so it is not
# defined as 'required'
-get_instance_action = {
+show_instance_action = {
'status_code': [200],
'response_body': {
'type': 'object',
@@ -448,7 +448,7 @@
}
}
-get_password = {
+show_password = {
'status_code': [200],
'response_body': {
'type': 'object',
@@ -520,7 +520,7 @@
'status_code': [204]
}
-set_get_server_metadata_item = {
+set_show_server_metadata_item = {
'status_code': [200],
'response_body': {
'type': 'object',
diff --git a/tempest/api_schema/response/compute/v2_1/services.py b/tempest/api_schema/response/compute/v2_1/services.py
deleted file mode 100644
index ddef7b2..0000000
--- a/tempest/api_schema/response/compute/v2_1/services.py
+++ /dev/null
@@ -1,65 +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.
-
-list_services = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'services': {
- 'type': 'array',
- 'items': {
- 'type': 'object',
- 'properties': {
- 'id': {'type': ['integer', 'string'],
- 'pattern': '^[a-zA-Z!]*@[0-9]+$'},
- 'zone': {'type': 'string'},
- 'host': {'type': 'string'},
- 'state': {'type': 'string'},
- 'binary': {'type': 'string'},
- 'status': {'type': 'string'},
- 'updated_at': {'type': ['string', 'null']},
- 'disabled_reason': {'type': ['string', 'null']}
- },
- 'additionalProperties': False,
- 'required': ['id', 'zone', 'host', 'state', 'binary',
- 'status', 'updated_at', 'disabled_reason']
- }
- }
- },
- 'additionalProperties': False,
- 'required': ['services']
- }
-}
-
-enable_disable_service = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'service': {
- 'type': 'object',
- 'properties': {
- 'status': {'type': 'string'},
- 'binary': {'type': 'string'},
- 'host': {'type': 'string'}
- },
- 'additionalProperties': False,
- 'required': ['status', 'binary', 'host']
- }
- },
- 'additionalProperties': False,
- 'required': ['service']
- }
-}
diff --git a/tempest/api_schema/response/compute/v2_1/snapshots.py b/tempest/api_schema/response/compute/v2_1/snapshots.py
deleted file mode 100644
index 01a524b..0000000
--- a/tempest/api_schema/response/compute/v2_1/snapshots.py
+++ /dev/null
@@ -1,61 +0,0 @@
-# Copyright 2015 Fujitsu(fnst) 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.
-
-common_snapshot_info = {
- 'type': 'object',
- 'properties': {
- 'id': {'type': 'string'},
- 'volumeId': {'type': 'string'},
- 'status': {'type': 'string'},
- 'size': {'type': 'integer'},
- 'createdAt': {'type': 'string'},
- 'displayName': {'type': ['string', 'null']},
- 'displayDescription': {'type': ['string', 'null']}
- },
- 'additionalProperties': False,
- 'required': ['id', 'volumeId', 'status', 'size',
- 'createdAt', 'displayName', 'displayDescription']
-}
-
-create_get_snapshot = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'snapshot': common_snapshot_info
- },
- 'additionalProperties': False,
- 'required': ['snapshot']
- }
-}
-
-list_snapshots = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'snapshots': {
- 'type': 'array',
- 'items': common_snapshot_info
- }
- },
- 'additionalProperties': False,
- 'required': ['snapshots']
- }
-}
-
-delete_snapshot = {
- 'status_code': [202]
-}
diff --git a/tempest/api_schema/response/compute/v2_1/tenant_networks.py b/tempest/api_schema/response/compute/v2_1/tenant_networks.py
deleted file mode 100644
index ddfab96..0000000
--- a/tempest/api_schema/response/compute/v2_1/tenant_networks.py
+++ /dev/null
@@ -1,53 +0,0 @@
-# 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'}
- },
- 'additionalProperties': False,
- 'required': ['id', 'cidr', 'label']
-}
-
-
-list_tenant_networks = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'networks': {
- 'type': 'array',
- 'items': param_network
- }
- },
- 'additionalProperties': False,
- 'required': ['networks']
- }
-}
-
-
-get_tenant_network = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'network': param_network
- },
- 'additionalProperties': False,
- 'required': ['network']
- }
-}
diff --git a/tempest/api_schema/response/compute/v2_1/tenant_usages.py b/tempest/api_schema/response/compute/v2_1/tenant_usages.py
deleted file mode 100644
index d51ef12..0000000
--- a/tempest/api_schema/response/compute/v2_1/tenant_usages.py
+++ /dev/null
@@ -1,92 +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.
-
-import copy
-
-_server_usages = {
- 'type': 'array',
- 'items': {
- 'type': 'object',
- 'properties': {
- 'ended_at': {
- 'oneOf': [
- {'type': 'string'},
- {'type': 'null'}
- ]
- },
- 'flavor': {'type': 'string'},
- 'hours': {'type': 'number'},
- 'instance_id': {'type': 'string'},
- 'local_gb': {'type': 'integer'},
- 'memory_mb': {'type': 'integer'},
- 'name': {'type': 'string'},
- 'started_at': {'type': 'string'},
- 'state': {'type': 'string'},
- 'tenant_id': {'type': 'string'},
- 'uptime': {'type': 'integer'},
- 'vcpus': {'type': 'integer'},
- },
- 'required': ['ended_at', 'flavor', 'hours', 'instance_id', 'local_gb',
- 'memory_mb', 'name', 'started_at', 'state', 'tenant_id',
- 'uptime', 'vcpus']
- }
-}
-
-_tenant_usage_list = {
- 'type': 'object',
- 'properties': {
- 'server_usages': _server_usages,
- 'start': {'type': 'string'},
- 'stop': {'type': 'string'},
- 'tenant_id': {'type': 'string'},
- 'total_hours': {'type': 'number'},
- 'total_local_gb_usage': {'type': 'number'},
- 'total_memory_mb_usage': {'type': 'number'},
- 'total_vcpus_usage': {'type': 'number'},
- },
- 'required': ['start', 'stop', 'tenant_id',
- 'total_hours', 'total_local_gb_usage',
- 'total_memory_mb_usage', 'total_vcpus_usage']
-}
-
-# 'required' of get_tenant is different from list_tenant's.
-_tenant_usage_get = copy.deepcopy(_tenant_usage_list)
-_tenant_usage_get['required'] = ['server_usages', 'start', 'stop', 'tenant_id',
- 'total_hours', 'total_local_gb_usage',
- 'total_memory_mb_usage', 'total_vcpus_usage']
-
-list_tenant_usage = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'tenant_usages': {
- 'type': 'array',
- 'items': _tenant_usage_list
- }
- },
- 'required': ['tenant_usages']
- }
-}
-
-get_tenant_usage = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'tenant_usage': _tenant_usage_get
- },
- 'required': ['tenant_usage']
- }
-}
diff --git a/tempest/api_schema/response/compute/v2_1/versions.py b/tempest/api_schema/response/compute/v2_1/versions.py
deleted file mode 100644
index 08a9fab..0000000
--- a/tempest/api_schema/response/compute/v2_1/versions.py
+++ /dev/null
@@ -1,110 +0,0 @@
-# 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 copy
-
-
-_version = {
- 'type': 'object',
- 'properties': {
- 'id': {'type': 'string'},
- 'links': {
- 'type': 'array',
- 'items': {
- 'type': 'object',
- 'properties': {
- 'href': {'type': 'string', 'format': 'uri'},
- 'rel': {'type': 'string'},
- 'type': {'type': 'string'},
- },
- 'required': ['href', 'rel'],
- 'additionalProperties': False
- }
- },
- 'status': {'type': 'string'},
- 'updated': {'type': 'string', 'format': 'date-time'},
- 'version': {'type': 'string'},
- 'min_version': {'type': 'string'},
- 'media-types': {
- 'type': 'array',
- 'properties': {
- 'base': {'type': 'string'},
- 'type': {'type': 'string'},
- }
- },
- },
- # NOTE: version and min_version have been added since Kilo,
- # so they should not be required.
- # NOTE(sdague): media-types only shows up in single version requests.
- 'required': ['id', 'links', 'status', 'updated'],
- 'additionalProperties': False
-}
-
-list_versions = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'versions': {
- 'type': 'array',
- 'items': _version
- }
- },
- 'required': ['versions'],
- 'additionalProperties': False
- }
-}
-
-
-_detail_get_version = copy.deepcopy(_version)
-_detail_get_version['properties'].pop('min_version')
-_detail_get_version['properties'].pop('version')
-_detail_get_version['properties'].pop('updated')
-_detail_get_version['properties']['media-types'] = {
- 'type': 'array',
- 'items': {
- 'type': 'object',
- 'properties': {
- 'base': {'type': 'string'},
- 'type': {'type': 'string'}
- }
- }
-}
-_detail_get_version['required'] = ['id', 'links', 'status', 'media-types']
-
-get_version = {
- 'status_code': [300],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'choices': {
- 'type': 'array',
- 'items': _detail_get_version
- }
- },
- 'required': ['choices'],
- 'additionalProperties': False
- }
-}
-
-get_one_version = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'version': _version
- },
- 'additionalProperties': False
- }
-}
diff --git a/tempest/clients.py b/tempest/clients.py
index e82a159..d16b47b 100644
--- a/tempest/clients.py
+++ b/tempest/clients.py
@@ -35,6 +35,29 @@
from tempest_lib.services.compute.hosts_client import HostsClient
from tempest_lib.services.compute.hypervisor_client import \
HypervisorClient
+from tempest_lib.services.compute.images_client import ImagesClient \
+ as ComputeImagesClient
+from tempest_lib.services.compute.instance_usage_audit_log_client import \
+ InstanceUsagesAuditLogClient
+from tempest_lib.services.compute.limits_client import LimitsClient
+from tempest_lib.services.compute.migrations_client import MigrationsClient
+from tempest_lib.services.compute.networks_client import NetworksClient \
+ as ComputeNetworksClient
+from tempest_lib.services.compute.quota_classes_client import \
+ QuotaClassesClient
+from tempest_lib.services.compute.quotas_client import QuotasClient
+from tempest_lib.services.compute.security_group_default_rules_client import \
+ SecurityGroupDefaultRulesClient
+from tempest_lib.services.compute.security_groups_client import \
+ SecurityGroupsClient
+from tempest_lib.services.compute.services_client import ServicesClient
+from tempest_lib.services.compute.snapshots_client import \
+ SnapshotsClient as ComputeSnapshotsClient
+from tempest_lib.services.compute.tenant_networks_client import \
+ TenantNetworksClient
+from tempest_lib.services.compute.tenant_usages_client import \
+ TenantUsagesClient
+from tempest_lib.services.compute.versions_client import VersionsClient
from tempest_lib.services.identity.v2.token_client import TokenClient
from tempest_lib.services.identity.v3.token_client import V3TokenClient
@@ -47,37 +70,14 @@
from tempest.services import botoclients
from tempest.services.compute.json.floating_ips_client import \
FloatingIPsClient as ComputeFloatingIPsClient
-from tempest.services.compute.json.images_client import ImagesClient
-from tempest.services.compute.json.instance_usage_audit_log_client import \
- InstanceUsagesAuditLogClient
from tempest.services.compute.json.interfaces_client import \
InterfacesClient
from tempest.services.compute.json.keypairs_client import KeyPairsClient
-from tempest.services.compute.json.limits_client import LimitsClient
-from tempest.services.compute.json.migrations_client import \
- MigrationsClient
-from tempest.services.compute.json.networks_client import NetworksClient \
- as ComputeNetworksClient
-from tempest.services.compute.json.quota_classes_client import \
- QuotaClassesClient
-from tempest.services.compute.json.quotas_client import QuotasClient
-from tempest.services.compute.json.security_group_default_rules_client import \
- SecurityGroupDefaultRulesClient
from tempest.services.compute.json.security_group_rules_client import \
SecurityGroupRulesClient
-from tempest.services.compute.json.security_groups_client import \
- SecurityGroupsClient
from tempest.services.compute.json.server_groups_client import \
ServerGroupsClient
from tempest.services.compute.json.servers_client import ServersClient
-from tempest.services.compute.json.services_client import ServicesClient
-from tempest.services.compute.json.snapshots_client import \
- SnapshotsClient as ComputeSnapshotsClient
-from tempest.services.compute.json.tenant_networks_client import \
- TenantNetworksClient
-from tempest.services.compute.json.tenant_usages_client import \
- TenantUsagesClient
-from tempest.services.compute.json.versions_client import VersionsClient
from tempest.services.compute.json.volumes_client import \
VolumesClient as ComputeVolumesClient
from tempest.services.data_processing.v1_1.data_processing_client import \
@@ -91,21 +91,25 @@
from tempest.services.identity.v2.json.identity_client import \
IdentityClient
from tempest.services.identity.v3.json.credentials_client import \
- CredentialsClient
+ CredentialsClient as CredentialsV3Client
from tempest.services.identity.v3.json.endpoints_client import \
- EndPointClient
-from tempest.services.identity.v3.json.groups_client import GroupsClient
-from tempest.services.identity.v3.json.identity_client import \
- IdentityV3Client
-from tempest.services.identity.v3.json.policy_client import PolicyClient
-from tempest.services.identity.v3.json.region_client import RegionClient
+ EndPointClient as EndPointV3Client
+from tempest.services.identity.v3.json.groups_client import \
+ GroupsClient as GroupsV3Client
+from tempest.services.identity.v3.json.identity_client import IdentityV3Client
+from tempest.services.identity.v3.json.policy_client import \
+ PolicyClient as PolicyV3Client
+from tempest.services.identity.v3.json.region_client import \
+ RegionClient as RegionV3Client
from tempest.services.identity.v3.json.service_client import \
- ServiceClient
-from tempest.services.image.v1.json.image_client import ImageClient
-from tempest.services.image.v2.json.image_client import ImageClientV2
+ ServiceClient as ServiceV3Client
+from tempest.services.image.v1.json.images_client import ImagesClient
+from tempest.services.image.v2.json.images_client import ImagesClientV2
from tempest.services.messaging.json.messaging_client import \
MessagingClient
from tempest.services.network.json.floating_ips_client import FloatingIPsClient
+from tempest.services.network.json.metering_labels_client import \
+ MeteringLabelsClient
from tempest.services.network.json.network_client import NetworkClient
from tempest.services.network.json.networks_client import NetworksClient
from tempest.services.network.json.ports_client import PortsClient
@@ -115,24 +119,25 @@
from tempest.services.object_storage.object_client import ObjectClient
from tempest.services.orchestration.json.orchestration_client import \
OrchestrationClient
+from tempest.services.telemetry.json.alarming_client import AlarmingClient
from tempest.services.telemetry.json.telemetry_client import \
TelemetryClient
-from tempest.services.volume.json.admin.volume_hosts_client import \
+from tempest.services.volume.v1.json.admin.volume_hosts_client import \
VolumeHostsClient
-from tempest.services.volume.json.admin.volume_quotas_client import \
+from tempest.services.volume.v1.json.admin.volume_quotas_client import \
VolumeQuotasClient
-from tempest.services.volume.json.admin.volume_services_client import \
+from tempest.services.volume.v1.json.admin.volume_services_client import \
VolumesServicesClient
-from tempest.services.volume.json.admin.volume_types_client import \
+from tempest.services.volume.v1.json.admin.volume_types_client import \
VolumeTypesClient
-from tempest.services.volume.json.availability_zone_client import \
+from tempest.services.volume.v1.json.availability_zone_client import \
VolumeAvailabilityZoneClient
-from tempest.services.volume.json.backups_client import BackupsClient
-from tempest.services.volume.json.extensions_client import \
+from tempest.services.volume.v1.json.backups_client import BackupsClient
+from tempest.services.volume.v1.json.extensions_client import \
ExtensionsClient as VolumeExtensionClient
-from tempest.services.volume.json.qos_client import QosSpecsClient
-from tempest.services.volume.json.snapshots_client import SnapshotsClient
-from tempest.services.volume.json.volumes_client import VolumesClient
+from tempest.services.volume.v1.json.qos_client import QosSpecsClient
+from tempest.services.volume.v1.json.snapshots_client import SnapshotsClient
+from tempest.services.volume.v1.json.volumes_client import VolumesClient
from tempest.services.volume.v2.json.admin.volume_hosts_client import \
VolumeHostsV2Client
from tempest.services.volume.v2.json.admin.volume_quotas_client import \
@@ -228,6 +233,14 @@
build_interval=CONF.network.build_interval,
build_timeout=CONF.network.build_timeout,
**self.default_params)
+ self.metering_labels_client = MeteringLabelsClient(
+ self.auth_provider,
+ CONF.network.catalog_type,
+ CONF.network.region or CONF.identity.region,
+ endpoint_type=CONF.network.endpoint_type,
+ build_interval=CONF.network.build_interval,
+ build_timeout=CONF.network.build_timeout,
+ **self.default_params)
self.messaging_client = MessagingClient(
self.auth_provider,
CONF.messaging.catalog_type,
@@ -240,8 +253,15 @@
CONF.identity.region,
endpoint_type=CONF.telemetry.endpoint_type,
**self.default_params_with_timeout_values)
+ if CONF.service_available.aodh:
+ self.alarming_client = AlarmingClient(
+ self.auth_provider,
+ CONF.alarming.catalog_type,
+ CONF.identity.region,
+ endpoint_type=CONF.alarming.endpoint_type,
+ **self.default_params_with_timeout_values)
if CONF.service_available.glance:
- self.image_client = ImageClient(
+ self.image_client = ImagesClient(
self.auth_provider,
CONF.image.catalog_type,
CONF.image.region or CONF.identity.region,
@@ -249,7 +269,7 @@
build_interval=CONF.image.build_interval,
build_timeout=CONF.image.build_timeout,
**self.default_params)
- self.image_client_v2 = ImageClientV2(
+ self.image_client_v2 = ImagesClientV2(
self.auth_provider,
CONF.image.catalog_type,
CONF.image.region or CONF.identity.region,
@@ -310,7 +330,7 @@
self.server_groups_client = ServerGroupsClient(
self.auth_provider, **params)
self.limits_client = LimitsClient(self.auth_provider, **params)
- self.images_client = ImagesClient(self.auth_provider, **params)
+ self.images_client = ComputeImagesClient(self.auth_provider, **params)
self.keypairs_client = KeyPairsClient(self.auth_provider, **params)
self.quotas_client = QuotasClient(self.auth_provider, **params)
self.quota_classes_client = QuotaClassesClient(self.auth_provider,
@@ -399,17 +419,17 @@
**params_v2_public)
params_v3 = params.copy()
params_v3['endpoint_type'] = CONF.identity.v3_endpoint_type
- # Client uses the endpoint type of Keystone API v3
+ # Clients below use the endpoint type of Keystone API v3
self.identity_v3_client = IdentityV3Client(self.auth_provider,
**params_v3)
- self.endpoints_client = EndPointClient(self.auth_provider,
- **params)
- self.service_client = ServiceClient(self.auth_provider, **params)
- self.policy_client = PolicyClient(self.auth_provider, **params)
- self.region_client = RegionClient(self.auth_provider, **params)
- self.credentials_client = CredentialsClient(self.auth_provider,
- **params)
- self.groups_client = GroupsClient(self.auth_provider, **params_v3)
+ self.endpoints_client = EndPointV3Client(self.auth_provider,
+ **params_v3)
+ self.service_client = ServiceV3Client(self.auth_provider, **params_v3)
+ self.policy_client = PolicyV3Client(self.auth_provider, **params_v3)
+ self.region_client = RegionV3Client(self.auth_provider, **params_v3)
+ self.credentials_client = CredentialsV3Client(self.auth_provider,
+ **params_v3)
+ self.groups_client = GroupsV3Client(self.auth_provider, **params_v3)
# Token clients do not use the catalog. They only need default_params.
# They read auth_url, so they should only be set if the corresponding
# API version is marked as enabled
diff --git a/tempest/cmd/account_generator.py b/tempest/cmd/account_generator.py
index c23b668..613fb26 100755
--- a/tempest/cmd/account_generator.py
+++ b/tempest/cmd/account_generator.py
@@ -195,7 +195,8 @@
continue
while True:
try:
- identity_admin.get_user_by_username(tenant['id'], u['name'])
+ identity.get_user_by_username(identity_admin,
+ tenant['id'], u['name'])
except tempest_lib.exceptions.NotFound:
identity_admin.create_user(
u['name'], u['pass'], tenant['id'],
@@ -224,8 +225,8 @@
LOG.error("Tenant: %s - not found" % u['tenant'])
continue
try:
- user = identity_admin.get_user_by_username(tenant['id'],
- u['name'])
+ user = identity.get_user_by_username(identity_admin,
+ tenant['id'], u['name'])
except tempest_lib.exceptions.NotFound:
LOG.error("User: %s - not found" % u['user'])
continue
diff --git a/tempest/cmd/cleanup.py b/tempest/cmd/cleanup.py
index 09e3c9d..1c8ddcb 100644
--- a/tempest/cmd/cleanup.py
+++ b/tempest/cmd/cleanup.py
@@ -182,8 +182,8 @@
CONF.auth.admin_tenant_name)
self.admin_tenant_id = tenant['id']
- user = id_cl.get_user_by_username(self.admin_tenant_id,
- CONF.auth.admin_username)
+ user = identity.get_user_by_username(id_cl, self.admin_tenant_id,
+ CONF.auth.admin_username)
self.admin_id = user['id']
roles = id_cl.list_roles()['roles']
@@ -240,7 +240,7 @@
id_cl = credentials.AdminManager().identity_client
if (self._tenant_exists(tenant_id)):
try:
- id_cl.remove_user_role(tenant_id, self.admin_id,
+ id_cl.delete_user_role(tenant_id, self.admin_id,
self.admin_role_id)
except Exception as ex:
LOG.exception("Failed removing role from tenant which still"
diff --git a/tempest/cmd/cleanup_service.py b/tempest/cmd/cleanup_service.py
index ba6bf6c..f2dd7af 100644
--- a/tempest/cmd/cleanup_service.py
+++ b/tempest/cmd/cleanup_service.py
@@ -387,6 +387,7 @@
self.subnets_client = manager.subnets_client
self.ports_client = manager.ports_client
self.floating_ips_client = manager.floating_ips_client
+ self.metering_labels_client = manager.metering_labels_client
def _filter_by_conf_networks(self, item_list):
if not item_list or not all(('network_id' in i for i in item_list)):
@@ -600,7 +601,7 @@
class NetworkMeteringLabelService(NetworkService):
def list(self):
- client = self.client
+ client = self.metering_labels_client
labels = client.list_metering_labels()
labels = labels['metering_labels']
labels = self._filter_by_tenant_id(labels)
@@ -608,7 +609,7 @@
return labels
def delete(self):
- client = self.client
+ client = self.metering_labels_client
labels = self.list()
for label in labels:
try:
diff --git a/tempest/cmd/javelin.py b/tempest/cmd/javelin.py
index c2feb23..c5e4a7e 100755
--- a/tempest/cmd/javelin.py
+++ b/tempest/cmd/javelin.py
@@ -118,6 +118,7 @@
from tempest_lib import auth
from tempest_lib import exceptions as lib_exc
from tempest_lib.services.compute import flavors_client
+from tempest_lib.services.compute import security_groups_client
import yaml
from tempest.common import identity
@@ -125,16 +126,16 @@
from tempest import config
from tempest.services.compute.json import floating_ips_client
from tempest.services.compute.json import security_group_rules_client
-from tempest.services.compute.json import security_groups_client
from tempest.services.compute.json import servers_client
from tempest.services.identity.v2.json import identity_client
-from tempest.services.image.v2.json import image_client
+from tempest.services.image.v2.json import images_client
from tempest.services.network.json import network_client
from tempest.services.network.json import subnets_client
from tempest.services.object_storage import container_client
from tempest.services.object_storage import object_client
+from tempest.services.telemetry.json import alarming_client
from tempest.services.telemetry.json import telemetry_client
-from tempest.services.volume.json import volumes_client
+from tempest.services.volume.v1.json import volumes_client
CONF = config.CONF
OPTS = {}
@@ -212,7 +213,7 @@
**object_storage_params)
self.containers = container_client.ContainerClient(
_auth, **object_storage_params)
- self.images = image_client.ImageClientV2(
+ self.images = images_client.ImagesClientV2(
_auth,
CONF.image.catalog_type,
CONF.image.region or CONF.identity.region,
@@ -226,6 +227,12 @@
CONF.identity.region,
endpoint_type=CONF.telemetry.endpoint_type,
**default_params_with_timeout_values)
+ self.alarming = alarming_client.AlarmingClient(
+ _auth,
+ CONF.alarm.catalog_type,
+ CONF.identity.region,
+ endpoint_type=CONF.alarm.endpoint_type,
+ **default_params_with_timeout_values)
self.volumes = volumes_client.VolumesClient(
_auth,
CONF.volume.catalog_type,
@@ -353,7 +360,8 @@
LOG.error("Tenant: %s - not found" % u['tenant'])
continue
try:
- admin.identity.get_user_by_username(tenant['id'], u['name'])
+ identity.get_user_by_username(admin.identity,
+ tenant['id'], u['name'])
LOG.warn("User '%s' already exists in this environment"
% u['name'])
except lib_exc.NotFound:
@@ -368,8 +376,8 @@
for user in users:
tenant_id = identity.get_tenant_by_name(admin.identity,
user['tenant'])['id']
- user_id = admin.identity.get_user_by_username(tenant_id,
- user['name'])['id']
+ user_id = identity.get_user_by_username(admin.identity,
+ tenant_id, user['name'])['id']
admin.identity.delete_user(user_id)
@@ -381,7 +389,8 @@
tenant = identity.get_tenant_by_name(admin.identity, u['tenant'])
u['tenant_id'] = tenant['id']
USERS[u['name']] = u
- body = admin.identity.get_user_by_username(tenant['id'], u['name'])
+ body = identity.get_user_by_username(admin.identity,
+ tenant['id'], u['name'])
USERS[u['name']]['id'] = body['id']
diff --git a/tempest/common/compute.py b/tempest/common/compute.py
index 6fc3843..5a14fbe 100644
--- a/tempest/common/compute.py
+++ b/tempest/common/compute.py
@@ -43,7 +43,7 @@
:param wait_until: Server status to wait for the server to reach after
its creation.
:param volume_backed: Whether the instance is volume backed or not.
- :returns a tuple
+ :returns: a tuple
"""
# TODO(jlanoux) add support of wait_until PINGABLE/SSHABLE
diff --git a/tempest/common/credentials_factory.py b/tempest/common/credentials_factory.py
index 38bde2e..95dcafc 100644
--- a/tempest/common/credentials_factory.py
+++ b/tempest/common/credentials_factory.py
@@ -13,6 +13,7 @@
import os
+from oslo_concurrency import lockutils
from oslo_log import log as logging
from tempest_lib import auth
@@ -42,6 +43,29 @@
# === Credential Providers
+# Subset of the parameters of credential providers that depend on configuration
+def _get_common_provider_params():
+ return {
+ 'credentials_domain': CONF.auth.default_credentials_domain_name,
+ 'admin_role': CONF.identity.admin_role
+ }
+
+
+def _get_dynamic_provider_params():
+ return _get_common_provider_params()
+
+
+def _get_preprov_provider_params():
+ _common_params = _get_common_provider_params()
+ reseller_admin_role = CONF.object_storage.reseller_admin_role
+ return dict(_common_params, **dict([
+ ('accounts_lock_dir', lockutils.get_lock_path(CONF)),
+ ('test_accounts_file', CONF.auth.test_accounts_file),
+ ('object_storage_operator_role', CONF.object_storage.operator_role),
+ ('object_storage_reseller_admin_role', reseller_admin_role)
+ ]))
+
+
class LegacyCredentialProvider(cred_provider.CredentialProvider):
def __init__(self, identity_version):
@@ -143,17 +167,15 @@
name=name,
network_resources=network_resources,
identity_version=identity_version,
- credentials_domain=CONF.auth.default_credentials_domain_name,
- admin_role=CONF.identity.admin_role,
- admin_creds=admin_creds)
+ admin_creds=admin_creds,
+ **_get_dynamic_provider_params())
else:
if (CONF.auth.test_accounts_file and
os.path.isfile(CONF.auth.test_accounts_file)):
# Most params are not relevant for pre-created accounts
return preprov_creds.PreProvisionedCredentialProvider(
name=name, identity_version=identity_version,
- credentials_domain=CONF.auth.default_credentials_domain_name,
- admin_role=CONF.identity.admin_role)
+ **_get_preprov_provider_params())
else:
# Dynamic credentials are disabled, and the account file is not
# defined - we fall back on credentials configured in tempest.conf
@@ -175,7 +197,7 @@
os.path.isfile(CONF.auth.test_accounts_file)):
check_accounts = preprov_creds.PreProvisionedCredentialProvider(
identity_version=identity_version, name='check_admin',
- admin_role=CONF.identity.admin_role)
+ **_get_preprov_provider_params())
if not check_accounts.admin_available():
is_admin = False
else:
@@ -201,7 +223,7 @@
os.path.isfile(CONF.auth.test_accounts_file)):
check_accounts = preprov_creds.PreProvisionedCredentialProvider(
identity_version=identity_version, name='check_alt',
- admin_role=CONF.identity.admin_role)
+ **_get_preprov_provider_params())
else:
check_accounts = LegacyCredentialProvider(identity_version)
try:
diff --git a/tempest/common/fixed_network.py b/tempest/common/fixed_network.py
index b81830a..56cd331 100644
--- a/tempest/common/fixed_network.py
+++ b/tempest/common/fixed_network.py
@@ -15,11 +15,8 @@
from tempest_lib.common.utils import misc as misc_utils
-from tempest import config
from tempest import exceptions
-CONF = config.CONF
-
LOG = logging.getLogger(__name__)
@@ -31,14 +28,14 @@
object to use for making the network lists api request
:return: The full dictionary for the network in question
:rtype: dict
- :raises InvalidConfiguration: If the name provided is invalid, the networks
+ :raises InvalidTestResource: If the name provided is invalid, the networks
list returns a 404, there are no found networks, or the found network
is invalid
"""
caller = misc_utils.find_test_caller()
if not name:
- raise exceptions.InvalidConfiguration()
+ raise exceptions.InvalidTestResource(type='network', name=name)
networks = compute_networks_client.list_networks()['networks']
networks = [n for n in networks if n['label'] == name]
@@ -53,13 +50,13 @@
if caller:
msg = '(%s) %s' % (caller, msg)
LOG.warn(msg)
- raise exceptions.InvalidConfiguration()
+ raise exceptions.InvalidTestResource(type='network', name=name)
else:
msg = "Network with name: %s not found" % name
if caller:
msg = '(%s) %s' % (caller, msg)
LOG.warn(msg)
- raise exceptions.InvalidConfiguration()
+ raise exceptions.InvalidTestResource(type='network', name=name)
# To be consistent between neutron and nova network always use name even
# if label is used in the api response. If neither is present than then
# the returned network is invalid.
@@ -69,12 +66,13 @@
if caller:
msg = '(%s) %s' % (caller, msg)
LOG.warn(msg)
- raise exceptions.InvalidConfiguration()
+ raise exceptions.InvalidTestResource(type='network', name=name)
network['name'] = name
return network
-def get_tenant_network(creds_provider, compute_networks_client):
+def get_tenant_network(creds_provider, compute_networks_client,
+ shared_network_name):
"""Get a network usable by the primary tenant
:param creds_provider: instance of credential provider
@@ -83,23 +81,24 @@
neutron and nova-network cases. If this is not an admin network
client, set_network_kwargs might fail in case fixed_network_name
is the network to be used, and it's not visible to the tenant
- :return a dict with 'id' and 'name' of the network
+ :param shared_network_name: name of the shared network to be used if no
+ tenant network is available in the creds provider
+ :returns: a dict with 'id' and 'name' of the network
"""
caller = misc_utils.find_test_caller()
- fixed_network_name = CONF.compute.fixed_network_name
net_creds = creds_provider.get_primary_creds()
network = getattr(net_creds, 'network', None)
if not network or not network.get('name'):
- if fixed_network_name:
+ if shared_network_name:
msg = ('No valid network provided or created, defaulting to '
'fixed_network_name')
if caller:
msg = '(%s) %s' % (caller, msg)
LOG.debug(msg)
try:
- network = get_network_from_name(fixed_network_name,
+ network = get_network_from_name(shared_network_name,
compute_networks_client)
- except exceptions.InvalidConfiguration:
+ except exceptions.InvalidTestResource:
network = {}
msg = ('Found network %s available for tenant' % network)
if caller:
diff --git a/tempest/common/glance_http.py b/tempest/common/glance_http.py
index e5431a0..800e977 100644
--- a/tempest/common/glance_http.py
+++ b/tempest/common/glance_http.py
@@ -24,12 +24,10 @@
import OpenSSL
from oslo_log import log as logging
-from oslo_serialization import jsonutils as json
import six
from six import moves
from six.moves import http_client as httplib
from six.moves.urllib import parse as urlparse
-from tempest_lib import exceptions as lib_exc
from tempest import exceptions as exc
@@ -51,19 +49,20 @@
self.endpoint_port = endpoint_parts.port
self.endpoint_path = endpoint_parts.path
- self.connection_class = self.get_connection_class(self.endpoint_scheme)
- self.connection_kwargs = self.get_connection_kwargs(
+ self.connection_class = self._get_connection_class(
+ self.endpoint_scheme)
+ self.connection_kwargs = self._get_connection_kwargs(
self.endpoint_scheme, **kwargs)
@staticmethod
- def get_connection_class(scheme):
+ def _get_connection_class(scheme):
if scheme == 'https':
return VerifiedHTTPSConnection
else:
return httplib.HTTPConnection
@staticmethod
- def get_connection_kwargs(scheme, **kwargs):
+ def _get_connection_kwargs(scheme, **kwargs):
_kwargs = {'timeout': float(kwargs.get('timeout', 600))}
if scheme == 'https':
@@ -75,7 +74,7 @@
return _kwargs
- def get_connection(self):
+ def _get_connection(self):
_class = self.connection_class
try:
return _class(self.endpoint_hostname, self.endpoint_port,
@@ -95,7 +94,7 @@
self._log_request(method, url, kwargs['headers'])
- conn = self.get_connection()
+ conn = self._get_connection()
try:
url_parts = urlparse.urlparse(url)
@@ -159,30 +158,6 @@
self.LOG.debug("Large body (%d) md5 summary: %s", length,
hashlib.md5(str_body).hexdigest())
- def json_request(self, method, url, **kwargs):
- kwargs.setdefault('headers', {})
- kwargs['headers'].setdefault('Content-Type', 'application/json')
- if kwargs['headers']['Content-Type'] != 'application/json':
- msg = "Only application/json content-type is supported."
- raise lib_exc.InvalidContentType(msg)
-
- if 'body' in kwargs:
- kwargs['body'] = json.dumps(kwargs['body'])
-
- resp, body_iter = self._http_request(url, method, **kwargs)
-
- if 'application/json' in resp.getheader('content-type', ''):
- body = ''.join([chunk for chunk in body_iter])
- try:
- body = json.loads(body)
- except ValueError:
- LOG.error('Could not decode response body as JSON')
- else:
- msg = "Only json/application content-type is supported."
- raise lib_exc.InvalidContentType(msg)
-
- return resp, body
-
def raw_request(self, method, url, **kwargs):
kwargs.setdefault('headers', {})
kwargs['headers'].setdefault('Content-Type',
diff --git a/tempest/common/identity.py b/tempest/common/identity.py
index 303f620..2179363 100644
--- a/tempest/common/identity.py
+++ b/tempest/common/identity.py
@@ -22,3 +22,11 @@
if tenant['name'] == tenant_name:
return tenant
raise lib_exc.NotFound('No such tenant(%s) in %s' % (tenant_name, tenants))
+
+
+def get_user_by_username(client, tenant_id, username):
+ users = client.list_tenant_users(tenant_id)['users']
+ for user in users:
+ if user['name'] == username:
+ return user
+ raise lib_exc.NotFound('No such user(%s) in %s' % (username, users))
diff --git a/tempest/common/preprov_creds.py b/tempest/common/preprov_creds.py
index f711302..74cc3f0 100644
--- a/tempest/common/preprov_creds.py
+++ b/tempest/common/preprov_creds.py
@@ -19,15 +19,14 @@
from oslo_log import log as logging
import six
from tempest_lib import auth
+from tempest_lib import exceptions as lib_exc
import yaml
from tempest import clients
from tempest.common import cred_provider
from tempest.common import fixed_network
-from tempest import config
from tempest import exceptions
-CONF = config.CONF
LOG = logging.getLogger(__name__)
@@ -39,21 +38,52 @@
class PreProvisionedCredentialProvider(cred_provider.CredentialProvider):
- def __init__(self, identity_version, name=None, credentials_domain=None,
- admin_role=None):
+ def __init__(self, identity_version, test_accounts_file,
+ accounts_lock_dir, name=None, credentials_domain=None,
+ admin_role=None, object_storage_operator_role=None,
+ object_storage_reseller_admin_role=None):
+ """Credentials provider using pre-provisioned accounts
+
+ This credentials provider loads the details of pre-provisioned
+ accounts from a YAML file, in the format specified by
+ `etc/accounts.yaml.sample`. It locks accounts while in use, using the
+ external locking mechanism, allowing for multiple python processes
+ to share a single account file, and thus running tests in parallel.
+
+ The accounts_lock_dir must be generated using `lockutils.get_lock_path`
+ from the oslo.concurrency library. For instance:
+
+ accounts_lock_dir = os.path.join(lockutils.get_lock_path(CONF),
+ 'test_accounts')
+
+ Role names for object storage are optional as long as the
+ `operator` and `reseller_admin` credential types are not used in the
+ accounts file.
+
+ :param identity_version: identity version of the credentials
+ :param admin_role: name of the admin role
+ :param test_accounts_file: path to the accounts YAML file
+ :param accounts_lock_dir: the directory for external locking
+ :param name: name of the hash file (optional)
+ :param credentials_domain: name of the domain credentials belong to
+ (if no domain is configured)
+ :param object_storage_operator_role: name of the role
+ :param object_storage_reseller_admin_role: name of the role
+ """
super(PreProvisionedCredentialProvider, self).__init__(
identity_version=identity_version, name=name,
- credentials_domain=credentials_domain, admin_role=admin_role)
- if (CONF.auth.test_accounts_file and
- os.path.isfile(CONF.auth.test_accounts_file)):
- accounts = read_accounts_yaml(CONF.auth.test_accounts_file)
+ admin_role=admin_role, credentials_domain=credentials_domain)
+ self.test_accounts_file = test_accounts_file
+ if test_accounts_file and os.path.isfile(test_accounts_file):
+ accounts = read_accounts_yaml(self.test_accounts_file)
self.use_default_creds = False
else:
accounts = {}
self.use_default_creds = True
- self.hash_dict = self.get_hash_dict(accounts, admin_role)
- self.accounts_dir = os.path.join(lockutils.get_lock_path(CONF),
- 'test_accounts')
+ self.hash_dict = self.get_hash_dict(
+ accounts, admin_role, object_storage_operator_role,
+ object_storage_reseller_admin_role)
+ self.accounts_dir = accounts_lock_dir
self._creds = {}
@classmethod
@@ -65,7 +95,9 @@
return hash_dict
@classmethod
- def get_hash_dict(cls, accounts, admin_role):
+ def get_hash_dict(cls, accounts, admin_role,
+ object_storage_operator_role=None,
+ object_storage_reseller_admin_role=None):
hash_dict = {'roles': {}, 'creds': {}, 'networks': {}}
# Loop over the accounts read from the yaml file
for account in accounts:
@@ -92,14 +124,24 @@
hash_dict = cls._append_role(admin_role, temp_hash_key,
hash_dict)
elif type == 'operator':
- hash_dict = cls._append_role(
- CONF.object_storage.operator_role, temp_hash_key,
- hash_dict)
+ if object_storage_operator_role:
+ hash_dict = cls._append_role(
+ object_storage_operator_role, temp_hash_key,
+ hash_dict)
+ else:
+ msg = ("Type 'operator' configured, but no "
+ "object_storage_operator_role specified")
+ raise lib_exc.InvalidCredentials(msg)
elif type == 'reseller_admin':
- hash_dict = cls._append_role(
- CONF.object_storage.reseller_admin_role,
- temp_hash_key,
- hash_dict)
+ if object_storage_reseller_admin_role:
+ hash_dict = cls._append_role(
+ object_storage_reseller_admin_role,
+ temp_hash_key,
+ hash_dict)
+ else:
+ msg = ("Type 'reseller_admin' configured, but no "
+ "object_storage_reseller_admin_role specified")
+ raise lib_exc.InvalidCredentials(msg)
# Populate the network subdict
for resource in resources:
if resource == 'network':
@@ -112,8 +154,8 @@
def is_multi_user(self):
# Default credentials is not a valid option with locking Account
if self.use_default_creds:
- raise exceptions.InvalidConfiguration(
- "Account file %s doesn't exist" % CONF.auth.test_accounts_file)
+ raise lib_exc.InvalidCredentials(
+ "Account file %s doesn't exist" % self.test_accounts_file)
else:
return len(self.hash_dict['creds']) > 1
@@ -149,7 +191,7 @@
names.append(fd.read())
msg = ('Insufficient number of users provided. %s have allocated all '
'the credentials for this allocation request' % ','.join(names))
- raise exceptions.InvalidConfiguration(msg)
+ raise lib_exc.InvalidCredentials(msg)
def _get_match_hash_list(self, roles=None):
hashes = []
@@ -159,7 +201,7 @@
for role in roles:
temp_hashes = self.hash_dict['roles'].get(role, None)
if not temp_hashes:
- raise exceptions.InvalidConfiguration(
+ raise lib_exc.InvalidCredentials(
"No credentials with role: %s specified in the "
"accounts ""file" % role)
hashes.append(temp_hashes)
@@ -191,8 +233,8 @@
def _get_creds(self, roles=None):
if self.use_default_creds:
- raise exceptions.InvalidConfiguration(
- "Account file %s doesn't exist" % CONF.auth.test_accounts_file)
+ raise lib_exc.InvalidCredentials(
+ "Account file %s doesn't exist" % self.test_accounts_file)
useable_hashes = self._get_match_hash_list(roles)
free_hash = self._get_free_hash(useable_hashes)
clean_creds = self._sanitize_creds(
@@ -297,7 +339,7 @@
try:
network = fixed_network.get_network_from_name(
net_name, compute_network_client)
- except exceptions.InvalidConfiguration:
+ except exceptions.InvalidTestResource:
network = {}
net_creds.set_resources(network=network)
return net_creds
diff --git a/tempest/common/utils/linux/remote_client.py b/tempest/common/utils/linux/remote_client.py
index 10654ff..025b79f 100644
--- a/tempest/common/utils/linux/remote_client.py
+++ b/tempest/common/utils/linux/remote_client.py
@@ -95,15 +95,24 @@
return self.exec_command(cmd)
def ping_host(self, host, count=CONF.compute.ping_count,
- size=CONF.compute.ping_size):
+ size=CONF.compute.ping_size, nic=None):
addr = netaddr.IPAddress(host)
cmd = 'ping6' if addr.version == 6 else 'ping'
+ if nic:
+ cmd = 'sudo {cmd} -I {nic}'.format(cmd=cmd, nic=nic)
cmd += ' -c{0} -w{0} -s{1} {2}'.format(count, size, host)
return self.exec_command(cmd)
- def get_mac_address(self):
- cmd = "ip addr | awk '/ether/ {print $2}'"
- return self.exec_command(cmd)
+ def set_mac_address(self, nic, address):
+ self.set_nic_state(nic=nic, state="down")
+ cmd = "sudo ip link set dev {0} address {1}".format(nic, address)
+ self.exec_command(cmd)
+ self.set_nic_state(nic=nic, state="up")
+
+ def get_mac_address(self, nic=""):
+ show_nic = "show {nic} ".format(nic=nic) if nic else ""
+ cmd = "ip addr %s| awk '/ether/ {print $2}'" % show_nic
+ return self.exec_command(cmd).strip().lower()
def get_nic_name(self, address):
cmd = "ip -o addr | awk '/%s/ {print $2}'" % address
@@ -121,8 +130,8 @@
)
return self.exec_command(cmd)
- def turn_nic_on(self, nic):
- cmd = "sudo ip link set {nic} up".format(nic=nic)
+ def set_nic_state(self, nic, state="up"):
+ cmd = "sudo ip link set {nic} {state}".format(nic=nic, state=state)
return self.exec_command(cmd)
def get_pids(self, pr_name):
diff --git a/tempest/config.py b/tempest/config.py
index 26823de..8c3656f 100644
--- a/tempest/config.py
+++ b/tempest/config.py
@@ -237,10 +237,6 @@
cfg.StrOpt('image_ssh_password',
default="password",
help="Password used to authenticate to an instance."),
- cfg.StrOpt('image_alt_ssh_user',
- default="root",
- help="User name used to authenticate to an instance using "
- "the alternate image."),
cfg.IntOpt('build_interval',
default=1,
help="Time in seconds between build status checks."),
@@ -726,11 +722,21 @@
'publicURL', 'adminURL', 'internalURL'],
help="The endpoint type to use for the volume service."),
cfg.StrOpt('backend1_name',
- default='BACKEND_1',
- help="Name of the backend1 (must be declared in cinder.conf)"),
+ default='',
+ help='Name of the backend1 (must be declared in cinder.conf)',
+ deprecated_for_removal=True),
cfg.StrOpt('backend2_name',
- default='BACKEND_2',
- help="Name of the backend2 (must be declared in cinder.conf)"),
+ default='',
+ help='Name of the backend2 (must be declared in cinder.conf)',
+ deprecated_for_removal=True),
+ cfg.ListOpt('backend_names',
+ default=['BACKEND_1', 'BACKEND_2'],
+ help='A list of backend names seperated by comma .'
+ 'The backend name must be declared in cinder.conf',
+ deprecated_opts=[cfg.DeprecatedOpt('BACKEND_1',
+ group='volume'),
+ cfg.DeprecatedOpt('BACKEND_2',
+ group='volume')]),
cfg.StrOpt('storage_protocol',
default='iSCSI',
help='Backend protocol to target when creating volume types'),
@@ -921,6 +927,20 @@
"notification tests")
]
+alarming_group = cfg.OptGroup(name='alarming',
+ title='Alarming Service Options')
+
+AlarmingGroup = [
+ cfg.StrOpt('catalog_type',
+ default='alarming',
+ help="Catalog type of the Alarming service."),
+ cfg.StrOpt('endpoint_type',
+ default='publicURL',
+ choices=['public', 'admin', 'internal',
+ 'publicURL', 'adminURL', 'internalURL'],
+ help="The endpoint type to use for the alarming service."),
+]
+
telemetry_feature_group = cfg.OptGroup(name='telemetry-feature-enabled',
title='Enabled Ceilometer Features')
@@ -1131,6 +1151,9 @@
cfg.BoolOpt('ceilometer',
default=True,
help="Whether or not Ceilometer is expected to be available"),
+ cfg.BoolOpt('aodh',
+ default=False,
+ help="Whether or not Aodh is expected to be available"),
cfg.BoolOpt('horizon',
default=True,
help="Whether or not Horizon is expected to be available"),
@@ -1277,6 +1300,7 @@
(orchestration_group, OrchestrationGroup),
(telemetry_group, TelemetryGroup),
(telemetry_feature_group, TelemetryFeaturesGroup),
+ (alarming_group, AlarmingGroup),
(dashboard_group, DashboardGroup),
(data_processing_group, DataProcessingGroup),
(data_processing_feature_group, DataProcessingFeaturesGroup),
diff --git a/tempest/exceptions.py b/tempest/exceptions.py
index c23e70c..031df7f 100644
--- a/tempest/exceptions.py
+++ b/tempest/exceptions.py
@@ -139,6 +139,13 @@
message = "%(num)d cleanUp operation failed"
+# NOTE(andreaf) This exception is added here to facilitate the migration
+# of get_network_from_name and preprov_creds to tempest-lib, and it should
+# be migrated along with them
+class InvalidTestResource(TempestException):
+ message = "%(name) is not a valid %(type), or the name is ambiguous"
+
+
class RFCViolation(RestClientException):
message = "RFC Violation"
diff --git a/tempest/hacking/checks.py b/tempest/hacking/checks.py
index 936fbe8..1dad3ba 100644
--- a/tempest/hacking/checks.py
+++ b/tempest/hacking/checks.py
@@ -32,6 +32,7 @@
TESTTOOLS_SKIP_DECORATOR = re.compile(r'\s*@testtools\.skip\((.*)\)')
METHOD = re.compile(r"^ def .+")
METHOD_GET_RESOURCE = re.compile(r"^\s*def (list|show)\_.+")
+METHOD_DELETE_RESOURCE = re.compile(r"^\s*def delete_.+")
CLASS = re.compile(r"^class .+")
@@ -146,27 +147,37 @@
"decorators.skip_because from tempest-lib")
+def _common_service_clients_check(logical_line, physical_line, filename,
+ ignored_list_file=None):
+ if 'tempest/services/' not in filename:
+ return False
+
+ if ignored_list_file is not None:
+ ignored_list = []
+ with open('tempest/hacking/' + ignored_list_file) as f:
+ for line in f:
+ ignored_list.append(line.strip())
+
+ if filename in ignored_list:
+ return False
+
+ if not METHOD.match(physical_line):
+ return False
+
+ if pep8.noqa(physical_line):
+ return False
+
+ return True
+
+
def get_resources_on_service_clients(logical_line, physical_line, filename,
line_number, lines):
"""Check that service client names of GET should be consistent
T110
"""
- if 'tempest/services/' not in filename:
- return
-
- ignored_list = []
- with open('tempest/hacking/ignored_list_T110.txt') as f:
- for line in f:
- ignored_list.append(line.strip())
-
- if filename in ignored_list:
- return
-
- if not METHOD.match(physical_line):
- return
-
- if pep8.noqa(physical_line):
+ if not _common_service_clients_check(logical_line, physical_line,
+ filename, 'ignored_list_T110.txt'):
return
for line in lines[line_number:]:
@@ -185,6 +196,32 @@
yield (0, msg)
+def delete_resources_on_service_clients(logical_line, physical_line, filename,
+ line_number, lines):
+ """Check that service client names of DELETE should be consistent
+
+ T111
+ """
+ if not _common_service_clients_check(logical_line, physical_line,
+ filename, 'ignored_list_T111.txt'):
+ return
+
+ for line in lines[line_number:]:
+ if METHOD.match(line) or CLASS.match(line):
+ # the end of a method
+ return
+
+ if 'self.delete(' not in line:
+ continue
+
+ if METHOD_DELETE_RESOURCE.match(logical_line):
+ return
+
+ msg = ("T111: [DELETE /resources/<id>] methods should be "
+ "delete_<resource name>")
+ yield (0, msg)
+
+
def factory(register):
register(import_no_clients_in_api_and_scenario_tests)
register(scenario_tests_need_service_tags)
@@ -195,3 +232,4 @@
register(no_mutable_default_args)
register(no_testtools_skip_decorator)
register(get_resources_on_service_clients)
+ register(delete_resources_on_service_clients)
diff --git a/tempest/hacking/ignored_list_T110.txt b/tempest/hacking/ignored_list_T110.txt
index d671616..211a7d6 100644
--- a/tempest/hacking/ignored_list_T110.txt
+++ b/tempest/hacking/ignored_list_T110.txt
@@ -1,14 +1,12 @@
-./tempest/services/compute/json/servers_client.py
./tempest/services/database/json/flavors_client.py
./tempest/services/identity/v3/json/credentials_client.py
-./tempest/services/identity/v3/json/groups_client.py
./tempest/services/identity/v3/json/identity_client.py
./tempest/services/identity/v3/json/policy_client.py
./tempest/services/identity/v3/json/region_client.py
./tempest/services/messaging/json/messaging_client.py
./tempest/services/object_storage/object_client.py
+./tempest/services/telemetry/json/alarming_client.py
./tempest/services/telemetry/json/telemetry_client.py
-./tempest/services/volume/json/qos_client.py
-./tempest/services/volume/json/backups_client.py
-./tempest/services/image/v2/json/image_client.py
+./tempest/services/volume/base/base_qos_client.py
+./tempest/services/volume/base/base_backups_client.py
./tempest/services/baremetal/base.py
diff --git a/tempest/hacking/ignored_list_T111.txt b/tempest/hacking/ignored_list_T111.txt
new file mode 100644
index 0000000..8017e76
--- /dev/null
+++ b/tempest/hacking/ignored_list_T111.txt
@@ -0,0 +1 @@
+./tempest/services/baremetal/base.py
diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py
index 147c0ba..64f9e31 100644
--- a/tempest/scenario/manager.py
+++ b/tempest/scenario/manager.py
@@ -23,7 +23,7 @@
from tempest_lib.common.utils import misc as misc_utils
from tempest_lib import exceptions as lib_exc
-from tempest.common import fixed_network
+from tempest.common import compute
from tempest.common.utils import data_utils
from tempest.common.utils.linux import remote_client
from tempest.common import waiters
@@ -158,52 +158,100 @@
return body['keypair']
def create_server(self, name=None, image=None, flavor=None,
- wait_on_boot=True, wait_on_delete=True,
- create_kwargs=None):
- """Creates VM instance.
+ validatable=False, wait_until=None,
+ wait_on_delete=True, clients=None, **kwargs):
+ """Wrapper utility that returns a test server.
- @param image: image from which to create the instance
- @param wait_on_boot: wait for status ACTIVE before continue
- @param wait_on_delete: force synchronous delete on cleanup
- @param create_kwargs: additional details for instance creation
- @return: server dict
+ This wrapper utility calls the common create test server and
+ returns a test server. The purpose of this wrapper is to minimize
+ the impact on the code of the tests already using this
+ function.
"""
- if name is None:
- name = data_utils.rand_name(self.__class__.__name__)
- if image is None:
- image = CONF.compute.image_ref
- if flavor is None:
- flavor = CONF.compute.flavor_ref
- if create_kwargs is None:
- create_kwargs = {}
- network = self.get_tenant_network()
- create_kwargs = fixed_network.set_networks_kwarg(network,
- create_kwargs)
- LOG.debug("Creating a server (name: %s, image: %s, flavor: %s)",
- name, image, flavor)
- server = self.servers_client.create_server(name=name, imageRef=image,
- flavorRef=flavor,
- **create_kwargs)['server']
+ # NOTE(jlanoux): As a first step, ssh checks in the scenario
+ # tests need to be run regardless of the run_validation and
+ # validatable parameters and thus until the ssh validation job
+ # becomes voting in CI. The test resources management and IP
+ # association are taken care of in the scenario tests.
+ # Therefore, the validatable parameter is set to false in all
+ # those tests. In this way create_server just return a standard
+ # server and the scenario tests always perform ssh checks.
+
+ # Needed for the cross_tenant_traffic test:
+ if clients is None:
+ clients = self.manager
+
+ vnic_type = CONF.network.port_vnic_type
+
+ # If vnic_type is configured create port for
+ # every network
+ if vnic_type:
+ ports = []
+ networks = []
+ create_port_body = {'binding:vnic_type': vnic_type,
+ 'namestart': 'port-smoke'}
+ if kwargs:
+ # Convert security group names to security group ids
+ # to pass to create_port
+ if 'security_groups' in kwargs:
+ security_groups =\
+ clients.network_client.list_security_groups(
+ ).get('security_groups')
+ sec_dict = dict([(s['name'], s['id'])
+ for s in security_groups])
+
+ sec_groups_names = [s['name'] for s in kwargs.pop(
+ 'security_groups')]
+ security_groups_ids = [sec_dict[s]
+ for s in sec_groups_names]
+
+ if security_groups_ids:
+ create_port_body[
+ 'security_groups'] = security_groups_ids
+ networks = kwargs.pop('networks')
+
+ # If there are no networks passed to us we look up
+ # for the tenant's private networks and create a port
+ # if there is only one private network. The same behaviour
+ # as we would expect when passing the call to the clients
+ # with no networks
+ if not networks:
+ networks = clients.networks_client.list_networks(
+ filters={'router:external': False})
+ self.assertEqual(1, len(networks),
+ "There is more than one"
+ " network for the tenant")
+ for net in networks:
+ net_id = net['uuid']
+ port = self._create_port(network_id=net_id,
+ client=clients.ports_client,
+ **create_port_body)
+ ports.append({'port': port.id})
+ if ports:
+ kwargs['networks'] = ports
+ self.ports = ports
+
+ tenant_network = self.get_tenant_network()
+
+ body, servers = compute.create_test_server(
+ clients,
+ tenant_network=tenant_network,
+ wait_until=wait_until,
+ **kwargs)
+
+ # TODO(jlanoux) Move wait_on_delete in compute.py
if wait_on_delete:
self.addCleanup(waiters.wait_for_server_termination,
- self.servers_client,
- server['id'])
+ clients.servers_client,
+ body['id'])
+
self.addCleanup_with_wait(
waiter_callable=waiters.wait_for_server_termination,
- thing_id=server['id'], thing_id_param='server_id',
+ thing_id=body['id'], thing_id_param='server_id',
cleanup_callable=self.delete_wrapper,
- cleanup_args=[self.servers_client.delete_server, server['id']],
- waiter_client=self.servers_client)
- if wait_on_boot:
- waiters.wait_for_server_status(self.servers_client,
- server_id=server['id'],
- status='ACTIVE')
- # The instance retrieved on creation is missing network
- # details, necessitating retrieval after it becomes active to
- # ensure correct details.
- server = self.servers_client.show_server(server['id'])['server']
- self.assertEqual(server['name'], name)
+ cleanup_args=[clients.servers_client.delete_server, body['id']],
+ waiter_client=clients.servers_client)
+ server = clients.servers_client.show_server(body['id'])['server']
return server
def create_volume(self, size=None, name=None, snapshot_id=None,
@@ -321,7 +369,7 @@
username = CONF.scenario.ssh_user
# Set this with 'keypair' or others to log in with keypair or
# username/password.
- if CONF.compute.ssh_auth_method == 'keypair':
+ if CONF.validation.auth_method == 'keypair':
password = None
if private_key is None:
private_key = self.keypair['private_key']
@@ -381,20 +429,22 @@
(img_path, img_container_format, img_disk_format,
img_properties, ami_img_path, ari_img_path, aki_img_path))
try:
- self.image = self._image_create('scenario-img',
- img_container_format,
- img_path,
- disk_format=img_disk_format,
- properties=img_properties)
+ image = self._image_create('scenario-img',
+ img_container_format,
+ img_path,
+ disk_format=img_disk_format,
+ properties=img_properties)
except IOError:
LOG.debug("A qcow2 image was not found. Try to get a uec image.")
kernel = self._image_create('scenario-aki', 'aki', aki_img_path)
ramdisk = self._image_create('scenario-ari', 'ari', ari_img_path)
properties = {'kernel_id': kernel, 'ramdisk_id': ramdisk}
- self.image = self._image_create('scenario-ami', 'ami',
- path=ami_img_path,
- properties=properties)
- LOG.debug("image:%s" % self.image)
+ image = self._image_create('scenario-ami', 'ami',
+ path=ami_img_path,
+ properties=properties)
+ LOG.debug("image:%s" % image)
+
+ return image
def _log_console_output(self, servers=None):
if not CONF.compute_feature_enabled.console_output:
@@ -489,7 +539,7 @@
def ping_ip_address(self, ip_address, should_succeed=True,
ping_timeout=None):
- timeout = ping_timeout or CONF.compute.ping_timeout
+ timeout = ping_timeout or CONF.validation.ping_timeout
cmd = ['ping', '-c1', '-w1', ip_address]
def ping():
@@ -694,8 +744,8 @@
def cidr_in_use(cidr, tenant_id):
"""Check cidr existence
- :return True if subnet with cidr already exist in tenant
- False else
+ :returns: True if subnet with cidr already exist in tenant
+ False else
"""
cidr_in_use = self._list_subnets(tenant_id=tenant_id, cidr=cidr)
return len(cidr_in_use) != 0
@@ -863,18 +913,20 @@
self._log_net_info(e)
raise
- def _check_remote_connectivity(self, source, dest, should_succeed=True):
+ def _check_remote_connectivity(self, source, dest, should_succeed=True,
+ nic=None):
"""check ping server via source ssh connection
:param source: RemoteClient: an ssh connection from which to ping
:param dest: and IP to ping against
:param should_succeed: boolean should ping succeed or not
+ :param nic: specific network interface to ping from
:returns: boolean -- should_succeed == ping
:returns: ping is false if ping failed
"""
def ping_remote():
try:
- source.ping_host(dest)
+ source.ping_host(dest, nic=nic)
except lib_exc.SSHExecCommandFailed:
LOG.warn('Failed to ping IP: %s via a ssh connection from: %s.'
% (dest, source.ssh_client.host))
@@ -882,7 +934,7 @@
return should_succeed
return tempest.test.call_until_true(ping_remote,
- CONF.compute.ping_timeout,
+ CONF.validation.ping_timeout,
1)
def _create_security_group(self, client=None, tenant_id=None,
@@ -1133,71 +1185,6 @@
subnet.add_to_router(router.id)
return network, subnet, router
- def create_server(self, name=None, image=None, flavor=None,
- wait_on_boot=True, wait_on_delete=True,
- network_client=None, networks_client=None,
- ports_client=None, create_kwargs=None):
- if network_client is None:
- network_client = self.network_client
- if networks_client is None:
- networks_client = self.networks_client
- if ports_client is None:
- ports_client = self.ports_client
-
- vnic_type = CONF.network.port_vnic_type
-
- # If vnic_type is configured create port for
- # every network
- if vnic_type:
- ports = []
- networks = []
- create_port_body = {'binding:vnic_type': vnic_type,
- 'namestart': 'port-smoke'}
- if create_kwargs:
- # Convert security group names to security group ids
- # to pass to create_port
- if create_kwargs.get('security_groups'):
- security_groups = network_client.list_security_groups(
- ).get('security_groups')
- sec_dict = dict([(s['name'], s['id'])
- for s in security_groups])
-
- sec_groups_names = [s['name'] for s in create_kwargs.get(
- 'security_groups')]
- security_groups_ids = [sec_dict[s]
- for s in sec_groups_names]
-
- if security_groups_ids:
- create_port_body[
- 'security_groups'] = security_groups_ids
- networks = create_kwargs.get('networks')
-
- # If there are no networks passed to us we look up
- # for the tenant's private networks and create a port
- # if there is only one private network. The same behaviour
- # as we would expect when passing the call to the clients
- # with no networks
- if not networks:
- networks = networks_client.list_networks(filters={
- 'router:external': False})
- self.assertEqual(1, len(networks),
- "There is more than one"
- " network for the tenant")
- for net in networks:
- net_id = net['uuid']
- port = self._create_port(network_id=net_id,
- client=ports_client,
- **create_port_body)
- ports.append({'port': port.id})
- if ports:
- create_kwargs['networks'] = ports
- self.ports = ports
-
- return super(NetworkScenarioTest, self).create_server(
- name=name, image=image, flavor=flavor,
- wait_on_boot=wait_on_boot, wait_on_delete=wait_on_delete,
- create_kwargs=create_kwargs)
-
# power/provision states as of icehouse
class BaremetalPowerStates(object):
@@ -1320,11 +1307,8 @@
dest.validate_authentication()
def boot_instance(self):
- create_kwargs = {
- 'key_name': self.keypair['name']
- }
self.instance = self.create_server(
- wait_on_boot=False, create_kwargs=create_kwargs)
+ key_name=self.keypair['name'])
self.wait_node(self.instance['id'])
self.node = self.get_node(instance_id=self.instance['id'])
@@ -1370,16 +1354,6 @@
else:
cls.admin_volume_types_client = cls.os_adm.volume_types_v2_client
- def _wait_for_volume_status(self, status):
- self.status_timeout(
- self.volume_client.volumes, self.volume.id, status)
-
- def nova_boot(self):
- self.keypair = self.create_keypair()
- create_kwargs = {'key_name': self.keypair['name']}
- self.server = self.create_server(image=self.image,
- create_kwargs=create_kwargs)
-
def create_volume_type(self, client=None, name=None):
if not client:
client = self.admin_volume_types_client
diff --git a/tempest/scenario/test_baremetal_basic_ops.py b/tempest/scenario/test_baremetal_basic_ops.py
index e629f0a..9415629 100644
--- a/tempest/scenario/test_baremetal_basic_ops.py
+++ b/tempest/scenario/test_baremetal_basic_ops.py
@@ -113,7 +113,7 @@
self.boot_instance()
self.validate_ports()
self.verify_connectivity()
- if CONF.compute.ssh_connect_method == 'floating':
+ if CONF.validation.connect_method == 'floating':
floating_ip = self.create_floating_ip(self.instance)['ip']
self.verify_connectivity(ip=floating_ip)
diff --git a/tempest/scenario/test_encrypted_cinder_volumes.py b/tempest/scenario/test_encrypted_cinder_volumes.py
index 99837eb..dcd77ad 100644
--- a/tempest/scenario/test_encrypted_cinder_volumes.py
+++ b/tempest/scenario/test_encrypted_cinder_volumes.py
@@ -42,8 +42,12 @@
raise cls.skipException('Encrypted volume attach is not supported')
def launch_instance(self):
- self.glance_image_create()
- self.nova_boot()
+ image = self.glance_image_create()
+ keypair = self.create_keypair()
+
+ return self.create_server(image_id=image,
+ key_name=keypair['name'],
+ wait_until='ACTIVE')
def create_encrypted_volume(self, encryption_provider, volume_type):
volume_type = self.create_volume_type(name=volume_type)
@@ -52,26 +56,26 @@
key_size=512,
cipher='aes-xts-plain64',
control_location='front-end')
- self.volume = self.create_volume(volume_type=volume_type['name'])
+ return self.create_volume(volume_type=volume_type['name'])
- def attach_detach_volume(self):
- self.volume = self.nova_volume_attach(self.server, self.volume)
- self.nova_volume_detach(self.server, self.volume)
+ def attach_detach_volume(self, server, volume):
+ attached_volume = self.nova_volume_attach(server, volume)
+ self.nova_volume_detach(server, attached_volume)
@test.idempotent_id('79165fb4-5534-4b9d-8429-97ccffb8f86e')
@test.services('compute', 'volume', 'image')
def test_encrypted_cinder_volumes_luks(self):
- self.launch_instance()
- self.create_encrypted_volume('nova.volume.encryptors.'
- 'luks.LuksEncryptor',
- volume_type='luks')
- self.attach_detach_volume()
+ server = self.launch_instance()
+ volume = self.create_encrypted_volume('nova.volume.encryptors.'
+ 'luks.LuksEncryptor',
+ volume_type='luks')
+ self.attach_detach_volume(server, volume)
@test.idempotent_id('cbc752ed-b716-4717-910f-956cce965722')
@test.services('compute', 'volume', 'image')
def test_encrypted_cinder_volumes_cryptsetup(self):
- self.launch_instance()
- self.create_encrypted_volume('nova.volume.encryptors.'
- 'cryptsetup.CryptsetupEncryptor',
- volume_type='cryptsetup')
- self.attach_detach_volume()
+ server = self.launch_instance()
+ volume = self.create_encrypted_volume('nova.volume.encryptors.'
+ 'cryptsetup.CryptsetupEncryptor',
+ volume_type='cryptsetup')
+ self.attach_detach_volume(server, volume)
diff --git a/tempest/scenario/test_large_ops.py b/tempest/scenario/test_large_ops.py
index 6497f7a..f45fb3a 100644
--- a/tempest/scenario/test_large_ops.py
+++ b/tempest/scenario/test_large_ops.py
@@ -79,7 +79,7 @@
waiters.wait_for_server_status(self.servers_client,
server['id'], status)
- def nova_boot(self):
+ def nova_boot(self, image):
name = data_utils.rand_name('scenario-server')
flavor_id = CONF.compute.flavor_ref
# Explicitly create secgroup to avoid cleanup at the end of testcases.
@@ -99,7 +99,7 @@
create_kwargs)
self.servers_client.create_server(
name=name,
- imageRef=self.image,
+ imageRef=image,
flavorRef=flavor_id,
**create_kwargs)
# needed because of bug 1199788
@@ -118,8 +118,8 @@
self._wait_for_server_status('ACTIVE')
def _large_ops_scenario(self):
- self.glance_image_create()
- self.nova_boot()
+ image = self.glance_image_create()
+ self.nova_boot(image)
@test.idempotent_id('14ba0e78-2ed9-4d17-9659-a48f4756ecb3')
@test.services('compute', 'image')
diff --git a/tempest/scenario/test_minimum_basic.py b/tempest/scenario/test_minimum_basic.py
index a5b5a1b..25e3e6f 100644
--- a/tempest/scenario/test_minimum_basic.py
+++ b/tempest/scenario/test_minimum_basic.py
@@ -58,11 +58,6 @@
waiters.wait_for_server_status(self.servers_client,
server_id, status)
- def nova_boot(self, keypair):
- create_kwargs = {'key_name': keypair['name']}
- return self.create_server(image=self.image,
- create_kwargs=create_kwargs)
-
def nova_list(self):
servers = self.servers_client.list_servers()
# The list servers in the compute client is inconsistent...
@@ -119,11 +114,12 @@
@test.idempotent_id('bdbb5441-9204-419d-a225-b4fdbfb1a1a8')
@test.services('compute', 'volume', 'image', 'network')
def test_minimum_basic_scenario(self):
- self.glance_image_create()
-
+ image = self.glance_image_create()
keypair = self.create_keypair()
- server = self.nova_boot(keypair)
+ server = self.create_server(image_id=image,
+ key_name=keypair['name'],
+ wait_until='ACTIVE')
servers = self.nova_list()
self.assertIn(server['id'], [x['id'] for x in servers])
diff --git a/tempest/scenario/test_network_advanced_server_ops.py b/tempest/scenario/test_network_advanced_server_ops.py
index 3689508..a45a730 100644
--- a/tempest/scenario/test_network_advanced_server_ops.py
+++ b/tempest/scenario/test_network_advanced_server_ops.py
@@ -57,16 +57,13 @@
security_group = self._create_security_group()
network, subnet, router = self.create_networks()
public_network_id = CONF.network.public_network_id
- create_kwargs = {
- 'networks': [
- {'uuid': network.id},
- ],
- 'key_name': keypair['name'],
- 'security_groups': [{'name': security_group['name']}],
- }
server_name = data_utils.rand_name('server-smoke')
- server = self.create_server(name=server_name,
- create_kwargs=create_kwargs)
+ server = self.create_server(
+ name=server_name,
+ networks=[{'uuid': network.id}],
+ key_name=keypair['name'],
+ security_groups=[{'name': security_group['name']}],
+ wait_until='ACTIVE')
floating_ip = self.create_floating_ip(server, public_network_id)
# Verify that we can indeed connect to the server before we mess with
# it's state
diff --git a/tempest/scenario/test_network_basic_ops.py b/tempest/scenario/test_network_basic_ops.py
index 8fefd9e..41d13fe 100644
--- a/tempest/scenario/test_network_basic_ops.py
+++ b/tempest/scenario/test_network_basic_ops.py
@@ -155,16 +155,16 @@
keypair = self.create_keypair()
self.keypairs[keypair['name']] = keypair
security_groups = [{'name': self.security_group['name']}]
- create_kwargs = {
- 'networks': [
- {'uuid': network.id},
- ],
- 'key_name': keypair['name'],
- 'security_groups': security_groups,
- }
+ network = {'uuid': network.id}
if port_id is not None:
- create_kwargs['networks'][0]['port'] = port_id
- server = self.create_server(name=name, create_kwargs=create_kwargs)
+ network['port'] = port_id
+
+ server = self.create_server(
+ name=name,
+ networks=[network],
+ key_name=keypair['name'],
+ security_groups=security_groups,
+ wait_until='ACTIVE')
self.servers.append(server)
return server
@@ -287,7 +287,7 @@
num, new_nic = self.diff_list[0]
ssh_client.assign_static_ip(nic=new_nic,
addr=new_port.fixed_ips[0]['ip_address'])
- ssh_client.turn_nic_on(nic=new_nic)
+ ssh_client.set_nic_state(nic=new_nic)
def _get_server_nics(self, ssh_client):
reg = re.compile(r'(?P<num>\d+): (?P<nic_name>\w+):')
@@ -737,3 +737,49 @@
self.check_public_network_connectivity(
should_connect=True,
msg='After router rescheduling')
+
+ @test.requires_ext(service='network', extension='port-security')
+ @test.idempotent_id('7c0bb1a2-d053-49a4-98f9-ca1a1d849f63')
+ @test.services('compute', 'network')
+ def test_port_security_macspoofing_port(self):
+ """Tests port_security extension enforces mac spoofing
+
+ 1. create a new network
+ 2. connect VM to new network
+ 4. check VM can ping new network DHCP port
+ 5. spoof mac on new new network interface
+ 6. check Neutron enforces mac spoofing and blocks pings via spoofed
+ interface
+ 7. disable port-security on the spoofed port
+ 8. check Neutron allows pings via spoofed interface
+ """
+ spoof_mac = "00:00:00:00:00:01"
+
+ # Create server
+ self._setup_network_and_servers()
+ self.check_public_network_connectivity(should_connect=False)
+ self._create_new_network()
+ self._hotplug_server()
+ fip, server = self.floating_ip_tuple
+ new_ports = self._list_ports(device_id=server["id"],
+ network_id=self.new_net["id"])
+ spoof_port = new_ports[0]
+ private_key = self._get_server_key(server)
+ ssh_client = self.get_remote_client(fip.floating_ip_address,
+ private_key=private_key)
+ spoof_nic = ssh_client.get_nic_name(spoof_port["mac_address"])
+ dhcp_ports = self._list_ports(device_owner="network:dhcp",
+ network_id=self.new_net["id"])
+ new_net_dhcp = dhcp_ports[0]["fixed_ips"][0]["ip_address"]
+ self._check_remote_connectivity(ssh_client, dest=new_net_dhcp,
+ nic=spoof_nic, should_succeed=True)
+ ssh_client.set_mac_address(spoof_nic, spoof_mac)
+ new_mac = ssh_client.get_mac_address(nic=spoof_nic)
+ self.assertEqual(spoof_mac, new_mac)
+ self._check_remote_connectivity(ssh_client, dest=new_net_dhcp,
+ nic=spoof_nic, should_succeed=False)
+ self.ports_client.update_port(spoof_port["id"],
+ port_security_enabled=False,
+ security_groups=[])
+ self._check_remote_connectivity(ssh_client, dest=new_net_dhcp,
+ nic=spoof_nic, should_succeed=True)
diff --git a/tempest/scenario/test_network_v6.py b/tempest/scenario/test_network_v6.py
index 151eef8..d6ad46a 100644
--- a/tempest/scenario/test_network_v6.py
+++ b/tempest/scenario/test_network_v6.py
@@ -65,9 +65,6 @@
super(TestGettingAddress, self).setUp()
self.keypair = self.create_keypair()
self.sec_grp = self._create_security_group(tenant_id=self.tenant_id)
- self.srv_kwargs = {
- 'key_name': self.keypair['name'],
- 'security_groups': [{'name': self.sec_grp['name']}]}
def prepare_network(self, address6_mode, n_subnets6=1, dualnet=False):
"""Prepare network
@@ -119,11 +116,13 @@
def prepare_server(self, networks=None):
username = CONF.compute.image_ssh_user
- create_kwargs = self.srv_kwargs
networks = networks or [self.network]
- create_kwargs['networks'] = [{'uuid': n.id} for n in networks]
- srv = self.create_server(create_kwargs=create_kwargs)
+ srv = self.create_server(
+ key_name=self.keypair['name'],
+ security_groups=[{'name': self.sec_grp['name']}],
+ networks=[{'uuid': n.id} for n in networks],
+ wait_until='ACTIVE')
fip = self.create_floating_ip(thing=srv)
ips = self.define_server_ips(srv=srv)
ssh = self.get_remote_client(
@@ -148,7 +147,7 @@
"ports: %s")
% (self.network_v6, ports))
mac6 = ports[0]
- ssh.turn_nic_on(ssh.get_nic_name(mac6))
+ ssh.set_nic_state(ssh.get_nic_name(mac6))
def _prepare_and_test(self, address6_mode, n_subnets6=1, dualnet=False):
net_list = self.prepare_network(address6_mode=address6_mode,
@@ -181,10 +180,10 @@
guest_has_address, sshv4_2, ips_from_api_2['6'][i])
self.assertTrue(test.call_until_true(srv1_v6_addr_assigned,
- CONF.compute.ping_timeout, 1))
+ CONF.validation.ping_timeout, 1))
self.assertTrue(test.call_until_true(srv2_v6_addr_assigned,
- CONF.compute.ping_timeout, 1))
+ CONF.validation.ping_timeout, 1))
self._check_connectivity(sshv4_1, ips_from_api_2['4'])
self._check_connectivity(sshv4_2, ips_from_api_1['4'])
diff --git a/tempest/scenario/test_security_groups_basic_ops.py b/tempest/scenario/test_security_groups_basic_ops.py
index 6a23c4b..e266dc2 100644
--- a/tempest/scenario/test_security_groups_basic_ops.py
+++ b/tempest/scenario/test_security_groups_basic_ops.py
@@ -234,23 +234,16 @@
def _create_server(self, name, tenant, security_groups=None):
"""creates a server and assigns to security group"""
- self._set_compute_context(tenant)
if security_groups is None:
security_groups = [tenant.security_groups['default']]
security_groups_names = [{'name': s['name']} for s in security_groups]
- create_kwargs = {
- 'networks': [
- {'uuid': tenant.network.id},
- ],
- 'key_name': tenant.keypair['name'],
- 'security_groups': security_groups_names
- }
server = self.create_server(
name=name,
- network_client=tenant.manager.network_client,
- networks_client=tenant.manager.networks_client,
- ports_client=tenant.manager.ports_client,
- create_kwargs=create_kwargs)
+ networks=[{'uuid': tenant.network.id}],
+ key_name=tenant.keypair['name'],
+ security_groups=security_groups_names,
+ wait_until='ACTIVE',
+ clients=tenant.manager)
self.assertEqual(
sorted([s['name'] for s in security_groups]),
sorted([s['name'] for s in server['security_groups']]))
@@ -293,10 +286,6 @@
subnets_client=tenant.manager.subnets_client)
tenant.set_network(network, subnet, router)
- def _set_compute_context(self, tenant):
- self.servers_client = tenant.manager.servers_client
- return self.servers_client
-
def _deploy_tenant(self, tenant_or_id):
"""creates:
@@ -310,7 +299,6 @@
tenant = self.tenants[tenant_or_id]
else:
tenant = tenant_or_id
- self._set_compute_context(tenant)
self._create_tenant_keypairs(tenant)
self._create_tenant_network(tenant)
self._create_tenant_security_groups(tenant)
diff --git a/tempest/scenario/test_server_advanced_ops.py b/tempest/scenario/test_server_advanced_ops.py
index 9387dc7..4b932ce 100644
--- a/tempest/scenario/test_server_advanced_ops.py
+++ b/tempest/scenario/test_server_advanced_ops.py
@@ -53,7 +53,7 @@
@test.services('compute')
def test_resize_server_confirm(self):
# We create an instance for use in this test
- instance = self.create_server()
+ instance = self.create_server(wait_until='ACTIVE')
instance_id = instance['id']
resize_flavor = CONF.compute.flavor_ref_alt
LOG.debug("Resizing instance %s from flavor %s to flavor %s",
@@ -74,7 +74,7 @@
@test.services('compute')
def test_server_sequence_suspend_resume(self):
# We create an instance for use in this test
- instance = self.create_server()
+ instance = self.create_server(wait_until='ACTIVE')
instance_id = instance['id']
LOG.debug("Suspending instance %s. Current status: %s",
instance_id, instance['status'])
diff --git a/tempest/scenario/test_server_basic_ops.py b/tempest/scenario/test_server_basic_ops.py
index 8a19254..239e120 100644
--- a/tempest/scenario/test_server_basic_ops.py
+++ b/tempest/scenario/test_server_basic_ops.py
@@ -72,20 +72,6 @@
def add_keypair(self):
self.keypair = self.create_keypair()
- def boot_instance(self):
- # Create server with image and flavor from input scenario
- security_groups = [{'name': self.security_group['name']}]
- self.md = {'meta1': 'data1', 'meta2': 'data2', 'metaN': 'dataN'}
- create_kwargs = {
- 'key_name': self.keypair['name'],
- 'security_groups': security_groups,
- 'config_drive': CONF.compute_feature_enabled.config_drive,
- 'metadata': self.md
- }
- self.instance = self.create_server(image=self.image_ref,
- flavor=self.flavor_ref,
- create_kwargs=create_kwargs)
-
def verify_ssh(self):
if self.run_ssh:
# Obtain a floating IP
@@ -139,7 +125,16 @@
def test_server_basicops(self):
self.add_keypair()
self.security_group = self._create_security_group()
- self.boot_instance()
+ security_groups = [{'name': self.security_group['name']}]
+ self.md = {'meta1': 'data1', 'meta2': 'data2', 'metaN': 'dataN'}
+ self.instance = self.create_server(
+ image_id=self.image_ref,
+ flavor=self.flavor_ref,
+ key_name=self.keypair['name'],
+ security_groups=security_groups,
+ config_drive=CONF.compute_feature_enabled.config_drive,
+ metadata=self.md,
+ wait_until='ACTIVE')
self.verify_ssh()
self.verify_metadata()
self.verify_metadata_on_config_drive()
diff --git a/tempest/scenario/test_server_multinode.py b/tempest/scenario/test_server_multinode.py
index 403804d..7e0e41c 100644
--- a/tempest/scenario/test_server_multinode.py
+++ b/tempest/scenario/test_server_multinode.py
@@ -60,15 +60,11 @@
servers = []
for host in hosts[:CONF.compute.min_compute_nodes]:
- create_kwargs = {
- 'availability_zone': '%(zone)s:%(host_name)s' % host
- }
-
# by getting to active state here, this means this has
# landed on the host in question.
- inst = self.create_server(image=CONF.compute.image_ref,
- flavor=CONF.compute.flavor_ref,
- create_kwargs=create_kwargs)
+ inst = self.create_server(
+ availability_zone='%(zone)s:%(host_name)s' % host,
+ wait_until='ACTIVE')
server = self.servers_client.show_server(inst['id'])['server']
servers.append(server)
diff --git a/tempest/scenario/test_shelve_instance.py b/tempest/scenario/test_shelve_instance.py
index 5778107..378ae9d 100644
--- a/tempest/scenario/test_shelve_instance.py
+++ b/tempest/scenario/test_shelve_instance.py
@@ -59,10 +59,6 @@
security_group = self._create_security_group()
security_groups = [{'name': security_group['name']}]
- create_kwargs = {
- 'key_name': keypair['name'],
- 'security_groups': security_groups
- }
if boot_from_volume:
volume = self.create_volume(size=CONF.volume.volume_size,
@@ -72,11 +68,17 @@
'volume_id': volume['id'],
'delete_on_termination': '0'}]
- create_kwargs['block_device_mapping'] = bd_map
- server = self.create_server(create_kwargs=create_kwargs)
+ server = self.create_server(
+ key_name=keypair['name'],
+ security_groups=security_groups,
+ block_device_mapping=bd_map,
+ wait_until='ACTIVE')
else:
- server = self.create_server(image=CONF.compute.image_ref,
- create_kwargs=create_kwargs)
+ server = self.create_server(
+ image_id=CONF.compute.image_ref,
+ key_name=keypair['name'],
+ security_groups=security_groups,
+ wait_until='ACTIVE')
instance_ip = self.get_server_or_ip(server)
timestamp = self.create_timestamp(instance_ip,
diff --git a/tempest/scenario/test_snapshot_pattern.py b/tempest/scenario/test_snapshot_pattern.py
index cd59334..f3b6558 100644
--- a/tempest/scenario/test_snapshot_pattern.py
+++ b/tempest/scenario/test_snapshot_pattern.py
@@ -36,14 +36,6 @@
"""
- def _boot_image(self, image_id, keypair, security_group):
- security_groups = [{'name': security_group['name']}]
- create_kwargs = {
- 'key_name': keypair['name'],
- 'security_groups': security_groups
- }
- return self.create_server(image=image_id, create_kwargs=create_kwargs)
-
@test.idempotent_id('608e604b-1d63-4a82-8e3e-91bc665c90b4')
@testtools.skipUnless(CONF.compute_feature_enabled.snapshot,
'Snapshotting is not available.')
@@ -54,8 +46,12 @@
security_group = self._create_security_group()
# boot an instance and create a timestamp file in it
- server = self._boot_image(CONF.compute.image_ref, keypair,
- security_group)
+ server = self.create_server(
+ image_id=CONF.compute.image_ref,
+ key_name=keypair['name'],
+ security_groups=[{'name': security_group['name']}],
+ wait_until='ACTIVE')
+
instance_ip = self.get_server_or_ip(server)
timestamp = self.create_timestamp(instance_ip,
private_key=keypair['private_key'])
@@ -64,8 +60,11 @@
snapshot_image = self.create_server_snapshot(server=server)
# boot a second instance from the snapshot
- server_from_snapshot = self._boot_image(snapshot_image['id'],
- keypair, security_group)
+ server_from_snapshot = self.create_server(
+ image_id=snapshot_image['id'],
+ key_name=keypair['name'],
+ security_groups=[{'name': security_group['name']}],
+ wait_until='ACTIVE')
# check the existence of the timestamp file in the second instance
server_from_snapshot_ip = self.get_server_or_ip(server_from_snapshot)
diff --git a/tempest/scenario/test_stamp_pattern.py b/tempest/scenario/test_stamp_pattern.py
index 05ae33e..faae800 100644
--- a/tempest/scenario/test_stamp_pattern.py
+++ b/tempest/scenario/test_stamp_pattern.py
@@ -64,14 +64,6 @@
self.snapshots_client.wait_for_snapshot_status(volume_snapshot['id'],
status)
- def _boot_image(self, image_id, keypair, security_group):
- security_groups = [{'name': security_group['name']}]
- create_kwargs = {
- 'key_name': keypair['name'],
- 'security_groups': security_groups
- }
- return self.create_server(image=image_id, create_kwargs=create_kwargs)
-
def _create_volume_snapshot(self, volume):
snapshot_name = data_utils.rand_name('scenario-snapshot')
snapshot = self.snapshots_client.create_snapshot(
@@ -135,8 +127,11 @@
# boot an instance and create a timestamp file in it
volume = self._create_volume()
- server = self._boot_image(CONF.compute.image_ref, keypair,
- security_group)
+ server = self.create_server(
+ image_id=CONF.compute.image_ref,
+ key_name=keypair['name'],
+ security_groups=security_group,
+ wait_until='ACTIVE')
# create and add floating IP to server1
ip_for_server = self.get_server_or_ip(server)
@@ -160,8 +155,10 @@
snapshot_id=volume_snapshot['id'])
# boot second instance from the snapshot(instance2)
- server_from_snapshot = self._boot_image(snapshot_image['id'],
- keypair, security_group)
+ server_from_snapshot = self.create_server(
+ image_id=snapshot_image['id'],
+ key_name=keypair['name'],
+ security_groups=security_group)
# create and add floating IP to server_from_snapshot
ip_for_snapshot = self.get_server_or_ip(server_from_snapshot)
diff --git a/tempest/scenario/test_volume_boot_pattern.py b/tempest/scenario/test_volume_boot_pattern.py
index 96e79e6..81ecda0 100644
--- a/tempest/scenario/test_volume_boot_pattern.py
+++ b/tempest/scenario/test_volume_boot_pattern.py
@@ -69,7 +69,10 @@
{'name': security_group['name']}]
create_kwargs.update(self._get_bdm(
vol_id, delete_on_termination=delete_on_termination))
- return self.create_server(image='', create_kwargs=create_kwargs)
+ return self.create_server(
+ image='',
+ wait_until='ACTIVE',
+ **create_kwargs)
def _create_snapshot_from_volume(self, vol_id):
snap_name = data_utils.rand_name('snapshot')
@@ -158,7 +161,8 @@
self._delete_server(instance)
# boot instance from EBS image
- instance = self.create_server(image=image['id'])
+ instance = self.create_server(
+ image_id=image['id'])
# just ensure that instance booted
# delete instance
diff --git a/tempest/services/compute/json/images_client.py b/tempest/services/compute/json/images_client.py
deleted file mode 100644
index 99fdfe6..0000000
--- a/tempest/services/compute/json/images_client.py
+++ /dev/null
@@ -1,122 +0,0 @@
-# Copyright 2012 OpenStack Foundation
-# 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 oslo_serialization import jsonutils as json
-from six.moves.urllib import parse as urllib
-from tempest_lib import exceptions as lib_exc
-
-from tempest.api_schema.response.compute.v2_1 import images as schema
-from tempest.common import service_client
-
-
-class ImagesClient(service_client.ServiceClient):
-
- def create_image(self, server_id, **kwargs):
- """Creates an image of the original server."""
-
- post_body = {'createImage': kwargs}
- post_body = json.dumps(post_body)
- resp, body = self.post('servers/%s/action' % server_id,
- post_body)
- self.validate_response(schema.create_image, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def list_images(self, detail=False, **params):
- """Returns a list of all images filtered by any parameters."""
- url = 'images'
- _schema = schema.list_images
- if detail:
- url += '/detail'
- _schema = schema.list_images_details
-
- if params:
- url += '?%s' % urllib.urlencode(params)
-
- resp, body = self.get(url)
- body = json.loads(body)
- self.validate_response(_schema, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def show_image(self, image_id):
- """Returns the details of a single image."""
- resp, body = self.get("images/%s" % image_id)
- self.expected_success(200, resp.status)
- body = json.loads(body)
- self.validate_response(schema.get_image, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def delete_image(self, image_id):
- """Deletes the provided image."""
- resp, body = self.delete("images/%s" % image_id)
- self.validate_response(schema.delete, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def list_image_metadata(self, image_id):
- """Lists all metadata items for an image."""
- resp, body = self.get("images/%s/metadata" % image_id)
- body = json.loads(body)
- self.validate_response(schema.image_metadata, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def set_image_metadata(self, image_id, meta):
- """Sets the metadata for an image."""
- post_body = json.dumps({'metadata': meta})
- resp, body = self.put('images/%s/metadata' % image_id, post_body)
- body = json.loads(body)
- self.validate_response(schema.image_metadata, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def update_image_metadata(self, image_id, meta):
- """Updates the metadata for an image."""
- post_body = json.dumps({'metadata': meta})
- resp, body = self.post('images/%s/metadata' % image_id, post_body)
- body = json.loads(body)
- self.validate_response(schema.image_metadata, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def show_image_metadata_item(self, image_id, key):
- """Returns the value for a specific image metadata key."""
- resp, body = self.get("images/%s/metadata/%s" % (image_id, key))
- body = json.loads(body)
- self.validate_response(schema.image_meta_item, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def set_image_metadata_item(self, image_id, key, meta):
- """Sets the value for a specific image metadata key."""
- post_body = json.dumps({'meta': meta})
- resp, body = self.put('images/%s/metadata/%s' % (image_id, key),
- post_body)
- body = json.loads(body)
- self.validate_response(schema.image_meta_item, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def delete_image_metadata_item(self, image_id, key):
- """Deletes a single image metadata key/value pair."""
- resp, body = self.delete("images/%s/metadata/%s" %
- (image_id, key))
- self.validate_response(schema.delete, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def is_resource_deleted(self, id):
- try:
- self.show_image(id)
- except lib_exc.NotFound:
- return True
- return False
-
- @property
- def resource_type(self):
- """Returns the primary type of resource this client works with."""
- return 'image'
diff --git a/tempest/services/compute/json/instance_usage_audit_log_client.py b/tempest/services/compute/json/instance_usage_audit_log_client.py
deleted file mode 100644
index 4d9625e..0000000
--- a/tempest/services/compute/json/instance_usage_audit_log_client.py
+++ /dev/null
@@ -1,38 +0,0 @@
-# Copyright 2013 IBM 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 oslo_serialization import jsonutils as json
-
-from tempest.api_schema.response.compute.v2_1 import \
- instance_usage_audit_logs as schema
-from tempest.common import service_client
-
-
-class InstanceUsagesAuditLogClient(service_client.ServiceClient):
-
- def list_instance_usage_audit_logs(self):
- url = 'os-instance_usage_audit_log'
- resp, body = self.get(url)
- body = json.loads(body)
- self.validate_response(schema.list_instance_usage_audit_log,
- resp, body)
- return service_client.ResponseBody(resp, body)
-
- def show_instance_usage_audit_log(self, time_before):
- url = 'os-instance_usage_audit_log/%s' % time_before
- resp, body = self.get(url)
- body = json.loads(body)
- self.validate_response(schema.get_instance_usage_audit_log, resp, body)
- return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/compute/json/limits_client.py b/tempest/services/compute/json/limits_client.py
deleted file mode 100644
index b64b4a5..0000000
--- a/tempest/services/compute/json/limits_client.py
+++ /dev/null
@@ -1,28 +0,0 @@
-# Copyright 2012 OpenStack Foundation
-# 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 oslo_serialization import jsonutils as json
-
-from tempest.api_schema.response.compute.v2_1 import limits as schema
-from tempest.common import service_client
-
-
-class LimitsClient(service_client.ServiceClient):
-
- def show_limits(self):
- resp, body = self.get("limits")
- body = json.loads(body)
- self.validate_response(schema.get_limit, resp, body)
- return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/compute/json/migrations_client.py b/tempest/services/compute/json/migrations_client.py
deleted file mode 100644
index b302539..0000000
--- a/tempest/services/compute/json/migrations_client.py
+++ /dev/null
@@ -1,34 +0,0 @@
-# Copyright 2014 NEC Corporation.
-#
-# 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 oslo_serialization import jsonutils as json
-from six.moves.urllib import parse as urllib
-
-from tempest.api_schema.response.compute.v2_1 import migrations as schema
-from tempest.common import service_client
-
-
-class MigrationsClient(service_client.ServiceClient):
-
- def list_migrations(self, **params):
- """Lists all migrations."""
-
- url = 'os-migrations'
- if params:
- url += '?%s' % urllib.urlencode(params)
-
- resp, body = self.get(url)
- body = json.loads(body)
- self.validate_response(schema.list_migrations, resp, body)
- return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/compute/json/networks_client.py b/tempest/services/compute/json/networks_client.py
deleted file mode 100644
index dd20ee5..0000000
--- a/tempest/services/compute/json/networks_client.py
+++ /dev/null
@@ -1,33 +0,0 @@
-# Copyright 2012 OpenStack Foundation
-# 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 oslo_serialization import jsonutils as json
-
-from tempest.common import service_client
-
-
-class NetworksClient(service_client.ServiceClient):
-
- def list_networks(self):
- resp, body = self.get("os-networks")
- body = json.loads(body)
- self.expected_success(200, resp.status)
- return service_client.ResponseBody(resp, body)
-
- def show_network(self, network_id):
- resp, body = self.get("os-networks/%s" % network_id)
- body = json.loads(body)
- self.expected_success(200, resp.status)
- return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/compute/json/quota_classes_client.py b/tempest/services/compute/json/quota_classes_client.py
deleted file mode 100644
index 7aac5e4..0000000
--- a/tempest/services/compute/json/quota_classes_client.py
+++ /dev/null
@@ -1,44 +0,0 @@
-# Copyright 2012 NTT Data
-# 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 oslo_serialization import jsonutils as json
-
-from tempest.api_schema.response.compute.v2_1\
- import quota_classes as classes_schema
-from tempest.common import service_client
-
-
-class QuotaClassesClient(service_client.ServiceClient):
-
- def show_quota_class_set(self, quota_class_id):
- """List the quota class set for a quota class."""
-
- url = 'os-quota-class-sets/%s' % quota_class_id
- resp, body = self.get(url)
- body = json.loads(body)
- self.validate_response(classes_schema.get_quota_class_set, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def update_quota_class_set(self, quota_class_id, **kwargs):
- """Updates the quota class's limits for one or more resources."""
- post_body = json.dumps({'quota_class_set': kwargs})
-
- resp, body = self.put('os-quota-class-sets/%s' % quota_class_id,
- post_body)
-
- body = json.loads(body)
- self.validate_response(classes_schema.update_quota_class_set,
- resp, body)
- return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/compute/json/quotas_client.py b/tempest/services/compute/json/quotas_client.py
deleted file mode 100644
index e628b3a..0000000
--- a/tempest/services/compute/json/quotas_client.py
+++ /dev/null
@@ -1,63 +0,0 @@
-# Copyright 2012 NTT Data
-# 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 oslo_serialization import jsonutils as json
-
-from tempest.api_schema.response.compute.v2_1 import quotas as schema
-from tempest.common import service_client
-
-
-class QuotasClient(service_client.ServiceClient):
-
- def show_quota_set(self, tenant_id, user_id=None):
- """List the quota set for a tenant."""
-
- url = 'os-quota-sets/%s' % tenant_id
- if user_id:
- url += '?user_id=%s' % user_id
- resp, body = self.get(url)
- body = json.loads(body)
- self.validate_response(schema.get_quota_set, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def show_default_quota_set(self, tenant_id):
- """List the default quota set for a tenant."""
-
- url = 'os-quota-sets/%s/defaults' % tenant_id
- resp, body = self.get(url)
- body = json.loads(body)
- self.validate_response(schema.get_quota_set, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def update_quota_set(self, tenant_id, user_id=None, **kwargs):
- """Updates the tenant's quota limits for one or more resources"""
- post_body = json.dumps({'quota_set': kwargs})
-
- if user_id:
- resp, body = self.put('os-quota-sets/%s?user_id=%s' %
- (tenant_id, user_id), post_body)
- else:
- resp, body = self.put('os-quota-sets/%s' % tenant_id,
- post_body)
-
- body = json.loads(body)
- self.validate_response(schema.update_quota_set, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def delete_quota_set(self, tenant_id):
- """Delete the tenant's quota set."""
- resp, body = self.delete('os-quota-sets/%s' % tenant_id)
- self.validate_response(schema.delete_quota, resp, body)
- return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/compute/json/security_group_default_rules_client.py b/tempest/services/compute/json/security_group_default_rules_client.py
deleted file mode 100644
index b31baab..0000000
--- a/tempest/services/compute/json/security_group_default_rules_client.py
+++ /dev/null
@@ -1,65 +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 oslo_serialization import jsonutils as json
-
-from tempest.api_schema.response.compute.v2_1 import \
- security_group_default_rule as schema
-from tempest.common import service_client
-
-
-class SecurityGroupDefaultRulesClient(service_client.ServiceClient):
-
- def create_security_default_group_rule(self, **kwargs):
- """Creating security group default rules.
-
- ip_protocol : ip_protocol (icmp, tcp, udp).
- from_port: Port at start of range.
- to_port : Port at end of range.
- cidr : CIDR for address range.
- """
- post_body = json.dumps({'security_group_default_rule': kwargs})
- url = 'os-security-group-default-rules'
- resp, body = self.post(url, post_body)
- body = json.loads(body)
- self.validate_response(schema.create_get_security_group_default_rule,
- resp, body)
- return service_client.ResponseBody(resp, body)
-
- def delete_security_group_default_rule(self,
- security_group_default_rule_id):
- """Deletes the provided Security Group default rule."""
- resp, body = self.delete('os-security-group-default-rules/%s' % (
- security_group_default_rule_id))
- self.validate_response(schema.delete_security_group_default_rule,
- resp, body)
- return service_client.ResponseBody(resp, body)
-
- def list_security_group_default_rules(self):
- """List all Security Group default rules."""
- resp, body = self.get('os-security-group-default-rules')
- body = json.loads(body)
- self.validate_response(schema.list_security_group_default_rules,
- resp, body)
- return service_client.ResponseBody(resp, body)
-
- def show_security_group_default_rule(self, security_group_default_rule_id):
- """Return the details of provided Security Group default rule."""
- resp, body = self.get('os-security-group-default-rules/%s' %
- security_group_default_rule_id)
- body = json.loads(body)
- self.validate_response(schema.create_get_security_group_default_rule,
- resp, body)
- return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/compute/json/security_groups_client.py b/tempest/services/compute/json/security_groups_client.py
deleted file mode 100644
index c996079..0000000
--- a/tempest/services/compute/json/security_groups_client.py
+++ /dev/null
@@ -1,89 +0,0 @@
-# Copyright 2012 OpenStack Foundation
-# 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 oslo_serialization import jsonutils as json
-from six.moves.urllib import parse as urllib
-from tempest_lib import exceptions as lib_exc
-
-from tempest.api_schema.response.compute.v2_1 import security_groups as schema
-from tempest.common import service_client
-
-
-class SecurityGroupsClient(service_client.ServiceClient):
-
- def list_security_groups(self, **params):
- """List all security groups for a user."""
-
- url = 'os-security-groups'
- if params:
- url += '?%s' % urllib.urlencode(params)
-
- resp, body = self.get(url)
- body = json.loads(body)
- self.validate_response(schema.list_security_groups, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def show_security_group(self, security_group_id):
- """Get the details of a Security Group."""
- url = "os-security-groups/%s" % security_group_id
- resp, body = self.get(url)
- body = json.loads(body)
- self.validate_response(schema.get_security_group, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def create_security_group(self, **kwargs):
- """Creates a new security group.
-
- name (Required): Name of security group.
- description (Required): Description of security group.
- """
- post_body = json.dumps({'security_group': kwargs})
- resp, body = self.post('os-security-groups', post_body)
- body = json.loads(body)
- self.validate_response(schema.get_security_group, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def update_security_group(self, security_group_id, **kwargs):
- """Update a security group.
-
- security_group_id: a security_group to update
- name: new name of security group
- description: new description of security group
- """
- post_body = json.dumps({'security_group': kwargs})
- resp, body = self.put('os-security-groups/%s' % security_group_id,
- post_body)
- body = json.loads(body)
- self.validate_response(schema.update_security_group, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def delete_security_group(self, security_group_id):
- """Deletes the provided Security Group."""
- resp, body = self.delete(
- 'os-security-groups/%s' % security_group_id)
- self.validate_response(schema.delete_security_group, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def is_resource_deleted(self, id):
- try:
- self.show_security_group(id)
- except lib_exc.NotFound:
- return True
- return False
-
- @property
- def resource_type(self):
- """Returns the primary type of resource this client works with."""
- return 'security_group'
diff --git a/tempest/services/compute/json/servers_client.py b/tempest/services/compute/json/servers_client.py
index 90b7a2d..a0251f1 100644
--- a/tempest/services/compute/json/servers_client.py
+++ b/tempest/services/compute/json/servers_client.py
@@ -152,11 +152,11 @@
return self.action(server_id, 'changePassword',
adminPass=adminPass)
- def get_password(self, server_id):
+ def show_password(self, server_id):
resp, body = self.get("servers/%s/os-server-password" %
server_id)
body = json.loads(body)
- self.validate_response(schema.get_password, resp, body)
+ self.validate_response(schema.show_password, resp, body)
return service_client.ResponseBody(resp, body)
def delete_password(self, server_id):
@@ -240,10 +240,10 @@
resp, body)
return service_client.ResponseBody(resp, body)
- def get_server_metadata_item(self, server_id, key):
+ def show_server_metadata_item(self, server_id, key):
resp, body = self.get("servers/%s/metadata/%s" % (server_id, key))
body = json.loads(body)
- self.validate_response(schema.set_get_server_metadata_item,
+ self.validate_response(schema.set_show_server_metadata_item,
resp, body)
return service_client.ResponseBody(resp, body)
@@ -252,7 +252,7 @@
resp, body = self.put('servers/%s/metadata/%s' % (server_id, key),
post_body)
body = json.loads(body)
- self.validate_response(schema.set_get_server_metadata_item,
+ self.validate_response(schema.set_show_server_metadata_item,
resp, body)
return service_client.ResponseBody(resp, body)
@@ -278,19 +278,19 @@
self.validate_response(schema.attach_volume, resp, body)
return service_client.ResponseBody(resp, body)
- def detach_volume(self, server_id, volume_id):
+ def detach_volume(self, server_id, volume_id): # noqa
"""Detaches a volume from a server instance."""
resp, body = self.delete('servers/%s/os-volume_attachments/%s' %
(server_id, volume_id))
self.validate_response(schema.detach_volume, resp, body)
return service_client.ResponseBody(resp, body)
- def get_volume_attachment(self, server_id, attach_id):
+ def show_volume_attachment(self, server_id, attach_id):
"""Return details about the given volume attachment."""
resp, body = self.get('servers/%s/os-volume_attachments/%s' % (
server_id, attach_id))
body = json.loads(body)
- self.validate_response(schema.get_volume_attachment, resp, body)
+ self.validate_response(schema.show_volume_attachment, resp, body)
return service_client.ResponseBody(resp, body)
def list_volume_attachments(self, server_id):
@@ -387,7 +387,7 @@
"""Unrescue the provided server."""
return self.action(server_id, 'unrescue')
- def get_server_diagnostics(self, server_id):
+ def show_server_diagnostics(self, server_id):
"""Get the usage data for a server."""
resp, body = self.get("servers/%s/diagnostics" % server_id)
return service_client.ResponseBody(resp, json.loads(body))
@@ -400,12 +400,12 @@
self.validate_response(schema.list_instance_actions, resp, body)
return service_client.ResponseBody(resp, body)
- def get_instance_action(self, server_id, request_id):
+ def show_instance_action(self, server_id, request_id):
"""Returns the action details of the provided server."""
resp, body = self.get("servers/%s/os-instance-actions/%s" %
(server_id, request_id))
body = json.loads(body)
- self.validate_response(schema.get_instance_action, resp, body)
+ self.validate_response(schema.show_instance_action, resp, body)
return service_client.ResponseBody(resp, body)
def force_delete_server(self, server_id, **kwargs):
diff --git a/tempest/services/compute/json/services_client.py b/tempest/services/compute/json/services_client.py
deleted file mode 100644
index 57d0434..0000000
--- a/tempest/services/compute/json/services_client.py
+++ /dev/null
@@ -1,58 +0,0 @@
-# Copyright 2013 NEC Corporation
-# Copyright 2013 IBM Corp.
-# 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 oslo_serialization import jsonutils as json
-from six.moves.urllib import parse as urllib
-
-from tempest.api_schema.response.compute.v2_1 import services as schema
-from tempest.common import service_client
-
-
-class ServicesClient(service_client.ServiceClient):
-
- def list_services(self, **params):
- url = 'os-services'
- if params:
- url += '?%s' % urllib.urlencode(params)
-
- resp, body = self.get(url)
- body = json.loads(body)
- self.validate_response(schema.list_services, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def enable_service(self, **kwargs):
- """Enable service on a host
-
- host_name: Name of host
- binary: Service binary
- """
- post_body = json.dumps(kwargs)
- resp, body = self.put('os-services/enable', post_body)
- body = json.loads(body)
- self.validate_response(schema.enable_disable_service, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def disable_service(self, **kwargs):
- """Disable service on a host
-
- host_name: Name of host
- binary: Service binary
- """
- post_body = json.dumps(kwargs)
- resp, body = self.put('os-services/disable', post_body)
- body = json.loads(body)
- self.validate_response(schema.enable_disable_service, resp, body)
- return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/compute/json/snapshots_client.py b/tempest/services/compute/json/snapshots_client.py
deleted file mode 100644
index e3f92db..0000000
--- a/tempest/services/compute/json/snapshots_client.py
+++ /dev/null
@@ -1,71 +0,0 @@
-# Copyright 2015 Fujitsu(fnst) 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 oslo_serialization import jsonutils as json
-from six.moves.urllib import parse as urllib
-from tempest_lib import exceptions as lib_exc
-
-from tempest.api_schema.response.compute.v2_1 import snapshots as schema
-from tempest.common import service_client
-
-
-class SnapshotsClient(service_client.ServiceClient):
-
- def create_snapshot(self, volume_id, **kwargs):
- post_body = {
- 'volume_id': volume_id
- }
- post_body.update(kwargs)
- post_body = json.dumps({'snapshot': post_body})
- resp, body = self.post('os-snapshots', post_body)
- body = json.loads(body)
- self.validate_response(schema.create_get_snapshot, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def show_snapshot(self, snapshot_id):
- url = "os-snapshots/%s" % snapshot_id
- resp, body = self.get(url)
- body = json.loads(body)
- self.validate_response(schema.create_get_snapshot, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def list_snapshots(self, detail=False, params=None):
- url = 'os-snapshots'
-
- if detail:
- url += '/detail'
- if params:
- url += '?%s' % urllib.urlencode(params)
- resp, body = self.get(url)
- body = json.loads(body)
- self.validate_response(schema.list_snapshots, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def delete_snapshot(self, snapshot_id):
- resp, body = self.delete("os-snapshots/%s" % snapshot_id)
- self.validate_response(schema.delete_snapshot, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def is_resource_deleted(self, id):
- try:
- self.show_snapshot(id)
- except lib_exc.NotFound:
- return True
- return False
-
- @property
- def resource_type(self):
- """Returns the primary type of resource this client works with."""
- return 'snapshot'
diff --git a/tempest/services/compute/json/tenant_networks_client.py b/tempest/services/compute/json/tenant_networks_client.py
deleted file mode 100644
index 33166c0..0000000
--- a/tempest/services/compute/json/tenant_networks_client.py
+++ /dev/null
@@ -1,33 +0,0 @@
-# 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 oslo_serialization import jsonutils as json
-
-from tempest.api_schema.response.compute.v2_1 import tenant_networks as schema
-from tempest.common import service_client
-
-
-class TenantNetworksClient(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.ResponseBody(resp, body)
-
- def show_tenant_network(self, network_id):
- resp, body = self.get("os-tenant-networks/%s" % network_id)
- body = json.loads(body)
- self.validate_response(schema.get_tenant_network, resp, body)
- return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/compute/json/tenant_usages_client.py b/tempest/services/compute/json/tenant_usages_client.py
deleted file mode 100644
index 73b4706..0000000
--- a/tempest/services/compute/json/tenant_usages_client.py
+++ /dev/null
@@ -1,43 +0,0 @@
-# Copyright 2013 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 oslo_serialization import jsonutils as json
-from six.moves.urllib import parse as urllib
-
-from tempest.api_schema.response.compute.v2_1 import tenant_usages as schema
-from tempest.common import service_client
-
-
-class TenantUsagesClient(service_client.ServiceClient):
-
- def list_tenant_usages(self, **params):
- url = 'os-simple-tenant-usage'
- if params:
- url += '?%s' % urllib.urlencode(params)
-
- resp, body = self.get(url)
- body = json.loads(body)
- self.validate_response(schema.list_tenant_usage, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def show_tenant_usage(self, tenant_id, **params):
- url = 'os-simple-tenant-usage/%s' % tenant_id
- if params:
- url += '?%s' % urllib.urlencode(params)
-
- resp, body = self.get(url)
- body = json.loads(body)
- self.validate_response(schema.get_tenant_usage, resp, body)
- return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/compute/json/versions_client.py b/tempest/services/compute/json/versions_client.py
deleted file mode 100644
index 48c0e8d..0000000
--- a/tempest/services/compute/json/versions_client.py
+++ /dev/null
@@ -1,55 +0,0 @@
-# Copyright (c) 2015 Hewlett-Packard Development Company, L.P.
-#
-# 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 oslo_serialization import jsonutils as json
-from six.moves import urllib
-
-from tempest.api_schema.response.compute.v2_1 import versions as schema
-from tempest.common import service_client
-
-
-class VersionsClient(service_client.ServiceClient):
-
- def _get_base_version_url(self):
- # NOTE: The URL which is gotten from keystone's catalog contains
- # API version and project-id like "v2/{project-id}", but we need
- # to access the URL which doesn't contain them for getting API
- # versions. For that, here should use raw_request() instead of
- # get().
- endpoint = self.base_url
- url = urllib.parse.urlparse(endpoint)
- return '%s://%s/' % (url.scheme, url.netloc)
-
- def list_versions(self):
- version_url = self._get_base_version_url()
- resp, body = self.raw_request(version_url, 'GET')
- body = json.loads(body)
- self.validate_response(schema.list_versions, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def get_version_by_url(self, version_url):
- """Get the version document by url.
-
- This gets the version document for a url, useful in testing
- the contents of things like /v2/ or /v2.1/ in Nova. That
- controller needs authenticated access, so we have to get
- ourselves a token before making the request.
-
- """
- # we need a token for this request
- resp, body = self.raw_request(version_url, 'GET',
- {'X-Auth-Token': self.token})
- body = json.loads(body)
- self.validate_response(schema.get_one_version, resp, body)
- return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/identity/v2/json/identity_client.py b/tempest/services/identity/v2/json/identity_client.py
index aef7884..3f6727d 100644
--- a/tempest/services/identity/v2/json/identity_client.py
+++ b/tempest/services/identity/v2/json/identity_client.py
@@ -11,7 +11,6 @@
# under the License.
from oslo_serialization import jsonutils as json
-from tempest_lib import exceptions as lib_exc
from tempest.common import service_client
@@ -85,7 +84,7 @@
body = json.loads(body)
return service_client.ResponseBody(resp, body)
- def remove_user_role(self, tenant_id, user_id, role_id):
+ def delete_user_role(self, tenant_id, user_id, role_id):
"""Removes a role assignment for a user on a tenant."""
resp, body = self.delete('/tenants/%s/users/%s/roles/OS-KSADM/%s' %
(tenant_id, user_id, role_id))
@@ -213,13 +212,6 @@
body = json.loads(body)
return service_client.ResponseBody(resp, body)
- def get_user_by_username(self, tenant_id, username):
- users = self.list_tenant_users(tenant_id)['users']
- for user in users:
- if user['name'] == username:
- return user
- raise lib_exc.NotFound('No such user')
-
def create_service(self, name, type, **kwargs):
"""Create a service."""
post_body = {
diff --git a/tempest/services/identity/v3/json/groups_client.py b/tempest/services/identity/v3/json/groups_client.py
index 5bd610d..70edd23 100644
--- a/tempest/services/identity/v3/json/groups_client.py
+++ b/tempest/services/identity/v3/json/groups_client.py
@@ -13,6 +13,10 @@
# License for the specific language governing permissions and limitations
# under the License.
+"""
+http://developer.openstack.org/api-ref-identity-v3.html#groups-v3
+"""
+
from oslo_serialization import jsonutils as json
from tempest.common import service_client
@@ -21,24 +25,19 @@
class GroupsClient(service_client.ServiceClient):
api_version = "v3"
- def create_group(self, name, **kwargs):
- """Creates a group."""
- description = kwargs.get('description', None)
- domain_id = kwargs.get('domain_id', 'default')
- project_id = kwargs.get('project_id', None)
- post_body = {
- 'description': description,
- 'domain_id': domain_id,
- 'project_id': project_id,
- 'name': name
- }
- post_body = json.dumps({'group': post_body})
+ def create_group(self, **kwargs):
+ """Creates a group.
+
+ Available params: see http://developer.openstack.org/
+ api-ref-identity-v3.html#createGroup
+ """
+ post_body = json.dumps({'group': kwargs})
resp, body = self.post('groups', post_body)
self.expected_success(201, resp.status)
body = json.loads(body)
return service_client.ResponseBody(resp, body)
- def get_group(self, group_id):
+ def show_group(self, group_id):
"""Get group details."""
resp, body = self.get('groups/%s' % group_id)
self.expected_success(200, resp.status)
@@ -53,15 +52,12 @@
return service_client.ResponseBody(resp, body)
def update_group(self, group_id, **kwargs):
- """Updates a group."""
- body = self.get_group(group_id)['group']
- name = kwargs.get('name', body['name'])
- description = kwargs.get('description', body['description'])
- post_body = {
- 'name': name,
- 'description': description
- }
- post_body = json.dumps({'group': post_body})
+ """Updates a group.
+
+ Available params: see http://developer.openstack.org/
+ api-ref-identity-v3.html#updateGroup
+ """
+ post_body = json.dumps({'group': kwargs})
resp, body = self.patch('groups/%s' % group_id, post_body)
self.expected_success(200, resp.status)
body = json.loads(body)
diff --git a/tempest/services/identity/v3/json/identity_client.py b/tempest/services/identity/v3/json/identity_client.py
index a26544e..bbd8804 100644
--- a/tempest/services/identity/v3/json/identity_client.py
+++ b/tempest/services/identity/v3/json/identity_client.py
@@ -336,14 +336,14 @@
body = json.loads(body)
return service_client.ResponseBody(resp, body)
- def revoke_role_from_user_on_project(self, project_id, user_id, role_id):
+ def delete_role_from_user_on_project(self, project_id, user_id, role_id):
"""Delete role of a user on a project."""
resp, body = self.delete('projects/%s/users/%s/roles/%s' %
(project_id, user_id, role_id))
self.expected_success(204, resp.status)
return service_client.ResponseBody(resp, body)
- def revoke_role_from_user_on_domain(self, domain_id, user_id, role_id):
+ def delete_role_from_user_on_domain(self, domain_id, user_id, role_id):
"""Delete role of a user on a domain."""
resp, body = self.delete('domains/%s/users/%s/roles/%s' %
(domain_id, user_id, role_id))
@@ -380,14 +380,14 @@
body = json.loads(body)
return service_client.ResponseBody(resp, body)
- def revoke_role_from_group_on_project(self, project_id, group_id, role_id):
+ def delete_role_from_group_on_project(self, project_id, group_id, role_id):
"""Delete role of a user on a project."""
resp, body = self.delete('projects/%s/groups/%s/roles/%s' %
(project_id, group_id, role_id))
self.expected_success(204, resp.status)
return service_client.ResponseBody(resp, body)
- def revoke_role_from_group_on_domain(self, domain_id, group_id, role_id):
+ def delete_role_from_group_on_domain(self, domain_id, group_id, role_id):
"""Delete role of a user on a domain."""
resp, body = self.delete('domains/%s/groups/%s/roles/%s' %
(domain_id, group_id, role_id))
diff --git a/tempest/services/image/v1/json/image_client.py b/tempest/services/image/v1/json/images_client.py
similarity index 99%
rename from tempest/services/image/v1/json/image_client.py
rename to tempest/services/image/v1/json/images_client.py
index d97da36..4884106 100644
--- a/tempest/services/image/v1/json/image_client.py
+++ b/tempest/services/image/v1/json/images_client.py
@@ -32,13 +32,13 @@
LOG = logging.getLogger(__name__)
-class ImageClient(service_client.ServiceClient):
+class ImagesClient(service_client.ServiceClient):
def __init__(self, auth_provider, catalog_type, region, endpoint_type=None,
build_interval=None, build_timeout=None,
disable_ssl_certificate_validation=None,
ca_certs=None, trace_requests=None):
- super(ImageClient, self).__init__(
+ super(ImagesClient, self).__init__(
auth_provider,
catalog_type,
region,
diff --git a/tempest/services/image/v2/json/image_client.py b/tempest/services/image/v2/json/images_client.py
similarity index 87%
rename from tempest/services/image/v2/json/image_client.py
rename to tempest/services/image/v2/json/images_client.py
index eea179d..33bfcb8 100644
--- a/tempest/services/image/v2/json/image_client.py
+++ b/tempest/services/image/v2/json/images_client.py
@@ -22,13 +22,13 @@
from tempest.common import service_client
-class ImageClientV2(service_client.ServiceClient):
+class ImagesClientV2(service_client.ServiceClient):
def __init__(self, auth_provider, catalog_type, region, endpoint_type=None,
build_interval=None, build_timeout=None,
disable_ssl_certificate_validation=None, ca_certs=None,
trace_requests=None):
- super(ImageClientV2, self).__init__(
+ super(ImagesClientV2, self).__init__(
auth_provider,
catalog_type,
region,
@@ -153,7 +153,7 @@
self.expected_success(204, resp.status)
return service_client.ResponseBody(resp, body)
- def load_image_file(self, image_id):
+ def show_image_file(self, image_id):
url = 'v2/images/%s/file' % image_id
resp, body = self.get(url)
self.expected_success(200, resp.status)
@@ -178,17 +178,22 @@
body = json.loads(body)
return service_client.ResponseBody(resp, body)
- def add_image_member(self, image_id, member_id):
+ def add_image_member(self, image_id, **kwargs):
url = 'v2/images/%s/members' % image_id
- data = json.dumps({'member': member_id})
+ data = json.dumps(kwargs)
resp, body = self.post(url, data)
self.expected_success(200, resp.status)
body = json.loads(body)
return service_client.ResponseBody(resp, body)
- def update_image_member(self, image_id, member_id, body):
+ def update_image_member(self, image_id, member_id, **kwargs):
+ """Update an image member.
+
+ Available params: see http://developer.openstack.org/
+ api-ref-image-v2.html#updateImageMember-v2
+ """
url = 'v2/images/%s/members/%s' % (image_id, member_id)
- data = json.dumps(body)
+ data = json.dumps(kwargs)
resp, body = self.put(url, data)
self.expected_success(200, resp.status)
body = json.loads(body)
@@ -200,7 +205,7 @@
self.expected_success(200, resp.status)
return service_client.ResponseBody(resp, json.loads(body))
- def remove_image_member(self, image_id, member_id):
+ def delete_image_member(self, image_id, member_id):
url = 'v2/images/%s/members/%s' % (image_id, member_id)
resp, _ = self.delete(url)
self.expected_success(204, resp.status)
@@ -220,19 +225,13 @@
body = json.loads(body)
return service_client.ResponseBody(resp, body)
- def create_namespaces(self, namespace, **kwargs):
- params = {
- "namespace": namespace,
- }
+ def create_namespace(self, **kwargs):
+ """Create a namespace.
- for option in kwargs:
- value = kwargs.get(option)
- if isinstance(value, dict) or isinstance(value, tuple):
- params.update(value)
- else:
- params[option] = value
-
- data = json.dumps(params)
+ Available params: see http://developer.openstack.org/
+ api-ref-image-v2.html#createNamespace-v2
+ """
+ data = json.dumps(kwargs)
self._validate_schema(data)
resp, body = self.post('/v2/metadefs/namespaces', data)
@@ -240,25 +239,23 @@
body = json.loads(body)
return service_client.ResponseBody(resp, body)
- def show_namespaces(self, namespace):
+ def show_namespace(self, namespace):
url = '/v2/metadefs/namespaces/%s' % namespace
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
return service_client.ResponseBody(resp, body)
- def update_namespaces(self, namespace, visibility, **kwargs):
- params = {
- "namespace": namespace,
- "visibility": visibility
- }
- for option in kwargs:
- value = kwargs.get(option)
- if isinstance(value, dict) or isinstance(value, tuple):
- params.update(value)
- else:
- params[option] = value
+ def update_namespace(self, namespace, **kwargs):
+ """Update a namespace.
+ Available params: see http://developer.openstack.org/
+ api-ref-image-v2.html#updateNamespace-v2
+ """
+ # NOTE: On Glance API, we need to pass namespace on both URI
+ # and a request body.
+ params = {'namespace': namespace}
+ params.update(kwargs)
data = json.dumps(params)
self._validate_schema(data)
url = '/v2/metadefs/namespaces/%s' % namespace
@@ -267,7 +264,7 @@
body = json.loads(body)
return service_client.ResponseBody(resp, body)
- def delete_namespaces(self, namespace):
+ def delete_namespace(self, namespace):
url = '/v2/metadefs/namespaces/%s' % namespace
resp, _ = self.delete(url)
self.expected_success(204, resp.status)
diff --git a/tempest/services/messaging/json/messaging_client.py b/tempest/services/messaging/json/messaging_client.py
index 2f233a9..5a43841 100644
--- a/tempest/services/messaging/json/messaging_client.py
+++ b/tempest/services/messaging/json/messaging_client.py
@@ -170,7 +170,7 @@
self.expected_success(204, resp.status)
return resp, body
- def release_claim(self, claim_uri):
+ def delete_claim(self, claim_uri):
resp, body = self.delete(claim_uri)
self.expected_success(204, resp.status)
return resp, body
diff --git a/tempest/services/network/json/metering_labels_client.py b/tempest/services/network/json/metering_labels_client.py
new file mode 100644
index 0000000..2e5cdae
--- /dev/null
+++ b/tempest/services/network/json/metering_labels_client.py
@@ -0,0 +1,33 @@
+# 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.services.network.json import base
+
+
+class MeteringLabelsClient(base.BaseNetworkClient):
+
+ def create_metering_label(self, **kwargs):
+ uri = '/metering/metering-labels'
+ post_data = {'metering_label': kwargs}
+ return self.create_resource(uri, post_data)
+
+ def show_metering_label(self, metering_label_id, **fields):
+ uri = '/metering/metering-labels/%s' % metering_label_id
+ return self.show_resource(uri, **fields)
+
+ def delete_metering_label(self, metering_label_id):
+ uri = '/metering/metering-labels/%s' % metering_label_id
+ return self.delete_resource(uri)
+
+ def list_metering_labels(self, **filters):
+ uri = '/metering/metering-labels'
+ return self.list_resources(uri, **filters)
diff --git a/tempest/services/network/json/network_client.py b/tempest/services/network/json/network_client.py
index 5a4229c..b525143 100644
--- a/tempest/services/network/json/network_client.py
+++ b/tempest/services/network/json/network_client.py
@@ -35,23 +35,6 @@
quotas
"""
- def create_metering_label(self, **kwargs):
- uri = '/metering/metering-labels'
- post_data = {'metering_label': kwargs}
- return self.create_resource(uri, post_data)
-
- def show_metering_label(self, metering_label_id, **fields):
- uri = '/metering/metering-labels/%s' % metering_label_id
- return self.show_resource(uri, **fields)
-
- def delete_metering_label(self, metering_label_id):
- uri = '/metering/metering-labels/%s' % metering_label_id
- return self.delete_resource(uri)
-
- def list_metering_labels(self, **filters):
- uri = '/metering/metering-labels'
- return self.list_resources(uri, **filters)
-
def create_metering_label_rule(self, **kwargs):
uri = '/metering/metering-label-rules'
post_data = {'metering_label_rule': kwargs}
diff --git a/tempest/services/telemetry/json/alarming_client.py b/tempest/services/telemetry/json/alarming_client.py
new file mode 100644
index 0000000..ce14211
--- /dev/null
+++ b/tempest/services/telemetry/json/alarming_client.py
@@ -0,0 +1,98 @@
+# Copyright 2014 OpenStack Foundation
+# 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 oslo_serialization import jsonutils as json
+from six.moves.urllib import parse as urllib
+
+from tempest.common import service_client
+
+
+class AlarmingClient(service_client.ServiceClient):
+
+ version = '2'
+ uri_prefix = "v2"
+
+ def deserialize(self, body):
+ return json.loads(body.replace("\n", ""))
+
+ def serialize(self, body):
+ return json.dumps(body)
+
+ def list_alarms(self, query=None):
+ uri = '%s/alarms' % self.uri_prefix
+ uri_dict = {}
+ if query:
+ uri_dict = {'q.field': query[0],
+ 'q.op': query[1],
+ 'q.value': query[2]}
+ 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 service_client.ResponseBodyList(resp, body)
+
+ def show_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 service_client.ResponseBody(resp, body)
+
+ def show_alarm_history(self, alarm_id):
+ uri = "%s/alarms/%s/history" % (self.uri_prefix, alarm_id)
+ resp, body = self.get(uri)
+ self.expected_success(200, resp.status)
+ body = self.deserialize(body)
+ return service_client.ResponseBodyList(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 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 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 service_client.ResponseBody(resp, body)
+
+ def show_alarm_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 service_client.ResponseBodyData(resp, body)
+
+ def alarm_set_state(self, alarm_id, state):
+ 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 service_client.ResponseBodyData(resp, body)
diff --git a/tempest/services/telemetry/json/telemetry_client.py b/tempest/services/telemetry/json/telemetry_client.py
index fc8951e..05530b1 100644
--- a/tempest/services/telemetry/json/telemetry_client.py
+++ b/tempest/services/telemetry/json/telemetry_client.py
@@ -72,10 +72,6 @@
uri = '%s/meters' % self.uri_prefix
return self._helper_list(uri, query)
- def list_alarms(self, query=None):
- uri = '%s/alarms' % self.uri_prefix
- return self._helper_list(uri, query)
-
def list_statistics(self, meter, period=None, query=None):
uri = "%s/meters/%s/statistics" % (self.uri_prefix, meter)
return self._helper_list(uri, query, period)
@@ -94,56 +90,3 @@
self.expected_success(200, resp.status)
body = self.deserialize(body)
return service_client.ResponseBody(resp, body)
-
- def show_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 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 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 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 service_client.ResponseBody(resp, body)
-
- def show_alarm_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 service_client.ResponseBodyData(resp, body)
-
- def alarm_set_state(self, alarm_id, state):
- 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 service_client.ResponseBodyData(resp, body)
-
- def show_alarm_history(self, alarm_id):
- uri = "%s/alarms/%s/history" % (self.uri_prefix, alarm_id)
- resp, body = self.get(uri)
- self.expected_success(200, resp.status)
- body = self.deserialize(body)
- return service_client.ResponseBodyList(resp, body)
diff --git a/tempest/services/volume/json/__init__.py b/tempest/services/volume/base/__init__.py
similarity index 100%
copy from tempest/services/volume/json/__init__.py
copy to tempest/services/volume/base/__init__.py
diff --git a/tempest/services/volume/json/admin/__init__.py b/tempest/services/volume/base/admin/__init__.py
similarity index 100%
copy from tempest/services/volume/json/admin/__init__.py
copy to tempest/services/volume/base/admin/__init__.py
diff --git a/tempest/services/volume/json/admin/volume_hosts_client.py b/tempest/services/volume/base/admin/base_volume_hosts_client.py
similarity index 88%
rename from tempest/services/volume/json/admin/volume_hosts_client.py
rename to tempest/services/volume/base/admin/base_volume_hosts_client.py
index 939db59..97bb007 100644
--- a/tempest/services/volume/json/admin/volume_hosts_client.py
+++ b/tempest/services/volume/base/admin/base_volume_hosts_client.py
@@ -22,7 +22,7 @@
class BaseVolumeHostsClient(service_client.ServiceClient):
"""Client class to send CRUD Volume Hosts API requests"""
- def list_hosts(self, params=None):
+ def list_hosts(self, **params):
"""Lists all hosts."""
url = 'os-hosts'
@@ -33,7 +33,3 @@
body = json.loads(body)
self.expected_success(200, resp.status)
return service_client.ResponseBody(resp, body)
-
-
-class VolumeHostsClient(BaseVolumeHostsClient):
- """Client class to send CRUD Volume Host API V1 requests"""
diff --git a/tempest/services/volume/json/admin/volume_quotas_client.py b/tempest/services/volume/base/admin/base_volume_quotas_client.py
similarity index 77%
rename from tempest/services/volume/json/admin/volume_quotas_client.py
rename to tempest/services/volume/base/admin/base_volume_quotas_client.py
index f6d4a14..ad8ba03 100644
--- a/tempest/services/volume/json/admin/volume_quotas_client.py
+++ b/tempest/services/volume/base/admin/base_volume_quotas_client.py
@@ -50,21 +50,14 @@
body = self.show_quota_set(tenant_id, params={'usage': True})
return body
- def update_quota_set(self, tenant_id, gigabytes=None, volumes=None,
- snapshots=None):
- post_body = {}
+ def update_quota_set(self, tenant_id, **kwargs):
+ """Updates quota set
- if gigabytes is not None:
- post_body['gigabytes'] = gigabytes
-
- if volumes is not None:
- post_body['volumes'] = volumes
-
- if snapshots is not None:
- post_body['snapshots'] = snapshots
-
- post_body = jsonutils.dumps({'quota_set': post_body})
- resp, body = self.put('os-quota-sets/%s' % tenant_id, post_body)
+ Available params: see http://developer.openstack.org/
+ api-ref-blockstorage-v2.html#updateQuotas-v2
+ """
+ put_body = jsonutils.dumps({'quota_set': kwargs})
+ resp, body = self.put('os-quota-sets/%s' % tenant_id, put_body)
self.expected_success(200, resp.status)
body = jsonutils.loads(body)
return service_client.ResponseBody(resp, body)
@@ -74,7 +67,3 @@
resp, body = self.delete('os-quota-sets/%s' % tenant_id)
self.expected_success(200, resp.status)
return service_client.ResponseBody(resp, body)
-
-
-class VolumeQuotasClient(BaseVolumeQuotasClient):
- """Client class to send CRUD Volume Type API V1 requests"""
diff --git a/tempest/services/volume/json/admin/volume_services_client.py b/tempest/services/volume/base/admin/base_volume_services_client.py
similarity index 91%
rename from tempest/services/volume/json/admin/volume_services_client.py
rename to tempest/services/volume/base/admin/base_volume_services_client.py
index 798a642..1790421 100644
--- a/tempest/services/volume/json/admin/volume_services_client.py
+++ b/tempest/services/volume/base/admin/base_volume_services_client.py
@@ -30,7 +30,3 @@
body = json.loads(body)
self.expected_success(200, resp.status)
return service_client.ResponseBody(resp, body)
-
-
-class VolumesServicesClient(BaseVolumesServicesClient):
- """Volume V1 volume services client"""
diff --git a/tempest/services/volume/json/admin/volume_types_client.py b/tempest/services/volume/base/admin/base_volume_types_client.py
similarity index 98%
rename from tempest/services/volume/json/admin/volume_types_client.py
rename to tempest/services/volume/base/admin/base_volume_types_client.py
index f2da8a5..8fcf57c 100644
--- a/tempest/services/volume/json/admin/volume_types_client.py
+++ b/tempest/services/volume/base/admin/base_volume_types_client.py
@@ -182,7 +182,3 @@
"/types/%s/encryption/provider" % str(vol_type_id))
self.expected_success(202, resp.status)
return service_client.ResponseBody(resp, body)
-
-
-class VolumeTypesClient(BaseVolumeTypesClient):
- """Volume V1 Volume Types client"""
diff --git a/tempest/services/volume/json/availability_zone_client.py b/tempest/services/volume/base/base_availability_zone_client.py
similarity index 89%
rename from tempest/services/volume/json/availability_zone_client.py
rename to tempest/services/volume/base/base_availability_zone_client.py
index 36f95d6..d5a2fda 100644
--- a/tempest/services/volume/json/availability_zone_client.py
+++ b/tempest/services/volume/base/base_availability_zone_client.py
@@ -25,7 +25,3 @@
body = json.loads(body)
self.expected_success(200, resp.status)
return service_client.ResponseBody(resp, body)
-
-
-class VolumeAvailabilityZoneClient(BaseVolumeAvailabilityZoneClient):
- """Volume V1 availability zone client."""
diff --git a/tempest/services/volume/json/backups_client.py b/tempest/services/volume/base/base_backups_client.py
similarity index 98%
rename from tempest/services/volume/json/backups_client.py
rename to tempest/services/volume/base/base_backups_client.py
index 3045992..be926e6 100644
--- a/tempest/services/volume/json/backups_client.py
+++ b/tempest/services/volume/base/base_backups_client.py
@@ -16,7 +16,6 @@
import time
from oslo_serialization import jsonutils as json
-
from tempest_lib import exceptions as lib_exc
from tempest.common import service_client
@@ -124,7 +123,3 @@
if int(time.time()) - start_time >= self.build_timeout:
raise exceptions.TimeoutException
time.sleep(self.build_interval)
-
-
-class BackupsClient(BaseBackupsClient):
- """Volume V1 Backups client"""
diff --git a/tempest/services/volume/json/extensions_client.py b/tempest/services/volume/base/base_extensions_client.py
similarity index 91%
rename from tempest/services/volume/json/extensions_client.py
rename to tempest/services/volume/base/base_extensions_client.py
index d7d3197..afc3f6b 100644
--- a/tempest/services/volume/json/extensions_client.py
+++ b/tempest/services/volume/base/base_extensions_client.py
@@ -26,7 +26,3 @@
body = json.loads(body)
self.expected_success(200, resp.status)
return service_client.ResponseBody(resp, body)
-
-
-class ExtensionsClient(BaseExtensionsClient):
- """Volume V1 extensions client."""
diff --git a/tempest/services/volume/json/qos_client.py b/tempest/services/volume/base/base_qos_client.py
similarity index 98%
rename from tempest/services/volume/json/qos_client.py
rename to tempest/services/volume/base/base_qos_client.py
index c79168c..c7f6c6e 100644
--- a/tempest/services/volume/json/qos_client.py
+++ b/tempest/services/volume/base/base_qos_client.py
@@ -155,7 +155,3 @@
resp, body = self.get(url)
self.expected_success(202, resp.status)
return service_client.ResponseBody(resp, body)
-
-
-class QosSpecsClient(BaseQosSpecsClient):
- """Volume V1 QoS client."""
diff --git a/tempest/services/volume/json/snapshots_client.py b/tempest/services/volume/base/base_snapshots_client.py
similarity index 98%
rename from tempest/services/volume/json/snapshots_client.py
rename to tempest/services/volume/base/base_snapshots_client.py
index 77c9dd1..fac90e4 100644
--- a/tempest/services/volume/json/snapshots_client.py
+++ b/tempest/services/volume/base/base_snapshots_client.py
@@ -196,7 +196,3 @@
resp, body = self.post('snapshots/%s/action' % snapshot_id, post_body)
self.expected_success(202, resp.status)
return service_client.ResponseBody(resp, body)
-
-
-class SnapshotsClient(BaseSnapshotsClient):
- """Client class to send CRUD Volume V1 API requests."""
diff --git a/tempest/services/volume/json/volumes_client.py b/tempest/services/volume/base/base_volumes_client.py
similarity index 98%
rename from tempest/services/volume/json/volumes_client.py
rename to tempest/services/volume/base/base_volumes_client.py
index c2a76f0..c7302e8 100644
--- a/tempest/services/volume/json/volumes_client.py
+++ b/tempest/services/volume/base/base_volumes_client.py
@@ -334,7 +334,3 @@
post_body = json.dumps({'os-retype': post_body})
resp, body = self.post('volumes/%s/action' % volume_id, post_body)
self.expected_success(202, resp.status)
-
-
-class VolumesClient(BaseVolumesClient):
- """Client class to send CRUD Volume V1 API requests"""
diff --git a/tempest/services/volume/json/__init__.py b/tempest/services/volume/v1/__init__.py
similarity index 100%
copy from tempest/services/volume/json/__init__.py
copy to tempest/services/volume/v1/__init__.py
diff --git a/tempest/services/volume/json/__init__.py b/tempest/services/volume/v1/json/__init__.py
similarity index 100%
rename from tempest/services/volume/json/__init__.py
rename to tempest/services/volume/v1/json/__init__.py
diff --git a/tempest/services/volume/json/admin/__init__.py b/tempest/services/volume/v1/json/admin/__init__.py
similarity index 100%
rename from tempest/services/volume/json/admin/__init__.py
rename to tempest/services/volume/v1/json/admin/__init__.py
diff --git a/tempest/services/volume/v1/json/admin/volume_hosts_client.py b/tempest/services/volume/v1/json/admin/volume_hosts_client.py
new file mode 100644
index 0000000..e564469
--- /dev/null
+++ b/tempest/services/volume/v1/json/admin/volume_hosts_client.py
@@ -0,0 +1,20 @@
+# Copyright 2013 OpenStack Foundation
+# 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.services.volume.base.admin import base_volume_hosts_client
+
+
+class VolumeHostsClient(base_volume_hosts_client.BaseVolumeHostsClient):
+ """Client class to send CRUD Volume Host API V1 requests"""
diff --git a/tempest/services/volume/v1/json/admin/volume_quotas_client.py b/tempest/services/volume/v1/json/admin/volume_quotas_client.py
new file mode 100644
index 0000000..b0dde19
--- /dev/null
+++ b/tempest/services/volume/v1/json/admin/volume_quotas_client.py
@@ -0,0 +1,19 @@
+# Copyright (C) 2014 eNovance SAS <licensing@enovance.com>
+#
+# 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.services.volume.base.admin import base_volume_quotas_client
+
+
+class VolumeQuotasClient(base_volume_quotas_client.BaseVolumeQuotasClient):
+ """Client class to send CRUD Volume Type API V1 requests"""
diff --git a/tempest/services/volume/v1/json/admin/volume_services_client.py b/tempest/services/volume/v1/json/admin/volume_services_client.py
new file mode 100644
index 0000000..00810ed
--- /dev/null
+++ b/tempest/services/volume/v1/json/admin/volume_services_client.py
@@ -0,0 +1,21 @@
+# 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.services.volume.base.admin import base_volume_services_client
+
+
+class VolumesServicesClient(
+ base_volume_services_client.BaseVolumesServicesClient):
+ """Volume V1 volume services client"""
diff --git a/tempest/services/volume/v1/json/admin/volume_types_client.py b/tempest/services/volume/v1/json/admin/volume_types_client.py
new file mode 100644
index 0000000..28524d1
--- /dev/null
+++ b/tempest/services/volume/v1/json/admin/volume_types_client.py
@@ -0,0 +1,20 @@
+# Copyright 2012 OpenStack Foundation
+# 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.services.volume.base.admin import base_volume_types_client
+
+
+class VolumeTypesClient(base_volume_types_client.BaseVolumeTypesClient):
+ """Volume V1 Volume Types client"""
diff --git a/tempest/services/volume/v1/json/availability_zone_client.py b/tempest/services/volume/v1/json/availability_zone_client.py
new file mode 100644
index 0000000..d8180fa
--- /dev/null
+++ b/tempest/services/volume/v1/json/availability_zone_client.py
@@ -0,0 +1,21 @@
+# 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.services.volume.base import base_availability_zone_client
+
+
+class VolumeAvailabilityZoneClient(
+ base_availability_zone_client.BaseVolumeAvailabilityZoneClient):
+ """Volume V1 availability zone client."""
diff --git a/tempest/services/volume/v1/json/backups_client.py b/tempest/services/volume/v1/json/backups_client.py
new file mode 100644
index 0000000..ac6db6a
--- /dev/null
+++ b/tempest/services/volume/v1/json/backups_client.py
@@ -0,0 +1,20 @@
+# Copyright 2014 OpenStack Foundation
+# 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.services.volume.base import base_backups_client
+
+
+class BackupsClient(base_backups_client.BaseBackupsClient):
+ """Volume V1 Backups client"""
diff --git a/tempest/services/volume/json/extensions_client.py b/tempest/services/volume/v1/json/extensions_client.py
similarity index 61%
copy from tempest/services/volume/json/extensions_client.py
copy to tempest/services/volume/v1/json/extensions_client.py
index d7d3197..f99d0f5 100644
--- a/tempest/services/volume/json/extensions_client.py
+++ b/tempest/services/volume/v1/json/extensions_client.py
@@ -13,20 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
-from oslo_serialization import jsonutils as json
-
-from tempest.common import service_client
+from tempest.services.volume.base import base_extensions_client
-class BaseExtensionsClient(service_client.ServiceClient):
-
- def list_extensions(self):
- url = 'extensions'
- resp, body = self.get(url)
- body = json.loads(body)
- self.expected_success(200, resp.status)
- return service_client.ResponseBody(resp, body)
-
-
-class ExtensionsClient(BaseExtensionsClient):
+class ExtensionsClient(base_extensions_client.BaseExtensionsClient):
"""Volume V1 extensions client."""
diff --git a/tempest/services/volume/v1/json/qos_client.py b/tempest/services/volume/v1/json/qos_client.py
new file mode 100644
index 0000000..b2b2195
--- /dev/null
+++ b/tempest/services/volume/v1/json/qos_client.py
@@ -0,0 +1,19 @@
+# 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.services.volume.base import base_qos_client
+
+
+class QosSpecsClient(base_qos_client.BaseQosSpecsClient):
+ """Volume V1 QoS client."""
diff --git a/tempest/services/volume/v1/json/snapshots_client.py b/tempest/services/volume/v1/json/snapshots_client.py
new file mode 100644
index 0000000..b039c2b
--- /dev/null
+++ b/tempest/services/volume/v1/json/snapshots_client.py
@@ -0,0 +1,17 @@
+# 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.services.volume.base import base_snapshots_client
+
+
+class SnapshotsClient(base_snapshots_client.BaseSnapshotsClient):
+ """Client class to send CRUD Volume V1 API requests."""
diff --git a/tempest/services/volume/v1/json/volumes_client.py b/tempest/services/volume/v1/json/volumes_client.py
new file mode 100644
index 0000000..7782043
--- /dev/null
+++ b/tempest/services/volume/v1/json/volumes_client.py
@@ -0,0 +1,20 @@
+# Copyright 2012 OpenStack Foundation
+# 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.services.volume.base import base_volumes_client
+
+
+class VolumesClient(base_volumes_client.BaseVolumesClient):
+ """Client class to send CRUD Volume V1 API requests"""
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 649c9ec..a1d8b61 100644
--- a/tempest/services/volume/v2/json/admin/volume_hosts_client.py
+++ b/tempest/services/volume/v2/json/admin/volume_hosts_client.py
@@ -13,10 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
-
-from tempest.services.volume.json.admin import volume_hosts_client
+from tempest.services.volume.base.admin import base_volume_hosts_client
-class VolumeHostsV2Client(volume_hosts_client.BaseVolumeHostsClient):
+class VolumeHostsV2Client(base_volume_hosts_client.BaseVolumeHostsClient):
"""Client class to send CRUD Volume V2 API requests"""
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 80fffc7..a89ba2f 100644
--- a/tempest/services/volume/v2/json/admin/volume_quotas_client.py
+++ b/tempest/services/volume/v2/json/admin/volume_quotas_client.py
@@ -13,9 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
-from tempest.services.volume.json.admin import volume_quotas_client
+from tempest.services.volume.base.admin import base_volume_quotas_client
-class VolumeQuotasV2Client(volume_quotas_client.BaseVolumeQuotasClient):
+class VolumeQuotasV2Client(base_volume_quotas_client.BaseVolumeQuotasClient):
"""Client class to send CRUD Volume V2 API requests"""
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 88eb82f..da7a4ea 100644
--- a/tempest/services/volume/v2/json/admin/volume_services_client.py
+++ b/tempest/services/volume/v2/json/admin/volume_services_client.py
@@ -13,9 +13,10 @@
# License for the specific language governing permissions and limitations
# under the License.
-from tempest.services.volume.json.admin import volume_services_client as vs_cli
+from tempest.services.volume.base.admin import base_volume_services_client
-class VolumesServicesV2Client(vs_cli.BaseVolumesServicesClient):
+class VolumesServicesV2Client(
+ base_volume_services_client.BaseVolumesServicesClient):
"""Client class to send CRUD Volume V2 API requests"""
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 78fe8e5..d63acf5 100644
--- a/tempest/services/volume/v2/json/admin/volume_types_client.py
+++ b/tempest/services/volume/v2/json/admin/volume_types_client.py
@@ -13,10 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
-
-from tempest.services.volume.json.admin import volume_types_client
+from tempest.services.volume.base.admin import base_volume_types_client
-class VolumeTypesV2Client(volume_types_client.BaseVolumeTypesClient):
+class VolumeTypesV2Client(base_volume_types_client.BaseVolumeTypesClient):
"""Client class to send CRUD Volume V2 API requests"""
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 2e1ab20..a4fc9fe 100644
--- a/tempest/services/volume/v2/json/availability_zone_client.py
+++ b/tempest/services/volume/v2/json/availability_zone_client.py
@@ -13,9 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
-from tempest.services.volume.json import availability_zone_client
+from tempest.services.volume.base import base_availability_zone_client
class VolumeV2AvailabilityZoneClient(
- availability_zone_client.BaseVolumeAvailabilityZoneClient):
+ base_availability_zone_client.BaseVolumeAvailabilityZoneClient):
api_version = "v2"
diff --git a/tempest/services/volume/v2/json/backups_client.py b/tempest/services/volume/v2/json/backups_client.py
index 8e87505..15d363b 100644
--- a/tempest/services/volume/v2/json/backups_client.py
+++ b/tempest/services/volume/v2/json/backups_client.py
@@ -13,9 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
-from tempest.services.volume.json import backups_client
+from tempest.services.volume.base import base_backups_client
-class BackupsClientV2(backups_client.BaseBackupsClient):
+class BackupsClientV2(base_backups_client.BaseBackupsClient):
"""Client class to send CRUD Volume V2 API requests"""
api_version = "v2"
diff --git a/tempest/services/volume/v2/json/extensions_client.py b/tempest/services/volume/v2/json/extensions_client.py
index 3e32c0c..004b232 100644
--- a/tempest/services/volume/v2/json/extensions_client.py
+++ b/tempest/services/volume/v2/json/extensions_client.py
@@ -13,8 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
-from tempest.services.volume.json import extensions_client
+from tempest.services.volume.base import base_extensions_client
-class ExtensionsV2Client(extensions_client.BaseExtensionsClient):
+class ExtensionsV2Client(base_extensions_client.BaseExtensionsClient):
api_version = "v2"
diff --git a/tempest/services/volume/v2/json/qos_client.py b/tempest/services/volume/v2/json/qos_client.py
index 42bd1c9..e8b680a 100644
--- a/tempest/services/volume/v2/json/qos_client.py
+++ b/tempest/services/volume/v2/json/qos_client.py
@@ -12,8 +12,8 @@
# License for the specific language governing permissions and limitations
# under the License.
-from tempest.services.volume.json import qos_client
+from tempest.services.volume.base import base_qos_client
-class QosSpecsV2Client(qos_client.BaseQosSpecsClient):
+class QosSpecsV2Client(base_qos_client.BaseQosSpecsClient):
api_version = "v2"
diff --git a/tempest/services/volume/v2/json/snapshots_client.py b/tempest/services/volume/v2/json/snapshots_client.py
index a94f9cd..28a9e98 100644
--- a/tempest/services/volume/v2/json/snapshots_client.py
+++ b/tempest/services/volume/v2/json/snapshots_client.py
@@ -10,10 +10,10 @@
# License for the specific language governing permissions and limitations
# under the License.
-from tempest.services.volume.json import snapshots_client
+from tempest.services.volume.base import base_snapshots_client
-class SnapshotsV2Client(snapshots_client.BaseSnapshotsClient):
+class SnapshotsV2Client(base_snapshots_client.BaseSnapshotsClient):
"""Client class to send CRUD Volume V2 API requests."""
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 a56a7be..51daa94 100644
--- a/tempest/services/volume/v2/json/volumes_client.py
+++ b/tempest/services/volume/v2/json/volumes_client.py
@@ -13,10 +13,10 @@
# License for the specific language governing permissions and limitations
# under the License.
-from tempest.services.volume.json import volumes_client
+from tempest.services.volume.base import base_volumes_client
-class VolumesV2Client(volumes_client.BaseVolumesClient):
+class VolumesV2Client(base_volumes_client.BaseVolumesClient):
"""Client class to send CRUD Volume V2 API requests"""
api_version = "v2"
create_resp = 202
diff --git a/tempest/test.py b/tempest/test.py
index 7b508ac..30eb93d 100644
--- a/tempest/test.py
+++ b/tempest/test.py
@@ -27,6 +27,7 @@
from oslo_serialization import jsonutils as json
from oslo_utils import importutils
import six
+from tempest_lib import decorators
import testscenarios
import testtools
@@ -43,6 +44,8 @@
CONF = config.CONF
+idempotent_id = decorators.idempotent_id
+
def attr(**kwargs):
"""A decorator which applies the testtools attr decorator
@@ -62,23 +65,6 @@
return decorator
-def idempotent_id(id):
- """Stub for metadata decorator"""
- if not isinstance(id, six.string_types):
- raise TypeError('Test idempotent_id must be string not %s'
- '' % type(id).__name__)
- uuid.UUID(id)
-
- def decorator(f):
- f = testtools.testcase.attr('id-%s' % id)(f)
- if f.__doc__:
- f.__doc__ = 'Test idempotent id: %s\n%s' % (id, f.__doc__)
- else:
- f.__doc__ = 'Test idempotent id: %s' % id
- return f
- return decorator
-
-
def get_service_list():
service_list = {
'compute': CONF.service_available.nova,
@@ -495,7 +481,7 @@
:param credential_type: string - primary, alt or admin
:param roles: list of roles
- :returns the created client manager
+ :returns: the created client manager
:raises skipException: if the requested credentials are not available
"""
if all([roles, credential_type]):
@@ -612,8 +598,8 @@
admin_creds = cred_provider.get_admin_creds()
admin_manager = clients.Manager(admin_creds)
networks_client = admin_manager.compute_networks_client
- return fixed_network.get_tenant_network(cred_provider,
- networks_client)
+ return fixed_network.get_tenant_network(
+ cred_provider, networks_client, CONF.compute.fixed_network_name)
def assertEmpty(self, list, msg=None):
self.assertTrue(len(list) == 0, msg)
diff --git a/tempest/tests/cmd/test_javelin.py b/tempest/tests/cmd/test_javelin.py
index ea0b7a7..d328d56 100644
--- a/tempest/tests/cmd/test_javelin.py
+++ b/tempest/tests/cmd/test_javelin.py
@@ -109,8 +109,9 @@
self.useFixture(mockpatch.Patch(
'tempest.common.identity.get_tenant_by_name',
return_value=self.fake_object['tenant']))
- self.fake_client.identity.get_user_by_username.side_effect = \
- lib_exc.NotFound("user is not found")
+ self.useFixture(mockpatch.Patch(
+ 'tempest.common.identity.get_user_by_username',
+ side_effect=lib_exc.NotFound("user is not found")))
self.useFixture(mockpatch.PatchObject(javelin, "keystone_admin",
return_value=self.fake_client))
@@ -309,8 +310,11 @@
fake_auth = self.fake_client
fake_auth.identity.list_tenants.return_value = \
{'tenants': [fake_tenant]}
- fake_auth.identity.get_user_by_username.return_value = fake_user
+ fake_auth.identity.list_users.return_value = {'users': [fake_user]}
+ self.useFixture(mockpatch.Patch(
+ 'tempest.common.identity.get_user_by_username',
+ return_value=fake_user))
self.useFixture(mockpatch.PatchObject(javelin, "keystone_admin",
return_value=fake_auth))
diff --git a/tempest/tests/common/test_preprov_creds.py b/tempest/tests/common/test_preprov_creds.py
index 36dd976..fd7df16 100644
--- a/tempest/tests/common/test_preprov_creds.py
+++ b/tempest/tests/common/test_preprov_creds.py
@@ -17,17 +17,17 @@
import mock
from oslo_concurrency.fixture import lockutils as lockutils_fixtures
-from oslo_concurrency import lockutils
from oslo_config import cfg
from oslotest import mockpatch
+import shutil
import six
from tempest_lib import auth
+from tempest_lib import exceptions as lib_exc
from tempest_lib.services.identity.v2 import token_client
from tempest.common import cred_provider
from tempest.common import preprov_creds
from tempest import config
-from tempest import exceptions
from tempest.tests import base
from tempest.tests import fake_config
from tempest.tests import fake_http
@@ -38,7 +38,11 @@
fixed_params = {'name': 'test class',
'identity_version': 'v2',
- 'admin_role': 'admin'}
+ 'test_accounts_file': 'fake_accounts_file',
+ 'accounts_lock_dir': 'fake_locks_dir',
+ 'admin_role': 'admin',
+ 'object_storage_operator_role': 'operator',
+ 'object_storage_reseller_admin_role': 'reseller'}
def setUp(self):
super(TestPreProvisionedCredentials, self).setUp()
@@ -77,9 +81,13 @@
self.accounts_mock = self.useFixture(mockpatch.Patch(
'tempest.common.preprov_creds.read_accounts_yaml',
return_value=self.test_accounts))
- cfg.CONF.set_default('test_accounts_file', 'fake_path', group='auth')
self.useFixture(mockpatch.Patch('os.path.isfile', return_value=True))
+ def tearDown(self):
+ super(TestPreProvisionedCredentials, self).tearDown()
+ shutil.rmtree(self.fixed_params['accounts_lock_dir'],
+ ignore_errors=True)
+
def _get_hash_list(self, accounts_list):
hash_list = []
for account in accounts_list:
@@ -147,11 +155,10 @@
with mock.patch('six.moves.builtins.open', mock.mock_open(),
create=True) as open_mock:
test_account_class._get_free_hash(hash_list)
- lock_path = os.path.join(lockutils.get_lock_path(
- preprov_creds.CONF), 'test_accounts', hash_list[0])
+ lock_path = os.path.join(self.fixed_params['accounts_lock_dir'],
+ hash_list[0])
open_mock.assert_called_once_with(lock_path, 'w')
- mkdir_path = os.path.join(
- preprov_creds.CONF.oslo_concurrency.lock_path, 'test_accounts')
+ mkdir_path = os.path.join(self.fixed_params['accounts_lock_dir'])
mkdir_mock.mock.assert_called_once_with(mkdir_path)
@mock.patch('oslo_concurrency.lockutils.lock')
@@ -165,7 +172,7 @@
**self.fixed_params)
with mock.patch('six.moves.builtins.open', mock.mock_open(),
create=True):
- self.assertRaises(exceptions.InvalidConfiguration,
+ self.assertRaises(lib_exc.InvalidCredentials,
test_account_class._get_free_hash, hash_list)
@mock.patch('oslo_concurrency.lockutils.lock')
@@ -187,9 +194,8 @@
with mock.patch('six.moves.builtins.open', mock.mock_open(),
create=True) as open_mock:
test_account_class._get_free_hash(hash_list)
- lock_path = os.path.join(
- lockutils.get_lock_path(preprov_creds.CONF),
- 'test_accounts', hash_list[3])
+ lock_path = os.path.join(self.fixed_params['accounts_lock_dir'],
+ hash_list[3])
open_mock.assert_has_calls([mock.call(lock_path, 'w')])
@mock.patch('oslo_concurrency.lockutils.lock')
@@ -204,11 +210,9 @@
remove_mock = self.useFixture(mockpatch.Patch('os.remove'))
rmdir_mock = self.useFixture(mockpatch.Patch('os.rmdir'))
test_account_class.remove_hash(hash_list[2])
- hash_path = os.path.join(lockutils.get_lock_path(preprov_creds.CONF),
- 'test_accounts',
+ hash_path = os.path.join(self.fixed_params['accounts_lock_dir'],
hash_list[2])
- lock_path = os.path.join(preprov_creds.CONF.oslo_concurrency.lock_path,
- 'test_accounts')
+ lock_path = self.fixed_params['accounts_lock_dir']
remove_mock.mock.assert_called_once_with(hash_path)
rmdir_mock.mock.assert_called_once_with(lock_path)
@@ -225,8 +229,7 @@
remove_mock = self.useFixture(mockpatch.Patch('os.remove'))
rmdir_mock = self.useFixture(mockpatch.Patch('os.rmdir'))
test_account_class.remove_hash(hash_list[2])
- hash_path = os.path.join(lockutils.get_lock_path(preprov_creds.CONF),
- 'test_accounts',
+ hash_path = os.path.join(self.fixed_params['accounts_lock_dir'],
hash_list[2])
remove_mock.mock.assert_called_once_with(hash_path)
rmdir_mock.mock.assert_not_called()
@@ -316,7 +319,7 @@
return_value=test_accounts))
test_accounts_class = preprov_creds.PreProvisionedCredentialProvider(
**self.fixed_params)
- with mock.patch('tempest.services.compute.json.networks_client.'
+ with mock.patch('tempest_lib.services.compute.networks_client.'
'NetworksClient.list_networks',
return_value={'networks': [{'name': 'network-2',
'id': 'fake-id',
diff --git a/tempest/tests/common/test_service_clients.py b/tempest/tests/common/test_service_clients.py
index 4225da8..8de014f 100644
--- a/tempest/tests/common/test_service_clients.py
+++ b/tempest/tests/common/test_service_clients.py
@@ -19,11 +19,9 @@
from tempest.services.baremetal.v1.json import baremetal_client
from tempest.services.compute.json import floating_ips_client
from tempest.services.compute.json import interfaces_client
-from tempest.services.compute.json import quota_classes_client
from tempest.services.compute.json import security_group_rules_client
from tempest.services.compute.json import server_groups_client
from tempest.services.compute.json import servers_client
-from tempest.services.compute.json import services_client
from tempest.services.compute.json import volumes_client \
as compute_volumes_client
from tempest.services.data_processing.v1_1 import data_processing_client
@@ -38,27 +36,28 @@
from tempest.services.identity.v3.json import policy_client
from tempest.services.identity.v3.json import region_client
from tempest.services.identity.v3.json import service_client
-from tempest.services.image.v1.json import image_client
-from tempest.services.image.v2.json import image_client as image_v2_client
+from tempest.services.image.v1.json import images_client
+from tempest.services.image.v2.json import images_client as images_v2_client
from tempest.services.messaging.json import messaging_client
from tempest.services.network.json import network_client
from tempest.services.object_storage import account_client
from tempest.services.object_storage import container_client
from tempest.services.object_storage import object_client
from tempest.services.orchestration.json import orchestration_client
+from tempest.services.telemetry.json import alarming_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 \
+from tempest.services.volume.v1.json.admin import volume_hosts_client
+from tempest.services.volume.v1.json.admin import volume_quotas_client
+from tempest.services.volume.v1.json.admin import volume_services_client
+from tempest.services.volume.v1.json.admin import volume_types_client
+from tempest.services.volume.v1.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 \
+from tempest.services.volume.v1.json import backups_client
+from tempest.services.volume.v1.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.v1.json import qos_client
+from tempest.services.volume.v1.json import snapshots_client
+from tempest.services.volume.v1.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 \
@@ -89,11 +88,9 @@
baremetal_client.BaremetalClient,
floating_ips_client.FloatingIPsClient,
interfaces_client.InterfacesClient,
- quota_classes_client.QuotaClassesClient,
security_group_rules_client.SecurityGroupRulesClient,
server_groups_client.ServerGroupsClient,
servers_client.ServersClient,
- services_client.ServicesClient,
compute_volumes_client.VolumesClient,
data_processing_client.DataProcessingClient,
db_flavor_client.DatabaseFlavorsClient,
@@ -105,6 +102,7 @@
object_client.ObjectClient,
orchestration_client.OrchestrationClient,
telemetry_client.TelemetryClient,
+ alarming_client.AlarmingClient,
qos_client.QosSpecsClient,
volume_hosts_client.VolumeHostsClient,
volume_quotas_client.VolumeQuotasClient,
@@ -132,8 +130,8 @@
policy_client.PolicyClient,
region_client.RegionClient,
service_client.ServiceClient,
- image_client.ImageClient,
- image_v2_client.ImageClientV2
+ images_client.ImagesClient,
+ images_v2_client.ImagesClientV2
]
for client in test_clients:
diff --git a/tempest/tests/common/test_waiters.py b/tempest/tests/common/test_waiters.py
index 68a8295..c7cc638 100644
--- a/tempest/tests/common/test_waiters.py
+++ b/tempest/tests/common/test_waiters.py
@@ -18,7 +18,7 @@
from tempest.common import waiters
from tempest import exceptions
-from tempest.services.volume.json import volumes_client
+from tempest.services.volume.base import base_volumes_client
from tempest.tests import base
@@ -53,7 +53,7 @@
def test_wait_for_volume_status_error_restoring(self, mock_sleep):
# Tests that the wait method raises VolumeRestoreErrorException if
# the volume status is 'error_restoring'.
- client = mock.Mock(spec=volumes_client.BaseVolumesClient,
+ client = mock.Mock(spec=base_volumes_client.BaseVolumesClient,
build_interval=1)
volume1 = {'volume': {'status': 'restoring-backup'}}
volume2 = {'volume': {'status': 'error_restoring'}}
diff --git a/tempest/tests/common/utils/linux/test_remote_client.py b/tempest/tests/common/utils/linux/test_remote_client.py
index 3ff8e0d..e596aab 100644
--- a/tempest/tests/common/utils/linux/test_remote_client.py
+++ b/tempest/tests/common/utils/linux/test_remote_client.py
@@ -146,8 +146,11 @@
self._assert_exec_called_with(
"sudo ip addr add %s/%s dev %s" % (ip, '28', nic))
- def test_turn_nic_on(self):
+ def test_set_nic_state(self):
nic = 'eth0'
- self.conn.turn_nic_on(nic)
+ self.conn.set_nic_state(nic)
self._assert_exec_called_with(
'sudo ip link set %s up' % nic)
+ self.conn.set_nic_state(nic, "down")
+ self._assert_exec_called_with(
+ 'sudo ip link set %s down' % nic)
diff --git a/tempest/tests/services/compute/test_images_client.py b/tempest/tests/services/compute/test_images_client.py
deleted file mode 100644
index 1d532b7..0000000
--- a/tempest/tests/services/compute/test_images_client.py
+++ /dev/null
@@ -1,240 +0,0 @@
-# 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 copy
-
-from oslotest import mockpatch
-from tempest_lib import exceptions as lib_exc
-
-from tempest.services.compute.json import images_client
-from tempest.tests import fake_auth_provider
-from tempest.tests.services.compute import base
-
-
-class TestImagesClient(base.BaseComputeServiceTest):
- # Data Dictionaries used for testing #
- FAKE_IMAGE_METADATA = {
- "list":
- {"metadata": {
- "auto_disk_config": "True",
- "Label": "Changed"
- }},
- "set_item":
- {"meta": {
- "auto_disk_config": "True"
- }},
- "show_item":
- {"meta": {
- "kernel_id": "nokernel",
- }},
- "update":
- {"metadata": {
- "kernel_id": "False",
- "Label": "UpdatedImage"
- }},
- "set":
- {"metadata": {
- "Label": "Changed",
- "auto_disk_config": "True"
- }},
- "delete_item": {}
- }
-
- FAKE_IMAGE_DATA = {
- "list":
- {"images": [
- {"id": "70a599e0-31e7-49b7-b260-868f441e862b",
- "links": [
- {"href": "http://openstack.example.com/v2/openstack" +
- "/images/70a599e0-31e7-49b7-b260-868f441e862b",
- "rel": "self"
- }
- ],
- "name": "fakeimage7"
- }]},
- "show": {"image": {
- "created": "2011-01-01T01:02:03Z",
- "id": "70a599e0-31e7-49b7-b260-868f441e862b",
- "links": [
- {
- "href": "http://openstack.example.com/v2/openstack" +
- "/images/70a599e0-31e7-49b7-b260-868f441e862b",
- "rel": "self"
- },
- ],
- "metadata": {
- "architecture": "x86_64",
- "auto_disk_config": "True",
- "kernel_id": "nokernel",
- "ramdisk_id": "nokernel"
- },
- "minDisk": 0,
- "minRam": 0,
- "name": "fakeimage7",
- "progress": 100,
- "status": "ACTIVE",
- "updated": "2011-01-01T01:02:03Z"}},
- "delete": {}
- }
- func2mock = {
- 'get': 'tempest.common.service_client.ServiceClient.get',
- 'post': 'tempest.common.service_client.ServiceClient.post',
- 'put': 'tempest.common.service_client.ServiceClient.put',
- 'delete': 'tempest.common.service_client.ServiceClient.delete'}
- # Variable definition
- FAKE_IMAGE_ID = FAKE_IMAGE_DATA['show']['image']['id']
- FAKE_CREATE_INFO = {'location': 'None'}
- FAKE_METADATA = FAKE_IMAGE_METADATA['show_item']['meta']
-
- def setUp(self):
- super(TestImagesClient, self).setUp()
- fake_auth = fake_auth_provider.FakeAuthProvider()
- self.client = images_client.ImagesClient(fake_auth,
- "compute", "regionOne")
-
- def _test_image_operation(self, operation="delete", bytes_body=False):
- response_code = 200
- mock_operation = self.func2mock['get']
- expected_op = self.FAKE_IMAGE_DATA[operation]
- params = {"image_id": self.FAKE_IMAGE_ID}
- if operation == 'list':
- function = self.client.list_images
- elif operation == 'show':
- function = self.client.show_image
- else:
- function = self.client.delete_image
- mock_operation = self.func2mock['delete']
- response_code = 204
-
- self.check_service_client_function(
- function, mock_operation, expected_op,
- bytes_body, response_code, **params)
-
- def _test_image_metadata(self, operation="set_item", bytes_body=False):
- response_code = 200
- expected_op = self.FAKE_IMAGE_METADATA[operation]
- if operation == 'list':
- function = self.client.list_image_metadata
- mock_operation = self.func2mock['get']
- params = {"image_id": self.FAKE_IMAGE_ID}
-
- elif operation == 'set':
- function = self.client.set_image_metadata
- mock_operation = self.func2mock['put']
- params = {"image_id": "_dummy_data",
- "meta": self.FAKE_METADATA}
-
- elif operation == 'update':
- function = self.client.update_image_metadata
- mock_operation = self.func2mock['post']
- params = {"image_id": self.FAKE_IMAGE_ID,
- "meta": self.FAKE_METADATA}
-
- elif operation == 'show_item':
- mock_operation = self.func2mock['get']
- function = self.client.show_image_metadata_item
- params = {"image_id": self.FAKE_IMAGE_ID,
- "key": "123"}
-
- elif operation == 'delete_item':
- function = self.client.delete_image_metadata_item
- mock_operation = self.func2mock['delete']
- response_code = 204
- params = {"image_id": self.FAKE_IMAGE_ID,
- "key": "123"}
-
- else:
- function = self.client.set_image_metadata_item
- mock_operation = self.func2mock['put']
- params = {"image_id": self.FAKE_IMAGE_ID,
- "key": "123",
- "meta": self.FAKE_METADATA}
-
- self.check_service_client_function(
- function, mock_operation, expected_op,
- bytes_body, response_code, **params)
-
- def _test_resource_deleted(self, bytes_body=False):
- params = {"id": self.FAKE_IMAGE_ID}
- expected_op = self.FAKE_IMAGE_DATA['show']['image']
- self.useFixture(mockpatch.Patch('tempest.services.compute.json'
- '.images_client.ImagesClient.show_image',
- side_effect=lib_exc.NotFound))
- self.assertEqual(True, self.client.is_resource_deleted(**params))
- tempdata = copy.deepcopy(self.FAKE_IMAGE_DATA['show'])
- tempdata['image']['id'] = None
- self.useFixture(mockpatch.Patch('tempest.services.compute.json'
- '.images_client.ImagesClient.show_image',
- return_value=expected_op))
- self.assertEqual(False, self.client.is_resource_deleted(**params))
-
- def test_list_images_with_str_body(self):
- self._test_image_operation('list')
-
- def test_list_images_with_bytes_body(self):
- self._test_image_operation('list', True)
-
- def test_show_image_with_str_body(self):
- self._test_image_operation('show')
-
- def test_show_image_with_bytes_body(self):
- self._test_image_operation('show', True)
-
- def test_delete_image_with_str_body(self):
- self._test_image_operation('delete')
-
- def test_delete_image_with_bytes_body(self):
- self._test_image_operation('delete', True)
-
- def test_list_image_metadata_with_str_body(self):
- self._test_image_metadata('list')
-
- def test_list_image_metadata_with_bytes_body(self):
- self._test_image_metadata('list', True)
-
- def test_set_image_metadata_with_str_body(self):
- self._test_image_metadata('set')
-
- def test_set_image_metadata_with_bytes_body(self):
- self._test_image_metadata('set', True)
-
- def test_update_image_metadata_with_str_body(self):
- self._test_image_metadata('update')
-
- def test_update_image_metadata_with_bytes_body(self):
- self._test_image_metadata('update', True)
-
- def test_set_image_metadata_item_with_str_body(self):
- self._test_image_metadata()
-
- def test_set_image_metadata_item_with_bytes_body(self):
- self._test_image_metadata(bytes_body=True)
-
- def test_show_image_metadata_item_with_str_body(self):
- self._test_image_metadata('show_item')
-
- def test_show_image_metadata_item_with_bytes_body(self):
- self._test_image_metadata('show_item', True)
-
- def test_delete_image_metadata_item_with_str_body(self):
- self._test_image_metadata('delete_item')
-
- def test_delete_image_metadata_item_with_bytes_body(self):
- self._test_image_metadata('delete_item', True)
-
- def test_resource_delete_with_str_body(self):
- self._test_resource_deleted()
-
- def test_resource_delete_with_bytes_body(self):
- self._test_resource_deleted(True)
diff --git a/tempest/tests/services/compute/test_instance_usage_audit_log_client.py b/tempest/tests/services/compute/test_instance_usage_audit_log_client.py
deleted file mode 100644
index b4af9d5..0000000
--- a/tempest/tests/services/compute/test_instance_usage_audit_log_client.py
+++ /dev/null
@@ -1,74 +0,0 @@
-# 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 datetime
-
-from tempest_lib.tests import fake_auth_provider
-
-from tempest.services.compute.json import instance_usage_audit_log_client
-from tempest.tests.services.compute import base
-
-
-class TestInstanceUsagesAuditLogClient(base.BaseComputeServiceTest):
-
- FAKE_AUDIT_LOG = {
- "hosts_not_run": [
- "f4eb7cfd155f4574967f8b55a7faed75"
- ],
- "log": {},
- "num_hosts": 1,
- "num_hosts_done": 0,
- "num_hosts_not_run": 1,
- "num_hosts_running": 0,
- "overall_status": "0 of 1 hosts done. 0 errors.",
- "period_beginning": "2012-12-01 00:00:00",
- "period_ending": "2013-01-01 00:00:00",
- "total_errors": 0,
- "total_instances": 0
- }
-
- def setUp(self):
- super(TestInstanceUsagesAuditLogClient, self).setUp()
- fake_auth = fake_auth_provider.FakeAuthProvider()
- self.client = (instance_usage_audit_log_client.
- InstanceUsagesAuditLogClient(fake_auth, 'compute',
- 'regionOne'))
-
- def _test_list_instance_usage_audit_logs(self, bytes_body=False):
- self.check_service_client_function(
- self.client.list_instance_usage_audit_logs,
- 'tempest.common.service_client.ServiceClient.get',
- {"instance_usage_audit_logs": self.FAKE_AUDIT_LOG},
- bytes_body)
-
- def test_list_instance_usage_audit_logs_with_str_body(self):
- self._test_list_instance_usage_audit_logs()
-
- def test_list_instance_usage_audit_logs_with_bytes_body(self):
- self._test_list_instance_usage_audit_logs(bytes_body=True)
-
- def _test_show_instance_usage_audit_log(self, bytes_body=False):
- before_time = datetime.datetime(2012, 12, 1, 0, 0)
- self.check_service_client_function(
- self.client.show_instance_usage_audit_log,
- 'tempest.common.service_client.ServiceClient.get',
- {"instance_usage_audit_log": self.FAKE_AUDIT_LOG},
- bytes_body,
- time_before=before_time)
-
- def test_show_instance_usage_audit_log_with_str_body(self):
- self._test_show_instance_usage_audit_log()
-
- def test_show_network_with_bytes_body_with_bytes_body(self):
- self._test_show_instance_usage_audit_log(bytes_body=True)
diff --git a/tempest/tests/services/compute/test_limits_client.py b/tempest/tests/services/compute/test_limits_client.py
deleted file mode 100644
index 733d3d1..0000000
--- a/tempest/tests/services/compute/test_limits_client.py
+++ /dev/null
@@ -1,67 +0,0 @@
-# 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_lib.tests import fake_auth_provider
-
-from tempest.services.compute.json import limits_client
-from tempest.tests.services.compute import base
-
-
-class TestLimitsClient(base.BaseComputeServiceTest):
-
- def setUp(self):
- super(TestLimitsClient, self).setUp()
- fake_auth = fake_auth_provider.FakeAuthProvider()
- self.client = limits_client.LimitsClient(
- fake_auth, 'compute', 'regionOne')
-
- def _test_show_limits(self, bytes_body=False):
- expected = {
- "limits": {
- "rate": [],
- "absolute": {
- "maxServerMeta": 128,
- "maxPersonality": 5,
- "totalServerGroupsUsed": 0,
- "maxImageMeta": 128,
- "maxPersonalitySize": 10240,
- "maxServerGroups": 10,
- "maxSecurityGroupRules": 20,
- "maxTotalKeypairs": 100,
- "totalCoresUsed": 0,
- "totalRAMUsed": 0,
- "totalInstancesUsed": 0,
- "maxSecurityGroups": 10,
- "totalFloatingIpsUsed": 0,
- "maxTotalCores": 20,
- "totalSecurityGroupsUsed": 0,
- "maxTotalFloatingIps": 10,
- "maxTotalInstances": 10,
- "maxTotalRAMSize": 51200,
- "maxServerGroupMembers": 10
- }
- }
- }
-
- self.check_service_client_function(
- self.client.show_limits,
- 'tempest.common.service_client.ServiceClient.get',
- expected,
- bytes_body)
-
- def test_show_limits_with_str_body(self):
- self._test_show_limits()
-
- def test_show_limits_with_bytes_body(self):
- self._test_show_limits(bytes_body=True)
diff --git a/tempest/tests/services/compute/test_migrations_client.py b/tempest/tests/services/compute/test_migrations_client.py
deleted file mode 100644
index 55f2ef2..0000000
--- a/tempest/tests/services/compute/test_migrations_client.py
+++ /dev/null
@@ -1,53 +0,0 @@
-# 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_lib.tests import fake_auth_provider
-
-from tempest.services.compute.json import migrations_client
-from tempest.tests.services.compute import base
-
-
-class TestMigrationsClient(base.BaseComputeServiceTest):
- FAKE_MIGRATION_INFO = {"migrations": [{
- "created_at": "2012-10-29T13:42:02",
- "dest_compute": "compute2",
- "dest_host": "1.2.3.4",
- "dest_node": "node2",
- "id": 1234,
- "instance_uuid": "e9e4fdd7-f956-44ff-bfeb-d654a96ab3a2",
- "new_instance_type_id": 2,
- "old_instance_type_id": 1,
- "source_compute": "compute1",
- "source_node": "node1",
- "status": "finished",
- "updated_at": "2012-10-29T13:42:02"}]}
-
- def setUp(self):
- super(TestMigrationsClient, self).setUp()
- fake_auth = fake_auth_provider.FakeAuthProvider()
- self.mg_client_obj = migrations_client.MigrationsClient(
- fake_auth, 'compute', 'regionOne')
-
- def _test_list_migrations(self, bytes_body=False):
- self.check_service_client_function(
- self.mg_client_obj.list_migrations,
- 'tempest.common.service_client.ServiceClient.get',
- self.FAKE_MIGRATION_INFO,
- bytes_body)
-
- def test_list_migration_with_str_body(self):
- self._test_list_migrations()
-
- def test_list_migration_with_bytes_body(self):
- self._test_list_migrations(True)
diff --git a/tempest/tests/services/compute/test_networks_client.py b/tempest/tests/services/compute/test_networks_client.py
deleted file mode 100644
index cec8262..0000000
--- a/tempest/tests/services/compute/test_networks_client.py
+++ /dev/null
@@ -1,95 +0,0 @@
-# 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_lib.tests import fake_auth_provider
-
-from tempest.services.compute.json import networks_client
-from tempest.tests.services.compute import base
-
-
-class TestNetworksClient(base.BaseComputeServiceTest):
-
- FAKE_NETWORK = {
- "bridge": None,
- "vpn_public_port": None,
- "dhcp_start": None,
- "bridge_interface": None,
- "share_address": None,
- "updated_at": None,
- "id": "34d5ae1e-5659-49cf-af80-73bccd7d7ad3",
- "cidr_v6": None,
- "deleted_at": None,
- "gateway": None,
- "rxtx_base": None,
- "label": u'30d7',
- "priority": None,
- "project_id": None,
- "vpn_private_address": None,
- "deleted": None,
- "vlan": None,
- "broadcast": None,
- "netmask": None,
- "injected": None,
- "cidr": None,
- "vpn_public_address": None,
- "multi_host": None,
- "enable_dhcp": None,
- "dns2": None,
- "created_at": None,
- "host": None,
- "mtu": None,
- "gateway_v6": None,
- "netmask_v6": None,
- "dhcp_server": None,
- "dns1": None
- }
-
- network_id = "34d5ae1e-5659-49cf-af80-73bccd7d7ad3"
-
- FAKE_NETWORKS = [FAKE_NETWORK]
-
- def setUp(self):
- super(TestNetworksClient, self).setUp()
- fake_auth = fake_auth_provider.FakeAuthProvider()
- self.client = networks_client.NetworksClient(
- fake_auth, 'compute', 'regionOne')
-
- def _test_list_networks(self, bytes_body=False):
- fake_list = {"networks": self.FAKE_NETWORKS}
- self.check_service_client_function(
- self.client.list_networks,
- 'tempest.common.service_client.ServiceClient.get',
- fake_list,
- bytes_body)
-
- def test_list_networks_with_str_body(self):
- self._test_list_networks()
-
- def test_list_networks_with_bytes_body(self):
- self._test_list_networks(bytes_body=True)
-
- def _test_show_network(self, bytes_body=False):
- self.check_service_client_function(
- self.client.show_network,
- 'tempest.common.service_client.ServiceClient.get',
- {"network": self.FAKE_NETWORK},
- bytes_body,
- network_id=self.network_id
- )
-
- def test_show_network_with_str_body(self):
- self._test_show_network()
-
- def test_show_network_with_bytes_body(self):
- self._test_show_network(bytes_body=True)
diff --git a/tempest/tests/services/compute/test_quota_classes_client.py b/tempest/tests/services/compute/test_quota_classes_client.py
deleted file mode 100644
index 29800a2..0000000
--- a/tempest/tests/services/compute/test_quota_classes_client.py
+++ /dev/null
@@ -1,72 +0,0 @@
-# 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 copy
-
-from tempest_lib.tests import fake_auth_provider
-
-from tempest.services.compute.json import quota_classes_client
-from tempest.tests.services.compute import base
-
-
-class TestQuotaClassesClient(base.BaseComputeServiceTest):
-
- FAKE_QUOTA_CLASS_SET = {
- "injected_file_content_bytes": 10240,
- "metadata_items": 128,
- "server_group_members": 10,
- "server_groups": 10,
- "ram": 51200,
- "floating_ips": 10,
- "key_pairs": 100,
- "id": u'\u2740(*\xb4\u25e1`*)\u2740',
- "instances": 10,
- "security_group_rules": 20,
- "security_groups": 10,
- "injected_files": 5,
- "cores": 20,
- "fixed_ips": -1,
- "injected_file_path_bytes": 255,
- }
-
- def setUp(self):
- super(TestQuotaClassesClient, self).setUp()
- fake_auth = fake_auth_provider.FakeAuthProvider()
- self.client = quota_classes_client.QuotaClassesClient(
- fake_auth, 'compute', 'regionOne')
-
- def _test_show_quota_class_set(self, bytes_body=False):
- fake_body = {'quota_class_set': self.FAKE_QUOTA_CLASS_SET}
- self.check_service_client_function(
- self.client.show_quota_class_set,
- 'tempest.common.service_client.ServiceClient.get',
- fake_body,
- bytes_body,
- quota_class_id="test")
-
- def test_show_quota_class_set_with_str_body(self):
- self._test_show_quota_class_set()
-
- def test_show_quota_class_set_with_bytes_body(self):
- self._test_show_quota_class_set(bytes_body=True)
-
- def test_update_quota_class_set(self):
- fake_quota_class_set = copy.deepcopy(self.FAKE_QUOTA_CLASS_SET)
- fake_quota_class_set.pop("id")
- fake_body = {'quota_class_set': fake_quota_class_set}
- self.check_service_client_function(
- self.client.update_quota_class_set,
- 'tempest.common.service_client.ServiceClient.put',
- fake_body,
- quota_class_id="test")
diff --git a/tempest/tests/services/compute/test_quotas_client.py b/tempest/tests/services/compute/test_quotas_client.py
deleted file mode 100644
index 9a9d8fe..0000000
--- a/tempest/tests/services/compute/test_quotas_client.py
+++ /dev/null
@@ -1,93 +0,0 @@
-# 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 copy
-
-from tempest_lib.tests import fake_auth_provider
-
-from tempest.services.compute.json import quotas_client
-from tempest.tests.services.compute import base
-
-
-class TestQuotasClient(base.BaseComputeServiceTest):
-
- FAKE_QUOTA_SET = {
- "quota_set": {
- "injected_file_content_bytes": 10240,
- "metadata_items": 128,
- "server_group_members": 10,
- "server_groups": 10,
- "ram": 51200,
- "floating_ips": 10,
- "key_pairs": 100,
- "id": "8421f7be61064f50b680465c07f334af",
- "instances": 10,
- "security_group_rules": 20,
- "injected_files": 5,
- "cores": 20,
- "fixed_ips": -1,
- "injected_file_path_bytes": 255,
- "security_groups": 10}
- }
-
- project_id = "8421f7be61064f50b680465c07f334af"
-
- def setUp(self):
- super(TestQuotasClient, self).setUp()
- fake_auth = fake_auth_provider.FakeAuthProvider()
- self.client = quotas_client.QuotasClient(
- fake_auth, 'compute', 'regionOne')
-
- def _test_show_quota_set(self, bytes_body=False):
- self.check_service_client_function(
- self.client.show_quota_set,
- 'tempest.common.service_client.ServiceClient.get',
- self.FAKE_QUOTA_SET,
- to_utf=bytes_body,
- tenant_id=self.project_id)
-
- def test_show_quota_set_with_str_body(self):
- self._test_show_quota_set()
-
- def test_show_quota_set_with_bytes_body(self):
- self._test_show_quota_set(bytes_body=True)
-
- def _test_show_default_quota_set(self, bytes_body=False):
- self.check_service_client_function(
- self.client.show_default_quota_set,
- 'tempest.common.service_client.ServiceClient.get',
- self.FAKE_QUOTA_SET,
- to_utf=bytes_body,
- tenant_id=self.project_id)
-
- def test_show_default_quota_set_with_str_body(self):
- self._test_show_quota_set()
-
- def test_show_default_quota_set_with_bytes_body(self):
- self._test_show_quota_set(bytes_body=True)
-
- def test_update_quota_set(self):
- fake_quota_set = copy.deepcopy(self.FAKE_QUOTA_SET)
- fake_quota_set['quota_set'].pop("id")
- self.check_service_client_function(
- self.client.update_quota_set,
- 'tempest.common.service_client.ServiceClient.put',
- fake_quota_set,
- tenant_id=self.project_id)
-
- def test_delete_quota_set(self):
- self.check_service_client_function(
- self.client.delete_quota_set,
- 'tempest.common.service_client.ServiceClient.delete',
- {}, status=202, tenant_id=self.project_id)
diff --git a/tempest/tests/services/compute/test_security_group_default_rules_client.py b/tempest/tests/services/compute/test_security_group_default_rules_client.py
deleted file mode 100644
index 99ab305..0000000
--- a/tempest/tests/services/compute/test_security_group_default_rules_client.py
+++ /dev/null
@@ -1,89 +0,0 @@
-# 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_lib.tests import fake_auth_provider
-
-from tempest.services.compute.json import security_group_default_rules_client
-from tempest.tests.services.compute import base
-
-
-class TestSecurityGroupDefaultRulesClient(base.BaseComputeServiceTest):
- FAKE_RULE = {
- "from_port": 80,
- "id": 1,
- "ip_protocol": "TCP",
- "ip_range": {
- "cidr": "10.10.10.0/24"
- },
- "to_port": 80
- }
-
- def setUp(self):
- super(TestSecurityGroupDefaultRulesClient, self).setUp()
- fake_auth = fake_auth_provider.FakeAuthProvider()
- self.client = (security_group_default_rules_client.
- SecurityGroupDefaultRulesClient(fake_auth, 'compute',
- 'regionOne'))
-
- def _test_list_security_group_default_rules(self, bytes_body=False):
- self.check_service_client_function(
- self.client.list_security_group_default_rules,
- 'tempest.common.service_client.ServiceClient.get',
- {"security_group_default_rules": [self.FAKE_RULE]},
- to_utf=bytes_body)
-
- def test_list_security_group_default_rules_with_str_body(self):
- self._test_list_security_group_default_rules()
-
- def test_list_security_group_default_rules_with_bytes_body(self):
- self._test_list_security_group_default_rules(bytes_body=True)
-
- def _test_show_security_group_default_rule(self, bytes_body=False):
- self.check_service_client_function(
- self.client.show_security_group_default_rule,
- 'tempest.common.service_client.ServiceClient.get',
- {"security_group_default_rule": self.FAKE_RULE},
- to_utf=bytes_body,
- security_group_default_rule_id=1)
-
- def test_show_security_group_default_rule_with_str_body(self):
- self._test_show_security_group_default_rule()
-
- def test_show_security_group_default_rule_with_bytes_body(self):
- self._test_show_security_group_default_rule(bytes_body=True)
-
- def _test_create_security_default_group_rule(self, bytes_body=False):
- request_body = {
- "to_port": 80,
- "from_port": 80,
- "ip_protocol": "TCP",
- "cidr": "10.10.10.0/24"
- }
- self.check_service_client_function(
- self.client.create_security_default_group_rule,
- 'tempest.common.service_client.ServiceClient.post',
- {"security_group_default_rule": self.FAKE_RULE},
- to_utf=bytes_body, **request_body)
-
- def test_create_security_default_group_rule_with_str_body(self):
- self._test_create_security_default_group_rule()
-
- def test_create_security_default_group_rule_with_bytes_body(self):
- self._test_create_security_default_group_rule(bytes_body=True)
-
- def test_delete_security_group_default_rule(self):
- self.check_service_client_function(
- self.client.delete_security_group_default_rule,
- 'tempest.common.service_client.ServiceClient.delete',
- {}, status=204, security_group_default_rule_id=1)
diff --git a/tempest/tests/services/compute/test_security_groups_client.py b/tempest/tests/services/compute/test_security_groups_client.py
deleted file mode 100644
index 9e40b96..0000000
--- a/tempest/tests/services/compute/test_security_groups_client.py
+++ /dev/null
@@ -1,113 +0,0 @@
-# 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 oslotest import mockpatch
-from tempest_lib import exceptions as lib_exc
-from tempest_lib.tests import fake_auth_provider
-
-from tempest.services.compute.json import security_groups_client
-from tempest.tests.services.compute import base
-
-
-class TestSecurityGroupsClient(base.BaseComputeServiceTest):
-
- FAKE_SECURITY_GROUP_INFO = [{
- "description": "default",
- "id": "3fb26eb3-581b-4420-9963-b0879a026506",
- "name": "default",
- "rules": [],
- "tenant_id": "openstack"
- }]
-
- def setUp(self):
- super(TestSecurityGroupsClient, self).setUp()
- fake_auth = fake_auth_provider.FakeAuthProvider()
- self.client = security_groups_client.SecurityGroupsClient(
- fake_auth, 'compute', 'regionOne')
-
- def _test_list_security_groups(self, bytes_body=False):
- self.check_service_client_function(
- self.client.list_security_groups,
- 'tempest.common.service_client.ServiceClient.get',
- {"security_groups": self.FAKE_SECURITY_GROUP_INFO},
- to_utf=bytes_body)
-
- def test_list_security_groups_with_str_body(self):
- self._test_list_security_groups()
-
- def test_list_security_groups_with_bytes_body(self):
- self._test_list_security_groups(bytes_body=True)
-
- def _test_show_security_group(self, bytes_body=False):
- self.check_service_client_function(
- self.client.show_security_group,
- 'tempest.common.service_client.ServiceClient.get',
- {"security_group": self.FAKE_SECURITY_GROUP_INFO[0]},
- to_utf=bytes_body,
- security_group_id='fake-id')
-
- def test_show_security_group_with_str_body(self):
- self._test_show_security_group()
-
- def test_show_security_group_with_bytes_body(self):
- self._test_show_security_group(bytes_body=True)
-
- def _test_create_security_group(self, bytes_body=False):
- post_body = {"name": "test", "description": "test_group"}
- self.check_service_client_function(
- self.client.create_security_group,
- 'tempest.common.service_client.ServiceClient.post',
- {"security_group": self.FAKE_SECURITY_GROUP_INFO[0]},
- to_utf=bytes_body,
- kwargs=post_body)
-
- def test_create_security_group_with_str_body(self):
- self._test_create_security_group()
-
- def test_create_security_group_with_bytes_body(self):
- self._test_create_security_group(bytes_body=True)
-
- def _test_update_security_group(self, bytes_body=False):
- req_body = {"name": "test", "description": "test_group"}
- self.check_service_client_function(
- self.client.update_security_group,
- 'tempest.common.service_client.ServiceClient.put',
- {"security_group": self.FAKE_SECURITY_GROUP_INFO[0]},
- to_utf=bytes_body,
- security_group_id='fake-id',
- kwargs=req_body)
-
- def test_update_security_group_with_str_body(self):
- self._test_update_security_group()
-
- def test_update_security_group_with_bytes_body(self):
- self._test_update_security_group(bytes_body=True)
-
- def test_delete_security_group(self):
- self.check_service_client_function(
- self.client.delete_security_group,
- 'tempest.common.service_client.ServiceClient.delete',
- {}, status=202, security_group_id='fake-id')
-
- def test_is_resource_deleted_true(self):
- mod = ('tempest.services.compute.json.security_groups_client.'
- 'SecurityGroupsClient.show_security_group')
- self.useFixture(mockpatch.Patch(mod, side_effect=lib_exc.NotFound))
- self.assertTrue(self.client.is_resource_deleted('fake-id'))
-
- def test_is_resource_deleted_false(self):
- mod = ('tempest.services.compute.json.security_groups_client.'
- 'SecurityGroupsClient.show_security_group')
- self.useFixture(mockpatch.Patch(mod, return_value='success'))
- self.assertFalse(self.client.is_resource_deleted('fake-id'))
diff --git a/tempest/tests/services/compute/test_services_client.py b/tempest/tests/services/compute/test_services_client.py
deleted file mode 100644
index fce28e8..0000000
--- a/tempest/tests/services/compute/test_services_client.py
+++ /dev/null
@@ -1,95 +0,0 @@
-# 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 copy
-
-from tempest_lib.tests import fake_auth_provider
-
-from tempest.services.compute.json import services_client
-from tempest.tests.services.compute import base
-
-
-class TestServicesClient(base.BaseComputeServiceTest):
-
- FAKE_SERVICES = {
- "services":
- [{
- "status": "enabled",
- "binary": "nova-conductor",
- "zone": "internal",
- "state": "up",
- "updated_at": "2015-08-19T06:50:55.000000",
- "host": "controller",
- "disabled_reason": None,
- "id": 1
- }]
- }
-
- FAKE_SERVICE = {
- "service":
- {
- "status": "enabled",
- "binary": "nova-conductor",
- "host": "controller"
- }
- }
-
- def setUp(self):
- super(TestServicesClient, self).setUp()
- fake_auth = fake_auth_provider.FakeAuthProvider()
- self.client = services_client.ServicesClient(
- fake_auth, 'compute', 'regionOne')
-
- def test_list_services_with_str_body(self):
- self.check_service_client_function(
- self.client.list_services,
- 'tempest.common.service_client.ServiceClient.get',
- self.FAKE_SERVICES)
-
- def test_list_services_with_bytes_body(self):
- self.check_service_client_function(
- self.client.list_services,
- 'tempest.common.service_client.ServiceClient.get',
- self.FAKE_SERVICES, to_utf=True)
-
- def _test_enable_service(self, bytes_body=False):
- self.check_service_client_function(
- self.client.enable_service,
- 'tempest.common.service_client.ServiceClient.put',
- self.FAKE_SERVICE,
- bytes_body,
- host_name="nova-conductor", binary="controller")
-
- def test_enable_service_with_str_body(self):
- self._test_enable_service()
-
- def test_enable_service_with_bytes_body(self):
- self._test_enable_service(bytes_body=True)
-
- def _test_disable_service(self, bytes_body=False):
- fake_service = copy.deepcopy(self.FAKE_SERVICE)
- fake_service["service"]["status"] = "disable"
-
- self.check_service_client_function(
- self.client.disable_service,
- 'tempest.common.service_client.ServiceClient.put',
- fake_service,
- bytes_body,
- host_name="nova-conductor", binary="controller")
-
- def test_disable_service_with_str_body(self):
- self._test_disable_service()
-
- def test_disable_service_with_bytes_body(self):
- self._test_disable_service(bytes_body=True)
diff --git a/tempest/tests/services/compute/test_snapshots_client.py b/tempest/tests/services/compute/test_snapshots_client.py
deleted file mode 100644
index c24c6ae..0000000
--- a/tempest/tests/services/compute/test_snapshots_client.py
+++ /dev/null
@@ -1,103 +0,0 @@
-# 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 oslotest import mockpatch
-from tempest_lib import exceptions as lib_exc
-
-from tempest.services.compute.json import snapshots_client
-from tempest.tests import fake_auth_provider
-from tempest.tests.services.compute import base
-
-
-class TestSnapshotsClient(base.BaseComputeServiceTest):
-
- FAKE_SNAPSHOT = {
- "createdAt": "2015-10-02T16:27:54.724209",
- "displayDescription": u"Another \u1234.",
- "displayName": u"v\u1234-001",
- "id": "100",
- "size": 100,
- "status": "available",
- "volumeId": "12"
- }
-
- FAKE_SNAPSHOTS = {"snapshots": [FAKE_SNAPSHOT]}
-
- def setUp(self):
- super(TestSnapshotsClient, self).setUp()
- fake_auth = fake_auth_provider.FakeAuthProvider()
- self.client = snapshots_client.SnapshotsClient(
- fake_auth, 'compute', 'regionOne')
-
- def _test_create_snapshot(self, bytes_body=False):
- self.check_service_client_function(
- self.client.create_snapshot,
- 'tempest.common.service_client.ServiceClient.post',
- {"snapshot": self.FAKE_SNAPSHOT},
- to_utf=bytes_body, status=200,
- volume_id=self.FAKE_SNAPSHOT["volumeId"])
-
- def test_create_snapshot_with_str_body(self):
- self._test_create_snapshot()
-
- def test_create_shapshot_with_bytes_body(self):
- self._test_create_snapshot(bytes_body=True)
-
- def _test_show_snapshot(self, bytes_body=False):
- self.check_service_client_function(
- self.client.show_snapshot,
- 'tempest.common.service_client.ServiceClient.get',
- {"snapshot": self.FAKE_SNAPSHOT},
- to_utf=bytes_body, snapshot_id=self.FAKE_SNAPSHOT["id"])
-
- def test_show_snapshot_with_str_body(self):
- self._test_show_snapshot()
-
- def test_show_snapshot_with_bytes_body(self):
- self._test_show_snapshot(bytes_body=True)
-
- def _test_list_snapshots(self, bytes_body=False, **params):
- self.check_service_client_function(
- self.client.list_snapshots,
- 'tempest.common.service_client.ServiceClient.get',
- self.FAKE_SNAPSHOTS, to_utf=bytes_body, **params)
-
- def test_list_snapshots_with_str_body(self):
- self._test_list_snapshots()
-
- def test_list_snapshots_with_byte_body(self):
- self._test_list_snapshots(bytes_body=True)
-
- def test_list_snapshots_with_params(self):
- self._test_list_snapshots('fake')
-
- def test_delete_snapshot(self):
- self.check_service_client_function(
- self.client.delete_snapshot,
- 'tempest.common.service_client.ServiceClient.delete',
- {}, status=202, snapshot_id=self.FAKE_SNAPSHOT['id'])
-
- def test_is_resource_deleted_true(self):
- module = ('tempest.services.compute.json.snapshots_client.'
- 'SnapshotsClient.show_snapshot')
- self.useFixture(mockpatch.Patch(
- module, side_effect=lib_exc.NotFound))
- self.assertTrue(self.client.is_resource_deleted('fake-id'))
-
- def test_is_resource_deleted_false(self):
- module = ('tempest.services.compute.json.snapshots_client.'
- 'SnapshotsClient.show_snapshot')
- self.useFixture(mockpatch.Patch(
- module, return_value={}))
- self.assertFalse(self.client.is_resource_deleted('fake-id'))
diff --git a/tempest/tests/services/compute/test_tenant_networks_client.py b/tempest/tests/services/compute/test_tenant_networks_client.py
deleted file mode 100644
index 691792a..0000000
--- a/tempest/tests/services/compute/test_tenant_networks_client.py
+++ /dev/null
@@ -1,64 +0,0 @@
-# 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_lib.tests import fake_auth_provider
-
-from tempest.services.compute.json import tenant_networks_client
-from tempest.tests.services.compute import base
-
-
-class TestTenantNetworksClient(base.BaseComputeServiceTest):
-
- FAKE_NETWORK = {
- "cidr": "None",
- "id": "c2329eb4-cc8e-4439-ac4c-932369309e36",
- "label": u'\u30d7'
- }
-
- FAKE_NETWORKS = [FAKE_NETWORK]
-
- NETWORK_ID = FAKE_NETWORK['id']
-
- def setUp(self):
- super(TestTenantNetworksClient, self).setUp()
- fake_auth = fake_auth_provider.FakeAuthProvider()
- self.client = tenant_networks_client.TenantNetworksClient(
- fake_auth, 'compute', 'regionOne')
-
- def _test_list_tenant_networks(self, bytes_body=False):
- self.check_service_client_function(
- self.client.list_tenant_networks,
- 'tempest.common.service_client.ServiceClient.get',
- {"networks": self.FAKE_NETWORKS},
- bytes_body)
-
- def test_list_tenant_networks_with_str_body(self):
- self._test_list_tenant_networks()
-
- def test_list_tenant_networks_with_bytes_body(self):
- self._test_list_tenant_networks(bytes_body=True)
-
- def _test_show_tenant_network(self, bytes_body=False):
- self.check_service_client_function(
- self.client.show_tenant_network,
- 'tempest.common.service_client.ServiceClient.get',
- {"network": self.FAKE_NETWORK},
- bytes_body,
- network_id=self.NETWORK_ID)
-
- def test_show_tenant_network_with_str_body(self):
- self._test_show_tenant_network()
-
- def test_show_tenant_network_with_bytes_body(self):
- self._test_show_tenant_network(bytes_body=True)
diff --git a/tempest/tests/services/compute/test_tenant_usages_client.py b/tempest/tests/services/compute/test_tenant_usages_client.py
deleted file mode 100644
index 58e0b7a..0000000
--- a/tempest/tests/services/compute/test_tenant_usages_client.py
+++ /dev/null
@@ -1,80 +0,0 @@
-# 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_lib.tests import fake_auth_provider
-
-from tempest.services.compute.json import tenant_usages_client
-from tempest.tests.services.compute import base
-
-
-class TestTenantUsagesClient(base.BaseComputeServiceTest):
-
- FAKE_SERVER_USAGES = [{
- "ended_at": None,
- "flavor": "m1.tiny",
- "hours": 1.0,
- "instance_id": "1f1deceb-17b5-4c04-84c7-e0d4499c8fe0",
- "local_gb": 1,
- "memory_mb": 512,
- "name": "new-server-test",
- "started_at": "2012-10-08T20:10:44.541277",
- "state": "active",
- "tenant_id": "openstack",
- "uptime": 3600,
- "vcpus": 1
- }]
-
- FAKE_TENANT_USAGES = [{
- "server_usages": FAKE_SERVER_USAGES,
- "start": "2012-10-08T21:10:44.587336",
- "stop": "2012-10-08T22:10:44.587336",
- "tenant_id": "openstack",
- "total_hours": 1,
- "total_local_gb_usage": 1,
- "total_memory_mb_usage": 512,
- "total_vcpus_usage": 1
- }]
-
- def setUp(self):
- super(TestTenantUsagesClient, self).setUp()
- fake_auth = fake_auth_provider.FakeAuthProvider()
- self.client = tenant_usages_client.TenantUsagesClient(
- fake_auth, 'compute', 'regionOne')
-
- def _test_list_tenant_usages(self, bytes_body=False):
- self.check_service_client_function(
- self.client.list_tenant_usages,
- 'tempest.common.service_client.ServiceClient.get',
- {"tenant_usages": self.FAKE_TENANT_USAGES},
- to_utf=bytes_body)
-
- def test_list_tenant_usages_with_str_body(self):
- self._test_list_tenant_usages()
-
- def test_list_tenant_usages_with_bytes_body(self):
- self._test_list_tenant_usages(bytes_body=True)
-
- def _test_show_tenant_usage(self, bytes_body=False):
- self.check_service_client_function(
- self.client.show_tenant_usage,
- 'tempest.common.service_client.ServiceClient.get',
- {"tenant_usage": self.FAKE_TENANT_USAGES[0]},
- to_utf=bytes_body,
- tenant_id='openstack')
-
- def test_show_tenant_usage_with_str_body(self):
- self._test_show_tenant_usage()
-
- def test_show_tenant_usage_with_bytes_body(self):
- self._test_show_tenant_usage(bytes_body=True)
diff --git a/tempest/tests/test_glance_http.py b/tempest/tests/test_glance_http.py
index 105caec..ed886da 100644
--- a/tempest/tests/test_glance_http.py
+++ b/tempest/tests/test_glance_http.py
@@ -13,14 +13,10 @@
# License for the specific language governing permissions and limitations
# under the License.
-import socket
-
import mock
-from oslo_serialization import jsonutils as json
from oslotest import mockpatch
import six
from six.moves import http_client as httplib
-from tempest_lib import exceptions as lib_exc
from tempest.common import glance_http
from tempest import exceptions
@@ -56,60 +52,6 @@
'getresponse', return_value=resp))
return resp
- def test_json_request_without_content_type_header_in_response(self):
- self._set_response_fixture({}, 200, 'fake_response_body')
- 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(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(lib_exc.InvalidContentType,
- self.client.json_request, 'GET', '/images')
-
- def test_json_request_with_json_content_type_header_only_in_resp(self):
- self._set_response_fixture({'content-type': 'application/json'},
- 200, 'fake_response_body')
- resp, body = self.client.json_request('GET', '/images')
- self.assertEqual(200, resp.status)
- self.assertEqual('fake_response_body', body)
-
- def test_json_request_with_json_content_type_header_in_req_and_resp(self):
- self._set_response_fixture({'content-type': 'application/json'},
- 200, 'fake_response_body')
- resp, body = self.client.json_request('GET', '/images', headers={
- 'Content-Type': 'application/json'})
- self.assertEqual(200, resp.status)
- self.assertEqual('fake_response_body', body)
-
- def test_json_request_fails_to_json_loads(self):
- self._set_response_fixture({'content-type': 'application/json'},
- 200, 'fake_response_body')
- self.useFixture(mockpatch.PatchObject(json, 'loads',
- side_effect=ValueError()))
- resp, body = self.client.json_request('GET', '/images')
- self.assertEqual(200, resp.status)
- self.assertEqual(body, 'fake_response_body')
-
- def test_json_request_socket_timeout(self):
- self.useFixture(mockpatch.PatchObject(httplib.HTTPConnection,
- 'request',
- side_effect=socket.timeout()))
- self.assertRaises(exceptions.TimeoutException,
- self.client.json_request, 'GET', '/images')
-
- def test_json_request_endpoint_not_found(self):
- self.useFixture(mockpatch.PatchObject(httplib.HTTPConnection,
- 'request',
- side_effect=socket.gaierror()))
- self.assertRaises(exceptions.EndpointNotFound,
- self.client.json_request, 'GET', '/images')
-
def test_raw_request(self):
self._set_response_fixture({}, 200, 'fake_response_body')
resp, body = self.client.raw_request('GET', '/images')
@@ -141,22 +83,22 @@
self.assertEqual(call_count - 1, req_body.tell())
def test_get_connection_class_for_https(self):
- conn_class = self.client.get_connection_class('https')
+ conn_class = self.client._get_connection_class('https')
self.assertEqual(glance_http.VerifiedHTTPSConnection, conn_class)
def test_get_connection_class_for_http(self):
- conn_class = (self.client.get_connection_class('http'))
+ conn_class = (self.client._get_connection_class('http'))
self.assertEqual(httplib.HTTPConnection, conn_class)
def test_get_connection_http(self):
- self.assertTrue(isinstance(self.client.get_connection(),
+ self.assertTrue(isinstance(self.client._get_connection(),
httplib.HTTPConnection))
def test_get_connection_https(self):
endpoint = 'https://fake_url.com'
self.fake_auth.base_url = mock.MagicMock(return_value=endpoint)
self.client = glance_http.HTTPClient(self.fake_auth, {})
- self.assertTrue(isinstance(self.client.get_connection(),
+ self.assertTrue(isinstance(self.client._get_connection(),
glance_http.VerifiedHTTPSConnection))
def test_get_connection_url_not_fount(self):
@@ -164,22 +106,22 @@
side_effect=httplib.InvalidURL()
))
self.assertRaises(exceptions.EndpointNotFound,
- self.client.get_connection)
+ self.client._get_connection)
def test_get_connection_kwargs_default_for_http(self):
- kwargs = self.client.get_connection_kwargs('http')
+ kwargs = self.client._get_connection_kwargs('http')
self.assertEqual(600, kwargs['timeout'])
self.assertEqual(1, len(kwargs.keys()))
def test_get_connection_kwargs_set_timeout_for_http(self):
- kwargs = self.client.get_connection_kwargs('http', timeout=10,
- ca_certs='foo')
+ kwargs = self.client._get_connection_kwargs('http', timeout=10,
+ ca_certs='foo')
self.assertEqual(10, kwargs['timeout'])
# nothing more than timeout is evaluated for http connections
self.assertEqual(1, len(kwargs.keys()))
def test_get_connection_kwargs_default_for_https(self):
- kwargs = self.client.get_connection_kwargs('https')
+ kwargs = self.client._get_connection_kwargs('https')
self.assertEqual(600, kwargs['timeout'])
self.assertEqual(None, kwargs['ca_certs'])
self.assertEqual(None, kwargs['cert_file'])
@@ -189,12 +131,12 @@
self.assertEqual(6, len(kwargs.keys()))
def test_get_connection_kwargs_set_params_for_https(self):
- kwargs = self.client.get_connection_kwargs('https', timeout=10,
- ca_certs='foo',
- cert_file='/foo/bar.cert',
- key_file='/foo/key.pem',
- insecure=True,
- ssl_compression=False)
+ kwargs = self.client._get_connection_kwargs('https', timeout=10,
+ ca_certs='foo',
+ cert_file='/foo/bar.cert',
+ key_file='/foo/key.pem',
+ insecure=True,
+ ssl_compression=False)
self.assertEqual(10, kwargs['timeout'])
self.assertEqual('foo', kwargs['ca_certs'])
self.assertEqual('/foo/bar.cert', kwargs['cert_file'])
diff --git a/tempest/thirdparty/boto/test_ec2_instance_run.py b/tempest/thirdparty/boto/test_ec2_instance_run.py
index 49a1854..6c1b362 100644
--- a/tempest/thirdparty/boto/test_ec2_instance_run.py
+++ b/tempest/thirdparty/boto/test_ec2_instance_run.py
@@ -175,23 +175,23 @@
instance.add_tag('key1', value='value1')
tags = self.ec2_client.get_all_tags()
- td = {item.name: item.value for item in tags}
+ td = dict((item.name, item.value) for item in tags)
self.assertIn('key1', td)
self.assertEqual('value1', td['key1'])
tags = self.ec2_client.get_all_tags(filters={'key': 'key1'})
- td = {item.name: item.value for item in tags}
+ td = dict((item.name, item.value) for item in tags)
self.assertIn('key1', td)
self.assertEqual('value1', td['key1'])
tags = self.ec2_client.get_all_tags(filters={'value': 'value1'})
- td = {item.name: item.value for item in tags}
+ td = dict((item.name, item.value) for item in tags)
self.assertIn('key1', td)
self.assertEqual('value1', td['key1'])
tags = self.ec2_client.get_all_tags(filters={'key': 'value2'})
- td = {item.name: item.value for item in tags}
+ td = dict((item.name, item.value) for item in tags)
self.assertNotIn('key1', td)
for instance in reservation.instances:
diff --git a/tools/check_uuid.py b/tools/check_uuid.py
deleted file mode 100755
index a71ad39..0000000
--- a/tools/check_uuid.py
+++ /dev/null
@@ -1,358 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright 2014 Mirantis, Inc.
-#
-# 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 argparse
-import ast
-import importlib
-import inspect
-import os
-import sys
-import unittest
-import urllib
-import uuid
-
-DECORATOR_MODULE = 'test'
-DECORATOR_NAME = 'idempotent_id'
-DECORATOR_IMPORT = 'tempest.%s' % DECORATOR_MODULE
-IMPORT_LINE = 'from tempest import %s' % DECORATOR_MODULE
-DECORATOR_TEMPLATE = "@%s.%s('%%s')" % (DECORATOR_MODULE,
- DECORATOR_NAME)
-UNIT_TESTS_EXCLUDE = 'tempest.tests'
-
-
-class SourcePatcher(object):
-
- """"Lazy patcher for python source files"""
-
- def __init__(self):
- self.source_files = None
- self.patches = None
- self.clear()
-
- def clear(self):
- """Clear inner state"""
- self.source_files = {}
- self.patches = {}
-
- @staticmethod
- def _quote(s):
- return urllib.quote(s)
-
- @staticmethod
- def _unquote(s):
- return urllib.unquote(s)
-
- def add_patch(self, filename, patch, line_no):
- """Add lazy patch"""
- if filename not in self.source_files:
- with open(filename) as f:
- self.source_files[filename] = self._quote(f.read())
- patch_id = str(uuid.uuid4())
- if not patch.endswith('\n'):
- patch += '\n'
- self.patches[patch_id] = self._quote(patch)
- lines = self.source_files[filename].split(self._quote('\n'))
- lines[line_no - 1] = ''.join(('{%s:s}' % patch_id, lines[line_no - 1]))
- self.source_files[filename] = self._quote('\n').join(lines)
-
- def _save_changes(self, filename, source):
- print('%s fixed' % filename)
- with open(filename, 'w') as f:
- f.write(source)
-
- def apply_patches(self):
- """Apply all patches"""
- for filename in self.source_files:
- patched_source = self._unquote(
- self.source_files[filename].format(**self.patches)
- )
- self._save_changes(filename, patched_source)
- self.clear()
-
-
-class TestChecker(object):
-
- def __init__(self, package):
- self.package = package
- self.base_path = os.path.abspath(os.path.dirname(package.__file__))
-
- def _path_to_package(self, path):
- relative_path = path[len(self.base_path) + 1:]
- if relative_path:
- return '.'.join((self.package.__name__,) +
- tuple(relative_path.split('/')))
- else:
- return self.package.__name__
-
- def _modules_search(self):
- """Recursive search for python modules in base package"""
- modules = []
- for root, dirs, files in os.walk(self.base_path):
- if not os.path.exists(os.path.join(root, '__init__.py')):
- continue
- root_package = self._path_to_package(root)
- for item in files:
- if item.endswith('.py'):
- module_name = '.'.join((root_package,
- os.path.splitext(item)[0]))
- if not module_name.startswith(UNIT_TESTS_EXCLUDE):
- modules.append(module_name)
- return modules
-
- @staticmethod
- def _get_idempotent_id(test_node):
- # Return key-value dict with all metadata from @test.idempotent_id
- # decorators for test method
- idempotent_id = None
- for decorator in test_node.decorator_list:
- if (hasattr(decorator, 'func') and
- hasattr(decorator.func, 'attr') and
- decorator.func.attr == DECORATOR_NAME and
- hasattr(decorator.func, 'value') and
- decorator.func.value.id == DECORATOR_MODULE):
- for arg in decorator.args:
- idempotent_id = ast.literal_eval(arg)
- return idempotent_id
-
- @staticmethod
- def _is_decorator(line):
- return line.strip().startswith('@')
-
- @staticmethod
- def _is_def(line):
- return line.strip().startswith('def ')
-
- def _add_uuid_to_test(self, patcher, test_node, source_path):
- with open(source_path) as src:
- src_lines = src.read().split('\n')
- lineno = test_node.lineno
- insert_position = lineno
- while True:
- if (self._is_def(src_lines[lineno - 1]) or
- (self._is_decorator(src_lines[lineno - 1]) and
- (DECORATOR_TEMPLATE.split('(')[0] <=
- src_lines[lineno - 1].strip().split('(')[0]))):
- insert_position = lineno
- break
- lineno += 1
- patcher.add_patch(
- source_path,
- ' ' * test_node.col_offset + DECORATOR_TEMPLATE % uuid.uuid4(),
- insert_position
- )
-
- @staticmethod
- def _is_test_case(module, node):
- if (node.__class__ is ast.ClassDef and
- hasattr(module, node.name) and
- inspect.isclass(getattr(module, node.name))):
- return issubclass(getattr(module, node.name), unittest.TestCase)
-
- @staticmethod
- def _is_test_method(node):
- return (node.__class__ is ast.FunctionDef
- and node.name.startswith('test_'))
-
- @staticmethod
- def _next_node(body, node):
- if body.index(node) < len(body):
- return body[body.index(node) + 1]
-
- @staticmethod
- def _import_name(node):
- if type(node) == ast.Import:
- return node.names[0].name
- elif type(node) == ast.ImportFrom:
- return '%s.%s' % (node.module, node.names[0].name)
-
- def _add_import_for_test_uuid(self, patcher, src_parsed, source_path):
- with open(source_path) as f:
- src_lines = f.read().split('\n')
- line_no = 0
- tempest_imports = [node for node in src_parsed.body
- if self._import_name(node) and
- 'tempest.' in self._import_name(node)]
- if not tempest_imports:
- import_snippet = '\n'.join(('', IMPORT_LINE, ''))
- else:
- for node in tempest_imports:
- if self._import_name(node) < DECORATOR_IMPORT:
- continue
- else:
- line_no = node.lineno
- import_snippet = IMPORT_LINE
- break
- else:
- line_no = tempest_imports[-1].lineno
- while True:
- if (not src_lines[line_no - 1] or
- getattr(self._next_node(src_parsed.body,
- tempest_imports[-1]),
- 'lineno') == line_no or
- line_no == len(src_lines)):
- break
- line_no += 1
- import_snippet = '\n'.join((IMPORT_LINE, ''))
- patcher.add_patch(source_path, import_snippet, line_no)
-
- def get_tests(self):
- """Get test methods with sources from base package with metadata"""
- tests = {}
- for module_name in self._modules_search():
- tests[module_name] = {}
- module = importlib.import_module(module_name)
- source_path = '.'.join(
- (os.path.splitext(module.__file__)[0], 'py')
- )
- with open(source_path, 'r') as f:
- source = f.read()
- tests[module_name]['source_path'] = source_path
- tests[module_name]['tests'] = {}
- source_parsed = ast.parse(source)
- tests[module_name]['ast'] = source_parsed
- tests[module_name]['import_valid'] = (
- hasattr(module, DECORATOR_MODULE) and
- inspect.ismodule(getattr(module, DECORATOR_MODULE))
- )
- test_cases = (node for node in source_parsed.body
- if self._is_test_case(module, node))
- for node in test_cases:
- for subnode in filter(self._is_test_method, node.body):
- test_name = '%s.%s' % (node.name, subnode.name)
- tests[module_name]['tests'][test_name] = subnode
- return tests
-
- @staticmethod
- def _filter_tests(function, tests):
- """Filter tests with condition 'function(test_node) == True'"""
- result = {}
- for module_name in tests:
- for test_name in tests[module_name]['tests']:
- if function(module_name, test_name, tests):
- if module_name not in result:
- result[module_name] = {
- 'ast': tests[module_name]['ast'],
- 'source_path': tests[module_name]['source_path'],
- 'import_valid': tests[module_name]['import_valid'],
- 'tests': {}
- }
- result[module_name]['tests'][test_name] = \
- tests[module_name]['tests'][test_name]
- return result
-
- def find_untagged(self, tests):
- """Filter all tests without uuid in metadata"""
- def check_uuid_in_meta(module_name, test_name, tests):
- idempotent_id = self._get_idempotent_id(
- tests[module_name]['tests'][test_name])
- return not idempotent_id
- return self._filter_tests(check_uuid_in_meta, tests)
-
- def report_collisions(self, tests):
- """Reports collisions if there are any.
-
- Returns true if collisions exist.
- """
- uuids = {}
-
- def report(module_name, test_name, tests):
- test_uuid = self._get_idempotent_id(
- tests[module_name]['tests'][test_name])
- if not test_uuid:
- return
- if test_uuid in uuids:
- error_str = "%s:%s\n uuid %s collision: %s<->%s\n%s:%s" % (
- tests[module_name]['source_path'],
- tests[module_name]['tests'][test_name].lineno,
- test_uuid,
- test_name,
- uuids[test_uuid]['test_name'],
- uuids[test_uuid]['source_path'],
- uuids[test_uuid]['test_node'].lineno,
- )
- print(error_str)
- print("cannot automatically resolve the collision, please "
- "manually remove the duplicate value on the new test.")
- return True
- else:
- uuids[test_uuid] = {
- 'module': module_name,
- 'test_name': test_name,
- 'test_node': tests[module_name]['tests'][test_name],
- 'source_path': tests[module_name]['source_path']
- }
- return bool(self._filter_tests(report, tests))
-
- def report_untagged(self, tests):
- """Reports untagged tests if there are any.
-
- Returns true if untagged tests exist.
- """
- def report(module_name, test_name, tests):
- error_str = "%s:%s\nmissing @test.idempotent_id('...')\n%s\n" % (
- tests[module_name]['source_path'],
- tests[module_name]['tests'][test_name].lineno,
- test_name
- )
- print(error_str)
- return True
- return bool(self._filter_tests(report, tests))
-
- def fix_tests(self, tests):
- """Add uuids to all tests specified in tests and fix it"""
- patcher = SourcePatcher()
- for module_name in tests:
- add_import_once = True
- for test_name in tests[module_name]['tests']:
- if not tests[module_name]['import_valid'] and add_import_once:
- self._add_import_for_test_uuid(
- patcher,
- tests[module_name]['ast'],
- tests[module_name]['source_path']
- )
- add_import_once = False
- self._add_uuid_to_test(
- patcher, tests[module_name]['tests'][test_name],
- tests[module_name]['source_path'])
- patcher.apply_patches()
-
-
-def run():
- parser = argparse.ArgumentParser()
- parser.add_argument('--package', action='store', dest='package',
- default='tempest', type=str,
- help='Package with tests')
- parser.add_argument('--fix', action='store_true', dest='fix_tests',
- help='Attempt to fix tests without UUIDs')
- args = parser.parse_args()
- sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
- pkg = importlib.import_module(args.package)
- checker = TestChecker(pkg)
- errors = False
- tests = checker.get_tests()
- untagged = checker.find_untagged(tests)
- errors = checker.report_collisions(tests) or errors
- if args.fix_tests and untagged:
- checker.fix_tests(untagged)
- else:
- errors = checker.report_untagged(untagged) or errors
- if errors:
- sys.exit("@test.idempotent_id existence and uniqueness checks failed\n"
- "Run 'tox -v -euuidgen' to automatically fix tests with\n"
- "missing @test.idempotent_id decorators.")
-
-if __name__ == '__main__':
- run()
diff --git a/tools/colorizer.py b/tools/colorizer.py
deleted file mode 100755
index 3f68a51..0000000
--- a/tools/colorizer.py
+++ /dev/null
@@ -1,328 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright (c) 2013, Nebula, Inc.
-# Copyright 2010 United States Government as represented by the
-# Administrator of the National Aeronautics and Space Administration.
-# 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.
-#
-# Colorizer Code is borrowed from Twisted:
-# Copyright (c) 2001-2010 Twisted Matrix Laboratories.
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-"""Display a subunit stream through a colorized unittest test runner."""
-
-import heapq
-import sys
-import unittest
-
-import subunit
-import testtools
-
-
-class _AnsiColorizer(object):
- """A colorizer is an object that loosely wraps around a stream
-
- allowing callers to write text to the stream in a particular color.
-
- Colorizer classes must implement C{supported()} and C{write(text, color)}.
- """
- _colors = dict(black=30, red=31, green=32, yellow=33,
- blue=34, magenta=35, cyan=36, white=37)
-
- def __init__(self, stream):
- self.stream = stream
-
- def supported(cls, stream=sys.stdout):
- """Check the current platform supports coloring terminal output
-
- A class method that returns True if the current platform supports
- coloring terminal output using this method. Returns False otherwise.
- """
- if not stream.isatty():
- return False # auto color only on TTYs
- try:
- import curses
- except ImportError:
- return False
- else:
- try:
- try:
- return curses.tigetnum("colors") > 2
- except curses.error:
- curses.setupterm()
- return curses.tigetnum("colors") > 2
- except Exception:
- # guess false in case of error
- return False
- supported = classmethod(supported)
-
- def write(self, text, color):
- """Write the given text to the stream in the given color.
-
- @param text: Text to be written to the stream.
-
- @param color: A string label for a color. e.g. 'red', 'white'.
- """
- color = self._colors[color]
- self.stream.write('\x1b[%s;1m%s\x1b[0m' % (color, text))
-
-
-class _Win32Colorizer(object):
- """See _AnsiColorizer docstring."""
- def __init__(self, stream):
- import win32console
- red, green, blue, bold = (win32console.FOREGROUND_RED,
- win32console.FOREGROUND_GREEN,
- win32console.FOREGROUND_BLUE,
- win32console.FOREGROUND_INTENSITY)
- self.stream = stream
- self.screenBuffer = win32console.GetStdHandle(
- win32console.STD_OUT_HANDLE)
- self._colors = {'normal': red | green | blue,
- 'red': red | bold,
- 'green': green | bold,
- 'blue': blue | bold,
- 'yellow': red | green | bold,
- 'magenta': red | blue | bold,
- 'cyan': green | blue | bold,
- 'white': red | green | blue | bold}
-
- def supported(cls, stream=sys.stdout):
- try:
- import win32console
- screenBuffer = win32console.GetStdHandle(
- win32console.STD_OUT_HANDLE)
- except ImportError:
- return False
- import pywintypes
- try:
- screenBuffer.SetConsoleTextAttribute(
- win32console.FOREGROUND_RED |
- win32console.FOREGROUND_GREEN |
- win32console.FOREGROUND_BLUE)
- except pywintypes.error:
- return False
- else:
- return True
- supported = classmethod(supported)
-
- def write(self, text, color):
- color = self._colors[color]
- self.screenBuffer.SetConsoleTextAttribute(color)
- self.stream.write(text)
- self.screenBuffer.SetConsoleTextAttribute(self._colors['normal'])
-
-
-class _NullColorizer(object):
- """See _AnsiColorizer docstring."""
- def __init__(self, stream):
- self.stream = stream
-
- def supported(cls, stream=sys.stdout):
- return True
- supported = classmethod(supported)
-
- def write(self, text, color):
- self.stream.write(text)
-
-
-def get_elapsed_time_color(elapsed_time):
- if elapsed_time > 1.0:
- return 'red'
- elif elapsed_time > 0.25:
- return 'yellow'
- else:
- return 'green'
-
-
-class NovaTestResult(testtools.TestResult):
- def __init__(self, stream, descriptions, verbosity):
- super(NovaTestResult, self).__init__()
- self.stream = stream
- self.showAll = verbosity > 1
- self.num_slow_tests = 10
- self.slow_tests = [] # this is a fixed-sized heap
- self.colorizer = None
- # NOTE(vish): reset stdout for the terminal check
- stdout = sys.stdout
- sys.stdout = sys.__stdout__
- for colorizer in [_Win32Colorizer, _AnsiColorizer, _NullColorizer]:
- if colorizer.supported():
- self.colorizer = colorizer(self.stream)
- break
- sys.stdout = stdout
- self.start_time = None
- self.last_time = {}
- self.results = {}
- self.last_written = None
-
- def _writeElapsedTime(self, elapsed):
- color = get_elapsed_time_color(elapsed)
- self.colorizer.write(" %.2f" % elapsed, color)
-
- def _addResult(self, test, *args):
- try:
- name = test.id()
- except AttributeError:
- name = 'Unknown.unknown'
- test_class, test_name = name.rsplit('.', 1)
-
- elapsed = (self._now() - self.start_time).total_seconds()
- item = (elapsed, test_class, test_name)
- if len(self.slow_tests) >= self.num_slow_tests:
- heapq.heappushpop(self.slow_tests, item)
- else:
- heapq.heappush(self.slow_tests, item)
-
- self.results.setdefault(test_class, [])
- self.results[test_class].append((test_name, elapsed) + args)
- self.last_time[test_class] = self._now()
- self.writeTests()
-
- def _writeResult(self, test_name, elapsed, long_result, color,
- short_result, success):
- if self.showAll:
- self.stream.write(' %s' % str(test_name).ljust(66))
- self.colorizer.write(long_result, color)
- if success:
- self._writeElapsedTime(elapsed)
- self.stream.writeln()
- else:
- self.colorizer.write(short_result, color)
-
- def addSuccess(self, test):
- super(NovaTestResult, self).addSuccess(test)
- self._addResult(test, 'OK', 'green', '.', True)
-
- def addFailure(self, test, err):
- if test.id() == 'process-returncode':
- return
- super(NovaTestResult, self).addFailure(test, err)
- self._addResult(test, 'FAIL', 'red', 'F', False)
-
- def addError(self, test, err):
- super(NovaTestResult, self).addFailure(test, err)
- self._addResult(test, 'ERROR', 'red', 'E', False)
-
- def addSkip(self, test, reason=None, details=None):
- super(NovaTestResult, self).addSkip(test, reason, details)
- self._addResult(test, 'SKIP', 'blue', 'S', True)
-
- def startTest(self, test):
- self.start_time = self._now()
- super(NovaTestResult, self).startTest(test)
-
- def writeTestCase(self, cls):
- if not self.results.get(cls):
- return
- if cls != self.last_written:
- self.colorizer.write(cls, 'white')
- self.stream.writeln()
- for result in self.results[cls]:
- self._writeResult(*result)
- del self.results[cls]
- self.stream.flush()
- self.last_written = cls
-
- def writeTests(self):
- time = self.last_time.get(self.last_written, self._now())
- if not self.last_written or (self._now() - time).total_seconds() > 2.0:
- diff = 3.0
- while diff > 2.0:
- classes = self.results.keys()
- oldest = min(classes, key=lambda x: self.last_time[x])
- diff = (self._now() - self.last_time[oldest]).total_seconds()
- self.writeTestCase(oldest)
- else:
- self.writeTestCase(self.last_written)
-
- def done(self):
- self.stopTestRun()
-
- def stopTestRun(self):
- for cls in list(self.results.iterkeys()):
- self.writeTestCase(cls)
- self.stream.writeln()
- self.writeSlowTests()
-
- def writeSlowTests(self):
- # Pare out 'fast' tests
- slow_tests = [item for item in self.slow_tests
- if get_elapsed_time_color(item[0]) != 'green']
- if slow_tests:
- slow_total_time = sum(item[0] for item in slow_tests)
- slow = ("Slowest %i tests took %.2f secs:"
- % (len(slow_tests), slow_total_time))
- self.colorizer.write(slow, 'yellow')
- self.stream.writeln()
- last_cls = None
- # sort by name
- for elapsed, cls, name in sorted(slow_tests,
- key=lambda x: x[1] + x[2]):
- if cls != last_cls:
- self.colorizer.write(cls, 'white')
- self.stream.writeln()
- last_cls = cls
- self.stream.write(' %s' % str(name).ljust(68))
- self._writeElapsedTime(elapsed)
- self.stream.writeln()
-
- def printErrors(self):
- if self.showAll:
- self.stream.writeln()
- self.printErrorList('ERROR', self.errors)
- self.printErrorList('FAIL', self.failures)
-
- def printErrorList(self, flavor, errors):
- for test, err in errors:
- self.colorizer.write("=" * 70, 'red')
- self.stream.writeln()
- self.colorizer.write(flavor, 'red')
- self.stream.writeln(": %s" % test.id())
- self.colorizer.write("-" * 70, 'red')
- self.stream.writeln()
- self.stream.writeln("%s" % err)
-
-
-test = subunit.ProtocolTestCase(sys.stdin, passthrough=None)
-
-if sys.version_info[0:2] <= (2, 6):
- runner = unittest.TextTestRunner(verbosity=2)
-else:
- runner = unittest.TextTestRunner(verbosity=2, resultclass=NovaTestResult)
-
-if runner.run(test).wasSuccessful():
- exit_code = 0
-else:
- exit_code = 1
-sys.exit(exit_code)
diff --git a/tox.ini b/tox.ini
index 892cfed..41eece1 100644
--- a/tox.ini
+++ b/tox.ini
@@ -55,7 +55,7 @@
setenv = {[tempestenv]setenv}
deps = {[tempestenv]deps}
# The regex below is used to select which tests to run and exclude the slow tag:
-# See the testrepostiory bug: https://bugs.launchpad.net/testrepository/+bug/1208610
+# See the testrepository bug: https://bugs.launchpad.net/testrepository/+bug/1208610
commands =
find . -type f -name "*.pyc" -delete
bash tools/pretty_tox.sh '(?!.*\[.*\bslow\b.*\])(^tempest\.(api|scenario|thirdparty)) {posargs}'
@@ -65,7 +65,7 @@
setenv = {[tempestenv]setenv}
deps = {[tempestenv]deps}
# The regex below is used to select which tests to run and exclude the slow tag:
-# See the testrepostiory bug: https://bugs.launchpad.net/testrepository/+bug/1208610
+# See the testrepository bug: https://bugs.launchpad.net/testrepository/+bug/1208610
commands =
find . -type f -name "*.pyc" -delete
bash tools/pretty_tox_serial.sh '(?!.*\[.*\bslow\b.*\])(^tempest\.(api|scenario|thirdparty)) {posargs}'
@@ -114,11 +114,11 @@
[testenv:pep8]
commands =
flake8 {posargs}
- python tools/check_uuid.py
+ check-uuid
[testenv:uuidgen]
commands =
- python tools/check_uuid.py --fix
+ check-uuid --fix
[hacking]
local-check-factory = tempest.hacking.checks.factory