Merge "Use servers_client from tempest-lib"
diff --git a/doc/source/configuration.rst b/doc/source/configuration.rst
index 1b2b6d2..a16f3b7 100644
--- a/doc/source/configuration.rst
+++ b/doc/source/configuration.rst
@@ -9,16 +9,6 @@
config file which explains the purpose of each individual option. You can see
the sample config file here: :ref:`tempest-sampleconf`
-Lock Path
----------
-
-There are some tests and operations inside of tempest that need to be
-externally locked when running in parallel to prevent them from running at
-the same time. This is a mandatory step for configuring tempest and is still
-needed even when running serially. All that is needed to do this is:
-
- #. Set the lock_path option in the oslo_concurrency group
-
Auth/Credentials
----------------
diff --git a/tempest/api/compute/servers/test_server_personality.py b/tempest/api/compute/servers/test_server_personality.py
index 58d26d3..c948f8c 100644
--- a/tempest/api/compute/servers/test_server_personality.py
+++ b/tempest/api/compute/servers/test_server_personality.py
@@ -55,13 +55,14 @@
file_path = '/test.txt'
personality = [{'path': file_path,
'contents': base64.b64encode(file_contents)}]
- server = self.create_test_server(personality=personality,
- wait_until='ACTIVE',
- validatable=True)
+ created_server = self.create_test_server(personality=personality,
+ wait_until='ACTIVE',
+ validatable=True)
+ server = self.client.show_server(created_server['id'])['server']
if CONF.validation.run_validation:
linux_client = remote_client.RemoteClient(
self.get_server_ip(server),
- self.ssh_user, server['adminPass'],
+ self.ssh_user, created_server['adminPass'],
self.validation_resources['keypair']['private_key'])
self.assertEqual(file_contents,
linux_client.exec_command(
@@ -116,13 +117,14 @@
'path': path,
'contents': base64.b64encode(file_contents),
})
- server = self.create_test_server(personality=person,
- wait_until='ACTIVE',
- validatable=True)
+ created_server = self.create_test_server(personality=person,
+ wait_until='ACTIVE',
+ validatable=True)
+ server = self.client.show_server(created_server['id'])['server']
if CONF.validation.run_validation:
linux_client = remote_client.RemoteClient(
self.get_server_ip(server),
- self.ssh_user, server['adminPass'],
+ self.ssh_user, created_server['adminPass'],
self.validation_resources['keypair']['private_key'])
for i in person:
self.assertEqual(base64.b64decode(i['contents']),
diff --git a/tempest/api/identity/admin/v3/test_endpoints.py b/tempest/api/identity/admin/v3/test_endpoints.py
index 429e2e3..2ac832e 100644
--- a/tempest/api/identity/admin/v3/test_endpoints.py
+++ b/tempest/api/identity/admin/v3/test_endpoints.py
@@ -34,8 +34,8 @@
s_type = data_utils.rand_name('type')
s_description = data_utils.rand_name('description')
cls.service_data = (
- cls.service_client.create_service(name=s_name, type=s_type,
- description=s_description))
+ cls.services_client.create_service(name=s_name, type=s_type,
+ description=s_description))
cls.service_data = cls.service_data['service']
cls.service_id = cls.service_data['id']
cls.service_ids.append(cls.service_id)
@@ -56,7 +56,7 @@
for e in cls.setup_endpoints:
cls.client.delete_endpoint(e['id'])
for s in cls.service_ids:
- cls.service_client.delete_service(s)
+ cls.services_client.delete_service(s)
super(EndPointsTestJSON, cls).resource_cleanup()
@test.idempotent_id('c19ecf90-240e-4e23-9966-21cee3f6a618')
@@ -113,8 +113,8 @@
s_type = data_utils.rand_name('type')
s_description = data_utils.rand_name('description')
service2 = (
- self.service_client.create_service(name=s_name, type=s_type,
- description=s_description))
+ self.services_client.create_service(name=s_name, type=s_type,
+ description=s_description))
service2 = service2['service']
self.service_ids.append(service2['id'])
# Updating endpoint with new values
diff --git a/tempest/api/identity/admin/v3/test_endpoints_negative.py b/tempest/api/identity/admin/v3/test_endpoints_negative.py
index 8f9bf2a..372254f 100644
--- a/tempest/api/identity/admin/v3/test_endpoints_negative.py
+++ b/tempest/api/identity/admin/v3/test_endpoints_negative.py
@@ -37,8 +37,8 @@
s_type = data_utils.rand_name('type')
s_description = data_utils.rand_name('description')
cls.service_data = (
- cls.service_client.create_service(name=s_name, type=s_type,
- description=s_description)
+ cls.services_client.create_service(name=s_name, type=s_type,
+ description=s_description)
['service'])
cls.service_id = cls.service_data['id']
cls.service_ids.append(cls.service_id)
@@ -46,7 +46,7 @@
@classmethod
def resource_cleanup(cls):
for s in cls.service_ids:
- cls.service_client.delete_service(s)
+ cls.services_client.delete_service(s)
super(EndpointsNegativeTestJSON, cls).resource_cleanup()
@test.attr(type=['negative'])
diff --git a/tempest/api/identity/admin/v3/test_services.py b/tempest/api/identity/admin/v3/test_services.py
index d1595dd..c6e3df4 100644
--- a/tempest/api/identity/admin/v3/test_services.py
+++ b/tempest/api/identity/admin/v3/test_services.py
@@ -24,9 +24,9 @@
def _del_service(self, service_id):
# Used for deleting the services created in this class
- self.service_client.delete_service(service_id)
+ self.services_client.delete_service(service_id)
# Checking whether service is deleted successfully
- self.assertRaises(lib_exc.NotFound, self.service_client.show_service,
+ self.assertRaises(lib_exc.NotFound, self.services_client.show_service,
service_id)
@test.attr(type='smoke')
@@ -36,7 +36,7 @@
name = data_utils.rand_name('service')
serv_type = data_utils.rand_name('type')
desc = data_utils.rand_name('description')
- create_service = self.service_client.create_service(
+ create_service = self.services_client.create_service(
type=serv_type, name=name, description=desc)['service']
self.addCleanup(self._del_service, create_service['id'])
self.assertIsNotNone(create_service['id'])
@@ -49,14 +49,14 @@
s_id = create_service['id']
resp1_desc = create_service['description']
s_desc2 = data_utils.rand_name('desc2')
- update_service = self.service_client.update_service(
+ update_service = self.services_client.update_service(
s_id, description=s_desc2)['service']
resp2_desc = update_service['description']
self.assertNotEqual(resp1_desc, resp2_desc)
# Get service
- fetched_service = self.service_client.show_service(s_id)['service']
+ fetched_service = self.services_client.show_service(s_id)['service']
resp3_desc = fetched_service['description']
self.assertEqual(resp2_desc, resp3_desc)
@@ -67,9 +67,9 @@
# Create a service only with name and type
name = data_utils.rand_name('service')
serv_type = data_utils.rand_name('type')
- service = self.service_client.create_service(
+ service = self.services_client.create_service(
type=serv_type, name=name)['service']
- self.addCleanup(self.service_client.delete_service, service['id'])
+ self.addCleanup(self.services_client.delete_service, service['id'])
self.assertIn('id', service)
expected_data = {'name': name, 'type': serv_type}
self.assertDictContainsSubset(expected_data, service)
@@ -81,14 +81,14 @@
for _ in range(3):
name = data_utils.rand_name('service')
serv_type = data_utils.rand_name('type')
- create_service = self.service_client.create_service(
+ create_service = self.services_client.create_service(
type=serv_type, name=name)['service']
- self.addCleanup(self.service_client.delete_service,
+ self.addCleanup(self.services_client.delete_service,
create_service['id'])
service_ids.append(create_service['id'])
# List and Verify Services
- services = self.service_client.list_services()['services']
+ services = self.services_client.list_services()['services']
fetched_ids = [service['id'] for service in services]
found = [s for s in fetched_ids if s in service_ids]
self.assertEqual(len(found), len(service_ids))
diff --git a/tempest/api/identity/base.py b/tempest/api/identity/base.py
index 1a4c8bb..d98e3b1 100644
--- a/tempest/api/identity/base.py
+++ b/tempest/api/identity/base.py
@@ -144,7 +144,7 @@
cls.token = cls.os_adm.token_v3_client
cls.endpoints_client = cls.os_adm.endpoints_client
cls.region_client = cls.os_adm.region_client
- cls.service_client = cls.os_adm.service_client
+ cls.services_client = cls.os_adm.identity_services_client
cls.policy_client = cls.os_adm.policy_client
cls.creds_client = cls.os_adm.credentials_client
cls.groups_client = cls.os_adm.groups_client
diff --git a/tempest/api/network/admin/test_dhcp_agent_scheduler.py b/tempest/api/network/admin/test_dhcp_agent_scheduler.py
index 7692b56..f186b36 100644
--- a/tempest/api/network/admin/test_dhcp_agent_scheduler.py
+++ b/tempest/api/network/admin/test_dhcp_agent_scheduler.py
@@ -92,6 +92,6 @@
def _add_dhcp_agent_to_network(self, network_id, agent):
self.admin_client.add_dhcp_agent_to_network(agent['id'],
- network_id)
+ network_id=network_id)
self.assertTrue(self._check_network_in_dhcp_agent(
network_id, agent))
diff --git a/tempest/api/network/base.py b/tempest/api/network/base.py
index f1fd3e9..e155bd0 100644
--- a/tempest/api/network/base.py
+++ b/tempest/api/network/base.py
@@ -76,6 +76,7 @@
cls.ports_client = cls.os.ports_client
cls.quotas_client = cls.os.network_quotas_client
cls.floating_ips_client = cls.os.floating_ips_client
+ cls.security_groups_client = cls.os.security_groups_client
@classmethod
def resource_setup(cls):
diff --git a/tempest/api/network/base_security_groups.py b/tempest/api/network/base_security_groups.py
index 1cef2cc..1525e19 100644
--- a/tempest/api/network/base_security_groups.py
+++ b/tempest/api/network/base_security_groups.py
@@ -22,17 +22,18 @@
def _create_security_group(self):
# Create a security group
name = data_utils.rand_name('secgroup-')
- group_create_body = self.client.create_security_group(name=name)
+ group_create_body = (
+ self.security_groups_client.create_security_group(name=name))
self.addCleanup(self._delete_security_group,
group_create_body['security_group']['id'])
self.assertEqual(group_create_body['security_group']['name'], name)
return group_create_body, name
def _delete_security_group(self, secgroup_id):
- self.client.delete_security_group(secgroup_id)
+ self.security_groups_client.delete_security_group(secgroup_id)
# Asserting that the security group is not found in the list
# after deletion
- list_body = self.client.list_security_groups()
+ list_body = self.security_groups_client.list_security_groups()
secgroup_list = list()
for secgroup in list_body['security_groups']:
secgroup_list.append(secgroup['id'])
diff --git a/tempest/api/network/test_networks.py b/tempest/api/network/test_networks.py
index a266142..1c446ef 100644
--- a/tempest/api/network/test_networks.py
+++ b/tempest/api/network/test_networks.py
@@ -449,9 +449,9 @@
@test.idempotent_id('d4f9024d-1e28-4fc1-a6b1-25dbc6fa11e2')
def test_bulk_create_delete_network(self):
# Creates 2 networks in one request
- network_names = [data_utils.rand_name('network-'),
- data_utils.rand_name('network-')]
- body = self.client.create_bulk_network(network_names)
+ network_list = [{'name': data_utils.rand_name('network-')},
+ {'name': data_utils.rand_name('network-')}]
+ body = self.client.create_bulk_network(networks=network_list)
created_networks = body['networks']
self.addCleanup(self._delete_networks, created_networks)
# Asserting that the networks are found in the list after creation
@@ -486,7 +486,7 @@
}
subnets_list.append(p1)
del subnets_list[1]['name']
- body = self.client.create_bulk_subnet(subnets_list)
+ body = self.client.create_bulk_subnet(subnets=subnets_list)
created_subnets = body['subnets']
self.addCleanup(self._delete_subnets, created_subnets)
# Asserting that the subnets are found in the list after creation
@@ -512,7 +512,7 @@
}
port_list.append(p1)
del port_list[1]['name']
- body = self.client.create_bulk_port(port_list)
+ body = self.client.create_bulk_port(ports=port_list)
created_ports = body['ports']
self.addCleanup(self._delete_ports, created_ports)
# Asserting that the ports are found in the list after creation
diff --git a/tempest/api/network/test_ports.py b/tempest/api/network/test_ports.py
index 43da1c4..67f2c83 100644
--- a/tempest/api/network/test_ports.py
+++ b/tempest/api/network/test_ports.py
@@ -74,7 +74,7 @@
network2 = self.create_network(network_name=name)
network_list = [network1['id'], network2['id']]
port_list = [{'network_id': net_id} for net_id in network_list]
- body = self.client.create_bulk_port(port_list)
+ body = self.client.create_bulk_port(ports=port_list)
created_ports = body['ports']
port1 = created_ports[0]
port2 = created_ports[1]
@@ -250,17 +250,19 @@
fixed_ip_1 = [{'subnet_id': subnet_1['id']}]
security_groups_list = list()
+ sec_grps_client = self.security_groups_client
for name in security_groups_names:
- group_create_body = self.client.create_security_group(
+ group_create_body = sec_grps_client.create_security_group(
name=name)
- self.addCleanup(self.client.delete_security_group,
+ self.addCleanup(self.security_groups_client.delete_security_group,
group_create_body['security_group']['id'])
security_groups_list.append(group_create_body['security_group']
['id'])
# Create a port
sec_grp_name = data_utils.rand_name('secgroup')
- security_group = self.client.create_security_group(name=sec_grp_name)
- self.addCleanup(self.client.delete_security_group,
+ security_group = sec_grps_client.create_security_group(
+ name=sec_grp_name)
+ self.addCleanup(self.security_groups_client.delete_security_group,
security_group['security_group']['id'])
post_body = {
"name": data_utils.rand_name('port-'),
diff --git a/tempest/api/network/test_security_groups.py b/tempest/api/network/test_security_groups.py
index ccc5232..cf45328 100644
--- a/tempest/api/network/test_security_groups.py
+++ b/tempest/api/network/test_security_groups.py
@@ -71,7 +71,7 @@
@test.idempotent_id('e30abd17-fef9-4739-8617-dc26da88e686')
def test_list_security_groups(self):
# Verify the that security group belonging to tenant exist in list
- body = self.client.list_security_groups()
+ body = self.security_groups_client.list_security_groups()
security_groups = body['security_groups']
found = None
for n in security_groups:
@@ -86,7 +86,7 @@
group_create_body, name = self._create_security_group()
# List security groups and verify if created group is there in response
- list_body = self.client.list_security_groups()
+ list_body = self.security_groups_client.list_security_groups()
secgroup_list = list()
for secgroup in list_body['security_groups']:
secgroup_list.append(secgroup['id'])
@@ -94,7 +94,7 @@
# Update the security group
new_name = data_utils.rand_name('security-')
new_description = data_utils.rand_name('security-description')
- update_body = self.client.update_security_group(
+ update_body = self.security_groups_client.update_security_group(
group_create_body['security_group']['id'],
name=new_name,
description=new_description)
@@ -103,7 +103,7 @@
self.assertEqual(update_body['security_group']['description'],
new_description)
# Show details of the updated security group
- show_body = self.client.show_security_group(
+ show_body = self.security_groups_client.show_security_group(
group_create_body['security_group']['id'])
self.assertEqual(show_body['security_group']['name'], new_name)
self.assertEqual(show_body['security_group']['description'],
diff --git a/tempest/api/network/test_security_groups_negative.py b/tempest/api/network/test_security_groups_negative.py
index f80ea59..58e39e9 100644
--- a/tempest/api/network/test_security_groups_negative.py
+++ b/tempest/api/network/test_security_groups_negative.py
@@ -38,8 +38,9 @@
@test.idempotent_id('424fd5c3-9ddc-486a-b45f-39bf0c820fc6')
def test_show_non_existent_security_group(self):
non_exist_id = str(uuid.uuid4())
- self.assertRaises(lib_exc.NotFound, self.client.show_security_group,
- non_exist_id)
+ self.assertRaises(
+ lib_exc.NotFound, self.security_groups_client.show_security_group,
+ non_exist_id)
@test.attr(type=['negative'])
@test.idempotent_id('4c094c09-000b-4e41-8100-9617600c02a6')
@@ -54,7 +55,7 @@
def test_delete_non_existent_security_group(self):
non_exist_id = str(uuid.uuid4())
self.assertRaises(lib_exc.NotFound,
- self.client.delete_security_group,
+ self.security_groups_client.delete_security_group,
non_exist_id
)
@@ -163,7 +164,7 @@
# Create security group named 'default', it should be failed.
name = 'default'
self.assertRaises(lib_exc.Conflict,
- self.client.create_security_group,
+ self.security_groups_client.create_security_group,
name=name)
@test.attr(type=['negative'])
diff --git a/tempest/api/telemetry/base.py b/tempest/api/telemetry/base.py
index 8b617ac..bbf6db2 100644
--- a/tempest/api/telemetry/base.py
+++ b/tempest/api/telemetry/base.py
@@ -75,10 +75,11 @@
return body
@classmethod
- def create_image(cls, client):
- body = client.create_image(
- name=data_utils.rand_name('image'), container_format='bare',
- disk_format='raw', visibility='private')
+ def create_image(cls, client, **kwargs):
+ body = client.create_image(name=data_utils.rand_name('image'),
+ container_format='bare',
+ disk_format='raw',
+ **kwargs)
# TODO(jswarren) Move ['image'] up to initial body value assignment
# once both v1 and v2 glance clients include the full response
# object.
diff --git a/tempest/api/telemetry/test_telemetry_notification_api.py b/tempest/api/telemetry/test_telemetry_notification_api.py
index 7511505..a575125 100644
--- a/tempest/api/telemetry/test_telemetry_notification_api.py
+++ b/tempest/api/telemetry/test_telemetry_notification_api.py
@@ -39,7 +39,7 @@
@testtools.skipIf(not CONF.image_feature_enabled.api_v1,
"Glance api v1 is disabled")
def test_check_glance_v1_notifications(self):
- body = self.create_image(self.image_client)
+ body = self.create_image(self.image_client, is_public=False)
self.image_client.update_image(body['id'], data='data')
query = 'resource', 'eq', body['id']
@@ -55,7 +55,7 @@
@testtools.skipIf(not CONF.image_feature_enabled.api_v2,
"Glance api v2 is disabled")
def test_check_glance_v2_notifications(self):
- body = self.create_image(self.image_client_v2)
+ body = self.create_image(self.image_client_v2, visibility='private')
self.image_client_v2.store_image_file(body['id'], "file")
self.image_client_v2.show_image_file(body['id'])
diff --git a/tempest/api/volume/admin/test_multi_backend.py b/tempest/api/volume/admin/test_multi_backend.py
index 6d2aaea..8e43b00 100644
--- a/tempest/api/volume/admin/test_multi_backend.py
+++ b/tempest/api/volume/admin/test_multi_backend.py
@@ -71,7 +71,7 @@
else:
extra_specs = {spec_key_without_prefix: backend_name_key}
self.type = self.volume_types_client.create_volume_type(
- type_name, extra_specs=extra_specs)['volume_type']
+ name=type_name, extra_specs=extra_specs)['volume_type']
self.volume_type_id_list.append(self.type['id'])
params = {self.name_field: vol_name, 'volume_type': type_name}
diff --git a/tempest/api/volume/admin/test_volume_types.py b/tempest/api/volume/admin/test_volume_types.py
index 2d9019a..acb591d 100644
--- a/tempest/api/volume/admin/test_volume_types.py
+++ b/tempest/api/volume/admin/test_volume_types.py
@@ -32,7 +32,7 @@
@test.idempotent_id('9d9b28e3-1b2e-4483-a2cc-24aa0ea1de54')
def test_volume_type_list(self):
- # List Volume types.
+ # List volume types.
body = self.volume_types_client.list_volume_types()['volume_types']
self.assertIsInstance(body, list)
@@ -50,7 +50,7 @@
for i in range(2):
vol_type_name = data_utils.rand_name("volume-type")
vol_type = self.volume_types_client.create_volume_type(
- vol_type_name,
+ name=vol_type_name,
extra_specs=extra_specs)['volume_type']
volume_types.append(vol_type)
self.addCleanup(self._delete_volume_type, vol_type['id'])
@@ -97,7 +97,7 @@
extra_specs = {"storage_protocol": proto,
"vendor_name": vendor}
body = self.volume_types_client.create_volume_type(
- name,
+ name=name,
extra_specs=extra_specs)['volume_type']
self.assertIn('id', body)
self.addCleanup(self._delete_volume_type, body['id'])
@@ -125,7 +125,8 @@
provider = "LuksEncryptor"
control_location = "front-end"
name = data_utils.rand_name("volume-type")
- body = self.volume_types_client.create_volume_type(name)['volume_type']
+ body = self.volume_types_client.create_volume_type(
+ name=name)['volume_type']
self.addCleanup(self._delete_volume_type, body['id'])
# Create encryption type
diff --git a/tempest/api/volume/admin/test_volume_types_extra_specs.py b/tempest/api/volume/admin/test_volume_types_extra_specs.py
index bec803c..502cd86 100644
--- a/tempest/api/volume/admin/test_volume_types_extra_specs.py
+++ b/tempest/api/volume/admin/test_volume_types_extra_specs.py
@@ -25,7 +25,7 @@
super(VolumeTypesExtraSpecsV2Test, cls).resource_setup()
vol_type_name = data_utils.rand_name('Volume-type')
cls.volume_type = cls.volume_types_client.create_volume_type(
- vol_type_name)['volume_type']
+ name=vol_type_name)['volume_type']
@classmethod
def resource_cleanup(cls):
diff --git a/tempest/api/volume/admin/test_volume_types_extra_specs_negative.py b/tempest/api/volume/admin/test_volume_types_extra_specs_negative.py
index 040ef53..6483af3 100644
--- a/tempest/api/volume/admin/test_volume_types_extra_specs_negative.py
+++ b/tempest/api/volume/admin/test_volume_types_extra_specs_negative.py
@@ -30,7 +30,7 @@
vol_type_name = data_utils.rand_name('Volume-type')
cls.extra_specs = {"spec1": "val1"}
cls.volume_type = cls.volume_types_client.create_volume_type(
- vol_type_name,
+ name=vol_type_name,
extra_specs=cls.extra_specs)['volume_type']
@classmethod
@@ -70,7 +70,7 @@
def test_update_multiple_extra_spec(self):
# Should not update volume type extra specs with multiple specs as
# body.
- extra_spec = {"spec1": "val2", 'spec2': 'val1'}
+ extra_spec = {"spec1": "val2", "spec2": "val1"}
self.assertRaises(
lib_exc.BadRequest,
self.volume_types_client.update_volume_type_extra_specs,
@@ -101,7 +101,7 @@
self.assertRaises(
lib_exc.BadRequest,
self.volume_types_client.create_volume_type_extra_specs,
- self.volume_type['id'], ['invalid'])
+ self.volume_type['id'], extra_specs=['invalid'])
@test.idempotent_id('031cda8b-7d23-4246-8bf6-bbe73fd67074')
def test_delete_nonexistent_volume_type_id(self):
diff --git a/tempest/api/volume/admin/test_volume_types_negative.py b/tempest/api/volume/admin/test_volume_types_negative.py
index 2694b63..bc32fc9 100644
--- a/tempest/api/volume/admin/test_volume_types_negative.py
+++ b/tempest/api/volume/admin/test_volume_types_negative.py
@@ -36,7 +36,7 @@
def test_create_with_empty_name(self):
# Should not be able to create volume type with an empty name.
self.assertRaises(lib_exc.BadRequest,
- self.volume_types_client.create_volume_type, '')
+ self.volume_types_client.create_volume_type, name='')
@test.idempotent_id('994610d6-0476-4018-a644-a2602ef5d4aa')
def test_get_nonexistent_type_id(self):
diff --git a/tempest/api/volume/test_qos.py b/tempest/api/volume/test_qos.py
index 2f7c3df..722a39a 100644
--- a/tempest/api/volume/test_qos.py
+++ b/tempest/api/volume/test_qos.py
@@ -53,7 +53,7 @@
def _create_test_volume_type(self):
vol_type_name = utils.rand_name("volume-type")
vol_type = self.volume_types_client.create_volume_type(
- vol_type_name)['volume_type']
+ name=vol_type_name)['volume_type']
self.addCleanup(self.volume_types_client.delete_volume_type,
vol_type['id'])
return vol_type
diff --git a/tempest/clients.py b/tempest/clients.py
index 774df35..8564c64 100644
--- a/tempest/clients.py
+++ b/tempest/clients.py
@@ -103,8 +103,8 @@
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 as ServiceV3Client
+from tempest.services.identity.v3.json.services_client import \
+ ServicesClient as IdentityServicesV3Client
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 \
@@ -119,6 +119,8 @@
from tempest.services.network.json.ports_client import PortsClient
from tempest.services.network.json.quotas_client import QuotasClient \
as NetworkQuotasClient
+from tempest.services.network.json.security_groups_client import \
+ SecurityGroupsClient
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
@@ -266,6 +268,14 @@
build_interval=CONF.network.build_interval,
build_timeout=CONF.network.build_timeout,
**self.default_params)
+ self.security_groups_client = SecurityGroupsClient(
+ 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,
@@ -448,7 +458,8 @@
**params_v3)
self.endpoints_client = EndPointV3Client(self.auth_provider,
**params_v3)
- self.service_client = ServiceV3Client(self.auth_provider, **params_v3)
+ self.identity_services_client = IdentityServicesV3Client(
+ 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,
diff --git a/tempest/cmd/cleanup_service.py b/tempest/cmd/cleanup_service.py
index c2f3885..2aeb5b1 100644
--- a/tempest/cmd/cleanup_service.py
+++ b/tempest/cmd/cleanup_service.py
@@ -389,6 +389,7 @@
self.floating_ips_client = manager.floating_ips_client
self.metering_labels_client = manager.metering_labels_client
self.metering_label_rules_client = manager.metering_label_rules_client
+ self.security_groups_client = manager.security_groups_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)):
@@ -654,7 +655,7 @@
class NetworkSecGroupService(NetworkService):
def list(self):
- client = self.client
+ client = self.security_groups_client
filter = self.tenant_filter
# cannot delete default sec group so never show it.
secgroups = [secgroup for secgroup in
diff --git a/tempest/cmd/run_stress.py b/tempest/cmd/run_stress.py
index f99e5d9..5c6f200 100644
--- a/tempest/cmd/run_stress.py
+++ b/tempest/cmd/run_stress.py
@@ -81,6 +81,9 @@
def take_action(self, pa):
return action(pa)
+ def get_description(self):
+ return 'Run tempest stress tests'
+
def add_arguments(parser):
parser.add_argument('-d', '--duration', default=300, type=int,
diff --git a/tempest/common/dynamic_creds.py b/tempest/common/dynamic_creds.py
index c52aa41..5bbc93c 100644
--- a/tempest/common/dynamic_creds.py
+++ b/tempest/common/dynamic_creds.py
@@ -62,7 +62,8 @@
self.network_admin_client,
self.networks_admin_client,
self.subnets_admin_client,
- self.ports_admin_client) = self._get_admin_clients()
+ self.ports_admin_client,
+ self.security_groups_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
@@ -87,10 +88,11 @@
if self.identity_version == 'v2':
return (os.identity_client, os.tenants_client, os.roles_client,
os.network_client, os.networks_client, os.subnets_client,
- os.ports_client)
+ os.ports_client, os.security_groups_client)
else:
return (os.identity_v3_client, None, None, os.network_client,
- os.networks_client, os.subnets_client, os.ports_client)
+ os.networks_client, os.subnets_client, os.ports_client,
+ os.security_groups_client)
def _create_creds(self, suffix="", admin=False, roles=None):
"""Create random credentials under the following schema.
@@ -303,13 +305,13 @@
network_name)
def _cleanup_default_secgroup(self, tenant):
- net_client = self.network_admin_client
- resp_body = net_client.list_security_groups(tenant_id=tenant,
+ nsg_client = self.security_groups_admin_client
+ resp_body = nsg_client.list_security_groups(tenant_id=tenant,
name="default")
secgroups_to_delete = resp_body['security_groups']
for secgroup in secgroups_to_delete:
try:
- net_client.delete_security_group(secgroup['id'])
+ nsg_client.delete_security_group(secgroup['id'])
except lib_exc.NotFound:
LOG.warn('Security group %s, id %s not found for clean-up' %
(secgroup['name'], secgroup['id']))
diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py
index c2159c3..8a00c65 100644
--- a/tempest/scenario/manager.py
+++ b/tempest/scenario/manager.py
@@ -67,6 +67,7 @@
cls.ports_client = cls.manager.ports_client
cls.subnets_client = cls.manager.subnets_client
cls.floating_ips_client = cls.manager.floating_ips_client
+ cls.security_groups_client = cls.manager.security_groups_client
# Heat client
cls.orchestration_client = cls.manager.orchestration_client
@@ -196,7 +197,7 @@
# to pass to create_port
if 'security_groups' in kwargs:
security_groups =\
- clients.network_client.list_security_groups(
+ clients.security_groups_client.list_security_groups(
).get('security_groups')
sec_dict = dict([(s['name'], s['id'])
for s in security_groups])
@@ -941,18 +942,22 @@
1)
def _create_security_group(self, client=None, tenant_id=None,
- namestart='secgroup-smoke'):
+ namestart='secgroup-smoke',
+ security_groups_client=None):
if client is None:
client = self.network_client
+ if security_groups_client is None:
+ security_groups_client = self.security_groups_client
if tenant_id is None:
- tenant_id = client.tenant_id
- secgroup = self._create_empty_security_group(namestart=namestart,
- client=client,
- tenant_id=tenant_id)
+ tenant_id = security_groups_client.tenant_id
+ secgroup = self._create_empty_security_group(
+ namestart=namestart, client=security_groups_client,
+ tenant_id=tenant_id)
# Add rules to the security group
- rules = self._create_loginable_secgroup_rule(client=client,
- secgroup=secgroup)
+ rules = self._create_loginable_secgroup_rule(
+ client=client, secgroup=secgroup,
+ security_groups_client=security_groups_client)
for rule in rules:
self.assertEqual(tenant_id, rule.tenant_id)
self.assertEqual(secgroup.id, rule.security_group_id)
@@ -970,7 +975,7 @@
:returns: DeletableSecurityGroup -- containing the secgroup created
"""
if client is None:
- client = self.network_client
+ client = self.security_groups_client
if not tenant_id:
tenant_id = client.tenant_id
sg_name = data_utils.rand_name(namestart)
@@ -995,7 +1000,7 @@
:returns: DeletableSecurityGroup -- default secgroup for given tenant
"""
if client is None:
- client = self.network_client
+ client = self.security_groups_client
if not tenant_id:
tenant_id = client.tenant_id
sgs = [
@@ -1008,7 +1013,8 @@
**sgs[0])
def _create_security_group_rule(self, secgroup=None, client=None,
- tenant_id=None, **kwargs):
+ tenant_id=None,
+ security_groups_client=None, **kwargs):
"""Create a rule from a dictionary of rule parameters.
Create a rule in a secgroup. if secgroup not defined will search for
@@ -1028,11 +1034,13 @@
"""
if client is None:
client = self.network_client
+ if security_groups_client is None:
+ security_groups_client = self.security_groups_client
if not tenant_id:
- tenant_id = client.tenant_id
+ tenant_id = security_groups_client.tenant_id
if secgroup is None:
- secgroup = self._default_security_group(client=client,
- tenant_id=tenant_id)
+ secgroup = self._default_security_group(
+ client=security_groups_client, tenant_id=tenant_id)
ruleset = dict(security_group_id=secgroup.id,
tenant_id=secgroup.tenant_id)
@@ -1049,7 +1057,8 @@
return sg_rule
- def _create_loginable_secgroup_rule(self, client=None, secgroup=None):
+ def _create_loginable_secgroup_rule(self, client=None, secgroup=None,
+ security_groups_client=None):
"""Create loginable security group rule
These rules are intended to permit inbound ssh and icmp
@@ -1060,6 +1069,8 @@
if client is None:
client = self.network_client
+ if security_groups_client is None:
+ security_groups_client = self.security_groups_client
rules = []
rulesets = [
dict(
@@ -1083,7 +1094,9 @@
ruleset['direction'] = r_direction
try:
sg_rule = self._create_security_group_rule(
- client=client, secgroup=secgroup, **ruleset)
+ client=client, secgroup=secgroup,
+ security_groups_client=security_groups_client,
+ **ruleset)
except lib_exc.Conflict as ex:
# if rule already exist - skip rule and continue
msg = 'Security group rule already exists'
@@ -1365,7 +1378,7 @@
randomized_name = data_utils.rand_name('scenario-type-' + name)
LOG.debug("Creating a volume type: %s", randomized_name)
body = client.create_volume_type(
- randomized_name)['volume_type']
+ name=randomized_name)['volume_type']
self.assertIn('id', body)
self.addCleanup(client.delete_volume_type, body['id'])
return body
diff --git a/tempest/scenario/test_security_groups_basic_ops.py b/tempest/scenario/test_security_groups_basic_ops.py
index 4e5a1e0..783b740 100644
--- a/tempest/scenario/test_security_groups_basic_ops.py
+++ b/tempest/scenario/test_security_groups_basic_ops.py
@@ -176,14 +176,14 @@
access_sg = self._create_empty_security_group(
namestart='secgroup_access-',
tenant_id=tenant.creds.tenant_id,
- client=tenant.manager.network_client
+ client=tenant.manager.security_groups_client
)
# don't use default secgroup since it allows in-tenant traffic
def_sg = self._create_empty_security_group(
namestart='secgroup_general-',
tenant_id=tenant.creds.tenant_id,
- client=tenant.manager.network_client
+ client=tenant.manager.security_groups_client
)
tenant.security_groups.update(access=access_sg, default=def_sg)
ssh_rule = dict(
@@ -464,7 +464,7 @@
new_sg = self._create_empty_security_group(
namestart='secgroup_new-',
tenant_id=new_tenant.creds.tenant_id,
- client=new_tenant.manager.network_client)
+ client=new_tenant.manager.security_groups_client)
icmp_rule = dict(
protocol='icmp',
direction='ingress',
diff --git a/tempest/services/identity/v3/json/service_client.py b/tempest/services/identity/v3/json/services_client.py
similarity index 97%
rename from tempest/services/identity/v3/json/service_client.py
rename to tempest/services/identity/v3/json/services_client.py
index 3dbfe5e..dd65f1d 100644
--- a/tempest/services/identity/v3/json/service_client.py
+++ b/tempest/services/identity/v3/json/services_client.py
@@ -22,7 +22,7 @@
from tempest.common import service_client
-class ServiceClient(service_client.ServiceClient):
+class ServicesClient(service_client.ServiceClient):
api_version = "v3"
def update_service(self, service_id, **kwargs):
diff --git a/tempest/services/network/json/network_client.py b/tempest/services/network/json/network_client.py
index 6e3b0fe..24a95e0 100644
--- a/tempest/services/network/json/network_client.py
+++ b/tempest/services/network/json/network_client.py
@@ -35,28 +35,6 @@
quotas
"""
- def create_security_group(self, **kwargs):
- uri = '/security-groups'
- post_data = {'security_group': kwargs}
- return self.create_resource(uri, post_data)
-
- def update_security_group(self, security_group_id, **kwargs):
- uri = '/security-groups/%s' % security_group_id
- post_data = {'security_group': kwargs}
- return self.update_resource(uri, post_data)
-
- def show_security_group(self, security_group_id, **fields):
- uri = '/security-groups/%s' % security_group_id
- return self.show_resource(uri, **fields)
-
- def delete_security_group(self, security_group_id):
- uri = '/security-groups/%s' % security_group_id
- return self.delete_resource(uri)
-
- def list_security_groups(self, **filters):
- uri = '/security-groups'
- return self.list_resources(uri, **filters)
-
def create_security_group_rule(self, **kwargs):
uri = '/security-group-rules'
post_data = {'security_group_rule': kwargs}
@@ -82,21 +60,32 @@
uri = '/extensions'
return self.list_resources(uri, **filters)
- def create_bulk_network(self, names):
- network_list = [{'name': name} for name in names]
- post_data = {'networks': network_list}
+ def create_bulk_network(self, **kwargs):
+ """create bulk network
+
+ Available params: see http://developer.openstack.org/
+ api-ref-networking-v2.html#bulkCreateNetwork
+ """
uri = '/networks'
- return self.create_resource(uri, post_data)
+ return self.create_resource(uri, kwargs)
- def create_bulk_subnet(self, subnet_list):
- post_data = {'subnets': subnet_list}
+ def create_bulk_subnet(self, **kwargs):
+ """create bulk subnet
+
+ Available params: see http://developer.openstack.org/
+ api-ref-networking-v2.html#bulkCreateSubnet
+ """
uri = '/subnets'
- return self.create_resource(uri, post_data)
+ return self.create_resource(uri, kwargs)
- def create_bulk_port(self, port_list):
- post_data = {'ports': port_list}
+ def create_bulk_port(self, **kwargs):
+ """create bulk port
+
+ Available params: see http://developer.openstack.org/
+ api-ref-networking-v2.html#bulkCreatePorts
+ """
uri = '/ports'
- return self.create_resource(uri, post_data)
+ return self.create_resource(uri, kwargs)
def wait_for_resource_deletion(self, resource_type, id, client=None):
"""Waits for a resource to be deleted."""
@@ -313,10 +302,13 @@
}
return self.update_resource(uri, put_body)
- def add_dhcp_agent_to_network(self, agent_id, network_id):
- post_body = {'network_id': network_id}
+ def add_dhcp_agent_to_network(self, agent_id, **kwargs):
+ # TODO(piyush): Current api-site doesn't contain this API description.
+ # After fixing the api-site, we need to fix here also for putting the
+ # link to api-site.
+ # LP: https://bugs.launchpad.net/openstack-api-site/+bug/1526212
uri = '/agents/%s/dhcp-networks' % agent_id
- return self.create_resource(uri, post_body)
+ return self.create_resource(uri, kwargs)
def list_subnetpools(self, **filters):
uri = '/subnetpools'
diff --git a/tempest/services/network/json/security_groups_client.py b/tempest/services/network/json/security_groups_client.py
new file mode 100644
index 0000000..a60d2a6
--- /dev/null
+++ b/tempest/services/network/json/security_groups_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 SecurityGroupsClient(base.BaseNetworkClient):
+
+ def create_security_group(self, **kwargs):
+ uri = '/security-groups'
+ post_data = {'security_group': kwargs}
+ return self.create_resource(uri, post_data)
+
+ def update_security_group(self, security_group_id, **kwargs):
+ uri = '/security-groups/%s' % security_group_id
+ post_data = {'security_group': kwargs}
+ return self.update_resource(uri, post_data)
+
+ def show_security_group(self, security_group_id, **fields):
+ uri = '/security-groups/%s' % security_group_id
+ return self.show_resource(uri, **fields)
+
+ def delete_security_group(self, security_group_id):
+ uri = '/security-groups/%s' % security_group_id
+ return self.delete_resource(uri)
+
+ def list_security_groups(self, **filters):
+ uri = '/security-groups'
+ return self.list_resources(uri, **filters)
diff --git a/tempest/services/volume/base/admin/base_types_client.py b/tempest/services/volume/base/admin/base_types_client.py
index de6ea8a..867273e 100644
--- a/tempest/services/volume/base/admin/base_types_client.py
+++ b/tempest/services/volume/base/admin/base_types_client.py
@@ -47,10 +47,10 @@
"""Returns the primary type of resource this client works with."""
return 'volume-type/encryption-type'
- def list_volume_types(self, params=None):
+ def list_volume_types(self, **params):
"""List all the volume_types created."""
url = 'types'
- if params is not None:
+ if params:
url += '?%s' % urllib.urlencode(params)
resp, body = self.get(url)
@@ -66,19 +66,13 @@
self.expected_success(200, resp.status)
return service_client.ResponseBody(resp, body)
- def create_volume_type(self, name, **kwargs):
- """Creates a new Volume_type.
+ def create_volume_type(self, **kwargs):
+ """Create volume type.
- name(Required): Name of volume_type.
- Following optional keyword arguments are accepted:
- extra_specs: A dictionary of values to be used as extra_specs.
+ Available params: see http://developer.openstack.org/
+ api-ref-blockstorage-v2.html#createVolumeType
"""
- post_body = {
- 'name': name,
- 'extra_specs': kwargs.get('extra_specs'),
- }
-
- post_body = json.dumps({'volume_type': post_body})
+ post_body = json.dumps({'volume_type': kwargs})
resp, body = self.post('types', post_body)
body = json.loads(body)
self.expected_success(200, resp.status)
@@ -90,10 +84,17 @@
self.expected_success(202, resp.status)
return service_client.ResponseBody(resp, body)
- def list_volume_types_extra_specs(self, vol_type_id, params=None):
- """List all the volume_types extra specs created."""
+ def list_volume_types_extra_specs(self, vol_type_id, **params):
+ """List all the volume_types extra specs created.
+
+ TODO: Current api-site doesn't contain this API description.
+ After fixing the api-site, we need to fix here also for putting
+ the link to api-site.
+
+
+ """
url = 'types/%s/extra_specs' % str(vol_type_id)
- if params is not None:
+ if params:
url += '?%s' % urllib.urlencode(params)
resp, body = self.get(url)
@@ -101,23 +102,23 @@
self.expected_success(200, resp.status)
return service_client.ResponseBody(resp, body)
- def show_volume_type_extra_specs(self, vol_type_id, extra_spec_name):
+ def show_volume_type_extra_specs(self, vol_type_id, extra_specs_name):
"""Returns the details of a single volume_type extra spec."""
url = "types/%s/extra_specs/%s" % (str(vol_type_id),
- str(extra_spec_name))
+ str(extra_specs_name))
resp, body = self.get(url)
body = json.loads(body)
self.expected_success(200, resp.status)
return service_client.ResponseBody(resp, body)
- def create_volume_type_extra_specs(self, vol_type_id, extra_spec):
+ def create_volume_type_extra_specs(self, vol_type_id, extra_specs):
"""Creates a new Volume_type extra spec.
vol_type_id: Id of volume_type.
extra_specs: A dictionary of values to be used as extra_specs.
"""
url = "types/%s/extra_specs" % str(vol_type_id)
- post_body = json.dumps({'extra_specs': extra_spec})
+ post_body = json.dumps({'extra_specs': extra_specs})
resp, body = self.post(url, post_body)
body = json.loads(body)
self.expected_success(200, resp.status)
@@ -131,7 +132,7 @@
return service_client.ResponseBody(resp, body)
def update_volume_type_extra_specs(self, vol_type_id, extra_spec_name,
- extra_spec):
+ extra_specs):
"""Update a volume_type extra spec.
vol_type_id: Id of volume_type.
@@ -141,7 +142,7 @@
"""
url = "types/%s/extra_specs/%s" % (str(vol_type_id),
str(extra_spec_name))
- put_body = json.dumps(extra_spec)
+ put_body = json.dumps(extra_specs)
resp, body = self.put(url, put_body)
body = json.loads(body)
self.expected_success(200, resp.status)
@@ -159,18 +160,14 @@
return service_client.ResponseBody(resp, body)
def create_encryption_type(self, vol_type_id, **kwargs):
- """Create a new encryption type for the specified volume type.
+ """Create encryption type.
- vol_type_id: Id of volume_type.
- provider: Class providing encryption support.
- cipher: Encryption algorithm/mode to use.
- key_size: Size of the encryption key, in bits.
- control_location: Notional service where encryption is performed.
+ TODO: Current api-site doesn't contain this API description.
+ After fixing the api-site, we need to fix here also for putting
+ the link to api-site.
"""
url = "/types/%s/encryption" % str(vol_type_id)
- post_body = {}
- post_body.update(kwargs)
- post_body = json.dumps({'encryption': post_body})
+ post_body = json.dumps({'encryption': kwargs})
resp, body = self.post(url, post_body)
body = json.loads(body)
self.expected_success(200, resp.status)
diff --git a/tempest/tests/common/test_dynamic_creds.py b/tempest/tests/common/test_dynamic_creds.py
index d520985..a55e556 100644
--- a/tempest/tests/common/test_dynamic_creds.py
+++ b/tempest/tests/common/test_dynamic_creds.py
@@ -396,15 +396,15 @@
port_list_mock.start()
secgroup_list_mock = mock.patch.object(
- creds.network_admin_client,
+ creds.security_groups_admin_client,
'list_security_groups',
side_effect=side_effect)
secgroup_list_mock.start()
return_values = (fake_http.fake_httplib({}, status=204), {})
remove_secgroup_mock = self.patch(
- 'tempest.services.network.json.network_client.'
- 'NetworkClient.delete', return_value=return_values)
+ 'tempest.services.network.json.security_groups_client.'
+ 'SecurityGroupsClient.delete', return_value=return_values)
creds.clear_creds()
# Verify default security group delete
calls = remove_secgroup_mock.mock_calls
diff --git a/tempest/tests/common/test_service_clients.py b/tempest/tests/common/test_service_clients.py
index a357df3..daeb0c0 100644
--- a/tempest/tests/common/test_service_clients.py
+++ b/tempest/tests/common/test_service_clients.py
@@ -28,7 +28,7 @@
identity_v3_identity_client
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.identity.v3.json import services_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
@@ -120,7 +120,7 @@
identity_v3_identity_client.IdentityV3Client,
policy_client.PolicyClient,
region_client.RegionClient,
- service_client.ServiceClient,
+ services_client.ServicesClient,
images_client.ImagesClient,
images_v2_client.ImagesClientV2
]