Merge "Drop admin_role CONF dependency from cred provider"
diff --git a/tempest/api/compute/admin/test_live_migration.py b/tempest/api/compute/admin/test_live_migration.py
index 34ec78d..12c471e 100644
--- a/tempest/api/compute/admin/test_live_migration.py
+++ b/tempest/api/compute/admin/test_live_migration.py
@@ -14,8 +14,6 @@
# under the License.
-from collections import namedtuple
-
import testtools
from tempest.api.compute import base
@@ -26,9 +24,6 @@
CONF = config.CONF
-CreatedServer = namedtuple('CreatedServer', 'server_id, volume_backed')
-
-
class LiveBlockMigrationTestJSON(base.BaseV2ComputeAdminTest):
_host_key = 'OS-EXT-SRV-ATTR:host'
@@ -43,10 +38,6 @@
def resource_setup(cls):
super(LiveBlockMigrationTestJSON, cls).resource_setup()
- # list of CreatedServer namedtuples
- # TODO(mriedem): Remove the instance variable and shared server re-use
- cls.created_servers = []
-
def _get_compute_hostnames(self):
body = self.admin_hosts_client.list_hosts()['hosts']
return [
@@ -62,18 +53,12 @@
def _get_host_for_server(self, server_id):
return self._get_server_details(server_id)[self._host_key]
- def _migrate_server_to(self, server_id, dest_host):
- # volume backed instances shouldn't be block migrated
- for id, volume_backed in self.created_servers:
- if server_id == id:
- use_block_migration = not volume_backed
- break
- else:
- raise ValueError('Server with id %s not found.' % server_id)
- bmflm = (CONF.compute_feature_enabled.
- block_migration_for_live_migration and use_block_migration)
+ def _migrate_server_to(self, server_id, dest_host, volume_backed):
+ block_migration = (CONF.compute_feature_enabled.
+ block_migration_for_live_migration and
+ not volume_backed)
body = self.admin_servers_client.live_migrate_server(
- server_id, host=dest_host, block_migration=bmflm,
+ server_id, host=dest_host, block_migration=block_migration,
disk_over_commit=False)
return body
@@ -85,19 +70,10 @@
def _get_server_status(self, server_id):
return self._get_server_details(server_id)['status']
- def _get_an_active_server(self, volume_backed=False):
- for server_id, vol_backed in self.created_servers:
- if ('ACTIVE' == self._get_server_status(server_id) and
- volume_backed == vol_backed):
- return server_id
- else:
+ def _create_server(self, volume_backed=False):
server = self.create_test_server(wait_until="ACTIVE",
volume_backed=volume_backed)
- server_id = server['id']
- new_server = CreatedServer(server_id=server_id,
- volume_backed=volume_backed)
- self.created_servers.append(new_server)
- return server_id
+ return server['id']
def _volume_clean_up(self, server_id, volume_id):
body = self.volumes_client.show_volume(volume_id)['volume']
@@ -117,11 +93,11 @@
:param volume_backed: If the instance is volume backed or not. If
volume_backed, *block* migration is not used.
"""
- # Live block migrate an instance to another host
+ # Live migrate an instance to another host
if len(self._get_compute_hostnames()) < 2:
raise self.skipTest(
"Less than 2 compute nodes, skipping migration test.")
- server_id = self._get_an_active_server(volume_backed=volume_backed)
+ server_id = self._create_server(volume_backed=volume_backed)
actual_host = self._get_host_for_server(server_id)
target_host = self._get_host_other_than(actual_host)
@@ -130,7 +106,7 @@
waiters.wait_for_server_status(self.admin_servers_client,
server_id, state)
- self._migrate_server_to(server_id, target_host)
+ self._migrate_server_to(server_id, target_host, volume_backed)
waiters.wait_for_server_status(self.servers_client, server_id, state)
migration_list = (self.admin_migration_client.list_migrations()
['migrations'])
@@ -178,11 +154,10 @@
block_migrate_cinder_iscsi,
'Block Live migration not configured for iSCSI')
def test_iscsi_volume(self):
- # Live block migrate an instance to another host
if len(self._get_compute_hostnames()) < 2:
raise self.skipTest(
"Less than 2 compute nodes, skipping migration test.")
- server_id = self._get_an_active_server()
+ server_id = self._create_server()
actual_host = self._get_host_for_server(server_id)
target_host = self._get_host_other_than(actual_host)
diff --git a/tempest/api/object_storage/test_container_staticweb.py b/tempest/api/object_storage/test_container_staticweb.py
index 4b4b499..18593f3 100644
--- a/tempest/api/object_storage/test_container_staticweb.py
+++ b/tempest/api/object_storage/test_container_staticweb.py
@@ -28,7 +28,7 @@
cls.container_name = data_utils.rand_name(name="TestContainer")
# This header should be posted on the container before every test
- cls.headers_public_read_acl = {'Read': '.r:*'}
+ cls.headers_public_read_acl = {'Read': '.r:*,.rlistings'}
# Create test container and create one object in it
cls.container_client.create_container(cls.container_name)
diff --git a/tempest/api_schema/response/compute/v2_1/fixed_ips.py b/tempest/api_schema/response/compute/v2_1/fixed_ips.py
deleted file mode 100644
index 229860e..0000000
--- a/tempest/api_schema/response/compute/v2_1/fixed_ips.py
+++ /dev/null
@@ -1,41 +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 tempest.api_schema.response.compute.v2_1 import parameter_types
-
-get_fixed_ip = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'fixed_ip': {
- 'type': 'object',
- 'properties': {
- 'address': parameter_types.ip_address,
- 'cidr': {'type': 'string'},
- 'host': {'type': 'string'},
- 'hostname': {'type': 'string'}
- },
- 'additionalProperties': False,
- 'required': ['address', 'cidr', 'host', 'hostname']
- }
- },
- 'additionalProperties': False,
- 'required': ['fixed_ip']
- }
-}
-
-reserve_unreserve_fixed_ip = {
- 'status_code': [202]
-}
diff --git a/tempest/api_schema/response/compute/v2_1/flavors.py b/tempest/api_schema/response/compute/v2_1/flavors.py
deleted file mode 100644
index 5f5b2e3..0000000
--- a/tempest/api_schema/response/compute/v2_1/flavors.py
+++ /dev/null
@@ -1,103 +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 tempest.api_schema.response.compute.v2_1 import parameter_types
-
-list_flavors = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'flavors': {
- 'type': 'array',
- 'items': {
- 'type': 'object',
- 'properties': {
- 'name': {'type': 'string'},
- 'links': parameter_types.links,
- 'id': {'type': 'string'}
- },
- 'additionalProperties': False,
- 'required': ['name', 'links', 'id']
- }
- },
- 'flavors_links': parameter_types.links
- },
- 'additionalProperties': False,
- # NOTE(gmann): flavors_links attribute is not necessary
- # to be present always So it is not 'required'.
- 'required': ['flavors']
- }
-}
-
-common_flavor_info = {
- 'type': 'object',
- 'properties': {
- 'name': {'type': 'string'},
- 'links': parameter_types.links,
- 'ram': {'type': 'integer'},
- 'vcpus': {'type': 'integer'},
- # 'swap' attributes comes as integer value but if it is empty
- # it comes as "". So defining type of as string and integer.
- 'swap': {'type': ['integer', 'string']},
- 'disk': {'type': 'integer'},
- 'id': {'type': 'string'},
- 'OS-FLV-DISABLED:disabled': {'type': 'boolean'},
- 'os-flavor-access:is_public': {'type': 'boolean'},
- 'rxtx_factor': {'type': 'number'},
- 'OS-FLV-EXT-DATA:ephemeral': {'type': 'integer'}
- },
- 'additionalProperties': False,
- # 'OS-FLV-DISABLED', 'os-flavor-access', 'rxtx_factor' and
- # 'OS-FLV-EXT-DATA' are API extensions. So they are not 'required'.
- 'required': ['name', 'links', 'ram', 'vcpus', 'swap', 'disk', 'id']
-}
-
-list_flavors_details = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'flavors': {
- 'type': 'array',
- 'items': common_flavor_info
- },
- # NOTE(gmann): flavors_links attribute is not necessary
- # to be present always So it is not 'required'.
- 'flavors_links': parameter_types.links
- },
- 'additionalProperties': False,
- 'required': ['flavors']
- }
-}
-
-unset_flavor_extra_specs = {
- 'status_code': [200]
-}
-
-create_get_flavor_details = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'flavor': common_flavor_info
- },
- 'additionalProperties': False,
- 'required': ['flavor']
- }
-}
-
-delete_flavor = {
- 'status_code': [202]
-}
diff --git a/tempest/api_schema/response/compute/v2_1/flavors_access.py b/tempest/api_schema/response/compute/v2_1/flavors_access.py
deleted file mode 100644
index a4d6af0..0000000
--- a/tempest/api_schema/response/compute/v2_1/flavors_access.py
+++ /dev/null
@@ -1,36 +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.
-
-add_remove_list_flavor_access = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'flavor_access': {
- 'type': 'array',
- 'items': {
- 'type': 'object',
- 'properties': {
- 'flavor_id': {'type': 'string'},
- 'tenant_id': {'type': 'string'},
- },
- 'additionalProperties': False,
- 'required': ['flavor_id', 'tenant_id'],
- }
- }
- },
- 'additionalProperties': False,
- 'required': ['flavor_access']
- }
-}
diff --git a/tempest/api_schema/response/compute/v2_1/flavors_extra_specs.py b/tempest/api_schema/response/compute/v2_1/flavors_extra_specs.py
deleted file mode 100644
index a438d48..0000000
--- a/tempest/api_schema/response/compute/v2_1/flavors_extra_specs.py
+++ /dev/null
@@ -1,40 +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.
-
-set_get_flavor_extra_specs = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'extra_specs': {
- 'type': 'object',
- 'patternProperties': {
- '^[a-zA-Z0-9_\-\. :]+$': {'type': 'string'}
- }
- }
- },
- 'additionalProperties': False,
- 'required': ['extra_specs']
- }
-}
-
-set_get_flavor_extra_specs_key = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'patternProperties': {
- '^[a-zA-Z0-9_\-\. :]+$': {'type': 'string'}
- }
- }
-}
diff --git a/tempest/api_schema/response/compute/v2_1/hosts.py b/tempest/api_schema/response/compute/v2_1/hosts.py
deleted file mode 100644
index ae70ff1..0000000
--- a/tempest/api_schema/response/compute/v2_1/hosts.py
+++ /dev/null
@@ -1,116 +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
-
-
-list_hosts = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'hosts': {
- 'type': 'array',
- 'items': {
- 'type': 'object',
- 'properties': {
- 'host_name': {'type': 'string'},
- 'service': {'type': 'string'},
- 'zone': {'type': 'string'}
- },
- 'additionalProperties': False,
- 'required': ['host_name', 'service', 'zone']
- }
- }
- },
- 'additionalProperties': False,
- 'required': ['hosts']
- }
-}
-
-get_host_detail = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'host': {
- 'type': 'array',
- 'item': {
- 'type': 'object',
- 'properties': {
- 'resource': {
- 'type': 'object',
- 'properties': {
- 'cpu': {'type': 'integer'},
- 'disk_gb': {'type': 'integer'},
- 'host': {'type': 'string'},
- 'memory_mb': {'type': 'integer'},
- 'project': {'type': 'string'}
- },
- 'additionalProperties': False,
- 'required': ['cpu', 'disk_gb', 'host',
- 'memory_mb', 'project']
- }
- },
- 'additionalProperties': False,
- 'required': ['resource']
- }
- }
- },
- 'additionalProperties': False,
- 'required': ['host']
- }
-}
-
-startup_host = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'host': {'type': 'string'},
- 'power_action': {'enum': ['startup']}
- },
- 'additionalProperties': False,
- 'required': ['host', 'power_action']
- }
-}
-
-# The 'power_action' attribute of 'shutdown_host' API is 'shutdown'
-shutdown_host = copy.deepcopy(startup_host)
-
-shutdown_host['response_body']['properties']['power_action'] = {
- 'enum': ['shutdown']
-}
-
-# The 'power_action' attribute of 'reboot_host' API is 'reboot'
-reboot_host = copy.deepcopy(startup_host)
-
-reboot_host['response_body']['properties']['power_action'] = {
- 'enum': ['reboot']
-}
-
-update_host = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'host': {'type': 'string'},
- 'maintenance_mode': {'enum': ['on_maintenance',
- 'off_maintenance']},
- 'status': {'enum': ['enabled', 'disabled']}
- },
- 'additionalProperties': False,
- 'required': ['host', 'maintenance_mode', 'status']
- }
-}
diff --git a/tempest/clients.py b/tempest/clients.py
index 19d3000..43dd316 100644
--- a/tempest/clients.py
+++ b/tempest/clients.py
@@ -26,6 +26,13 @@
CertificatesClient
from tempest_lib.services.compute.extensions_client import \
ExtensionsClient
+from tempest_lib.services.compute.fixed_ips_client import FixedIPsClient
+from tempest_lib.services.compute.flavors_client import FlavorsClient
+from tempest_lib.services.compute.floating_ip_pools_client import \
+ FloatingIPPoolsClient
+from tempest_lib.services.compute.floating_ips_bulk_client import \
+ FloatingIPsBulkClient
+from tempest_lib.services.compute.hosts_client import HostsClient
from tempest_lib.services.identity.v2.token_client import TokenClient
from tempest_lib.services.identity.v3.token_client import V3TokenClient
@@ -37,15 +44,8 @@
from tempest.services.baremetal.v1.json.baremetal_client import \
BaremetalClient
from tempest.services import botoclients
-from tempest.services.compute.json.fixed_ips_client import FixedIPsClient
-from tempest.services.compute.json.flavors_client import FlavorsClient
-from tempest.services.compute.json.floating_ip_pools_client import \
- FloatingIPPoolsClient
-from tempest.services.compute.json.floating_ips_bulk_client import \
- FloatingIPsBulkClient
from tempest.services.compute.json.floating_ips_client import \
FloatingIPsClient
-from tempest.services.compute.json.hosts_client import HostsClient
from tempest.services.compute.json.hypervisor_client import \
HypervisorClient
from tempest.services.compute.json.images_client import ImagesClient
diff --git a/tempest/cmd/javelin.py b/tempest/cmd/javelin.py
index d9588b3..f57e757 100755
--- a/tempest/cmd/javelin.py
+++ b/tempest/cmd/javelin.py
@@ -117,11 +117,11 @@
import six
from tempest_lib import auth
from tempest_lib import exceptions as lib_exc
+from tempest_lib.services.compute import flavors_client
import yaml
from tempest.common import waiters
from tempest import config
-from tempest.services.compute.json import flavors_client
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
diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py
index 036914e..a10dc83 100644
--- a/tempest/scenario/manager.py
+++ b/tempest/scenario/manager.py
@@ -450,21 +450,21 @@
image_name, server['name'])
return snapshot_image
- def nova_volume_attach(self):
+ def nova_volume_attach(self, server, volume_to_attach):
volume = self.servers_client.attach_volume(
- self.server['id'], volumeId=self.volume['id'], device='/dev/%s'
+ server['id'], volumeId=volume_to_attach['id'], device='/dev/%s'
% CONF.compute.volume_device_name)['volumeAttachment']
- self.assertEqual(self.volume['id'], volume['id'])
+ self.assertEqual(volume_to_attach['id'], volume['id'])
self.volumes_client.wait_for_volume_status(volume['id'], 'in-use')
- # Refresh the volume after the attachment
- self.volume = self.volumes_client.show_volume(volume['id'])['volume']
- def nova_volume_detach(self):
- self.servers_client.detach_volume(self.server['id'], self.volume['id'])
- self.volumes_client.wait_for_volume_status(self.volume['id'],
- 'available')
+ # Return the updated volume after the attachment
+ return self.volumes_client.show_volume(volume['id'])['volume']
- volume = self.volumes_client.show_volume(self.volume['id'])['volume']
+ def nova_volume_detach(self, server, volume):
+ self.servers_client.detach_volume(server['id'], volume['id'])
+ self.volumes_client.wait_for_volume_status(volume['id'], 'available')
+
+ volume = self.volumes_client.show_volume(volume['id'])['volume']
self.assertEqual('available', volume['status'])
def rebuild_server(self, server_id, image=None,
@@ -573,8 +573,10 @@
floating_ip['ip'], thing['id'])
return floating_ip
- def create_timestamp(self, server_or_ip, dev_name=None, mount_path='/mnt'):
- ssh_client = self.get_remote_client(server_or_ip)
+ def create_timestamp(self, server_or_ip, dev_name=None, mount_path='/mnt',
+ private_key=None):
+ ssh_client = self.get_remote_client(server_or_ip,
+ private_key=private_key)
if dev_name is not None:
ssh_client.make_fs(dev_name)
ssh_client.mount(dev_name, mount_path)
@@ -586,8 +588,10 @@
ssh_client.umount(mount_path)
return timestamp
- def get_timestamp(self, server_or_ip, dev_name=None, mount_path='/mnt'):
- ssh_client = self.get_remote_client(server_or_ip)
+ def get_timestamp(self, server_or_ip, dev_name=None, mount_path='/mnt',
+ private_key=None):
+ ssh_client = self.get_remote_client(server_or_ip,
+ private_key=private_key)
if dev_name is not None:
ssh_client.mount(dev_name, mount_path)
timestamp = ssh_client.exec_command('sudo cat %s/timestamp'
diff --git a/tempest/scenario/test_encrypted_cinder_volumes.py b/tempest/scenario/test_encrypted_cinder_volumes.py
index b66eb59..3f0123d 100644
--- a/tempest/scenario/test_encrypted_cinder_volumes.py
+++ b/tempest/scenario/test_encrypted_cinder_volumes.py
@@ -54,8 +54,8 @@
self.volume = self.create_volume(volume_type=volume_type['name'])
def attach_detach_volume(self):
- self.nova_volume_attach()
- self.nova_volume_detach()
+ self.volume = self.nova_volume_attach(self.server, self.volume)
+ self.nova_volume_detach(self.server, self.volume)
@test.idempotent_id('79165fb4-5534-4b9d-8429-97ccffb8f86e')
@test.services('compute', 'volume', 'image')
diff --git a/tempest/scenario/test_minimum_basic.py b/tempest/scenario/test_minimum_basic.py
index eac8311..22aa06c 100644
--- a/tempest/scenario/test_minimum_basic.py
+++ b/tempest/scenario/test_minimum_basic.py
@@ -40,66 +40,61 @@
"""
- def _wait_for_server_status(self, status):
- server_id = self.server['id']
+ def _wait_for_server_status(self, server, status):
+ server_id = server['id']
# Raise on error defaults to True, which is consistent with the
# original function from scenario tests here
waiters.wait_for_server_status(self.servers_client,
server_id, status)
- def nova_keypair_add(self):
- self.keypair = self.create_keypair()
-
- def nova_boot(self):
- create_kwargs = {'key_name': self.keypair['name']}
- self.server = self.create_server(image=self.image,
- create_kwargs=create_kwargs)
+ 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...
- servers = servers['servers']
- self.assertIn(self.server['id'], [x['id'] for x in servers])
+ return servers['servers']
- def nova_show(self):
- got_server = (self.servers_client.show_server(self.server['id'])
+ def nova_show(self, server):
+ got_server = (self.servers_client.show_server(server['id'])
['server'])
excluded_keys = ['OS-EXT-AZ:availability_zone']
# Exclude these keys because of LP:#1486475
excluded_keys.extend(['OS-EXT-STS:power_state', 'updated'])
self.assertThat(
- self.server, custom_matchers.MatchesDictExceptForKeys(
+ server, custom_matchers.MatchesDictExceptForKeys(
got_server, excluded_keys=excluded_keys))
def cinder_create(self):
- self.volume = self.create_volume()
+ return self.create_volume()
def cinder_list(self):
- volumes = self.volumes_client.list_volumes()['volumes']
- self.assertIn(self.volume['id'], [x['id'] for x in volumes])
+ return self.volumes_client.list_volumes()['volumes']
- def cinder_show(self):
- volume = self.volumes_client.show_volume(self.volume['id'])['volume']
- self.assertEqual(self.volume, volume)
+ def cinder_show(self, volume):
+ got_volume = self.volumes_client.show_volume(volume['id'])['volume']
+ self.assertEqual(volume, got_volume)
- def nova_reboot(self):
- self.servers_client.reboot_server(self.server['id'], 'SOFT')
- self._wait_for_server_status('ACTIVE')
+ def nova_reboot(self, server):
+ self.servers_client.reboot_server(server['id'], 'SOFT')
+ self._wait_for_server_status(server, 'ACTIVE')
def check_partitions(self):
# NOTE(andreaf) The device name may be different on different guest OS
partitions = self.linux_client.get_partitions()
self.assertEqual(1, partitions.count(CONF.compute.volume_device_name))
- def create_and_add_security_group(self):
+ def create_and_add_security_group_to_server(self, server):
secgroup = self._create_security_group()
- self.servers_client.add_security_group(self.server['id'],
+ self.servers_client.add_security_group(server['id'],
secgroup['name'])
self.addCleanup(self.servers_client.remove_security_group,
- self.server['id'], secgroup['name'])
+ server['id'], secgroup['name'])
def wait_for_secgroup_add():
- body = (self.servers_client.show_server(self.server['id'])
+ body = (self.servers_client.show_server(server['id'])
['server'])
return {'name': secgroup['name']} in body['security_groups']
@@ -107,29 +102,39 @@
CONF.compute.build_timeout,
CONF.compute.build_interval):
msg = ('Timed out waiting for adding security group %s to server '
- '%s' % (secgroup['id'], self.server['id']))
+ '%s' % (secgroup['id'], server['id']))
raise exceptions.TimeoutException(msg)
@test.idempotent_id('bdbb5441-9204-419d-a225-b4fdbfb1a1a8')
@test.services('compute', 'volume', 'image', 'network')
def test_minimum_basic_scenario(self):
self.glance_image_create()
- self.nova_keypair_add()
- self.nova_boot()
- self.nova_list()
- self.nova_show()
- self.cinder_create()
- self.cinder_list()
- self.cinder_show()
- self.nova_volume_attach()
- self.addCleanup(self.nova_volume_detach)
- self.cinder_show()
- self.floating_ip = self.create_floating_ip(self.server)
- self.create_and_add_security_group()
+ keypair = self.create_keypair()
- self.linux_client = self.get_remote_client(self.floating_ip['ip'])
- self.nova_reboot()
+ server = self.nova_boot(keypair)
+ servers = self.nova_list()
+ self.assertIn(server['id'], [x['id'] for x in servers])
- self.linux_client = self.get_remote_client(self.floating_ip['ip'])
+ self.nova_show(server)
+
+ volume = self.cinder_create()
+ volumes = self.cinder_list()
+ self.assertIn(volume['id'], [x['id'] for x in volumes])
+
+ self.cinder_show(volume)
+
+ volume = self.nova_volume_attach(server, volume)
+ self.addCleanup(self.nova_volume_detach, server, volume)
+ self.cinder_show(volume)
+
+ floating_ip = self.create_floating_ip(server)
+ self.create_and_add_security_group_to_server(server)
+
+ self.linux_client = self.get_remote_client(
+ floating_ip['ip'], private_key=keypair['private_key'])
+ self.nova_reboot(server)
+
+ self.linux_client = self.get_remote_client(
+ floating_ip['ip'], private_key=keypair['private_key'])
self.check_partitions()
diff --git a/tempest/scenario/test_network_advanced_server_ops.py b/tempest/scenario/test_network_advanced_server_ops.py
index 62b2976..704342f 100644
--- a/tempest/scenario/test_network_advanced_server_ops.py
+++ b/tempest/scenario/test_network_advanced_server_ops.py
@@ -56,7 +56,7 @@
super(TestNetworkAdvancedServerOps, cls).setup_credentials()
def _setup_network_and_servers(self):
- self.keypair = self.create_keypair()
+ keypair = self.create_keypair()
security_group = self._create_security_group()
network, subnet, router = self.create_networks()
public_network_id = CONF.network.public_network_id
@@ -64,91 +64,103 @@
'networks': [
{'uuid': network.id},
],
- 'key_name': self.keypair['name'],
+ 'key_name': keypair['name'],
'security_groups': [{'name': security_group['name']}],
}
server_name = data_utils.rand_name('server-smoke')
- self.server = self.create_server(name=server_name,
- create_kwargs=create_kwargs)
- self.floating_ip = self.create_floating_ip(self.server,
- public_network_id)
+ server = self.create_server(name=server_name,
+ create_kwargs=create_kwargs)
+ floating_ip = self.create_floating_ip(server, public_network_id)
# Verify that we can indeed connect to the server before we mess with
# it's state
- self._wait_server_status_and_check_network_connectivity()
+ self._wait_server_status_and_check_network_connectivity(
+ server, keypair, floating_ip)
- def _check_network_connectivity(self, should_connect=True):
+ return server, keypair, floating_ip
+
+ def _check_network_connectivity(self, server, keypair, floating_ip,
+ should_connect=True):
username = CONF.compute.image_ssh_user
- private_key = self.keypair['private_key']
+ private_key = keypair['private_key']
self._check_tenant_network_connectivity(
- self.server, username, private_key,
+ server, username, private_key,
should_connect=should_connect,
- servers_for_debug=[self.server])
- floating_ip = self.floating_ip.floating_ip_address
+ servers_for_debug=[server])
+ floating_ip_addr = floating_ip.floating_ip_address
# Check FloatingIP status before checking the connectivity
- self.check_floating_ip_status(self.floating_ip, 'ACTIVE')
- self.check_public_network_connectivity(floating_ip, username,
+ self.check_floating_ip_status(floating_ip, 'ACTIVE')
+ self.check_public_network_connectivity(floating_ip_addr, username,
private_key, should_connect,
- servers=[self.server])
+ servers=[server])
- def _wait_server_status_and_check_network_connectivity(self):
- waiters.wait_for_server_status(self.servers_client,
- self.server['id'], 'ACTIVE')
- self._check_network_connectivity()
+ def _wait_server_status_and_check_network_connectivity(self, server,
+ keypair,
+ floating_ip):
+ waiters.wait_for_server_status(self.servers_client, server['id'],
+ 'ACTIVE')
+ self._check_network_connectivity(server, keypair, floating_ip)
@test.idempotent_id('61f1aa9a-1573-410e-9054-afa557cab021')
@test.stresstest(class_setup_per='process')
@test.services('compute', 'network')
def test_server_connectivity_stop_start(self):
- self._setup_network_and_servers()
- self.servers_client.stop_server(self.server['id'])
- waiters.wait_for_server_status(self.servers_client,
- self.server['id'], 'SHUTOFF')
- self._check_network_connectivity(should_connect=False)
- self.servers_client.start_server(self.server['id'])
- self._wait_server_status_and_check_network_connectivity()
+ server, keypair, floating_ip = self._setup_network_and_servers()
+ self.servers_client.stop_server(server['id'])
+ waiters.wait_for_server_status(self.servers_client, server['id'],
+ 'SHUTOFF')
+ self._check_network_connectivity(server, keypair, floating_ip,
+ should_connect=False)
+ self.servers_client.start_server(server['id'])
+ self._wait_server_status_and_check_network_connectivity(
+ server, keypair, floating_ip)
@test.idempotent_id('7b6860c2-afa3-4846-9522-adeb38dfbe08')
@test.services('compute', 'network')
def test_server_connectivity_reboot(self):
- self._setup_network_and_servers()
- self.servers_client.reboot_server(self.server['id'],
- reboot_type='SOFT')
- self._wait_server_status_and_check_network_connectivity()
+ server, keypair, floating_ip = self._setup_network_and_servers()
+ self.servers_client.reboot_server(server['id'], reboot_type='SOFT')
+ self._wait_server_status_and_check_network_connectivity(
+ server, keypair, floating_ip)
@test.idempotent_id('88a529c2-1daa-4c85-9aec-d541ba3eb699')
@test.services('compute', 'network')
def test_server_connectivity_rebuild(self):
- self._setup_network_and_servers()
+ server, keypair, floating_ip = self._setup_network_and_servers()
image_ref_alt = CONF.compute.image_ref_alt
- self.servers_client.rebuild_server(self.server['id'],
+ self.servers_client.rebuild_server(server['id'],
image_ref=image_ref_alt)
- self._wait_server_status_and_check_network_connectivity()
+ self._wait_server_status_and_check_network_connectivity(
+ server, keypair, floating_ip)
@test.idempotent_id('2b2642db-6568-4b35-b812-eceed3fa20ce')
@testtools.skipUnless(CONF.compute_feature_enabled.pause,
'Pause is not available.')
@test.services('compute', 'network')
def test_server_connectivity_pause_unpause(self):
- self._setup_network_and_servers()
- self.servers_client.pause_server(self.server['id'])
- waiters.wait_for_server_status(self.servers_client,
- self.server['id'], 'PAUSED')
- self._check_network_connectivity(should_connect=False)
- self.servers_client.unpause_server(self.server['id'])
- self._wait_server_status_and_check_network_connectivity()
+ server, keypair, floating_ip = self._setup_network_and_servers()
+ self.servers_client.pause_server(server['id'])
+ waiters.wait_for_server_status(self.servers_client, server['id'],
+ 'PAUSED')
+ self._check_network_connectivity(server, keypair, floating_ip,
+ should_connect=False)
+ self.servers_client.unpause_server(server['id'])
+ self._wait_server_status_and_check_network_connectivity(
+ server, keypair, floating_ip)
@test.idempotent_id('5cdf9499-541d-4923-804e-b9a60620a7f0')
@testtools.skipUnless(CONF.compute_feature_enabled.suspend,
'Suspend is not available.')
@test.services('compute', 'network')
def test_server_connectivity_suspend_resume(self):
- self._setup_network_and_servers()
- self.servers_client.suspend_server(self.server['id'])
- waiters.wait_for_server_status(self.servers_client, self.server['id'],
+ server, keypair, floating_ip = self._setup_network_and_servers()
+ self.servers_client.suspend_server(server['id'])
+ waiters.wait_for_server_status(self.servers_client, server['id'],
'SUSPENDED')
- self._check_network_connectivity(should_connect=False)
- self.servers_client.resume_server(self.server['id'])
- self._wait_server_status_and_check_network_connectivity()
+ self._check_network_connectivity(server, keypair, floating_ip,
+ should_connect=False)
+ self.servers_client.resume_server(server['id'])
+ self._wait_server_status_and_check_network_connectivity(
+ server, keypair, floating_ip)
@test.idempotent_id('719eb59d-2f42-4b66-b8b1-bb1254473967')
@testtools.skipUnless(CONF.compute_feature_enabled.resize,
@@ -159,10 +171,11 @@
if resize_flavor == CONF.compute.flavor_ref:
msg = "Skipping test - flavor_ref and flavor_ref_alt are identical"
raise self.skipException(msg)
- self._setup_network_and_servers()
- self.servers_client.resize_server(self.server['id'],
+ server, keypair, floating_ip = self._setup_network_and_servers()
+ self.servers_client.resize_server(server['id'],
flavor_ref=resize_flavor)
- waiters.wait_for_server_status(self.servers_client, self.server['id'],
+ waiters.wait_for_server_status(self.servers_client, server['id'],
'VERIFY_RESIZE')
- self.servers_client.confirm_resize_server(self.server['id'])
- self._wait_server_status_and_check_network_connectivity()
+ self.servers_client.confirm_resize_server(server['id'])
+ self._wait_server_status_and_check_network_connectivity(
+ server, keypair, floating_ip)
diff --git a/tempest/scenario/test_shelve_instance.py b/tempest/scenario/test_shelve_instance.py
index dbc9bbb..bc80412 100644
--- a/tempest/scenario/test_shelve_instance.py
+++ b/tempest/scenario/test_shelve_instance.py
@@ -55,12 +55,12 @@
'ACTIVE')
def _create_server_then_shelve_and_unshelve(self, boot_from_volume=False):
- self.keypair = self.create_keypair()
+ keypair = self.create_keypair()
- self.security_group = self._create_security_group()
- security_groups = [{'name': self.security_group['name']}]
+ security_group = self._create_security_group()
+ security_groups = [{'name': security_group['name']}]
create_kwargs = {
- 'key_name': self.keypair['name'],
+ 'key_name': keypair['name'],
'security_groups': security_groups
}
@@ -86,18 +86,22 @@
floating_ip['id'])
self.floating_ips_client.associate_floating_ip_to_server(
floating_ip['ip'], server['id'])
- timestamp = self.create_timestamp(floating_ip['ip'])
+ timestamp = self.create_timestamp(
+ floating_ip['ip'], private_key=keypair['private_key'])
else:
- timestamp = self.create_timestamp(server)
+ timestamp = self.create_timestamp(
+ server, private_key=keypair['private_key'])
# Prevent bug #1257594 from coming back
# Unshelve used to boot the instance with the original image, not
# with the instance snapshot
self._shelve_then_unshelve_server(server)
if CONF.compute.use_floatingip_for_ssh:
- timestamp2 = self.get_timestamp(floating_ip['ip'])
+ timestamp2 = self.get_timestamp(floating_ip['ip'],
+ private_key=keypair['private_key'])
else:
- timestamp2 = self.get_timestamp(server)
+ timestamp2 = self.get_timestamp(server,
+ private_key=keypair['private_key'])
self.assertEqual(timestamp, timestamp2)
@test.idempotent_id('1164e700-0af0-4a4c-8792-35909a88743c')
diff --git a/tempest/scenario/test_snapshot_pattern.py b/tempest/scenario/test_snapshot_pattern.py
index 79b809f..5ac3a7e 100644
--- a/tempest/scenario/test_snapshot_pattern.py
+++ b/tempest/scenario/test_snapshot_pattern.py
@@ -36,44 +36,47 @@
"""
- def _boot_image(self, image_id):
- security_groups = [{'name': self.security_group['name']}]
+ def _boot_image(self, image_id, keypair, security_group):
+ security_groups = [{'name': security_group['name']}]
create_kwargs = {
- 'key_name': self.keypair['name'],
+ 'key_name': keypair['name'],
'security_groups': security_groups
}
return self.create_server(image=image_id, create_kwargs=create_kwargs)
- def _add_keypair(self):
- self.keypair = self.create_keypair()
-
@test.idempotent_id('608e604b-1d63-4a82-8e3e-91bc665c90b4')
@testtools.skipUnless(CONF.compute_feature_enabled.snapshot,
'Snapshotting is not available.')
@test.services('compute', 'network', 'image')
def test_snapshot_pattern(self):
# prepare for booting an instance
- self._add_keypair()
- self.security_group = self._create_security_group()
+ keypair = self.create_keypair()
+ security_group = self._create_security_group()
# boot an instance and create a timestamp file in it
- server = self._boot_image(CONF.compute.image_ref)
+ server = self._boot_image(CONF.compute.image_ref, keypair,
+ security_group)
if CONF.compute.use_floatingip_for_ssh:
fip_for_server = self.create_floating_ip(server)
- timestamp = self.create_timestamp(fip_for_server['ip'])
+ timestamp = self.create_timestamp(
+ fip_for_server['ip'], private_key=keypair['private_key'])
else:
- timestamp = self.create_timestamp(server)
+ timestamp = self.create_timestamp(
+ server, private_key=keypair['private_key'])
# snapshot the instance
snapshot_image = self.create_server_snapshot(server=server)
# boot a second instance from the snapshot
- server_from_snapshot = self._boot_image(snapshot_image['id'])
+ server_from_snapshot = self._boot_image(snapshot_image['id'],
+ keypair, security_group)
# check the existence of the timestamp file in the second instance
if CONF.compute.use_floatingip_for_ssh:
fip_for_snapshot = self.create_floating_ip(server_from_snapshot)
- timestamp2 = self.get_timestamp(fip_for_snapshot['ip'])
+ timestamp2 = self.get_timestamp(fip_for_snapshot['ip'],
+ private_key=keypair['private_key'])
else:
- timestamp2 = self.get_timestamp(server_from_snapshot)
+ timestamp2 = self.get_timestamp(server_from_snapshot,
+ private_key=keypair['private_key'])
self.assertEqual(timestamp, timestamp2)
diff --git a/tempest/scenario/test_stamp_pattern.py b/tempest/scenario/test_stamp_pattern.py
index a4f9896..6eceeb2 100644
--- a/tempest/scenario/test_stamp_pattern.py
+++ b/tempest/scenario/test_stamp_pattern.py
@@ -63,20 +63,17 @@
self.snapshots_client.wait_for_snapshot_status(volume_snapshot['id'],
status)
- def _boot_image(self, image_id):
- security_groups = [{'name': self.security_group['name']}]
+ def _boot_image(self, image_id, keypair, security_group):
+ security_groups = [{'name': security_group['name']}]
create_kwargs = {
- 'key_name': self.keypair['name'],
+ 'key_name': keypair['name'],
'security_groups': security_groups
}
return self.create_server(image=image_id, create_kwargs=create_kwargs)
- def _add_keypair(self):
- self.keypair = self.create_keypair()
-
def _create_volume_snapshot(self, volume):
snapshot_name = data_utils.rand_name('scenario-snapshot')
- _, snapshot = self.snapshots_client.create_snapshot(
+ snapshot = self.snapshots_client.create_snapshot(
volume['id'], display_name=snapshot_name)['snapshot']
def cleaner():
@@ -111,8 +108,9 @@
self.servers_client.detach_volume(server['id'], volume['id'])
self._wait_for_volume_status(volume, 'available')
- def _wait_for_volume_available_on_the_system(self, server_or_ip):
- ssh = self.get_remote_client(server_or_ip)
+ def _wait_for_volume_available_on_the_system(self, server_or_ip,
+ private_key):
+ ssh = self.get_remote_client(server_or_ip, private_key=private_key)
def _func():
part = ssh.get_partitions()
@@ -131,12 +129,13 @@
@tempest.test.services('compute', 'network', 'volume', 'image')
def test_stamp_pattern(self):
# prepare for booting an instance
- self._add_keypair()
- self.security_group = self._create_security_group()
+ keypair = self.create_keypair()
+ security_group = self._create_security_group()
# boot an instance and create a timestamp file in it
volume = self._create_volume()
- server = self._boot_image(CONF.compute.image_ref)
+ server = self._boot_image(CONF.compute.image_ref, keypair,
+ security_group)
# create and add floating IP to server1
if CONF.compute.use_floatingip_for_ssh:
@@ -146,9 +145,11 @@
ip_for_server = server
self._attach_volume(server, volume)
- self._wait_for_volume_available_on_the_system(ip_for_server)
+ self._wait_for_volume_available_on_the_system(ip_for_server,
+ keypair['private_key'])
timestamp = self.create_timestamp(ip_for_server,
- CONF.compute.volume_device_name)
+ CONF.compute.volume_device_name,
+ private_key=keypair['private_key'])
self._detach_volume(server, volume)
# snapshot the volume
@@ -162,7 +163,8 @@
snapshot_id=volume_snapshot['id'])
# boot second instance from the snapshot(instance2)
- server_from_snapshot = self._boot_image(snapshot_image['id'])
+ server_from_snapshot = self._boot_image(snapshot_image['id'],
+ keypair, security_group)
# create and add floating IP to server_from_snapshot
if CONF.compute.use_floatingip_for_ssh:
@@ -174,9 +176,11 @@
# attach volume2 to instance2
self._attach_volume(server_from_snapshot, volume_from_snapshot)
- self._wait_for_volume_available_on_the_system(ip_for_snapshot)
+ self._wait_for_volume_available_on_the_system(ip_for_snapshot,
+ keypair['private_key'])
# check the existence of the timestamp file in the volume2
timestamp2 = self.get_timestamp(ip_for_snapshot,
- CONF.compute.volume_device_name)
+ CONF.compute.volume_device_name,
+ private_key=keypair['private_key'])
self.assertEqual(timestamp, timestamp2)
diff --git a/tempest/services/compute/json/fixed_ips_client.py b/tempest/services/compute/json/fixed_ips_client.py
deleted file mode 100644
index 7b374aa..0000000
--- a/tempest/services/compute/json/fixed_ips_client.py
+++ /dev/null
@@ -1,36 +0,0 @@
-# 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 tempest.api_schema.response.compute.v2_1 import fixed_ips as schema
-from tempest.common import service_client
-
-
-class FixedIPsClient(service_client.ServiceClient):
-
- def show_fixed_ip(self, fixed_ip):
- url = "os-fixed-ips/%s" % fixed_ip
- resp, body = self.get(url)
- body = json.loads(body)
- self.validate_response(schema.get_fixed_ip, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def reserve_fixed_ip(self, fixed_ip, **kwargs):
- """This reserves and unreserves fixed ips."""
- url = "os-fixed-ips/%s/action" % fixed_ip
- resp, body = self.post(url, json.dumps(kwargs))
- self.validate_response(schema.reserve_unreserve_fixed_ip, resp, body)
- return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/compute/json/flavors_client.py b/tempest/services/compute/json/flavors_client.py
deleted file mode 100644
index 2c32d30..0000000
--- a/tempest/services/compute/json/flavors_client.py
+++ /dev/null
@@ -1,169 +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.api_schema.response.compute.v2_1 import flavors as schema
-from tempest.api_schema.response.compute.v2_1 import flavors_access \
- as schema_access
-from tempest.api_schema.response.compute.v2_1 import flavors_extra_specs \
- as schema_extra_specs
-from tempest.common import service_client
-
-
-class FlavorsClient(service_client.ServiceClient):
-
- def list_flavors(self, detail=False, **params):
- url = 'flavors'
- _schema = schema.list_flavors
-
- if detail:
- url += '/detail'
- _schema = schema.list_flavors_details
- if params:
- url += '?%s' % urllib.urlencode(params)
-
- resp, body = self.get(url)
- body = json.loads(body)
- self.validate_response(_schema, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def show_flavor(self, flavor_id):
- resp, body = self.get("flavors/%s" % flavor_id)
- body = json.loads(body)
- self.validate_response(schema.create_get_flavor_details, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def create_flavor(self, **kwargs):
- """Creates a new flavor or instance type.
- Most parameters except the following are passed to the API without
- any changes.
- :param ephemeral: The name is changed to OS-FLV-EXT-DATA:ephemeral
- :param is_public: The name is changed to os-flavor-access:is_public
- """
- if kwargs.get('ephemeral'):
- kwargs['OS-FLV-EXT-DATA:ephemeral'] = kwargs.pop('ephemeral')
- if kwargs.get('is_public'):
- kwargs['os-flavor-access:is_public'] = kwargs.pop('is_public')
-
- post_body = json.dumps({'flavor': kwargs})
- resp, body = self.post('flavors', post_body)
-
- body = json.loads(body)
- self.validate_response(schema.create_get_flavor_details, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def delete_flavor(self, flavor_id):
- """Deletes the given flavor."""
- resp, body = self.delete("flavors/{0}".format(flavor_id))
- self.validate_response(schema.delete_flavor, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def is_resource_deleted(self, id):
- # Did not use show_flavor(id) for verification as it gives
- # 200 ok even for deleted id. LP #981263
- # we can remove the loop here and use get by ID when bug gets sortedout
- flavors = self.list_flavors(detail=True)['flavors']
- for flavor in flavors:
- if flavor['id'] == id:
- return False
- return True
-
- @property
- def resource_type(self):
- """Returns the primary type of resource this client works with."""
- return 'flavor'
-
- def set_flavor_extra_spec(self, flavor_id, **kwargs):
- """Sets extra Specs to the mentioned flavor."""
- post_body = json.dumps({'extra_specs': kwargs})
- resp, body = self.post('flavors/%s/os-extra_specs' % flavor_id,
- post_body)
- body = json.loads(body)
- self.validate_response(schema_extra_specs.set_get_flavor_extra_specs,
- resp, body)
- return service_client.ResponseBody(resp, body)
-
- def list_flavor_extra_specs(self, flavor_id):
- """Gets extra Specs details of the mentioned flavor."""
- resp, body = self.get('flavors/%s/os-extra_specs' % flavor_id)
- body = json.loads(body)
- self.validate_response(schema_extra_specs.set_get_flavor_extra_specs,
- resp, body)
- return service_client.ResponseBody(resp, body)
-
- def show_flavor_extra_spec(self, flavor_id, key):
- """Gets extra Specs key-value of the mentioned flavor and key."""
- resp, body = self.get('flavors/%s/os-extra_specs/%s' % (flavor_id,
- key))
- body = json.loads(body)
- self.validate_response(
- schema_extra_specs.set_get_flavor_extra_specs_key,
- resp, body)
- return service_client.ResponseBody(resp, body)
-
- def update_flavor_extra_spec(self, flavor_id, key, **kwargs):
- """Update specified extra Specs of the mentioned flavor and key."""
- resp, body = self.put('flavors/%s/os-extra_specs/%s' %
- (flavor_id, key), json.dumps(kwargs))
- body = json.loads(body)
- self.validate_response(
- schema_extra_specs.set_get_flavor_extra_specs_key,
- resp, body)
- return service_client.ResponseBody(resp, body)
-
- def unset_flavor_extra_spec(self, flavor_id, key):
- """Unsets extra Specs from the mentioned flavor."""
- resp, body = self.delete('flavors/%s/os-extra_specs/%s' %
- (flavor_id, key))
- self.validate_response(schema.unset_flavor_extra_specs, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def list_flavor_access(self, flavor_id):
- """Gets flavor access information given the flavor id."""
- resp, body = self.get('flavors/%s/os-flavor-access' % flavor_id)
- body = json.loads(body)
- self.validate_response(schema_access.add_remove_list_flavor_access,
- resp, body)
- return service_client.ResponseBody(resp, body)
-
- def add_flavor_access(self, flavor_id, tenant_id):
- """Add flavor access for the specified tenant."""
- post_body = {
- 'addTenantAccess': {
- 'tenant': tenant_id
- }
- }
- post_body = json.dumps(post_body)
- resp, body = self.post('flavors/%s/action' % flavor_id, post_body)
- body = json.loads(body)
- self.validate_response(schema_access.add_remove_list_flavor_access,
- resp, body)
- return service_client.ResponseBody(resp, body)
-
- def remove_flavor_access(self, flavor_id, tenant_id):
- """Remove flavor access from the specified tenant."""
- post_body = {
- 'removeTenantAccess': {
- 'tenant': tenant_id
- }
- }
- post_body = json.dumps(post_body)
- resp, body = self.post('flavors/%s/action' % flavor_id, post_body)
- body = json.loads(body)
- self.validate_response(schema_access.add_remove_list_flavor_access,
- resp, body)
- return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/compute/json/floating_ip_pools_client.py b/tempest/services/compute/json/floating_ip_pools_client.py
deleted file mode 100644
index c83537a..0000000
--- a/tempest/services/compute/json/floating_ip_pools_client.py
+++ /dev/null
@@ -1,34 +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.api_schema.response.compute.v2_1 import floating_ips as schema
-from tempest.common import service_client
-
-
-class FloatingIPPoolsClient(service_client.ServiceClient):
-
- def list_floating_ip_pools(self, params=None):
- """Gets all floating IP Pools list."""
- url = 'os-floating-ip-pools'
- if params:
- url += '?%s' % urllib.urlencode(params)
-
- resp, body = self.get(url)
- body = json.loads(body)
- self.validate_response(schema.list_floating_ip_pools, resp, body)
- return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/compute/json/floating_ips_bulk_client.py b/tempest/services/compute/json/floating_ips_bulk_client.py
deleted file mode 100644
index dfe69f0..0000000
--- a/tempest/services/compute/json/floating_ips_bulk_client.py
+++ /dev/null
@@ -1,50 +0,0 @@
-# Copyright 2012 OpenStack Foundation
-# All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-from oslo_serialization import jsonutils as json
-
-from tempest.api_schema.response.compute.v2_1 import floating_ips as schema
-from tempest.common import service_client
-
-
-class FloatingIPsBulkClient(service_client.ServiceClient):
-
- def create_floating_ips_bulk(self, ip_range, pool, interface):
- """Allocate floating IPs in bulk."""
- post_body = {
- 'ip_range': ip_range,
- 'pool': pool,
- 'interface': interface
- }
- post_body = json.dumps({'floating_ips_bulk_create': post_body})
- resp, body = self.post('os-floating-ips-bulk', post_body)
- body = json.loads(body)
- self.validate_response(schema.create_floating_ips_bulk, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def list_floating_ips_bulk(self):
- """Gets all floating IPs in bulk."""
- resp, body = self.get('os-floating-ips-bulk')
- body = json.loads(body)
- self.validate_response(schema.list_floating_ips_bulk, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def delete_floating_ips_bulk(self, ip_range):
- """Deletes the provided floating IPs in bulk."""
- post_body = json.dumps({'ip_range': ip_range})
- resp, body = self.put('os-floating-ips-bulk/delete', post_body)
- body = json.loads(body)
- self.validate_response(schema.delete_floating_ips_bulk, resp, body)
- return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/compute/json/hosts_client.py b/tempest/services/compute/json/hosts_client.py
deleted file mode 100644
index 3d3cb18..0000000
--- a/tempest/services/compute/json/hosts_client.py
+++ /dev/null
@@ -1,81 +0,0 @@
-# Copyright 2013 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 oslo_serialization import jsonutils as json
-from six.moves.urllib import parse as urllib
-
-from tempest.api_schema.response.compute.v2_1 import hosts as schema
-from tempest.common import service_client
-
-
-class HostsClient(service_client.ServiceClient):
-
- def list_hosts(self, **params):
- """Lists all hosts."""
-
- url = 'os-hosts'
- if params:
- url += '?%s' % urllib.urlencode(params)
-
- resp, body = self.get(url)
- body = json.loads(body)
- self.validate_response(schema.list_hosts, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def show_host(self, hostname):
- """Show detail information for the host."""
-
- resp, body = self.get("os-hosts/%s" % hostname)
- body = json.loads(body)
- self.validate_response(schema.get_host_detail, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def update_host(self, hostname, **kwargs):
- """Update a host."""
-
- request_body = {
- 'status': None,
- 'maintenance_mode': None,
- }
- request_body.update(**kwargs)
- request_body = json.dumps(request_body)
-
- resp, body = self.put("os-hosts/%s" % hostname, request_body)
- body = json.loads(body)
- self.validate_response(schema.update_host, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def startup_host(self, hostname):
- """Startup a host."""
-
- resp, body = self.get("os-hosts/%s/startup" % hostname)
- body = json.loads(body)
- self.validate_response(schema.startup_host, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def shutdown_host(self, hostname):
- """Shutdown a host."""
-
- resp, body = self.get("os-hosts/%s/shutdown" % hostname)
- body = json.loads(body)
- self.validate_response(schema.shutdown_host, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def reboot_host(self, hostname):
- """reboot a host."""
-
- resp, body = self.get("os-hosts/%s/reboot" % hostname)
- body = json.loads(body)
- self.validate_response(schema.reboot_host, resp, body)
- return service_client.ResponseBody(resp, body)
diff --git a/tempest/tests/services/compute/test_fixedIPs_client.py b/tempest/tests/services/compute/test_fixedIPs_client.py
deleted file mode 100644
index b537baa..0000000
--- a/tempest/tests/services/compute/test_fixedIPs_client.py
+++ /dev/null
@@ -1,59 +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 fixed_ips_client
-from tempest.tests.services.compute import base
-
-
-class TestFixedIPsClient(base.BaseComputeServiceTest):
- FIXED_IP_INFO = {"fixed_ip": {"address": "10.0.0.1",
- "cidr": "10.11.12.0/24",
- "host": "localhost",
- "hostname": "OpenStack"}}
-
- def setUp(self):
- super(TestFixedIPsClient, self).setUp()
- fake_auth = fake_auth_provider.FakeAuthProvider()
- self.fixedIPsClient = (fixed_ips_client.
- FixedIPsClient
- (fake_auth, 'compute',
- 'regionOne'))
-
- def _test_show_fixed_ip(self, bytes_body=False):
- self.check_service_client_function(
- self.fixedIPsClient.show_fixed_ip,
- 'tempest.common.service_client.ServiceClient.get',
- self.FIXED_IP_INFO, bytes_body,
- status=200, fixed_ip='Identifier')
-
- def test_show_fixed_ip_with_str_body(self):
- self._test_show_fixed_ip()
-
- def test_show_fixed_ip_with_bytes_body(self):
- self._test_show_fixed_ip(True)
-
- def _test_reserve_fixed_ip(self, bytes_body=False):
- self.check_service_client_function(
- self.fixedIPsClient.reserve_fixed_ip,
- 'tempest.common.service_client.ServiceClient.post',
- {}, bytes_body,
- status=202, fixed_ip='Identifier')
-
- def test_reserve_fixed_ip_with_str_body(self):
- self._test_reserve_fixed_ip()
-
- def test_reserve_fixed_ip_with_bytes_body(self):
- self._test_reserve_fixed_ip(True)
diff --git a/tempest/tests/services/compute/test_flavors_client.py b/tempest/tests/services/compute/test_flavors_client.py
deleted file mode 100644
index 6c0edb8..0000000
--- a/tempest/tests/services/compute/test_flavors_client.py
+++ /dev/null
@@ -1,255 +0,0 @@
-# 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.
-
-import copy
-import httplib2
-
-from oslo_serialization import jsonutils as json
-from oslotest import mockpatch
-
-from tempest.services.compute.json import flavors_client
-from tempest.tests import fake_auth_provider
-from tempest.tests.services.compute import base
-
-
-class TestFlavorsClient(base.BaseComputeServiceTest):
-
- FAKE_FLAVOR = {
- "disk": 1,
- "id": "1",
- "links": [{
- "href": "http://openstack.example.com/v2/openstack/flavors/1",
- "rel": "self"}, {
- "href": "http://openstack.example.com/openstack/flavors/1",
- "rel": "bookmark"}],
- "name": "m1.tiny",
- "ram": 512,
- "swap": 1,
- "vcpus": 1
- }
-
- EXTRA_SPECS = {"extra_specs": {
- "key1": "value1",
- "key2": "value2"}
- }
-
- FAKE_FLAVOR_ACCESS = {
- "flavor_id": "10",
- "tenant_id": "1a951d988e264818afe520e78697dcbf"
- }
-
- def setUp(self):
- super(TestFlavorsClient, self).setUp()
- fake_auth = fake_auth_provider.FakeAuthProvider()
- self.client = flavors_client.FlavorsClient(fake_auth,
- 'compute', 'regionOne')
-
- def _test_list_flavors(self, bytes_body=False):
- flavor = copy.deepcopy(TestFlavorsClient.FAKE_FLAVOR)
- # Remove extra attributes
- for attribute in ('disk', 'vcpus', 'ram', 'swap'):
- del flavor[attribute]
- expected = {'flavors': [flavor]}
- self.check_service_client_function(
- self.client.list_flavors,
- 'tempest.common.service_client.ServiceClient.get',
- expected,
- bytes_body)
-
- def test_list_flavors_str_body(self):
- self._test_list_flavors(bytes_body=False)
-
- def test_list_flavors_byte_body(self):
- self._test_list_flavors(bytes_body=True)
-
- def _test_show_flavor(self, bytes_body=False):
- expected = {"flavor": TestFlavorsClient.FAKE_FLAVOR}
- self.check_service_client_function(
- self.client.show_flavor,
- 'tempest.common.service_client.ServiceClient.get',
- expected,
- bytes_body,
- flavor_id='fake-id')
-
- def test_show_flavor_str_body(self):
- self._test_show_flavor(bytes_body=False)
-
- def test_show_flavor_byte_body(self):
- self._test_show_flavor(bytes_body=True)
-
- def _test_create_flavor(self, bytes_body=False):
- expected = {"flavor": TestFlavorsClient.FAKE_FLAVOR}
- request = copy.deepcopy(TestFlavorsClient.FAKE_FLAVOR)
- # The 'links' parameter should not be passed in
- del request['links']
- self.check_service_client_function(
- self.client.create_flavor,
- 'tempest.common.service_client.ServiceClient.post',
- expected,
- bytes_body,
- **request)
-
- def test_create_flavor_str_body(self):
- self._test_create_flavor(bytes_body=False)
-
- def test_create_flavor__byte_body(self):
- self._test_create_flavor(bytes_body=True)
-
- def test_delete_flavor(self):
- self.check_service_client_function(
- self.client.delete_flavor,
- 'tempest.common.service_client.ServiceClient.delete',
- {}, status=202, flavor_id='c782b7a9-33cd-45f0-b795-7f87f456408b')
-
- def _test_is_resource_deleted(self, flavor_id, is_deleted=True,
- bytes_body=False):
- body = json.dumps({'flavors': [TestFlavorsClient.FAKE_FLAVOR]})
- if bytes_body:
- body = body.encode('utf-8')
- response = (httplib2.Response({'status': 200}), body)
- self.useFixture(mockpatch.Patch(
- 'tempest.common.service_client.ServiceClient.get',
- return_value=response))
- self.assertEqual(is_deleted,
- self.client.is_resource_deleted(flavor_id))
-
- def test_is_resource_deleted_true_str_body(self):
- self._test_is_resource_deleted('2', bytes_body=False)
-
- def test_is_resource_deleted_true_byte_body(self):
- self._test_is_resource_deleted('2', bytes_body=True)
-
- def test_is_resource_deleted_false_str_body(self):
- self._test_is_resource_deleted('1', is_deleted=False, bytes_body=False)
-
- def test_is_resource_deleted_false_byte_body(self):
- self._test_is_resource_deleted('1', is_deleted=False, bytes_body=True)
-
- def _test_set_flavor_extra_spec(self, bytes_body=False):
- self.check_service_client_function(
- self.client.set_flavor_extra_spec,
- 'tempest.common.service_client.ServiceClient.post',
- TestFlavorsClient.EXTRA_SPECS,
- bytes_body,
- flavor_id='8c7aae5a-d315-4216-875b-ed9b6a5bcfc6',
- **TestFlavorsClient.EXTRA_SPECS)
-
- def test_set_flavor_extra_spec_str_body(self):
- self._test_set_flavor_extra_spec(bytes_body=False)
-
- def test_set_flavor_extra_spec_byte_body(self):
- self._test_set_flavor_extra_spec(bytes_body=True)
-
- def _test_list_flavor_extra_specs(self, bytes_body=False):
- self.check_service_client_function(
- self.client.list_flavor_extra_specs,
- 'tempest.common.service_client.ServiceClient.get',
- TestFlavorsClient.EXTRA_SPECS,
- bytes_body,
- flavor_id='8c7aae5a-d315-4216-875b-ed9b6a5bcfc6')
-
- def test_list_flavor_extra_specs_str_body(self):
- self._test_list_flavor_extra_specs(bytes_body=False)
-
- def test_list_flavor_extra_specs__byte_body(self):
- self._test_list_flavor_extra_specs(bytes_body=True)
-
- def _test_show_flavor_extra_spec(self, bytes_body=False):
- expected = {"key": "value"}
- self.check_service_client_function(
- self.client.show_flavor_extra_spec,
- 'tempest.common.service_client.ServiceClient.get',
- expected,
- bytes_body,
- flavor_id='8c7aae5a-d315-4216-875b-ed9b6a5bcfc6',
- key='key')
-
- def test_show_flavor_extra_spec_str_body(self):
- self._test_show_flavor_extra_spec(bytes_body=False)
-
- def test_show_flavor_extra_spec__byte_body(self):
- self._test_show_flavor_extra_spec(bytes_body=True)
-
- def _test_update_flavor_extra_spec(self, bytes_body=False):
- expected = {"key1": "value"}
- self.check_service_client_function(
- self.client.update_flavor_extra_spec,
- 'tempest.common.service_client.ServiceClient.put',
- expected,
- bytes_body,
- flavor_id='8c7aae5a-d315-4216-875b-ed9b6a5bcfc6',
- key='key1', **expected)
-
- def test_update_flavor_extra_spec_str_body(self):
- self._test_update_flavor_extra_spec(bytes_body=False)
-
- def test_update_flavor_extra_spec_byte_body(self):
- self._test_update_flavor_extra_spec(bytes_body=True)
-
- def test_unset_flavor_extra_spec(self):
- self.check_service_client_function(
- self.client.unset_flavor_extra_spec,
- 'tempest.common.service_client.ServiceClient.delete', {},
- flavor_id='c782b7a9-33cd-45f0-b795-7f87f456408b', key='key')
-
- def _test_list_flavor_access(self, bytes_body=False):
- expected = {'flavor_access': [TestFlavorsClient.FAKE_FLAVOR_ACCESS]}
- self.check_service_client_function(
- self.client.list_flavor_access,
- 'tempest.common.service_client.ServiceClient.get',
- expected,
- bytes_body,
- flavor_id='8c7aae5a-d315-4216-875b-ed9b6a5bcfc6')
-
- def test_list_flavor_access_str_body(self):
- self._test_list_flavor_access(bytes_body=False)
-
- def test_list_flavor_access_byte_body(self):
- self._test_list_flavor_access(bytes_body=True)
-
- def _test_add_flavor_access(self, bytes_body=False):
- expected = {
- "flavor_access": [TestFlavorsClient.FAKE_FLAVOR_ACCESS]
- }
- self.check_service_client_function(
- self.client.add_flavor_access,
- 'tempest.common.service_client.ServiceClient.post',
- expected,
- bytes_body,
- flavor_id='8c7aae5a-d315-4216-875b-ed9b6a5bcfc6',
- tenant_id='1a951d988e264818afe520e78697dcbf')
-
- def test_add_flavor_access_str_body(self):
- self._test_add_flavor_access(bytes_body=False)
-
- def test_add_flavor_access_byte_body(self):
- self._test_add_flavor_access(bytes_body=True)
-
- def _test_remove_flavor_access(self, bytes_body=False):
- expected = {
- "flavor_access": [TestFlavorsClient.FAKE_FLAVOR_ACCESS]
- }
- self.check_service_client_function(
- self.client.remove_flavor_access,
- 'tempest.common.service_client.ServiceClient.post',
- expected,
- bytes_body,
- flavor_id='10',
- tenant_id='a6edd4d66ad04245b5d2d8716ecc91e3')
-
- def test_remove_flavor_access_str_body(self):
- self._test_remove_flavor_access(bytes_body=False)
-
- def test_remove_flavor_access_byte_body(self):
- self._test_remove_flavor_access(bytes_body=True)
diff --git a/tempest/tests/services/compute/test_floating_ip_pools_client.py b/tempest/tests/services/compute/test_floating_ip_pools_client.py
deleted file mode 100644
index 1cb4bf3..0000000
--- a/tempest/tests/services/compute/test_floating_ip_pools_client.py
+++ /dev/null
@@ -1,47 +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 floating_ip_pools_client
-from tempest.tests.services.compute import base
-
-
-class TestFloatingIPPoolsClient(base.BaseComputeServiceTest):
-
- FAKE_FLOATING_IP_POOLS = {
- "floating_ip_pools":
- [
- {"name": u'\u3042'},
- {"name": u'\u3044'}
- ]
- }
-
- def setUp(self):
- super(TestFloatingIPPoolsClient, self).setUp()
- fake_auth = fake_auth_provider.FakeAuthProvider()
- self.client = floating_ip_pools_client.FloatingIPPoolsClient(
- fake_auth, 'compute', 'regionOne')
-
- def test_list_floating_ip_pools_with_str_body(self):
- self.check_service_client_function(
- self.client.list_floating_ip_pools,
- 'tempest.common.service_client.ServiceClient.get',
- self.FAKE_FLOATING_IP_POOLS)
-
- def test_list_floating_ip_pools_with_bytes_body(self):
- self.check_service_client_function(
- self.client.list_floating_ip_pools,
- 'tempest.common.service_client.ServiceClient.get',
- self.FAKE_FLOATING_IP_POOLS, to_utf=True)
diff --git a/tempest/tests/services/compute/test_floating_ips_bulk_client.py b/tempest/tests/services/compute/test_floating_ips_bulk_client.py
deleted file mode 100644
index 600985b..0000000
--- a/tempest/tests/services/compute/test_floating_ips_bulk_client.py
+++ /dev/null
@@ -1,88 +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 floating_ips_bulk_client
-from tempest.tests.services.compute import base
-
-
-class TestFloatingIPsBulkClient(base.BaseComputeServiceTest):
-
- FAKE_FIP_BULK_LIST = {"floating_ip_info": [{
- "address": "10.10.10.1",
- "instance_uuid": None,
- "fixed_ip": None,
- "interface": "eth0",
- "pool": "nova",
- "project_id": None
- },
- {
- "address": "10.10.10.2",
- "instance_uuid": None,
- "fixed_ip": None,
- "interface": "eth0",
- "pool": "nova",
- "project_id": None
- }]}
-
- def setUp(self):
- super(TestFloatingIPsBulkClient, self).setUp()
- fake_auth = fake_auth_provider.FakeAuthProvider()
- self.client = floating_ips_bulk_client.FloatingIPsBulkClient(
- fake_auth, 'compute', 'regionOne')
-
- def _test_list_floating_ips_bulk(self, bytes_body=False):
- self.check_service_client_function(
- self.client.list_floating_ips_bulk,
- 'tempest.common.service_client.ServiceClient.get',
- self.FAKE_FIP_BULK_LIST,
- to_utf=bytes_body)
-
- def _test_create_floating_ips_bulk(self, bytes_body=False):
- fake_fip_create_data = {"floating_ips_bulk_create": {
- "ip_range": "192.168.1.0/24", "pool": "nova", "interface": "eth0"}}
- self.check_service_client_function(
- self.client.create_floating_ips_bulk,
- 'tempest.common.service_client.ServiceClient.post',
- fake_fip_create_data,
- to_utf=bytes_body,
- ip_range="192.168.1.0/24", pool="nova", interface="eth0")
-
- def _test_delete_floating_ips_bulk(self, bytes_body=False):
- fake_fip_delete_data = {"floating_ips_bulk_delete": "192.168.1.0/24"}
- self.check_service_client_function(
- self.client.delete_floating_ips_bulk,
- 'tempest.common.service_client.ServiceClient.put',
- fake_fip_delete_data,
- to_utf=bytes_body,
- ip_range="192.168.1.0/24")
-
- def test_list_floating_ips_bulk_with_str_body(self):
- self._test_list_floating_ips_bulk()
-
- def test_list_floating_ips_bulk_with_bytes_body(self):
- self._test_list_floating_ips_bulk(True)
-
- def test_create_floating_ips_bulk_with_str_body(self):
- self._test_create_floating_ips_bulk()
-
- def test_create_floating_ips_bulk_with_bytes_body(self):
- self._test_create_floating_ips_bulk(True)
-
- def test_delete_floating_ips_bulk_with_str_body(self):
- self._test_delete_floating_ips_bulk()
-
- def test_delete_floating_ips_bulk_with_bytes_body(self):
- self._test_delete_floating_ips_bulk(True)
diff --git a/tempest/tests/services/compute/test_hosts_client.py b/tempest/tests/services/compute/test_hosts_client.py
deleted file mode 100644
index 2b7fdb5..0000000
--- a/tempest/tests/services/compute/test_hosts_client.py
+++ /dev/null
@@ -1,147 +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.services.compute.json import hosts_client
-from tempest.tests import fake_auth_provider
-from tempest.tests.services.compute import base
-
-
-class TestHostsClient(base.BaseComputeServiceTest):
- FAKE_HOST_DATA = {
- "host": {
- "resource": {
- "cpu": 1,
- "disk_gb": 1028,
- "host": "c1a7de0ac9d94e4baceae031d05caae3",
- "memory_mb": 8192,
- "project": "(total)"
- }
- },
- "hosts": {
- "host_name": "c1a7de0ac9d94e4baceae031d05caae3",
- "service": "conductor",
- "zone": "internal"
- },
- "enable_hosts": {
- "host": "65c5d5b7e3bd44308e67fc50f362aee6",
- "maintenance_mode": "off_maintenance",
- "status": "enabled"
- }
- }
-
- FAKE_CONTROL_DATA = {
- "shutdown": {
- "host": "c1a7de0ac9d94e4baceae031d05caae3",
- "power_action": "shutdown"
- },
- "startup": {
- "host": "c1a7de0ac9d94e4baceae031d05caae3",
- "power_action": "startup"
- },
- "reboot": {
- "host": "c1a7de0ac9d94e4baceae031d05caae3",
- "power_action": "reboot"
- }}
-
- HOST_DATA = {'host': [FAKE_HOST_DATA['host']]}
- HOSTS_DATA = {'hosts': [FAKE_HOST_DATA['hosts']]}
- ENABLE_HOST_DATA = FAKE_HOST_DATA['enable_hosts']
- HOST_ID = "c1a7de0ac9d94e4baceae031d05caae3"
- TEST_HOST_DATA = {
- "status": "enable",
- "maintenance_mode": "disable"
- }
-
- def setUp(self):
- super(TestHostsClient, self).setUp()
- fake_auth = fake_auth_provider.FakeAuthProvider()
- self.client = hosts_client.HostsClient(fake_auth, 'compute',
- 'regionOne')
- self.params = {'hostname': self.HOST_ID}
- self.func2mock = {
- 'get': 'tempest.common.service_client.ServiceClient.get',
- 'put': 'tempest.common.service_client.ServiceClient.put'}
-
- def _test_host_data(self, test_type='list', bytes_body=False):
- expected_resp = self.HOST_DATA
- if test_type != 'list':
- function_call = self.client.show_host
- else:
- expected_resp = self.HOSTS_DATA
- function_call = self.client.list_hosts
- self.params = {'host_name': self.HOST_ID}
-
- self.check_service_client_function(
- function_call, self.func2mock['get'],
- expected_resp, bytes_body,
- 200, **self.params)
-
- def _test_update_hosts(self, bytes_body=False):
- expected_resp = self.ENABLE_HOST_DATA
- self.check_service_client_function(
- self.client.update_host, self.func2mock['put'],
- expected_resp, bytes_body,
- 200, **self.params)
-
- def _test_control_host(self, control_op='reboot', bytes_body=False):
- if control_op == 'start':
- expected_resp = self.FAKE_CONTROL_DATA['startup']
- function_call = self.client.startup_host
- elif control_op == 'stop':
- expected_resp = self.FAKE_CONTROL_DATA['shutdown']
- function_call = self.client.shutdown_host
- else:
- expected_resp = self.FAKE_CONTROL_DATA['reboot']
- function_call = self.client.reboot_host
-
- self.check_service_client_function(
- function_call, self.func2mock['get'],
- expected_resp, bytes_body,
- 200, **self.params)
-
- def test_show_host_with_str_body(self):
- self._test_host_data('show')
-
- def test_show_host_with_bytes_body(self):
- self._test_host_data('show', True)
-
- def test_list_host_with_str_body(self):
- self._test_host_data()
-
- def test_list_host_with_bytes_body(self):
- self._test_host_data(bytes_body=True)
-
- def test_start_host_with_str_body(self):
- self._test_control_host('start')
-
- def test_start_host_with_bytes_body(self):
- self._test_control_host('start', True)
-
- def test_stop_host_with_str_body(self):
- self._test_control_host('stop')
-
- def test_stop_host_with_bytes_body(self):
- self._test_control_host('stop', True)
-
- def test_reboot_host_with_str_body(self):
- self._test_control_host('reboot')
-
- def test_reboot_host_with_bytes_body(self):
- self._test_control_host('reboot', True)
-
- def test_update_host_with_str_body(self):
- self._test_update_hosts()
-
- def test_update_host_with_bytes_body(self):
- self._test_update_hosts(True)