Merge "Full response for missed IdentityV2Client methods"
diff --git a/tempest/api/compute/admin/test_flavors.py b/tempest/api/compute/admin/test_flavors.py
index 42a2984..085916e 100644
--- a/tempest/api/compute/admin/test_flavors.py
+++ b/tempest/api/compute/admin/test_flavors.py
@@ -221,7 +221,8 @@
# Verify flavor is not used by other user
self.assertRaises(lib_exc.BadRequest,
self.os.servers_client.create_server,
- 'test', self.image_ref, flavor['id'])
+ name='test', imageRef=self.image_ref,
+ flavorRef=flavor['id'])
@test.idempotent_id('b345b196-bfbd-4231-8ac1-6d7fe15ff3a3')
def test_list_public_flavor_with_other_user(self):
diff --git a/tempest/api/compute/admin/test_servers.py b/tempest/api/compute/admin/test_servers.py
index 1849f83..dfaa5d5 100644
--- a/tempest/api/compute/admin/test_servers.py
+++ b/tempest/api/compute/admin/test_servers.py
@@ -111,7 +111,8 @@
image_id = self.image_ref
network = self.get_tenant_network()
network_kwargs = fixed_network.set_networks_kwarg(network)
- test_server = self.client.create_server(name, image_id, flavor,
+ test_server = self.client.create_server(name=name, imageRef=image_id,
+ flavorRef=flavor,
**network_kwargs)['server']
self.addCleanup(self.client.delete_server, test_server['id'])
waiters.wait_for_server_status(self.client,
@@ -198,5 +199,5 @@
hints = {
'same_host': self.s1_id
}
- self.create_test_server(sched_hints=hints,
+ self.create_test_server(scheduler_hints=hints,
wait_until='ACTIVE')
diff --git a/tempest/api/compute/limits/test_absolute_limits_negative.py b/tempest/api/compute/limits/test_absolute_limits_negative.py
index 5755f5b..73e852f 100644
--- a/tempest/api/compute/limits/test_absolute_limits_negative.py
+++ b/tempest/api/compute/limits/test_absolute_limits_negative.py
@@ -55,4 +55,4 @@
# A 403 Forbidden or 413 Overlimit (old behaviour) exception
# will be raised when out of quota
self.assertRaises((lib_exc.Forbidden, lib_exc.OverLimit),
- self.create_test_server, meta=meta_data)
+ self.create_test_server, metadata=meta_data)
diff --git a/tempest/api/compute/servers/test_attach_interfaces.py b/tempest/api/compute/servers/test_attach_interfaces.py
index 530e422..24d503f 100644
--- a/tempest/api/compute/servers/test_attach_interfaces.py
+++ b/tempest/api/compute/servers/test_attach_interfaces.py
@@ -186,7 +186,7 @@
self.assertTrue(interface_count > 0)
self._check_interface(ifs[0])
network_id = ifs[0]['net_id']
- self.client.add_fixed_ip(server['id'], networkId=network_id)
+ self.servers_client.add_fixed_ip(server['id'], networkId=network_id)
# Remove the fixed IP from server.
server_detail = self.os.servers_client.show_server(
server['id'])['server']
@@ -199,4 +199,4 @@
break
if fixed_ip is not None:
break
- self.client.remove_fixed_ip(server['id'], address=fixed_ip)
+ self.servers_client.remove_fixed_ip(server['id'], address=fixed_ip)
diff --git a/tempest/api/compute/servers/test_create_server.py b/tempest/api/compute/servers/test_create_server.py
index 419bfd7..68af81c 100644
--- a/tempest/api/compute/servers/test_create_server.py
+++ b/tempest/api/compute/servers/test_create_server.py
@@ -58,7 +58,7 @@
validatable=True,
wait_until='ACTIVE',
name=cls.name,
- meta=cls.meta,
+ metadata=cls.meta,
accessIPv4=cls.accessIPv4,
accessIPv6=cls.accessIPv6,
personality=personality,
@@ -150,7 +150,7 @@
group_id)
hints = {'group': group_id}
- server = self.create_test_server(sched_hints=hints,
+ server = self.create_test_server(scheduler_hints=hints,
wait_until='ACTIVE')
# Check a server is in the group
diff --git a/tempest/api/compute/servers/test_server_actions.py b/tempest/api/compute/servers/test_server_actions.py
index c394e44..f0cd2a1 100644
--- a/tempest/api/compute/servers/test_server_actions.py
+++ b/tempest/api/compute/servers/test_server_actions.py
@@ -374,7 +374,7 @@
# for a given server_id and number of lines
# This reboot is necessary for outputting some console log after
- # creating a instance backup. If a instance backup, the console
+ # creating an instance backup. If an instance backup, the console
# log file is truncated and we cannot get any console log through
# "console-log" API.
# The detail is https://bugs.launchpad.net/nova/+bug/1251920
diff --git a/tempest/api/compute/servers/test_server_metadata.py b/tempest/api/compute/servers/test_server_metadata.py
index f9e8b4f..77ddb3b 100644
--- a/tempest/api/compute/servers/test_server_metadata.py
+++ b/tempest/api/compute/servers/test_server_metadata.py
@@ -28,7 +28,7 @@
@classmethod
def resource_setup(cls):
super(ServerMetadataTestJSON, cls).resource_setup()
- server = cls.create_test_server(meta={}, wait_until='ACTIVE')
+ server = cls.create_test_server(metadata={}, wait_until='ACTIVE')
cls.server_id = server['id']
def setUp(self):
diff --git a/tempest/api/compute/servers/test_server_metadata_negative.py b/tempest/api/compute/servers/test_server_metadata_negative.py
index 5804dbe..cee60fb 100644
--- a/tempest/api/compute/servers/test_server_metadata_negative.py
+++ b/tempest/api/compute/servers/test_server_metadata_negative.py
@@ -32,7 +32,7 @@
def resource_setup(cls):
super(ServerMetadataNegativeTestJSON, cls).resource_setup()
cls.tenant_id = cls.client.tenant_id
- server = cls.create_test_server(meta={}, wait_until='ACTIVE')
+ server = cls.create_test_server(metadata={}, wait_until='ACTIVE')
cls.server_id = server['id']
@@ -48,7 +48,7 @@
meta = {key: 'data1'}
self.assertRaises((lib_exc.BadRequest, lib_exc.OverLimit),
self.create_test_server,
- meta=meta)
+ metadata=meta)
# no teardown - all creates should fail
@@ -59,7 +59,7 @@
meta = {'': 'data1'}
self.assertRaises(lib_exc.BadRequest,
self.create_test_server,
- meta=meta)
+ metadata=meta)
@test.attr(type=['negative'])
@test.idempotent_id('4d9cd7a3-2010-4b41-b8fe-3bbf0b169466')
diff --git a/tempest/api/compute/servers/test_servers_negative.py b/tempest/api/compute/servers/test_servers_negative.py
index dbaa6a1..6946be4 100644
--- a/tempest/api/compute/servers/test_servers_negative.py
+++ b/tempest/api/compute/servers/test_servers_negative.py
@@ -236,7 +236,7 @@
metadata = {'a': 'b' * 260}
self.assertRaises((lib_exc.BadRequest, lib_exc.OverLimit),
self.create_test_server,
- meta=metadata)
+ metadata=metadata)
@test.attr(type=['negative'])
@test.idempotent_id('aa8eed43-e2cb-4ebf-930b-da14f6a21d81')
diff --git a/tempest/api/compute/test_authorization.py b/tempest/api/compute/test_authorization.py
index e60874f..484c156 100644
--- a/tempest/api/compute/test_authorization.py
+++ b/tempest/api/compute/test_authorization.py
@@ -181,7 +181,8 @@
def test_create_server_with_unauthorized_image(self):
# Server creation with another user's image should fail
self.assertRaises(lib_exc.BadRequest, self.alt_client.create_server,
- 'test', self.image['id'], self.flavor_ref)
+ name='test', imageRef=self.image['id'],
+ flavorRef=self.flavor_ref)
@test.idempotent_id('acf8724b-142b-4044-82c3-78d31a533f24')
def test_create_server_fails_when_tenant_incorrect(self):
@@ -193,8 +194,8 @@
auth_data=self.client.auth_provider.auth_data
)
self.assertRaises(lib_exc.BadRequest,
- self.alt_client.create_server, 'test',
- self.image['id'], self.flavor_ref)
+ self.alt_client.create_server, name='test',
+ imageRef=self.image['id'], flavorRef=self.flavor_ref)
@test.idempotent_id('f03d1ded-7fd4-4d29-bc13-e2391f29c625')
def test_create_keypair_in_analt_user_tenant(self):
diff --git a/tempest/api/database/limits/test_limits.py b/tempest/api/database/limits/test_limits.py
index 4b7f2d6..ee51b1d 100644
--- a/tempest/api/database/limits/test_limits.py
+++ b/tempest/api/database/limits/test_limits.py
@@ -27,7 +27,7 @@
@test.attr(type='smoke')
@test.idempotent_id('73024538-f316-4829-b3e9-b459290e137a')
def test_absolute_limits(self):
- # Test to verify if all absolute limit paramaters are
+ # Test to verify if all absolute limit parameters are
# present when verb is ABSOLUTE
limits = self.client.list_db_limits()['limits']
expected_abs_limits = ['max_backups', 'max_volumes',
diff --git a/tempest/api/volume/test_volumes_snapshots.py b/tempest/api/volume/test_volumes_snapshots.py
index 7eaa9cc..9866da3 100644
--- a/tempest/api/volume/test_volumes_snapshots.py
+++ b/tempest/api/volume/test_volumes_snapshots.py
@@ -85,9 +85,7 @@
snapshot = self.create_snapshot(self.volume_origin['id'],
force=True)
# Delete the snapshot
- self.snapshots_client.delete_snapshot(snapshot['id'])
- self.snapshots_client.wait_for_resource_deletion(snapshot['id'])
- self.snapshots.remove(snapshot)
+ self.cleanup_snapshot(snapshot)
@test.idempotent_id('2a8abbe4-d871-46db-b049-c41f5af8216e')
def test_snapshot_create_get_list_update_delete(self):
@@ -126,9 +124,7 @@
self.assertEqual(new_desc, updated_snapshot[self.descrip_field])
# Delete the snapshot
- self.snapshots_client.delete_snapshot(snapshot['id'])
- self.snapshots_client.wait_for_resource_deletion(snapshot['id'])
- self.snapshots.remove(snapshot)
+ self.cleanup_snapshot(snapshot)
@test.idempotent_id('59f41f43-aebf-48a9-ab5d-d76340fab32b')
def test_snapshots_list_with_params(self):
@@ -137,6 +133,7 @@
display_name = data_utils.rand_name('snap')
params = {self.name_field: display_name}
snapshot = self.create_snapshot(self.volume_origin['id'], **params)
+ self.addCleanup(self.cleanup_snapshot, snapshot)
# Verify list snapshots by display_name filter
params = {self.name_field: snapshot[self.name_field]}
@@ -158,6 +155,7 @@
display_name = data_utils.rand_name('snap')
params = {self.name_field: display_name}
snapshot = self.create_snapshot(self.volume_origin['id'], **params)
+ self.addCleanup(self.cleanup_snapshot, snapshot)
# Verify list snapshot details by display_name filter
params = {self.name_field: snapshot[self.name_field]}
@@ -181,7 +179,13 @@
self.volumes_client.wait_for_volume_status(volume['id'], 'available')
self.volumes_client.delete_volume(volume['id'])
self.volumes_client.wait_for_resource_deletion(volume['id'])
- self.clear_snapshots()
+ self.cleanup_snapshot(snapshot)
+
+ def cleanup_snapshot(self, snapshot):
+ # Delete the snapshot
+ self.snapshots_client.delete_snapshot(snapshot['id'])
+ self.snapshots_client.wait_for_resource_deletion(snapshot['id'])
+ self.snapshots.remove(snapshot)
class VolumesV1SnapshotTestJSON(VolumesV2SnapshotTestJSON):
diff --git a/tempest/cmd/javelin.py b/tempest/cmd/javelin.py
index 380be8f..2dbcd98 100755
--- a/tempest/cmd/javelin.py
+++ b/tempest/cmd/javelin.py
@@ -869,7 +869,8 @@
kwargs['networks'] = [{'uuid': get_net_id(network)}
for network in server['networks']]
body = client.servers.create_server(
- server['name'], image_id, flavor_id, **kwargs)['server']
+ name=server['name'], imageRef=image_id, flavorRef=flavor_id,
+ **kwargs)['server']
server_id = body['id']
client.servers.wait_for_server_status(server_id, 'ACTIVE')
# create security group(s) after server spawning
diff --git a/tempest/cmd/verify_tempest_config.py b/tempest/cmd/verify_tempest_config.py
index 6d53b59..4fcdf8b 100755
--- a/tempest/cmd/verify_tempest_config.py
+++ b/tempest/cmd/verify_tempest_config.py
@@ -65,10 +65,10 @@
# Check glance api versions
_, versions = os.image_client.get_versions()
if CONF.image_feature_enabled.api_v1 != contains_version('v1.', versions):
- print_and_or_update('api_v1', 'image_feature_enabled',
+ print_and_or_update('api_v1', 'image-feature-enabled',
not CONF.image_feature_enabled.api_v1, update)
if CONF.image_feature_enabled.api_v2 != contains_version('v2.', versions):
- print_and_or_update('api_v2', 'image_feature_enabled',
+ print_and_or_update('api_v2', 'image-feature-enabled',
not CONF.image_feature_enabled.api_v2, update)
@@ -105,11 +105,11 @@
versions = _get_api_versions(os, 'keystone')
if (CONF.identity_feature_enabled.api_v2 !=
contains_version('v2.', versions)):
- print_and_or_update('api_v2', 'identity_feature_enabled',
+ print_and_or_update('api_v2', 'identity-feature-enabled',
not CONF.identity_feature_enabled.api_v2, update)
if (CONF.identity_feature_enabled.api_v3 !=
contains_version('v3.', versions)):
- print_and_or_update('api_v3', 'identity_feature_enabled',
+ print_and_or_update('api_v3', 'identity-feature-enabled',
not CONF.identity_feature_enabled.api_v3, update)
@@ -118,11 +118,11 @@
versions = _get_api_versions(os, 'cinder')
if (CONF.volume_feature_enabled.api_v1 !=
contains_version('v1.', versions)):
- print_and_or_update('api_v1', 'volume_feature_enabled',
+ print_and_or_update('api_v1', 'volume-feature-enabled',
not CONF.volume_feature_enabled.api_v1, update)
if (CONF.volume_feature_enabled.api_v2 !=
contains_version('v2.', versions)):
- print_and_or_update('api_v2', 'volume_feature_enabled',
+ print_and_or_update('api_v2', 'volume-feature-enabled',
not CONF.volume_feature_enabled.api_v2, update)
diff --git a/tempest/common/compute.py b/tempest/common/compute.py
index a76696e..176be51 100644
--- a/tempest/common/compute.py
+++ b/tempest/common/compute.py
@@ -34,7 +34,7 @@
This method is a common wrapper returning a test server that can be
pingable or sshable.
- :param clients: Client manager which provides Openstack Tempest clients.
+ :param clients: Client manager which provides OpenStack Tempest clients.
:param validatable: Whether the server will be pingable or sshable.
:param validation_resources: Resources created for the connection to the
server. Include a keypair, a security group and an IP.
@@ -51,8 +51,8 @@
else:
name = data_utils.rand_name(__name__ + "-instance")
- flavor = kwargs.get('flavor', CONF.compute.flavor_ref)
- image_id = kwargs.get('image_id', CONF.compute.image_ref)
+ flavor = kwargs.pop('flavor', CONF.compute.flavor_ref)
+ image_id = kwargs.pop('image_id', CONF.compute.image_ref)
kwargs = fixed_network.set_networks_kwarg(
tenant_network, kwargs) or {}
@@ -85,7 +85,8 @@
if wait_until is None:
wait_until = 'ACTIVE'
- body = clients.servers_client.create_server(name, image_id, flavor,
+ body = clients.servers_client.create_server(name=name, imageRef=image_id,
+ flavorRef=flavor,
**kwargs)
# handle the case of multiple servers
diff --git a/tempest/common/utils/linux/remote_client.py b/tempest/common/utils/linux/remote_client.py
index a567c6a..9308390 100644
--- a/tempest/common/utils/linux/remote_client.py
+++ b/tempest/common/utils/linux/remote_client.py
@@ -163,9 +163,9 @@
* dhclient
"""
# TODO(yfried): add support for dhcpcd
- suported_clients = ['udhcpc', 'dhclient']
+ supported_clients = ['udhcpc', 'dhclient']
dhcp_client = CONF.scenario.dhcp_client
- if dhcp_client not in suported_clients:
+ if dhcp_client not in supported_clients:
raise exceptions.InvalidConfiguration('%s DHCP client unsupported'
% dhcp_client)
if dhcp_client == 'udhcpc' and not fixed_ip:
diff --git a/tempest/config.py b/tempest/config.py
index b867980..3d3ddff 100644
--- a/tempest/config.py
+++ b/tempest/config.py
@@ -1048,7 +1048,7 @@
# TODO(yfried): add support for dhcpcd
cfg.StrOpt('dhcp_client',
default='udhcpc',
- choices=["udhcpc", "dhclient"],
+ choices=["udhcpc", "dhclient", ""],
help='DHCP client used by images to renew DCHP lease. '
'If left empty, update operation will be skipped. '
'Supported clients: "udhcpc", "dhclient"')
diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py
index d70021c..7ab3864 100644
--- a/tempest/scenario/manager.py
+++ b/tempest/scenario/manager.py
@@ -178,7 +178,8 @@
LOG.debug("Creating a server (name: %s, image: %s, flavor: %s)",
name, image, flavor)
- server = self.servers_client.create_server(name, image, flavor,
+ server = self.servers_client.create_server(name=name, imageRef=image,
+ flavorRef=flavor,
**create_kwargs)['server']
if wait_on_delete:
self.addCleanup(waiters.wait_for_server_termination,
@@ -1073,7 +1074,10 @@
def create_server(self, name=None, image=None, flavor=None,
wait_on_boot=True, wait_on_delete=True,
- create_kwargs=None):
+ network_client=None, create_kwargs=None):
+ if network_client is None:
+ network_client = self.network_client
+
vnic_type = CONF.network.port_vnic_type
# If vnic_type is configured create port for
@@ -1084,19 +1088,16 @@
create_port_body = {'binding:vnic_type': vnic_type,
'namestart': 'port-smoke'}
if create_kwargs:
- net_client = create_kwargs.get("network_client",
- self.network_client)
-
# Convert security group names to security group ids
# to pass to create_port
if create_kwargs.get('security_groups'):
- security_groups = net_client.list_security_groups().get(
- 'security_groups')
+ security_groups = network_client.list_security_groups(
+ ).get('security_groups')
sec_dict = dict([(s['name'], s['id'])
for s in security_groups])
- sec_groups_names = [s['name'] for s in create_kwargs[
- 'security_groups']]
+ sec_groups_names = [s['name'] for s in create_kwargs.get(
+ 'security_groups')]
security_groups_ids = [sec_dict[s]
for s in sec_groups_names]
@@ -1104,15 +1105,14 @@
create_port_body[
'security_groups'] = security_groups_ids
networks = create_kwargs.get('networks')
- else:
- net_client = self.network_client
+
# If there are no networks passed to us we look up
# for the tenant's private networks and create a port
# if there is only one private network. The same behaviour
# as we would expect when passing the call to the clients
# with no networks
if not networks:
- networks = net_client.list_networks(filters={
+ networks = network_client.list_networks(filters={
'router:external': False})
self.assertEqual(1, len(networks),
"There is more than one"
@@ -1120,7 +1120,7 @@
for net in networks:
net_id = net['uuid']
port = self._create_port(network_id=net_id,
- client=net_client,
+ client=network_client,
**create_port_body)
ports.append({'port': port.id})
if ports:
@@ -1343,9 +1343,9 @@
control_location=control_location)['encryption']
-class SwiftScenarioTest(ScenarioTest):
+class ObjectStorageScenarioTest(ScenarioTest):
"""
- Provide harness to do Swift scenario tests.
+ Provide harness to do Object Storage scenario tests.
Subclasses implement the tests that use the methods provided by this
class.
@@ -1353,7 +1353,7 @@
@classmethod
def skip_checks(cls):
- super(SwiftScenarioTest, cls).skip_checks()
+ super(ObjectStorageScenarioTest, cls).skip_checks()
if not CONF.service_available.swift:
skip_msg = ("%s skipped as swift is not available" %
cls.__name__)
@@ -1362,13 +1362,13 @@
@classmethod
def setup_credentials(cls):
cls.set_network_resources()
- super(SwiftScenarioTest, cls).setup_credentials()
+ super(ObjectStorageScenarioTest, cls).setup_credentials()
operator_role = CONF.object_storage.operator_role
cls.os_operator = cls.get_client_manager(roles=[operator_role])
@classmethod
def setup_clients(cls):
- super(SwiftScenarioTest, cls).setup_clients()
+ super(ObjectStorageScenarioTest, cls).setup_clients()
# Clients for Swift
cls.account_client = cls.os_operator.account_client
cls.container_client = cls.os_operator.container_client
diff --git a/tempest/scenario/test_large_ops.py b/tempest/scenario/test_large_ops.py
index 2ad5d2d..63dd4f0 100644
--- a/tempest/scenario/test_large_ops.py
+++ b/tempest/scenario/test_large_ops.py
@@ -99,9 +99,9 @@
create_kwargs = fixed_network.set_networks_kwarg(network,
create_kwargs)
self.servers_client.create_server(
- name,
- self.image,
- flavor_id,
+ name=name,
+ imageRef=self.image,
+ flavorRef=flavor_id,
**create_kwargs)
# needed because of bug 1199788
params = {'name': name}
diff --git a/tempest/scenario/test_swift_basic_ops.py b/tempest/scenario/test_object_storage_basic_ops.py
similarity index 97%
rename from tempest/scenario/test_swift_basic_ops.py
rename to tempest/scenario/test_object_storage_basic_ops.py
index 69e0c4c..49768c5 100644
--- a/tempest/scenario/test_swift_basic_ops.py
+++ b/tempest/scenario/test_object_storage_basic_ops.py
@@ -24,7 +24,7 @@
LOG = logging.getLogger(__name__)
-class TestSwiftBasicOps(manager.SwiftScenarioTest):
+class TestObjectStorageBasicOps(manager.ObjectStorageScenarioTest):
"""
Test swift basic ops.
* get swift stat.
diff --git a/tempest/scenario/test_swift_telemetry_middleware.py b/tempest/scenario/test_object_storage_telemetry_middleware.py
similarity index 95%
rename from tempest/scenario/test_swift_telemetry_middleware.py
rename to tempest/scenario/test_object_storage_telemetry_middleware.py
index c5a0e7c..3376a7c 100644
--- a/tempest/scenario/test_swift_telemetry_middleware.py
+++ b/tempest/scenario/test_object_storage_telemetry_middleware.py
@@ -34,7 +34,7 @@
NOTIFICATIONS_SLEEP = 1
-class TestSwiftTelemetry(manager.SwiftScenarioTest):
+class TestObjectStorageTelemetry(manager.ObjectStorageScenarioTest):
"""
Test that swift uses the ceilometer middleware.
* create container.
@@ -45,7 +45,7 @@
@classmethod
def skip_checks(cls):
- super(TestSwiftTelemetry, cls).skip_checks()
+ super(TestObjectStorageTelemetry, cls).skip_checks()
if not CONF.service_available.ceilometer:
skip_msg = ("%s skipped as ceilometer is not available" %
cls.__name__)
@@ -53,7 +53,7 @@
@classmethod
def setup_clients(cls):
- super(TestSwiftTelemetry, cls).setup_clients()
+ super(TestObjectStorageTelemetry, cls).setup_clients()
cls.telemetry_client = cls.os_operator.telemetry_client
def _confirm_notifications(self, container_name, obj_name):
diff --git a/tempest/scenario/test_security_groups_basic_ops.py b/tempest/scenario/test_security_groups_basic_ops.py
index 9afb598..297076c 100644
--- a/tempest/scenario/test_security_groups_basic_ops.py
+++ b/tempest/scenario/test_security_groups_basic_ops.py
@@ -244,10 +244,12 @@
{'uuid': tenant.network.id},
],
'key_name': tenant.keypair['name'],
- 'security_groups': security_groups_names,
- 'network_client': tenant.manager.network_client
+ 'security_groups': security_groups_names
}
- server = self.create_server(name=name, create_kwargs=create_kwargs)
+ server = self.create_server(
+ name=name,
+ network_client=tenant.manager.network_client,
+ create_kwargs=create_kwargs)
self.assertEqual(
sorted([s['name'] for s in security_groups]),
sorted([s['name'] for s in server['security_groups']]))
@@ -552,3 +554,44 @@
username=ssh_login,
private_key=private_key,
should_connect=True)
+
+ @test.requires_ext(service='network', extension='port-security')
+ @test.idempotent_id('7c811dcc-263b-49a3-92d2-1b4d8405f50c')
+ @test.services('compute', 'network')
+ def test_port_security_disable_security_group(self):
+ """
+ This test verifies port_security_enabled=False disables
+ the default security group rules.
+ """
+ new_tenant = self.primary_tenant
+
+ # Create server
+ name = 'server-{tenant}-gen-1'.format(
+ tenant=new_tenant.creds.tenant_name
+ )
+ name = data_utils.rand_name(name)
+ server = self._create_server(name, new_tenant)
+
+ access_point_ssh = self._connect_to_access_point(new_tenant)
+ server_id = server['id']
+ port_id = self._list_ports(device_id=server_id)[0]['id']
+
+ # Flip the port's port security and check connectivity
+ try:
+ self.network_client.update_port(port_id,
+ port_security_enabled=True,
+ security_groups=[])
+ self._check_connectivity(access_point=access_point_ssh,
+ ip=self._get_server_ip(server),
+ should_succeed=False)
+
+ self.network_client.update_port(port_id,
+ port_security_enabled=False,
+ security_groups=[])
+ self._check_connectivity(
+ access_point=access_point_ssh,
+ ip=self._get_server_ip(server))
+ except Exception:
+ for tenant in self.tenants.values():
+ self._log_console_output(servers=tenant.servers)
+ raise
diff --git a/tempest/scenario/test_shelve_instance.py b/tempest/scenario/test_shelve_instance.py
index 022306e..bf4b8e7 100644
--- a/tempest/scenario/test_shelve_instance.py
+++ b/tempest/scenario/test_shelve_instance.py
@@ -30,7 +30,7 @@
"""
This test shelves then unshelves a Nova instance
The following is the scenario outline:
- * boot a instance and create a timestamp file in it
+ * boot an instance and create a timestamp file in it
* shelve the instance
* unshelve the instance
* check the existence of the timestamp file in the unshelved instance
@@ -64,22 +64,29 @@
waiters.wait_for_server_status(self.servers_client, server['id'],
'ACTIVE')
- @test.idempotent_id('1164e700-0af0-4a4c-8792-35909a88743c')
- @testtools.skipUnless(CONF.compute_feature_enabled.shelve,
- 'Shelve is not available.')
- @test.services('compute', 'network', 'image')
- def test_shelve_instance(self):
+ def _create_server_then_shelve_and_unshelve(self, boot_from_volume=False):
self.keypair = self.create_keypair()
self.security_group = self._create_security_group()
security_groups = [{'name': self.security_group['name']}]
-
create_kwargs = {
'key_name': self.keypair['name'],
'security_groups': security_groups
}
- server = self.create_server(image=CONF.compute.image_ref,
- create_kwargs=create_kwargs)
+
+ if boot_from_volume:
+ volume = self.create_volume(size=CONF.volume.volume_size,
+ imageRef=CONF.compute.image_ref)
+ bd_map = [{
+ 'device_name': 'vda',
+ 'volume_id': volume['id'],
+ 'delete_on_termination': '0'}]
+
+ create_kwargs['block_device_mapping'] = bd_map
+ server = self.create_server(create_kwargs=create_kwargs)
+ else:
+ server = self.create_server(image=CONF.compute.image_ref,
+ create_kwargs=create_kwargs)
if CONF.compute.use_floatingip_for_ssh:
floating_ip = (self.floating_ips_client.create_floating_ip()
@@ -101,3 +108,17 @@
self._check_timestamp(floating_ip['ip'])
else:
self._check_timestamp(server)
+
+ @test.idempotent_id('1164e700-0af0-4a4c-8792-35909a88743c')
+ @testtools.skipUnless(CONF.compute_feature_enabled.shelve,
+ 'Shelve is not available.')
+ @test.services('compute', 'network', 'image')
+ def test_shelve_instance(self):
+ self._create_server_then_shelve_and_unshelve()
+
+ @test.idempotent_id('c1b6318c-b9da-490b-9c67-9339b627271f')
+ @testtools.skipUnless(CONF.compute_feature_enabled.shelve,
+ 'Shelve is not available.')
+ @test.services('compute', 'volume', 'network', 'image')
+ def test_shelve_volume_backed_instance(self):
+ self._create_server_then_shelve_and_unshelve(boot_from_volume=True)
diff --git a/tempest/scenario/test_snapshot_pattern.py b/tempest/scenario/test_snapshot_pattern.py
index 1298faa..b5e5da8 100644
--- a/tempest/scenario/test_snapshot_pattern.py
+++ b/tempest/scenario/test_snapshot_pattern.py
@@ -29,7 +29,7 @@
"""
This test is for snapshotting an instance and booting with it.
The following is the scenario outline:
- * boot a instance and create a timestamp file in it
+ * boot an instance and create a timestamp file in it
* snapshot the instance
* boot a second instance from the snapshot
* check the existence of the timestamp file in the second instance
@@ -62,11 +62,11 @@
'Snapshotting is not available.')
@test.services('compute', 'network', 'image')
def test_snapshot_pattern(self):
- # prepare for booting a instance
+ # prepare for booting an instance
self._add_keypair()
self.security_group = self._create_security_group()
- # boot a instance and create a timestamp file in it
+ # boot an instance and create a timestamp file in it
server = self._boot_image(CONF.compute.image_ref)
if CONF.compute.use_floatingip_for_ssh:
fip_for_server = self.create_floating_ip(server)
diff --git a/tempest/scenario/test_stamp_pattern.py b/tempest/scenario/test_stamp_pattern.py
index 5f1e7fe..91e4657 100644
--- a/tempest/scenario/test_stamp_pattern.py
+++ b/tempest/scenario/test_stamp_pattern.py
@@ -150,7 +150,7 @@
'Snapshotting is not available.')
@tempest.test.services('compute', 'network', 'volume', 'image')
def test_stamp_pattern(self):
- # prepare for booting a instance
+ # prepare for booting an instance
self._add_keypair()
self.security_group = self._create_security_group()
diff --git a/tempest/scenario/utils.py b/tempest/scenario/utils.py
index 0a7d492..2841060 100644
--- a/tempest/scenario/utils.py
+++ b/tempest/scenario/utils.py
@@ -91,8 +91,8 @@
def test_create_server_metadata(self):
name = rand_name('instance')
self.servers_client.create_server(name=name,
- flavor_ref=self.flavor_ref,
- image_ref=self.image_ref)
+ flavorRef=self.flavor_ref,
+ imageRef=self.image_ref)
"""
validchars = "-_.{ascii}{digit}".format(ascii=string.ascii_letters,
digit=string.digits)
diff --git a/tempest/services/compute/json/interfaces_client.py b/tempest/services/compute/json/interfaces_client.py
index 2e66082..fe076d8 100644
--- a/tempest/services/compute/json/interfaces_client.py
+++ b/tempest/services/compute/json/interfaces_client.py
@@ -16,7 +16,6 @@
from oslo_serialization import jsonutils as json
from tempest.api_schema.response.compute.v2_1 import interfaces as schema
-from tempest.api_schema.response.compute.v2_1 import servers as servers_schema
from tempest.common import service_client
@@ -49,21 +48,3 @@
port_id))
self.validate_response(schema.delete_interface, resp, body)
return service_client.ResponseBody(resp, body)
-
- def add_fixed_ip(self, server_id, **kwargs):
- """Add a fixed IP to input server instance."""
- post_body = json.dumps({'addFixedIp': kwargs})
- resp, body = self.post('servers/%s/action' % server_id,
- post_body)
- self.validate_response(servers_schema.server_actions_common_schema,
- resp, body)
- return service_client.ResponseBody(resp, body)
-
- def remove_fixed_ip(self, server_id, **kwargs):
- """Remove input fixed IP from input server instance."""
- post_body = json.dumps({'removeFixedIp': kwargs})
- resp, body = self.post('servers/%s/action' % server_id,
- post_body)
- self.validate_response(servers_schema.server_actions_common_schema,
- resp, body)
- return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/compute/json/servers_client.py b/tempest/services/compute/json/servers_client.py
index a36603f..1d2c7b2 100644
--- a/tempest/services/compute/json/servers_client.py
+++ b/tempest/services/compute/json/servers_client.py
@@ -14,6 +14,8 @@
# License for the specific language governing permissions and limitations
# under the License.
+import copy
+
from oslo_serialization import jsonutils as json
from six.moves.urllib import parse as urllib
@@ -29,59 +31,28 @@
auth_provider, service, region, **kwargs)
self.enable_instance_password = enable_instance_password
- def create_server(self, name, image_ref, flavor_ref, **kwargs):
+ def create_server(self, **kwargs):
"""
Creates an instance of a server.
- name (Required): The name of the server.
- image_ref (Required): Reference to the image used to build the server.
- flavor_ref (Required): The flavor used to build the server.
- Following optional keyword arguments are accepted:
- adminPass: Sets the initial root password.
- key_name: Key name of keypair that was created earlier.
- meta: A dictionary of values to be used as metadata.
- personality: A list of dictionaries for files to be injected into
- the server.
- security_groups: A list of security group dicts.
- networks: A list of network dicts with UUID and fixed_ip.
- user_data: User data for instance.
- availability_zone: Availability zone in which to launch instance.
- accessIPv4: The IPv4 access address for the server.
- accessIPv6: The IPv6 access address for the server.
- min_count: Count of minimum number of instances to launch.
- max_count: Count of maximum number of instances to launch.
- disk_config: Determines if user or admin controls disk configuration.
- return_reservation_id: Enable/Disable the return of reservation id
- block_device_mapping: Block device mapping for the server.
- block_device_mapping_v2: Block device mapping V2 for the server.
+ Most parameters except the following are passed to the API without
+ any changes.
+ :param disk_config: The name is changed to OS-DCF:diskConfig
+ :param scheduler_hints: The name is changed to os:scheduler_hints and
+ the parameter is set in the same level as the parameter 'server'.
"""
- post_body = {
- 'name': name,
- 'imageRef': image_ref,
- 'flavorRef': flavor_ref
- }
+ body = copy.deepcopy(kwargs)
+ if body.get('disk_config'):
+ body['OS-DCF:diskConfig'] = body.pop('disk_config')
- for option in ['personality', 'adminPass', 'key_name',
- 'security_groups', 'networks', 'user_data',
- 'availability_zone', 'accessIPv4', 'accessIPv6',
- 'min_count', 'max_count', ('metadata', 'meta'),
- ('OS-DCF:diskConfig', 'disk_config'),
- 'return_reservation_id', 'block_device_mapping',
- 'block_device_mapping_v2']:
- if isinstance(option, tuple):
- post_param = option[0]
- key = option[1]
- else:
- post_param = option
- key = option
- value = kwargs.get(key)
- if value is not None:
- post_body[post_param] = value
+ hints = None
+ if body.get('scheduler_hints'):
+ hints = {'os:scheduler_hints': body.pop('scheduler_hints')}
- post_body = {'server': post_body}
+ post_body = {'server': body}
- if 'sched_hints' in kwargs:
- hints = {'os:scheduler_hints': kwargs.get('sched_hints')}
+ if hints:
post_body = dict(post_body.items() + hints.items())
+
post_body = json.dumps(post_body)
resp, body = self.post('servers', post_body)
@@ -457,3 +428,11 @@
return self.action(server_id, "os-getVNCConsole",
schema.get_vnc_console,
type=console_type)
+
+ def add_fixed_ip(self, server_id, **kwargs):
+ """Add a fixed IP to input server instance."""
+ return self.action(server_id, 'addFixedIp', **kwargs)
+
+ def remove_fixed_ip(self, server_id, **kwargs):
+ """Remove input fixed IP from input server instance."""
+ return self.action(server_id, 'removeFixedIp', **kwargs)
diff --git a/tempest/stress/actions/server_create_destroy.py b/tempest/stress/actions/server_create_destroy.py
index 37664de..44b6f62 100644
--- a/tempest/stress/actions/server_create_destroy.py
+++ b/tempest/stress/actions/server_create_destroy.py
@@ -30,7 +30,7 @@
name = data_utils.rand_name("instance")
self.logger.info("creating %s" % name)
server = self.manager.servers_client.create_server(
- name, self.image, self.flavor)['server']
+ name=name, imageRef=self.image, flavorRef=self.flavor)['server']
server_id = server['id']
waiters.wait_for_server_status(self.manager.servers_client, server_id,
'ACTIVE')
diff --git a/tempest/stress/actions/ssh_floating.py b/tempest/stress/actions/ssh_floating.py
index 81bb071..d912b25 100644
--- a/tempest/stress/actions/ssh_floating.py
+++ b/tempest/stress/actions/ssh_floating.py
@@ -75,8 +75,8 @@
self.logger.info("creating %s" % name)
vm_args = self.vm_extra_args.copy()
vm_args['security_groups'] = [self.sec_grp]
- server = servers_client.create_server(name, self.image,
- self.flavor,
+ server = servers_client.create_server(name=name, imageRef=self.image,
+ flavorRef=self.flavor,
**vm_args)['server']
self.server_id = server['id']
if self.wait_after_vm_create:
diff --git a/tempest/stress/actions/volume_attach_delete.py b/tempest/stress/actions/volume_attach_delete.py
index b3753a5..847f342 100644
--- a/tempest/stress/actions/volume_attach_delete.py
+++ b/tempest/stress/actions/volume_attach_delete.py
@@ -39,7 +39,7 @@
vm_name = data_utils.rand_name("instance")
self.logger.info("creating vm: %s" % vm_name)
server = self.manager.servers_client.create_server(
- vm_name, self.image, self.flavor)['server']
+ name=vm_name, imageRef=self.image, flavorRef=self.flavor)['server']
server_id = server['id']
waiters.wait_for_server_status(self.manager.servers_client, server_id,
'ACTIVE')
diff --git a/tempest/stress/actions/volume_attach_verify.py b/tempest/stress/actions/volume_attach_verify.py
index 8105626..95841a9 100644
--- a/tempest/stress/actions/volume_attach_verify.py
+++ b/tempest/stress/actions/volume_attach_verify.py
@@ -39,8 +39,8 @@
vm_args = self.vm_extra_args.copy()
vm_args['security_groups'] = [self.sec_grp]
vm_args['key_name'] = self.key['name']
- server = servers_client.create_server(name, self.image,
- self.flavor,
+ server = servers_client.create_server(name=name, imageRef=self.image,
+ flavorRef=self.flavor,
**vm_args)['server']
self.server_id = server['id']
waiters.wait_for_server_status(self.manager.servers_client,
diff --git a/tempest/tests/cmd/test_verify_tempest_config.py b/tempest/tests/cmd/test_verify_tempest_config.py
index 2de5802..a5dea54 100644
--- a/tempest/tests/cmd/test_verify_tempest_config.py
+++ b/tempest/tests/cmd/test_verify_tempest_config.py
@@ -113,7 +113,7 @@
'print_and_or_update') as print_mock:
verify_tempest_config.verify_keystone_api_versions(fake_os, True)
print_mock.assert_called_once_with('api_v3',
- 'identity_feature_enabled',
+ 'identity-feature-enabled',
False, True)
def test_verify_keystone_api_versions_no_v2(self):
@@ -129,7 +129,7 @@
'print_and_or_update') as print_mock:
verify_tempest_config.verify_keystone_api_versions(fake_os, True)
print_mock.assert_called_once_with('api_v2',
- 'identity_feature_enabled',
+ 'identity-feature-enabled',
False, True)
def test_verify_cinder_api_versions_no_v2(self):
@@ -144,7 +144,7 @@
with mock.patch.object(verify_tempest_config,
'print_and_or_update') as print_mock:
verify_tempest_config.verify_cinder_api_versions(fake_os, True)
- print_mock.assert_called_once_with('api_v2', 'volume_feature_enabled',
+ print_mock.assert_called_once_with('api_v2', 'volume-feature-enabled',
False, True)
def test_verify_cinder_api_versions_no_v1(self):
@@ -159,7 +159,7 @@
with mock.patch.object(verify_tempest_config,
'print_and_or_update') as print_mock:
verify_tempest_config.verify_cinder_api_versions(fake_os, True)
- print_mock.assert_called_once_with('api_v1', 'volume_feature_enabled',
+ print_mock.assert_called_once_with('api_v1', 'volume-feature-enabled',
False, True)
def test_verify_glance_version_no_v2_with_v1_1(self):
@@ -170,7 +170,7 @@
with mock.patch.object(verify_tempest_config,
'print_and_or_update') as print_mock:
verify_tempest_config.verify_glance_api_versions(fake_os, True)
- print_mock.assert_called_once_with('api_v2', 'image_feature_enabled',
+ print_mock.assert_called_once_with('api_v2', 'image-feature-enabled',
False, True)
def test_verify_glance_version_no_v2_with_v1_0(self):
@@ -181,7 +181,7 @@
with mock.patch.object(verify_tempest_config,
'print_and_or_update') as print_mock:
verify_tempest_config.verify_glance_api_versions(fake_os, True)
- print_mock.assert_called_once_with('api_v2', 'image_feature_enabled',
+ print_mock.assert_called_once_with('api_v2', 'image-feature-enabled',
False, True)
def test_verify_glance_version_no_v1(self):
@@ -192,7 +192,7 @@
with mock.patch.object(verify_tempest_config,
'print_and_or_update') as print_mock:
verify_tempest_config.verify_glance_api_versions(fake_os, True)
- print_mock.assert_called_once_with('api_v1', 'image_feature_enabled',
+ print_mock.assert_called_once_with('api_v1', 'image-feature-enabled',
False, True)
def test_verify_extensions_neutron(self):
diff --git a/tempest/tests/services/compute/test_availability_zone_client.py b/tempest/tests/services/compute/test_availability_zone_client.py
index 6100f44..e1d94bc 100644
--- a/tempest/tests/services/compute/test_availability_zone_client.py
+++ b/tempest/tests/services/compute/test_availability_zone_client.py
@@ -12,6 +12,8 @@
# 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 availability_zone_client
@@ -20,7 +22,7 @@
class TestAvailabilityZoneClient(base.BaseComputeServiceTest):
- FAKE_AVAILABIRITY_ZONE_INFO = {
+ FAKE_AZ_INFO = {
"availabilityZoneInfo":
[
{
@@ -33,20 +35,48 @@
]
}
+ FAKE_AZ_DETAILS = {
+ "testhost": {
+ "nova-compute": {
+ "available": True,
+ "active": True,
+ "updated_at": "2015-09-10T07:16:46.000000"
+ }
+ }
+ }
+
def setUp(self):
super(TestAvailabilityZoneClient, self).setUp()
fake_auth = fake_auth_provider.FakeAuthProvider()
self.client = availability_zone_client.AvailabilityZoneClient(
fake_auth, 'compute', 'regionOne')
- def test_list_availability_zones_with_str_body(self):
+ def _test_availability_zones(self, to_utf=False):
self.check_service_client_function(
self.client.list_availability_zones,
'tempest.common.service_client.ServiceClient.get',
- self.FAKE_AVAILABIRITY_ZONE_INFO)
+ self.FAKE_AZ_INFO,
+ to_utf)
+
+ def _test_availability_zones_with_details(self, to_utf=False):
+ fake_az_details = copy.deepcopy(self.FAKE_AZ_INFO)
+ fake_az_details['availabilityZoneInfo'][0]['hosts'] = \
+ self.FAKE_AZ_DETAILS
+ self.check_service_client_function(
+ self.client.list_availability_zones,
+ 'tempest.common.service_client.ServiceClient.get',
+ fake_az_details,
+ to_utf,
+ detail=True)
+
+ def test_list_availability_zones_with_str_body(self):
+ self._test_availability_zones()
def test_list_availability_zones_with_bytes_body(self):
- self.check_service_client_function(
- self.client.list_availability_zones,
- 'tempest.common.service_client.ServiceClient.get',
- self.FAKE_AVAILABIRITY_ZONE_INFO, to_utf=True)
+ self._test_availability_zones(True)
+
+ def test_list_availability_zones_with_str_body_and_details(self):
+ self._test_availability_zones_with_details()
+
+ def test_list_availability_zones_with_bytes_body_and_details(self):
+ self._test_availability_zones_with_details(True)
diff --git a/tempest/tests/services/compute/test_floating_ips_client.py b/tempest/tests/services/compute/test_floating_ips_client.py
new file mode 100644
index 0000000..ee22004
--- /dev/null
+++ b/tempest/tests/services/compute/test_floating_ips_client.py
@@ -0,0 +1,113 @@
+# Copyright 2015 IBM Corp.
+#
+# 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 floating_ips_client
+from tempest.tests import fake_auth_provider
+from tempest.tests.services.compute import base
+
+
+class TestFloatingIpsClient(base.BaseComputeServiceTest):
+
+ floating_ip = {"fixed_ip": None,
+ "id": "46d61064-13ba-4bf0-9557-69de824c3d6f",
+ "instance_id": "a1daa443-a6bb-463e-aea2-104b7d912eb8",
+ "ip": "10.10.10.1",
+ "pool": "nova"}
+
+ def setUp(self):
+ super(TestFloatingIpsClient, self).setUp()
+ fake_auth = fake_auth_provider.FakeAuthProvider()
+ self.client = floating_ips_client.FloatingIPsClient(
+ fake_auth, 'compute', 'regionOne')
+
+ def _test_list_floating_ips(self, bytes_body=False):
+ expected = {'floating_ips': [TestFloatingIpsClient.floating_ip]}
+ self.check_service_client_function(
+ self.client.list_floating_ips,
+ 'tempest.common.service_client.ServiceClient.get',
+ expected,
+ bytes_body)
+
+ def test_list_floating_ips_str_body(self):
+ self._test_list_floating_ips(bytes_body=False)
+
+ def test_list_floating_ips_byte_body(self):
+ self._test_list_floating_ips(bytes_body=True)
+
+ def _test_show_floating_ip(self, bytes_body=False):
+ expected = {"floating_ip": TestFloatingIpsClient.floating_ip}
+ self.check_service_client_function(
+ self.client.show_floating_ip,
+ 'tempest.common.service_client.ServiceClient.get',
+ expected,
+ bytes_body,
+ floating_ip_id='a1daa443-a6bb-463e-aea2-104b7d912eb8')
+
+ def test_show_floating_ip_str_body(self):
+ self._test_show_floating_ip(bytes_body=False)
+
+ def test_show_floating_ip_byte_body(self):
+ self._test_show_floating_ip(bytes_body=True)
+
+ def _test_create_floating_ip(self, bytes_body=False):
+ expected = {"floating_ip": TestFloatingIpsClient.floating_ip}
+ self.check_service_client_function(
+ self.client.create_floating_ip,
+ 'tempest.common.service_client.ServiceClient.post',
+ expected,
+ bytes_body,
+ pool_name='nova')
+
+ def test_create_floating_ip_str_body(self):
+ self._test_create_floating_ip(bytes_body=False)
+
+ def test_create_floating_ip_byte_body(self):
+ self._test_create_floating_ip(bytes_body=True)
+
+ def test_delete_floating_ip(self):
+ self.check_service_client_function(
+ self.client.delete_floating_ip,
+ 'tempest.common.service_client.ServiceClient.delete',
+ {}, status=202, floating_ip_id='fake-id')
+
+ def test_associate_floating_ip_to_server(self):
+ self.check_service_client_function(
+ self.client.associate_floating_ip_to_server,
+ 'tempest.common.service_client.ServiceClient.post',
+ {}, status=202, floating_ip='10.10.10.1',
+ server_id='c782b7a9-33cd-45f0-b795-7f87f456408b')
+
+ def test_disassociate_floating_ip_from_server(self):
+ self.check_service_client_function(
+ self.client.disassociate_floating_ip_from_server,
+ 'tempest.common.service_client.ServiceClient.post',
+ {}, status=202, floating_ip='10.10.10.1',
+ server_id='c782b7a9-33cd-45f0-b795-7f87f456408b')
+
+ def test_is_resource_deleted_true(self):
+ self.useFixture(mockpatch.Patch(
+ 'tempest.services.compute.json.floating_ips_client.'
+ 'FloatingIPsClient.show_floating_ip',
+ side_effect=lib_exc.NotFound()))
+ self.assertTrue(self.client.is_resource_deleted('fake-id'))
+
+ def test_is_resource_deleted_false(self):
+ self.useFixture(mockpatch.Patch(
+ 'tempest.services.compute.json.floating_ips_client.'
+ 'FloatingIPsClient.show_floating_ip',
+ return_value={"floating_ip": TestFloatingIpsClient.floating_ip}))
+ self.assertFalse(self.client.is_resource_deleted('fake-id'))
diff --git a/tempest/tests/services/compute/test_hypervisor_client.py b/tempest/tests/services/compute/test_hypervisor_client.py
new file mode 100644
index 0000000..441e7e6
--- /dev/null
+++ b/tempest/tests/services/compute/test_hypervisor_client.py
@@ -0,0 +1,167 @@
+# Copyright 2015 IBM Corp.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from tempest.services.compute.json import hypervisor_client
+from tempest.tests import fake_auth_provider
+from tempest.tests.services.compute import base
+
+
+class TestHypervisorClient(base.BaseComputeServiceTest):
+
+ hypervisor_id = "1"
+ hypervisor_name = "hyper.hostname.com"
+
+ def setUp(self):
+ super(TestHypervisorClient, self).setUp()
+ fake_auth = fake_auth_provider.FakeAuthProvider()
+ self.client = hypervisor_client.HypervisorClient(
+ fake_auth, 'compute', 'regionOne')
+
+ def test_list_hypervisor_str_body(self):
+ self._test_list_hypervisor(bytes_body=False)
+
+ def test_list_hypervisor_byte_body(self):
+ self._test_list_hypervisor(bytes_body=True)
+
+ def _test_list_hypervisor(self, bytes_body=False):
+ expected = {"hypervisors": [{
+ "id": 1,
+ "hypervisor_hostname": "hypervisor1.hostname.com"},
+ {
+ "id": 2,
+ "hypervisor_hostname": "hypervisor2.hostname.com"}]}
+ self.check_service_client_function(
+ self.client.list_hypervisors,
+ 'tempest.common.service_client.ServiceClient.get',
+ expected, bytes_body)
+
+ def test_show_hypervisor_str_body(self):
+ self._test_show_hypervisor(bytes_body=False)
+
+ def test_show_hypervisor_byte_body(self):
+ self._test_show_hypervisor(bytes_body=True)
+
+ def _test_show_hypervisor(self, bytes_body=False):
+ expected = {"hypervisor": {
+ "cpu_info": "?",
+ "current_workload": 0,
+ "disk_available_least": 1,
+ "host_ip": "10.10.10.10",
+ "free_disk_gb": 1028,
+ "free_ram_mb": 7680,
+ "hypervisor_hostname": "fake-mini",
+ "hypervisor_type": "fake",
+ "hypervisor_version": 1,
+ "id": 1,
+ "local_gb": 1028,
+ "local_gb_used": 0,
+ "memory_mb": 8192,
+ "memory_mb_used": 512,
+ "running_vms": 0,
+ "service": {
+ "host": "fake_host",
+ "id": 2},
+ "vcpus": 1,
+ "vcpus_used": 0}}
+ self.check_service_client_function(
+ self.client.show_hypervisor,
+ 'tempest.common.service_client.ServiceClient.get',
+ expected, bytes_body,
+ hypervisor_id=self.hypervisor_id)
+
+ def test_list_servers_on_hypervisor_str_body(self):
+ self._test_list_servers_on_hypervisor(bytes_body=False)
+
+ def test_list_servers_on_hypervisor_byte_body(self):
+ self._test_list_servers_on_hypervisor(bytes_body=True)
+
+ def _test_list_servers_on_hypervisor(self, bytes_body=False):
+ expected = {"hypervisors": [{
+ "id": 1,
+ "hypervisor_hostname": "hyper.hostname.com",
+ "servers": [{
+ "uuid": "e1ae8fc4-b72d-4c2f-a427-30dd420b6277",
+ "name": "instance-00000001"},
+ {
+ "uuid": "e1ae8fc4-b72d-4c2f-a427-30dd42066666",
+ "name": "instance-00000002"}
+ ]}
+ ]}
+ self.check_service_client_function(
+ self.client.list_servers_on_hypervisor,
+ 'tempest.common.service_client.ServiceClient.get',
+ expected, bytes_body,
+ hypervisor_name=self.hypervisor_name)
+
+ def test_show_hypervisor_statistics_str_body(self):
+ self._test_show_hypervisor_statistics(bytes_body=False)
+
+ def test_show_hypervisor_statistics_byte_body(self):
+ self._test_show_hypervisor_statistics(bytes_body=True)
+
+ def _test_show_hypervisor_statistics(self, bytes_body=False):
+ expected = {
+ "hypervisor_statistics": {
+ "count": 1,
+ "current_workload": 0,
+ "disk_available_least": 0,
+ "free_disk_gb": 1028,
+ "free_ram_mb": 7680,
+ "local_gb": 1028,
+ "local_gb_used": 0,
+ "memory_mb": 8192,
+ "memory_mb_used": 512,
+ "running_vms": 0,
+ "vcpus": 1,
+ "vcpus_used": 0}}
+ self.check_service_client_function(
+ self.client.show_hypervisor_statistics,
+ 'tempest.common.service_client.ServiceClient.get',
+ expected, bytes_body)
+
+ def test_show_hypervisor_uptime_str_body(self):
+ self._test_show_hypervisor_uptime(bytes_body=False)
+
+ def test_show_hypervisor_uptime_byte_body(self):
+ self._test_show_hypervisor_uptime(bytes_body=True)
+
+ def _test_show_hypervisor_uptime(self, bytes_body=False):
+ expected = {
+ "hypervisor": {
+ "hypervisor_hostname": "fake-mini",
+ "id": 1,
+ "uptime": (" 08:32:11 up 93 days, 18:25, 12 users, "
+ " load average: 0.20, 0.12, 0.14")
+ }}
+ self.check_service_client_function(
+ self.client.show_hypervisor_uptime,
+ 'tempest.common.service_client.ServiceClient.get',
+ expected, bytes_body,
+ hypervisor_id=self.hypervisor_id)
+
+ def test_search_hypervisor_str_body(self):
+ self._test_search_hypervisor(bytes_body=False)
+
+ def test_search_hypervisor_byte_body(self):
+ self._test_search_hypervisor(bytes_body=True)
+
+ def _test_search_hypervisor(self, bytes_body=False):
+ expected = {"hypervisors": [{
+ "id": 2,
+ "hypervisor_hostname": "hyper.hostname.com"}]}
+ self.check_service_client_function(
+ self.client.search_hypervisor,
+ 'tempest.common.service_client.ServiceClient.get',
+ expected, bytes_body,
+ hypervisor_name=self.hypervisor_name)
diff --git a/tempest/thirdparty/boto/test.py b/tempest/thirdparty/boto/test.py
index 8c371a7..1ced180 100644
--- a/tempest/thirdparty/boto/test.py
+++ b/tempest/thirdparty/boto/test.py
@@ -211,7 +211,7 @@
def resource_setup(cls):
super(BotoTestCase, cls).resource_setup()
cls.conclusion = decision_maker()
- # The trash contains cleanup functions and paramaters in tuples
+ # The trash contains cleanup functions and parameters in tuples
# (function, *args, **kwargs)
cls._resource_trash_bin = {}
cls._sequence = -1