Merge "[V3] Rename get_region to show_region"
diff --git a/requirements.txt b/requirements.txt
index 17d063d..d470c30 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -22,6 +22,6 @@
iso8601>=0.1.9
fixtures>=1.3.1
testscenarios>=0.4
-tempest-lib>=0.10.0
+tempest-lib>=0.11.0
PyYAML>=3.1.0
stevedore>=1.5.0 # Apache-2.0
diff --git a/tempest/api/identity/admin/v3/test_credentials.py b/tempest/api/identity/admin/v3/test_credentials.py
index 048c53a..5e1c3cc 100644
--- a/tempest/api/identity/admin/v3/test_credentials.py
+++ b/tempest/api/identity/admin/v3/test_credentials.py
@@ -76,7 +76,7 @@
self.assertEqual(update_body['blob']['access'], new_keys[0])
self.assertEqual(update_body['blob']['secret'], new_keys[1])
- get_body = self.creds_client.get_credential(cred['id'])['credential']
+ get_body = self.creds_client.show_credential(cred['id'])['credential']
for value1 in self.creds_list[0]:
self.assertEqual(update_body[value1],
get_body[value1])
diff --git a/tempest/api/network/admin/test_l3_agent_scheduler.py b/tempest/api/network/admin/test_l3_agent_scheduler.py
index d5556b8..36747a3 100644
--- a/tempest/api/network/admin/test_l3_agent_scheduler.py
+++ b/tempest/api/network/admin/test_l3_agent_scheduler.py
@@ -97,7 +97,7 @@
l3_agent_ids = list()
self.admin_client.add_router_to_l3_agent(
self.agent['id'],
- self.router['id'])
+ router_id=self.router['id'])
body = (
self.admin_client.list_l3_agents_hosting_router(self.router['id']))
for agent in body['agents']:
diff --git a/tempest/api/network/admin/test_negative_quotas.py b/tempest/api/network/admin/test_negative_quotas.py
new file mode 100644
index 0000000..5c4c421
--- /dev/null
+++ b/tempest/api/network/admin/test_negative_quotas.py
@@ -0,0 +1,68 @@
+# Copyright 2015 Cloudwatt
+# 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.network import base
+from tempest import test
+from tempest_lib import exceptions as lib_exc
+
+
+class QuotasNegativeTest(base.BaseAdminNetworkTest):
+ """Tests the following operations in the Neutron API:
+
+ set network quota and exceed this quota
+
+ v2.0 of the API is assumed.
+ It is also assumed that the per-tenant quota extension API is configured
+ in /etc/neutron/neutron.conf as follows:
+
+ quota_driver = neutron.db.quota_db.DbQuotaDriver
+ """
+
+ @classmethod
+ def skip_checks(cls):
+ super(QuotasNegativeTest, cls).skip_checks()
+ if not test.is_extension_enabled('quotas', 'network'):
+ msg = "quotas extension not enabled."
+ raise cls.skipException(msg)
+
+ @classmethod
+ def setup_clients(cls):
+ super(QuotasNegativeTest, cls).setup_clients()
+ cls.identity_admin_client = cls.os_adm.identity_client
+
+ @test.idempotent_id('644f4e1b-1bf9-4af0-9fd8-eb56ac0f51cf')
+ def test_network_quota_exceeding(self):
+ # Set the network quota to two
+ self.admin_client.update_quotas(self.networks_client.tenant_id,
+ network=2)
+ self.addCleanup(self.admin_client.reset_quotas,
+ self.networks_client.tenant_id)
+
+ # Create two networks
+ n1 = self.networks_client.create_network()
+ self.addCleanup(self.networks_client.delete_network,
+ n1['network']['id'])
+ n2 = self.networks_client.create_network()
+ self.addCleanup(self.networks_client.delete_network,
+ n2['network']['id'])
+
+ # Try to create a third network while the quota is two
+ with self.assertRaisesRegexp(
+ lib_exc.Conflict,
+ "An object with that identifier already exists\\n" +
+ "Details.*Quota exceeded for resources: \['network'\].*"):
+ n3 = self.networks_client.create_network()
+ self.addCleanup(self.networks_client.delete_network,
+ n3['network']['id'])
diff --git a/tempest/api/network/base.py b/tempest/api/network/base.py
index b4ea29b..c5a3dff 100644
--- a/tempest/api/network/base.py
+++ b/tempest/api/network/base.py
@@ -98,9 +98,12 @@
floating_ip['id'])
# Clean up metering label rules
+ # Not all classes in the hierarchy have the client class variable
+ if len(cls.metering_label_rules) > 0:
+ label_rules_client = cls.admin_metering_label_rules_client
for metering_label_rule in cls.metering_label_rules:
cls._try_delete_resource(
- cls.admin_client.delete_metering_label_rule,
+ label_rules_client.delete_metering_label_rule,
metering_label_rule['id'])
# Clean up metering labels
for metering_label in cls.metering_labels:
@@ -273,6 +276,8 @@
cls.admin_ports_client = cls.os_adm.ports_client
cls.admin_floating_ips_client = cls.os_adm.floating_ips_client
cls.admin_metering_labels_client = cls.os_adm.metering_labels_client
+ cls.admin_metering_label_rules_client = (
+ cls.os_adm.metering_label_rules_client)
@classmethod
def create_metering_label(cls, name, description):
@@ -288,7 +293,8 @@
def create_metering_label_rule(cls, remote_ip_prefix, direction,
metering_label_id):
"""Wrapper utility that returns a test metering label rule."""
- body = cls.admin_client.create_metering_label_rule(
+ client = cls.admin_metering_label_rules_client
+ body = client.create_metering_label_rule(
remote_ip_prefix=remote_ip_prefix, direction=direction,
metering_label_id=metering_label_id)
metering_label_rule = body['metering_label_rule']
diff --git a/tempest/api/network/test_metering_extensions.py b/tempest/api/network/test_metering_extensions.py
index c4021b4..007ba3b 100644
--- a/tempest/api/network/test_metering_extensions.py
+++ b/tempest/api/network/test_metering_extensions.py
@@ -59,12 +59,11 @@
self.assertEqual(len(labels['metering_labels']), 0)
def _delete_metering_label_rule(self, metering_label_rule_id):
+ client = self.admin_metering_label_rules_client
# Deletes a rule and verifies if it is deleted or not
- self.admin_client.delete_metering_label_rule(
- metering_label_rule_id)
+ client.delete_metering_label_rule(metering_label_rule_id)
# Asserting that the rule is not found in list after deletion
- rules = (self.admin_client.list_metering_label_rules(
- id=metering_label_rule_id))
+ rules = client.list_metering_label_rules(id=metering_label_rule_id)
self.assertEqual(len(rules['metering_label_rules']), 0)
@test.idempotent_id('e2fb2f8c-45bf-429a-9f17-171c70444612')
@@ -105,8 +104,9 @@
@test.idempotent_id('cc832399-6681-493b-9d79-0202831a1281')
def test_list_metering_label_rules(self):
+ client = self.admin_metering_label_rules_client
# Verify rule filtering
- body = self.admin_client.list_metering_label_rules(id=33)
+ body = client.list_metering_label_rules(id=33)
metering_label_rules = body['metering_label_rules']
self.assertEqual(0, len(metering_label_rules))
@@ -115,7 +115,8 @@
# Creates a rule
remote_ip_prefix = ("10.0.1.0/24" if self._ip_version == 4
else "fd03::/64")
- body = (self.admin_client.create_metering_label_rule(
+ client = self.admin_metering_label_rules_client
+ body = (client.create_metering_label_rule(
remote_ip_prefix=remote_ip_prefix,
direction="ingress",
metering_label_id=self.metering_label['id']))
@@ -124,14 +125,14 @@
metering_label_rule['id'])
# Assert whether created rules are found in rules list or fail
# if created rules are not found in rules list
- rules = (self.admin_client.list_metering_label_rules(
- id=metering_label_rule['id']))
+ rules = client.list_metering_label_rules(id=metering_label_rule['id'])
self.assertEqual(len(rules['metering_label_rules']), 1)
@test.idempotent_id('b7354489-96ea-41f3-9452-bace120fb4a7')
def test_show_metering_label_rule(self):
# Verifies the details of a rule
- body = (self.admin_client.show_metering_label_rule(
+ client = self.admin_metering_label_rules_client
+ body = (client.show_metering_label_rule(
self.metering_label_rule['id']))
metering_label_rule = body['metering_label_rule']
self.assertEqual(self.metering_label_rule['id'],
diff --git a/tempest/api_schema/response/compute/v2_1/interfaces.py b/tempest/api_schema/response/compute/v2_1/interfaces.py
deleted file mode 100644
index 130775b..0000000
--- a/tempest/api_schema/response/compute/v2_1/interfaces.py
+++ /dev/null
@@ -1,73 +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
-
-interface_common_info = {
- 'type': 'object',
- 'properties': {
- 'port_state': {'type': 'string'},
- 'fixed_ips': {
- 'type': 'array',
- 'items': {
- 'type': 'object',
- 'properties': {
- 'subnet_id': {
- 'type': 'string',
- 'format': 'uuid'
- },
- 'ip_address': parameter_types.ip_address
- },
- 'additionalProperties': False,
- 'required': ['subnet_id', 'ip_address']
- }
- },
- 'port_id': {'type': 'string', 'format': 'uuid'},
- 'net_id': {'type': 'string', 'format': 'uuid'},
- 'mac_addr': parameter_types.mac_address
- },
- 'additionalProperties': False,
- 'required': ['port_state', 'fixed_ips', 'port_id', 'net_id', 'mac_addr']
-}
-
-get_create_interfaces = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'interfaceAttachment': interface_common_info
- },
- 'additionalProperties': False,
- 'required': ['interfaceAttachment']
- }
-}
-
-list_interfaces = {
- 'status_code': [200],
- 'response_body': {
- 'type': 'object',
- 'properties': {
- 'interfaceAttachments': {
- 'type': 'array',
- 'items': interface_common_info
- }
- },
- 'additionalProperties': False,
- 'required': ['interfaceAttachments']
- }
-}
-
-delete_interface = {
- 'status_code': [202]
-}
diff --git a/tempest/clients.py b/tempest/clients.py
index d16b47b..fe44094 100644
--- a/tempest/clients.py
+++ b/tempest/clients.py
@@ -39,6 +39,7 @@
as ComputeImagesClient
from tempest_lib.services.compute.instance_usage_audit_log_client import \
InstanceUsagesAuditLogClient
+from tempest_lib.services.compute.interfaces_client import InterfacesClient
from tempest_lib.services.compute.limits_client import LimitsClient
from tempest_lib.services.compute.migrations_client import MigrationsClient
from tempest_lib.services.compute.networks_client import NetworksClient \
@@ -70,8 +71,6 @@
from tempest.services import botoclients
from tempest.services.compute.json.floating_ips_client import \
FloatingIPsClient as ComputeFloatingIPsClient
-from tempest.services.compute.json.interfaces_client import \
- InterfacesClient
from tempest.services.compute.json.keypairs_client import KeyPairsClient
from tempest.services.compute.json.security_group_rules_client import \
SecurityGroupRulesClient
@@ -108,6 +107,8 @@
from tempest.services.messaging.json.messaging_client import \
MessagingClient
from tempest.services.network.json.floating_ips_client import FloatingIPsClient
+from tempest.services.network.json.metering_label_rules_client import \
+ MeteringLabelRulesClient
from tempest.services.network.json.metering_labels_client import \
MeteringLabelsClient
from tempest.services.network.json.network_client import NetworkClient
@@ -122,13 +123,13 @@
from tempest.services.telemetry.json.alarming_client import AlarmingClient
from tempest.services.telemetry.json.telemetry_client import \
TelemetryClient
-from tempest.services.volume.v1.json.admin.volume_hosts_client import \
+from tempest.services.volume.v1.json.admin.hosts_client import \
VolumeHostsClient
-from tempest.services.volume.v1.json.admin.volume_quotas_client import \
+from tempest.services.volume.v1.json.admin.quotas_client import \
VolumeQuotasClient
-from tempest.services.volume.v1.json.admin.volume_services_client import \
+from tempest.services.volume.v1.json.admin.services_client import \
VolumesServicesClient
-from tempest.services.volume.v1.json.admin.volume_types_client import \
+from tempest.services.volume.v1.json.admin.types_client import \
VolumeTypesClient
from tempest.services.volume.v1.json.availability_zone_client import \
VolumeAvailabilityZoneClient
@@ -138,13 +139,13 @@
from tempest.services.volume.v1.json.qos_client import QosSpecsClient
from tempest.services.volume.v1.json.snapshots_client import SnapshotsClient
from tempest.services.volume.v1.json.volumes_client import VolumesClient
-from tempest.services.volume.v2.json.admin.volume_hosts_client import \
+from tempest.services.volume.v2.json.admin.hosts_client import \
VolumeHostsV2Client
-from tempest.services.volume.v2.json.admin.volume_quotas_client import \
+from tempest.services.volume.v2.json.admin.quotas_client import \
VolumeQuotasV2Client
-from tempest.services.volume.v2.json.admin.volume_services_client import \
+from tempest.services.volume.v2.json.admin.services_client import \
VolumesServicesV2Client
-from tempest.services.volume.v2.json.admin.volume_types_client import \
+from tempest.services.volume.v2.json.admin.types_client import \
VolumeTypesV2Client
from tempest.services.volume.v2.json.availability_zone_client import \
VolumeV2AvailabilityZoneClient
@@ -241,6 +242,14 @@
build_interval=CONF.network.build_interval,
build_timeout=CONF.network.build_timeout,
**self.default_params)
+ self.metering_label_rules_client = MeteringLabelRulesClient(
+ self.auth_provider,
+ CONF.network.catalog_type,
+ CONF.network.region or CONF.identity.region,
+ endpoint_type=CONF.network.endpoint_type,
+ build_interval=CONF.network.build_interval,
+ build_timeout=CONF.network.build_timeout,
+ **self.default_params)
self.messaging_client = MessagingClient(
self.auth_provider,
CONF.messaging.catalog_type,
diff --git a/tempest/cmd/cleanup_service.py b/tempest/cmd/cleanup_service.py
index f2dd7af..98af9c1 100644
--- a/tempest/cmd/cleanup_service.py
+++ b/tempest/cmd/cleanup_service.py
@@ -388,6 +388,7 @@
self.ports_client = manager.ports_client
self.floating_ips_client = manager.floating_ips_client
self.metering_labels_client = manager.metering_labels_client
+ self.metering_label_rules_client = manager.metering_label_rules_client
def _filter_by_conf_networks(self, item_list):
if not item_list or not all(('network_id' in i for i in item_list)):
@@ -577,7 +578,7 @@
class NetworkMeteringLabelRuleService(NetworkService):
def list(self):
- client = self.client
+ client = self.metering_label_rules_client
rules = client.list_metering_label_rules()
rules = rules['metering_label_rules']
rules = self._filter_by_tenant_id(rules)
@@ -585,7 +586,7 @@
return rules
def delete(self):
- client = self.client
+ client = self.metering_label_rules_client
rules = self.list()
for rule in rules:
try:
diff --git a/tempest/hacking/ignored_list_T110.txt b/tempest/hacking/ignored_list_T110.txt
index 8582f53..dd3e489 100644
--- a/tempest/hacking/ignored_list_T110.txt
+++ b/tempest/hacking/ignored_list_T110.txt
@@ -1,5 +1,4 @@
./tempest/services/database/json/flavors_client.py
-./tempest/services/identity/v3/json/credentials_client.py
./tempest/services/identity/v3/json/identity_client.py
./tempest/services/identity/v3/json/policy_client.py
./tempest/services/messaging/json/messaging_client.py
diff --git a/tempest/scenario/test_network_basic_ops.py b/tempest/scenario/test_network_basic_ops.py
index 41d13fe..20ccc59 100644
--- a/tempest/scenario/test_network_basic_ops.py
+++ b/tempest/scenario/test_network_basic_ops.py
@@ -726,7 +726,7 @@
target_agent = list(hosting_agents if no_migration else
agent_list - hosting_agents)[0]
schedule_router(target_agent,
- self.router['id'])
+ router_id=self.router['id'])
self.assertEqual(
target_agent,
list_hosts(self.router.id)['agents'][0]['id'],
diff --git a/tempest/services/baremetal/base.py b/tempest/services/baremetal/base.py
index 004c0de..d8cb99d 100644
--- a/tempest/services/baremetal/base.py
+++ b/tempest/services/baremetal/base.py
@@ -59,7 +59,7 @@
:param resource_name: The name of the REST resource, e.g., 'nodes'.
:param uuid: The unique identifier of an object in UUID format.
- :return: Relative URI for the resource or object.
+ :returns: Relative URI for the resource or object.
"""
prefix = self.uri_prefix if not permanent else ''
@@ -68,18 +68,18 @@
res=resource_name,
uuid='/%s' % uuid if uuid else '')
- def _make_patch(self, allowed_attributes, **kw):
+ def _make_patch(self, allowed_attributes, **kwargs):
"""Create a JSON patch according to RFC 6902.
:param allowed_attributes: An iterable object that contains a set of
allowed attributes for an object.
- :param **kw: Attributes and new values for them.
- :return: A JSON path that sets values of the specified attributes to
+ :param **kwargs: Attributes and new values for them.
+ :returns: A JSON path that sets values of the specified attributes to
the new ones.
"""
- def get_change(kw, path='/'):
- for name, value in six.iteritems(kw):
+ def get_change(kwargs, path='/'):
+ for name, value in six.iteritems(kwargs):
if isinstance(value, dict):
for ch in get_change(value, path + '%s/' % name):
yield ch
@@ -92,7 +92,7 @@
'value': value,
'op': 'replace'}
- patch = [ch for ch in get_change(kw)
+ patch = [ch for ch in get_change(kwargs)
if ch['path'].lstrip('/') in allowed_attributes]
return patch
@@ -101,8 +101,8 @@
"""Get the list of objects of the specified type.
:param resource: The name of the REST resource, e.g., 'nodes'.
- "param **kw: Parameters for the request.
- :return: A tuple with the server response and deserialized JSON list
+ :param **kwargs: Parameters for the request.
+ :returns: A tuple with the server response and deserialized JSON list
of objects
"""
@@ -119,7 +119,7 @@
"""Gets a specific object of the specified type.
:param uuid: Unique identifier of the object in UUID format.
- :return: Serialized object as a dictionary.
+ :returns: Serialized object as a dictionary.
"""
if 'uri' in kwargs:
@@ -137,7 +137,7 @@
:param resource: The name of the REST resource, e.g., 'nodes'.
:param object_dict: A Python dict that represents an object of the
specified type.
- :return: A tuple with the server response and the deserialized created
+ :returns: A tuple with the server response and the deserialized created
object.
"""
@@ -154,7 +154,7 @@
:param resource: The name of the REST resource, e.g., 'nodes'.
:param uuid: The unique identifier of an object in UUID format.
- :return: A tuple with the server response and the response body.
+ :returns: A tuple with the server response and the response body.
"""
uri = self._get_uri(resource, uuid)
@@ -168,7 +168,7 @@
:param resource: The name of the REST resource, e.g., 'nodes'.
:param uuid: The unique identifier of an object in UUID format.
- :return: A tuple with the server response and the serialized patched
+ :returns: A tuple with the server response and the serialized patched
object.
"""
@@ -190,7 +190,7 @@
"""Retrieves the desctription of the API.
:param version: The version of the API. Default: 'v1'.
- :return: Serialized description of API resources.
+ :returns: Serialized description of API resources.
"""
return self._list_request(version, permanent=True)
diff --git a/tempest/services/compute/json/interfaces_client.py b/tempest/services/compute/json/interfaces_client.py
deleted file mode 100644
index fe076d8..0000000
--- a/tempest/services/compute/json/interfaces_client.py
+++ /dev/null
@@ -1,50 +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 interfaces as schema
-from tempest.common import service_client
-
-
-class InterfacesClient(service_client.ServiceClient):
-
- def list_interfaces(self, server_id):
- resp, body = self.get('servers/%s/os-interface' % server_id)
- body = json.loads(body)
- self.validate_response(schema.list_interfaces, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def create_interface(self, server_id, **kwargs):
- post_body = {'interfaceAttachment': kwargs}
- post_body = json.dumps(post_body)
- resp, body = self.post('servers/%s/os-interface' % server_id,
- body=post_body)
- body = json.loads(body)
- self.validate_response(schema.get_create_interfaces, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def show_interface(self, server_id, port_id):
- resp, body = self.get('servers/%s/os-interface/%s' % (server_id,
- port_id))
- body = json.loads(body)
- self.validate_response(schema.get_create_interfaces, resp, body)
- return service_client.ResponseBody(resp, body)
-
- def delete_interface(self, server_id, port_id):
- resp, body = self.delete('servers/%s/os-interface/%s' % (server_id,
- port_id))
- self.validate_response(schema.delete_interface, resp, body)
- return service_client.ResponseBody(resp, body)
diff --git a/tempest/services/identity/v3/json/credentials_client.py b/tempest/services/identity/v3/json/credentials_client.py
index 7d4cf9a..753e960 100644
--- a/tempest/services/identity/v3/json/credentials_client.py
+++ b/tempest/services/identity/v3/json/credentials_client.py
@@ -51,7 +51,7 @@
body['credential']['blob'] = json.loads(body['credential']['blob'])
return service_client.ResponseBody(resp, body)
- def get_credential(self, credential_id):
+ def show_credential(self, credential_id):
"""To GET Details of a credential."""
resp, body = self.get('credentials/%s' % credential_id)
self.expected_success(200, resp.status)
diff --git a/tempest/services/network/json/metering_label_rules_client.py b/tempest/services/network/json/metering_label_rules_client.py
new file mode 100644
index 0000000..374a89c
--- /dev/null
+++ b/tempest/services/network/json/metering_label_rules_client.py
@@ -0,0 +1,33 @@
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from tempest.services.network.json import base
+
+
+class MeteringLabelRulesClient(base.BaseNetworkClient):
+
+ def create_metering_label_rule(self, **kwargs):
+ uri = '/metering/metering-label-rules'
+ post_data = {'metering_label_rule': kwargs}
+ return self.create_resource(uri, post_data)
+
+ def show_metering_label_rule(self, metering_label_rule_id, **fields):
+ uri = '/metering/metering-label-rules/%s' % metering_label_rule_id
+ return self.show_resource(uri, **fields)
+
+ def delete_metering_label_rule(self, metering_label_rule_id):
+ uri = '/metering/metering-label-rules/%s' % metering_label_rule_id
+ return self.delete_resource(uri)
+
+ def list_metering_label_rules(self, **filters):
+ uri = '/metering/metering-label-rules'
+ return self.list_resources(uri, **filters)
diff --git a/tempest/services/network/json/network_client.py b/tempest/services/network/json/network_client.py
index b525143..08316be 100644
--- a/tempest/services/network/json/network_client.py
+++ b/tempest/services/network/json/network_client.py
@@ -35,23 +35,6 @@
quotas
"""
- def create_metering_label_rule(self, **kwargs):
- uri = '/metering/metering-label-rules'
- post_data = {'metering_label_rule': kwargs}
- return self.create_resource(uri, post_data)
-
- def show_metering_label_rule(self, metering_label_rule_id, **fields):
- uri = '/metering/metering-label-rules/%s' % metering_label_rule_id
- return self.show_resource(uri, **fields)
-
- def delete_metering_label_rule(self, metering_label_rule_id):
- uri = '/metering/metering-label-rules/%s' % metering_label_rule_id
- return self.delete_resource(uri)
-
- def list_metering_label_rules(self, **filters):
- uri = '/metering/metering-label-rules'
- return self.list_resources(uri, **filters)
-
def create_security_group(self, **kwargs):
uri = '/security-groups'
post_data = {'security_group': kwargs}
@@ -300,10 +283,12 @@
uri = '/routers/%s/l3-agents' % router_id
return self.list_resources(uri)
- def add_router_to_l3_agent(self, agent_id, router_id):
+ def add_router_to_l3_agent(self, agent_id, **kwargs):
+ # TODO(piyush): Current api-site doesn't contain this API description.
+ # After fixing the api-site, we need to fix here also for putting the
+ # link to api-site.
uri = '/agents/%s/l3-routers' % agent_id
- post_body = {"router_id": router_id}
- return self.create_resource(uri, post_body)
+ return self.create_resource(uri, kwargs)
def remove_router_from_l3_agent(self, agent_id, router_id):
uri = '/agents/%s/l3-routers/%s' % (agent_id, router_id)
diff --git a/tempest/services/volume/base/admin/base_volume_hosts_client.py b/tempest/services/volume/base/admin/base_hosts_client.py
similarity index 100%
rename from tempest/services/volume/base/admin/base_volume_hosts_client.py
rename to tempest/services/volume/base/admin/base_hosts_client.py
diff --git a/tempest/services/volume/base/admin/base_volume_quotas_client.py b/tempest/services/volume/base/admin/base_quotas_client.py
similarity index 100%
rename from tempest/services/volume/base/admin/base_volume_quotas_client.py
rename to tempest/services/volume/base/admin/base_quotas_client.py
diff --git a/tempest/services/volume/base/admin/base_volume_services_client.py b/tempest/services/volume/base/admin/base_services_client.py
similarity index 100%
rename from tempest/services/volume/base/admin/base_volume_services_client.py
rename to tempest/services/volume/base/admin/base_services_client.py
diff --git a/tempest/services/volume/base/admin/base_volume_types_client.py b/tempest/services/volume/base/admin/base_types_client.py
similarity index 100%
rename from tempest/services/volume/base/admin/base_volume_types_client.py
rename to tempest/services/volume/base/admin/base_types_client.py
diff --git a/tempest/services/volume/v1/json/admin/volume_hosts_client.py b/tempest/services/volume/v1/json/admin/hosts_client.py
similarity index 82%
rename from tempest/services/volume/v1/json/admin/volume_hosts_client.py
rename to tempest/services/volume/v1/json/admin/hosts_client.py
index e564469..1b685bd 100644
--- a/tempest/services/volume/v1/json/admin/volume_hosts_client.py
+++ b/tempest/services/volume/v1/json/admin/hosts_client.py
@@ -13,8 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
-from tempest.services.volume.base.admin import base_volume_hosts_client
+from tempest.services.volume.base.admin import base_hosts_client
-class VolumeHostsClient(base_volume_hosts_client.BaseVolumeHostsClient):
+class VolumeHostsClient(base_hosts_client.BaseVolumeHostsClient):
"""Client class to send CRUD Volume Host API V1 requests"""
diff --git a/tempest/services/volume/v1/json/admin/volume_quotas_client.py b/tempest/services/volume/v1/json/admin/quotas_client.py
similarity index 82%
rename from tempest/services/volume/v1/json/admin/volume_quotas_client.py
rename to tempest/services/volume/v1/json/admin/quotas_client.py
index b0dde19..5ca074e 100644
--- a/tempest/services/volume/v1/json/admin/volume_quotas_client.py
+++ b/tempest/services/volume/v1/json/admin/quotas_client.py
@@ -12,8 +12,8 @@
# License for the specific language governing permissions and limitations
# under the License.
-from tempest.services.volume.base.admin import base_volume_quotas_client
+from tempest.services.volume.base.admin import base_quotas_client
-class VolumeQuotasClient(base_volume_quotas_client.BaseVolumeQuotasClient):
+class VolumeQuotasClient(base_quotas_client.BaseVolumeQuotasClient):
"""Client class to send CRUD Volume Type API V1 requests"""
diff --git a/tempest/services/volume/v1/json/admin/volume_services_client.py b/tempest/services/volume/v1/json/admin/services_client.py
similarity index 80%
rename from tempest/services/volume/v1/json/admin/volume_services_client.py
rename to tempest/services/volume/v1/json/admin/services_client.py
index 00810ed..efe02d8 100644
--- a/tempest/services/volume/v1/json/admin/volume_services_client.py
+++ b/tempest/services/volume/v1/json/admin/services_client.py
@@ -13,9 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
-from tempest.services.volume.base.admin import base_volume_services_client
+from tempest.services.volume.base.admin import base_services_client
-class VolumesServicesClient(
- base_volume_services_client.BaseVolumesServicesClient):
+class VolumesServicesClient(base_services_client.BaseVolumesServicesClient):
"""Volume V1 volume services client"""
diff --git a/tempest/services/volume/v1/json/admin/volume_types_client.py b/tempest/services/volume/v1/json/admin/types_client.py
similarity index 82%
rename from tempest/services/volume/v1/json/admin/volume_types_client.py
rename to tempest/services/volume/v1/json/admin/types_client.py
index 28524d1..4bd1579 100644
--- a/tempest/services/volume/v1/json/admin/volume_types_client.py
+++ b/tempest/services/volume/v1/json/admin/types_client.py
@@ -13,8 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
-from tempest.services.volume.base.admin import base_volume_types_client
+from tempest.services.volume.base.admin import base_types_client
-class VolumeTypesClient(base_volume_types_client.BaseVolumeTypesClient):
+class VolumeTypesClient(base_types_client.BaseVolumeTypesClient):
"""Volume V1 Volume Types client"""
diff --git a/tempest/services/volume/v2/json/admin/volume_hosts_client.py b/tempest/services/volume/v2/json/admin/hosts_client.py
similarity index 83%
rename from tempest/services/volume/v2/json/admin/volume_hosts_client.py
rename to tempest/services/volume/v2/json/admin/hosts_client.py
index a1d8b61..7bdc6f7 100644
--- a/tempest/services/volume/v2/json/admin/volume_hosts_client.py
+++ b/tempest/services/volume/v2/json/admin/hosts_client.py
@@ -13,9 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
-from tempest.services.volume.base.admin import base_volume_hosts_client
+from tempest.services.volume.base.admin import base_hosts_client
-class VolumeHostsV2Client(base_volume_hosts_client.BaseVolumeHostsClient):
+class VolumeHostsV2Client(base_hosts_client.BaseVolumeHostsClient):
"""Client class to send CRUD Volume V2 API requests"""
api_version = "v2"
diff --git a/tempest/services/volume/v2/json/admin/volume_hosts_client.py b/tempest/services/volume/v2/json/admin/quotas_client.py
similarity index 82%
copy from tempest/services/volume/v2/json/admin/volume_hosts_client.py
copy to tempest/services/volume/v2/json/admin/quotas_client.py
index a1d8b61..b2d3604 100644
--- a/tempest/services/volume/v2/json/admin/volume_hosts_client.py
+++ b/tempest/services/volume/v2/json/admin/quotas_client.py
@@ -13,9 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
-from tempest.services.volume.base.admin import base_volume_hosts_client
+from tempest.services.volume.base.admin import base_quotas_client
-class VolumeHostsV2Client(base_volume_hosts_client.BaseVolumeHostsClient):
+class VolumeQuotasV2Client(base_quotas_client.BaseVolumeQuotasClient):
"""Client class to send CRUD Volume V2 API requests"""
api_version = "v2"
diff --git a/tempest/services/volume/v2/json/admin/volume_hosts_client.py b/tempest/services/volume/v2/json/admin/services_client.py
similarity index 82%
copy from tempest/services/volume/v2/json/admin/volume_hosts_client.py
copy to tempest/services/volume/v2/json/admin/services_client.py
index a1d8b61..3912c9d 100644
--- a/tempest/services/volume/v2/json/admin/volume_hosts_client.py
+++ b/tempest/services/volume/v2/json/admin/services_client.py
@@ -13,9 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
-from tempest.services.volume.base.admin import base_volume_hosts_client
+from tempest.services.volume.base.admin import base_services_client
-class VolumeHostsV2Client(base_volume_hosts_client.BaseVolumeHostsClient):
+class VolumesServicesV2Client(base_services_client.BaseVolumesServicesClient):
"""Client class to send CRUD Volume V2 API requests"""
api_version = "v2"
diff --git a/tempest/services/volume/v2/json/admin/volume_types_client.py b/tempest/services/volume/v2/json/admin/types_client.py
similarity index 83%
rename from tempest/services/volume/v2/json/admin/volume_types_client.py
rename to tempest/services/volume/v2/json/admin/types_client.py
index d63acf5..d9eba7e 100644
--- a/tempest/services/volume/v2/json/admin/volume_types_client.py
+++ b/tempest/services/volume/v2/json/admin/types_client.py
@@ -13,9 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
-from tempest.services.volume.base.admin import base_volume_types_client
+from tempest.services.volume.base.admin import base_types_client
-class VolumeTypesV2Client(base_volume_types_client.BaseVolumeTypesClient):
+class VolumeTypesV2Client(base_types_client.BaseVolumeTypesClient):
"""Client class to send CRUD Volume V2 API requests"""
api_version = "v2"
diff --git a/tempest/services/volume/v2/json/admin/volume_quotas_client.py b/tempest/services/volume/v2/json/admin/volume_quotas_client.py
deleted file mode 100644
index a89ba2f..0000000
--- a/tempest/services/volume/v2/json/admin/volume_quotas_client.py
+++ /dev/null
@@ -1,21 +0,0 @@
-# Copyright 2014 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 tempest.services.volume.base.admin import base_volume_quotas_client
-
-
-class VolumeQuotasV2Client(base_volume_quotas_client.BaseVolumeQuotasClient):
- """Client class to send CRUD Volume V2 API requests"""
- api_version = "v2"
diff --git a/tempest/services/volume/v2/json/admin/volume_services_client.py b/tempest/services/volume/v2/json/admin/volume_services_client.py
deleted file mode 100644
index da7a4ea..0000000
--- a/tempest/services/volume/v2/json/admin/volume_services_client.py
+++ /dev/null
@@ -1,22 +0,0 @@
-# Copyright 2014 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 tempest.services.volume.base.admin import base_volume_services_client
-
-
-class VolumesServicesV2Client(
- base_volume_services_client.BaseVolumesServicesClient):
- """Client class to send CRUD Volume V2 API requests"""
- api_version = "v2"
diff --git a/tempest/tests/common/test_service_clients.py b/tempest/tests/common/test_service_clients.py
index 8de014f..f051ac0 100644
--- a/tempest/tests/common/test_service_clients.py
+++ b/tempest/tests/common/test_service_clients.py
@@ -18,7 +18,6 @@
from tempest.services.baremetal.v1.json import baremetal_client
from tempest.services.compute.json import floating_ips_client
-from tempest.services.compute.json import interfaces_client
from tempest.services.compute.json import security_group_rules_client
from tempest.services.compute.json import server_groups_client
from tempest.services.compute.json import servers_client
@@ -46,10 +45,14 @@
from tempest.services.orchestration.json import orchestration_client
from tempest.services.telemetry.json import alarming_client
from tempest.services.telemetry.json import telemetry_client
-from tempest.services.volume.v1.json.admin import volume_hosts_client
-from tempest.services.volume.v1.json.admin import volume_quotas_client
-from tempest.services.volume.v1.json.admin import volume_services_client
-from tempest.services.volume.v1.json.admin import volume_types_client
+from tempest.services.volume.v1.json.admin import hosts_client \
+ as volume_hosts_client
+from tempest.services.volume.v1.json.admin import quotas_client \
+ as volume_quotas_client
+from tempest.services.volume.v1.json.admin import services_client \
+ as volume_services_client
+from tempest.services.volume.v1.json.admin import types_client \
+ as volume_types_client
from tempest.services.volume.v1.json import availability_zone_client \
as volume_az_client
from tempest.services.volume.v1.json import backups_client
@@ -58,13 +61,13 @@
from tempest.services.volume.v1.json import qos_client
from tempest.services.volume.v1.json import snapshots_client
from tempest.services.volume.v1.json import volumes_client
-from tempest.services.volume.v2.json.admin import volume_hosts_client \
+from tempest.services.volume.v2.json.admin import hosts_client \
as volume_v2_hosts_client
-from tempest.services.volume.v2.json.admin import volume_quotas_client \
+from tempest.services.volume.v2.json.admin import quotas_client \
as volume_v2_quotas_client
-from tempest.services.volume.v2.json.admin import volume_services_client \
+from tempest.services.volume.v2.json.admin import services_client \
as volume_v2_services_client
-from tempest.services.volume.v2.json.admin import volume_types_client \
+from tempest.services.volume.v2.json.admin import types_client \
as volume_v2_types_client
from tempest.services.volume.v2.json import availability_zone_client \
as volume_v2_az_client
@@ -87,7 +90,6 @@
test_clients = [
baremetal_client.BaremetalClient,
floating_ips_client.FloatingIPsClient,
- interfaces_client.InterfacesClient,
security_group_rules_client.SecurityGroupRulesClient,
server_groups_client.ServerGroupsClient,
servers_client.ServersClient,
diff --git a/tempest/tests/services/compute/test_interfaces_client.py b/tempest/tests/services/compute/test_interfaces_client.py
deleted file mode 100644
index 235585a..0000000
--- a/tempest/tests/services/compute/test_interfaces_client.py
+++ /dev/null
@@ -1,98 +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 interfaces_client
-from tempest.tests import fake_auth_provider
-from tempest.tests.services.compute import base
-
-
-class TestInterfacesClient(base.BaseComputeServiceTest):
- # Data Values to be used for testing #
- FAKE_INTERFACE_DATA = {
- "fixed_ips": [{
- "ip_address": "192.168.1.1",
- "subnet_id": "f8a6e8f8-c2ec-497c-9f23-da9616de54ef"
- }],
- "mac_addr": "fa:16:3e:4c:2c:30",
- "net_id": "3cb9bc59-5699-4588-a4b1-b87f96708bc6",
- "port_id": "ce531f90-199f-48c0-816c-13e38010b442",
- "port_state": "ACTIVE"}
-
- FAKE_SHOW_DATA = {
- "interfaceAttachment": FAKE_INTERFACE_DATA}
- FAKE_LIST_DATA = {
- "interfaceAttachments": [FAKE_INTERFACE_DATA]}
-
- FAKE_SERVER_ID = "ec14c864-096e-4e27-bb8a-2c2b4dc6f3f5"
- FAKE_PORT_ID = FAKE_SHOW_DATA['interfaceAttachment']['port_id']
- func2mock = {
- 'delete': 'tempest.common.service_client.ServiceClient.delete',
- 'get': 'tempest.common.service_client.ServiceClient.get',
- 'post': 'tempest.common.service_client.ServiceClient.post'}
-
- def setUp(self):
- super(TestInterfacesClient, self).setUp()
- fake_auth = fake_auth_provider.FakeAuthProvider()
- self.client = interfaces_client.InterfacesClient(fake_auth,
- "compute",
- "regionOne")
-
- def _test_interface_operation(self, operation="create", bytes_body=False):
- response_code = 200
- expected_op = self.FAKE_SHOW_DATA
- mock_operation = self.func2mock['get']
- params = {'server_id': self.FAKE_SERVER_ID,
- 'port_id': self.FAKE_PORT_ID}
- if operation == 'list':
- expected_op = self.FAKE_LIST_DATA
- function = self.client.list_interfaces
- params = {'server_id': self.FAKE_SERVER_ID}
- elif operation == 'show':
- function = self.client.show_interface
- elif operation == 'delete':
- expected_op = {}
- mock_operation = self.func2mock['delete']
- function = self.client.delete_interface
- response_code = 202
- else:
- function = self.client.create_interface
- mock_operation = self.func2mock['post']
-
- self.check_service_client_function(
- function, mock_operation, expected_op,
- bytes_body, response_code, **params)
-
- def test_list_interfaces_with_str_body(self):
- self._test_interface_operation('list')
-
- def test_list_interfaces_with_bytes_body(self):
- self._test_interface_operation('list', True)
-
- def test_show_interface_with_str_body(self):
- self._test_interface_operation('show')
-
- def test_show_interface_with_bytes_body(self):
- self._test_interface_operation('show', True)
-
- def test_delete_interface_with_str_body(self):
- self._test_interface_operation('delete')
-
- def test_delete_interface_with_bytes_body(self):
- self._test_interface_operation('delete', True)
-
- def test_create_interface_with_str_body(self):
- self._test_interface_operation()
-
- def test_create_interface_with_bytes_body(self):
- self._test_interface_operation(bytes_body=True)
diff --git a/tempest/tests/services/compute/test_servers_client.py b/tempest/tests/services/compute/test_servers_client.py
index e347cf1..95b81c1 100644
--- a/tempest/tests/services/compute/test_servers_client.py
+++ b/tempest/tests/services/compute/test_servers_client.py
@@ -12,6 +12,7 @@
# 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
@@ -34,6 +35,24 @@
"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": "",
@@ -116,6 +135,48 @@
]}
}
+ 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'
@@ -206,7 +267,733 @@
self.client.list_addresses_by_network,
'tempest.common.service_client.ServiceClient.get',
self.FAKE_ADDRESS['addresses'],
- bytes_body,
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,
+ reboot_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,
+ console_type='fake-console-type'
+ )