Merge "Fix some inconsistency in docstrings"
diff --git a/tempest/api/compute/servers/test_servers.py b/tempest/api/compute/servers/test_servers.py
index d2fb652..8e2fbf1 100644
--- a/tempest/api/compute/servers/test_servers.py
+++ b/tempest/api/compute/servers/test_servers.py
@@ -71,9 +71,10 @@
server = self.client.show_server(server['id'])['server']
self.assertEqual(key_name, server['key_name'])
- def _update_server_name(self, server_id, status):
+ def _update_server_name(self, server_id, status, prefix_name='server'):
# The server name should be changed to the the provided value
- new_name = data_utils.rand_name('server')
+ new_name = data_utils.rand_name(prefix_name)
+
# Update the server with a new name
self.client.update_server(server_id,
name=new_name)
@@ -88,8 +89,9 @@
def test_update_server_name(self):
# The server name should be changed to the the provided value
server = self.create_test_server(wait_until='ACTIVE')
-
- self._update_server_name(server['id'], 'ACTIVE')
+ # Update instance name with non-ASCII characters
+ prefix_name = u'\u00CD\u00F1st\u00E1\u00F1c\u00E9'
+ self._update_server_name(server['id'], 'ACTIVE', prefix_name)
@test.idempotent_id('6ac19cb1-27a3-40ec-b350-810bdc04c08e')
def test_update_server_name_in_stop_state(self):
@@ -97,7 +99,11 @@
server = self.create_test_server(wait_until='ACTIVE')
self.client.stop_server(server['id'])
waiters.wait_for_server_status(self.client, server['id'], 'SHUTOFF')
- updated_server = self._update_server_name(server['id'], 'SHUTOFF')
+ # Update instance name with non-ASCII characters
+ prefix_name = u'\u00CD\u00F1st\u00E1\u00F1c\u00E9'
+ updated_server = self._update_server_name(server['id'],
+ 'SHUTOFF',
+ prefix_name)
self.assertNotIn('progress', updated_server)
@test.idempotent_id('89b90870-bc13-4b73-96af-f9d4f2b70077')
diff --git a/tempest/api/identity/admin/v3/test_groups.py b/tempest/api/identity/admin/v3/test_groups.py
index d5af4b4..82e4ec8 100644
--- a/tempest/api/identity/admin/v3/test_groups.py
+++ b/tempest/api/identity/admin/v3/test_groups.py
@@ -25,7 +25,7 @@
name = data_utils.rand_name('Group')
description = data_utils.rand_name('Description')
group = self.groups_client.create_group(
- name, description=description)['group']
+ name=name, description=description)['group']
self.addCleanup(self.groups_client.delete_group, group['id'])
self.assertEqual(group['name'], name)
self.assertEqual(group['description'], description)
@@ -37,7 +37,7 @@
self.assertEqual(updated_group['name'], new_name)
self.assertEqual(updated_group['description'], new_desc)
- new_group = self.groups_client.get_group(group['id'])['group']
+ new_group = self.groups_client.show_group(group['id'])['group']
self.assertEqual(group['id'], new_group['id'])
self.assertEqual(new_name, new_group['name'])
self.assertEqual(new_desc, new_group['description'])
@@ -46,7 +46,7 @@
@test.idempotent_id('1598521a-2f36-4606-8df9-30772bd51339')
def test_group_users_add_list_delete(self):
name = data_utils.rand_name('Group')
- group = self.groups_client.create_group(name)['group']
+ group = self.groups_client.create_group(name=name)['group']
self.addCleanup(self.groups_client.delete_group, group['id'])
# add user into group
users = []
@@ -77,7 +77,7 @@
groups = []
for i in range(2):
name = data_utils.rand_name('Group')
- group = self.groups_client.create_group(name)['group']
+ group = self.groups_client.create_group(name=name)['group']
groups.append(group)
self.addCleanup(self.groups_client.delete_group, group['id'])
self.groups_client.add_group_user(group['id'], user['id'])
@@ -95,7 +95,7 @@
name = data_utils.rand_name('Group')
description = data_utils.rand_name('Description')
group = self.groups_client.create_group(
- name, description=description)['group']
+ name=name, description=description)['group']
self.addCleanup(self.groups_client.delete_group, group['id'])
group_ids.append(group['id'])
# List and Verify Groups
diff --git a/tempest/api/identity/admin/v3/test_roles.py b/tempest/api/identity/admin/v3/test_roles.py
index d5350a1..3be2643 100644
--- a/tempest/api/identity/admin/v3/test_roles.py
+++ b/tempest/api/identity/admin/v3/test_roles.py
@@ -40,7 +40,7 @@
description=data_utils.rand_name('project-desc'),
domain_id=cls.domain['id'])['project']
cls.group_body = cls.groups_client.create_group(
- data_utils.rand_name('Group'), project_id=cls.project['id'],
+ name=data_utils.rand_name('Group'), project_id=cls.project['id'],
domain_id=cls.domain['id'])['group']
cls.user_body = cls.client.create_user(
u_name, description=u_desc, password=cls.u_password,
diff --git a/tempest/api/image/admin/v2/test_images.py b/tempest/api/image/admin/v2/test_images.py
index 01838b6..b171da3 100644
--- a/tempest/api/image/admin/v2/test_images.py
+++ b/tempest/api/image/admin/v2/test_images.py
@@ -49,12 +49,12 @@
body = self.client.show_image(image_id)
self.assertEqual("deactivated", body['status'])
# non-admin user unable to download deactivated image
- self.assertRaises(lib_exc.Forbidden, self.client.load_image_file,
+ self.assertRaises(lib_exc.Forbidden, self.client.show_image_file,
image_id)
# reactivate image
self.admin_client.reactivate_image(image_id)
body = self.client.show_image(image_id)
self.assertEqual("active", body['status'])
# non-admin user able to download image after reactivation by admin
- body = self.client.load_image_file(image_id)
+ body = self.client.show_image_file(image_id)
self.assertEqual(content, body.data)
diff --git a/tempest/api/image/v2/test_images.py b/tempest/api/image/v2/test_images.py
index 936eadf..2e6c268 100644
--- a/tempest/api/image/v2/test_images.py
+++ b/tempest/api/image/v2/test_images.py
@@ -72,7 +72,7 @@
self.assertEqual(1024, body.get('size'))
# Now try get image file
- body = self.client.load_image_file(image_id)
+ body = self.client.show_image_file(image_id)
self.assertEqual(file_content, body.data)
@test.attr(type='smoke')
diff --git a/tempest/api/image/v2/test_images_member.py b/tempest/api/image/v2/test_images_member.py
index d68ceff..98ff64b 100644
--- a/tempest/api/image/v2/test_images_member.py
+++ b/tempest/api/image/v2/test_images_member.py
@@ -20,14 +20,14 @@
def test_image_share_accept(self):
image_id = self._create_image()
member = self.os_img_client.add_image_member(image_id,
- self.alt_tenant_id)
+ member=self.alt_tenant_id)
self.assertEqual(member['member_id'], self.alt_tenant_id)
self.assertEqual(member['image_id'], image_id)
self.assertEqual(member['status'], 'pending')
self.assertNotIn(image_id, self._list_image_ids_as_alt())
self.alt_img_client.update_image_member(image_id,
self.alt_tenant_id,
- {'status': 'accepted'})
+ status='accepted')
self.assertIn(image_id, self._list_image_ids_as_alt())
body = self.os_img_client.list_image_members(image_id)
members = body['members']
@@ -41,24 +41,24 @@
def test_image_share_reject(self):
image_id = self._create_image()
member = self.os_img_client.add_image_member(image_id,
- self.alt_tenant_id)
+ member=self.alt_tenant_id)
self.assertEqual(member['member_id'], self.alt_tenant_id)
self.assertEqual(member['image_id'], image_id)
self.assertEqual(member['status'], 'pending')
self.assertNotIn(image_id, self._list_image_ids_as_alt())
self.alt_img_client.update_image_member(image_id,
self.alt_tenant_id,
- {'status': 'rejected'})
+ status='rejected')
self.assertNotIn(image_id, self._list_image_ids_as_alt())
@test.idempotent_id('a6ee18b9-4378-465e-9ad9-9a6de58a3287')
def test_get_image_member(self):
image_id = self._create_image()
self.os_img_client.add_image_member(image_id,
- self.alt_tenant_id)
+ member=self.alt_tenant_id)
self.alt_img_client.update_image_member(image_id,
self.alt_tenant_id,
- {'status': 'accepted'})
+ status='accepted')
self.assertIn(image_id, self._list_image_ids_as_alt())
member = self.os_img_client.show_image_member(image_id,
@@ -71,10 +71,10 @@
def test_remove_image_member(self):
image_id = self._create_image()
self.os_img_client.add_image_member(image_id,
- self.alt_tenant_id)
+ member=self.alt_tenant_id)
self.alt_img_client.update_image_member(image_id,
self.alt_tenant_id,
- {'status': 'accepted'})
+ status='accepted')
self.assertIn(image_id, self._list_image_ids_as_alt())
self.os_img_client.delete_image_member(image_id, self.alt_tenant_id)
@@ -94,14 +94,14 @@
def test_get_private_image(self):
image_id = self._create_image()
member = self.os_img_client.add_image_member(image_id,
- self.alt_tenant_id)
+ member=self.alt_tenant_id)
self.assertEqual(member['member_id'], self.alt_tenant_id)
self.assertEqual(member['image_id'], image_id)
self.assertEqual(member['status'], 'pending')
self.assertNotIn(image_id, self._list_image_ids_as_alt())
self.alt_img_client.update_image_member(image_id,
self.alt_tenant_id,
- {'status': 'accepted'})
+ status='accepted')
self.assertIn(image_id, self._list_image_ids_as_alt())
self.os_img_client.delete_image_member(image_id, self.alt_tenant_id)
self.assertNotIn(image_id, self._list_image_ids_as_alt())
diff --git a/tempest/api/image/v2/test_images_member_negative.py b/tempest/api/image/v2/test_images_member_negative.py
index ae8913c..d5ea291 100644
--- a/tempest/api/image/v2/test_images_member_negative.py
+++ b/tempest/api/image/v2/test_images_member_negative.py
@@ -23,22 +23,22 @@
def test_image_share_invalid_status(self):
image_id = self._create_image()
member = self.os_img_client.add_image_member(image_id,
- self.alt_tenant_id)
+ member=self.alt_tenant_id)
self.assertEqual(member['status'], 'pending')
self.assertRaises(lib_exc.BadRequest,
self.alt_img_client.update_image_member,
image_id, self.alt_tenant_id,
- {'status': 'notavalidstatus'})
+ status='notavalidstatus')
@test.attr(type=['negative'])
@test.idempotent_id('27002f74-109e-4a37-acd0-f91cd4597967')
def test_image_share_owner_cannot_accept(self):
image_id = self._create_image()
member = self.os_img_client.add_image_member(image_id,
- self.alt_tenant_id)
+ member=self.alt_tenant_id)
self.assertEqual(member['status'], 'pending')
self.assertNotIn(image_id, self._list_image_ids_as_alt())
self.assertRaises(lib_exc.Forbidden,
self.os_img_client.update_image_member,
- image_id, self.alt_tenant_id, {'status': 'accepted'})
+ image_id, self.alt_tenant_id, status='accepted')
self.assertNotIn(image_id, self._list_image_ids_as_alt())
diff --git a/tempest/api/image/v2/test_images_metadefs_namespaces.py b/tempest/api/image/v2/test_images_metadefs_namespaces.py
index d089c84..efb7b8b 100644
--- a/tempest/api/image/v2/test_images_metadefs_namespaces.py
+++ b/tempest/api/image/v2/test_images_metadefs_namespaces.py
@@ -29,42 +29,42 @@
resource_name = body['resource_types'][0]['name']
name = [{'name': resource_name}]
namespace_name = data_utils.rand_name('namespace')
- # create the metadef namespaces
- body = self.client.create_namespaces(namespace=namespace_name,
- visibility='public',
- description='Tempest',
- display_name=namespace_name,
- resource_type_associations=name,
- protected=True)
+ # create the metadef namespace
+ body = self.client.create_namespace(namespace=namespace_name,
+ visibility='public',
+ description='Tempest',
+ display_name=namespace_name,
+ resource_type_associations=name,
+ protected=True)
self.addCleanup(self._cleanup_namespace, namespace_name)
- # get namespaces details
- body = self.client.show_namespaces(namespace_name)
+ # get namespace details
+ body = self.client.show_namespace(namespace_name)
self.assertEqual(namespace_name, body['namespace'])
self.assertEqual('public', body['visibility'])
# unable to delete protected namespace
- self.assertRaises(lib_exc.Forbidden, self.client.delete_namespaces,
+ self.assertRaises(lib_exc.Forbidden, self.client.delete_namespace,
namespace_name)
# update the visibility to private and protected to False
- body = self.client.update_namespaces(namespace=namespace_name,
- description='Tempest',
- visibility='private',
- display_name=namespace_name,
- protected=False)
+ body = self.client.update_namespace(namespace=namespace_name,
+ description='Tempest',
+ visibility='private',
+ display_name=namespace_name,
+ protected=False)
self.assertEqual('private', body['visibility'])
self.assertEqual(False, body['protected'])
# now able to delete the non-protected namespace
- self.client.delete_namespaces(namespace_name)
+ self.client.delete_namespace(namespace_name)
def _cleanup_namespace(self, namespace_name):
# this is used to cleanup the resources
try:
- body = self.client.show_namespaces(namespace_name)
+ body = self.client.show_namespace(namespace_name)
self.assertEqual(namespace_name, body['namespace'])
- body = self.client.update_namespaces(namespace=namespace_name,
- description='Tempest',
- visibility='private',
- display_name=namespace_name,
- protected=False)
- self.client.delete_namespaces(namespace_name)
+ body = self.client.update_namespace(namespace=namespace_name,
+ description='Tempest',
+ visibility='private',
+ display_name=namespace_name,
+ protected=False)
+ self.client.delete_namespace(namespace_name)
except lib_exc.NotFound:
pass
diff --git a/tempest/api/network/test_dhcp_ipv6.py b/tempest/api/network/test_dhcp_ipv6.py
index ceb7906..74c1d51 100644
--- a/tempest/api/network/test_dhcp_ipv6.py
+++ b/tempest/api/network/test_dhcp_ipv6.py
@@ -126,7 +126,7 @@
):
kwargs = {'ipv6_ra_mode': ra_mode,
'ipv6_address_mode': add_mode}
- kwargs = {k: v for k, v in six.iteritems(kwargs) if v}
+ kwargs = dict((k, v) for k, v in six.iteritems(kwargs) if v)
real_ip, eui_ip = self._get_ips_from_subnet(**kwargs)
self._clean_network()
self.assertEqual(eui_ip, real_ip,
@@ -269,7 +269,7 @@
):
kwargs = {'ipv6_ra_mode': ra_mode,
'ipv6_address_mode': add_mode}
- kwargs = {k: v for k, v in six.iteritems(kwargs) if v}
+ kwargs = dict((k, v) for k, v in six.iteritems(kwargs) if v)
subnet = self.create_subnet(self.network, **kwargs)
port = self.create_port(self.network)
port_ip = next(iter(port['fixed_ips']), None)['ip_address']
@@ -291,7 +291,7 @@
):
kwargs = {'ipv6_ra_mode': ra_mode,
'ipv6_address_mode': add_mode}
- kwargs = {k: v for k, v in six.iteritems(kwargs) if v}
+ kwargs = dict((k, v) for k, v in six.iteritems(kwargs) if v)
subnet = self.create_subnet(self.network, **kwargs)
ip_range = netaddr.IPRange(subnet["allocation_pools"][0]["start"],
subnet["allocation_pools"][0]["end"])
@@ -366,7 +366,7 @@
):
kwargs = {'ipv6_ra_mode': ra_mode,
'ipv6_address_mode': add_mode}
- kwargs = {k: v for k, v in six.iteritems(kwargs) if v}
+ kwargs = dict((k, v) for k, v in six.iteritems(kwargs) if v)
subnet, port = self._create_subnet_router(kwargs)
port_ip = next(iter(port['fixed_ips']), None)['ip_address']
self._clean_network()
diff --git a/tempest/api/telemetry/test_telemetry_notification_api.py b/tempest/api/telemetry/test_telemetry_notification_api.py
index 31eff9d..7511505 100644
--- a/tempest/api/telemetry/test_telemetry_notification_api.py
+++ b/tempest/api/telemetry/test_telemetry_notification_api.py
@@ -58,7 +58,7 @@
body = self.create_image(self.image_client_v2)
self.image_client_v2.store_image_file(body['id'], "file")
- self.image_client_v2.load_image_file(body['id'])
+ self.image_client_v2.show_image_file(body['id'])
query = 'resource', 'eq', body['id']
diff --git a/tempest/api/volume/admin/test_multi_backend.py b/tempest/api/volume/admin/test_multi_backend.py
index 4337922..6d2aaea 100644
--- a/tempest/api/volume/admin/test_multi_backend.py
+++ b/tempest/api/volume/admin/test_multi_backend.py
@@ -11,7 +11,7 @@
# under the License.
from oslo_log import log as logging
-
+import six
from tempest.api.volume import base
from tempest.common.utils import data_utils
from tempest import config
@@ -34,9 +34,14 @@
@classmethod
def resource_setup(cls):
super(VolumeMultiBackendV2Test, cls).resource_setup()
-
- cls.backend1_name = CONF.volume.backend1_name
- cls.backend2_name = CONF.volume.backend2_name
+ # support 2 backends names, deprecated_for_removal.
+ # keep support 2 backend names, in case they are not empty
+ if CONF.volume.backend1_name and CONF.volume.backend2_name:
+ cls.backend_names = {CONF.volume.backend1_name,
+ CONF.volume.backend2_name}
+ else:
+ # read backend name from a list .
+ cls.backend_names = set(CONF.volume.backend_names)
cls.name_field = cls.special_fields['name_field']
cls.volume_type_id_list = []
@@ -44,15 +49,15 @@
cls.volume_id_list_without_prefix = []
# Volume/Type creation (uses volume_backend_name)
- cls._create_type_and_volume(cls.backend1_name, False)
- # Volume/Type creation (uses capabilities:volume_backend_name)
- cls._create_type_and_volume(cls.backend1_name, True)
-
- if cls.backend1_name != cls.backend2_name:
- # Volume/Type creation (uses backend2_name)
- cls._create_type_and_volume(cls.backend2_name, False)
+ # It is not allowed to create the same backend name twice
+ if len(cls.backend_names) < 2:
+ raise cls.skipException("Requires at least two different "
+ "backend names")
+ for backend_name in cls.backend_names:
+ # Volume/Type creation (uses backend_name)
+ cls._create_type_and_volume(backend_name, False)
# Volume/Type creation (uses capabilities:volume_backend_name)
- cls._create_type_and_volume(cls.backend2_name, True)
+ cls._create_type_and_volume(backend_name, True)
@classmethod
def _create_type_and_volume(self, backend_name_key, with_prefix):
@@ -104,32 +109,28 @@
@test.idempotent_id('c1a41f3f-9dad-493e-9f09-3ff197d477cc')
def test_backend_name_reporting(self):
# get volume id which created by type without prefix
- volume_id = self.volume_id_list_without_prefix[0]
- self._test_backend_name_reporting_by_volume_id(volume_id)
+ for volume_id in self.volume_id_list_without_prefix:
+ self._test_backend_name_reporting_by_volume_id(volume_id)
@test.idempotent_id('f38e647f-ab42-4a31-a2e7-ca86a6485215')
def test_backend_name_reporting_with_prefix(self):
# get volume id which created by type with prefix
- volume_id = self.volume_id_list_with_prefix[0]
- self._test_backend_name_reporting_by_volume_id(volume_id)
+ for volume_id in self.volume_id_list_with_prefix:
+ self._test_backend_name_reporting_by_volume_id(volume_id)
@test.idempotent_id('46435ab1-a0af-4401-8373-f14e66b0dd58')
def test_backend_name_distinction(self):
- if self.backend1_name == self.backend2_name:
- raise self.skipException("backends configured with same name")
- # get volume id which created by type without prefix
- volume1_id = self.volume_id_list_without_prefix[0]
- volume2_id = self.volume_id_list_without_prefix[1]
- self._test_backend_name_distinction(volume1_id, volume2_id)
+ # get volume ids which created by type without prefix
+ self._test_backend_name_distinction(self.volume_id_list_without_prefix)
@test.idempotent_id('4236305b-b65a-4bfc-a9d2-69cb5b2bf2ed')
def test_backend_name_distinction_with_prefix(self):
- if self.backend1_name == self.backend2_name:
- raise self.skipException("backends configured with same name")
- # get volume id which created by type without prefix
- volume1_id = self.volume_id_list_with_prefix[0]
- volume2_id = self.volume_id_list_with_prefix[1]
- self._test_backend_name_distinction(volume1_id, volume2_id)
+ # get volume ids which created by type without prefix
+ self._test_backend_name_distinction(self.volume_id_list_with_prefix)
+
+ def _get_volume_host(self, volume_id):
+ return self.admin_volume_client.show_volume(
+ volume_id)['volume']['os-vol-host-attr:host']
def _test_backend_name_reporting_by_volume_id(self, volume_id):
# this test checks if os-vol-attr:host is populated correctly after
@@ -143,19 +144,16 @@
volume_id)
self.assertTrue(len(volume1_host.split("@")) > 1, msg)
- def _test_backend_name_distinction(self, volume1_id, volume2_id):
- # this test checks that the two volumes created at setUp don't
+ def _test_backend_name_distinction(self, volume_id_list):
+ # this test checks that the volumes created at setUp don't
# belong to the same backend (if they are, than the
# volume backend distinction is not working properly)
- volume = self.admin_volume_client.show_volume(volume1_id)['volume']
- volume1_host = volume['os-vol-host-attr:host']
-
- volume = self.admin_volume_client.show_volume(volume2_id)['volume']
- volume2_host = volume['os-vol-host-attr:host']
-
- msg = ("volumes %s and %s were created in the same backend" %
- (volume1_id, volume2_id))
- self.assertNotEqual(volume1_host, volume2_host, msg)
+ volume_hosts = [self._get_volume_host(volume) for volume in
+ volume_id_list]
+ # assert that volumes are each created on separate hosts:
+ msg = ("volumes %s were created in the same backend" % ", "
+ .join(volume_hosts))
+ six.assertCountEqual(self, volume_hosts, set(volume_hosts), msg)
class VolumeMultiBackendV1Test(VolumeMultiBackendV2Test):
diff --git a/tempest/api_schema/response/compute/v2_1/quota_classes.py b/tempest/api_schema/response/compute/v2_1/quota_classes.py
deleted file mode 100644
index a0cdaf5..0000000
--- a/tempest/api_schema/response/compute/v2_1/quota_classes.py
+++ /dev/null
@@ -1,31 +0,0 @@
-# Copyright 2014 IBM Corporation.
-# All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-import copy
-
-from tempest.api_schema.response.compute.v2_1 import quotas
-
-# NOTE(mriedem): os-quota-class-sets responses are the same as os-quota-sets
-# except for the key in the response body is quota_class_set instead of
-# quota_set, so update this copy of the schema from os-quota-sets.
-get_quota_class_set = copy.deepcopy(quotas.get_quota_set)
-get_quota_class_set['response_body']['properties']['quota_class_set'] = (
- get_quota_class_set['response_body']['properties'].pop('quota_set'))
-get_quota_class_set['response_body']['required'] = ['quota_class_set']
-
-update_quota_class_set = copy.deepcopy(quotas.update_quota_set)
-update_quota_class_set['response_body']['properties']['quota_class_set'] = (
- update_quota_class_set['response_body']['properties'].pop('quota_set'))
-update_quota_class_set['response_body']['required'] = ['quota_class_set']
diff --git a/tempest/api_schema/response/compute/v2_1/quotas.py b/tempest/api_schema/response/compute/v2_1/quotas.py
deleted file mode 100644
index 7953983..0000000
--- a/tempest/api_schema/response/compute/v2_1/quotas.py
+++ /dev/null
@@ -1,65 +0,0 @@
-# Copyright 2014 NEC Corporation. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-import copy
-
-update_quota_set = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'quota_set': {
- 'type': 'object',
- 'properties': {
- 'instances': {'type': 'integer'},
- 'cores': {'type': 'integer'},
- 'ram': {'type': 'integer'},
- 'floating_ips': {'type': 'integer'},
- 'fixed_ips': {'type': 'integer'},
- 'metadata_items': {'type': 'integer'},
- 'key_pairs': {'type': 'integer'},
- 'security_groups': {'type': 'integer'},
- 'security_group_rules': {'type': 'integer'},
- 'server_group_members': {'type': 'integer'},
- 'server_groups': {'type': 'integer'},
- 'injected_files': {'type': 'integer'},
- 'injected_file_content_bytes': {'type': 'integer'},
- 'injected_file_path_bytes': {'type': 'integer'}
- },
- 'additionalProperties': False,
- # NOTE: server_group_members and server_groups are represented
- # when enabling quota_server_group extension. So they should
- # not be required.
- 'required': ['instances', 'cores', 'ram',
- 'floating_ips', 'fixed_ips',
- 'metadata_items', 'key_pairs',
- 'security_groups', 'security_group_rules',
- 'injected_files', 'injected_file_content_bytes',
- 'injected_file_path_bytes']
- }
- },
- 'additionalProperties': False,
- 'required': ['quota_set']
- }
-}
-
-get_quota_set = copy.deepcopy(update_quota_set)
-get_quota_set['response_body']['properties']['quota_set']['properties'][
- 'id'] = {'type': 'string'}
-get_quota_set['response_body']['properties']['quota_set']['required'].extend([
- 'id'])
-
-delete_quota = {
- 'status_code': [202]
-}
diff --git a/tempest/api_schema/response/compute/v2_1/security_group_default_rule.py b/tempest/api_schema/response/compute/v2_1/security_group_default_rule.py
deleted file mode 100644
index 2ec2826..0000000
--- a/tempest/api_schema/response/compute/v2_1/security_group_default_rule.py
+++ /dev/null
@@ -1,65 +0,0 @@
-# Copyright 2014 NEC Corporation. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-common_security_group_default_rule_info = {
- 'type': 'object',
- 'properties': {
- 'from_port': {'type': 'integer'},
- 'id': {'type': 'integer'},
- 'ip_protocol': {'type': 'string'},
- 'ip_range': {
- 'type': 'object',
- 'properties': {
- 'cidr': {'type': 'string'}
- },
- 'additionalProperties': False,
- 'required': ['cidr'],
- },
- 'to_port': {'type': 'integer'},
- },
- 'additionalProperties': False,
- 'required': ['from_port', 'id', 'ip_protocol', 'ip_range', 'to_port'],
-}
-
-create_get_security_group_default_rule = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'security_group_default_rule':
- common_security_group_default_rule_info
- },
- 'additionalProperties': False,
- 'required': ['security_group_default_rule']
- }
-}
-
-delete_security_group_default_rule = {
- 'status_code': [204]
-}
-
-list_security_group_default_rules = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'security_group_default_rules': {
- 'type': 'array',
- 'items': common_security_group_default_rule_info
- }
- },
- 'additionalProperties': False,
- 'required': ['security_group_default_rules']
- }
-}
diff --git a/tempest/api_schema/response/compute/v2_1/services.py b/tempest/api_schema/response/compute/v2_1/services.py
deleted file mode 100644
index ddef7b2..0000000
--- a/tempest/api_schema/response/compute/v2_1/services.py
+++ /dev/null
@@ -1,65 +0,0 @@
-# Copyright 2014 NEC Corporation. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-list_services = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'services': {
- 'type': 'array',
- 'items': {
- 'type': 'object',
- 'properties': {
- 'id': {'type': ['integer', 'string'],
- 'pattern': '^[a-zA-Z!]*@[0-9]+$'},
- 'zone': {'type': 'string'},
- 'host': {'type': 'string'},
- 'state': {'type': 'string'},
- 'binary': {'type': 'string'},
- 'status': {'type': 'string'},
- 'updated_at': {'type': ['string', 'null']},
- 'disabled_reason': {'type': ['string', 'null']}
- },
- 'additionalProperties': False,
- 'required': ['id', 'zone', 'host', 'state', 'binary',
- 'status', 'updated_at', 'disabled_reason']
- }
- }
- },
- 'additionalProperties': False,
- 'required': ['services']
- }
-}
-
-enable_disable_service = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'service': {
- 'type': 'object',
- 'properties': {
- 'status': {'type': 'string'},
- 'binary': {'type': 'string'},
- 'host': {'type': 'string'}
- },
- 'additionalProperties': False,
- 'required': ['status', 'binary', 'host']
- }
- },
- 'additionalProperties': False,
- 'required': ['service']
- }
-}
diff --git a/tempest/api_schema/response/compute/v2_1/snapshots.py b/tempest/api_schema/response/compute/v2_1/snapshots.py
deleted file mode 100644
index 01a524b..0000000
--- a/tempest/api_schema/response/compute/v2_1/snapshots.py
+++ /dev/null
@@ -1,61 +0,0 @@
-# Copyright 2015 Fujitsu(fnst) Corporation
-# All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-common_snapshot_info = {
- 'type': 'object',
- 'properties': {
- 'id': {'type': 'string'},
- 'volumeId': {'type': 'string'},
- 'status': {'type': 'string'},
- 'size': {'type': 'integer'},
- 'createdAt': {'type': 'string'},
- 'displayName': {'type': ['string', 'null']},
- 'displayDescription': {'type': ['string', 'null']}
- },
- 'additionalProperties': False,
- 'required': ['id', 'volumeId', 'status', 'size',
- 'createdAt', 'displayName', 'displayDescription']
-}
-
-create_get_snapshot = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'snapshot': common_snapshot_info
- },
- 'additionalProperties': False,
- 'required': ['snapshot']
- }
-}
-
-list_snapshots = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'snapshots': {
- 'type': 'array',
- 'items': common_snapshot_info
- }
- },
- 'additionalProperties': False,
- 'required': ['snapshots']
- }
-}
-
-delete_snapshot = {
- 'status_code': [202]
-}
diff --git a/tempest/api_schema/response/compute/v2_1/tenant_networks.py b/tempest/api_schema/response/compute/v2_1/tenant_networks.py
deleted file mode 100644
index ddfab96..0000000
--- a/tempest/api_schema/response/compute/v2_1/tenant_networks.py
+++ /dev/null
@@ -1,53 +0,0 @@
-# Copyright 2015 NEC Corporation. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-param_network = {
- 'type': 'object',
- 'properties': {
- 'id': {'type': 'string'},
- 'cidr': {'type': ['string', 'null']},
- 'label': {'type': 'string'}
- },
- 'additionalProperties': False,
- 'required': ['id', 'cidr', 'label']
-}
-
-
-list_tenant_networks = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'networks': {
- 'type': 'array',
- 'items': param_network
- }
- },
- 'additionalProperties': False,
- 'required': ['networks']
- }
-}
-
-
-get_tenant_network = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'network': param_network
- },
- 'additionalProperties': False,
- 'required': ['network']
- }
-}
diff --git a/tempest/api_schema/response/compute/v2_1/tenant_usages.py b/tempest/api_schema/response/compute/v2_1/tenant_usages.py
deleted file mode 100644
index d51ef12..0000000
--- a/tempest/api_schema/response/compute/v2_1/tenant_usages.py
+++ /dev/null
@@ -1,92 +0,0 @@
-# Copyright 2014 NEC Corporation. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-import copy
-
-_server_usages = {
- 'type': 'array',
- 'items': {
- 'type': 'object',
- 'properties': {
- 'ended_at': {
- 'oneOf': [
- {'type': 'string'},
- {'type': 'null'}
- ]
- },
- 'flavor': {'type': 'string'},
- 'hours': {'type': 'number'},
- 'instance_id': {'type': 'string'},
- 'local_gb': {'type': 'integer'},
- 'memory_mb': {'type': 'integer'},
- 'name': {'type': 'string'},
- 'started_at': {'type': 'string'},
- 'state': {'type': 'string'},
- 'tenant_id': {'type': 'string'},
- 'uptime': {'type': 'integer'},
- 'vcpus': {'type': 'integer'},
- },
- 'required': ['ended_at', 'flavor', 'hours', 'instance_id', 'local_gb',
- 'memory_mb', 'name', 'started_at', 'state', 'tenant_id',
- 'uptime', 'vcpus']
- }
-}
-
-_tenant_usage_list = {
- 'type': 'object',
- 'properties': {
- 'server_usages': _server_usages,
- 'start': {'type': 'string'},
- 'stop': {'type': 'string'},
- 'tenant_id': {'type': 'string'},
- 'total_hours': {'type': 'number'},
- 'total_local_gb_usage': {'type': 'number'},
- 'total_memory_mb_usage': {'type': 'number'},
- 'total_vcpus_usage': {'type': 'number'},
- },
- 'required': ['start', 'stop', 'tenant_id',
- 'total_hours', 'total_local_gb_usage',
- 'total_memory_mb_usage', 'total_vcpus_usage']
-}
-
-# 'required' of get_tenant is different from list_tenant's.
-_tenant_usage_get = copy.deepcopy(_tenant_usage_list)
-_tenant_usage_get['required'] = ['server_usages', 'start', 'stop', 'tenant_id',
- 'total_hours', 'total_local_gb_usage',
- 'total_memory_mb_usage', 'total_vcpus_usage']
-
-list_tenant_usage = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'tenant_usages': {
- 'type': 'array',
- 'items': _tenant_usage_list
- }
- },
- 'required': ['tenant_usages']
- }
-}
-
-get_tenant_usage = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'tenant_usage': _tenant_usage_get
- },
- 'required': ['tenant_usage']
- }
-}
diff --git a/tempest/api_schema/response/compute/v2_1/versions.py b/tempest/api_schema/response/compute/v2_1/versions.py
deleted file mode 100644
index 08a9fab..0000000
--- a/tempest/api_schema/response/compute/v2_1/versions.py
+++ /dev/null
@@ -1,110 +0,0 @@
-# Copyright 2015 NEC Corporation. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-import copy
-
-
-_version = {
- 'type': 'object',
- 'properties': {
- 'id': {'type': 'string'},
- 'links': {
- 'type': 'array',
- 'items': {
- 'type': 'object',
- 'properties': {
- 'href': {'type': 'string', 'format': 'uri'},
- 'rel': {'type': 'string'},
- 'type': {'type': 'string'},
- },
- 'required': ['href', 'rel'],
- 'additionalProperties': False
- }
- },
- 'status': {'type': 'string'},
- 'updated': {'type': 'string', 'format': 'date-time'},
- 'version': {'type': 'string'},
- 'min_version': {'type': 'string'},
- 'media-types': {
- 'type': 'array',
- 'properties': {
- 'base': {'type': 'string'},
- 'type': {'type': 'string'},
- }
- },
- },
- # NOTE: version and min_version have been added since Kilo,
- # so they should not be required.
- # NOTE(sdague): media-types only shows up in single version requests.
- 'required': ['id', 'links', 'status', 'updated'],
- 'additionalProperties': False
-}
-
-list_versions = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'versions': {
- 'type': 'array',
- 'items': _version
- }
- },
- 'required': ['versions'],
- 'additionalProperties': False
- }
-}
-
-
-_detail_get_version = copy.deepcopy(_version)
-_detail_get_version['properties'].pop('min_version')
-_detail_get_version['properties'].pop('version')
-_detail_get_version['properties'].pop('updated')
-_detail_get_version['properties']['media-types'] = {
- 'type': 'array',
- 'items': {
- 'type': 'object',
- 'properties': {
- 'base': {'type': 'string'},
- 'type': {'type': 'string'}
- }
- }
-}
-_detail_get_version['required'] = ['id', 'links', 'status', 'media-types']
-
-get_version = {
- 'status_code': [300],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'choices': {
- 'type': 'array',
- 'items': _detail_get_version
- }
- },
- 'required': ['choices'],
- 'additionalProperties': False
- }
-}
-
-get_one_version = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'version': _version
- },
- 'additionalProperties': False
- }
-}
diff --git a/tempest/clients.py b/tempest/clients.py
index e822ebe..b685bb7 100644
--- a/tempest/clients.py
+++ b/tempest/clients.py
@@ -40,6 +40,23 @@
InstanceUsagesAuditLogClient
from tempest_lib.services.compute.limits_client import LimitsClient
from tempest_lib.services.compute.migrations_client import MigrationsClient
+from tempest_lib.services.compute.networks_client import NetworksClient \
+ as ComputeNetworksClient
+from tempest_lib.services.compute.quota_classes_client import \
+ QuotaClassesClient
+from tempest_lib.services.compute.quotas_client import QuotasClient
+from tempest_lib.services.compute.security_group_default_rules_client import \
+ SecurityGroupDefaultRulesClient
+from tempest_lib.services.compute.security_groups_client import \
+ SecurityGroupsClient
+from tempest_lib.services.compute.services_client import ServicesClient
+from tempest_lib.services.compute.snapshots_client import \
+ SnapshotsClient as ComputeSnapshotsClient
+from tempest_lib.services.compute.tenant_networks_client import \
+ TenantNetworksClient
+from tempest_lib.services.compute.tenant_usages_client import \
+ TenantUsagesClient
+from tempest_lib.services.compute.versions_client import VersionsClient
from tempest_lib.services.identity.v2.token_client import TokenClient
from tempest_lib.services.identity.v3.token_client import V3TokenClient
@@ -55,28 +72,11 @@
from tempest.services.compute.json.interfaces_client import \
InterfacesClient
from tempest.services.compute.json.keypairs_client import KeyPairsClient
-from tempest.services.compute.json.networks_client import NetworksClient \
- as ComputeNetworksClient
-from tempest.services.compute.json.quota_classes_client import \
- QuotaClassesClient
-from tempest.services.compute.json.quotas_client import QuotasClient
-from tempest.services.compute.json.security_group_default_rules_client import \
- SecurityGroupDefaultRulesClient
from tempest.services.compute.json.security_group_rules_client import \
SecurityGroupRulesClient
-from tempest.services.compute.json.security_groups_client import \
- SecurityGroupsClient
from tempest.services.compute.json.server_groups_client import \
ServerGroupsClient
from tempest.services.compute.json.servers_client import ServersClient
-from tempest.services.compute.json.services_client import ServicesClient
-from tempest.services.compute.json.snapshots_client import \
- SnapshotsClient as ComputeSnapshotsClient
-from tempest.services.compute.json.tenant_networks_client import \
- TenantNetworksClient
-from tempest.services.compute.json.tenant_usages_client import \
- TenantUsagesClient
-from tempest.services.compute.json.versions_client import VersionsClient
from tempest.services.compute.json.volumes_client import \
VolumesClient as ComputeVolumesClient
from tempest.services.data_processing.v1_1.data_processing_client import \
@@ -90,16 +90,18 @@
from tempest.services.identity.v2.json.identity_client import \
IdentityClient
from tempest.services.identity.v3.json.credentials_client import \
- CredentialsClient
+ CredentialsClient as CredentialsV3Client
from tempest.services.identity.v3.json.endpoints_client import \
- EndPointClient
-from tempest.services.identity.v3.json.groups_client import GroupsClient
-from tempest.services.identity.v3.json.identity_client import \
- IdentityV3Client
-from tempest.services.identity.v3.json.policy_client import PolicyClient
-from tempest.services.identity.v3.json.region_client import RegionClient
+ EndPointClient as EndPointV3Client
+from tempest.services.identity.v3.json.groups_client import \
+ GroupsClient as GroupsV3Client
+from tempest.services.identity.v3.json.identity_client import IdentityV3Client
+from tempest.services.identity.v3.json.policy_client import \
+ PolicyClient as PolicyV3Client
+from tempest.services.identity.v3.json.region_client import \
+ RegionClient as RegionV3Client
from tempest.services.identity.v3.json.service_client import \
- ServiceClient
+ ServiceClient as ServiceV3Client
from tempest.services.image.v1.json.image_client import ImageClient
from tempest.services.image.v2.json.image_client import ImageClientV2
from tempest.services.messaging.json.messaging_client import \
@@ -406,17 +408,17 @@
**params_v2_public)
params_v3 = params.copy()
params_v3['endpoint_type'] = CONF.identity.v3_endpoint_type
- # Client uses the endpoint type of Keystone API v3
+ # Clients below use the endpoint type of Keystone API v3
self.identity_v3_client = IdentityV3Client(self.auth_provider,
**params_v3)
- self.endpoints_client = EndPointClient(self.auth_provider,
- **params)
- self.service_client = ServiceClient(self.auth_provider, **params)
- self.policy_client = PolicyClient(self.auth_provider, **params)
- self.region_client = RegionClient(self.auth_provider, **params)
- self.credentials_client = CredentialsClient(self.auth_provider,
- **params)
- self.groups_client = GroupsClient(self.auth_provider, **params_v3)
+ self.endpoints_client = EndPointV3Client(self.auth_provider,
+ **params_v3)
+ self.service_client = ServiceV3Client(self.auth_provider, **params_v3)
+ self.policy_client = PolicyV3Client(self.auth_provider, **params_v3)
+ self.region_client = RegionV3Client(self.auth_provider, **params_v3)
+ self.credentials_client = CredentialsV3Client(self.auth_provider,
+ **params_v3)
+ self.groups_client = GroupsV3Client(self.auth_provider, **params_v3)
# Token clients do not use the catalog. They only need default_params.
# They read auth_url, so they should only be set if the corresponding
# API version is marked as enabled
diff --git a/tempest/cmd/javelin.py b/tempest/cmd/javelin.py
index 3df19fc..184bb9a 100755
--- a/tempest/cmd/javelin.py
+++ b/tempest/cmd/javelin.py
@@ -118,6 +118,7 @@
from tempest_lib import auth
from tempest_lib import exceptions as lib_exc
from tempest_lib.services.compute import flavors_client
+from tempest_lib.services.compute import security_groups_client
import yaml
from tempest.common import identity
@@ -125,7 +126,6 @@
from tempest import config
from tempest.services.compute.json import floating_ips_client
from tempest.services.compute.json import security_group_rules_client
-from tempest.services.compute.json import security_groups_client
from tempest.services.compute.json import servers_client
from tempest.services.identity.v2.json import identity_client
from tempest.services.image.v2.json import image_client
diff --git a/tempest/common/utils/linux/remote_client.py b/tempest/common/utils/linux/remote_client.py
index 10654ff..025b79f 100644
--- a/tempest/common/utils/linux/remote_client.py
+++ b/tempest/common/utils/linux/remote_client.py
@@ -95,15 +95,24 @@
return self.exec_command(cmd)
def ping_host(self, host, count=CONF.compute.ping_count,
- size=CONF.compute.ping_size):
+ size=CONF.compute.ping_size, nic=None):
addr = netaddr.IPAddress(host)
cmd = 'ping6' if addr.version == 6 else 'ping'
+ if nic:
+ cmd = 'sudo {cmd} -I {nic}'.format(cmd=cmd, nic=nic)
cmd += ' -c{0} -w{0} -s{1} {2}'.format(count, size, host)
return self.exec_command(cmd)
- def get_mac_address(self):
- cmd = "ip addr | awk '/ether/ {print $2}'"
- return self.exec_command(cmd)
+ def set_mac_address(self, nic, address):
+ self.set_nic_state(nic=nic, state="down")
+ cmd = "sudo ip link set dev {0} address {1}".format(nic, address)
+ self.exec_command(cmd)
+ self.set_nic_state(nic=nic, state="up")
+
+ def get_mac_address(self, nic=""):
+ show_nic = "show {nic} ".format(nic=nic) if nic else ""
+ cmd = "ip addr %s| awk '/ether/ {print $2}'" % show_nic
+ return self.exec_command(cmd).strip().lower()
def get_nic_name(self, address):
cmd = "ip -o addr | awk '/%s/ {print $2}'" % address
@@ -121,8 +130,8 @@
)
return self.exec_command(cmd)
- def turn_nic_on(self, nic):
- cmd = "sudo ip link set {nic} up".format(nic=nic)
+ def set_nic_state(self, nic, state="up"):
+ cmd = "sudo ip link set {nic} {state}".format(nic=nic, state=state)
return self.exec_command(cmd)
def get_pids(self, pr_name):
diff --git a/tempest/config.py b/tempest/config.py
index c9fe38d..8c3656f 100644
--- a/tempest/config.py
+++ b/tempest/config.py
@@ -722,11 +722,21 @@
'publicURL', 'adminURL', 'internalURL'],
help="The endpoint type to use for the volume service."),
cfg.StrOpt('backend1_name',
- default='BACKEND_1',
- help="Name of the backend1 (must be declared in cinder.conf)"),
+ default='',
+ help='Name of the backend1 (must be declared in cinder.conf)',
+ deprecated_for_removal=True),
cfg.StrOpt('backend2_name',
- default='BACKEND_2',
- help="Name of the backend2 (must be declared in cinder.conf)"),
+ default='',
+ help='Name of the backend2 (must be declared in cinder.conf)',
+ deprecated_for_removal=True),
+ cfg.ListOpt('backend_names',
+ default=['BACKEND_1', 'BACKEND_2'],
+ help='A list of backend names seperated by comma .'
+ 'The backend name must be declared in cinder.conf',
+ deprecated_opts=[cfg.DeprecatedOpt('BACKEND_1',
+ group='volume'),
+ cfg.DeprecatedOpt('BACKEND_2',
+ group='volume')]),
cfg.StrOpt('storage_protocol',
default='iSCSI',
help='Backend protocol to target when creating volume types'),
diff --git a/tempest/hacking/ignored_list_T110.txt b/tempest/hacking/ignored_list_T110.txt
index f522865..f1655d0 100644
--- a/tempest/hacking/ignored_list_T110.txt
+++ b/tempest/hacking/ignored_list_T110.txt
@@ -1,6 +1,5 @@
./tempest/services/database/json/flavors_client.py
./tempest/services/identity/v3/json/credentials_client.py
-./tempest/services/identity/v3/json/groups_client.py
./tempest/services/identity/v3/json/identity_client.py
./tempest/services/identity/v3/json/policy_client.py
./tempest/services/identity/v3/json/region_client.py
@@ -10,5 +9,4 @@
./tempest/services/telemetry/json/telemetry_client.py
./tempest/services/volume/json/qos_client.py
./tempest/services/volume/json/backups_client.py
-./tempest/services/image/v2/json/image_client.py
./tempest/services/baremetal/base.py
diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py
index a5ed645..d787c3f 100644
--- a/tempest/scenario/manager.py
+++ b/tempest/scenario/manager.py
@@ -381,20 +381,22 @@
(img_path, img_container_format, img_disk_format,
img_properties, ami_img_path, ari_img_path, aki_img_path))
try:
- self.image = self._image_create('scenario-img',
- img_container_format,
- img_path,
- disk_format=img_disk_format,
- properties=img_properties)
+ image = self._image_create('scenario-img',
+ img_container_format,
+ img_path,
+ disk_format=img_disk_format,
+ properties=img_properties)
except IOError:
LOG.debug("A qcow2 image was not found. Try to get a uec image.")
kernel = self._image_create('scenario-aki', 'aki', aki_img_path)
ramdisk = self._image_create('scenario-ari', 'ari', ari_img_path)
properties = {'kernel_id': kernel, 'ramdisk_id': ramdisk}
- self.image = self._image_create('scenario-ami', 'ami',
- path=ami_img_path,
- properties=properties)
- LOG.debug("image:%s" % self.image)
+ image = self._image_create('scenario-ami', 'ami',
+ path=ami_img_path,
+ properties=properties)
+ LOG.debug("image:%s" % image)
+
+ return image
def _log_console_output(self, servers=None):
if not CONF.compute_feature_enabled.console_output:
@@ -863,18 +865,20 @@
self._log_net_info(e)
raise
- def _check_remote_connectivity(self, source, dest, should_succeed=True):
+ def _check_remote_connectivity(self, source, dest, should_succeed=True,
+ nic=None):
"""check ping server via source ssh connection
:param source: RemoteClient: an ssh connection from which to ping
:param dest: and IP to ping against
:param should_succeed: boolean should ping succeed or not
+ :param nic: specific network interface to ping from
:returns: boolean -- should_succeed == ping
:returns: ping is false if ping failed
"""
def ping_remote():
try:
- source.ping_host(dest)
+ source.ping_host(dest, nic=nic)
except lib_exc.SSHExecCommandFailed:
LOG.warn('Failed to ping IP: %s via a ssh connection from: %s.'
% (dest, source.ssh_client.host))
@@ -1370,16 +1374,6 @@
else:
cls.admin_volume_types_client = cls.os_adm.volume_types_v2_client
- def _wait_for_volume_status(self, status):
- self.status_timeout(
- self.volume_client.volumes, self.volume.id, status)
-
- def nova_boot(self):
- self.keypair = self.create_keypair()
- create_kwargs = {'key_name': self.keypair['name']}
- self.server = self.create_server(image=self.image,
- create_kwargs=create_kwargs)
-
def create_volume_type(self, client=None, name=None):
if not client:
client = self.admin_volume_types_client
diff --git a/tempest/scenario/test_encrypted_cinder_volumes.py b/tempest/scenario/test_encrypted_cinder_volumes.py
index 99837eb..082a8bf 100644
--- a/tempest/scenario/test_encrypted_cinder_volumes.py
+++ b/tempest/scenario/test_encrypted_cinder_volumes.py
@@ -42,8 +42,11 @@
raise cls.skipException('Encrypted volume attach is not supported')
def launch_instance(self):
- self.glance_image_create()
- self.nova_boot()
+ image = self.glance_image_create()
+ keypair = self.create_keypair()
+
+ return self.create_server(image=image,
+ create_kwargs={'key_name': keypair['name']})
def create_encrypted_volume(self, encryption_provider, volume_type):
volume_type = self.create_volume_type(name=volume_type)
@@ -52,26 +55,26 @@
key_size=512,
cipher='aes-xts-plain64',
control_location='front-end')
- self.volume = self.create_volume(volume_type=volume_type['name'])
+ return self.create_volume(volume_type=volume_type['name'])
- def attach_detach_volume(self):
- self.volume = self.nova_volume_attach(self.server, self.volume)
- self.nova_volume_detach(self.server, self.volume)
+ def attach_detach_volume(self, server, volume):
+ attached_volume = self.nova_volume_attach(server, volume)
+ self.nova_volume_detach(server, attached_volume)
@test.idempotent_id('79165fb4-5534-4b9d-8429-97ccffb8f86e')
@test.services('compute', 'volume', 'image')
def test_encrypted_cinder_volumes_luks(self):
- self.launch_instance()
- self.create_encrypted_volume('nova.volume.encryptors.'
- 'luks.LuksEncryptor',
- volume_type='luks')
- self.attach_detach_volume()
+ server = self.launch_instance()
+ volume = self.create_encrypted_volume('nova.volume.encryptors.'
+ 'luks.LuksEncryptor',
+ volume_type='luks')
+ self.attach_detach_volume(server, volume)
@test.idempotent_id('cbc752ed-b716-4717-910f-956cce965722')
@test.services('compute', 'volume', 'image')
def test_encrypted_cinder_volumes_cryptsetup(self):
- self.launch_instance()
- self.create_encrypted_volume('nova.volume.encryptors.'
- 'cryptsetup.CryptsetupEncryptor',
- volume_type='cryptsetup')
- self.attach_detach_volume()
+ server = self.launch_instance()
+ volume = self.create_encrypted_volume('nova.volume.encryptors.'
+ 'cryptsetup.CryptsetupEncryptor',
+ volume_type='cryptsetup')
+ self.attach_detach_volume(server, volume)
diff --git a/tempest/scenario/test_large_ops.py b/tempest/scenario/test_large_ops.py
index 6497f7a..f45fb3a 100644
--- a/tempest/scenario/test_large_ops.py
+++ b/tempest/scenario/test_large_ops.py
@@ -79,7 +79,7 @@
waiters.wait_for_server_status(self.servers_client,
server['id'], status)
- def nova_boot(self):
+ def nova_boot(self, image):
name = data_utils.rand_name('scenario-server')
flavor_id = CONF.compute.flavor_ref
# Explicitly create secgroup to avoid cleanup at the end of testcases.
@@ -99,7 +99,7 @@
create_kwargs)
self.servers_client.create_server(
name=name,
- imageRef=self.image,
+ imageRef=image,
flavorRef=flavor_id,
**create_kwargs)
# needed because of bug 1199788
@@ -118,8 +118,8 @@
self._wait_for_server_status('ACTIVE')
def _large_ops_scenario(self):
- self.glance_image_create()
- self.nova_boot()
+ image = self.glance_image_create()
+ self.nova_boot(image)
@test.idempotent_id('14ba0e78-2ed9-4d17-9659-a48f4756ecb3')
@test.services('compute', 'image')
diff --git a/tempest/scenario/test_minimum_basic.py b/tempest/scenario/test_minimum_basic.py
index a5b5a1b..92e3592 100644
--- a/tempest/scenario/test_minimum_basic.py
+++ b/tempest/scenario/test_minimum_basic.py
@@ -58,11 +58,6 @@
waiters.wait_for_server_status(self.servers_client,
server_id, status)
- def nova_boot(self, keypair):
- create_kwargs = {'key_name': keypair['name']}
- return self.create_server(image=self.image,
- create_kwargs=create_kwargs)
-
def nova_list(self):
servers = self.servers_client.list_servers()
# The list servers in the compute client is inconsistent...
@@ -119,11 +114,12 @@
@test.idempotent_id('bdbb5441-9204-419d-a225-b4fdbfb1a1a8')
@test.services('compute', 'volume', 'image', 'network')
def test_minimum_basic_scenario(self):
- self.glance_image_create()
-
+ image = self.glance_image_create()
keypair = self.create_keypair()
- server = self.nova_boot(keypair)
+ create_kwargs = {'key_name': keypair['name']}
+ server = self.create_server(image=image,
+ create_kwargs=create_kwargs)
servers = self.nova_list()
self.assertIn(server['id'], [x['id'] for x in servers])
diff --git a/tempest/scenario/test_network_basic_ops.py b/tempest/scenario/test_network_basic_ops.py
index 8fefd9e..28f1cd3 100644
--- a/tempest/scenario/test_network_basic_ops.py
+++ b/tempest/scenario/test_network_basic_ops.py
@@ -287,7 +287,7 @@
num, new_nic = self.diff_list[0]
ssh_client.assign_static_ip(nic=new_nic,
addr=new_port.fixed_ips[0]['ip_address'])
- ssh_client.turn_nic_on(nic=new_nic)
+ ssh_client.set_nic_state(nic=new_nic)
def _get_server_nics(self, ssh_client):
reg = re.compile(r'(?P<num>\d+): (?P<nic_name>\w+):')
@@ -737,3 +737,49 @@
self.check_public_network_connectivity(
should_connect=True,
msg='After router rescheduling')
+
+ @test.requires_ext(service='network', extension='port-security')
+ @test.idempotent_id('7c0bb1a2-d053-49a4-98f9-ca1a1d849f63')
+ @test.services('compute', 'network')
+ def test_port_security_macspoofing_port(self):
+ """Tests port_security extension enforces mac spoofing
+
+ 1. create a new network
+ 2. connect VM to new network
+ 4. check VM can ping new network DHCP port
+ 5. spoof mac on new new network interface
+ 6. check Neutron enforces mac spoofing and blocks pings via spoofed
+ interface
+ 7. disable port-security on the spoofed port
+ 8. check Neutron allows pings via spoofed interface
+ """
+ spoof_mac = "00:00:00:00:00:01"
+
+ # Create server
+ self._setup_network_and_servers()
+ self.check_public_network_connectivity(should_connect=False)
+ self._create_new_network()
+ self._hotplug_server()
+ fip, server = self.floating_ip_tuple
+ new_ports = self._list_ports(device_id=server["id"],
+ network_id=self.new_net["id"])
+ spoof_port = new_ports[0]
+ private_key = self._get_server_key(server)
+ ssh_client = self.get_remote_client(fip.floating_ip_address,
+ private_key=private_key)
+ spoof_nic = ssh_client.get_nic_name(spoof_port["mac_address"])
+ dhcp_ports = self._list_ports(device_owner="network:dhcp",
+ network_id=self.new_net["id"])
+ new_net_dhcp = dhcp_ports[0]["fixed_ips"][0]["ip_address"]
+ self._check_remote_connectivity(ssh_client, dest=new_net_dhcp,
+ nic=spoof_nic, should_succeed=True)
+ ssh_client.set_mac_address(spoof_nic, spoof_mac)
+ new_mac = ssh_client.get_mac_address(nic=spoof_nic)
+ self.assertEqual(spoof_mac, new_mac)
+ self._check_remote_connectivity(ssh_client, dest=new_net_dhcp,
+ nic=spoof_nic, should_succeed=False)
+ self.ports_client.update_port(spoof_port["id"],
+ port_security_enabled=False,
+ security_groups=[])
+ self._check_remote_connectivity(ssh_client, dest=new_net_dhcp,
+ nic=spoof_nic, should_succeed=True)
diff --git a/tempest/scenario/test_network_v6.py b/tempest/scenario/test_network_v6.py
index 151eef8..a18dd2e 100644
--- a/tempest/scenario/test_network_v6.py
+++ b/tempest/scenario/test_network_v6.py
@@ -148,7 +148,7 @@
"ports: %s")
% (self.network_v6, ports))
mac6 = ports[0]
- ssh.turn_nic_on(ssh.get_nic_name(mac6))
+ ssh.set_nic_state(ssh.get_nic_name(mac6))
def _prepare_and_test(self, address6_mode, n_subnets6=1, dualnet=False):
net_list = self.prepare_network(address6_mode=address6_mode,
diff --git a/tempest/services/compute/json/networks_client.py b/tempest/services/compute/json/networks_client.py
deleted file mode 100644
index dd20ee5..0000000
--- a/tempest/services/compute/json/networks_client.py
+++ /dev/null
@@ -1,33 +0,0 @@
-# Copyright 2012 OpenStack Foundation
-# All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-from oslo_serialization import jsonutils as json
-
-from tempest.common import service_client
-
-
-class NetworksClient(service_client.ServiceClient):
-
- def list_networks(self):
- resp, body = self.get("os-networks")
- body = json.loads(body)
- self.expected_success(200, resp.status)
- return service_client.ResponseBody(resp, body)
-
- def show_network(self, network_id):
- resp, body = self.get("os-networks/%s" % network_id)
- body = json.loads(body)
- self.expected_success(200, resp.status)
- return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/compute/json/quota_classes_client.py b/tempest/services/compute/json/quota_classes_client.py
deleted file mode 100644
index 7aac5e4..0000000
--- a/tempest/services/compute/json/quota_classes_client.py
+++ /dev/null
@@ -1,44 +0,0 @@
-# Copyright 2012 NTT Data
-# All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-from oslo_serialization import jsonutils as json
-
-from tempest.api_schema.response.compute.v2_1\
- import quota_classes as classes_schema
-from tempest.common import service_client
-
-
-class QuotaClassesClient(service_client.ServiceClient):
-
- def show_quota_class_set(self, quota_class_id):
- """List the quota class set for a quota class."""
-
- url = 'os-quota-class-sets/%s' % quota_class_id
- resp, body = self.get(url)
- body = json.loads(body)
- self.validate_response(classes_schema.get_quota_class_set, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def update_quota_class_set(self, quota_class_id, **kwargs):
- """Updates the quota class's limits for one or more resources."""
- post_body = json.dumps({'quota_class_set': kwargs})
-
- resp, body = self.put('os-quota-class-sets/%s' % quota_class_id,
- post_body)
-
- body = json.loads(body)
- self.validate_response(classes_schema.update_quota_class_set,
- resp, body)
- return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/compute/json/quotas_client.py b/tempest/services/compute/json/quotas_client.py
deleted file mode 100644
index e628b3a..0000000
--- a/tempest/services/compute/json/quotas_client.py
+++ /dev/null
@@ -1,63 +0,0 @@
-# Copyright 2012 NTT Data
-# All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-from oslo_serialization import jsonutils as json
-
-from tempest.api_schema.response.compute.v2_1 import quotas as schema
-from tempest.common import service_client
-
-
-class QuotasClient(service_client.ServiceClient):
-
- def show_quota_set(self, tenant_id, user_id=None):
- """List the quota set for a tenant."""
-
- url = 'os-quota-sets/%s' % tenant_id
- if user_id:
- url += '?user_id=%s' % user_id
- resp, body = self.get(url)
- body = json.loads(body)
- self.validate_response(schema.get_quota_set, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def show_default_quota_set(self, tenant_id):
- """List the default quota set for a tenant."""
-
- url = 'os-quota-sets/%s/defaults' % tenant_id
- resp, body = self.get(url)
- body = json.loads(body)
- self.validate_response(schema.get_quota_set, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def update_quota_set(self, tenant_id, user_id=None, **kwargs):
- """Updates the tenant's quota limits for one or more resources"""
- post_body = json.dumps({'quota_set': kwargs})
-
- if user_id:
- resp, body = self.put('os-quota-sets/%s?user_id=%s' %
- (tenant_id, user_id), post_body)
- else:
- resp, body = self.put('os-quota-sets/%s' % tenant_id,
- post_body)
-
- body = json.loads(body)
- self.validate_response(schema.update_quota_set, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def delete_quota_set(self, tenant_id):
- """Delete the tenant's quota set."""
- resp, body = self.delete('os-quota-sets/%s' % tenant_id)
- self.validate_response(schema.delete_quota, resp, body)
- return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/compute/json/security_group_default_rules_client.py b/tempest/services/compute/json/security_group_default_rules_client.py
deleted file mode 100644
index b31baab..0000000
--- a/tempest/services/compute/json/security_group_default_rules_client.py
+++ /dev/null
@@ -1,65 +0,0 @@
-# Copyright 2014 NEC Corporation.
-# All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-from oslo_serialization import jsonutils as json
-
-from tempest.api_schema.response.compute.v2_1 import \
- security_group_default_rule as schema
-from tempest.common import service_client
-
-
-class SecurityGroupDefaultRulesClient(service_client.ServiceClient):
-
- def create_security_default_group_rule(self, **kwargs):
- """Creating security group default rules.
-
- ip_protocol : ip_protocol (icmp, tcp, udp).
- from_port: Port at start of range.
- to_port : Port at end of range.
- cidr : CIDR for address range.
- """
- post_body = json.dumps({'security_group_default_rule': kwargs})
- url = 'os-security-group-default-rules'
- resp, body = self.post(url, post_body)
- body = json.loads(body)
- self.validate_response(schema.create_get_security_group_default_rule,
- resp, body)
- return service_client.ResponseBody(resp, body)
-
- def delete_security_group_default_rule(self,
- security_group_default_rule_id):
- """Deletes the provided Security Group default rule."""
- resp, body = self.delete('os-security-group-default-rules/%s' % (
- security_group_default_rule_id))
- self.validate_response(schema.delete_security_group_default_rule,
- resp, body)
- return service_client.ResponseBody(resp, body)
-
- def list_security_group_default_rules(self):
- """List all Security Group default rules."""
- resp, body = self.get('os-security-group-default-rules')
- body = json.loads(body)
- self.validate_response(schema.list_security_group_default_rules,
- resp, body)
- return service_client.ResponseBody(resp, body)
-
- def show_security_group_default_rule(self, security_group_default_rule_id):
- """Return the details of provided Security Group default rule."""
- resp, body = self.get('os-security-group-default-rules/%s' %
- security_group_default_rule_id)
- body = json.loads(body)
- self.validate_response(schema.create_get_security_group_default_rule,
- resp, body)
- return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/compute/json/security_groups_client.py b/tempest/services/compute/json/security_groups_client.py
deleted file mode 100644
index c996079..0000000
--- a/tempest/services/compute/json/security_groups_client.py
+++ /dev/null
@@ -1,89 +0,0 @@
-# Copyright 2012 OpenStack Foundation
-# All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-from oslo_serialization import jsonutils as json
-from six.moves.urllib import parse as urllib
-from tempest_lib import exceptions as lib_exc
-
-from tempest.api_schema.response.compute.v2_1 import security_groups as schema
-from tempest.common import service_client
-
-
-class SecurityGroupsClient(service_client.ServiceClient):
-
- def list_security_groups(self, **params):
- """List all security groups for a user."""
-
- url = 'os-security-groups'
- if params:
- url += '?%s' % urllib.urlencode(params)
-
- resp, body = self.get(url)
- body = json.loads(body)
- self.validate_response(schema.list_security_groups, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def show_security_group(self, security_group_id):
- """Get the details of a Security Group."""
- url = "os-security-groups/%s" % security_group_id
- resp, body = self.get(url)
- body = json.loads(body)
- self.validate_response(schema.get_security_group, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def create_security_group(self, **kwargs):
- """Creates a new security group.
-
- name (Required): Name of security group.
- description (Required): Description of security group.
- """
- post_body = json.dumps({'security_group': kwargs})
- resp, body = self.post('os-security-groups', post_body)
- body = json.loads(body)
- self.validate_response(schema.get_security_group, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def update_security_group(self, security_group_id, **kwargs):
- """Update a security group.
-
- security_group_id: a security_group to update
- name: new name of security group
- description: new description of security group
- """
- post_body = json.dumps({'security_group': kwargs})
- resp, body = self.put('os-security-groups/%s' % security_group_id,
- post_body)
- body = json.loads(body)
- self.validate_response(schema.update_security_group, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def delete_security_group(self, security_group_id):
- """Deletes the provided Security Group."""
- resp, body = self.delete(
- 'os-security-groups/%s' % security_group_id)
- self.validate_response(schema.delete_security_group, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def is_resource_deleted(self, id):
- try:
- self.show_security_group(id)
- except lib_exc.NotFound:
- return True
- return False
-
- @property
- def resource_type(self):
- """Returns the primary type of resource this client works with."""
- return 'security_group'
diff --git a/tempest/services/compute/json/services_client.py b/tempest/services/compute/json/services_client.py
deleted file mode 100644
index 57d0434..0000000
--- a/tempest/services/compute/json/services_client.py
+++ /dev/null
@@ -1,58 +0,0 @@
-# Copyright 2013 NEC Corporation
-# Copyright 2013 IBM Corp.
-# All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-from oslo_serialization import jsonutils as json
-from six.moves.urllib import parse as urllib
-
-from tempest.api_schema.response.compute.v2_1 import services as schema
-from tempest.common import service_client
-
-
-class ServicesClient(service_client.ServiceClient):
-
- def list_services(self, **params):
- url = 'os-services'
- if params:
- url += '?%s' % urllib.urlencode(params)
-
- resp, body = self.get(url)
- body = json.loads(body)
- self.validate_response(schema.list_services, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def enable_service(self, **kwargs):
- """Enable service on a host
-
- host_name: Name of host
- binary: Service binary
- """
- post_body = json.dumps(kwargs)
- resp, body = self.put('os-services/enable', post_body)
- body = json.loads(body)
- self.validate_response(schema.enable_disable_service, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def disable_service(self, **kwargs):
- """Disable service on a host
-
- host_name: Name of host
- binary: Service binary
- """
- post_body = json.dumps(kwargs)
- resp, body = self.put('os-services/disable', post_body)
- body = json.loads(body)
- self.validate_response(schema.enable_disable_service, resp, body)
- return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/compute/json/snapshots_client.py b/tempest/services/compute/json/snapshots_client.py
deleted file mode 100644
index e3f92db..0000000
--- a/tempest/services/compute/json/snapshots_client.py
+++ /dev/null
@@ -1,71 +0,0 @@
-# Copyright 2015 Fujitsu(fnst) Corporation
-# All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-from oslo_serialization import jsonutils as json
-from six.moves.urllib import parse as urllib
-from tempest_lib import exceptions as lib_exc
-
-from tempest.api_schema.response.compute.v2_1 import snapshots as schema
-from tempest.common import service_client
-
-
-class SnapshotsClient(service_client.ServiceClient):
-
- def create_snapshot(self, volume_id, **kwargs):
- post_body = {
- 'volume_id': volume_id
- }
- post_body.update(kwargs)
- post_body = json.dumps({'snapshot': post_body})
- resp, body = self.post('os-snapshots', post_body)
- body = json.loads(body)
- self.validate_response(schema.create_get_snapshot, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def show_snapshot(self, snapshot_id):
- url = "os-snapshots/%s" % snapshot_id
- resp, body = self.get(url)
- body = json.loads(body)
- self.validate_response(schema.create_get_snapshot, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def list_snapshots(self, detail=False, params=None):
- url = 'os-snapshots'
-
- if detail:
- url += '/detail'
- if params:
- url += '?%s' % urllib.urlencode(params)
- resp, body = self.get(url)
- body = json.loads(body)
- self.validate_response(schema.list_snapshots, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def delete_snapshot(self, snapshot_id):
- resp, body = self.delete("os-snapshots/%s" % snapshot_id)
- self.validate_response(schema.delete_snapshot, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def is_resource_deleted(self, id):
- try:
- self.show_snapshot(id)
- except lib_exc.NotFound:
- return True
- return False
-
- @property
- def resource_type(self):
- """Returns the primary type of resource this client works with."""
- return 'snapshot'
diff --git a/tempest/services/compute/json/tenant_networks_client.py b/tempest/services/compute/json/tenant_networks_client.py
deleted file mode 100644
index 33166c0..0000000
--- a/tempest/services/compute/json/tenant_networks_client.py
+++ /dev/null
@@ -1,33 +0,0 @@
-# Copyright 2015 NEC Corporation. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-from oslo_serialization import jsonutils as json
-
-from tempest.api_schema.response.compute.v2_1 import tenant_networks as schema
-from tempest.common import service_client
-
-
-class TenantNetworksClient(service_client.ServiceClient):
-
- def list_tenant_networks(self):
- resp, body = self.get("os-tenant-networks")
- body = json.loads(body)
- self.validate_response(schema.list_tenant_networks, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def show_tenant_network(self, network_id):
- resp, body = self.get("os-tenant-networks/%s" % network_id)
- body = json.loads(body)
- self.validate_response(schema.get_tenant_network, resp, body)
- return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/compute/json/tenant_usages_client.py b/tempest/services/compute/json/tenant_usages_client.py
deleted file mode 100644
index 73b4706..0000000
--- a/tempest/services/compute/json/tenant_usages_client.py
+++ /dev/null
@@ -1,43 +0,0 @@
-# Copyright 2013 NEC Corporation
-# All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-from oslo_serialization import jsonutils as json
-from six.moves.urllib import parse as urllib
-
-from tempest.api_schema.response.compute.v2_1 import tenant_usages as schema
-from tempest.common import service_client
-
-
-class TenantUsagesClient(service_client.ServiceClient):
-
- def list_tenant_usages(self, **params):
- url = 'os-simple-tenant-usage'
- if params:
- url += '?%s' % urllib.urlencode(params)
-
- resp, body = self.get(url)
- body = json.loads(body)
- self.validate_response(schema.list_tenant_usage, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def show_tenant_usage(self, tenant_id, **params):
- url = 'os-simple-tenant-usage/%s' % tenant_id
- if params:
- url += '?%s' % urllib.urlencode(params)
-
- resp, body = self.get(url)
- body = json.loads(body)
- self.validate_response(schema.get_tenant_usage, resp, body)
- return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/compute/json/versions_client.py b/tempest/services/compute/json/versions_client.py
deleted file mode 100644
index 48c0e8d..0000000
--- a/tempest/services/compute/json/versions_client.py
+++ /dev/null
@@ -1,55 +0,0 @@
-# Copyright (c) 2015 Hewlett-Packard Development Company, L.P.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-from oslo_serialization import jsonutils as json
-from six.moves import urllib
-
-from tempest.api_schema.response.compute.v2_1 import versions as schema
-from tempest.common import service_client
-
-
-class VersionsClient(service_client.ServiceClient):
-
- def _get_base_version_url(self):
- # NOTE: The URL which is gotten from keystone's catalog contains
- # API version and project-id like "v2/{project-id}", but we need
- # to access the URL which doesn't contain them for getting API
- # versions. For that, here should use raw_request() instead of
- # get().
- endpoint = self.base_url
- url = urllib.parse.urlparse(endpoint)
- return '%s://%s/' % (url.scheme, url.netloc)
-
- def list_versions(self):
- version_url = self._get_base_version_url()
- resp, body = self.raw_request(version_url, 'GET')
- body = json.loads(body)
- self.validate_response(schema.list_versions, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def get_version_by_url(self, version_url):
- """Get the version document by url.
-
- This gets the version document for a url, useful in testing
- the contents of things like /v2/ or /v2.1/ in Nova. That
- controller needs authenticated access, so we have to get
- ourselves a token before making the request.
-
- """
- # we need a token for this request
- resp, body = self.raw_request(version_url, 'GET',
- {'X-Auth-Token': self.token})
- body = json.loads(body)
- self.validate_response(schema.get_one_version, resp, body)
- return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/identity/v3/json/groups_client.py b/tempest/services/identity/v3/json/groups_client.py
index 5bd610d..70edd23 100644
--- a/tempest/services/identity/v3/json/groups_client.py
+++ b/tempest/services/identity/v3/json/groups_client.py
@@ -13,6 +13,10 @@
# License for the specific language governing permissions and limitations
# under the License.
+"""
+http://developer.openstack.org/api-ref-identity-v3.html#groups-v3
+"""
+
from oslo_serialization import jsonutils as json
from tempest.common import service_client
@@ -21,24 +25,19 @@
class GroupsClient(service_client.ServiceClient):
api_version = "v3"
- def create_group(self, name, **kwargs):
- """Creates a group."""
- description = kwargs.get('description', None)
- domain_id = kwargs.get('domain_id', 'default')
- project_id = kwargs.get('project_id', None)
- post_body = {
- 'description': description,
- 'domain_id': domain_id,
- 'project_id': project_id,
- 'name': name
- }
- post_body = json.dumps({'group': post_body})
+ def create_group(self, **kwargs):
+ """Creates a group.
+
+ Available params: see http://developer.openstack.org/
+ api-ref-identity-v3.html#createGroup
+ """
+ post_body = json.dumps({'group': kwargs})
resp, body = self.post('groups', post_body)
self.expected_success(201, resp.status)
body = json.loads(body)
return service_client.ResponseBody(resp, body)
- def get_group(self, group_id):
+ def show_group(self, group_id):
"""Get group details."""
resp, body = self.get('groups/%s' % group_id)
self.expected_success(200, resp.status)
@@ -53,15 +52,12 @@
return service_client.ResponseBody(resp, body)
def update_group(self, group_id, **kwargs):
- """Updates a group."""
- body = self.get_group(group_id)['group']
- name = kwargs.get('name', body['name'])
- description = kwargs.get('description', body['description'])
- post_body = {
- 'name': name,
- 'description': description
- }
- post_body = json.dumps({'group': post_body})
+ """Updates a group.
+
+ Available params: see http://developer.openstack.org/
+ api-ref-identity-v3.html#updateGroup
+ """
+ post_body = json.dumps({'group': kwargs})
resp, body = self.patch('groups/%s' % group_id, post_body)
self.expected_success(200, resp.status)
body = json.loads(body)
diff --git a/tempest/services/image/v2/json/image_client.py b/tempest/services/image/v2/json/image_client.py
index 413f70e..a7e0f04 100644
--- a/tempest/services/image/v2/json/image_client.py
+++ b/tempest/services/image/v2/json/image_client.py
@@ -153,7 +153,7 @@
self.expected_success(204, resp.status)
return service_client.ResponseBody(resp, body)
- def load_image_file(self, image_id):
+ def show_image_file(self, image_id):
url = 'v2/images/%s/file' % image_id
resp, body = self.get(url)
self.expected_success(200, resp.status)
@@ -178,17 +178,17 @@
body = json.loads(body)
return service_client.ResponseBody(resp, body)
- def add_image_member(self, image_id, member_id):
+ def add_image_member(self, image_id, **kwargs):
url = 'v2/images/%s/members' % image_id
- data = json.dumps({'member': member_id})
+ data = json.dumps(kwargs)
resp, body = self.post(url, data)
self.expected_success(200, resp.status)
body = json.loads(body)
return service_client.ResponseBody(resp, body)
- def update_image_member(self, image_id, member_id, body):
+ def update_image_member(self, image_id, member_id, **kwargs):
url = 'v2/images/%s/members/%s' % (image_id, member_id)
- data = json.dumps(body)
+ data = json.dumps(kwargs)
resp, body = self.put(url, data)
self.expected_success(200, resp.status)
body = json.loads(body)
@@ -220,19 +220,13 @@
body = json.loads(body)
return service_client.ResponseBody(resp, body)
- def create_namespaces(self, namespace, **kwargs):
- params = {
- "namespace": namespace,
- }
+ def create_namespace(self, **kwargs):
+ """Create a namespace.
- for option in kwargs:
- value = kwargs.get(option)
- if isinstance(value, dict) or isinstance(value, tuple):
- params.update(value)
- else:
- params[option] = value
-
- data = json.dumps(params)
+ Available params: see http://developer.openstack.org/
+ api-ref-image-v2.html#createNamespace-v2
+ """
+ data = json.dumps(kwargs)
self._validate_schema(data)
resp, body = self.post('/v2/metadefs/namespaces', data)
@@ -240,25 +234,23 @@
body = json.loads(body)
return service_client.ResponseBody(resp, body)
- def show_namespaces(self, namespace):
+ def show_namespace(self, namespace):
url = '/v2/metadefs/namespaces/%s' % namespace
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body)
return service_client.ResponseBody(resp, body)
- def update_namespaces(self, namespace, visibility, **kwargs):
- params = {
- "namespace": namespace,
- "visibility": visibility
- }
- for option in kwargs:
- value = kwargs.get(option)
- if isinstance(value, dict) or isinstance(value, tuple):
- params.update(value)
- else:
- params[option] = value
+ def update_namespace(self, namespace, **kwargs):
+ """Update a namespace.
+ Available params: see http://developer.openstack.org/
+ api-ref-image-v2.html#updateNamespace-v2
+ """
+ # NOTE: On Glance API, we need to pass namespace on both URI
+ # and a request body.
+ params = {'namespace': namespace}
+ params.update(kwargs)
data = json.dumps(params)
self._validate_schema(data)
url = '/v2/metadefs/namespaces/%s' % namespace
@@ -267,7 +259,7 @@
body = json.loads(body)
return service_client.ResponseBody(resp, body)
- def delete_namespaces(self, namespace):
+ def delete_namespace(self, namespace):
url = '/v2/metadefs/namespaces/%s' % namespace
resp, _ = self.delete(url)
self.expected_success(204, resp.status)
diff --git a/tempest/services/volume/json/admin/volume_hosts_client.py b/tempest/services/volume/json/admin/volume_hosts_client.py
index 939db59..279fed5 100644
--- a/tempest/services/volume/json/admin/volume_hosts_client.py
+++ b/tempest/services/volume/json/admin/volume_hosts_client.py
@@ -22,7 +22,7 @@
class BaseVolumeHostsClient(service_client.ServiceClient):
"""Client class to send CRUD Volume Hosts API requests"""
- def list_hosts(self, params=None):
+ def list_hosts(self, **params):
"""Lists all hosts."""
url = 'os-hosts'
diff --git a/tempest/tests/common/test_preprov_creds.py b/tempest/tests/common/test_preprov_creds.py
index 2e0f82a..fd7df16 100644
--- a/tempest/tests/common/test_preprov_creds.py
+++ b/tempest/tests/common/test_preprov_creds.py
@@ -319,7 +319,7 @@
return_value=test_accounts))
test_accounts_class = preprov_creds.PreProvisionedCredentialProvider(
**self.fixed_params)
- with mock.patch('tempest.services.compute.json.networks_client.'
+ with mock.patch('tempest_lib.services.compute.networks_client.'
'NetworksClient.list_networks',
return_value={'networks': [{'name': 'network-2',
'id': 'fake-id',
diff --git a/tempest/tests/common/test_service_clients.py b/tempest/tests/common/test_service_clients.py
index b26ba7d..b0706f2 100644
--- a/tempest/tests/common/test_service_clients.py
+++ b/tempest/tests/common/test_service_clients.py
@@ -19,11 +19,9 @@
from tempest.services.baremetal.v1.json import baremetal_client
from tempest.services.compute.json import floating_ips_client
from tempest.services.compute.json import interfaces_client
-from tempest.services.compute.json import quota_classes_client
from tempest.services.compute.json import security_group_rules_client
from tempest.services.compute.json import server_groups_client
from tempest.services.compute.json import servers_client
-from tempest.services.compute.json import services_client
from tempest.services.compute.json import volumes_client \
as compute_volumes_client
from tempest.services.data_processing.v1_1 import data_processing_client
@@ -90,11 +88,9 @@
baremetal_client.BaremetalClient,
floating_ips_client.FloatingIPsClient,
interfaces_client.InterfacesClient,
- quota_classes_client.QuotaClassesClient,
security_group_rules_client.SecurityGroupRulesClient,
server_groups_client.ServerGroupsClient,
servers_client.ServersClient,
- services_client.ServicesClient,
compute_volumes_client.VolumesClient,
data_processing_client.DataProcessingClient,
db_flavor_client.DatabaseFlavorsClient,
diff --git a/tempest/tests/common/utils/linux/test_remote_client.py b/tempest/tests/common/utils/linux/test_remote_client.py
index 3ff8e0d..e596aab 100644
--- a/tempest/tests/common/utils/linux/test_remote_client.py
+++ b/tempest/tests/common/utils/linux/test_remote_client.py
@@ -146,8 +146,11 @@
self._assert_exec_called_with(
"sudo ip addr add %s/%s dev %s" % (ip, '28', nic))
- def test_turn_nic_on(self):
+ def test_set_nic_state(self):
nic = 'eth0'
- self.conn.turn_nic_on(nic)
+ self.conn.set_nic_state(nic)
self._assert_exec_called_with(
'sudo ip link set %s up' % nic)
+ self.conn.set_nic_state(nic, "down")
+ self._assert_exec_called_with(
+ 'sudo ip link set %s down' % nic)
diff --git a/tempest/tests/services/compute/test_networks_client.py b/tempest/tests/services/compute/test_networks_client.py
deleted file mode 100644
index cec8262..0000000
--- a/tempest/tests/services/compute/test_networks_client.py
+++ /dev/null
@@ -1,95 +0,0 @@
-# Copyright 2015 NEC Corporation. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-from tempest_lib.tests import fake_auth_provider
-
-from tempest.services.compute.json import networks_client
-from tempest.tests.services.compute import base
-
-
-class TestNetworksClient(base.BaseComputeServiceTest):
-
- FAKE_NETWORK = {
- "bridge": None,
- "vpn_public_port": None,
- "dhcp_start": None,
- "bridge_interface": None,
- "share_address": None,
- "updated_at": None,
- "id": "34d5ae1e-5659-49cf-af80-73bccd7d7ad3",
- "cidr_v6": None,
- "deleted_at": None,
- "gateway": None,
- "rxtx_base": None,
- "label": u'30d7',
- "priority": None,
- "project_id": None,
- "vpn_private_address": None,
- "deleted": None,
- "vlan": None,
- "broadcast": None,
- "netmask": None,
- "injected": None,
- "cidr": None,
- "vpn_public_address": None,
- "multi_host": None,
- "enable_dhcp": None,
- "dns2": None,
- "created_at": None,
- "host": None,
- "mtu": None,
- "gateway_v6": None,
- "netmask_v6": None,
- "dhcp_server": None,
- "dns1": None
- }
-
- network_id = "34d5ae1e-5659-49cf-af80-73bccd7d7ad3"
-
- FAKE_NETWORKS = [FAKE_NETWORK]
-
- def setUp(self):
- super(TestNetworksClient, self).setUp()
- fake_auth = fake_auth_provider.FakeAuthProvider()
- self.client = networks_client.NetworksClient(
- fake_auth, 'compute', 'regionOne')
-
- def _test_list_networks(self, bytes_body=False):
- fake_list = {"networks": self.FAKE_NETWORKS}
- self.check_service_client_function(
- self.client.list_networks,
- 'tempest.common.service_client.ServiceClient.get',
- fake_list,
- bytes_body)
-
- def test_list_networks_with_str_body(self):
- self._test_list_networks()
-
- def test_list_networks_with_bytes_body(self):
- self._test_list_networks(bytes_body=True)
-
- def _test_show_network(self, bytes_body=False):
- self.check_service_client_function(
- self.client.show_network,
- 'tempest.common.service_client.ServiceClient.get',
- {"network": self.FAKE_NETWORK},
- bytes_body,
- network_id=self.network_id
- )
-
- def test_show_network_with_str_body(self):
- self._test_show_network()
-
- def test_show_network_with_bytes_body(self):
- self._test_show_network(bytes_body=True)
diff --git a/tempest/tests/services/compute/test_quota_classes_client.py b/tempest/tests/services/compute/test_quota_classes_client.py
deleted file mode 100644
index 29800a2..0000000
--- a/tempest/tests/services/compute/test_quota_classes_client.py
+++ /dev/null
@@ -1,72 +0,0 @@
-# Copyright 2015 NEC Corporation. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-import copy
-
-from tempest_lib.tests import fake_auth_provider
-
-from tempest.services.compute.json import quota_classes_client
-from tempest.tests.services.compute import base
-
-
-class TestQuotaClassesClient(base.BaseComputeServiceTest):
-
- FAKE_QUOTA_CLASS_SET = {
- "injected_file_content_bytes": 10240,
- "metadata_items": 128,
- "server_group_members": 10,
- "server_groups": 10,
- "ram": 51200,
- "floating_ips": 10,
- "key_pairs": 100,
- "id": u'\u2740(*\xb4\u25e1`*)\u2740',
- "instances": 10,
- "security_group_rules": 20,
- "security_groups": 10,
- "injected_files": 5,
- "cores": 20,
- "fixed_ips": -1,
- "injected_file_path_bytes": 255,
- }
-
- def setUp(self):
- super(TestQuotaClassesClient, self).setUp()
- fake_auth = fake_auth_provider.FakeAuthProvider()
- self.client = quota_classes_client.QuotaClassesClient(
- fake_auth, 'compute', 'regionOne')
-
- def _test_show_quota_class_set(self, bytes_body=False):
- fake_body = {'quota_class_set': self.FAKE_QUOTA_CLASS_SET}
- self.check_service_client_function(
- self.client.show_quota_class_set,
- 'tempest.common.service_client.ServiceClient.get',
- fake_body,
- bytes_body,
- quota_class_id="test")
-
- def test_show_quota_class_set_with_str_body(self):
- self._test_show_quota_class_set()
-
- def test_show_quota_class_set_with_bytes_body(self):
- self._test_show_quota_class_set(bytes_body=True)
-
- def test_update_quota_class_set(self):
- fake_quota_class_set = copy.deepcopy(self.FAKE_QUOTA_CLASS_SET)
- fake_quota_class_set.pop("id")
- fake_body = {'quota_class_set': fake_quota_class_set}
- self.check_service_client_function(
- self.client.update_quota_class_set,
- 'tempest.common.service_client.ServiceClient.put',
- fake_body,
- quota_class_id="test")
diff --git a/tempest/tests/services/compute/test_quotas_client.py b/tempest/tests/services/compute/test_quotas_client.py
deleted file mode 100644
index 9a9d8fe..0000000
--- a/tempest/tests/services/compute/test_quotas_client.py
+++ /dev/null
@@ -1,93 +0,0 @@
-# Copyright 2015 NEC Corporation. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-import copy
-
-from tempest_lib.tests import fake_auth_provider
-
-from tempest.services.compute.json import quotas_client
-from tempest.tests.services.compute import base
-
-
-class TestQuotasClient(base.BaseComputeServiceTest):
-
- FAKE_QUOTA_SET = {
- "quota_set": {
- "injected_file_content_bytes": 10240,
- "metadata_items": 128,
- "server_group_members": 10,
- "server_groups": 10,
- "ram": 51200,
- "floating_ips": 10,
- "key_pairs": 100,
- "id": "8421f7be61064f50b680465c07f334af",
- "instances": 10,
- "security_group_rules": 20,
- "injected_files": 5,
- "cores": 20,
- "fixed_ips": -1,
- "injected_file_path_bytes": 255,
- "security_groups": 10}
- }
-
- project_id = "8421f7be61064f50b680465c07f334af"
-
- def setUp(self):
- super(TestQuotasClient, self).setUp()
- fake_auth = fake_auth_provider.FakeAuthProvider()
- self.client = quotas_client.QuotasClient(
- fake_auth, 'compute', 'regionOne')
-
- def _test_show_quota_set(self, bytes_body=False):
- self.check_service_client_function(
- self.client.show_quota_set,
- 'tempest.common.service_client.ServiceClient.get',
- self.FAKE_QUOTA_SET,
- to_utf=bytes_body,
- tenant_id=self.project_id)
-
- def test_show_quota_set_with_str_body(self):
- self._test_show_quota_set()
-
- def test_show_quota_set_with_bytes_body(self):
- self._test_show_quota_set(bytes_body=True)
-
- def _test_show_default_quota_set(self, bytes_body=False):
- self.check_service_client_function(
- self.client.show_default_quota_set,
- 'tempest.common.service_client.ServiceClient.get',
- self.FAKE_QUOTA_SET,
- to_utf=bytes_body,
- tenant_id=self.project_id)
-
- def test_show_default_quota_set_with_str_body(self):
- self._test_show_quota_set()
-
- def test_show_default_quota_set_with_bytes_body(self):
- self._test_show_quota_set(bytes_body=True)
-
- def test_update_quota_set(self):
- fake_quota_set = copy.deepcopy(self.FAKE_QUOTA_SET)
- fake_quota_set['quota_set'].pop("id")
- self.check_service_client_function(
- self.client.update_quota_set,
- 'tempest.common.service_client.ServiceClient.put',
- fake_quota_set,
- tenant_id=self.project_id)
-
- def test_delete_quota_set(self):
- self.check_service_client_function(
- self.client.delete_quota_set,
- 'tempest.common.service_client.ServiceClient.delete',
- {}, status=202, tenant_id=self.project_id)
diff --git a/tempest/tests/services/compute/test_security_group_default_rules_client.py b/tempest/tests/services/compute/test_security_group_default_rules_client.py
deleted file mode 100644
index 99ab305..0000000
--- a/tempest/tests/services/compute/test_security_group_default_rules_client.py
+++ /dev/null
@@ -1,89 +0,0 @@
-# Copyright 2015 NEC Corporation. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-from tempest_lib.tests import fake_auth_provider
-
-from tempest.services.compute.json import security_group_default_rules_client
-from tempest.tests.services.compute import base
-
-
-class TestSecurityGroupDefaultRulesClient(base.BaseComputeServiceTest):
- FAKE_RULE = {
- "from_port": 80,
- "id": 1,
- "ip_protocol": "TCP",
- "ip_range": {
- "cidr": "10.10.10.0/24"
- },
- "to_port": 80
- }
-
- def setUp(self):
- super(TestSecurityGroupDefaultRulesClient, self).setUp()
- fake_auth = fake_auth_provider.FakeAuthProvider()
- self.client = (security_group_default_rules_client.
- SecurityGroupDefaultRulesClient(fake_auth, 'compute',
- 'regionOne'))
-
- def _test_list_security_group_default_rules(self, bytes_body=False):
- self.check_service_client_function(
- self.client.list_security_group_default_rules,
- 'tempest.common.service_client.ServiceClient.get',
- {"security_group_default_rules": [self.FAKE_RULE]},
- to_utf=bytes_body)
-
- def test_list_security_group_default_rules_with_str_body(self):
- self._test_list_security_group_default_rules()
-
- def test_list_security_group_default_rules_with_bytes_body(self):
- self._test_list_security_group_default_rules(bytes_body=True)
-
- def _test_show_security_group_default_rule(self, bytes_body=False):
- self.check_service_client_function(
- self.client.show_security_group_default_rule,
- 'tempest.common.service_client.ServiceClient.get',
- {"security_group_default_rule": self.FAKE_RULE},
- to_utf=bytes_body,
- security_group_default_rule_id=1)
-
- def test_show_security_group_default_rule_with_str_body(self):
- self._test_show_security_group_default_rule()
-
- def test_show_security_group_default_rule_with_bytes_body(self):
- self._test_show_security_group_default_rule(bytes_body=True)
-
- def _test_create_security_default_group_rule(self, bytes_body=False):
- request_body = {
- "to_port": 80,
- "from_port": 80,
- "ip_protocol": "TCP",
- "cidr": "10.10.10.0/24"
- }
- self.check_service_client_function(
- self.client.create_security_default_group_rule,
- 'tempest.common.service_client.ServiceClient.post',
- {"security_group_default_rule": self.FAKE_RULE},
- to_utf=bytes_body, **request_body)
-
- def test_create_security_default_group_rule_with_str_body(self):
- self._test_create_security_default_group_rule()
-
- def test_create_security_default_group_rule_with_bytes_body(self):
- self._test_create_security_default_group_rule(bytes_body=True)
-
- def test_delete_security_group_default_rule(self):
- self.check_service_client_function(
- self.client.delete_security_group_default_rule,
- 'tempest.common.service_client.ServiceClient.delete',
- {}, status=204, security_group_default_rule_id=1)
diff --git a/tempest/tests/services/compute/test_security_groups_client.py b/tempest/tests/services/compute/test_security_groups_client.py
deleted file mode 100644
index 9e40b96..0000000
--- a/tempest/tests/services/compute/test_security_groups_client.py
+++ /dev/null
@@ -1,113 +0,0 @@
-# Copyright 2015 NEC Corporation. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-from oslotest import mockpatch
-from tempest_lib import exceptions as lib_exc
-from tempest_lib.tests import fake_auth_provider
-
-from tempest.services.compute.json import security_groups_client
-from tempest.tests.services.compute import base
-
-
-class TestSecurityGroupsClient(base.BaseComputeServiceTest):
-
- FAKE_SECURITY_GROUP_INFO = [{
- "description": "default",
- "id": "3fb26eb3-581b-4420-9963-b0879a026506",
- "name": "default",
- "rules": [],
- "tenant_id": "openstack"
- }]
-
- def setUp(self):
- super(TestSecurityGroupsClient, self).setUp()
- fake_auth = fake_auth_provider.FakeAuthProvider()
- self.client = security_groups_client.SecurityGroupsClient(
- fake_auth, 'compute', 'regionOne')
-
- def _test_list_security_groups(self, bytes_body=False):
- self.check_service_client_function(
- self.client.list_security_groups,
- 'tempest.common.service_client.ServiceClient.get',
- {"security_groups": self.FAKE_SECURITY_GROUP_INFO},
- to_utf=bytes_body)
-
- def test_list_security_groups_with_str_body(self):
- self._test_list_security_groups()
-
- def test_list_security_groups_with_bytes_body(self):
- self._test_list_security_groups(bytes_body=True)
-
- def _test_show_security_group(self, bytes_body=False):
- self.check_service_client_function(
- self.client.show_security_group,
- 'tempest.common.service_client.ServiceClient.get',
- {"security_group": self.FAKE_SECURITY_GROUP_INFO[0]},
- to_utf=bytes_body,
- security_group_id='fake-id')
-
- def test_show_security_group_with_str_body(self):
- self._test_show_security_group()
-
- def test_show_security_group_with_bytes_body(self):
- self._test_show_security_group(bytes_body=True)
-
- def _test_create_security_group(self, bytes_body=False):
- post_body = {"name": "test", "description": "test_group"}
- self.check_service_client_function(
- self.client.create_security_group,
- 'tempest.common.service_client.ServiceClient.post',
- {"security_group": self.FAKE_SECURITY_GROUP_INFO[0]},
- to_utf=bytes_body,
- kwargs=post_body)
-
- def test_create_security_group_with_str_body(self):
- self._test_create_security_group()
-
- def test_create_security_group_with_bytes_body(self):
- self._test_create_security_group(bytes_body=True)
-
- def _test_update_security_group(self, bytes_body=False):
- req_body = {"name": "test", "description": "test_group"}
- self.check_service_client_function(
- self.client.update_security_group,
- 'tempest.common.service_client.ServiceClient.put',
- {"security_group": self.FAKE_SECURITY_GROUP_INFO[0]},
- to_utf=bytes_body,
- security_group_id='fake-id',
- kwargs=req_body)
-
- def test_update_security_group_with_str_body(self):
- self._test_update_security_group()
-
- def test_update_security_group_with_bytes_body(self):
- self._test_update_security_group(bytes_body=True)
-
- def test_delete_security_group(self):
- self.check_service_client_function(
- self.client.delete_security_group,
- 'tempest.common.service_client.ServiceClient.delete',
- {}, status=202, security_group_id='fake-id')
-
- def test_is_resource_deleted_true(self):
- mod = ('tempest.services.compute.json.security_groups_client.'
- 'SecurityGroupsClient.show_security_group')
- self.useFixture(mockpatch.Patch(mod, side_effect=lib_exc.NotFound))
- self.assertTrue(self.client.is_resource_deleted('fake-id'))
-
- def test_is_resource_deleted_false(self):
- mod = ('tempest.services.compute.json.security_groups_client.'
- 'SecurityGroupsClient.show_security_group')
- self.useFixture(mockpatch.Patch(mod, return_value='success'))
- self.assertFalse(self.client.is_resource_deleted('fake-id'))
diff --git a/tempest/tests/services/compute/test_services_client.py b/tempest/tests/services/compute/test_services_client.py
deleted file mode 100644
index fce28e8..0000000
--- a/tempest/tests/services/compute/test_services_client.py
+++ /dev/null
@@ -1,95 +0,0 @@
-# Copyright 2015 NEC Corporation. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-import copy
-
-from tempest_lib.tests import fake_auth_provider
-
-from tempest.services.compute.json import services_client
-from tempest.tests.services.compute import base
-
-
-class TestServicesClient(base.BaseComputeServiceTest):
-
- FAKE_SERVICES = {
- "services":
- [{
- "status": "enabled",
- "binary": "nova-conductor",
- "zone": "internal",
- "state": "up",
- "updated_at": "2015-08-19T06:50:55.000000",
- "host": "controller",
- "disabled_reason": None,
- "id": 1
- }]
- }
-
- FAKE_SERVICE = {
- "service":
- {
- "status": "enabled",
- "binary": "nova-conductor",
- "host": "controller"
- }
- }
-
- def setUp(self):
- super(TestServicesClient, self).setUp()
- fake_auth = fake_auth_provider.FakeAuthProvider()
- self.client = services_client.ServicesClient(
- fake_auth, 'compute', 'regionOne')
-
- def test_list_services_with_str_body(self):
- self.check_service_client_function(
- self.client.list_services,
- 'tempest.common.service_client.ServiceClient.get',
- self.FAKE_SERVICES)
-
- def test_list_services_with_bytes_body(self):
- self.check_service_client_function(
- self.client.list_services,
- 'tempest.common.service_client.ServiceClient.get',
- self.FAKE_SERVICES, to_utf=True)
-
- def _test_enable_service(self, bytes_body=False):
- self.check_service_client_function(
- self.client.enable_service,
- 'tempest.common.service_client.ServiceClient.put',
- self.FAKE_SERVICE,
- bytes_body,
- host_name="nova-conductor", binary="controller")
-
- def test_enable_service_with_str_body(self):
- self._test_enable_service()
-
- def test_enable_service_with_bytes_body(self):
- self._test_enable_service(bytes_body=True)
-
- def _test_disable_service(self, bytes_body=False):
- fake_service = copy.deepcopy(self.FAKE_SERVICE)
- fake_service["service"]["status"] = "disable"
-
- self.check_service_client_function(
- self.client.disable_service,
- 'tempest.common.service_client.ServiceClient.put',
- fake_service,
- bytes_body,
- host_name="nova-conductor", binary="controller")
-
- def test_disable_service_with_str_body(self):
- self._test_disable_service()
-
- def test_disable_service_with_bytes_body(self):
- self._test_disable_service(bytes_body=True)
diff --git a/tempest/tests/services/compute/test_snapshots_client.py b/tempest/tests/services/compute/test_snapshots_client.py
deleted file mode 100644
index c24c6ae..0000000
--- a/tempest/tests/services/compute/test_snapshots_client.py
+++ /dev/null
@@ -1,103 +0,0 @@
-# Copyright 2015 NEC Corporation. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-from oslotest import mockpatch
-from tempest_lib import exceptions as lib_exc
-
-from tempest.services.compute.json import snapshots_client
-from tempest.tests import fake_auth_provider
-from tempest.tests.services.compute import base
-
-
-class TestSnapshotsClient(base.BaseComputeServiceTest):
-
- FAKE_SNAPSHOT = {
- "createdAt": "2015-10-02T16:27:54.724209",
- "displayDescription": u"Another \u1234.",
- "displayName": u"v\u1234-001",
- "id": "100",
- "size": 100,
- "status": "available",
- "volumeId": "12"
- }
-
- FAKE_SNAPSHOTS = {"snapshots": [FAKE_SNAPSHOT]}
-
- def setUp(self):
- super(TestSnapshotsClient, self).setUp()
- fake_auth = fake_auth_provider.FakeAuthProvider()
- self.client = snapshots_client.SnapshotsClient(
- fake_auth, 'compute', 'regionOne')
-
- def _test_create_snapshot(self, bytes_body=False):
- self.check_service_client_function(
- self.client.create_snapshot,
- 'tempest.common.service_client.ServiceClient.post',
- {"snapshot": self.FAKE_SNAPSHOT},
- to_utf=bytes_body, status=200,
- volume_id=self.FAKE_SNAPSHOT["volumeId"])
-
- def test_create_snapshot_with_str_body(self):
- self._test_create_snapshot()
-
- def test_create_shapshot_with_bytes_body(self):
- self._test_create_snapshot(bytes_body=True)
-
- def _test_show_snapshot(self, bytes_body=False):
- self.check_service_client_function(
- self.client.show_snapshot,
- 'tempest.common.service_client.ServiceClient.get',
- {"snapshot": self.FAKE_SNAPSHOT},
- to_utf=bytes_body, snapshot_id=self.FAKE_SNAPSHOT["id"])
-
- def test_show_snapshot_with_str_body(self):
- self._test_show_snapshot()
-
- def test_show_snapshot_with_bytes_body(self):
- self._test_show_snapshot(bytes_body=True)
-
- def _test_list_snapshots(self, bytes_body=False, **params):
- self.check_service_client_function(
- self.client.list_snapshots,
- 'tempest.common.service_client.ServiceClient.get',
- self.FAKE_SNAPSHOTS, to_utf=bytes_body, **params)
-
- def test_list_snapshots_with_str_body(self):
- self._test_list_snapshots()
-
- def test_list_snapshots_with_byte_body(self):
- self._test_list_snapshots(bytes_body=True)
-
- def test_list_snapshots_with_params(self):
- self._test_list_snapshots('fake')
-
- def test_delete_snapshot(self):
- self.check_service_client_function(
- self.client.delete_snapshot,
- 'tempest.common.service_client.ServiceClient.delete',
- {}, status=202, snapshot_id=self.FAKE_SNAPSHOT['id'])
-
- def test_is_resource_deleted_true(self):
- module = ('tempest.services.compute.json.snapshots_client.'
- 'SnapshotsClient.show_snapshot')
- self.useFixture(mockpatch.Patch(
- module, side_effect=lib_exc.NotFound))
- self.assertTrue(self.client.is_resource_deleted('fake-id'))
-
- def test_is_resource_deleted_false(self):
- module = ('tempest.services.compute.json.snapshots_client.'
- 'SnapshotsClient.show_snapshot')
- self.useFixture(mockpatch.Patch(
- module, return_value={}))
- self.assertFalse(self.client.is_resource_deleted('fake-id'))
diff --git a/tempest/tests/services/compute/test_tenant_networks_client.py b/tempest/tests/services/compute/test_tenant_networks_client.py
deleted file mode 100644
index 691792a..0000000
--- a/tempest/tests/services/compute/test_tenant_networks_client.py
+++ /dev/null
@@ -1,64 +0,0 @@
-# Copyright 2015 NEC Corporation. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-from tempest_lib.tests import fake_auth_provider
-
-from tempest.services.compute.json import tenant_networks_client
-from tempest.tests.services.compute import base
-
-
-class TestTenantNetworksClient(base.BaseComputeServiceTest):
-
- FAKE_NETWORK = {
- "cidr": "None",
- "id": "c2329eb4-cc8e-4439-ac4c-932369309e36",
- "label": u'\u30d7'
- }
-
- FAKE_NETWORKS = [FAKE_NETWORK]
-
- NETWORK_ID = FAKE_NETWORK['id']
-
- def setUp(self):
- super(TestTenantNetworksClient, self).setUp()
- fake_auth = fake_auth_provider.FakeAuthProvider()
- self.client = tenant_networks_client.TenantNetworksClient(
- fake_auth, 'compute', 'regionOne')
-
- def _test_list_tenant_networks(self, bytes_body=False):
- self.check_service_client_function(
- self.client.list_tenant_networks,
- 'tempest.common.service_client.ServiceClient.get',
- {"networks": self.FAKE_NETWORKS},
- bytes_body)
-
- def test_list_tenant_networks_with_str_body(self):
- self._test_list_tenant_networks()
-
- def test_list_tenant_networks_with_bytes_body(self):
- self._test_list_tenant_networks(bytes_body=True)
-
- def _test_show_tenant_network(self, bytes_body=False):
- self.check_service_client_function(
- self.client.show_tenant_network,
- 'tempest.common.service_client.ServiceClient.get',
- {"network": self.FAKE_NETWORK},
- bytes_body,
- network_id=self.NETWORK_ID)
-
- def test_show_tenant_network_with_str_body(self):
- self._test_show_tenant_network()
-
- def test_show_tenant_network_with_bytes_body(self):
- self._test_show_tenant_network(bytes_body=True)
diff --git a/tempest/tests/services/compute/test_tenant_usages_client.py b/tempest/tests/services/compute/test_tenant_usages_client.py
deleted file mode 100644
index 58e0b7a..0000000
--- a/tempest/tests/services/compute/test_tenant_usages_client.py
+++ /dev/null
@@ -1,80 +0,0 @@
-# Copyright 2015 NEC Corporation. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-from tempest_lib.tests import fake_auth_provider
-
-from tempest.services.compute.json import tenant_usages_client
-from tempest.tests.services.compute import base
-
-
-class TestTenantUsagesClient(base.BaseComputeServiceTest):
-
- FAKE_SERVER_USAGES = [{
- "ended_at": None,
- "flavor": "m1.tiny",
- "hours": 1.0,
- "instance_id": "1f1deceb-17b5-4c04-84c7-e0d4499c8fe0",
- "local_gb": 1,
- "memory_mb": 512,
- "name": "new-server-test",
- "started_at": "2012-10-08T20:10:44.541277",
- "state": "active",
- "tenant_id": "openstack",
- "uptime": 3600,
- "vcpus": 1
- }]
-
- FAKE_TENANT_USAGES = [{
- "server_usages": FAKE_SERVER_USAGES,
- "start": "2012-10-08T21:10:44.587336",
- "stop": "2012-10-08T22:10:44.587336",
- "tenant_id": "openstack",
- "total_hours": 1,
- "total_local_gb_usage": 1,
- "total_memory_mb_usage": 512,
- "total_vcpus_usage": 1
- }]
-
- def setUp(self):
- super(TestTenantUsagesClient, self).setUp()
- fake_auth = fake_auth_provider.FakeAuthProvider()
- self.client = tenant_usages_client.TenantUsagesClient(
- fake_auth, 'compute', 'regionOne')
-
- def _test_list_tenant_usages(self, bytes_body=False):
- self.check_service_client_function(
- self.client.list_tenant_usages,
- 'tempest.common.service_client.ServiceClient.get',
- {"tenant_usages": self.FAKE_TENANT_USAGES},
- to_utf=bytes_body)
-
- def test_list_tenant_usages_with_str_body(self):
- self._test_list_tenant_usages()
-
- def test_list_tenant_usages_with_bytes_body(self):
- self._test_list_tenant_usages(bytes_body=True)
-
- def _test_show_tenant_usage(self, bytes_body=False):
- self.check_service_client_function(
- self.client.show_tenant_usage,
- 'tempest.common.service_client.ServiceClient.get',
- {"tenant_usage": self.FAKE_TENANT_USAGES[0]},
- to_utf=bytes_body,
- tenant_id='openstack')
-
- def test_show_tenant_usage_with_str_body(self):
- self._test_show_tenant_usage()
-
- def test_show_tenant_usage_with_bytes_body(self):
- self._test_show_tenant_usage(bytes_body=True)
diff --git a/tempest/thirdparty/boto/test_ec2_instance_run.py b/tempest/thirdparty/boto/test_ec2_instance_run.py
index 49a1854..6c1b362 100644
--- a/tempest/thirdparty/boto/test_ec2_instance_run.py
+++ b/tempest/thirdparty/boto/test_ec2_instance_run.py
@@ -175,23 +175,23 @@
instance.add_tag('key1', value='value1')
tags = self.ec2_client.get_all_tags()
- td = {item.name: item.value for item in tags}
+ td = dict((item.name, item.value) for item in tags)
self.assertIn('key1', td)
self.assertEqual('value1', td['key1'])
tags = self.ec2_client.get_all_tags(filters={'key': 'key1'})
- td = {item.name: item.value for item in tags}
+ td = dict((item.name, item.value) for item in tags)
self.assertIn('key1', td)
self.assertEqual('value1', td['key1'])
tags = self.ec2_client.get_all_tags(filters={'value': 'value1'})
- td = {item.name: item.value for item in tags}
+ td = dict((item.name, item.value) for item in tags)
self.assertIn('key1', td)
self.assertEqual('value1', td['key1'])
tags = self.ec2_client.get_all_tags(filters={'key': 'value2'})
- td = {item.name: item.value for item in tags}
+ td = dict((item.name, item.value) for item in tags)
self.assertNotIn('key1', td)
for instance in reservation.instances: