Use servers_client from tempest-lib
The files below have been migrated to tempest-lib
* servers_client.py: I9234f063a72bd58100bfffd3db38718a257ce6ea
* servers.py: I9234f063a72bd58100bfffd3db38718a257ce6ea
* test_servers_client.py: I9234f063a72bd58100bfffd3db38718a257ce6ea
* parameter_types.py: I5cad7d45b3be330ebcfb063315ff29b06cf0688c
Now Tempest-lib provides those as stable interfaces. So Tempest should
start using those from lib and remove its own copy.
Change-Id: Iec56aee243106f8dd79dbf464080dc1382866f07
diff --git a/tempest/api_schema/response/compute/v2_1/parameter_types.py b/tempest/api_schema/response/compute/v2_1/parameter_types.py
deleted file mode 100644
index 07cc890..0000000
--- a/tempest/api_schema/response/compute/v2_1/parameter_types.py
+++ /dev/null
@@ -1,96 +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.
-
-links = {
- 'type': 'array',
- 'items': {
- 'type': 'object',
- 'properties': {
- 'href': {
- 'type': 'string',
- 'format': 'uri'
- },
- 'rel': {'type': 'string'}
- },
- 'additionalProperties': False,
- 'required': ['href', 'rel']
- }
-}
-
-mac_address = {
- 'type': 'string',
- 'pattern': '(?:[a-f0-9]{2}:){5}[a-f0-9]{2}'
-}
-
-ip_address = {
- 'oneOf': [
- {
- 'type': 'string',
- 'oneOf': [
- {'format': 'ipv4'},
- {'format': 'ipv6'}
- ]
- },
- {'type': 'null'}
- ]
-}
-
-access_ip_v4 = {
- 'type': 'string',
- 'oneOf': [{'format': 'ipv4'}, {'enum': ['']}]
-}
-
-access_ip_v6 = {
- 'type': 'string',
- 'oneOf': [{'format': 'ipv6'}, {'enum': ['']}]
-}
-
-addresses = {
- 'type': 'object',
- 'patternProperties': {
- # NOTE: Here is for 'private' or something.
- '^[a-zA-Z0-9-_.]+$': {
- 'type': 'array',
- 'items': {
- 'type': 'object',
- 'properties': {
- 'version': {'type': 'integer'},
- 'addr': {
- 'type': 'string',
- 'oneOf': [
- {'format': 'ipv4'},
- {'format': 'ipv6'}
- ]
- }
- },
- 'additionalProperties': False,
- 'required': ['version', 'addr']
- }
- }
- }
-}
-
-response_header = {
- 'connection': {'type': 'string'},
- 'content-length': {'type': 'string'},
- 'content-type': {'type': 'string'},
- 'status': {'type': 'string'},
- 'x-compute-request-id': {'type': 'string'},
- 'vary': {'type': 'string'},
- 'x-openstack-nova-api-version': {'type': 'string'},
- 'date': {
- 'type': 'string',
- 'format': 'data-time'
- }
-}
diff --git a/tempest/api_schema/response/compute/v2_1/servers.py b/tempest/api_schema/response/compute/v2_1/servers.py
deleted file mode 100644
index 38f7c82..0000000
--- a/tempest/api_schema/response/compute/v2_1/servers.py
+++ /dev/null
@@ -1,549 +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
-
-from tempest.api_schema.response.compute.v2_1 import parameter_types
-
-create_server = {
- 'status_code': [202],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'server': {
- 'type': 'object',
- 'properties': {
- 'id': {'type': 'string'},
- 'security_groups': {'type': 'array'},
- 'links': parameter_types.links,
- 'OS-DCF:diskConfig': {'type': 'string'}
- },
- 'additionalProperties': False,
- # NOTE: OS-DCF:diskConfig & security_groups are API extension,
- # and some environments return a response without these
- # attributes.So they are not 'required'.
- 'required': ['id', 'links']
- }
- },
- 'additionalProperties': False,
- 'required': ['server']
- }
-}
-
-create_server_with_admin_pass = copy.deepcopy(create_server)
-create_server_with_admin_pass['response_body']['properties']['server'][
- 'properties'].update({'adminPass': {'type': 'string'}})
-create_server_with_admin_pass['response_body']['properties']['server'][
- 'required'].append('adminPass')
-
-list_servers = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'servers': {
- 'type': 'array',
- 'items': {
- 'type': 'object',
- 'properties': {
- 'id': {'type': 'string'},
- 'links': parameter_types.links,
- 'name': {'type': 'string'}
- },
- 'additionalProperties': False,
- 'required': ['id', 'links', 'name']
- }
- },
- 'servers_links': parameter_types.links
- },
- 'additionalProperties': False,
- # NOTE(gmann): servers_links attribute is not necessary to be
- # present always So it is not 'required'.
- 'required': ['servers']
- }
-}
-
-delete_server = {
- 'status_code': [204],
-}
-
-common_show_server = {
- 'type': 'object',
- 'properties': {
- 'id': {'type': 'string'},
- 'name': {'type': 'string'},
- 'status': {'type': 'string'},
- 'image': {'oneOf': [
- {'type': 'object',
- 'properties': {
- 'id': {'type': 'string'},
- 'links': parameter_types.links
- },
- 'additionalProperties': False,
- 'required': ['id', 'links']},
- {'type': ['string', 'null']}
- ]},
- 'flavor': {
- 'type': 'object',
- 'properties': {
- 'id': {'type': 'string'},
- 'links': parameter_types.links
- },
- 'additionalProperties': False,
- 'required': ['id', 'links']
- },
- 'fault': {
- 'type': 'object',
- 'properties': {
- 'code': {'type': 'integer'},
- 'created': {'type': 'string'},
- 'message': {'type': 'string'},
- 'details': {'type': 'string'},
- },
- 'additionalProperties': False,
- # NOTE(gmann): 'details' is not necessary to be present
- # in the 'fault'. So it is not defined as 'required'.
- 'required': ['code', 'created', 'message']
- },
- 'user_id': {'type': 'string'},
- 'tenant_id': {'type': 'string'},
- 'created': {'type': 'string'},
- 'updated': {'type': 'string'},
- 'progress': {'type': 'integer'},
- 'metadata': {'type': 'object'},
- 'links': parameter_types.links,
- 'addresses': parameter_types.addresses,
- 'hostId': {'type': 'string'},
- 'OS-DCF:diskConfig': {'type': 'string'},
- 'accessIPv4': parameter_types.access_ip_v4,
- 'accessIPv6': parameter_types.access_ip_v6
- },
- 'additionalProperties': False,
- # NOTE(GMann): 'progress' attribute is present in the response
- # only when server's status is one of the progress statuses
- # ("ACTIVE","BUILD", "REBUILD", "RESIZE","VERIFY_RESIZE")
- # 'fault' attribute is present in the response
- # only when server's status is one of the "ERROR", "DELETED".
- # OS-DCF:diskConfig and accessIPv4/v6 are API
- # extensions, and some environments return a response
- # without these attributes.So these are not defined as 'required'.
- 'required': ['id', 'name', 'status', 'image', 'flavor',
- 'user_id', 'tenant_id', 'created', 'updated',
- 'metadata', 'links', 'addresses', 'hostId']
-}
-
-update_server = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'server': common_show_server
- },
- 'additionalProperties': False,
- 'required': ['server']
- }
-}
-
-server_detail = copy.deepcopy(common_show_server)
-server_detail['properties'].update({
- 'key_name': {'type': ['string', 'null']},
- 'security_groups': {'type': 'array'},
-
- # NOTE: Non-admin users also can see "OS-SRV-USG" and "OS-EXT-AZ"
- # attributes.
- 'OS-SRV-USG:launched_at': {'type': ['string', 'null']},
- 'OS-SRV-USG:terminated_at': {'type': ['string', 'null']},
- 'OS-EXT-AZ:availability_zone': {'type': 'string'},
-
- # NOTE: Admin users only can see "OS-EXT-STS" and "OS-EXT-SRV-ATTR"
- # attributes.
- 'OS-EXT-STS:task_state': {'type': ['string', 'null']},
- 'OS-EXT-STS:vm_state': {'type': 'string'},
- 'OS-EXT-STS:power_state': {'type': 'integer'},
- 'OS-EXT-SRV-ATTR:host': {'type': ['string', 'null']},
- 'OS-EXT-SRV-ATTR:instance_name': {'type': 'string'},
- 'OS-EXT-SRV-ATTR:hypervisor_hostname': {'type': ['string', 'null']},
- 'os-extended-volumes:volumes_attached': {'type': 'array'},
- 'config_drive': {'type': 'string'}
-})
-server_detail['properties']['addresses']['patternProperties'][
- '^[a-zA-Z0-9-_.]+$']['items']['properties'].update({
- 'OS-EXT-IPS:type': {'type': 'string'},
- 'OS-EXT-IPS-MAC:mac_addr': parameter_types.mac_address})
-# NOTE(gmann): Update OS-EXT-IPS:type and OS-EXT-IPS-MAC:mac_addr
-# attributes in server address. Those are API extension,
-# and some environments return a response without
-# these attributes. So they are not 'required'.
-
-get_server = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'server': server_detail
- },
- 'additionalProperties': False,
- 'required': ['server']
- }
-}
-
-list_servers_detail = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'servers': {
- 'type': 'array',
- 'items': server_detail
- },
- 'servers_links': parameter_types.links
- },
- 'additionalProperties': False,
- # NOTE(gmann): servers_links attribute is not necessary to be
- # present always So it is not 'required'.
- 'required': ['servers']
- }
-}
-
-rebuild_server = copy.deepcopy(update_server)
-rebuild_server['status_code'] = [202]
-
-rebuild_server_with_admin_pass = copy.deepcopy(rebuild_server)
-rebuild_server_with_admin_pass['response_body']['properties']['server'][
- 'properties'].update({'adminPass': {'type': 'string'}})
-rebuild_server_with_admin_pass['response_body']['properties']['server'][
- 'required'].append('adminPass')
-
-rescue_server = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'adminPass': {'type': 'string'}
- },
- 'additionalProperties': False,
- 'required': ['adminPass']
- }
-}
-
-list_virtual_interfaces = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'virtual_interfaces': {
- 'type': 'array',
- 'items': {
- 'type': 'object',
- 'properties': {
- 'id': {'type': 'string'},
- 'mac_address': parameter_types.mac_address,
- 'OS-EXT-VIF-NET:net_id': {'type': 'string'}
- },
- 'additionalProperties': False,
- # 'OS-EXT-VIF-NET:net_id' is API extension So it is
- # not defined as 'required'
- 'required': ['id', 'mac_address']
- }
- }
- },
- 'additionalProperties': False,
- 'required': ['virtual_interfaces']
- }
-}
-
-common_attach_volume_info = {
- 'type': 'object',
- 'properties': {
- 'id': {'type': 'string'},
- 'device': {'type': 'string'},
- 'volumeId': {'type': 'string'},
- 'serverId': {'type': ['integer', 'string']}
- },
- 'additionalProperties': False,
- 'required': ['id', 'device', 'volumeId', 'serverId']
-}
-
-attach_volume = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'volumeAttachment': common_attach_volume_info
- },
- 'additionalProperties': False,
- 'required': ['volumeAttachment']
- }
-}
-
-detach_volume = {
- 'status_code': [202]
-}
-
-show_volume_attachment = copy.deepcopy(attach_volume)
-show_volume_attachment['response_body']['properties'][
- 'volumeAttachment']['properties'].update({'serverId': {'type': 'string'}})
-
-list_volume_attachments = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'volumeAttachments': {
- 'type': 'array',
- 'items': common_attach_volume_info
- }
- },
- 'additionalProperties': False,
- 'required': ['volumeAttachments']
- }
-}
-list_volume_attachments['response_body']['properties'][
- 'volumeAttachments']['items']['properties'].update(
- {'serverId': {'type': 'string'}})
-
-list_addresses_by_network = {
- 'status_code': [200],
- 'response_body': parameter_types.addresses
-}
-
-list_addresses = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'addresses': parameter_types.addresses
- },
- 'additionalProperties': False,
- 'required': ['addresses']
- }
-}
-
-common_server_group = {
- 'type': 'object',
- 'properties': {
- 'id': {'type': 'string'},
- 'name': {'type': 'string'},
- 'policies': {
- 'type': 'array',
- 'items': {'type': 'string'}
- },
- # 'members' attribute contains the array of instance's UUID of
- # instances present in server group
- 'members': {
- 'type': 'array',
- 'items': {'type': 'string'}
- },
- 'metadata': {'type': 'object'}
- },
- 'additionalProperties': False,
- 'required': ['id', 'name', 'policies', 'members', 'metadata']
-}
-
-create_show_server_group = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'server_group': common_server_group
- },
- 'additionalProperties': False,
- 'required': ['server_group']
- }
-}
-
-delete_server_group = {
- 'status_code': [204]
-}
-
-list_server_groups = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'server_groups': {
- 'type': 'array',
- 'items': common_server_group
- }
- },
- 'additionalProperties': False,
- 'required': ['server_groups']
- }
-}
-
-instance_actions = {
- 'type': 'object',
- 'properties': {
- 'action': {'type': 'string'},
- 'request_id': {'type': 'string'},
- 'user_id': {'type': 'string'},
- 'project_id': {'type': 'string'},
- 'start_time': {'type': 'string'},
- 'message': {'type': ['string', 'null']},
- 'instance_uuid': {'type': 'string'}
- },
- 'additionalProperties': False,
- 'required': ['action', 'request_id', 'user_id', 'project_id',
- 'start_time', 'message', 'instance_uuid']
-}
-
-instance_action_events = {
- 'type': 'array',
- 'items': {
- 'type': 'object',
- 'properties': {
- 'event': {'type': 'string'},
- 'start_time': {'type': 'string'},
- 'finish_time': {'type': 'string'},
- 'result': {'type': 'string'},
- 'traceback': {'type': ['string', 'null']}
- },
- 'additionalProperties': False,
- 'required': ['event', 'start_time', 'finish_time', 'result',
- 'traceback']
- }
-}
-
-list_instance_actions = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'instanceActions': {
- 'type': 'array',
- 'items': instance_actions
- }
- },
- 'additionalProperties': False,
- 'required': ['instanceActions']
- }
-}
-
-instance_actions_with_events = copy.deepcopy(instance_actions)
-instance_actions_with_events['properties'].update({
- 'events': instance_action_events})
-# 'events' does not come in response body always so it is not
-# defined as 'required'
-
-show_instance_action = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'instanceAction': instance_actions_with_events
- },
- 'additionalProperties': False,
- 'required': ['instanceAction']
- }
-}
-
-show_password = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'password': {'type': 'string'}
- },
- 'additionalProperties': False,
- 'required': ['password']
- }
-}
-
-get_vnc_console = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'console': {
- 'type': 'object',
- 'properties': {
- 'type': {'type': 'string'},
- 'url': {
- 'type': 'string',
- 'format': 'uri'
- }
- },
- 'additionalProperties': False,
- 'required': ['type', 'url']
- }
- },
- 'additionalProperties': False,
- 'required': ['console']
- }
-}
-
-get_console_output = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'output': {'type': 'string'}
- },
- 'additionalProperties': False,
- 'required': ['output']
- }
-}
-
-set_server_metadata = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'metadata': {
- 'type': 'object',
- 'patternProperties': {
- '^.+$': {'type': 'string'}
- }
- }
- },
- 'additionalProperties': False,
- 'required': ['metadata']
- }
-}
-
-list_server_metadata = copy.deepcopy(set_server_metadata)
-
-update_server_metadata = copy.deepcopy(set_server_metadata)
-
-delete_server_metadata_item = {
- 'status_code': [204]
-}
-
-set_show_server_metadata_item = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'meta': {
- 'type': 'object',
- 'patternProperties': {
- '^.+$': {'type': 'string'}
- }
- }
- },
- 'additionalProperties': False,
- 'required': ['meta']
- }
-}
-
-server_actions_common_schema = {
- 'status_code': [202]
-}
-
-server_actions_delete_password = {
- 'status_code': [204]
-}
-
-server_actions_confirm_resize = copy.deepcopy(
- server_actions_delete_password)
diff --git a/tempest/clients.py b/tempest/clients.py
index 74c8dcd..774df35 100644
--- a/tempest/clients.py
+++ b/tempest/clients.py
@@ -57,6 +57,7 @@
SecurityGroupsClient as ComputeSecurityGroupsClient
from tempest_lib.services.compute.server_groups_client import \
ServerGroupsClient
+from tempest_lib.services.compute.servers_client import ServersClient
from tempest_lib.services.compute.services_client import ServicesClient
from tempest_lib.services.compute.snapshots_client import \
SnapshotsClient as ComputeSnapshotsClient
@@ -77,7 +78,6 @@
from tempest.services.baremetal.v1.json.baremetal_client import \
BaremetalClient
from tempest.services.compute.json.keypairs_client import KeyPairsClient
-from tempest.services.compute.json.servers_client import ServersClient
from tempest.services.data_processing.v1_1.data_processing_client import \
DataProcessingClient
from tempest.services.database.json.flavors_client import \
diff --git a/tempest/cmd/javelin.py b/tempest/cmd/javelin.py
index c0c645c..fd35eab 100755
--- a/tempest/cmd/javelin.py
+++ b/tempest/cmd/javelin.py
@@ -121,12 +121,12 @@
from tempest_lib.services.compute import floating_ips_client
from tempest_lib.services.compute import security_group_rules_client
from tempest_lib.services.compute import security_groups_client
+from tempest_lib.services.compute import servers_client
import yaml
from tempest.common import identity
from tempest.common import waiters
from tempest import config
-from tempest.services.compute.json import servers_client
from tempest.services.identity.v2.json import identity_client
from tempest.services.identity.v2.json import roles_client
from tempest.services.identity.v2.json import tenants_client
diff --git a/tempest/services/compute/json/servers_client.py b/tempest/services/compute/json/servers_client.py
deleted file mode 100644
index c20295b..0000000
--- a/tempest/services/compute/json/servers_client.py
+++ /dev/null
@@ -1,561 +0,0 @@
-# Copyright 2012 OpenStack Foundation
-# Copyright 2013 Hewlett-Packard Development Company, L.P.
-# All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-import copy
-
-from oslo_serialization import jsonutils as json
-from six.moves.urllib import parse as urllib
-
-from tempest.api_schema.response.compute.v2_1 import servers as schema
-from tempest.common import service_client
-
-
-class ServersClient(service_client.ServiceClient):
-
- def __init__(self, auth_provider, service, region,
- enable_instance_password=True, **kwargs):
- super(ServersClient, self).__init__(
- auth_provider, service, region, **kwargs)
- self.enable_instance_password = enable_instance_password
-
- def create_server(self, **kwargs):
- """Create server.
-
- Available params: see http://developer.openstack.org/
- api-ref-compute-v2.1.html#createServer
-
- 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'.
- """
- body = copy.deepcopy(kwargs)
- if body.get('disk_config'):
- body['OS-DCF:diskConfig'] = body.pop('disk_config')
-
- hints = None
- if body.get('scheduler_hints'):
- hints = {'os:scheduler_hints': body.pop('scheduler_hints')}
-
- post_body = {'server': body}
-
- if hints:
- post_body = dict(post_body.items() + hints.items())
-
- post_body = json.dumps(post_body)
- resp, body = self.post('servers', post_body)
-
- body = json.loads(body)
- # NOTE(maurosr): this deals with the case of multiple server create
- # with return reservation id set True
- if 'reservation_id' in body:
- return service_client.ResponseBody(resp, body)
- if self.enable_instance_password:
- create_schema = schema.create_server_with_admin_pass
- else:
- create_schema = schema.create_server
- self.validate_response(create_schema, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def update_server(self, server_id, **kwargs):
- """Update server.
-
- Available params: see http://developer.openstack.org/
- api-ref-compute-v2.1.html#updateServer
-
- Most parameters except the following are passed to the API without
- any changes.
- :param disk_config: The name is changed to OS-DCF:diskConfig
- """
- if kwargs.get('disk_config'):
- kwargs['OS-DCF:diskConfig'] = kwargs.pop('disk_config')
-
- post_body = json.dumps({'server': kwargs})
- resp, body = self.put("servers/%s" % server_id, post_body)
- body = json.loads(body)
- self.validate_response(schema.update_server, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def show_server(self, server_id):
- """Get server details."""
- resp, body = self.get("servers/%s" % server_id)
- body = json.loads(body)
- self.validate_response(schema.get_server, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def delete_server(self, server_id):
- """Delete server."""
- resp, body = self.delete("servers/%s" % server_id)
- self.validate_response(schema.delete_server, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def list_servers(self, detail=False, **params):
- """List servers.
-
- Available params: see http://developer.openstack.org/
- api-ref-compute-v2.1.html#listServers
- and http://developer.openstack.org/
- api-ref-compute-v2.1.html#listDetailServers
- """
-
- url = 'servers'
- _schema = schema.list_servers
-
- if detail:
- url += '/detail'
- _schema = schema.list_servers_detail
- 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 list_addresses(self, server_id):
- """Lists all addresses for a server."""
- resp, body = self.get("servers/%s/ips" % server_id)
- body = json.loads(body)
- self.validate_response(schema.list_addresses, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def list_addresses_by_network(self, server_id, network_id):
- """Lists all addresses of a specific network type for a server."""
- resp, body = self.get("servers/%s/ips/%s" %
- (server_id, network_id))
- body = json.loads(body)
- self.validate_response(schema.list_addresses_by_network, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def action(self, server_id, action_name,
- schema=schema.server_actions_common_schema,
- **kwargs):
- post_body = json.dumps({action_name: kwargs})
- resp, body = self.post('servers/%s/action' % server_id,
- post_body)
- if body:
- body = json.loads(body)
- self.validate_response(schema, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def create_backup(self, server_id, **kwargs):
- """Backup a server instance.
-
- Available params: see http://developer.openstack.org/
- api-ref-compute-v2.1.html#createBackup
- """
- return self.action(server_id, "createBackup", **kwargs)
-
- def change_password(self, server_id, **kwargs):
- """Change the root password for the server.
-
- Available params: see http://developer.openstack.org/
- api-ref-compute-v2.1.html#changePassword
- """
- return self.action(server_id, 'changePassword', **kwargs)
-
- def show_password(self, server_id):
- resp, body = self.get("servers/%s/os-server-password" %
- server_id)
- body = json.loads(body)
- self.validate_response(schema.show_password, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def delete_password(self, server_id):
- """Removes the encrypted server password from the metadata server
-
- Note that this does not actually change the instance server
- password.
- """
- resp, body = self.delete("servers/%s/os-server-password" %
- server_id)
- self.validate_response(schema.server_actions_delete_password,
- resp, body)
- return service_client.ResponseBody(resp, body)
-
- def reboot_server(self, server_id, **kwargs):
- """Reboot a server.
-
- Available params: http://developer.openstack.org/
- api-ref-compute-v2.1.html#reboot
- """
- return self.action(server_id, 'reboot', **kwargs)
-
- def rebuild_server(self, server_id, image_ref, **kwargs):
- """Rebuild a server with a new image.
-
- Available params: http://developer.openstack.org/
- api-ref-compute-v2.1.html#rebuild
-
- Most parameters except the following are passed to the API without
- any changes.
- :param disk_config: The name is changed to OS-DCF:diskConfig
- """
- kwargs['imageRef'] = image_ref
- if 'disk_config' in kwargs:
- kwargs['OS-DCF:diskConfig'] = kwargs.pop('disk_config')
- if self.enable_instance_password:
- rebuild_schema = schema.rebuild_server_with_admin_pass
- else:
- rebuild_schema = schema.rebuild_server
- return self.action(server_id, 'rebuild',
- rebuild_schema, **kwargs)
-
- def resize_server(self, server_id, flavor_ref, **kwargs):
- """Change the flavor of a server.
-
- Available params: http://developer.openstack.org/
- api-ref-compute-v2.1.html#resize
-
- Most parameters except the following are passed to the API without
- any changes.
- :param disk_config: The name is changed to OS-DCF:diskConfig
- """
- kwargs['flavorRef'] = flavor_ref
- if 'disk_config' in kwargs:
- kwargs['OS-DCF:diskConfig'] = kwargs.pop('disk_config')
- return self.action(server_id, 'resize', **kwargs)
-
- def confirm_resize_server(self, server_id, **kwargs):
- """Confirm the flavor change for a server.
-
- Available params: see http://developer.openstack.org/
- api-ref-compute-v2.1.html#confirmResize
- """
- return self.action(server_id, 'confirmResize',
- schema.server_actions_confirm_resize,
- **kwargs)
-
- def revert_resize_server(self, server_id, **kwargs):
- """Revert a server back to its original flavor.
-
- Available params: see http://developer.openstack.org/
- api-ref-compute-v2.1.html#revertResize
- """
- return self.action(server_id, 'revertResize', **kwargs)
-
- def list_server_metadata(self, server_id):
- resp, body = self.get("servers/%s/metadata" % server_id)
- body = json.loads(body)
- self.validate_response(schema.list_server_metadata, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def set_server_metadata(self, server_id, meta, no_metadata_field=False):
- if no_metadata_field:
- post_body = ""
- else:
- post_body = json.dumps({'metadata': meta})
- resp, body = self.put('servers/%s/metadata' % server_id,
- post_body)
- body = json.loads(body)
- self.validate_response(schema.set_server_metadata, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def update_server_metadata(self, server_id, meta):
- post_body = json.dumps({'metadata': meta})
- resp, body = self.post('servers/%s/metadata' % server_id,
- post_body)
- body = json.loads(body)
- self.validate_response(schema.update_server_metadata,
- resp, body)
- return service_client.ResponseBody(resp, body)
-
- def show_server_metadata_item(self, server_id, key):
- resp, body = self.get("servers/%s/metadata/%s" % (server_id, key))
- body = json.loads(body)
- self.validate_response(schema.set_show_server_metadata_item,
- resp, body)
- return service_client.ResponseBody(resp, body)
-
- def set_server_metadata_item(self, server_id, key, meta):
- post_body = json.dumps({'meta': meta})
- resp, body = self.put('servers/%s/metadata/%s' % (server_id, key),
- post_body)
- body = json.loads(body)
- self.validate_response(schema.set_show_server_metadata_item,
- resp, body)
- return service_client.ResponseBody(resp, body)
-
- def delete_server_metadata_item(self, server_id, key):
- resp, body = self.delete("servers/%s/metadata/%s" %
- (server_id, key))
- self.validate_response(schema.delete_server_metadata_item,
- resp, body)
- return service_client.ResponseBody(resp, body)
-
- def stop_server(self, server_id, **kwargs):
- return self.action(server_id, 'os-stop', **kwargs)
-
- def start_server(self, server_id, **kwargs):
- return self.action(server_id, 'os-start', **kwargs)
-
- def attach_volume(self, server_id, **kwargs):
- """Attaches a volume to a server instance."""
- post_body = json.dumps({'volumeAttachment': kwargs})
- resp, body = self.post('servers/%s/os-volume_attachments' % server_id,
- post_body)
- body = json.loads(body)
- self.validate_response(schema.attach_volume, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def detach_volume(self, server_id, volume_id): # noqa
- """Detaches a volume from a server instance."""
- resp, body = self.delete('servers/%s/os-volume_attachments/%s' %
- (server_id, volume_id))
- self.validate_response(schema.detach_volume, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def show_volume_attachment(self, server_id, attach_id):
- """Return details about the given volume attachment."""
- resp, body = self.get('servers/%s/os-volume_attachments/%s' % (
- server_id, attach_id))
- body = json.loads(body)
- self.validate_response(schema.show_volume_attachment, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def list_volume_attachments(self, server_id):
- """Returns the list of volume attachments for a given instance."""
- resp, body = self.get('servers/%s/os-volume_attachments' % (
- server_id))
- body = json.loads(body)
- self.validate_response(schema.list_volume_attachments, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def add_security_group(self, server_id, **kwargs):
- """Add a security group to the server.
-
- Available params: TODO
- """
- # TODO(oomichi): The api-site doesn't contain this API description.
- # So the above should be changed to the api-site link after
- # adding the description on the api-site.
- # LP: https://bugs.launchpad.net/openstack-api-site/+bug/1524199
- return self.action(server_id, 'addSecurityGroup', **kwargs)
-
- def remove_security_group(self, server_id, **kwargs):
- """Remove a security group from the server.
-
- Available params: TODO
- """
- # TODO(oomichi): The api-site doesn't contain this API description.
- # So the above should be changed to the api-site link after
- # adding the description on the api-site.
- # LP: https://bugs.launchpad.net/openstack-api-site/+bug/1524199
- return self.action(server_id, 'removeSecurityGroup', **kwargs)
-
- def live_migrate_server(self, server_id, **kwargs):
- """This should be called with administrator privileges.
-
- Available params: http://developer.openstack.org/
- api-ref-compute-v2.1.html#migrateLive
- """
- return self.action(server_id, 'os-migrateLive', **kwargs)
-
- def migrate_server(self, server_id, **kwargs):
- """Migrate a server to a new host.
-
- Available params: http://developer.openstack.org/
- api-ref-compute-v2.1.html#migrate
- """
- return self.action(server_id, 'migrate', **kwargs)
-
- def lock_server(self, server_id, **kwargs):
- """Lock the given server.
-
- Available params: http://developer.openstack.org/
- api-ref-compute-v2.1.html#lock
- """
- return self.action(server_id, 'lock', **kwargs)
-
- def unlock_server(self, server_id, **kwargs):
- """UNlock the given server.
-
- Available params: http://developer.openstack.org/
- api-ref-compute-v2.1.html#unlock
- """
- return self.action(server_id, 'unlock', **kwargs)
-
- def suspend_server(self, server_id, **kwargs):
- """Suspend the provided server.
-
- Available params: http://developer.openstack.org/
- api-ref-compute-v2.1.html#suspend
- """
- return self.action(server_id, 'suspend', **kwargs)
-
- def resume_server(self, server_id, **kwargs):
- """Un-suspend the provided server.
-
- Available params: http://developer.openstack.org/
- api-ref-compute-v2.1.html#resume
- """
- return self.action(server_id, 'resume', **kwargs)
-
- def pause_server(self, server_id, **kwargs):
- """Pause the provided server.
-
- Available params: http://developer.openstack.org/
- api-ref-compute-v2.1.html#pause
- """
- return self.action(server_id, 'pause', **kwargs)
-
- def unpause_server(self, server_id, **kwargs):
- """Un-pause the provided server.
-
- Available params: http://developer.openstack.org/
- api-ref-compute-v2.1.html#unpause
- """
- return self.action(server_id, 'unpause', **kwargs)
-
- def reset_state(self, server_id, **kwargs):
- """Reset the state of a server to active/error.
-
- Available params: http://developer.openstack.org/
- api-ref-compute-v2.1.html#resetState
- """
- return self.action(server_id, 'os-resetState', **kwargs)
-
- def shelve_server(self, server_id, **kwargs):
- """Shelve the provided server.
-
- Available params: http://developer.openstack.org/
- api-ref-compute-v2.1.html#shelve
- """
- return self.action(server_id, 'shelve', **kwargs)
-
- def unshelve_server(self, server_id, **kwargs):
- """Un-shelve the provided server.
-
- Available params: http://developer.openstack.org/
- api-ref-compute-v2.1.html#unshelve
- """
- return self.action(server_id, 'unshelve', **kwargs)
-
- def shelve_offload_server(self, server_id, **kwargs):
- """Shelve-offload the provided server.
-
- Available params: http://developer.openstack.org/
- api-ref-compute-v2.1.html#shelveOffload
- """
- return self.action(server_id, 'shelveOffload', **kwargs)
-
- def get_console_output(self, server_id, **kwargs):
- """Get console output.
-
- Available params: http://developer.openstack.org/
- api-ref-compute-v2.1.html#getConsoleOutput
- """
- return self.action(server_id, 'os-getConsoleOutput',
- schema.get_console_output, **kwargs)
-
- def list_virtual_interfaces(self, server_id):
- """List the virtual interfaces used in an instance."""
- resp, body = self.get('/'.join(['servers', server_id,
- 'os-virtual-interfaces']))
- body = json.loads(body)
- self.validate_response(schema.list_virtual_interfaces, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def rescue_server(self, server_id, **kwargs):
- """Rescue the provided server.
-
- Available params: http://developer.openstack.org/
- api-ref-compute-v2.1.html#rescue
- """
- return self.action(server_id, 'rescue', schema.rescue_server, **kwargs)
-
- def unrescue_server(self, server_id):
- """Unrescue the provided server."""
- return self.action(server_id, 'unrescue')
-
- def show_server_diagnostics(self, server_id):
- """Get the usage data for a server."""
- resp, body = self.get("servers/%s/diagnostics" % server_id)
- return service_client.ResponseBody(resp, json.loads(body))
-
- def list_instance_actions(self, server_id):
- """List the provided server action."""
- resp, body = self.get("servers/%s/os-instance-actions" %
- server_id)
- body = json.loads(body)
- self.validate_response(schema.list_instance_actions, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def show_instance_action(self, server_id, request_id):
- """Returns the action details of the provided server."""
- resp, body = self.get("servers/%s/os-instance-actions/%s" %
- (server_id, request_id))
- body = json.loads(body)
- self.validate_response(schema.show_instance_action, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def force_delete_server(self, server_id, **kwargs):
- """Force delete a server.
-
- Available params: http://developer.openstack.org/
- api-ref-compute-v2.1.html#forceDelete
- """
- return self.action(server_id, 'forceDelete', **kwargs)
-
- def restore_soft_deleted_server(self, server_id, **kwargs):
- """Restore a soft-deleted server.
-
- Available params: http://developer.openstack.org/
- api-ref-compute-v2.1.html#restore
- """
- return self.action(server_id, 'restore', **kwargs)
-
- def reset_network(self, server_id, **kwargs):
- """Reset the Network of a server.
-
- Available params: http://developer.openstack.org/
- api-ref-compute-v2.1.html#resetNetwork
- """
- return self.action(server_id, 'resetNetwork', **kwargs)
-
- def inject_network_info(self, server_id, **kwargs):
- """Inject the Network Info into server.
-
- Available params: http://developer.openstack.org/
- api-ref-compute-v2.1.html#injectNetworkInfo
- """
- return self.action(server_id, 'injectNetworkInfo', **kwargs)
-
- def get_vnc_console(self, server_id, **kwargs):
- """Get URL of VNC console.
-
- Available params: http://developer.openstack.org/
- api-ref-compute-v2.1.html#getVNCConsole
- """
- return self.action(server_id, "os-getVNCConsole",
- schema.get_vnc_console, **kwargs)
-
- def add_fixed_ip(self, server_id, **kwargs):
- """Add a fixed IP to server instance.
-
- Available params: http://developer.openstack.org/
- api-ref-compute-v2.1.html#addFixedIp
- """
- return self.action(server_id, 'addFixedIp', **kwargs)
-
- def remove_fixed_ip(self, server_id, **kwargs):
- """Remove input fixed IP from input server instance.
-
- Available params: http://developer.openstack.org/
- api-ref-compute-v2.1.html#removeFixedIp
- """
- return self.action(server_id, 'removeFixedIp', **kwargs)
diff --git a/tempest/tests/common/test_service_clients.py b/tempest/tests/common/test_service_clients.py
index d3bbb21..a357df3 100644
--- a/tempest/tests/common/test_service_clients.py
+++ b/tempest/tests/common/test_service_clients.py
@@ -17,7 +17,6 @@
import six
from tempest.services.baremetal.v1.json import baremetal_client
-from tempest.services.compute.json import servers_client
from tempest.services.data_processing.v1_1 import data_processing_client
from tempest.services.database.json import flavors_client as db_flavor_client
from tempest.services.database.json import versions_client as db_version_client
@@ -84,7 +83,6 @@
def test_service_client_creations_with_specified_args(self, mock_init):
test_clients = [
baremetal_client.BaremetalClient,
- servers_client.ServersClient,
data_processing_client.DataProcessingClient,
db_flavor_client.DatabaseFlavorsClient,
db_version_client.DatabaseVersionsClient,
diff --git a/tempest/tests/services/compute/test_servers_client.py b/tempest/tests/services/compute/test_servers_client.py
deleted file mode 100644
index 1fd0740..0000000
--- a/tempest/tests/services/compute/test_servers_client.py
+++ /dev/null
@@ -1,999 +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
-from tempest.services.compute.json import servers_client
-from tempest.tests import fake_auth_provider
-from tempest.tests.services.compute import base
-
-
-class TestServersClient(base.BaseComputeServiceTest):
-
- FAKE_SERVERS = {'servers': [{
- "id": "616fb98f-46ca-475e-917e-2563e5a8cd19",
- "links": [
- {
- "href": "http://os.co/v2/616fb98f-46ca-475e-917e-2563e5a8cd19",
- "rel": "self"
- },
- {
- "href": "http://os.co/616fb98f-46ca-475e-917e-2563e5a8cd19",
- "rel": "bookmark"
- }
- ],
- "name": u"new\u1234-server-test"}]
- }
-
- FAKE_SERVER_DIAGNOSTICS = {
- "cpu0_time": 17300000000,
- "memory": 524288,
- "vda_errors": -1,
- "vda_read": 262144,
- "vda_read_req": 112,
- "vda_write": 5778432,
- "vda_write_req": 488,
- "vnet1_rx": 2070139,
- "vnet1_rx_drop": 0,
- "vnet1_rx_errors": 0,
- "vnet1_rx_packets": 26701,
- "vnet1_tx": 140208,
- "vnet1_tx_drop": 0,
- "vnet1_tx_errors": 0,
- "vnet1_tx_packets": 662
- }
-
- FAKE_SERVER_GET = {'server': {
- "accessIPv4": "",
- "accessIPv6": "",
- "addresses": {
- "private": [
- {
- "addr": "192.168.0.3",
- "version": 4
- }
- ]
- },
- "created": "2012-08-20T21:11:09Z",
- "flavor": {
- "id": "1",
- "links": [
- {
- "href": "http://os.com/openstack/flavors/1",
- "rel": "bookmark"
- }
- ]
- },
- "hostId": "65201c14a29663e06d0748e561207d998b343e1d164bfa0aafa9c45d",
- "id": "893c7791-f1df-4c3d-8383-3caae9656c62",
- "image": {
- "id": "70a599e0-31e7-49b7-b260-868f441e862b",
- "links": [
- {
- "href": "http://imgs/70a599e0-31e7-49b7-b260-868f441e862b",
- "rel": "bookmark"
- }
- ]
- },
- "links": [
- {
- "href": "http://v2/srvs/893c7791-f1df-4c3d-8383-3caae9656c62",
- "rel": "self"
- },
- {
- "href": "http://srvs/893c7791-f1df-4c3d-8383-3caae9656c62",
- "rel": "bookmark"
- }
- ],
- "metadata": {
- u"My Server N\u1234me": u"Apa\u1234che1"
- },
- "name": u"new\u1234-server-test",
- "progress": 0,
- "status": "ACTIVE",
- "tenant_id": "openstack",
- "updated": "2012-08-20T21:11:09Z",
- "user_id": "fake"}
- }
-
- FAKE_SERVER_POST = {"server": {
- "id": "616fb98f-46ca-475e-917e-2563e5a8cd19",
- "adminPass": "fake-admin-pass",
- "security_groups": [
- 'fake-security-group-1',
- 'fake-security-group-2'
- ],
- "links": [
- {
- "href": "http://os.co/v2/616fb98f-46ca-475e-917e-2563e5a8cd19",
- "rel": "self"
- },
- {
- "href": "http://os.co/616fb98f-46ca-475e-917e-2563e5a8cd19",
- "rel": "bookmark"
- }
- ],
- "OS-DCF:diskConfig": "fake-disk-config"}
- }
-
- FAKE_ADDRESS = {"addresses": {
- "private": [
- {
- "addr": "192.168.0.3",
- "version": 4
- }
- ]}
- }
-
- FAKE_COMMON_VOLUME = {
- "id": "a6b0875b-6b5d-4a5a-81eb-0c3aa62e5fdb",
- "device": "fake-device",
- "volumeId": "a6b0875b-46ca-475e-917e-0c3aa62e5fdb",
- "serverId": "616fb98f-46ca-475e-917e-2563e5a8cd19"
- }
-
- FAKE_VIRTUAL_INTERFACES = {
- "id": "a6b0875b-46ca-475e-917e-0c3aa62e5fdb",
- "mac_address": "00:25:90:5b:f8:c3",
- "OS-EXT-VIF-NET:net_id": "fake-os-net-id"
- }
-
- FAKE_INSTANCE_ACTIONS = {
- "action": "fake-action",
- "request_id": "16fb98f-46ca-475e-917e-2563e5a8cd19",
- "user_id": "16fb98f-46ca-475e-917e-2563e5a8cd12",
- "project_id": "16fb98f-46ca-475e-917e-2563e5a8cd34",
- "start_time": "09MAR2015 11:15",
- "message": "fake-msg",
- "instance_uuid": "16fb98f-46ca-475e-917e-2563e5a8cd12"
- }
-
- FAKE_VNC_CONSOLE = {
- "type": "fake-type",
- "url": "http://os.co/v2/616fb98f-46ca-475e-917e-2563e5a8cd19"
- }
-
- FAKE_INSTANCE_ACTION_EVENTS = {
- "event": "fake-event",
- "start_time": "09MAR2015 11:15",
- "finish_time": "09MAR2015 11:15",
- "result": "fake-result",
- "traceback": "fake-trace-back"
- }
-
- FAKE_INSTANCE_WITH_EVENTS = copy.deepcopy(FAKE_INSTANCE_ACTIONS)
- FAKE_INSTANCE_WITH_EVENTS['events'] = [FAKE_INSTANCE_ACTION_EVENTS]
-
- FAKE_REBUILD_SERVER = copy.deepcopy(FAKE_SERVER_GET)
- FAKE_REBUILD_SERVER['server']['adminPass'] = 'fake-admin-pass'
-
- server_id = FAKE_SERVER_GET['server']['id']
- network_id = 'a6b0875b-6b5d-4a5a-81eb-0c3aa62e5fdb'
-
- def setUp(self):
- super(TestServersClient, self).setUp()
- fake_auth = fake_auth_provider.FakeAuthProvider()
- self.client = servers_client.ServersClient(
- fake_auth, 'compute', 'regionOne')
-
- def test_list_servers_with_str_body(self):
- self._test_list_servers()
-
- def test_list_servers_with_bytes_body(self):
- self._test_list_servers(bytes_body=True)
-
- def _test_list_servers(self, bytes_body=False):
- self.check_service_client_function(
- self.client.list_servers,
- 'tempest.common.service_client.ServiceClient.get',
- self.FAKE_SERVERS,
- bytes_body)
-
- def test_show_server_with_str_body(self):
- self._test_show_server()
-
- def test_show_server_with_bytes_body(self):
- self._test_show_server(bytes_body=True)
-
- def _test_show_server(self, bytes_body=False):
- self.check_service_client_function(
- self.client.show_server,
- 'tempest.common.service_client.ServiceClient.get',
- self.FAKE_SERVER_GET,
- bytes_body,
- server_id=self.server_id
- )
-
- def test_delete_server(self, bytes_body=False):
- self.check_service_client_function(
- self.client.delete_server,
- 'tempest.common.service_client.ServiceClient.delete',
- {},
- status=204,
- server_id=self.server_id
- )
-
- def test_create_server_with_str_body(self):
- self._test_create_server()
-
- def test_create_server_with_bytes_body(self):
- self._test_create_server(True)
-
- def _test_create_server(self, bytes_body=False):
- self.check_service_client_function(
- self.client.create_server,
- 'tempest.common.service_client.ServiceClient.post',
- self.FAKE_SERVER_POST,
- bytes_body,
- status=202,
- name='fake-name',
- imageRef='fake-image-ref',
- flavorRef='fake-flavor-ref'
- )
-
- def test_list_addresses_with_str_body(self):
- self._test_list_addresses()
-
- def test_list_addresses_with_bytes_body(self):
- self._test_list_addresses(True)
-
- def _test_list_addresses(self, bytes_body=False):
- self.check_service_client_function(
- self.client.list_addresses,
- 'tempest.common.service_client.ServiceClient.get',
- self.FAKE_ADDRESS,
- bytes_body,
- server_id=self.server_id
- )
-
- def test_list_addresses_by_network_with_str_body(self):
- self._test_list_addresses_by_network()
-
- def test_list_addresses_by_network_with_bytes_body(self):
- self._test_list_addresses_by_network(True)
-
- def _test_list_addresses_by_network(self, bytes_body=False):
- self.check_service_client_function(
- self.client.list_addresses_by_network,
- 'tempest.common.service_client.ServiceClient.get',
- self.FAKE_ADDRESS['addresses'],
- server_id=self.server_id,
- network_id=self.network_id
- )
-
- def test_action_with_str_body(self):
- self._test_action()
-
- def test_action_with_bytes_body(self):
- self._test_action(True)
-
- def _test_action(self, bytes_body=False):
- self.check_service_client_function(
- self.client.action,
- 'tempest.common.service_client.ServiceClient.post',
- {},
- server_id=self.server_id,
- action_name='fake-action-name',
- schema={'status_code': 200}
- )
-
- def test_create_backup_with_str_body(self):
- self._test_create_backup()
-
- def test_create_backup_with_bytes_body(self):
- self._test_create_backup(True)
-
- def _test_create_backup(self, bytes_body=False):
- self.check_service_client_function(
- self.client.create_backup,
- 'tempest.common.service_client.ServiceClient.post',
- {},
- status=202,
- server_id=self.server_id,
- backup_type='fake-backup',
- rotation='fake-rotation',
- name='fake-name'
- )
-
- def test_change_password_with_str_body(self):
- self._test_change_password()
-
- def test_change_password_with_bytes_body(self):
- self._test_change_password(True)
-
- def _test_change_password(self, bytes_body=False):
- self.check_service_client_function(
- self.client.change_password,
- 'tempest.common.service_client.ServiceClient.post',
- {},
- status=202,
- server_id=self.server_id,
- adminPass='fake-admin-pass'
- )
-
- def test_show_password_with_str_body(self):
- self._test_show_password()
-
- def test_show_password_with_bytes_body(self):
- self._test_show_password(True)
-
- def _test_show_password(self, bytes_body=False):
- self.check_service_client_function(
- self.client.show_password,
- 'tempest.common.service_client.ServiceClient.get',
- {'password': 'fake-password'},
- server_id=self.server_id
- )
-
- def test_delete_password_with_str_body(self):
- self._test_delete_password()
-
- def test_delete_password_with_bytes_body(self):
- self._test_delete_password(True)
-
- def _test_delete_password(self, bytes_body=False):
- self.check_service_client_function(
- self.client.delete_password,
- 'tempest.common.service_client.ServiceClient.delete',
- {},
- status=204,
- server_id=self.server_id
- )
-
- def test_reboot_server_with_str_body(self):
- self._test_reboot_server()
-
- def test_reboot_server_with_bytes_body(self):
- self._test_reboot_server(True)
-
- def _test_reboot_server(self, bytes_body=False):
- self.check_service_client_function(
- self.client.reboot_server,
- 'tempest.common.service_client.ServiceClient.post',
- {},
- status=202,
- server_id=self.server_id,
- type='fake-reboot-type'
- )
-
- def test_rebuild_server_with_str_body(self):
- self._test_rebuild_server()
-
- def test_rebuild_server_with_bytes_body(self):
- self._test_rebuild_server(True)
-
- def _test_rebuild_server(self, bytes_body=False):
- self.check_service_client_function(
- self.client.rebuild_server,
- 'tempest.common.service_client.ServiceClient.post',
- self.FAKE_REBUILD_SERVER,
- status=202,
- server_id=self.server_id,
- image_ref='fake-image-ref'
- )
-
- def test_resize_server_with_str_body(self):
- self._test_resize_server()
-
- def test_resize_server_with_bytes_body(self):
- self._test_resize_server(True)
-
- def _test_resize_server(self, bytes_body=False):
- self.check_service_client_function(
- self.client.resize_server,
- 'tempest.common.service_client.ServiceClient.post',
- {},
- status=202,
- server_id=self.server_id,
- flavor_ref='fake-flavor-ref'
- )
-
- def test_confirm_resize_server_with_str_body(self):
- self._test_confirm_resize_server()
-
- def test_confirm_resize_server_with_bytes_body(self):
- self._test_confirm_resize_server(True)
-
- def _test_confirm_resize_server(self, bytes_body=False):
- self.check_service_client_function(
- self.client.confirm_resize_server,
- 'tempest.common.service_client.ServiceClient.post',
- {},
- status=204,
- server_id=self.server_id
- )
-
- def test_revert_resize_server_with_str_body(self):
- self._test_revert_resize()
-
- def test_revert_resize_server_with_bytes_body(self):
- self._test_revert_resize(True)
-
- def _test_revert_resize(self, bytes_body=False):
- self.check_service_client_function(
- self.client.revert_resize_server,
- 'tempest.common.service_client.ServiceClient.post',
- {},
- status=202,
- server_id=self.server_id
- )
-
- def test_list_server_metadata_with_str_body(self):
- self._test_list_server_metadata()
-
- def test_list_server_metadata_with_bytes_body(self):
- self._test_list_server_metadata()
-
- def _test_list_server_metadata(self, bytes_body=False):
- self.check_service_client_function(
- self.client.list_server_metadata,
- 'tempest.common.service_client.ServiceClient.get',
- {'metadata': {'fake-key': 'fake-meta-data'}},
- server_id=self.server_id
- )
-
- def test_set_server_metadata_with_str_body(self):
- self._test_set_server_metadata()
-
- def test_set_server_metadata_with_bytes_body(self):
- self._test_set_server_metadata(True)
-
- def _test_set_server_metadata(self, bytes_body=False):
- self.check_service_client_function(
- self.client.set_server_metadata,
- 'tempest.common.service_client.ServiceClient.put',
- {'metadata': {'fake-key': 'fake-meta-data'}},
- server_id=self.server_id,
- meta='fake-meta'
- )
-
- def test_update_server_metadata_with_str_body(self):
- self._test_update_server_metadata()
-
- def test_update_server_metadata_with_bytes_body(self):
- self._test_update_server_metadata(True)
-
- def _test_update_server_metadata(self, bytes_body=False):
- self.check_service_client_function(
- self.client.update_server_metadata,
- 'tempest.common.service_client.ServiceClient.post',
- {'metadata': {'fake-key': 'fake-meta-data'}},
- server_id=self.server_id,
- meta='fake-meta'
- )
-
- def test_show_server_metadata_item_with_str_body(self):
- self._test_show_server_metadata()
-
- def test_show_server_metadata_item_with_bytes_body(self):
- self._test_show_server_metadata(True)
-
- def _test_show_server_metadata(self, bytes_body=False):
- self.check_service_client_function(
- self.client.show_server_metadata_item,
- 'tempest.common.service_client.ServiceClient.get',
- {'meta': {'fake-key': 'fake-meta-data'}},
- server_id=self.server_id,
- key='fake-key'
- )
-
- def test_set_server_metadata_item_with_str_body(self):
- self._test_set_server_metadata_item()
-
- def test_set_server_metadata_item_with_bytes_body(self):
- self._test_set_server_metadata_item(True)
-
- def _test_set_server_metadata_item(self, bytes_body=False):
- self.check_service_client_function(
- self.client.set_server_metadata_item,
- 'tempest.common.service_client.ServiceClient.put',
- {'meta': {'fake-key': 'fake-meta-data'}},
- server_id=self.server_id,
- key='fake-key',
- meta='fake-meta'
- )
-
- def test_delete_server_metadata_item_with_str_body(self):
- self._test_delete_server_metadata()
-
- def test_delete_server_metadata_item_with_bytes_body(self):
- self._test_delete_server_metadata(True)
-
- def _test_delete_server_metadata(self, bytes_body=False):
- self.check_service_client_function(
- self.client.delete_server_metadata_item,
- 'tempest.common.service_client.ServiceClient.delete',
- {},
- status=204,
- server_id=self.server_id,
- key='fake-key'
- )
-
- def test_stop_server_with_str_body(self):
- self._test_stop_server()
-
- def test_stop_server_with_bytes_body(self):
- self._test_stop_server(True)
-
- def _test_stop_server(self, bytes_body=False):
- self.check_service_client_function(
- self.client.stop_server,
- 'tempest.common.service_client.ServiceClient.post',
- {},
- status=202,
- server_id=self.server_id
- )
-
- def test_start_server_with_str_body(self):
- self._test_start_server()
-
- def test_start_server_with_bytes_body(self):
- self._test_start_server(True)
-
- def _test_start_server(self, bytes_body=False):
- self.check_service_client_function(
- self.client.start_server,
- 'tempest.common.service_client.ServiceClient.post',
- {},
- status=202,
- server_id=self.server_id
- )
-
- def test_attach_volume_with_str_body(self):
- self._test_attach_volume_server()
-
- def test_attach_volume_with_bytes_body(self):
- self._test_attach_volume_server(True)
-
- def _test_attach_volume_server(self, bytes_body=False):
- self.check_service_client_function(
- self.client.attach_volume,
- 'tempest.common.service_client.ServiceClient.post',
- {'volumeAttachment': self.FAKE_COMMON_VOLUME},
- server_id=self.server_id
- )
-
- def test_detach_volume_with_str_body(self):
- self._test_detach_volume_server()
-
- def test_detach_volume_with_bytes_body(self):
- self._test_detach_volume_server(True)
-
- def _test_detach_volume_server(self, bytes_body=False):
- self.check_service_client_function(
- self.client.detach_volume,
- 'tempest.common.service_client.ServiceClient.delete',
- {},
- status=202,
- server_id=self.server_id,
- volume_id=self.FAKE_COMMON_VOLUME['volumeId']
- )
-
- def test_show_volume_attachment_with_str_body(self):
- self._test_show_volume_attachment()
-
- def test_show_volume_attachment_with_bytes_body(self):
- self._test_show_volume_attachment(True)
-
- def _test_show_volume_attachment(self, bytes_body=False):
- self.check_service_client_function(
- self.client.show_volume_attachment,
- 'tempest.common.service_client.ServiceClient.get',
- {'volumeAttachment': self.FAKE_COMMON_VOLUME},
- server_id=self.server_id,
- attach_id='fake-attach-id'
- )
-
- def test_list_volume_attachments_with_str_body(self):
- self._test_list_volume_attachments()
-
- def test_list_volume_attachments_with_bytes_body(self):
- self._test_list_volume_attachments(True)
-
- def _test_list_volume_attachments(self, bytes_body=False):
- self.check_service_client_function(
- self.client.list_volume_attachments,
- 'tempest.common.service_client.ServiceClient.get',
- {'volumeAttachments': [self.FAKE_COMMON_VOLUME]},
- server_id=self.server_id
- )
-
- def test_add_security_group_with_str_body(self):
- self._test_add_security_group()
-
- def test_add_security_group_with_bytes_body(self):
- self._test_add_security_group(True)
-
- def _test_add_security_group(self, bytes_body=False):
- self.check_service_client_function(
- self.client.add_security_group,
- 'tempest.common.service_client.ServiceClient.post',
- {},
- status=202,
- server_id=self.server_id,
- name='fake-name'
- )
-
- def test_remove_security_group_with_str_body(self):
- self._test_remove_security_group()
-
- def test_remove_security_group_with_bytes_body(self):
- self._test_remove_security_group(True)
-
- def _test_remove_security_group(self, bytes_body=False):
- self.check_service_client_function(
- self.client.remove_security_group,
- 'tempest.common.service_client.ServiceClient.post',
- {},
- status=202,
- server_id=self.server_id,
- name='fake-name'
- )
-
- def test_live_migrate_server_with_str_body(self):
- self._test_live_migrate_server()
-
- def test_live_migrate_server_with_bytes_body(self):
- self._test_live_migrate_server(True)
-
- def _test_live_migrate_server(self, bytes_body=False):
- self.check_service_client_function(
- self.client.live_migrate_server,
- 'tempest.common.service_client.ServiceClient.post',
- {},
- status=202,
- server_id=self.server_id
- )
-
- def test_migrate_server_with_str_body(self):
- self._test_migrate_server()
-
- def test_migrate_server_with_bytes_body(self):
- self._test_migrate_server(True)
-
- def _test_migrate_server(self, bytes_body=False):
- self.check_service_client_function(
- self.client.migrate_server,
- 'tempest.common.service_client.ServiceClient.post',
- {},
- status=202,
- server_id=self.server_id
- )
-
- def test_lock_server_with_str_body(self):
- self._test_lock_server()
-
- def test_lock_server_with_bytes_body(self):
- self._test_lock_server(True)
-
- def _test_lock_server(self, bytes_body=False):
- self.check_service_client_function(
- self.client.lock_server,
- 'tempest.common.service_client.ServiceClient.post',
- {},
- status=202,
- server_id=self.server_id
- )
-
- def test_unlock_server_with_str_body(self):
- self._test_unlock_server()
-
- def test_unlock_server_with_bytes_body(self):
- self._test_unlock_server(True)
-
- def _test_unlock_server(self, bytes_body=False):
- self.check_service_client_function(
- self.client.unlock_server,
- 'tempest.common.service_client.ServiceClient.post',
- {},
- status=202,
- server_id=self.server_id
- )
-
- def test_suspend_server_with_str_body(self):
- self._test_suspend_server()
-
- def test_suspend_server_with_bytes_body(self):
- self._test_suspend_server(True)
-
- def _test_suspend_server(self, bytes_body=False):
- self.check_service_client_function(
- self.client.suspend_server,
- 'tempest.common.service_client.ServiceClient.post',
- {},
- status=202,
- server_id=self.server_id
- )
-
- def test_resume_server_with_str_body(self):
- self._test_resume_server()
-
- def test_resume_server_with_bytes_body(self):
- self._test_resume_server(True)
-
- def _test_resume_server(self, bytes_body=False):
- self.check_service_client_function(
- self.client.resume_server,
- 'tempest.common.service_client.ServiceClient.post',
- {},
- status=202,
- server_id=self.server_id
- )
-
- def test_pause_server_with_str_body(self):
- self._test_pause_server()
-
- def test_pause_server_with_bytes_body(self):
- self._test_pause_server(True)
-
- def _test_pause_server(self, bytes_body=False):
- self.check_service_client_function(
- self.client.pause_server,
- 'tempest.common.service_client.ServiceClient.post',
- {},
- status=202,
- server_id=self.server_id
- )
-
- def test_unpause_server_with_str_body(self):
- self._test_unpause_server()
-
- def test_unpause_server_with_bytes_body(self):
- self._test_unpause_server(True)
-
- def _test_unpause_server(self, bytes_body=False):
- self.check_service_client_function(
- self.client.unpause_server,
- 'tempest.common.service_client.ServiceClient.post',
- {},
- status=202,
- server_id=self.server_id
- )
-
- def test_reset_state_with_str_body(self):
- self._test_reset_state()
-
- def test_reset_state_with_bytes_body(self):
- self._test_reset_state(True)
-
- def _test_reset_state(self, bytes_body=False):
- self.check_service_client_function(
- self.client.reset_state,
- 'tempest.common.service_client.ServiceClient.post',
- {},
- status=202,
- server_id=self.server_id,
- state='fake-state'
- )
-
- def test_shelve_server_with_str_body(self):
- self._test_shelve_server()
-
- def test_shelve_server_with_bytes_body(self):
- self._test_shelve_server(True)
-
- def _test_shelve_server(self, bytes_body=False):
- self.check_service_client_function(
- self.client.shelve_server,
- 'tempest.common.service_client.ServiceClient.post',
- {},
- status=202,
- server_id=self.server_id
- )
-
- def test_unshelve_server_with_str_body(self):
- self._test_unshelve_server()
-
- def test_unshelve_server_with_bytes_body(self):
- self._test_unshelve_server(True)
-
- def _test_unshelve_server(self, bytes_body=False):
- self.check_service_client_function(
- self.client.unshelve_server,
- 'tempest.common.service_client.ServiceClient.post',
- {},
- status=202,
- server_id=self.server_id
- )
-
- def test_shelve_offload_server_with_str_body(self):
- self._test_shelve_offload_server()
-
- def test_shelve_offload_server_with_bytes_body(self):
- self._test_shelve_offload_server(True)
-
- def _test_shelve_offload_server(self, bytes_body=False):
- self.check_service_client_function(
- self.client.shelve_offload_server,
- 'tempest.common.service_client.ServiceClient.post',
- {},
- status=202,
- server_id=self.server_id
- )
-
- def test_get_console_output_with_str_body(self):
- self._test_get_console_output()
-
- def test_get_console_output_with_bytes_body(self):
- self._test_get_console_output(True)
-
- def _test_get_console_output(self, bytes_body=False):
- self.check_service_client_function(
- self.client.get_console_output,
- 'tempest.common.service_client.ServiceClient.post',
- {'output': 'fake-output'},
- server_id=self.server_id,
- length='fake-length'
- )
-
- def test_list_virtual_interfaces_with_str_body(self):
- self._test_list_virtual_interfaces()
-
- def test_list_virtual_interfaces_with_bytes_body(self):
- self._test_list_virtual_interfaces(True)
-
- def _test_list_virtual_interfaces(self, bytes_body=False):
- self.check_service_client_function(
- self.client.list_virtual_interfaces,
- 'tempest.common.service_client.ServiceClient.get',
- {'virtual_interfaces': [self.FAKE_VIRTUAL_INTERFACES]},
- server_id=self.server_id
- )
-
- def test_rescue_server_with_str_body(self):
- self._test_rescue_server()
-
- def test_rescue_server_with_bytes_body(self):
- self._test_rescue_server(True)
-
- def _test_rescue_server(self, bytes_body=False):
- self.check_service_client_function(
- self.client.rescue_server,
- 'tempest.common.service_client.ServiceClient.post',
- {'adminPass': 'fake-admin-pass'},
- server_id=self.server_id
- )
-
- def test_unrescue_server_with_str_body(self):
- self._test_unrescue_server()
-
- def test_unrescue_server_with_bytes_body(self):
- self._test_unrescue_server(True)
-
- def _test_unrescue_server(self, bytes_body=False):
- self.check_service_client_function(
- self.client.unrescue_server,
- 'tempest.common.service_client.ServiceClient.post',
- {},
- status=202,
- server_id=self.server_id
- )
-
- def test_show_server_diagnostics_with_str_body(self):
- self._test_show_server_diagnostics()
-
- def test_show_server_diagnostics_with_bytes_body(self):
- self._test_show_server_diagnostics(True)
-
- def _test_show_server_diagnostics(self, bytes_body=False):
- self.check_service_client_function(
- self.client.show_server_diagnostics,
- 'tempest.common.service_client.ServiceClient.get',
- self.FAKE_SERVER_DIAGNOSTICS,
- status=200,
- server_id=self.server_id
- )
-
- def test_list_instance_actions_with_str_body(self):
- self._test_list_instance_actions()
-
- def test_list_instance_actions_with_bytes_body(self):
- self._test_list_instance_actions(True)
-
- def _test_list_instance_actions(self, bytes_body=False):
- self.check_service_client_function(
- self.client.list_instance_actions,
- 'tempest.common.service_client.ServiceClient.get',
- {'instanceActions': [self.FAKE_INSTANCE_ACTIONS]},
- server_id=self.server_id
- )
-
- def test_show_instance_action_with_str_body(self):
- self._test_show_instance_action()
-
- def test_show_instance_action_with_bytes_body(self):
- self._test_show_instance_action(True)
-
- def _test_show_instance_action(self, bytes_body=False):
- self.check_service_client_function(
- self.client.show_instance_action,
- 'tempest.common.service_client.ServiceClient.get',
- {'instanceAction': self.FAKE_INSTANCE_WITH_EVENTS},
- server_id=self.server_id,
- request_id='fake-request-id'
- )
-
- def test_force_delete_server_with_str_body(self):
- self._test_force_delete_server()
-
- def test_force_delete_server_with_bytes_body(self):
- self._test_force_delete_server(True)
-
- def _test_force_delete_server(self, bytes_body=False):
- self.check_service_client_function(
- self.client.force_delete_server,
- 'tempest.common.service_client.ServiceClient.post',
- {},
- status=202,
- server_id=self.server_id
- )
-
- def test_restore_soft_deleted_server_with_str_body(self):
- self._test_restore_soft_deleted_server()
-
- def test_restore_soft_deleted_server_with_bytes_body(self):
- self._test_restore_soft_deleted_server(True)
-
- def _test_restore_soft_deleted_server(self, bytes_body=False):
- self.check_service_client_function(
- self.client.restore_soft_deleted_server,
- 'tempest.common.service_client.ServiceClient.post',
- {},
- status=202,
- server_id=self.server_id
- )
-
- def test_reset_network_with_str_body(self):
- self._test_reset_network()
-
- def test_reset_network_with_bytes_body(self):
- self._test_reset_network(True)
-
- def _test_reset_network(self, bytes_body=False):
- self.check_service_client_function(
- self.client.reset_network,
- 'tempest.common.service_client.ServiceClient.post',
- {},
- status=202,
- server_id=self.server_id
- )
-
- def test_inject_network_info_with_str_body(self):
- self._test_inject_network_info()
-
- def test_inject_network_info_with_bytes_body(self):
- self._test_inject_network_info(True)
-
- def _test_inject_network_info(self, bytes_body=False):
- self.check_service_client_function(
- self.client.inject_network_info,
- 'tempest.common.service_client.ServiceClient.post',
- {},
- status=202,
- server_id=self.server_id
- )
-
- def test_get_vnc_console_with_str_body(self):
- self._test_get_vnc_console()
-
- def test_get_vnc_console_with_bytes_body(self):
- self._test_get_vnc_console(True)
-
- def _test_get_vnc_console(self, bytes_body=False):
- self.check_service_client_function(
- self.client.get_vnc_console,
- 'tempest.common.service_client.ServiceClient.post',
- {'console': self.FAKE_VNC_CONSOLE},
- server_id=self.server_id,
- type='fake-console-type'
- )