Merge "Remove BaseComputeTest and _api_version"
diff --git a/doc/source/configuration.rst b/doc/source/configuration.rst
index f228040..02fa0d8 100644
--- a/doc/source/configuration.rst
+++ b/doc/source/configuration.rst
@@ -363,6 +363,17 @@
the same *catalog_type* as devstack or you want Tempest to talk to a different
endpoint type instead of publicURL for a service that these need to be changed.
+.. note::
+
+ Tempest does not serve all kind of fancy URLs in the service catalog.
+ Service catalog should be in a standard format (which is going to be
+ standardized at keystone level).
+ Tempest expects URLs in the Service catalog in below format:
+ * http://example.com:1234/<version-info>
+ Examples:
+ * Good - http://example.com:1234/v2.0
+ * Wouldn’t work - http://example.com:1234/xyz/v2.0/
+ (adding prefix/suffix around version etc)
Service feature configuration
-----------------------------
diff --git a/setup.cfg b/setup.cfg
index 46e21f1..ee61788 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -34,6 +34,7 @@
tempest = tempest.cmd.main:main
tempest.cm =
init = tempest.cmd.init:TempestInit
+ cleanup = tempest.cmd.cleanup:TempestCleanup
oslo.config.opts =
tempest.config = tempest.config:list_opts
diff --git a/tempest/api/compute/admin/test_live_migration.py b/tempest/api/compute/admin/test_live_migration.py
index f186a7d..ecb27c2 100644
--- a/tempest/api/compute/admin/test_live_migration.py
+++ b/tempest/api/compute/admin/test_live_migration.py
@@ -28,14 +28,27 @@
_host_key = 'OS-EXT-SRV-ATTR:host'
@classmethod
+ def skip_checks(cls):
+ super(LiveBlockMigrationTestJSON, cls).skip_checks()
+
+ if not CONF.compute_feature_enabled.live_migration:
+ skip_msg = ("%s skipped as live-migration is "
+ "not available" % cls.__name__)
+ raise cls.skipException(skip_msg)
+ if len(cls._get_compute_hostnames()) < 2:
+ raise cls.skipTest(
+ "Less than 2 compute nodes, skipping migration test.")
+
+ @classmethod
def setup_clients(cls):
super(LiveBlockMigrationTestJSON, cls).setup_clients()
cls.admin_hosts_client = cls.os_adm.hosts_client
cls.admin_servers_client = cls.os_adm.servers_client
cls.admin_migration_client = cls.os_adm.migrations_client
- def _get_compute_hostnames(self):
- body = self.admin_hosts_client.list_hosts()['hosts']
+ @classmethod
+ def _get_compute_hostnames(cls):
+ body = cls.admin_hosts_client.list_hosts()['hosts']
return [
host_record['host_name']
for host_record in body
@@ -90,9 +103,6 @@
volume_backed, *block* migration is not used.
"""
# Live migrate an instance to another host
- if len(self._get_compute_hostnames()) < 2:
- raise self.skipTest(
- "Less than 2 compute nodes, skipping migration test.")
server_id = self._create_server(volume_backed=volume_backed)
actual_host = self._get_host_for_server(server_id)
target_host = self._get_host_other_than(actual_host)
@@ -117,14 +127,10 @@
msg)
@test.idempotent_id('1dce86b8-eb04-4c03-a9d8-9c1dc3ee0c7b')
- @testtools.skipUnless(CONF.compute_feature_enabled.live_migration,
- 'Live migration not available')
def test_live_block_migration(self):
self._test_live_migration()
@test.idempotent_id('1e107f21-61b2-4988-8f22-b196e938ab88')
- @testtools.skipUnless(CONF.compute_feature_enabled.live_migration,
- 'Live migration not available')
@testtools.skipUnless(CONF.compute_feature_enabled.pause,
'Pause is not available.')
@testtools.skipUnless(CONF.compute_feature_enabled
@@ -135,24 +141,18 @@
self._test_live_migration(state='PAUSED')
@test.idempotent_id('5071cf17-3004-4257-ae61-73a84e28badd')
- @testtools.skipUnless(CONF.compute_feature_enabled.live_migration,
- 'Live migration not available')
@test.services('volume')
def test_volume_backed_live_migration(self):
self._test_live_migration(volume_backed=True)
@test.idempotent_id('e19c0cc6-6720-4ed8-be83-b6603ed5c812')
- @testtools.skipIf(not CONF.compute_feature_enabled.live_migration or not
- CONF.compute_feature_enabled.
+ @testtools.skipIf(not CONF.compute_feature_enabled.
block_migration_for_live_migration,
'Block Live migration not available')
@testtools.skipIf(not CONF.compute_feature_enabled.
block_migrate_cinder_iscsi,
'Block Live migration not configured for iSCSI')
def test_iscsi_volume(self):
- if len(self._get_compute_hostnames()) < 2:
- raise self.skipTest(
- "Less than 2 compute nodes, skipping migration test.")
server_id = self._create_server()
actual_host = self._get_host_for_server(server_id)
target_host = self._get_host_other_than(actual_host)
diff --git a/tempest/api/compute/base.py b/tempest/api/compute/base.py
index c9b2239..1ee8f04 100644
--- a/tempest/api/compute/base.py
+++ b/tempest/api/compute/base.py
@@ -141,7 +141,7 @@
Method will delete the server when it's dirty.
The setUp method is responsible for creating a new server.
Exceptions raised in tearDown class are fails the test case,
- This method supposed to use only by tierDown methods, when
+ This method supposed to use only by tearDown methods, when
the shared server_id is stored in the server_id of the class.
"""
if getattr(cls, 'server_id', None) is not None:
diff --git a/tempest/api/compute/servers/test_server_actions.py b/tempest/api/compute/servers/test_server_actions.py
index a59cb16..0754d27 100644
--- a/tempest/api/compute/servers/test_server_actions.py
+++ b/tempest/api/compute/servers/test_server_actions.py
@@ -52,7 +52,7 @@
except Exception:
# Rebuild server if something happened to it during a test
self.__class__.server_id = self.rebuild_server(
- self.server_id, validatable=True)['server']
+ self.server_id, validatable=True)
def tearDown(self):
self.server_check_teardown()
diff --git a/tempest/api/identity/admin/v2/test_roles.py b/tempest/api/identity/admin/v2/test_roles.py
index 78beead..657d72e 100644
--- a/tempest/api/identity/admin/v2/test_roles.py
+++ b/tempest/api/identity/admin/v2/test_roles.py
@@ -76,7 +76,7 @@
self.data.setup_test_role()
role_id = self.data.role['id']
role_name = self.data.role['name']
- body = self.client.get_role(role_id)['role']
+ body = self.client.show_role(role_id)['role']
self.assertEqual(role_id, body['id'])
self.assertEqual(role_name, body['name'])
diff --git a/tempest/api/identity/admin/v2/test_services.py b/tempest/api/identity/admin/v2/test_services.py
index eebeedb..04e15d2 100644
--- a/tempest/api/identity/admin/v2/test_services.py
+++ b/tempest/api/identity/admin/v2/test_services.py
@@ -27,7 +27,7 @@
# Deleting the service created in this method
self.client.delete_service(service_id)
# Checking whether service is deleted successfully
- self.assertRaises(lib_exc.NotFound, self.client.get_service,
+ self.assertRaises(lib_exc.NotFound, self.client.show_service,
service_id)
@test.idempotent_id('84521085-c6e6-491c-9a08-ec9f70f90110')
@@ -50,7 +50,7 @@
self.assertIn('description', service_data)
self.assertEqual(description, service_data['description'])
# Get service
- fetched_service = (self.client.get_service(service_data['id'])
+ fetched_service = (self.client.show_service(service_data['id'])
['OS-KSADM:service'])
# verifying the existence of service created
self.assertIn('id', fetched_service)
diff --git a/tempest/api/identity/admin/v2/test_tenants.py b/tempest/api/identity/admin/v2/test_tenants.py
index 2ec5c4f..4632b1e 100644
--- a/tempest/api/identity/admin/v2/test_tenants.py
+++ b/tempest/api/identity/admin/v2/test_tenants.py
@@ -57,7 +57,7 @@
desc1 = body['description']
self.assertEqual(desc1, tenant_desc, 'Description should have '
'been sent in response for create')
- body = self.client.get_tenant(tenant_id)['tenant']
+ body = self.client.show_tenant(tenant_id)['tenant']
desc2 = body['description']
self.assertEqual(desc2, tenant_desc, 'Description does not appear'
'to be set')
@@ -74,7 +74,7 @@
tenant_id = body['id']
en1 = body['enabled']
self.assertTrue(en1, 'Enable should be True in response')
- body = self.client.get_tenant(tenant_id)['tenant']
+ body = self.client.show_tenant(tenant_id)['tenant']
en2 = body['enabled']
self.assertTrue(en2, 'Enable should be True in lookup')
self.client.delete_tenant(tenant_id)
@@ -91,7 +91,7 @@
en1 = body['enabled']
self.assertEqual('false', str(en1).lower(),
'Enable should be False in response')
- body = self.client.get_tenant(tenant_id)['tenant']
+ body = self.client.show_tenant(tenant_id)['tenant']
en2 = body['enabled']
self.assertEqual('false', str(en2).lower(),
'Enable should be False in lookup')
@@ -114,7 +114,7 @@
resp2_name = body['name']
self.assertNotEqual(resp1_name, resp2_name)
- body = self.client.get_tenant(t_id)['tenant']
+ body = self.client.show_tenant(t_id)['tenant']
resp3_name = body['name']
self.assertNotEqual(resp1_name, resp3_name)
@@ -141,7 +141,7 @@
resp2_desc = body['description']
self.assertNotEqual(resp1_desc, resp2_desc)
- body = self.client.get_tenant(t_id)['tenant']
+ body = self.client.show_tenant(t_id)['tenant']
resp3_desc = body['description']
self.assertNotEqual(resp1_desc, resp3_desc)
@@ -168,7 +168,7 @@
resp2_en = body['enabled']
self.assertNotEqual(resp1_en, resp2_en)
- body = self.client.get_tenant(t_id)['tenant']
+ body = self.client.show_tenant(t_id)['tenant']
resp3_en = body['enabled']
self.assertNotEqual(resp1_en, resp3_en)
diff --git a/tempest/api/identity/admin/v2/test_tokens.py b/tempest/api/identity/admin/v2/test_tokens.py
index 981a9ea..e808990 100644
--- a/tempest/api/identity/admin/v2/test_tokens.py
+++ b/tempest/api/identity/admin/v2/test_tokens.py
@@ -41,7 +41,7 @@
tenant['name'])
# Perform GET Token
token_id = body['token']['id']
- token_details = self.client.get_token(token_id)['access']
+ token_details = self.client.show_token(token_id)['access']
self.assertEqual(token_id, token_details['token']['id'])
self.assertEqual(user['id'], token_details['user']['id'])
self.assertEqual(user_name, token_details['user']['name'])
diff --git a/tempest/api/identity/admin/v2/test_users.py b/tempest/api/identity/admin/v2/test_users.py
index 6ee5218..6341106 100644
--- a/tempest/api/identity/admin/v2/test_users.py
+++ b/tempest/api/identity/admin/v2/test_users.py
@@ -73,7 +73,7 @@
self.assertEqual(u_email2, update_user['email'])
self.assertEqual(False, update_user['enabled'])
# GET by id after updating
- updated_user = self.client.get_user(user['id'])['user']
+ updated_user = self.client.show_user(user['id'])['user']
# Assert response body of GET after updating
self.assertEqual(u_name2, updated_user['name'])
self.assertEqual(u_email2, updated_user['email'])
@@ -121,7 +121,7 @@
def test_get_users(self):
# Get a list of users and find the test user
self.data.setup_test_user()
- users = self.client.get_users()['users']
+ users = self.client.list_users()['users']
self.assertThat([u['name'] for u in users],
matchers.Contains(self.data.test_user),
"Could not find %s" % self.data.test_user)
@@ -146,7 +146,7 @@
user_ids.append(user2['id'])
self.data.users.append(user2)
# List of users for the respective tenant ID
- body = (self.client.list_users_for_tenant(self.data.tenant['id'])
+ body = (self.client.list_tenant_users(self.data.tenant['id'])
['users'])
for i in body:
fetched_user_ids.append(i['id'])
@@ -182,7 +182,7 @@
second_user['id'],
role['id'])['role']
# List of users with roles for the respective tenant ID
- body = (self.client.list_users_for_tenant(self.data.tenant['id'])
+ body = (self.client.list_tenant_users(self.data.tenant['id'])
['users'])
for i in body:
fetched_user_ids.append(i['id'])
diff --git a/tempest/api/identity/admin/v2/test_users_negative.py b/tempest/api/identity/admin/v2/test_users_negative.py
index 85f7411..a88053d 100644
--- a/tempest/api/identity/admin/v2/test_users_negative.py
+++ b/tempest/api/identity/admin/v2/test_users_negative.py
@@ -222,7 +222,7 @@
# Non-administrator user should not be authorized to get user list
self.data.setup_test_user()
self.assertRaises(lib_exc.Forbidden,
- self.non_admin_client.get_users)
+ self.non_admin_client.list_users)
@test.attr(type=['negative'])
@test.idempotent_id('a73591ec-1903-4ffe-be42-282b39fefc9d')
@@ -230,7 +230,7 @@
# Request to get list of users without a valid token should fail
token = self.client.auth_provider.get_token()
self.client.delete_token(token)
- self.assertRaises(lib_exc.Unauthorized, self.client.get_users)
+ self.assertRaises(lib_exc.Unauthorized, self.client.list_users)
self.client.auth_provider.clear_auth()
@test.attr(type=['negative'])
@@ -247,4 +247,4 @@
# List the users with invalid tenant id
for invalid in invalid_id:
self.assertRaises(lib_exc.NotFound,
- self.client.list_users_for_tenant, invalid)
+ self.client.list_tenant_users, invalid)
diff --git a/tempest/api/identity/admin/v3/test_default_project_id.py b/tempest/api/identity/admin/v3/test_default_project_id.py
index 4c69758..53861ca 100644
--- a/tempest/api/identity/admin/v3/test_default_project_id.py
+++ b/tempest/api/identity/admin/v3/test_default_project_id.py
@@ -83,6 +83,6 @@
# verify the user's token and see that it is scoped to the project
token, auth_data = admin_client.auth_provider.get_auth()
- result = admin_client.identity_v3_client.get_token(token)['token']
+ result = admin_client.identity_v3_client.show_token(token)['token']
self.assertEqual(result['project']['domain']['id'], dom_id)
self.assertEqual(result['project']['id'], proj_id)
diff --git a/tempest/api/identity/admin/v3/test_domains_negative.py b/tempest/api/identity/admin/v3/test_domains_negative.py
index 156179c..33819a8 100644
--- a/tempest/api/identity/admin/v3/test_domains_negative.py
+++ b/tempest/api/identity/admin/v3/test_domains_negative.py
@@ -37,3 +37,10 @@
# domain need to be disabled before deleting
self.assertRaises(lib_exc.Forbidden, self.client.delete_domain,
domain_id)
+
+ @test.attr(type=['negative'])
+ @test.idempotent_id('9018461d-7d24-408d-b3fe-ae37e8cd5c9e')
+ def test_create_domain_with_empty_name(self):
+ # Domain name should not be empty
+ self.assertRaises(lib_exc.BadRequest, self.client.create_domain,
+ name='')
diff --git a/tempest/api/identity/admin/v3/test_list_users.py b/tempest/api/identity/admin/v3/test_list_users.py
index 320b479..b7f37d4 100644
--- a/tempest/api/identity/admin/v3/test_list_users.py
+++ b/tempest/api/identity/admin/v3/test_list_users.py
@@ -25,7 +25,7 @@
# assert the response based on expected and not_expected
# expected: user expected in the list response
# not_expected: user, which should not be present in list response
- body = self.client.get_users(params)['users']
+ body = self.client.list_users(params)['users']
self.assertIn(expected[key], map(lambda x: x[key], body))
self.assertNotIn(not_expected[key],
map(lambda x: x[key], body))
@@ -77,7 +77,7 @@
@test.idempotent_id('b30d4651-a2ea-4666-8551-0c0e49692635')
def test_list_users(self):
# List users
- body = self.client.get_users()['users']
+ body = self.client.list_users()['users']
fetched_ids = [u['id'] for u in body]
missing_users = [u['id'] for u in self.data.v3_users
if u['id'] not in fetched_ids]
@@ -88,7 +88,7 @@
@test.idempotent_id('b4baa3ae-ac00-4b4e-9e27-80deaad7771f')
def test_get_user(self):
# Get a user detail
- user = self.client.get_user(self.data.v3_users[0]['id'])['user']
+ user = self.client.show_user(self.data.v3_users[0]['id'])['user']
self.assertEqual(self.data.v3_users[0]['id'], user['id'])
self.assertEqual(self.data.v3_users[0]['name'], user['name'])
self.assertEqual(self.alt_email, user['email'])
diff --git a/tempest/api/identity/admin/v3/test_projects.py b/tempest/api/identity/admin/v3/test_projects.py
index f014307..d39fd5f 100644
--- a/tempest/api/identity/admin/v3/test_projects.py
+++ b/tempest/api/identity/admin/v3/test_projects.py
@@ -169,7 +169,7 @@
self.addCleanup(self.client.delete_user, user['id'])
# Get User To validate the user details
- new_user_get = self.client.get_user(user['id'])['user']
+ new_user_get = self.client.show_user(user['id'])['user']
# Assert response body of GET
self.assertEqual(u_name, new_user_get['name'])
self.assertEqual(u_desc, new_user_get['description'])
diff --git a/tempest/api/identity/admin/v3/test_roles.py b/tempest/api/identity/admin/v3/test_roles.py
index ffc991a..8595dde 100644
--- a/tempest/api/identity/admin/v3/test_roles.py
+++ b/tempest/api/identity/admin/v3/test_roles.py
@@ -81,7 +81,7 @@
self.assertIn('links', updated_role)
self.assertNotEqual(r_name, updated_role['name'])
- new_role = self.client.get_role(role['id'])['role']
+ new_role = self.client.show_role(role['id'])['role']
self.assertEqual(new_name, new_role['name'])
self.assertEqual(updated_role['id'], new_role['id'])
diff --git a/tempest/api/identity/admin/v3/test_services.py b/tempest/api/identity/admin/v3/test_services.py
index d920f64..dfb03df 100644
--- a/tempest/api/identity/admin/v3/test_services.py
+++ b/tempest/api/identity/admin/v3/test_services.py
@@ -26,7 +26,7 @@
# Used for deleting the services created in this class
self.service_client.delete_service(service_id)
# Checking whether service is deleted successfully
- self.assertRaises(lib_exc.NotFound, self.service_client.get_service,
+ self.assertRaises(lib_exc.NotFound, self.service_client.show_service,
service_id)
@test.attr(type='smoke')
@@ -56,7 +56,7 @@
self.assertNotEqual(resp1_desc, resp2_desc)
# Get service
- fetched_service = self.service_client.get_service(s_id)['service']
+ fetched_service = self.service_client.show_service(s_id)['service']
resp3_desc = fetched_service['description']
self.assertEqual(resp2_desc, resp3_desc)
diff --git a/tempest/api/identity/admin/v3/test_tokens.py b/tempest/api/identity/admin/v3/test_tokens.py
index b5f86da..7d33d4a 100644
--- a/tempest/api/identity/admin/v3/test_tokens.py
+++ b/tempest/api/identity/admin/v3/test_tokens.py
@@ -39,13 +39,13 @@
password=u_password).response
subject_token = resp['x-subject-token']
# Perform GET Token
- token_details = self.client.get_token(subject_token)['token']
+ token_details = self.client.show_token(subject_token)['token']
self.assertEqual(resp['x-subject-token'], subject_token)
self.assertEqual(token_details['user']['id'], user['id'])
self.assertEqual(token_details['user']['name'], u_name)
# Perform Delete Token
self.client.delete_token(subject_token)
- self.assertRaises(lib_exc.NotFound, self.client.get_token,
+ self.assertRaises(lib_exc.NotFound, self.client.show_token,
subject_token)
@test.idempotent_id('565fa210-1da1-4563-999b-f7b5b67cf112')
diff --git a/tempest/api/identity/admin/v3/test_users.py b/tempest/api/identity/admin/v3/test_users.py
index 8fac0b3..b56c9e6 100644
--- a/tempest/api/identity/admin/v3/test_users.py
+++ b/tempest/api/identity/admin/v3/test_users.py
@@ -54,7 +54,7 @@
self.assertEqual(u_email2, update_user['email'])
self.assertEqual(False, update_user['enabled'])
# GET by id after updation
- new_user_get = self.client.get_user(user['id'])['user']
+ new_user_get = self.client.show_user(user['id'])['user']
# Assert response body of GET after updation
self.assertEqual(u_name2, new_user_get['name'])
self.assertEqual(u_description2, new_user_get['description'])
@@ -80,7 +80,7 @@
password=new_password).response
subject_token = resp['x-subject-token']
# Perform GET Token to verify and confirm password is updated
- token_details = self.client.get_token(subject_token)['token']
+ token_details = self.client.show_token(subject_token)['token']
self.assertEqual(resp['x-subject-token'], subject_token)
self.assertEqual(token_details['user']['id'], user['id'])
self.assertEqual(token_details['user']['name'], u_name)
@@ -111,8 +111,8 @@
# Delete the Role at the end of this method
self.addCleanup(self.client.delete_role, role_body['id'])
- user = self.client.get_user(user_body['id'])['user']
- role = self.client.get_role(role_body['id'])['role']
+ user = self.client.show_user(user_body['id'])['user']
+ role = self.client.show_role(role_body['id'])['role']
for i in range(2):
# Creating project so as to assign role
project_body = self.client.create_project(
@@ -142,5 +142,5 @@
def test_get_user(self):
# Get a user detail
self.data.setup_test_v3_user()
- user = self.client.get_user(self.data.v3_user['id'])['user']
+ user = self.client.show_user(self.data.v3_user['id'])['user']
self.assertEqual(self.data.v3_user['id'], user['id'])
diff --git a/tempest/api/identity/base.py b/tempest/api/identity/base.py
index 95826b0..02ede3a 100644
--- a/tempest/api/identity/base.py
+++ b/tempest/api/identity/base.py
@@ -39,7 +39,7 @@
@classmethod
def get_user_by_name(cls, name):
- users = cls.client.get_users()['users']
+ users = cls.client.list_users()['users']
user = [u for u in users if u['name'] == name]
if len(user) > 0:
return user[0]
@@ -154,7 +154,7 @@
@classmethod
def get_user_by_name(cls, name):
- users = cls.client.get_users()['users']
+ users = cls.client.list_users()['users']
user = [u for u in users if u['name'] == name]
if len(user) > 0:
return user[0]
diff --git a/tempest/api/identity/v2/test_api_discovery.py b/tempest/api/identity/v2/test_api_discovery.py
index 57c78ef..ca807a4 100644
--- a/tempest/api/identity/v2/test_api_discovery.py
+++ b/tempest/api/identity/v2/test_api_discovery.py
@@ -23,7 +23,7 @@
@test.attr(type='smoke')
@test.idempotent_id('ea889a68-a15f-4166-bfb1-c12456eae853')
def test_api_version_resources(self):
- descr = self.non_admin_client.get_api_description()['version']
+ descr = self.non_admin_client.show_api_description()['version']
expected_resources = ('id', 'links', 'media-types', 'status',
'updated')
@@ -34,7 +34,7 @@
@test.attr(type='smoke')
@test.idempotent_id('007a0be0-78fe-4fdb-bbee-e9216cc17bb2')
def test_api_media_types(self):
- descr = self.non_admin_client.get_api_description()['version']
+ descr = self.non_admin_client.show_api_description()['version']
# Get MIME type bases and descriptions
media_types = [(media_type['base'], media_type['type']) for
media_type in descr['media-types']]
@@ -49,7 +49,7 @@
@test.attr(type='smoke')
@test.idempotent_id('77fd6be0-8801-48e6-b9bf-38cdd2f253ec')
def test_api_version_statuses(self):
- descr = self.non_admin_client.get_api_description()['version']
+ descr = self.non_admin_client.show_api_description()['version']
status = descr['status'].lower()
supported_statuses = ['current', 'stable', 'experimental',
'supported', 'deprecated']
diff --git a/tempest/api/identity/v3/test_api_discovery.py b/tempest/api/identity/v3/test_api_discovery.py
index e0207a9..74e9ec1 100644
--- a/tempest/api/identity/v3/test_api_discovery.py
+++ b/tempest/api/identity/v3/test_api_discovery.py
@@ -23,7 +23,7 @@
@test.attr(type='smoke')
@test.idempotent_id('b9232f5e-d9e5-4d97-b96c-28d3db4de1bd')
def test_api_version_resources(self):
- descr = self.non_admin_client.get_api_description()['version']
+ descr = self.non_admin_client.show_api_description()['version']
expected_resources = ('id', 'links', 'media-types', 'status',
'updated')
@@ -34,7 +34,7 @@
@test.attr(type='smoke')
@test.idempotent_id('657c1970-4722-4189-8831-7325f3bc4265')
def test_api_media_types(self):
- descr = self.non_admin_client.get_api_description()['version']
+ descr = self.non_admin_client.show_api_description()['version']
# Get MIME type bases and descriptions
media_types = [(media_type['base'], media_type['type']) for
media_type in descr['media-types']]
@@ -49,7 +49,7 @@
@test.attr(type='smoke')
@test.idempotent_id('8879a470-abfb-47bb-bb8d-5a7fd279ad1e')
def test_api_version_statuses(self):
- descr = self.non_admin_client.get_api_description()['version']
+ descr = self.non_admin_client.show_api_description()['version']
status = descr['status'].lower()
supported_statuses = ['current', 'stable', 'experimental',
'supported', 'deprecated']
diff --git a/tempest/api/network/admin/test_dhcp_agent_scheduler.py b/tempest/api/network/admin/test_dhcp_agent_scheduler.py
index 86b4973..7692b56 100644
--- a/tempest/api/network/admin/test_dhcp_agent_scheduler.py
+++ b/tempest/api/network/admin/test_dhcp_agent_scheduler.py
@@ -61,7 +61,7 @@
@test.idempotent_id('a0856713-6549-470c-a656-e97c8df9a14d')
def test_add_remove_network_from_dhcp_agent(self):
# The agent is now bound to the network, we can free the port
- self.client.delete_port(self.port['id'])
+ self.ports_client.delete_port(self.port['id'])
self.ports.remove(self.port)
agent = dict()
agent['agent_type'] = None
diff --git a/tempest/api/network/admin/test_external_networks_negative.py b/tempest/api/network/admin/test_external_networks_negative.py
index c2fa0dd..8dfce24 100644
--- a/tempest/api/network/admin/test_external_networks_negative.py
+++ b/tempest/api/network/admin/test_external_networks_negative.py
@@ -49,6 +49,6 @@
# create a port which will internally create an instance-ip
self.assertRaises(lib_exc.Conflict,
- client.create_port,
+ self.admin_ports_client.create_port,
network_id=CONF.network.public_network_id,
fixed_ips=fixed_ips)
diff --git a/tempest/api/network/base.py b/tempest/api/network/base.py
index 17adfa5..5198ae8 100644
--- a/tempest/api/network/base.py
+++ b/tempest/api/network/base.py
@@ -75,6 +75,7 @@
cls.client = cls.os.network_client
cls.networks_client = cls.os.networks_client
cls.subnets_client = cls.os.subnets_client
+ cls.ports_client = cls.os.ports_client
@classmethod
def resource_setup(cls):
@@ -108,7 +109,7 @@
metering_label['id'])
# Clean up ports
for port in cls.ports:
- cls._try_delete_resource(cls.client.delete_port,
+ cls._try_delete_resource(cls.ports_client.delete_port,
port['id'])
# Clean up routers
for router in cls.routers:
@@ -201,8 +202,8 @@
@classmethod
def create_port(cls, network, **kwargs):
"""Wrapper utility that returns a test port."""
- body = cls.client.create_port(network_id=network['id'],
- **kwargs)
+ body = cls.ports_client.create_port(network_id=network['id'],
+ **kwargs)
port = body['port']
cls.ports.append(port)
return port
@@ -210,8 +211,8 @@
@classmethod
def update_port(cls, port, **kwargs):
"""Wrapper utility that updates a test port."""
- body = cls.client.update_port(port['id'],
- **kwargs)
+ body = cls.ports_client.update_port(port['id'],
+ **kwargs)
return body['port']
@classmethod
@@ -269,6 +270,7 @@
cls.admin_client = cls.os_adm.network_client
cls.admin_networks_client = cls.os_adm.networks_client
cls.admin_subnets_client = cls.os_adm.subnets_client
+ cls.admin_ports_client = cls.os_adm.ports_client
@classmethod
def create_metering_label(cls, name, description):
diff --git a/tempest/api/network/test_allowed_address_pair.py b/tempest/api/network/test_allowed_address_pair.py
index 5d7f00e..41714aa 100644
--- a/tempest/api/network/test_allowed_address_pair.py
+++ b/tempest/api/network/test_allowed_address_pair.py
@@ -60,14 +60,14 @@
# Create port with allowed address pair attribute
allowed_address_pairs = [{'ip_address': self.ip_address,
'mac_address': self.mac_address}]
- body = self.client.create_port(
+ body = self.ports_client.create_port(
network_id=self.network['id'],
allowed_address_pairs=allowed_address_pairs)
port_id = body['port']['id']
- self.addCleanup(self.client.delete_port, port_id)
+ self.addCleanup(self.ports_client.delete_port, port_id)
# Confirm port was created with allowed address pair attribute
- body = self.client.list_ports()
+ body = self.ports_client.list_ports()
ports = body['ports']
port = [p for p in ports if p['id'] == port_id]
msg = 'Created port not found in list of ports returned by Neutron'
@@ -76,9 +76,9 @@
def _update_port_with_address(self, address, mac_address=None, **kwargs):
# Create a port without allowed address pair
- body = self.client.create_port(network_id=self.network['id'])
+ body = self.ports_client.create_port(network_id=self.network['id'])
port_id = body['port']['id']
- self.addCleanup(self.client.delete_port, port_id)
+ self.addCleanup(self.ports_client.delete_port, port_id)
if mac_address is None:
mac_address = self.mac_address
@@ -87,7 +87,7 @@
'mac_address': mac_address}]
if kwargs:
allowed_address_pairs.append(kwargs['allowed_address_pairs'])
- body = self.client.update_port(
+ body = self.ports_client.update_port(
port_id, allowed_address_pairs=allowed_address_pairs)
allowed_address_pair = body['port']['allowed_address_pairs']
self.assertEqual(allowed_address_pair, allowed_address_pairs)
@@ -106,9 +106,9 @@
@test.idempotent_id('b3f20091-6cd5-472b-8487-3516137df933')
def test_update_port_with_multiple_ip_mac_address_pair(self):
# Create an ip _address and mac_address through port create
- resp = self.client.create_port(network_id=self.network['id'])
+ resp = self.ports_client.create_port(network_id=self.network['id'])
newportid = resp['port']['id']
- self.addCleanup(self.client.delete_port, newportid)
+ self.addCleanup(self.ports_client.delete_port, newportid)
ipaddress = resp['port']['fixed_ips'][0]['ip_address']
macaddress = resp['port']['mac_address']
diff --git a/tempest/api/network/test_dhcp_ipv6.py b/tempest/api/network/test_dhcp_ipv6.py
index 631a38b..27713a2 100644
--- a/tempest/api/network/test_dhcp_ipv6.py
+++ b/tempest/api/network/test_dhcp_ipv6.py
@@ -63,7 +63,7 @@
del things_list[index]
def _clean_network(self):
- body = self.client.list_ports()
+ body = self.ports_client.list_ports()
ports = body['ports']
for port in ports:
if (port['device_owner'].startswith('network:router_interface')
@@ -73,7 +73,7 @@
)
else:
if port['id'] in [p['id'] for p in self.ports]:
- self.client.delete_port(port['id'])
+ self.ports_client.delete_port(port['id'])
self._remove_from_list_by_index(self.ports, port)
body = self.subnets_client.list_subnets()
subnets = body['subnets']
@@ -203,9 +203,9 @@
real_dhcp_ip, real_eui_ip = [real_ips[sub['id']]
for sub in [subnet_dhcp,
subnet_slaac]]
- self.client.delete_port(port['id'])
+ self.ports_client.delete_port(port['id'])
self.ports.pop()
- body = self.client.list_ports()
+ body = self.ports_client.list_ports()
ports_id_list = [i['id'] for i in body['ports']]
self.assertNotIn(port['id'], ports_id_list)
self._clean_network()
@@ -362,7 +362,7 @@
admin_state_up=True)
port = self.create_router_interface(router['id'],
subnet['id'])
- body = self.client.show_port(port['port_id'])
+ body = self.ports_client.show_port(port['port_id'])
return subnet, body['port']
@test.idempotent_id('e98f65db-68f4-4330-9fea-abd8c5192d4d')
diff --git a/tempest/api/network/test_extra_dhcp_options.py b/tempest/api/network/test_extra_dhcp_options.py
index 87e3413..7924f38 100644
--- a/tempest/api/network/test_extra_dhcp_options.py
+++ b/tempest/api/network/test_extra_dhcp_options.py
@@ -59,14 +59,14 @@
@test.idempotent_id('d2c17063-3767-4a24-be4f-a23dbfa133c9')
def test_create_list_port_with_extra_dhcp_options(self):
# Create a port with Extra DHCP Options
- body = self.client.create_port(
+ body = self.ports_client.create_port(
network_id=self.network['id'],
extra_dhcp_opts=self.extra_dhcp_opts)
port_id = body['port']['id']
- self.addCleanup(self.client.delete_port, port_id)
+ self.addCleanup(self.ports_client.delete_port, port_id)
# Confirm port created has Extra DHCP Options
- body = self.client.list_ports()
+ body = self.ports_client.list_ports()
ports = body['ports']
port = [p for p in ports if p['id'] == port_id]
self.assertTrue(port)
@@ -76,12 +76,12 @@
def test_update_show_port_with_extra_dhcp_options(self):
# Update port with extra dhcp options
name = data_utils.rand_name('new-port-name')
- body = self.client.update_port(
+ body = self.ports_client.update_port(
self.port['id'],
name=name,
extra_dhcp_opts=self.extra_dhcp_opts)
# Confirm extra dhcp options were added to the port
- body = self.client.show_port(self.port['id'])
+ body = self.ports_client.show_port(self.port['id'])
self._confirm_extra_dhcp_options(body['port'], self.extra_dhcp_opts)
def _confirm_extra_dhcp_options(self, port, extra_dhcp_opts):
diff --git a/tempest/api/network/test_floating_ips.py b/tempest/api/network/test_floating_ips.py
index 4b4a4e2..b796311 100644
--- a/tempest/api/network/test_floating_ips.py
+++ b/tempest/api/network/test_floating_ips.py
@@ -130,13 +130,13 @@
self.addCleanup(self.client.delete_floatingip,
created_floating_ip['id'])
# Create a port
- port = self.client.create_port(network_id=self.network['id'])
+ port = self.ports_client.create_port(network_id=self.network['id'])
created_port = port['port']
floating_ip = self.client.update_floatingip(
created_floating_ip['id'],
port_id=created_port['id'])
# Delete port
- self.client.delete_port(created_port['id'])
+ self.ports_client.delete_port(created_port['id'])
# Verifies the details of the floating_ip
floating_ip = self.client.show_floatingip(created_floating_ip['id'])
shown_floating_ip = floating_ip['floatingip']
@@ -197,10 +197,10 @@
list_ips = [str(ip) for ip in ips[-3:-1]]
fixed_ips = [{'ip_address': list_ips[0]}, {'ip_address': list_ips[1]}]
# Create port
- body = self.client.create_port(network_id=self.network['id'],
- fixed_ips=fixed_ips)
+ body = self.ports_client.create_port(network_id=self.network['id'],
+ fixed_ips=fixed_ips)
port = body['port']
- self.addCleanup(self.client.delete_port, port['id'])
+ self.addCleanup(self.ports_client.delete_port, port['id'])
# Create floating ip
body = self.client.create_floatingip(
floating_network_id=self.ext_net_id,
diff --git a/tempest/api/network/test_networks.py b/tempest/api/network/test_networks.py
index c5b2080..5039a69 100644
--- a/tempest/api/network/test_networks.py
+++ b/tempest/api/network/test_networks.py
@@ -444,9 +444,9 @@
def _delete_ports(self, created_ports):
for n in created_ports:
- self.client.delete_port(n['id'])
+ self.ports_client.delete_port(n['id'])
# Asserting that the ports are not found in the list after deletion
- body = self.client.list_ports()
+ body = self.ports_client.list_ports()
ports_list = [port['id'] for port in body['ports']]
for n in created_ports:
self.assertNotIn(n['id'], ports_list)
@@ -522,7 +522,7 @@
created_ports = body['ports']
self.addCleanup(self._delete_ports, created_ports)
# Asserting that the ports are found in the list after creation
- body = self.client.list_ports()
+ body = self.ports_client.list_ports()
ports_list = [port['id'] for port in body['ports']]
for n in created_ports:
self.assertIsNotNone(n['id'])
diff --git a/tempest/api/network/test_networks_negative.py b/tempest/api/network/test_networks_negative.py
index 4fe31cf..0ef96a6 100644
--- a/tempest/api/network/test_networks_negative.py
+++ b/tempest/api/network/test_networks_negative.py
@@ -41,7 +41,7 @@
@test.idempotent_id('a954861d-cbfd-44e8-b0a9-7fab111f235d')
def test_show_non_existent_port(self):
non_exist_id = data_utils.rand_uuid()
- self.assertRaises(lib_exc.NotFound, self.client.show_port,
+ self.assertRaises(lib_exc.NotFound, self.ports_client.show_port,
non_exist_id)
@test.attr(type=['negative'])
@@ -79,13 +79,14 @@
def test_create_port_on_non_existent_network(self):
non_exist_net_id = data_utils.rand_uuid()
self.assertRaises(lib_exc.NotFound,
- self.client.create_port, network_id=non_exist_net_id)
+ self.ports_client.create_port,
+ network_id=non_exist_net_id)
@test.attr(type=['negative'])
@test.idempotent_id('cf8eef21-4351-4f53-adcd-cc5cb1e76b92')
def test_update_non_existent_port(self):
non_exist_port_id = data_utils.rand_uuid()
- self.assertRaises(lib_exc.NotFound, self.client.update_port,
+ self.assertRaises(lib_exc.NotFound, self.ports_client.update_port,
non_exist_port_id, name='new_name')
@test.attr(type=['negative'])
@@ -93,4 +94,4 @@
def test_delete_non_existent_port(self):
non_exist_port_id = data_utils.rand_uuid()
self.assertRaises(lib_exc.NotFound,
- self.client.delete_port, non_exist_port_id)
+ self.ports_client.delete_port, non_exist_port_id)
diff --git a/tempest/api/network/test_ports.py b/tempest/api/network/test_ports.py
index 6f58075..d0ed1f2 100644
--- a/tempest/api/network/test_ports.py
+++ b/tempest/api/network/test_ports.py
@@ -45,8 +45,8 @@
cls.port = cls.create_port(cls.network)
def _delete_port(self, port_id):
- self.client.delete_port(port_id)
- body = self.client.list_ports()
+ self.ports_client.delete_port(port_id)
+ body = self.ports_client.list_ports()
ports_list = body['ports']
self.assertFalse(port_id in [n['id'] for n in ports_list])
@@ -54,16 +54,16 @@
@test.idempotent_id('c72c1c0c-2193-4aca-aaa4-b1442640f51c')
def test_create_update_delete_port(self):
# Verify port creation
- body = self.client.create_port(network_id=self.network['id'])
+ body = self.ports_client.create_port(network_id=self.network['id'])
port = body['port']
# Schedule port deletion with verification upon test completion
self.addCleanup(self._delete_port, port['id'])
self.assertTrue(port['admin_state_up'])
# Verify port update
new_name = "New_Port"
- body = self.client.update_port(port['id'],
- name=new_name,
- admin_state_up=False)
+ body = self.ports_client.update_port(port['id'],
+ name=new_name,
+ admin_state_up=False)
updated_port = body['port']
self.assertEqual(updated_port['name'], new_name)
self.assertFalse(updated_port['admin_state_up'])
@@ -107,8 +107,8 @@
'end': str(address + 6)}]}
subnet = self.create_subnet(network, **allocation_pools)
self.addCleanup(self.subnets_client.delete_subnet, subnet['id'])
- body = self.client.create_port(network_id=net_id)
- self.addCleanup(self.client.delete_port, body['port']['id'])
+ body = self.ports_client.create_port(network_id=net_id)
+ self.addCleanup(self.ports_client.delete_port, body['port']['id'])
port = body['port']
ip_address = port['fixed_ips'][0]['ip_address']
start_ip_address = allocation_pools['allocation_pools'][0]['start']
@@ -120,7 +120,7 @@
@test.idempotent_id('c9a685bd-e83f-499c-939f-9f7863ca259f')
def test_show_port(self):
# Verify the details of port
- body = self.client.show_port(self.port['id'])
+ body = self.ports_client.show_port(self.port['id'])
port = body['port']
self.assertIn('id', port)
# TODO(Santosh)- This is a temporary workaround to compare create_port
@@ -134,8 +134,8 @@
def test_show_port_fields(self):
# Verify specific fields of a port
fields = ['id', 'mac_address']
- body = self.client.show_port(self.port['id'],
- fields=fields)
+ body = self.ports_client.show_port(self.port['id'],
+ fields=fields)
port = body['port']
self.assertEqual(sorted(port.keys()), sorted(fields))
for field_name in fields:
@@ -145,7 +145,7 @@
@test.idempotent_id('cf95b358-3e92-4a29-a148-52445e1ac50e')
def test_list_ports(self):
# Verify the port exists in the list of all ports
- body = self.client.list_ports()
+ body = self.ports_client.list_ports()
ports = [port['id'] for port in body['ports']
if port['id'] == self.port['id']]
self.assertNotEmpty(ports, "Created port not found in the list")
@@ -157,14 +157,14 @@
subnet = self.create_subnet(network)
self.addCleanup(self.subnets_client.delete_subnet, subnet['id'])
# Create two ports
- port_1 = self.client.create_port(network_id=network['id'])
- self.addCleanup(self.client.delete_port, port_1['port']['id'])
- port_2 = self.client.create_port(network_id=network['id'])
- self.addCleanup(self.client.delete_port, port_2['port']['id'])
+ port_1 = self.ports_client.create_port(network_id=network['id'])
+ self.addCleanup(self.ports_client.delete_port, port_1['port']['id'])
+ port_2 = self.ports_client.create_port(network_id=network['id'])
+ self.addCleanup(self.ports_client.delete_port, port_2['port']['id'])
# List ports filtered by fixed_ips
port_1_fixed_ip = port_1['port']['fixed_ips'][0]['ip_address']
fixed_ips = 'ip_address=' + port_1_fixed_ip
- port_list = self.client.list_ports(fixed_ips=fixed_ips)
+ port_list = self.ports_client.list_ports(fixed_ips=fixed_ips)
# Check that we got the desired port
ports = port_list['ports']
tenant_ids = set([port['tenant_id'] for port in ports])
@@ -190,14 +190,14 @@
self.addCleanup(self.subnets_client.delete_subnet, subnet['id'])
router = self.create_router(data_utils.rand_name('router-'))
self.addCleanup(self.client.delete_router, router['id'])
- port = self.client.create_port(network_id=network['id'])
+ port = self.ports_client.create_port(network_id=network['id'])
# Add router interface to port created above
self.client.add_router_interface_with_port_id(
router['id'], port['port']['id'])
self.addCleanup(self.client.remove_router_interface_with_port_id,
router['id'], port['port']['id'])
# List ports filtered by router_id
- port_list = self.client.list_ports(device_id=router['id'])
+ port_list = self.ports_client.list_ports(device_id=router['id'])
ports = port_list['ports']
self.assertEqual(len(ports), 1)
self.assertEqual(ports[0]['id'], port['port']['id'])
@@ -207,7 +207,7 @@
def test_list_ports_fields(self):
# Verify specific fields of ports
fields = ['id', 'mac_address']
- body = self.client.list_ports(fields=fields)
+ body = self.ports_client.list_ports(fields=fields)
ports = body['ports']
self.assertNotEmpty(ports, "Port list returned is empty")
# Asserting the fields returned are correct
@@ -231,7 +231,7 @@
# Create a port with multiple IP addresses
port = self.create_port(network,
fixed_ips=fixed_ips)
- self.addCleanup(self.client.delete_port, port['id'])
+ self.addCleanup(self.ports_client.delete_port, port['id'])
self.assertEqual(2, len(port['fixed_ips']))
check_fixed_ips = [subnet_1['id'], subnet_2['id']]
for item in port['fixed_ips']:
@@ -269,8 +269,8 @@
"network_id": self.network['id'],
"admin_state_up": True,
"fixed_ips": fixed_ip_1}
- body = self.client.create_port(**post_body)
- self.addCleanup(self.client.delete_port, body['port']['id'])
+ body = self.ports_client.create_port(**post_body)
+ self.addCleanup(self.ports_client.delete_port, body['port']['id'])
port = body['port']
# Update the port with security groups
@@ -280,7 +280,7 @@
"admin_state_up": False,
"fixed_ips": fixed_ip_2,
"security_groups": security_groups_list}
- body = self.client.update_port(port['id'], **update_body)
+ body = self.ports_client.update_port(port['id'], **update_body)
port_show = body['port']
# Verify the security groups and other attributes updated to port
exclude_keys = set(port_show).symmetric_difference(update_body)
@@ -308,16 +308,16 @@
@test.idempotent_id('13e95171-6cbd-489c-9d7c-3f9c58215c18')
def test_create_show_delete_port_user_defined_mac(self):
# Create a port for a legal mac
- body = self.client.create_port(network_id=self.network['id'])
+ body = self.ports_client.create_port(network_id=self.network['id'])
old_port = body['port']
free_mac_address = old_port['mac_address']
- self.client.delete_port(old_port['id'])
+ self.ports_client.delete_port(old_port['id'])
# Create a new port with user defined mac
- body = self.client.create_port(network_id=self.network['id'],
- mac_address=free_mac_address)
- self.addCleanup(self.client.delete_port, body['port']['id'])
+ body = self.ports_client.create_port(network_id=self.network['id'],
+ mac_address=free_mac_address)
+ self.addCleanup(self.ports_client.delete_port, body['port']['id'])
port = body['port']
- body = self.client.show_port(port['id'])
+ body = self.ports_client.show_port(port['id'])
show_port = body['port']
self.assertEqual(free_mac_address,
show_port['mac_address'])
@@ -330,7 +330,7 @@
subnet = self.create_subnet(network)
self.addCleanup(self.subnets_client.delete_subnet, subnet['id'])
port = self.create_port(network, security_groups=[])
- self.addCleanup(self.client.delete_port, port['id'])
+ self.addCleanup(self.ports_client.delete_port, port['id'])
self.assertIsNotNone(port['security_groups'])
self.assertEmpty(port['security_groups'])
@@ -352,9 +352,9 @@
def test_create_port_binding_ext_attr(self):
post_body = {"network_id": self.network['id'],
"binding:host_id": self.host_id}
- body = self.admin_client.create_port(**post_body)
+ body = self.admin_ports_client.create_port(**post_body)
port = body['port']
- self.addCleanup(self.admin_client.delete_port, port['id'])
+ self.addCleanup(self.admin_ports_client.delete_port, port['id'])
host_id = port['binding:host_id']
self.assertIsNotNone(host_id)
self.assertEqual(self.host_id, host_id)
@@ -362,11 +362,11 @@
@test.idempotent_id('6f6c412c-711f-444d-8502-0ac30fbf5dd5')
def test_update_port_binding_ext_attr(self):
post_body = {"network_id": self.network['id']}
- body = self.admin_client.create_port(**post_body)
+ body = self.admin_ports_client.create_port(**post_body)
port = body['port']
- self.addCleanup(self.admin_client.delete_port, port['id'])
+ self.addCleanup(self.admin_ports_client.delete_port, port['id'])
update_body = {"binding:host_id": self.host_id}
- body = self.admin_client.update_port(port['id'], **update_body)
+ body = self.admin_ports_client.update_port(port['id'], **update_body)
updated_port = body['port']
host_id = updated_port['binding:host_id']
self.assertIsNotNone(host_id)
@@ -376,18 +376,18 @@
def test_list_ports_binding_ext_attr(self):
# Create a new port
post_body = {"network_id": self.network['id']}
- body = self.admin_client.create_port(**post_body)
+ body = self.admin_ports_client.create_port(**post_body)
port = body['port']
- self.addCleanup(self.admin_client.delete_port, port['id'])
+ self.addCleanup(self.admin_ports_client.delete_port, port['id'])
# Update the port's binding attributes so that is now 'bound'
# to a host
update_body = {"binding:host_id": self.host_id}
- self.admin_client.update_port(port['id'], **update_body)
+ self.admin_ports_client.update_port(port['id'], **update_body)
# List all ports, ensure new port is part of list and its binding
# attributes are set and accurate
- body = self.admin_client.list_ports()
+ body = self.admin_ports_client.list_ports()
ports_list = body['ports']
pids_list = [p['id'] for p in ports_list]
self.assertIn(port['id'], pids_list)
@@ -399,10 +399,11 @@
@test.idempotent_id('b54ac0ff-35fc-4c79-9ca3-c7dbd4ea4f13')
def test_show_port_binding_ext_attr(self):
- body = self.admin_client.create_port(network_id=self.network['id'])
+ body = self.admin_ports_client.create_port(
+ network_id=self.network['id'])
port = body['port']
- self.addCleanup(self.admin_client.delete_port, port['id'])
- body = self.admin_client.show_port(port['id'])
+ self.addCleanup(self.admin_ports_client.delete_port, port['id'])
+ body = self.admin_ports_client.show_port(port['id'])
show_port = body['port']
self.assertEqual(port['binding:host_id'],
show_port['binding:host_id'])
diff --git a/tempest/api/network/test_routers.py b/tempest/api/network/test_routers.py
index 29855e1..ed191b6 100644
--- a/tempest/api/network/test_routers.py
+++ b/tempest/api/network/test_routers.py
@@ -144,7 +144,7 @@
self.assertIn('subnet_id', interface.keys())
self.assertIn('port_id', interface.keys())
# Verify router id is equal to device id in port details
- show_port_body = self.client.show_port(
+ show_port_body = self.ports_client.show_port(
interface['port_id'])
self.assertEqual(show_port_body['port']['device_id'],
router['id'])
@@ -155,7 +155,7 @@
network = self.create_network()
self.create_subnet(network)
router = self._create_router(data_utils.rand_name('router-'))
- port_body = self.client.create_port(
+ port_body = self.ports_client.create_port(
network_id=network['id'])
# add router interface to port created above
interface = self.client.add_router_interface_with_port_id(
@@ -165,7 +165,7 @@
self.assertIn('subnet_id', interface.keys())
self.assertIn('port_id', interface.keys())
# Verify router id is equal to device id in port details
- show_port_body = self.client.show_port(
+ show_port_body = self.ports_client.show_port(
interface['port_id'])
self.assertEqual(show_port_body['port']['device_id'],
router['id'])
@@ -181,7 +181,7 @@
self.assertEqual(v, actual_ext_gw_info[k])
def _verify_gateway_port(self, router_id):
- list_body = self.admin_client.list_ports(
+ list_body = self.admin_ports_client.list_ports(
network_id=CONF.network.public_network_id,
device_id=router_id)
self.assertEqual(len(list_body['ports']), 1)
@@ -245,7 +245,7 @@
self.client.update_router(router['id'], external_gateway_info={})
self._verify_router_gateway(router['id'])
# No gateway port expected
- list_body = self.admin_client.list_ports(
+ list_body = self.admin_ports_client.list_ports(
network_id=CONF.network.public_network_id,
device_id=router['id'])
self.assertFalse(list_body['ports'])
@@ -357,7 +357,7 @@
interface02['port_id'])
def _verify_router_interface(self, router_id, subnet_id, port_id):
- show_port_body = self.client.show_port(port_id)
+ show_port_body = self.ports_client.show_port(port_id)
interface_port = show_port_body['port']
self.assertEqual(router_id, interface_port['device_id'])
self.assertEqual(subnet_id,
diff --git a/tempest/api/object_storage/test_object_services.py b/tempest/api/object_storage/test_object_services.py
index d64efee..e8b035b 100644
--- a/tempest/api/object_storage/test_object_services.py
+++ b/tempest/api/object_storage/test_object_services.py
@@ -545,7 +545,7 @@
self.assertTrue(resp['etag'].strip('\"').isalnum())
self.assertTrue(re.match("^\d+\.?\d*\Z", resp['x-timestamp']))
self.assertNotEqual(len(resp['content-type']), 0)
- self.assertTrue(re.match("^tx[0-9a-f]*-[0-9a-f]*$",
+ self.assertTrue(re.match("^tx[0-9a-f]{21}-[0-9a-f]{10}.*",
resp['x-trans-id']))
self.assertNotEqual(len(resp['date']), 0)
self.assertEqual(resp['accept-ranges'], 'bytes')
@@ -637,7 +637,7 @@
self.assertTrue(resp['etag'].strip('\"').isalnum())
self.assertTrue(re.match("^\d+\.?\d*\Z", resp['x-timestamp']))
self.assertNotEqual(len(resp['content-type']), 0)
- self.assertTrue(re.match("^tx[0-9a-f]*-[0-9a-f]*$",
+ self.assertTrue(re.match("^tx[0-9a-f]{21}-[0-9a-f]{10}.*",
resp['x-trans-id']))
self.assertNotEqual(len(resp['date']), 0)
self.assertEqual(resp['accept-ranges'], 'bytes')
diff --git a/tempest/api/orchestration/stacks/test_neutron_resources.py b/tempest/api/orchestration/stacks/test_neutron_resources.py
index 070150d..d22fb25 100644
--- a/tempest/api/orchestration/stacks/test_neutron_resources.py
+++ b/tempest/api/orchestration/stacks/test_neutron_resources.py
@@ -164,7 +164,7 @@
router_id = self.test_resources.get('Router')['physical_resource_id']
network_id = self.test_resources.get('Network')['physical_resource_id']
subnet_id = self.test_resources.get('Subnet')['physical_resource_id']
- body = self.network_client.list_ports()
+ body = self.ports_client.list_ports()
ports = body['ports']
router_ports = filter(lambda port: port['device_id'] ==
router_id, ports)
diff --git a/tempest/clients.py b/tempest/clients.py
index 84e8544..e8a9fd5 100644
--- a/tempest/clients.py
+++ b/tempest/clients.py
@@ -107,6 +107,7 @@
MessagingClient
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
from tempest.services.network.json.subnets_client import SubnetsClient
from tempest.services.object_storage.account_client import AccountClient
from tempest.services.object_storage.container_client import ContainerClient
@@ -213,6 +214,14 @@
build_interval=CONF.network.build_interval,
build_timeout=CONF.network.build_timeout,
**self.default_params)
+ self.ports_client = PortsClient(
+ 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,
diff --git a/tempest/cmd/cleanup.py b/tempest/cmd/cleanup.py
old mode 100755
new mode 100644
index 7898035..8b84bea
--- a/tempest/cmd/cleanup.py
+++ b/tempest/cmd/cleanup.py
@@ -50,9 +50,9 @@
Please run with **--help** to see full list of options.
"""
-import argparse
import sys
+from cliff import command
from oslo_log import log as logging
from oslo_serialization import jsonutils as json
@@ -67,13 +67,17 @@
CONF = config.CONF
-class Cleanup(object):
+class TempestCleanup(command.Command):
- def __init__(self):
+ def __init__(self, app, cmd):
+ super(TempestCleanup, self).__init__(app, cmd)
+
+ def take_action(self, parsed_args):
+ cleanup_service.init_conf()
+ self.options = parsed_args
self.admin_mgr = clients.AdminManager()
self.dry_run_data = {}
self.json_data = {}
- self._init_options()
self.admin_id = ""
self.admin_role_id = ""
@@ -86,9 +90,7 @@
self.tenant_services = cleanup_service.get_tenant_cleanup_services()
self.global_services = cleanup_service.get_global_cleanup_services()
- def run(self):
- opts = self.options
- if opts.init_saved_state:
+ if parsed_args.init_saved_state:
self._init_state()
return
@@ -157,8 +159,8 @@
tenant_data = dry_run_data["_tenants_to_clean"][tenant_id] = {}
tenant_data['name'] = tenant_name
- kwargs = {"username": CONF.identity.admin_username,
- "password": CONF.identity.admin_password,
+ kwargs = {"username": CONF.auth.admin_username,
+ "password": CONF.auth.admin_password,
"tenant_name": tenant['name']}
mgr = clients.Manager(credentials=cred_provider.get_credentials(
**kwargs))
@@ -175,22 +177,21 @@
def _init_admin_ids(self):
id_cl = self.admin_mgr.identity_client
- tenant = id_cl.get_tenant_by_name(CONF.identity.admin_tenant_name)
+ tenant = id_cl.get_tenant_by_name(CONF.auth.admin_tenant_name)
self.admin_tenant_id = tenant['id']
user = id_cl.get_user_by_username(self.admin_tenant_id,
- CONF.identity.admin_username)
+ CONF.auth.admin_username)
self.admin_id = user['id']
- roles = id_cl.list_roles()
+ roles = id_cl.list_roles()['roles']
for role in roles:
if role['name'] == CONF.identity.admin_role:
self.admin_role_id = role['id']
break
- def _init_options(self):
- parser = argparse.ArgumentParser(
- description='Cleanup after tempest run')
+ def get_parser(self, prog_name):
+ parser = super(TempestCleanup, self).get_parser(prog_name)
parser.add_argument('--init-saved-state', action="store_true",
dest='init_saved_state', default=False,
help="Creates JSON file: " + SAVED_STATE_JSON +
@@ -211,13 +212,15 @@
help="Generate JSON file:" + DRY_RUN_JSON +
", that reports the objects that would have "
"been deleted had a full cleanup been run.")
+ return parser
- self.options = parser.parse_args()
+ def get_description(self):
+ return 'Cleanup after tempest run'
def _add_admin(self, tenant_id):
id_cl = self.admin_mgr.identity_client
needs_role = True
- roles = id_cl.list_user_roles(tenant_id, self.admin_id)
+ roles = id_cl.list_user_roles(tenant_id, self.admin_id)['roles']
for role in roles:
if role['id'] == self.admin_role_id:
needs_role = False
@@ -244,7 +247,7 @@
def _tenant_exists(self, tenant_id):
id_cl = self.admin_mgr.identity_client
try:
- t = id_cl.get_tenant(tenant_id)
+ t = id_cl.show_tenant(tenant_id)
LOG.debug("Tenant is: %s" % str(t))
return True
except Exception as ex:
@@ -282,14 +285,3 @@
except Exception as ex:
LOG.exception("Exception parsing saved state json : %s" % ex)
sys.exit(ex)
-
-
-def main():
- cleanup_service.init_conf()
- cleanup = Cleanup()
- cleanup.run()
- LOG.info('Cleanup finished!')
- return 0
-
-if __name__ == "__main__":
- sys.exit(main())
diff --git a/tempest/cmd/cleanup_service.py b/tempest/cmd/cleanup_service.py
index 64e1303..8b1e550 100644
--- a/tempest/cmd/cleanup_service.py
+++ b/tempest/cmd/cleanup_service.py
@@ -69,10 +69,10 @@
CONF_PRIV_NETWORK_NAME = CONF.compute.fixed_network_name
CONF_PUB_NETWORK = CONF.network.public_network_id
CONF_PUB_ROUTER = CONF.network.public_router_id
- CONF_TENANTS = [CONF.identity.admin_tenant_name,
+ CONF_TENANTS = [CONF.auth.admin_tenant_name,
CONF.identity.tenant_name,
CONF.identity.alt_tenant_name]
- CONF_USERS = [CONF.identity.admin_username, CONF.identity.username,
+ CONF_USERS = [CONF.auth.admin_username, CONF.identity.username,
CONF.identity.alt_username]
if IS_NEUTRON:
@@ -147,7 +147,7 @@
def list(self):
client = self.client
- snaps = client.list_snapshots()
+ snaps = client.list_snapshots()['snapshots']
LOG.debug("List count, %s Snapshots" % len(snaps))
return snaps
@@ -169,6 +169,7 @@
def __init__(self, manager, **kwargs):
super(ServerService, self).__init__(kwargs)
self.client = manager.servers_client
+ self.server_groups_client = manager.server_groups_client
def list(self):
client = self.client
@@ -194,7 +195,7 @@
class ServerGroupService(ServerService):
def list(self):
- client = self.client
+ client = self.server_groups_client
sgs = client.list_server_groups()['server_groups']
LOG.debug("List count, %s Server Groups" % len(sgs))
return sgs
@@ -383,6 +384,7 @@
self.client = manager.network_client
self.networks_client = manager.networks_client
self.subnets_client = manager.subnets_client
+ self.ports_client = manager.ports_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)):
@@ -620,7 +622,7 @@
class NetworkPortService(NetworkService):
def list(self):
- client = self.client
+ client = self.ports_client
ports = [port for port in
client.list_ports(**self.tenant_filter)['ports']
if port["device_owner"] == "" or
@@ -633,7 +635,7 @@
return ports
def delete(self):
- client = self.client
+ client = self.ports_client
ports = self.list()
for port in ports:
try:
@@ -812,7 +814,7 @@
def list(self):
client = self.client
- users = client.get_users()
+ users = client.list_users()['users']
if not self.is_save_state:
users = [user for user in users if user['id']
@@ -824,7 +826,7 @@
elif not self.is_save_state: # Never delete admin user
users = [user for user in users if user['name'] !=
- CONF.identity.admin_username]
+ CONF.auth.admin_username]
LOG.debug("List count, %s Users after reconcile" % len(users))
return users
@@ -854,7 +856,7 @@
def list(self):
client = self.client
try:
- roles = client.list_roles()
+ roles = client.list_roles()['roles']
# reconcile roles with saved state and never list admin role
if not self.is_save_state:
roles = [role for role in roles if
@@ -895,7 +897,7 @@
if not self.is_save_state:
tenants = [tenant for tenant in tenants if (tenant['id']
not in self.saved_state_json['tenants'].keys()
- and tenant['name'] != CONF.identity.admin_tenant_name)]
+ and tenant['name'] != CONF.auth.admin_tenant_name)]
if self.is_preserve:
tenants = [tenant for tenant in tenants if tenant['name']
diff --git a/tempest/cmd/init.py b/tempest/cmd/init.py
index af8f270..a4ed064 100644
--- a/tempest/cmd/init.py
+++ b/tempest/cmd/init.py
@@ -116,9 +116,9 @@
if not os.path.isdir(local_dir):
LOG.debug('Creating local working dir: %s' % local_dir)
os.mkdir(local_dir)
- else:
+ elif not os.listdir(local_dir) == []:
raise OSError("Directory you are trying to initialize already "
- "exists: %s" % local_dir)
+ "exists and is not empty: %s" % local_dir)
lock_dir = os.path.join(local_dir, 'tempest_lock')
etc_dir = os.path.join(local_dir, 'etc')
diff --git a/tempest/cmd/javelin.py b/tempest/cmd/javelin.py
index f57e757..97d431a 100755
--- a/tempest/cmd/javelin.py
+++ b/tempest/cmd/javelin.py
@@ -432,7 +432,7 @@
LOG.info("checking users")
for name, user in six.iteritems(self.users):
client = keystone_admin()
- found = client.identity.get_user(user['id'])['user']
+ found = client.identity.show_user(user['id'])['user']
self.assertEqual(found['name'], user['name'])
self.assertEqual(found['tenantId'], user['tenant_id'])
diff --git a/tempest/common/dynamic_creds.py b/tempest/common/dynamic_creds.py
index e2df560..ce69c84 100644
--- a/tempest/common/dynamic_creds.py
+++ b/tempest/common/dynamic_creds.py
@@ -43,7 +43,8 @@
identity_version=self.identity_version)
(self.identity_admin_client, self.network_admin_client,
self.networks_admin_client,
- self.subnets_admin_client) = self._get_admin_clients()
+ self.subnets_admin_client,
+ self.ports_admin_client) = self._get_admin_clients()
# Domain where isolated credentials are provisioned (v3 only).
# Use that of the admin account is None is configured.
self.creds_domain_name = None
@@ -64,10 +65,10 @@
os = clients.Manager(self.default_admin_creds)
if self.identity_version == 'v2':
return (os.identity_client, os.network_client, os.networks_client,
- os.subnets_client)
+ os.subnets_client, os.ports_client)
else:
return (os.identity_v3_client, os.network_client,
- os.networks_client, os.subnets_client)
+ os.networks_client, os.subnets_client, os.ports_client)
def _create_creds(self, suffix="", admin=False, roles=None):
"""Create random credentials under the following schema.
diff --git a/tempest/config.py b/tempest/config.py
index 0cda018..26823de 100644
--- a/tempest/config.py
+++ b/tempest/config.py
@@ -255,6 +255,7 @@
"when sshing to a guest."),
cfg.StrOpt('ssh_auth_method',
default='keypair',
+ choices=('keypair', 'configured', 'adminpass', 'disabled'),
help="Auth method used for authenticate to the instance. "
"Valid choices are: keypair, configured, adminpass "
"and disabled. "
@@ -264,6 +265,7 @@
"Disabled: avoid using ssh when it is an option."),
cfg.StrOpt('ssh_connect_method',
default='floating',
+ choices=('fixed', 'floating'),
help="How to connect to the instance? "
"fixed: using the first ip belongs the fixed network "
"floating: creating and using a floating ip."),
@@ -330,7 +332,13 @@
help='Unallocated floating IP range, which will be used to '
'test the floating IP bulk feature for CRUD operation. '
'This block must not overlap an existing floating IP '
- 'pool.')
+ 'pool.'),
+ cfg.IntOpt('min_compute_nodes',
+ default=1,
+ help=('The minimum number of compute nodes expected. This will '
+ 'be utilized by some multinode specific tests to ensure '
+ 'that requests match the expected size of the cluster '
+ 'you are testing with.'))
]
compute_features_group = cfg.OptGroup(name='compute-feature-enabled',
diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py
index a10dc83..6548d28 100644
--- a/tempest/scenario/manager.py
+++ b/tempest/scenario/manager.py
@@ -62,6 +62,7 @@
# Neutron network client
cls.network_client = cls.manager.network_client
cls.networks_client = cls.manager.networks_client
+ cls.ports_client = cls.manager.ports_client
cls.subnets_client = cls.manager.subnets_client
# Heat client
cls.orchestration_client = cls.manager.orchestration_client
@@ -661,7 +662,7 @@
def _list_ports(self, *args, **kwargs):
"""List ports using admin creds """
- ports_list = self.admin_manager.network_client.list_ports(
+ ports_list = self.admin_manager.ports_client.list_ports(
*args, **kwargs)
return ports_list['ports']
@@ -735,14 +736,14 @@
def _create_port(self, network_id, client=None, namestart='port-quotatest',
**kwargs):
if not client:
- client = self.network_client
+ client = self.ports_client
name = data_utils.rand_name(namestart)
result = client.create_port(
name=name,
network_id=network_id,
**kwargs)
self.assertIsNotNone(result, 'Unable to allocate port')
- port = net_resources.DeletablePort(client=client,
+ port = net_resources.DeletablePort(ports_client=client,
**result['port'])
self.addCleanup(self.delete_wrapper, port.delete)
return port
@@ -757,6 +758,8 @@
for fxip in p["fixed_ips"]
if netaddr.valid_ipv4(fxip["ip_address"])]
+ self.assertNotEqual(0, len(port_map),
+ "No IPv4 addresses found in: %s" % ports)
self.assertEqual(len(port_map), 1,
"Found multiple IPv4 addresses: %s. "
"Unable to determine which port to target."
@@ -1127,11 +1130,13 @@
def create_server(self, name=None, image=None, flavor=None,
wait_on_boot=True, wait_on_delete=True,
network_client=None, networks_client=None,
- create_kwargs=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
@@ -1175,7 +1180,7 @@
for net in networks:
net_id = net['uuid']
port = self._create_port(network_id=net_id,
- client=network_client,
+ client=ports_client,
**create_port_body)
ports.append({'port': port.id})
if ports:
diff --git a/tempest/scenario/test_baremetal_basic_ops.py b/tempest/scenario/test_baremetal_basic_ops.py
index c0b5a44..ed691ac 100644
--- a/tempest/scenario/test_baremetal_basic_ops.py
+++ b/tempest/scenario/test_baremetal_basic_ops.py
@@ -107,17 +107,10 @@
return None
return int(ephemeral)
- def add_floating_ip(self):
- floating_ip = (self.floating_ips_client.create_floating_ip()
- ['floating_ip'])
- self.floating_ips_client.associate_floating_ip_to_server(
- floating_ip['ip'], self.instance['id'])
- return floating_ip['ip']
-
def validate_ports(self):
for port in self.get_ports(self.node['uuid']):
n_port_id = port['extra']['vif_port_id']
- body = self.network_client.show_port(n_port_id)
+ body = self.ports_client.show_port(n_port_id)
n_port = body['port']
self.assertEqual(n_port['device_id'], self.instance['id'])
self.assertEqual(n_port['mac_address'], port['address'])
@@ -131,7 +124,7 @@
self.validate_ports()
self.verify_connectivity()
if CONF.compute.ssh_connect_method == 'floating':
- floating_ip = self.add_floating_ip()
+ floating_ip = self.create_floating_ip(self.instance)['ip']
self.verify_connectivity(ip=floating_ip)
vm_client = self.get_remote_client(self.instance)
diff --git a/tempest/scenario/test_network_basic_ops.py b/tempest/scenario/test_network_basic_ops.py
index 31ccd5b..dc5ca08 100644
--- a/tempest/scenario/test_network_basic_ops.py
+++ b/tempest/scenario/test_network_basic_ops.py
@@ -250,7 +250,7 @@
net_id=self.new_net.id)['interfaceAttachment']
self.addCleanup(self.network_client.wait_for_resource_deletion,
'port',
- interface['port_id'])
+ interface['port_id'], client=self.ports_client)
self.addCleanup(self.delete_wrapper,
self.interface_client.delete_interface,
server['id'], interface['port_id'])
@@ -268,7 +268,7 @@
"Old port: %s. Number of new ports: %d" % (
CONF.network.build_timeout, old_port,
len(self.new_port_list)))
- new_port = net_resources.DeletablePort(client=self.network_client,
+ new_port = net_resources.DeletablePort(ports_client=self.ports_client,
**self.new_port_list[0])
def check_new_nic():
@@ -609,12 +609,12 @@
self.check_public_network_connectivity(
should_connect=True, msg="before updating "
"admin_state_up of instance port to False")
- self.network_client.update_port(port_id, admin_state_up=False)
+ self.ports_client.update_port(port_id, admin_state_up=False)
self.check_public_network_connectivity(
should_connect=False, msg="after updating "
"admin_state_up of instance port to False",
should_check_floating_ip_status=False)
- self.network_client.update_port(port_id, admin_state_up=True)
+ self.ports_client.update_port(port_id, admin_state_up=True)
self.check_public_network_connectivity(
should_connect=True, msg="after updating "
"admin_state_up of instance port to True")
@@ -653,7 +653,7 @@
waiters.wait_for_server_termination(self.servers_client, server['id'])
# Assert the port still exists on the network but is unbound from
# the deleted server.
- port = self.network_client.show_port(port_id)['port']
+ port = self.ports_client.show_port(port_id)['port']
self.assertEqual(self.network['id'], port['network_id'])
self.assertEqual('', port['device_id'])
self.assertEqual('', port['device_owner'])
diff --git a/tempest/scenario/test_security_groups_basic_ops.py b/tempest/scenario/test_security_groups_basic_ops.py
index 3c11c22..d2a7ec6 100644
--- a/tempest/scenario/test_security_groups_basic_ops.py
+++ b/tempest/scenario/test_security_groups_basic_ops.py
@@ -250,6 +250,7 @@
name=name,
network_client=tenant.manager.network_client,
networks_client=tenant.manager.networks_client,
+ ports_client=tenant.manager.ports_client,
create_kwargs=create_kwargs)
self.assertEqual(
sorted([s['name'] for s in security_groups]),
@@ -514,7 +515,7 @@
port_id = self._list_ports(device_id=server_id)[0]['id']
# update port with new security group and check connectivity
- self.network_client.update_port(port_id, security_groups=[
+ self.ports_client.update_port(port_id, security_groups=[
new_tenant.security_groups['new_sg'].id])
self._check_connectivity(
access_point=access_point_ssh,
@@ -581,16 +582,16 @@
# Flip the port's port security and check connectivity
try:
- self.network_client.update_port(port_id,
- port_security_enabled=True,
- security_groups=[])
+ self.ports_client.update_port(port_id,
+ port_security_enabled=True,
+ security_groups=[])
self._check_connectivity(access_point=access_point_ssh,
ip=self._get_server_ip(server),
should_succeed=False)
- self.network_client.update_port(port_id,
- port_security_enabled=False,
- security_groups=[])
+ self.ports_client.update_port(port_id,
+ port_security_enabled=False,
+ security_groups=[])
self._check_connectivity(
access_point=access_point_ssh,
ip=self._get_server_ip(server))
diff --git a/tempest/scenario/test_server_basic_ops.py b/tempest/scenario/test_server_basic_ops.py
index e2f8adb..c55cff6 100644
--- a/tempest/scenario/test_server_basic_ops.py
+++ b/tempest/scenario/test_server_basic_ops.py
@@ -89,17 +89,10 @@
def verify_ssh(self):
if self.run_ssh:
# Obtain a floating IP
- self.floating_ip = (self.floating_ips_client.create_floating_ip()
- ['floating_ip'])
- self.addCleanup(self.delete_wrapper,
- self.floating_ips_client.delete_floating_ip,
- self.floating_ip['id'])
- # Attach a floating IP
- self.floating_ips_client.associate_floating_ip_to_server(
- self.floating_ip['ip'], self.instance['id'])
+ self.fip = self.create_floating_ip(self.instance)['ip']
# Check ssh
self.ssh_client = self.get_remote_client(
- server_or_ip=self.floating_ip['ip'],
+ server_or_ip=self.fip,
username=self.image_utils.ssh_user(self.image_ref),
private_key=self.keypair['private_key'])
@@ -110,12 +103,11 @@
def exec_cmd_and_verify_output():
cmd = 'curl ' + md_url
- floating_ip = self.floating_ip['ip']
result = self.ssh_client.exec_command(cmd)
if result:
msg = ('Failed while verifying metadata on server. Result '
- 'of command "%s" is NOT "%s".' % (cmd, floating_ip))
- self.assertEqual(floating_ip, result, msg)
+ 'of command "%s" is NOT "%s".' % (cmd, self.fip))
+ self.assertEqual(self.fip, result, msg)
return 'Verification is successful!'
if not test.call_until_true(exec_cmd_and_verify_output,
diff --git a/tempest/scenario/test_server_multinode.py b/tempest/scenario/test_server_multinode.py
new file mode 100644
index 0000000..ef78b4a
--- /dev/null
+++ b/tempest/scenario/test_server_multinode.py
@@ -0,0 +1,88 @@
+# 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_log import log as logging
+
+from tempest import config
+from tempest import exceptions
+from tempest.scenario import manager
+from tempest import test
+
+CONF = config.CONF
+
+LOG = logging.getLogger(__name__)
+
+
+class TestServerMultinode(manager.ScenarioTest):
+
+ """
+ This is a set of tests specific to multinode testing.
+
+ """
+ credentials = ['primary', 'admin']
+
+ @classmethod
+ def setup_clients(cls):
+ super(TestServerMultinode, cls).setup_clients()
+ # Use admin client by default
+ cls.manager = cls.admin_manager
+ # this is needed so that we can use the availability_zone:host
+ # scheduler hint, which is admin_only by default
+ cls.servers_client = cls.admin_manager.servers_client
+ super(TestServerMultinode, cls).resource_setup()
+
+ @test.idempotent_id('9cecbe35-b9d4-48da-a37e-7ce70aa43d30')
+ @test.attr(type='smoke')
+ @test.services('compute', 'network')
+ def test_schedule_to_all_nodes(self):
+ host_client = self.manager.hosts_client
+ hosts = host_client.list_hosts()['hosts']
+ hosts = [x for x in hosts if x['service'] == 'compute']
+
+ # ensure we have at least as many compute hosts as we expect
+ if len(hosts) < CONF.compute.min_compute_nodes:
+ raise exceptions.InvalidConfiguration(
+ "Host list %s is shorter than min_compute_nodes. "
+ "Did a compute worker not boot correctly?" % hosts)
+
+ # create 1 compute for each node, up to the min_compute_nodes
+ # threshold (so that things don't get crazy if you have 1000
+ # compute nodes but set min to 3).
+ 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)
+ server = self.servers_client.show_server(inst['id'])['server']
+ servers.append(server)
+
+ # make sure we really have the number of servers we think we should
+ self.assertEqual(
+ len(servers), CONF.compute.min_compute_nodes,
+ "Incorrect number of servers built %s" % servers)
+
+ # ensure that every server ended up on a different host
+ host_ids = [x['hostId'] for x in servers]
+ self.assertEqual(
+ len(set(host_ids)), len(servers),
+ "Incorrect number of distinct host_ids scheduled to %s" % servers)
diff --git a/tempest/scenario/test_shelve_instance.py b/tempest/scenario/test_shelve_instance.py
index bc80412..3b38888 100644
--- a/tempest/scenario/test_shelve_instance.py
+++ b/tempest/scenario/test_shelve_instance.py
@@ -79,15 +79,9 @@
create_kwargs=create_kwargs)
if CONF.compute.use_floatingip_for_ssh:
- floating_ip = (self.floating_ips_client.create_floating_ip()
- ['floating_ip'])
- self.addCleanup(self.delete_wrapper,
- self.floating_ips_client.delete_floating_ip,
- floating_ip['id'])
- self.floating_ips_client.associate_floating_ip_to_server(
- floating_ip['ip'], server['id'])
+ floating_ip = self.create_floating_ip(server)['ip']
timestamp = self.create_timestamp(
- floating_ip['ip'], private_key=keypair['private_key'])
+ floating_ip, private_key=keypair['private_key'])
else:
timestamp = self.create_timestamp(
server, private_key=keypair['private_key'])
@@ -97,7 +91,7 @@
# with the instance snapshot
self._shelve_then_unshelve_server(server)
if CONF.compute.use_floatingip_for_ssh:
- timestamp2 = self.get_timestamp(floating_ip['ip'],
+ timestamp2 = self.get_timestamp(floating_ip,
private_key=keypair['private_key'])
else:
timestamp2 = self.get_timestamp(server,
diff --git a/tempest/scenario/test_volume_boot_pattern.py b/tempest/scenario/test_volume_boot_pattern.py
index 678fcfc..414305d 100644
--- a/tempest/scenario/test_volume_boot_pattern.py
+++ b/tempest/scenario/test_volume_boot_pattern.py
@@ -95,32 +95,17 @@
vol_name = data_utils.rand_name('volume')
return self.create_volume(name=vol_name, snapshot_id=snap_id)
- def _ssh_to_server(self, server, keypair):
+ def _get_server_ip(self, server):
if CONF.compute.use_floatingip_for_ssh:
ip = self.create_floating_ip(server)['ip']
else:
ip = server
-
- return self.get_remote_client(ip, private_key=keypair['private_key'],
- log_console_of_servers=[server])
-
- def _get_content(self, ssh_client):
- return ssh_client.exec_command('cat /tmp/text')
-
- def _write_text(self, ssh_client):
- text = data_utils.rand_name('text')
- ssh_client.exec_command('echo "%s" > /tmp/text; sync' % (text))
-
- return self._get_content(ssh_client)
+ return ip
def _delete_server(self, server):
self.servers_client.delete_server(server['id'])
waiters.wait_for_server_termination(self.servers_client, server['id'])
- def _check_content_of_written_file(self, ssh_client, expected):
- actual = self._get_content(ssh_client)
- self.assertEqual(expected, actual)
-
@test.idempotent_id('557cd2c2-4eb8-4dce-98be-f86765ff311b')
@test.attr(type='smoke')
@test.services('compute', 'volume', 'image')
@@ -134,9 +119,9 @@
keypair, security_group)
# write content to volume on instance
- ssh_client_for_instance_1st = self._ssh_to_server(instance_1st,
- keypair)
- text = self._write_text(ssh_client_for_instance_1st)
+ ip_instance_1st = self._get_server_ip(instance_1st)
+ timestamp = self.create_timestamp(ip_instance_1st,
+ private_key=keypair['private_key'])
# delete instance
self._delete_server(instance_1st)
@@ -146,9 +131,10 @@
keypair, security_group)
# check the content of written file
- ssh_client_for_instance_2nd = self._ssh_to_server(instance_2nd,
- keypair)
- self._check_content_of_written_file(ssh_client_for_instance_2nd, text)
+ ip_instance_2nd = self._get_server_ip(instance_2nd)
+ timestamp2 = self.get_timestamp(ip_instance_2nd,
+ private_key=keypair['private_key'])
+ self.assertEqual(timestamp, timestamp2)
# snapshot a volume
snapshot = self._create_snapshot_from_volume(volume_origin['id'])
@@ -160,8 +146,10 @@
keypair, security_group))
# check the content of written file
- ssh_client = self._ssh_to_server(instance_from_snapshot, keypair)
- self._check_content_of_written_file(ssh_client, text)
+ ip_instance_from_snapshot = self._get_server_ip(instance_from_snapshot)
+ timestamp3 = self.get_timestamp(ip_instance_from_snapshot,
+ private_key=keypair['private_key'])
+ self.assertEqual(timestamp, timestamp3)
@test.idempotent_id('36c34c67-7b54-4b59-b188-02a2f458a63b')
@test.services('compute', 'volume', 'image')
diff --git a/tempest/services/identity/v2/json/identity_client.py b/tempest/services/identity/v2/json/identity_client.py
index f37bc08..1c1bfaa 100644
--- a/tempest/services/identity/v2/json/identity_client.py
+++ b/tempest/services/identity/v2/json/identity_client.py
@@ -19,7 +19,7 @@
class IdentityClient(service_client.ServiceClient):
api_version = "v2.0"
- def get_api_description(self):
+ def show_api_description(self):
"""Retrieves info about the v2.0 Identity API"""
url = ''
resp, body = self.get(url)
@@ -27,21 +27,6 @@
body = json.loads(body)
return service_client.ResponseBody(resp, body)
- def has_admin_extensions(self):
- """
- Returns True if the KSADM Admin Extensions are supported
- False otherwise
- """
- if hasattr(self, '_has_admin_extensions'):
- return self._has_admin_extensions
- # Try something that requires admin
- try:
- self.list_roles()
- self._has_admin_extensions = True
- except Exception:
- self._has_admin_extensions = False
- return self._has_admin_extensions
-
def create_role(self, name):
"""Create a role."""
post_body = {
@@ -53,7 +38,7 @@
body = json.loads(body)
return service_client.ResponseBody(resp, body)
- def get_role(self, role_id):
+ def show_role(self, role_id):
"""Get a role by its id."""
resp, body = self.get('OS-KSADM/roles/%s' % role_id)
self.expected_success(200, resp.status)
@@ -113,7 +98,7 @@
self.expected_success(204, resp.status)
return service_client.ResponseBody(resp, body)
- def get_tenant(self, tenant_id):
+ def show_tenant(self, tenant_id):
"""Get tenant details."""
resp, body = self.get('tenants/%s' % str(tenant_id))
self.expected_success(200, resp.status)
@@ -143,7 +128,7 @@
def update_tenant(self, tenant_id, **kwargs):
"""Updates a tenant."""
- body = self.get_tenant(tenant_id)['tenant']
+ body = self.show_tenant(tenant_id)['tenant']
name = kwargs.get('name', body['name'])
desc = kwargs.get('description', body['description'])
en = kwargs.get('enabled', body['enabled'])
@@ -184,7 +169,7 @@
body = json.loads(body)
return service_client.ResponseBody(resp, body)
- def get_user(self, user_id):
+ def show_user(self, user_id):
"""GET a user."""
resp, body = self.get("users/%s" % user_id)
self.expected_success(200, resp.status)
@@ -197,7 +182,7 @@
self.expected_success(204, resp.status)
return service_client.ResponseBody(resp, body)
- def get_users(self):
+ def list_users(self):
"""Get the list of users."""
resp, body = self.get("users")
self.expected_success(200, resp.status)
@@ -215,7 +200,7 @@
body = json.loads(body)
return service_client.ResponseBody(resp, body)
- def get_token(self, token_id):
+ def show_token(self, token_id):
"""Get token details."""
resp, body = self.get("tokens/%s" % token_id)
self.expected_success(200, resp.status)
@@ -228,7 +213,7 @@
self.expected_success(204, resp.status)
return service_client.ResponseBody(resp, body)
- def list_users_for_tenant(self, tenant_id):
+ def list_tenant_users(self, tenant_id):
"""List users for a Tenant."""
resp, body = self.get('/tenants/%s/users' % tenant_id)
self.expected_success(200, resp.status)
@@ -236,7 +221,7 @@
return service_client.ResponseBody(resp, body)
def get_user_by_username(self, tenant_id, username):
- users = self.list_users_for_tenant(tenant_id)['users']
+ users = self.list_tenant_users(tenant_id)['users']
for user in users:
if user['name'] == username:
return user
@@ -255,7 +240,7 @@
body = json.loads(body)
return service_client.ResponseBody(resp, body)
- def get_service(self, service_id):
+ def show_service(self, service_id):
"""Get Service."""
url = '/OS-KSADM/services/%s' % service_id
resp, body = self.get(url)
diff --git a/tempest/services/identity/v3/json/identity_client.py b/tempest/services/identity/v3/json/identity_client.py
index 3f27624..f7913d0 100644
--- a/tempest/services/identity/v3/json/identity_client.py
+++ b/tempest/services/identity/v3/json/identity_client.py
@@ -22,7 +22,7 @@
class IdentityV3Client(service_client.ServiceClient):
api_version = "v3"
- def get_api_description(self):
+ def show_api_description(self):
"""Retrieves info about the v3 Identity API"""
url = ''
resp, body = self.get(url)
@@ -54,7 +54,7 @@
def update_user(self, user_id, name, **kwargs):
"""Updates a user."""
- body = self.get_user(user_id)['user']
+ body = self.show_user(user_id)['user']
email = kwargs.get('email', body['email'])
en = kwargs.get('enabled', body['enabled'])
project_id = kwargs.get('project_id', body['project_id'])
@@ -99,7 +99,7 @@
body = json.loads(body)
return service_client.ResponseBody(resp, body)
- def get_users(self, params=None):
+ def list_users(self, params=None):
"""Get the list of users."""
url = 'users'
if params:
@@ -109,7 +109,7 @@
body = json.loads(body)
return service_client.ResponseBody(resp, body)
- def get_user(self, user_id):
+ def show_user(self, user_id):
"""GET a user."""
resp, body = self.get("users/%s" % user_id)
self.expected_success(200, resp.status)
@@ -191,7 +191,7 @@
body = json.loads(body)
return service_client.ResponseBody(resp, body)
- def get_role(self, role_id):
+ def show_role(self, role_id):
"""GET a Role."""
resp, body = self.get('roles/%s' % str(role_id))
self.expected_success(200, resp.status)
@@ -284,7 +284,7 @@
body = json.loads(body)
return service_client.ResponseBody(resp, body)
- def get_token(self, resp_token):
+ def show_token(self, resp_token):
"""Get token details."""
headers = {'X-Subject-Token': resp_token}
resp, body = self.get("auth/tokens", headers=headers)
diff --git a/tempest/services/identity/v3/json/service_client.py b/tempest/services/identity/v3/json/service_client.py
index 2acc3a8..7af6209 100644
--- a/tempest/services/identity/v3/json/service_client.py
+++ b/tempest/services/identity/v3/json/service_client.py
@@ -23,7 +23,7 @@
def update_service(self, service_id, **kwargs):
"""Updates a service."""
- body = self.get_service(service_id)['service']
+ body = self.show_service(service_id)['service']
name = kwargs.get('name', body['name'])
type = kwargs.get('type', body['type'])
desc = kwargs.get('description', body['description'])
@@ -38,7 +38,7 @@
body = json.loads(body)
return service_client.ResponseBody(resp, body)
- def get_service(self, service_id):
+ def show_service(self, service_id):
"""Get Service."""
url = 'services/%s' % service_id
resp, body = self.get(url)
diff --git a/tempest/services/network/json/network_client.py b/tempest/services/network/json/network_client.py
index 7821f37..d811c51 100644
--- a/tempest/services/network/json/network_client.py
+++ b/tempest/services/network/json/network_client.py
@@ -34,28 +34,6 @@
quotas
"""
- def create_port(self, **kwargs):
- uri = '/ports'
- post_data = {'port': kwargs}
- return self.create_resource(uri, post_data)
-
- def update_port(self, port_id, **kwargs):
- uri = '/ports/%s' % port_id
- post_data = {'port': kwargs}
- return self.update_resource(uri, post_data)
-
- def show_port(self, port_id, **fields):
- uri = '/ports/%s' % port_id
- return self.show_resource(uri, **fields)
-
- def delete_port(self, port_id):
- uri = '/ports/%s' % port_id
- return self.delete_resource(uri)
-
- def list_ports(self, **filters):
- uri = '/ports'
- return self.list_resources(uri, **filters)
-
def create_floatingip(self, **kwargs):
uri = '/floatingips'
post_data = {'floatingip': kwargs}
@@ -175,20 +153,22 @@
uri = '/ports'
return self.create_resource(uri, post_data)
- def wait_for_resource_deletion(self, resource_type, id):
+ def wait_for_resource_deletion(self, resource_type, id, client=None):
"""Waits for a resource to be deleted."""
start_time = int(time.time())
while True:
- if self.is_resource_deleted(resource_type, id):
+ if self.is_resource_deleted(resource_type, id, client=client):
return
if int(time.time()) - start_time >= self.build_timeout:
raise exceptions.TimeoutException
time.sleep(self.build_interval)
- def is_resource_deleted(self, resource_type, id):
+ def is_resource_deleted(self, resource_type, id, client=None):
+ if client is None:
+ client = self
method = 'show_' + resource_type
try:
- getattr(self, method)(id)
+ getattr(client, method)(id)
except AttributeError:
raise Exception("Unknown resource type %s " % resource_type)
except lib_exc.NotFound:
diff --git a/tempest/services/network/json/ports_client.py b/tempest/services/network/json/ports_client.py
new file mode 100644
index 0000000..d52d65e
--- /dev/null
+++ b/tempest/services/network/json/ports_client.py
@@ -0,0 +1,38 @@
+# 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 PortsClient(base.BaseNetworkClient):
+
+ def create_port(self, **kwargs):
+ uri = '/ports'
+ post_data = {'port': kwargs}
+ return self.create_resource(uri, post_data)
+
+ def update_port(self, port_id, **kwargs):
+ uri = '/ports/%s' % port_id
+ post_data = {'port': kwargs}
+ return self.update_resource(uri, post_data)
+
+ def show_port(self, port_id, **fields):
+ uri = '/ports/%s' % port_id
+ return self.show_resource(uri, **fields)
+
+ def delete_port(self, port_id):
+ uri = '/ports/%s' % port_id
+ return self.delete_resource(uri)
+
+ def list_ports(self, **filters):
+ uri = '/ports'
+ return self.list_resources(uri, **filters)
diff --git a/tempest/services/network/resources.py b/tempest/services/network/resources.py
index 16d9823..ae30312 100644
--- a/tempest/services/network/resources.py
+++ b/tempest/services/network/resources.py
@@ -44,6 +44,7 @@
self.network_client = kwargs.pop('network_client', None)
self.networks_client = kwargs.pop('networks_client', None)
self.subnets_client = kwargs.pop('subnets_client', None)
+ self.ports_client = kwargs.pop('ports_client', None)
super(DeletableResource, self).__init__(*args, **kwargs)
def __str__(self):
@@ -152,7 +153,7 @@
class DeletablePort(DeletableResource):
def delete(self):
- self.client.delete_port(self.id)
+ self.ports_client.delete_port(self.id)
class DeletableSecurityGroup(DeletableResource):
diff --git a/tempest/stress/cleanup.py b/tempest/stress/cleanup.py
index 1350d95..bac1984 100644
--- a/tempest/stress/cleanup.py
+++ b/tempest/stress/cleanup.py
@@ -68,7 +68,7 @@
except Exception:
pass
- users = admin_manager.identity_client.get_users()['users']
+ users = admin_manager.identity_client.list_users()['users']
LOG.info("Cleanup::remove %s users" % len(users))
for user in users:
if user['name'].startswith("stress_user"):
diff --git a/tempest/tests/cmd/test_tempest_init.py b/tempest/tests/cmd/test_tempest_init.py
index 1d60c67..1048a52 100644
--- a/tempest/tests/cmd/test_tempest_init.py
+++ b/tempest/tests/cmd/test_tempest_init.py
@@ -58,9 +58,11 @@
self.assertTrue(os.path.isfile(local_sample_conf_file))
self.assertGreater(os.path.getsize(local_sample_conf_file), 0)
- def test_create_working_dir_with_existing_local_dir(self):
+ def test_create_working_dir_with_existing_local_dir_non_empty(self):
fake_local_dir = self.useFixture(fixtures.TempDir())
fake_local_conf_dir = self.useFixture(fixtures.TempDir())
+ open("%s/foo" % fake_local_dir.path, 'w').close()
+
_init = init.TempestInit(None, None)
self.assertRaises(OSError,
_init.create_working_dir,
diff --git a/tempest/tests/common/test_dynamic_creds.py b/tempest/tests/common/test_dynamic_creds.py
index 59a5523..73e180e 100644
--- a/tempest/tests/common/test_dynamic_creds.py
+++ b/tempest/tests/common/test_dynamic_creds.py
@@ -376,7 +376,7 @@
'tempest.services.network.json.network_client.NetworkClient.'
'remove_router_interface_with_subnet_id')
return_values = ({'status': 200}, {'ports': []})
- port_list_mock = mock.patch.object(creds.network_admin_client,
+ port_list_mock = mock.patch.object(creds.ports_admin_client,
'list_ports',
return_value=return_values)